5.0.4-stable review
Greg Kroah-Hartman
maintainerPATCH 141/238 clk: samsung: exynos5: Fix possible NULL pointer exception on platform_device_alloc() failure
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 5f0b6216ea381b43c0dff88702d6cc5673d63922 upstream.
During initialization of subdevices if platform_device_alloc() failed, returned NULL pointer will be later dereferenced. Add proper error paths to exynos5_clk_register_subcmu(). The return value of this function is still ignored because at this stage of init there is nothing we can do.
--- drivers/clk/samsung/clk-exynos5-subcmu.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/clk/samsung/clk-exynos5-subcmu.c +8 -2
@@ -136,15 +136,21 @@ static int __init exynos5_clk_register_s {struct of_phandle_args genpdspec = { .np = pd_node };struct platform_device *pdev; +int ret; pdev =platform_device_alloc (info->pd_name,-1 ); +if (!pdev) +return -ENOMEM ; + pdev->dev.parent = parent; pdev->driver_override ="exynos5-subcmu" ;platform_set_drvdata (pdev, (void *)info);of_genpd_add_device (&genpdspec, &pdev->dev); -platform_device_add (pdev); + ret =platform_device_add (pdev); +if (ret) +platform_device_put (pdev); -return 0 ; +return ret; }static int __init exynos5_clk_probe (struct platform_device *pdev)
Greg Kroah-Hartman
maintainerPATCH 142/238 clk: samsung: exynos5: Fix kfree() of const memory on setting driver_override
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 785c9f411eb2d9a6076d3511c631587d5e676bf3 upstream.
Platform driver driver_override field should not be initialized from const memory because the core later kfree() it. If driver_override is manually set later through sysfs, kfree() of old value leads to:
$ echo "new_value" > /sys/bus/platform/drivers/.../driver_override
kernel BUG at ../mm/slub.c:3960!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
...
(kfree) from [<c058e8c0>] (platform_set_driver_override+0x84/0xac)
(platform_set_driver_override) from [<c058e908>] (driver_override_store+0x20/0x34)
(driver_override_store) from [<c031f778>] (kernfs_fop_write+0x100/0x1dc)
(kernfs_fop_write) from [<c0296de8>] (__vfs_write+0x2c/0x17c)
(__vfs_write) from [<c02970c4>] (vfs_write+0xa4/0x188)
(vfs_write) from [<c02972e8>] (ksys_write+0x4c/0xac)
(ksys_write) from [<c0101000>] (ret_fast_syscall+0x0/0x28)The clk-exynos5-subcmu driver uses override only for the purpose of creating meaningful names for children devices (matching names of power domains, e.g. DISP, MFC). The driver_override was not developed for this purpose so just switch to default names of devices to fix the issue.
--- drivers/clk/samsung/clk-exynos5-subcmu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/clk/samsung/clk-exynos5-subcmu.c +1 -2
@@ -138,12 +138,11 @@ static int __init exynos5_clk_register_sstruct platform_device *pdev;int ret; - pdev =platform_device_alloc (info->pd_name,-1 ); + pdev =platform_device_alloc ("exynos5-subcmu" ,PLATFORM_DEVID_AUTO );if (!pdev)return -ENOMEM ; pdev->dev.parent = parent; - pdev->driver_override ="exynos5-subcmu" ;platform_set_drvdata (pdev, (void *)info);of_genpd_add_device (&genpdspec, &pdev->dev); ret =platform_device_add (pdev);
Greg Kroah-Hartman
maintainerPATCH 143/238 clk: ingenic: Fix round_rate misbehaving with non-integer dividers
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Cercueil <[email protected]>
commit bc5d922c93491878c44c9216e9d227c7eeb81d7f upstream.
Take a parent rate of 180 MHz, and a requested rate of 4.285715 MHz. This results in a theorical divider of 41.999993 which is then rounded up to 42. The .round_rate function would then return (180 MHz / 42) as the clock, rounded down, so 4.285714 MHz.
Calling clk_set_rate on 4.285714 MHz would round the rate again, and give a theorical divider of 42,0000028, now rounded up to 43, and the rate returned would be (180 MHz / 43) which is 4.186046 MHz, aka. not what we requested.
Fix this by rounding up the divisions.
--- drivers/clk/ingenic/cgu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/ingenic/cgu.c +5 -5
@@ -426,16 +426,16 @@ ingenic_clk_round_rate(struct clk_hw *hwstruct ingenic_clk *ingenic_clk =to_ingenic_clk (hw);struct ingenic_cgu *cgu = ingenic_clk->cgu;const struct ingenic_cgu_clk_info *clk_info; -long rate = *parent_rate; +unsigned int div =1 ; clk_info = &cgu->clock_info[ingenic_clk->idx];if (clk_info->type &CGU_CLK_DIV ) - rate /=ingenic_clk_calc_div (clk_info, *parent_rate, req_rate); + div =ingenic_clk_calc_div (clk_info, *parent_rate, req_rate);else if (clk_info->type &CGU_CLK_FIXDIV ) - rate /= clk_info->fixdiv.div; + div = clk_info->fixdiv.div; -return rate; +return DIV_ROUND_UP (*parent_rate, div); } static int
@@ -455,7 +455,7 @@ ingenic_clk_set_rate(struct clk_hw *hw,if (clk_info->type &CGU_CLK_DIV ) { div =ingenic_clk_calc_div (clk_info, parent_rate, req_rate); - rate = parent_rate / div; + rate =DIV_ROUND_UP (parent_rate, div);if (rate != req_rate)return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 144/238 clk: ingenic: Fix doc of ingenic_cgu_div_info
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Cercueil <[email protected]>
commit 7ca4c922aad2e3c46767a12f80d01c6b25337b59 upstream.
The 'div' field does not represent a number of bits used to divide (understand: right-shift) the divider, but a number itself used to divide the divider.
--- drivers/clk/ingenic/cgu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/ingenic/cgu.h +1 -1
@@ -80,7 +80,7 @@ struct ingenic_cgu_mux_info {* @reg: offset of the divider control register within the CGU * @shift: number of bits to left shift the divide value by (ie. the index of * the lowest bit of the divide value within its control register) -* @div: number of bits to divide the divider value by (i.e. if the +* @div: number to divide the divider value by (i.e. if the * effective divider value is the value written to the register * multiplied by some constant) * @bits: the size of the divide value in bits
Greg Kroah-Hartman
maintainerPATCH 145/238 usb: chipidea: tegra: Fix missed ci_hdrc_remove_device()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Osipenko <[email protected]>
commit 563b9372f7ec57e44e8f9a8600c5107d7ffdd166 upstream.
The ChipIdea's platform device need to be unregistered on Tegra's driver module removal.
--- drivers/usb/chipidea/ci_hdrc_tegra.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/chipidea/ci_hdrc_tegra.c +1 -0
@@ -130,6 +130,7 @@ static int tegra_udc_remove(struct platf {struct tegra_udc *udc =platform_get_drvdata (pdev); +ci_hdrc_remove_device (udc->dev);usb_phy_set_suspend (udc->phy,1 );clk_disable_unprepare (udc->clk);
Greg Kroah-Hartman
maintainerPATCH 146/238 usb: typec: tps6598x: handle block writes separately with plain-I2C adapters
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolaus Voss <[email protected]>
commit 8a863a608d47fa5d9dd15cf841817f73f804cf91 upstream.
Commit 1a2f474d328f handles block _reads_ separately with plain-I2C adapters, but the problem described with regmap-i2c not handling SMBus block transfers (i.e. read and writes) correctly also exists with writes.
As workaround, this patch adds a block write function the same way 1a2f474d328f adds a block read function.
--- drivers/usb/typec/tps6598x.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
drivers/usb/typec/tps6598x.c +20 -6
@@ -110,6 +110,20 @@ tps6598x_block_read(struct tps6598x *tpsreturn 0 ; } +static int tps6598x_block_write (struct tps6598x *tps,u8 reg, +void *val,size_t len) +{ +u8 data[TPS_MAX_LEN +1 ]; + +if (!tps->i2c_protocol) +return regmap_raw_write (tps->regmap, reg, val, len); + + data[0 ] = len; +memcpy (&data[1 ], val, len); + +return regmap_raw_write (tps->regmap, reg, data,sizeof (data)); +} +static inline int tps6598x_read16 (struct tps6598x *tps,u8 reg,u16 *val) {return tps6598x_block_read (tps, reg, val,sizeof (u16));
@@ -127,23 +141,23 @@ static inline int tps6598x_read64(structstatic inline int tps6598x_write16 (struct tps6598x *tps,u8 reg,u16 val) { -return regmap_raw_write (tps->regmap, reg, &val,sizeof (u16)); +return tps6598x_block_write (tps, reg, &val,sizeof (u16)); }static inline int tps6598x_write32 (struct tps6598x *tps,u8 reg,u32 val) { -return regmap_raw_write (tps->regmap, reg, &val,sizeof (u32)); +return tps6598x_block_write (tps, reg, &val,sizeof (u32)); }static inline int tps6598x_write64 (struct tps6598x *tps,u8 reg,u64 val) { -return regmap_raw_write (tps->regmap, reg, &val,sizeof (u64)); +return tps6598x_block_write (tps, reg, &val,sizeof (u64)); }static inline int tps6598x_write_4cc (struct tps6598x *tps,u8 reg,const char *val) { -return regmap_raw_write (tps->regmap, reg, &val,sizeof (u32)); +return tps6598x_block_write (tps, reg, &val,sizeof (u32)); }static int tps6598x_read_partner_identity (struct tps6598x *tps)
@@ -229,8 +243,8 @@ static int tps6598x_exec_cmd(struct tps6return -EBUSY ;if (in_len) { - ret =regmap_raw_write (tps->regmap,TPS_REG_DATA1 , - in_data, in_len); + ret =tps6598x_block_write (tps,TPS_REG_DATA1 , + in_data, in_len);if (ret)return ret; }
Greg Kroah-Hartman
maintainerPATCH 147/238 dmaengine: usb-dmac: Make DMAC system sleep callbacks explicit
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phuong Nguyen <[email protected]>
commit d9140a0da4a230a03426d175145989667758aa6a upstream.
This commit fixes the issue that USB-DMAC hangs silently after system resumes on R-Car Gen3 hence renesas_usbhs will not work correctly when using USB-DMAC for bulk transfer e.g. ethernet or serial gadgets.
The issue can be reproduced by these steps:
1. modprobe g_serial
2. Suspend and resume system.
3. connect a usb cable to host side
4. Transfer data from Host to Target
5. cat /dev/ttyGS0 (Target side)
6. echo "test" > /dev/ttyACM0 (Host side)
The 'cat' will not result anything. However, system still can work normally.
Currently, USB-DMAC driver does not have system sleep callbacks hence this driver relies on the PM core to force runtime suspend/resume to suspend and reinitialize USB-DMAC during system resume. After the commit 17218e0092f8 ("PM / genpd: Stop/start devices without pm_runtime_force_suspend/resume()"), PM core will not force runtime suspend/resume anymore so this issue happens.
To solve this, make system suspend resume explicit by using pm_runtime_force_{suspend,resume}() as the system sleep callbacks. SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() is used to make sure USB-DMAC suspended after and initialized before renesas_usbhs."
--- drivers/dma/sh/usb-dmac.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/dma/sh/usb-dmac.c +2 -0
@@ -694,6 +694,8 @@ static int usb_dmac_runtime_resume(struc#endif /* CONFIG_PM */ static const struct dev_pm_ops usb_dmac_pm = { + SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume)SET_RUNTIME_PM_OPS (usb_dmac_runtime_suspend, usb_dmac_runtime_resume,NULL ) };
Greg Kroah-Hartman
maintainerPATCH 148/238 serial: uartps: Fix stuck ISR if RX disabled with non-empty FIFO
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anssi Hannula <[email protected]>
commit 7abab1605139bc41442864c18f9573440f7ca105 upstream.
If RX is disabled while there are still unprocessed bytes in RX FIFO, cdns_uart_handle_rx() called from interrupt handler will get stuck in the receive loop as read bytes will not get removed from the RX FIFO and CDNS_UART_SR_RXEMPTY bit will never get set.
Avoid the stuck handler by checking first if RX is disabled. port->lock protects against race with RX-disabling functions.
This HW behavior was mentioned by Nathan Rossi in 43e98facc4a3 ("tty:
xuartps: Fix RX hang, and TX corruption in termios call") which fixed a similar issue in cdns_uart_set_termios().
The behavior can also be easily verified by e.g. setting CDNS_UART_CR_RX_DIS at the beginning of cdns_uart_handle_rx() - the following loop will then get stuck.
Resetting the FIFO using RXRST would not set RXEMPTY either so simply issuing a reset after RX-disable would not work.
I observe this frequently on a ZynqMP board during heavy RX load at 1M baudrate when the reader process exits and thus RX gets disabled.
--- drivers/tty/serial/xilinx_uartps.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/tty/serial/xilinx_uartps.c +7 -1
@@ -364,7 +364,13 @@ static irqreturn_t cdns_uart_isr(int irqcdns_uart_handle_tx (dev_id); isrstatus &= ~CDNS_UART_IXR_TXEMPTY ; } -if (isrstatus &CDNS_UART_IXR_RXMASK ) + +/* +* Skip RX processing if RX is disabled as RXEMPTY will never be set +* as read bytes will not be removed from the FIFO. +*/ +if (isrstatus &CDNS_UART_IXR_RXMASK && + !(readl (port->membase +CDNS_UART_CR ) &CDNS_UART_CR_RX_DIS ))cdns_uart_handle_rx (dev_id, isrstatus);spin_unlock (&port->lock);
Greg Kroah-Hartman
maintainerPATCH 149/238 serial: 8250_of: assume reg-shift of 2 for mrvl,mmp-uart
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lubomir Rintel <[email protected]>
commit f4817843e39ce78aace0195a57d4e8500a65a898 upstream.
There are two other drivers that bind to mrvl,mmp-uart and both of them assume register shift of 2 bits. There are device trees that lack the property and rely on that assumption.
If this driver wins the race to bind to those devices, it should behave the same as the older deprecated driver.
--- drivers/tty/serial/8250/8250_of.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/tty/serial/8250/8250_of.c +4 -0
@@ -130,6 +130,10 @@ static int of_platform_serial_setup(stru port->flags |=UPF_IOREMAP ; } +/* Compatibility with the deprecated pxa driver and 8250_pxa drivers. */ +if (of_device_is_compatible (np,"mrvl,mmp-uart" )) + port->regshift =2 ; +/* Check for registers offset within the devices address range */ if (of_property_read_u32 (np,"reg-shift" , &prop) ==0 ) port->regshift = prop;
Greg Kroah-Hartman
maintainerPATCH 150/238 serial: 8250_pci: Fix number of ports for ACCES serial cards
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jay Dolan <[email protected]>
commit b896b03bc7fce43a07012cc6bf5e2ab2fddf3364 upstream.
Have the correct number of ports created for ACCES serial cards. Two port cards show up as four ports, and four port cards show up as eight.
--- drivers/tty/serial/8250/8250_pci.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
drivers/tty/serial/8250/8250_pci.c +18 -18
@@ -4575,10 +4575,10 @@ static const struct pci_device_id serial*/ {PCI_VENDOR_ID_ACCESIO ,PCI_DEVICE_ID_ACCESIO_PCIE_COM_2SDB ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , - pbn_pericom_PI7C9X7954 }, + pbn_pericom_PI7C9X7952 }, { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_COM_2S,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , - pbn_pericom_PI7C9X7954 }, + pbn_pericom_PI7C9X7952 }, { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SDB,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , pbn_pericom_PI7C9X7954 },
@@ -4587,10 +4587,10 @@ static const struct pci_device_id serial pbn_pericom_PI7C9X7954 }, {PCI_VENDOR_ID_ACCESIO ,PCI_DEVICE_ID_ACCESIO_PCIE_COM232_2DB ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , - pbn_pericom_PI7C9X7954 }, + pbn_pericom_PI7C9X7952 }, { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_COM232_2,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , - pbn_pericom_PI7C9X7954 }, + pbn_pericom_PI7C9X7952 }, { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM232_4DB,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , pbn_pericom_PI7C9X7954 },
@@ -4599,10 +4599,10 @@ static const struct pci_device_id serial pbn_pericom_PI7C9X7954 }, {PCI_VENDOR_ID_ACCESIO ,PCI_DEVICE_ID_ACCESIO_PCIE_COM_2SMDB ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , - pbn_pericom_PI7C9X7954 }, + pbn_pericom_PI7C9X7952 }, { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_COM_2SM,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , - pbn_pericom_PI7C9X7954 }, + pbn_pericom_PI7C9X7952 }, { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SMDB,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , pbn_pericom_PI7C9X7954 },
@@ -4611,13 +4611,13 @@ static const struct pci_device_id serial pbn_pericom_PI7C9X7954 }, {PCI_VENDOR_ID_ACCESIO ,PCI_DEVICE_ID_ACCESIO_MPCIE_ICM485_1 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , - pbn_pericom_PI7C9X7954 }, + pbn_pericom_PI7C9X7951 }, { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM422_2,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , - pbn_pericom_PI7C9X7954 }, + pbn_pericom_PI7C9X7952 }, { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM485_2,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , - pbn_pericom_PI7C9X7954 }, + pbn_pericom_PI7C9X7952 }, { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM422_4,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , pbn_pericom_PI7C9X7954 },
@@ -4626,16 +4626,16 @@ static const struct pci_device_id serial pbn_pericom_PI7C9X7954 }, {PCI_VENDOR_ID_ACCESIO ,PCI_DEVICE_ID_ACCESIO_PCIE_ICM_2S ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , - pbn_pericom_PI7C9X7954 }, + pbn_pericom_PI7C9X7952 }, { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM_4S,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , pbn_pericom_PI7C9X7954 }, { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM232_2,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , - pbn_pericom_PI7C9X7954 }, + pbn_pericom_PI7C9X7952 }, { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM232_2,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , - pbn_pericom_PI7C9X7954 }, + pbn_pericom_PI7C9X7952 }, { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM232_4,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , pbn_pericom_PI7C9X7954 },
@@ -4644,13 +4644,13 @@ static const struct pci_device_id serial pbn_pericom_PI7C9X7954 }, {PCI_VENDOR_ID_ACCESIO ,PCI_DEVICE_ID_ACCESIO_PCIE_ICM_2SM ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , - pbn_pericom_PI7C9X7954 }, + pbn_pericom_PI7C9X7952 }, { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM422_4,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , - pbn_pericom_PI7C9X7958 }, + pbn_pericom_PI7C9X7954 }, { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM485_4,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , - pbn_pericom_PI7C9X7958 }, + pbn_pericom_PI7C9X7954 }, { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM422_8,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , pbn_pericom_PI7C9X7958 },
@@ -4659,19 +4659,19 @@ static const struct pci_device_id serial pbn_pericom_PI7C9X7958 }, {PCI_VENDOR_ID_ACCESIO ,PCI_DEVICE_ID_ACCESIO_PCIE_COM232_4 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , - pbn_pericom_PI7C9X7958 }, + pbn_pericom_PI7C9X7954 }, { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM232_8,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , pbn_pericom_PI7C9X7958 }, { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SM,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , - pbn_pericom_PI7C9X7958 }, + pbn_pericom_PI7C9X7954 }, { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_8SM,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , pbn_pericom_PI7C9X7958 }, { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM_4SM,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , - pbn_pericom_PI7C9X7958 }, + pbn_pericom_PI7C9X7954 },/* * Topic TP560 Data/Fax/Voice 56k modem (reported by Evan Clarke) */
Greg Kroah-Hartman
maintainerPATCH 151/238 serial: 8250_pci: Have ACCES cards that use the four port Pericom PI7C9X7954 chip use the pci_pericom_setup()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jay Dolan <[email protected]>
commit 78d3820b9bd39028727c6aab7297b63c093db343 upstream.
The four port Pericom chips have the fourth port at the wrong address. Make use of quirk to fix it.
--- drivers/tty/serial/8250/8250_pci.c | 105 +++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+)
drivers/tty/serial/8250/8250_pci.c +105 -0
@@ -2027,6 +2027,111 @@ static struct pci_serial_quirk pci_seria .setup = pci_default_setup, .exit = pci_plx9050_exit, }, + { + .vendor = PCI_VENDOR_ID_ACCESIO, + .device = PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SDB, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, + { + .vendor = PCI_VENDOR_ID_ACCESIO, + .device = PCI_DEVICE_ID_ACCESIO_MPCIE_COM_4S, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, + { + .vendor = PCI_VENDOR_ID_ACCESIO, + .device = PCI_DEVICE_ID_ACCESIO_PCIE_COM232_4DB, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, + { + .vendor = PCI_VENDOR_ID_ACCESIO, + .device = PCI_DEVICE_ID_ACCESIO_MPCIE_COM232_4, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, + { + .vendor = PCI_VENDOR_ID_ACCESIO, + .device = PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SMDB, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, + { + .vendor = PCI_VENDOR_ID_ACCESIO, + .device = PCI_DEVICE_ID_ACCESIO_MPCIE_COM_4SM, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, + { + .vendor = PCI_VENDOR_ID_ACCESIO, + .device = PCI_DEVICE_ID_ACCESIO_MPCIE_ICM422_4, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, + { + .vendor = PCI_VENDOR_ID_ACCESIO, + .device = PCI_DEVICE_ID_ACCESIO_MPCIE_ICM485_4, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, + { + .vendor = PCI_DEVICE_ID_ACCESIO_PCIE_ICM_4S, + .device = PCI_DEVICE_ID_ACCESIO_PCIE_ICM232_4, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, + { + .vendor = PCI_VENDOR_ID_ACCESIO, + .device = PCI_DEVICE_ID_ACCESIO_MPCIE_ICM232_4, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, + { + .vendor = PCI_VENDOR_ID_ACCESIO, + .device = PCI_DEVICE_ID_ACCESIO_PCIE_COM422_4, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, + { + .vendor = PCI_VENDOR_ID_ACCESIO, + .device = PCI_DEVICE_ID_ACCESIO_PCIE_COM485_4, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, + { + .vendor = PCI_VENDOR_ID_ACCESIO, + .device = PCI_DEVICE_ID_ACCESIO_PCIE_COM232_4, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, + { + .vendor = PCI_VENDOR_ID_ACCESIO, + .device = PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SM, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, + { + .vendor = PCI_VENDOR_ID_ACCESIO, + .device = PCI_DEVICE_ID_ACCESIO_PCIE_ICM_4SM, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, /* * SBS Technologies, Inc., PMC-OCTALPRO 232 */
Greg Kroah-Hartman
maintainerPATCH 152/238 jbd2: clear dirty flag when revoking a buffer from an older transaction
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: zhangyi (F) <[email protected]>
commit 904cdbd41d749a476863a0ca41f6f396774f26e4 upstream.
Now, we capture a data corruption problem on ext4 while we're truncating an extent index block. Imaging that if we are revoking a buffer which has been journaled by the committing transaction, the buffer's jbddirty flag will not be cleared in jbd2_journal_forget(), so the commit code will set the buffer dirty flag again after refile the buffer.
fsx kjournald2
jbd2_journal_commit_transactionjbd2_journal_revoke commit phase 1~5...
jbd2_journal_forget
belongs to older transaction commit phase 6
jbddirty not clear __jbd2_journal_refile_buffer
__jbd2_journal_unfile_buffer
test_clear_buffer_jbddirty
mark_buffer_dirty
Finally, if the freed extent index block was allocated again as data block by some other files, it may corrupt the file data after writing cached pages later, such as during unmount time. (In general, clean_bdev_aliases() related helpers should be invoked after re-allocation to prevent the above corruption, but unfortunately we missed it when zeroout the head of extra extent blocks in ext4_ext_handle_unwritten_extents()).
This patch mark buffer as freed and set j_next_transaction to the new transaction when it already belongs to the committing transaction in jbd2_journal_forget(), so that commit code knows it should clear dirty bits when it is done with the buffer.
This problem can be reproduced by xfstests generic/455 easily with seeds (3246 3247 3248 3249).
--- fs/jbd2/transaction.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
fs/jbd2/transaction.c +12 -5
@@ -1609,14 +1609,21 @@ int jbd2_journal_forget (handle_t *handl/* However, if the buffer is still owned by a prior * (committing) transaction, we can't drop it yet... */ JBUFFER_TRACE (jh,"belongs to older transaction" ); -/* ... but we CAN drop it from the new transaction if we -* have also modified it since the original commit. */ +/* ... but we CAN drop it from the new transaction through +* marking the buffer as freed and set j_next_transaction to +* the new transaction, so that not only the commit code +* knows it should clear dirty bits when it is done with the +* buffer, but also the buffer can be checkpointed only +* after the new transaction commits. */ -if (jh->b_next_transaction) { -J_ASSERT (jh->b_next_transaction == transaction); +set_buffer_freed (bh); + +if (!jh->b_next_transaction) {spin_lock (&journal->j_list_lock); - jh->b_next_transaction =NULL ; + jh->b_next_transaction = transaction;spin_unlock (&journal->j_list_lock); + }else { +J_ASSERT (jh->b_next_transaction == transaction);/* * only drop a reference if this transaction modified
Greg Kroah-Hartman
maintainerPATCH 153/238 jbd2: fix compile warning when using JBUFFER_TRACE
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: zhangyi (F) <[email protected]>
commit 01215d3edb0f384ddeaa5e4a22c1ae5ff634149f upstream.
The jh pointer may be used uninitialized in the two cases below and the compiler complain about it when enabling JBUFFER_TRACE macro, fix them.
In file included from fs/jbd2/transaction.c:19:0:fs/jbd2/transaction.c: In function ‘jbd2_journal_get_undo_access’:./include/linux/jbd2.h:1637:38: warning: ‘jh’ is used uninitialized in this function [-Wuninitialized]
#define JBUFFER_TRACE(jh, info) do { printk("%s: %d\n", __func__, jh->b_jcount);} while (0)
^
fs/jbd2/transaction.c:1219:23: note: ‘jh’ was declared here
struct journal_head *jh;
^
In file included from fs/jbd2/transaction.c:19:0:
fs/jbd2/transaction.c: In function ‘jbd2_journal_dirty_metadata’:
./include/linux/jbd2.h:1637:38: warning: ‘jh’ may be used uninitialized in this function [-Wmaybe-uninitialized]
#define JBUFFER_TRACE(jh, info) do { printk("%s: %d\n", __func__, jh->b_jcount);} while (0)
^
fs/jbd2/transaction.c:1332:23: note: ‘jh’ was declared here
struct journal_head *jh;
^--- fs/jbd2/transaction.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
fs/jbd2/transaction.c +8 -8
@@ -1252,11 +1252,12 @@ int jbd2_journal_get_undo_access(handle_struct journal_head *jh;char *committed_data =NULL ; -JBUFFER_TRACE (jh,"entry" );if (jbd2_write_access_granted (handle, bh, true))return 0 ; jh =jbd2_journal_add_journal_head (bh); +JBUFFER_TRACE (jh,"entry" ); +/* * Do this first --- it can drop the journal lock, so we want to * make sure that obtaining the committed_data is done
@@ -1367,15 +1368,17 @@ int jbd2_journal_dirty_metadata(handle_tif (is_handle_aborted (handle))return -EROFS ; -if (!buffer_jbd (bh)) { - ret = -EUCLEAN ; - goto out; - } +if (!buffer_jbd (bh)) +return -EUCLEAN ; +/* * We don't grab jh reference here since the buffer must be part * of the running transaction. */ jh =bh2jh (bh); +jbd_debug (5 ,"journal_head %p\n" , jh); +JBUFFER_TRACE (jh,"entry" ); +/* * This and the following assertions are unreliable since we may see jh * in inconsistent state unless we grab bh_state lock. But this is
@@ -1409,9 +1412,6 @@ int jbd2_journal_dirty_metadata(handle_t } journal = transaction->t_journal; -jbd_debug (5 ,"journal_head %p\n" , jh); -JBUFFER_TRACE (jh,"entry" ); -jbd_lock_bh_state (bh);if (jh->b_modified ==0 ) {
Greg Kroah-Hartman
maintainerPATCH 154/238 selinux: add the missing walk_size + len check in selinux_sctp_bind_connect
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
commit 292c997a1970f8d1e1dfa354ed770a22f7b5a434 upstream.
As does in __sctp_connect(), when checking addrs in a while loop, after get the addr len according to sa_family, it's necessary to do the check walk_size + af->sockaddr_len > addrs_size to make sure it won't access an out-of-bounds addr.
The same thing is needed in selinux_sctp_bind_connect(), otherwise an out-of-bounds issue can be triggered:
[14548.772313] BUG: KASAN: slab-out-of-bounds in selinux_sctp_bind_connect+0x1aa/0x1f0 [14548.927083] Call Trace: [14548.938072] dump_stack+0x9a/0xe9 [14548.953015] print_address_description+0x65/0x22e [14548.996524] kasan_report.cold.6+0x92/0x1a6 [14549.015335] selinux_sctp_bind_connect+0x1aa/0x1f0 [14549.036947] security_sctp_bind_connect+0x58/0x90 [14549.058142] __sctp_setsockopt_connectx+0x5a/0x150 [sctp] [14549.081650] sctp_setsockopt.part.24+0x1322/0x3ce0 [sctp]
--- security/selinux/hooks.c | 3 +++ 1 file changed, 3 insertions(+)
security/selinux/hooks.c +3 -0
@@ -5120,6 +5120,9 @@ static int selinux_sctp_bind_connect(strreturn -EINVAL ; } +if (walk_size + len > addrlen) +return -EINVAL ; + err = -EINVAL ;switch (optname) {/* Bind checks */
Greg Kroah-Hartman
maintainerPATCH 155/238 security/selinux: fix SECURITY_LSM_NATIVE_LABELS on reused superblock
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: J. Bruce Fields <[email protected]>
commit 3815a245b50124f0865415dcb606a034e97494d4 upstream.
In the case when we're reusing a superblock, selinux_sb_clone_mnt_opts() fails to set set_kern_flags, with the result that nfs_clone_sb_security() incorrectly clears NFS_CAP_SECURITY_LABEL.
The result is that if you mount the same NFS filesystem twice, NFS security labels are turned off, even if they would work fine if you mounted the filesystem only once.
("fixes" may be not exactly the right tag, it may be more like "fixed-other-cases-but-missed-this-one".)
--- security/selinux/hooks.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
security/selinux/hooks.c +4 -1
@@ -959,8 +959,11 @@ static int selinux_sb_clone_mnt_opts(conBUG_ON (!(oldsbsec->flags &SE_SBINITIALIZED ));/* if fs is reusing a sb, make sure that the contexts match */ -if (newsbsec->flags &SE_SBINITIALIZED ) +if (newsbsec->flags &SE_SBINITIALIZED ) { +if ((kern_flags &SECURITY_LSM_NATIVE_LABELS ) && !set_context) + *set_kern_flags |=SECURITY_LSM_NATIVE_LABELS ;return selinux_cmp_sb_context (oldsb, newsb); + }mutex_lock (&newsbsec->lock);
Greg Kroah-Hartman
maintainerPATCH 156/238 powerpc/32: Clear on-stack exception marker upon exception return
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
commit 9580b71b5a7863c24a9bd18bcd2ad759b86b1eff upstream.
Clear the on-stack STACK_FRAME_REGS_MARKER on exception exit in order to avoid confusing stacktrace like the one below.
Call Trace:
[c0e9dca0] [c01c42a0] print_address_description+0x64/0x2bc (unreliable)
[c0e9dcd0] [c01c4684] kasan_report+0xfc/0x180
[c0e9dd10] [c0895130] memchr+0x24/0x74
[c0e9dd30] [c00a9e38] msg_print_text+0x124/0x574
[c0e9dde0] [c00ab710] console_unlock+0x114/0x4f8
[c0e9de40] [c00adc60] vprintk_emit+0x188/0x1c4
--- interrupt: c0e9df00 at 0x400f330
LR = init_stack+0x1f00/0x2000
[c0e9de80] [c00ae3c4] printk+0xa8/0xcc (unreliable)
[c0e9df20] [c0c27e44] early_irq_init+0x38/0x108
[c0e9df50] [c0c15434] start_kernel+0x310/0x488
[c0e9dff0] [00003484] 0x3484With this patch the trace becomes:
Call Trace: [c0e9dca0] [c01c42c0] print_address_description+0x64/0x2bc (unreliable) [c0e9dcd0] [c01c46a4] kasan_report+0xfc/0x180 [c0e9dd10] [c0895150] memchr+0x24/0x74 [c0e9dd30] [c00a9e58] msg_print_text+0x124/0x574 [c0e9dde0] [c00ab730] console_unlock+0x114/0x4f8 [c0e9de40] [c00adc80] vprintk_emit+0x188/0x1c4 [c0e9de80] [c00ae3e4] printk+0xa8/0xcc [c0e9df20] [c0c27e44] early_irq_init+0x38/0x108 [c0e9df50] [c0c15434] start_kernel+0x310/0x488 [c0e9dff0] [00003484] 0x3484
--- arch/powerpc/kernel/entry_32.S | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/powerpc/kernel/entry_32.S +9 -0
@@ -745,6 +745,9 @@ fast_exception_return: mtcr r10 lwz r10,_LINK(r11) mtlr r10 + /* Clear the exception_marker on the stack to avoid confusing stacktrace */ + li r10, 0 + stw r10, 8(r11) REST_GPR(10, r11) #if defined(CONFIG_PPC_8xx) && defined(CONFIG_PERF_EVENTS) mtspr SPRN_NRI, r0
@@ -982,6 +985,9 @@ END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRE mtcrf 0xFF,r10 mtlr r11 + /* Clear the exception_marker on the stack to avoid confusing stacktrace */ + li r10, 0 + stw r10, 8(r1) /* * Once we put values in SRR0 and SRR1, we are in a state * where exceptions are not recoverable, since taking an
@@ -1021,6 +1027,9 @@ exc_exit_restart_end: mtlr r11 lwz r10,_CCR(r1) mtcrf 0xff,r10 + /* Clear the exception_marker on the stack to avoid confusing stacktrace */ + li r10, 0 + stw r10, 8(r1) REST_2GPRS(9, r1) .globl exc_exit_restart exc_exit_restart:
Greg Kroah-Hartman
maintainerPATCH 157/238 powerpc/wii: properly disable use of BATs when requested.
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
commit 6d183ca8baec983dc4208ca45ece3c36763df912 upstream.
'nobats' kernel parameter or some options like CONFIG_DEBUG_PAGEALLOC deny the use of BATS for mapping memory.
This patch makes sure that the specific wii RAM mapping function takes it into account as well.
--- arch/powerpc/platforms/embedded6xx/wii.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/powerpc/platforms/embedded6xx/wii.c +4 -0
@@ -83,6 +83,10 @@ unsigned long __init wii_mmu_mapin_mem2(/* MEM2 64MB@0x10000000 */ delta = wii_hole_start + wii_hole_size; size = top - delta; + +if (__map_without_bats) +return delta; +for (bl =128 <<10 ; bl < max_size; bl <<=1 ) {if (bl *2 > size)break ;
Greg Kroah-Hartman
maintainerPATCH 158/238 powerpc/powernv: Make opal log only readable by root
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jordan Niethe <[email protected]>
commit 7b62f9bd2246b7d3d086e571397c14ba52645ef1 upstream.
Currently the opal log is globally readable. It is kernel policy to limit the visibility of physical addresses / kernel pointers to root. Given this and the fact the opal log may contain this information it would be better to limit the readability to root.
--- arch/powerpc/platforms/powernv/opal-msglog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/powernv/opal-msglog.c +1 -1
@@ -98,7 +98,7 @@ static ssize_t opal_msglog_read(struct f }static struct bin_attribute opal_msglog_attr = { - .attr = {.name ="msglog" , .mode =0444 }, + .attr = {.name ="msglog" , .mode =0400 }, .read = opal_msglog_read };
Greg Kroah-Hartman
maintainerPATCH 159/238 powerpc/83xx: Also save/restore SPRG4-7 during suspend
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
commit 36da5ff0bea2dc67298150ead8d8471575c54c7d upstream.
The 83xx has 8 SPRG registers and uses at least SPRG4 for DTLB handling LRU.
--- arch/powerpc/platforms/83xx/suspend-asm.S | 34 +++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-)
arch/powerpc/platforms/83xx/suspend-asm.S +27 -7
@@ -26,13 +26,13 @@ #define SS_MSR 0x74 #define SS_SDR1 0x78 #define SS_LR 0x7c -#define SS_SPRG 0x80 /* 4 SPRGs */ -#define SS_DBAT 0x90 /* 8 DBATs */ -#define SS_IBAT 0xd0 /* 8 IBATs */ -#define SS_TB 0x110 -#define SS_CR 0x118 -#define SS_GPREG 0x11c /* r12-r31 */ -#define STATE_SAVE_SIZE 0x16c +#define SS_SPRG 0x80 /* 8 SPRGs */ +#define SS_DBAT 0xa0 /* 8 DBATs */ +#define SS_IBAT 0xe0 /* 8 IBATs */ +#define SS_TB 0x120 +#define SS_CR 0x128 +#define SS_GPREG 0x12c /* r12-r31 */ +#define STATE_SAVE_SIZE 0x17c .section .data .align 5
@@ -103,6 +103,16 @@ _GLOBAL(mpc83xx_enter_deep_sleep) stw r7, SS_SPRG+12(r3) stw r8, SS_SDR1(r3) + mfspr r4, SPRN_SPRG4 + mfspr r5, SPRN_SPRG5 + mfspr r6, SPRN_SPRG6 + mfspr r7, SPRN_SPRG7 + + stw r4, SS_SPRG+16(r3) + stw r5, SS_SPRG+20(r3) + stw r6, SS_SPRG+24(r3) + stw r7, SS_SPRG+28(r3) + mfspr r4, SPRN_DBAT0U mfspr r5, SPRN_DBAT0L mfspr r6, SPRN_DBAT1U
@@ -493,6 +503,16 @@ mpc83xx_deep_resume: mtspr SPRN_IBAT7U, r6 mtspr SPRN_IBAT7L, r7 + lwz r4, SS_SPRG+16(r3) + lwz r5, SS_SPRG+20(r3) + lwz r6, SS_SPRG+24(r3) + lwz r7, SS_SPRG+28(r3) + + mtspr SPRN_SPRG4, r4 + mtspr SPRN_SPRG5, r5 + mtspr SPRN_SPRG6, r6 + mtspr SPRN_SPRG7, r7 + lwz r4, SS_SPRG+0(r3) lwz r5, SS_SPRG+4(r3) lwz r6, SS_SPRG+8(r3)
Greg Kroah-Hartman
maintainerPATCH 160/238 powerpc/kvm: Save and restore host AMR/IAMR/UAMOR
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit c3c7470c75566a077c8dc71dcf8f1948b8ddfab4 upstream.
When the hash MMU is active the AMR, IAMR and UAMOR are used for pkeys. The AMR is directly writable by user space, and the UAMOR masks those writes, meaning both registers are effectively user register state. The IAMR is used to create an execute only key.
Also we must maintain the value of at least the AMR when running in process context, so that any memory accesses done by the kernel on behalf of the process are correctly controlled by the AMR.
Although we are correctly switching all registers when going into a guest, on returning to the host we just write 0 into all regs, except on Power9 where we restore the IAMR correctly.
This could be observed by a user process if it writes the AMR, then runs a guest and we then return immediately to it without rescheduling. Because we have written 0 to the AMR that would have the effect of granting read/write permission to pages that the process was trying to protect.
In addition, when using the Radix MMU, the AMR can prevent inadvertent kernel access to userspace data, writing 0 to the AMR disables that protection.
So save and restore AMR, IAMR and UAMOR.
--- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
arch/powerpc/kvm/book3s_hv_rmhandlers.S +17 -9
@@ -58,6 +58,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_300) #define STACK_SLOT_DAWR (SFS-56) #define STACK_SLOT_DAWRX (SFS-64) #define STACK_SLOT_HFSCR (SFS-72) +#define STACK_SLOT_AMR (SFS-80) +#define STACK_SLOT_UAMOR (SFS-88) /* the following is used by the P9 short path */ #define STACK_SLOT_NVGPRS (SFS-152) /* 18 gprs */
@@ -726,11 +728,9 @@ BEGIN_FTR_SECTION mfspr r5, SPRN_TIDR mfspr r6, SPRN_PSSCR mfspr r7, SPRN_PID - mfspr r8, SPRN_IAMR std r5, STACK_SLOT_TID(r1) std r6, STACK_SLOT_PSSCR(r1) std r7, STACK_SLOT_PID(r1) - std r8, STACK_SLOT_IAMR(r1) mfspr r5, SPRN_HFSCR std r5, STACK_SLOT_HFSCR(r1) END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
@@ -738,11 +738,18 @@ BEGIN_FTR_SECTION mfspr r5, SPRN_CIABR mfspr r6, SPRN_DAWR mfspr r7, SPRN_DAWRX + mfspr r8, SPRN_IAMR std r5, STACK_SLOT_CIABR(r1) std r6, STACK_SLOT_DAWR(r1) std r7, STACK_SLOT_DAWRX(r1) + std r8, STACK_SLOT_IAMR(r1) END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) + mfspr r5, SPRN_AMR + std r5, STACK_SLOT_AMR(r1) + mfspr r6, SPRN_UAMOR + std r6, STACK_SLOT_UAMOR(r1) + BEGIN_FTR_SECTION /* Set partition DABR */ /* Do this before re-enabling PMU to avoid P7 DABR corruption bug */
@@ -1631,22 +1638,25 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_3 mtspr SPRN_PSPB, r0 mtspr SPRN_WORT, r0 BEGIN_FTR_SECTION - mtspr SPRN_IAMR, r0 mtspr SPRN_TCSCR, r0 /* Set MMCRS to 1<<31 to freeze and disable the SPMC counters */ li r0, 1 sldi r0, r0, 31 mtspr SPRN_MMCRS, r0 END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_300) -8: - /* Save and reset AMR and UAMOR before turning on the MMU */ + /* Save and restore AMR, IAMR and UAMOR before turning on the MMU */ + ld r8, STACK_SLOT_IAMR(r1) + mtspr SPRN_IAMR, r8 + +8: /* Power7 jumps back in here */ mfspr r5,SPRN_AMR mfspr r6,SPRN_UAMOR std r5,VCPU_AMR(r9) std r6,VCPU_UAMOR(r9) - li r6,0 - mtspr SPRN_AMR,r6 + ld r5,STACK_SLOT_AMR(r1) + ld r6,STACK_SLOT_UAMOR(r1) + mtspr SPRN_AMR, r5 mtspr SPRN_UAMOR, r6 /* Switch DSCR back to host value */
@@ -1746,11 +1756,9 @@ BEGIN_FTR_SECTION ld r5, STACK_SLOT_TID(r1) ld r6, STACK_SLOT_PSSCR(r1) ld r7, STACK_SLOT_PID(r1) - ld r8, STACK_SLOT_IAMR(r1) mtspr SPRN_TIDR, r5 mtspr SPRN_PSSCR, r6 mtspr SPRN_PID, r7 - mtspr SPRN_IAMR, r8 END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) #ifdef CONFIG_PPC_RADIX_MMU
Greg Kroah-Hartman
maintainerPATCH 161/238 powerpc/powernv: Dont reprogram SLW image on every KVM guest entry/exit
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Mackerras <[email protected]>
commit 19f8a5b5be2898573a5e1dc1db93e8d40117606a upstream.
Commit 24be85a23d1f ("powerpc/powernv: Clear PECE1 in LPCR via stop-api only on Hotplug", 2017-07-21) added two calls to opal_slw_set_reg() inside pnv_cpu_offline(), with the aim of changing the LPCR value in the SLW image to disable wakeups from the decrementer while a CPU is offline. However, pnv_cpu_offline() gets called each time a secondary CPU thread is woken up to participate in running a KVM guest, that is, not just when a CPU is offlined.
Since opal_slw_set_reg() is a very slow operation (with observed execution times around 20 milliseconds), this means that an offline secondary CPU can often be busy doing the opal_slw_set_reg() call when the primary CPU wants to grab all the secondary threads so that it can run a KVM guest. This leads to messages like "KVM: couldn't grab CPU n" being printed and guest execution failing.
There is no need to reprogram the SLW image on every KVM guest entry and exit. So that we do it only when a CPU is really transitioning between online and offline, this moves the calls to pnv_program_cpu_hotplug_lpcr() into pnv_smp_cpu_kill_self().
--- arch/powerpc/include/asm/powernv.h | 2 ++ arch/powerpc/platforms/powernv/idle.c | 27 ++------------------------- arch/powerpc/platforms/powernv/smp.c | 25 +++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 25 deletions(-)
arch/powerpc/include/asm/powernv.h +2 -0
@@ -23,6 +23,8 @@ extern int pnv_npu2_handle_fault(struct unsigned long *flags, unsigned long *status, int count); +void pnv_program_cpu_hotplug_lpcr (unsigned int cpu,u64 lpcr_val); +void pnv_tm_init (void );#else static inline void powernv_set_nmmu_ptcr (unsigned long ptcr) { }
arch/powerpc/platforms/powernv/idle.c +2 -25
@@ -458,7 +458,8 @@ EXPORT_SYMBOL_GPL(pnv_power9_force_smt4_#endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */ #ifdef CONFIG_HOTPLUG_CPU -static void pnv_program_cpu_hotplug_lpcr (unsigned int cpu,u64 lpcr_val) + +void pnv_program_cpu_hotplug_lpcr (unsigned int cpu,u64 lpcr_val) {u64 pir =get_hard_smp_processor_id (cpu);
@@ -481,20 +482,6 @@ unsigned long pnv_cpu_offline(unsigned i {unsigned long srr1;u32 idle_states =pnv_get_supported_cpuidle_states (); -u64 lpcr_val; - -/* -* We don't want to take decrementer interrupts while we are -* offline, so clear LPCR:PECE1. We keep PECE2 (and -* LPCR_PECE_HVEE on P9) enabled as to let IPIs in. -* -* If the CPU gets woken up by a special wakeup, ensure that -* the SLW engine sets LPCR with decrementer bit cleared, else -* the CPU will come back to the kernel due to a spurious -* wakeup. -*/ - lpcr_val =mfspr (SPRN_LPCR ) & ~(u64 )LPCR_PECE1 ; -pnv_program_cpu_hotplug_lpcr (cpu, lpcr_val);__ppc64_runlatch_off ();
@@ -526,16 +513,6 @@ unsigned long pnv_cpu_offline(unsigned i__ppc64_runlatch_on (); -/* -* Re-enable decrementer interrupts in LPCR. -* -* Further, we want stop states to be woken up by decrementer -* for non-hotplug cases. So program the LPCR via stop api as -* well. -*/ - lpcr_val =mfspr (SPRN_LPCR ) | (u64 )LPCR_PECE1 ; -pnv_program_cpu_hotplug_lpcr (cpu, lpcr_val); - return srr1; }#endif
arch/powerpc/platforms/powernv/smp.c +25 -0
@@ -39,6 +39,7 @@#include <asm/cpuidle.h> #include <asm/kexec.h> #include <asm/reg.h> +#include <asm/powernv.h> #include "powernv.h"
@@ -153,6 +154,7 @@ static void pnv_smp_cpu_kill_self(void) {unsigned int cpu;unsigned long srr1, wmask; +u64 lpcr_val;/* Standard hot unplug procedure */ /*
@@ -174,6 +176,19 @@ static void pnv_smp_cpu_kill_self(void)if (cpu_has_feature (CPU_FTR_ARCH_207S )) wmask =SRR1_WAKEMASK_P8 ; +/* +* We don't want to take decrementer interrupts while we are +* offline, so clear LPCR:PECE1. We keep PECE2 (and +* LPCR_PECE_HVEE on P9) enabled so as to let IPIs in. +* +* If the CPU gets woken up by a special wakeup, ensure that +* the SLW engine sets LPCR with decrementer bit cleared, else +* the CPU will come back to the kernel due to a spurious +* wakeup. +*/ + lpcr_val =mfspr (SPRN_LPCR ) & ~(u64 )LPCR_PECE1 ; +pnv_program_cpu_hotplug_lpcr (cpu, lpcr_val); +while (!generic_check_cpu_restart (cpu)) {/* * Clear IPI flag, since we don't handle IPIs while
@@ -246,6 +261,16 @@ static void pnv_smp_cpu_kill_self(void) } +/* +* Re-enable decrementer interrupts in LPCR. +* +* Further, we want stop states to be woken up by decrementer +* for non-hotplug cases. So program the LPCR via stop api as +* well. +*/ + lpcr_val =mfspr (SPRN_LPCR ) | (u64 )LPCR_PECE1 ; +pnv_program_cpu_hotplug_lpcr (cpu, lpcr_val); +DBG ("CPU%d coming online...\n" , cpu); }
Greg Kroah-Hartman
maintainerPATCH 162/238 powerpc/64s/hash: Fix assert_slb_presence() use of the slbfee. instruction
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Piggin <[email protected]>
commit 7104dccfd052fde51eecc9972dad9c40bd3e0d11 upstream.
The slbfee. instruction must have bit 24 of RB clear, failure to do so can result in false negatives that result in incorrect assertions.
This is not obvious from the ISA v3.0B document, which only says:
The hardware ignores the contents of RB 36:38 40:63 -- p.1032
This patch fixes the bug and also clears all other bits from PPC bit 36-63, which is good practice when dealing with reserved or ignored bits.
--- arch/powerpc/mm/slb.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/powerpc/mm/slb.c +5 -0
@@ -69,6 +69,11 @@ static void assert_slb_presence(bool preif (!cpu_has_feature (CPU_FTR_ARCH_206 ))return ; +/* +* slbfee. requires bit 24 (PPC bit 39) be clear in RB. Hardware +* ignores all other bits from 0-27, so just clear them all. +*/ + ea &= ~((1UL <<28 ) -1 ); asm volatile(__PPC_SLBFEE_DOT(%0, %1) : "=r"(tmp) : "r"(ea) : "cr0");WARN_ON (present == (tmp ==0 ));
Greg Kroah-Hartman
maintainerPATCH 163/238 powerpc: Fix 32-bit KVM-PR lockup and host crash with MacOS guest
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Cave-Ayland <[email protected]>
commit fe1ef6bcdb4fca33434256a802a3ed6aacf0bd2f upstream.
Commit 8792468da5e1 "powerpc: Add the ability to save FPU without giving it up" unexpectedly removed the MSR_FE0 and MSR_FE1 bits from the bitmask used to update the MSR of the previous thread in __giveup_fpu() causing a KVM-PR MacOS guest to lockup and panic the host kernel.
Leaving FE0/1 enabled means unrelated processes might receive FPEs when they're not expecting them and crash. In particular if this happens to init the host will then panic.
eg (transcribed):
qemu-system-ppc[837]: unhandled signal 8 at 12cc9ce4 nip 12cc9ce4 lr 12cc9ca4 code 0 systemd[1]: unhandled signal 8 at 202f02e0 nip 202f02e0 lr 001003d4 code 0
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
Reinstate these bits to the MSR bitmask to enable MacOS guests to run under 32-bit KVM-PR once again without issue.
--- arch/powerpc/kernel/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/process.c +1 -1
@@ -176,7 +176,7 @@ static void __giveup_fpu(struct task_strsave_fpu (tsk); msr = tsk->thread.regs->msr; - msr &= ~MSR_FP ; + msr &= ~(MSR_FP |MSR_FE0 |MSR_FE1 );#ifdef CONFIG_VSX if (cpu_has_feature (CPU_FTR_VSX )) msr &= ~MSR_VSX ;
Greg Kroah-Hartman
maintainerPATCH 164/238 powerpc/ptrace: Simplify vr_get/set() to avoid GCC warning
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit ca6d5149d2ad0a8d2f9c28cbe379802260a0a5e0 upstream.
GCC 8 warns about the logic in vr_get/set(), which with -Werror breaks the build:
In function ‘user_regset_copyin’,
inlined from ‘vr_set’ at arch/powerpc/kernel/ptrace.c:628:9:
include/linux/regset.h:295:4: error: ‘memcpy’ offset [-527, -529] is out of the bounds [0, 16] of object ‘vrsave’ with type ‘union <anonymous>’ [-Werror=array-bounds] arch/powerpc/kernel/ptrace.c: In function ‘vr_set’:
arch/powerpc/kernel/ptrace.c:623:5: note: ‘vrsave’ declared here
} vrsave;
This has been identified as a regression in GCC, see GCC bug 88273.
However we can avoid the warning and also simplify the logic and make it more robust.
Currently we pass -1 as end_pos to user_regset_copyout(). This says "copy up to the end of the regset".
The definition of the regset is:
[REGSET_VMX] = {
.core_note_type = NT_PPC_VMX, .n = 34,
.size = sizeof(vector128), .align = sizeof(vector128),
.active = vr_active, .get = vr_get, .set = vr_set
},The end is calculated as (n * size), ie. 34 * sizeof(vector128).
In vr_get/set() we pass start_pos as 33 * sizeof(vector128), meaning we can copy up to sizeof(vector128) into/out-of vrsave.
The on-stack vrsave is defined as:
union {
elf_vrreg_t reg;
u32 word;} vrsave;
And elf_vrreg_t is:
typedef __vector128 elf_vrreg_t;
So there is no bug, but we rely on all those sizes lining up, otherwise we would have a kernel stack exposure/overwrite on our hands.
Rather than relying on that we can pass an explict end_pos based on the sizeof(vrsave). The result should be exactly the same but it's more obviously not over-reading/writing the stack and it avoids the compiler warning.
--- arch/powerpc/kernel/ptrace.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
arch/powerpc/kernel/ptrace.c +8 -2
@@ -561,6 +561,7 @@ static int vr_get(struct task_struct *ta/* * Copy out only the low-order word of vrsave. */ +int start, end;union {elf_vrreg_t reg;u32 word;
@@ -569,8 +570,10 @@ static int vr_get(struct task_struct *ta vrsave.word = target->thread.vrsave; + start =33 *sizeof (vector128); + end = start +sizeof (vrsave); ret =user_regset_copyout (&pos, &count, &kbuf, &ubuf, &vrsave, -33 *sizeof (vector128),-1 ); + start, end); }return ret;
@@ -608,6 +611,7 @@ static int vr_set(struct task_struct *ta/* * We use only the first word of vrsave. */ +int start, end;union {elf_vrreg_t reg;u32 word;
@@ -616,8 +620,10 @@ static int vr_set(struct task_struct *ta vrsave.word = target->thread.vrsave; + start =33 *sizeof (vector128); + end = start +sizeof (vrsave); ret =user_regset_copyin (&pos, &count, &kbuf, &ubuf, &vrsave, -33 *sizeof (vector128),-1 ); + start, end);if (!ret) target->thread.vrsave = vrsave.word; }
Greg Kroah-Hartman
maintainerPATCH 165/238 powerpc/hugetlb: Dont do runtime allocation of 16G pages in LPAR configuration
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aneesh Kumar K.V <[email protected]>
commit 35f2806b481f5b9207f25e1886cba5d1c4d12cc7 upstream.
We added runtime allocation of 16G pages in commit 4ae279c2c96a ("powerpc/mm/hugetlb: Allow runtime allocation of 16G.") That was done to enable 16G allocation on PowerNV and KVM config. In case of KVM config, we mostly would have the entire guest RAM backed by 16G hugetlb pages for this to work. PAPR do support partial backing of guest RAM with hugepages via ibm,expected#pages node of memory node in the device tree. This means rest of the guest RAM won't be backed by 16G contiguous pages in the host and hence a hash page table insertion can fail in such case.
An example error message will look like
hash-mmu: mm: Hashing failure ! EA=0x7efc00000000 access=0x8000000000000006 current=readback
hash-mmu: trap=0x300 vsid=0x67af789 ssize=1 base psize=14 psize 14 pte=0xc000000400000386
readback[12260]: unhandled signal 7 at 00007efc00000000 nip 00000000100012d0 lr 000000001000127c code 2
This patch address that by preventing runtime allocation of 16G hugepages in LPAR config. To allocate 16G hugetlb one need to kernel command line hugepagesz=16G hugepages=<number of 16G pages>
With radix translation mode we don't run into this issue.
This change will prevent runtime allocation of 16G hugetlb pages on kvm with hash translation mode. However, with the current upstream it was observed that 16G hugetlbfs backed guest doesn't boot at all.
We observe boot failure with the below message:
[131354.647546] KVM: map_vrma at 0 failed, ret=-4
That means this patch is not resulting in an observable regression. Once we fix the boot issue with 16G hugetlb backed memory, we need to use ibm,expected#pages memory node attribute to indicate 16G page reservation to the guest. This will also enable partial backing of guest RAM with 16G pages.
--- arch/powerpc/include/asm/book3s/64/hugetlb.h | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/powerpc/include/asm/book3s/64/hugetlb.h +8 -0
@@ -35,6 +35,14 @@ static inline int hstate_get_psize(struc#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE static inline bool gigantic_page_supported (void ) { +/* +* We used gigantic page reservation with hypervisor assist in some case. +* We cannot use runtime allocation of gigantic pages in those platforms +* This is hash translation mode LPARs. +*/ +if (firmware_has_feature (FW_FEATURE_LPAR ) && !radix_enabled ()) +return false; +return true; }#endif
Greg Kroah-Hartman
maintainerPATCH 166/238 powerpc/smp: Fix NMI IPI timeout
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Piggin <[email protected]>
commit 1b5fc84aba170bdfe3533396ca9662ceea1609b7 upstream.
The NMI IPI timeout logic is broken, if __smp_send_nmi_ipi() times out on the first condition, delay_us will be zero which will send it into the second spin loop with no timeout so it will spin forever.
--- arch/powerpc/kernel/smp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/kernel/smp.c +3 -2
@@ -519,7 +519,7 @@ int __smp_send_nmi_ipi(int cpu, void (*fif (delay_us) { delay_us--;if (!delay_us) -break ; + goto timeout; } }
@@ -530,10 +530,11 @@ int __smp_send_nmi_ipi(int cpu, void (*fif (delay_us) { delay_us--;if (!delay_us) -break ; + goto timeout; } } +timeout:if (!cpumask_empty (&nmi_ipi_pending_mask)) {/* Timeout waiting for CPUs to call smp_handle_nmi_ipi */ ret =0 ;
Greg Kroah-Hartman
maintainerPATCH 167/238 powerpc/smp: Fix NMI IPI xmon timeout
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Piggin <[email protected]>
commit 88b9a3d1425a436e95c41f09986fdae2daee437a upstream.
The xmon debugger IPI handler waits in the callback function while xmon is still active. This means they don't complete the IPI, and the initiator always times out waiting for them.
Things manage to work after the timeout because there is some fallback logic to keep NMI IPI state sane in case of the timeout, but this is a bit ugly.
This patch changes NMI IPI back to half-asynchronous (i.e., wait for everyone to call in, do not wait for IPI function to complete), but the complexity is avoided by going one step further and allowing new IPIs to be issued before the IPI functions to all complete.
If synchronization against that is required, it is left up to the caller, but current callers don't require that. In fact with the timeout handling, callers must be able to cope with this already.
--- arch/powerpc/kernel/smp.c | 93 ++++++++++++++-------------------------------- 1 file changed, 29 insertions(+), 64 deletions(-)
arch/powerpc/kernel/smp.c +29 -64
@@ -358,13 +358,12 @@ void arch_send_call_function_ipi_mask(co* NMI IPIs may not be recoverable, so should not be used as ongoing part of * a running system. They can be used for crash, debug, halt/reboot, etc. * -* NMI IPIs are globally single threaded. No more than one in progress at -* any time. -* * The IPI call waits with interrupts disabled until all targets enter the -* NMI handler, then the call returns. +* NMI handler, then returns. Subsequent IPIs can be issued before targets +* have returned from their handlers, so there is no guarantee about +* concurrency or re-entrancy. * -* No new NMI can be initiated until targets exit the handler. +* A new NMI can be issued before all targets exit the handler. * * The IPI call may time out without all targets entering the NMI handler. * In that case, there is some logic to recover (and ignore subsequent
@@ -375,7 +374,7 @@ void arch_send_call_function_ipi_mask(costatic atomic_t __nmi_ipi_lock =ATOMIC_INIT (0 );static struct cpumask nmi_ipi_pending_mask; -static int nmi_ipi_busy_count =0 ; +static bool nmi_ipi_busy = false;static void (*nmi_ipi_function)(struct pt_regs *) =NULL ;static void nmi_ipi_lock_start (unsigned long *flags)
@@ -414,7 +413,7 @@ static void nmi_ipi_unlock_end(unsigned*/ int smp_handle_nmi_ipi (struct pt_regs *regs) { -void (*fn)(struct pt_regs *); +void (*fn)(struct pt_regs *) =NULL ;unsigned long flags;int me =raw_smp_processor_id ();int ret =0 ;
@@ -425,29 +424,17 @@ int smp_handle_nmi_ipi(struct pt_regs *r* because the caller may have timed out. */ nmi_ipi_lock_start (&flags); -if (!nmi_ipi_busy_count) - goto out; -if (!cpumask_test_cpu (me, &nmi_ipi_pending_mask)) - goto out; - - fn = nmi_ipi_function; -if (!fn) - goto out; - -cpumask_clear_cpu (me, &nmi_ipi_pending_mask); - nmi_ipi_busy_count++; -nmi_ipi_unlock (); - - ret =1 ; - -fn (regs); - -nmi_ipi_lock (); -if (nmi_ipi_busy_count >1 )/* Can race with caller time-out */ - nmi_ipi_busy_count--; -out: +if (cpumask_test_cpu (me, &nmi_ipi_pending_mask)) { +cpumask_clear_cpu (me, &nmi_ipi_pending_mask); + fn =READ_ONCE (nmi_ipi_function); +WARN_ON_ONCE (!fn); + ret =1 ; + }nmi_ipi_unlock_end (&flags); +if (fn) +fn (regs); +return ret; }
@@ -473,7 +460,7 @@ static void do_smp_send_nmi_ipi(int cpu,* - cpu is the target CPU (must not be this CPU), or NMI_IPI_ALL_OTHERS. * - fn is the target callback function. * - delay_us > 0 is the delay before giving up waiting for targets to -* complete executing the handler, == 0 specifies indefinite delay. +* begin executing the handler, == 0 specifies indefinite delay. */ int __smp_send_nmi_ipi (int cpu,void (*fn)(struct pt_regs *),u64 delay_us,bool safe) {
@@ -487,31 +474,33 @@ int __smp_send_nmi_ipi(int cpu, void (*fif (unlikely (!smp_ops))return 0 ; -/* Take the nmi_ipi_busy count/lock with interrupts hard disabled */ nmi_ipi_lock_start (&flags); -while (nmi_ipi_busy_count) { +while (nmi_ipi_busy) {nmi_ipi_unlock_end (&flags); -spin_until_cond (nmi_ipi_busy_count ==0 ); +spin_until_cond (!nmi_ipi_busy);nmi_ipi_lock_start (&flags); } - + nmi_ipi_busy = true; nmi_ipi_function = fn; +WARN_ON_ONCE (!cpumask_empty (&nmi_ipi_pending_mask)); +if (cpu <0 ) {/* ALL_OTHERS */ cpumask_copy (&nmi_ipi_pending_mask, cpu_online_mask);cpumask_clear_cpu (me, &nmi_ipi_pending_mask); }else { -/* cpumask starts clear */ cpumask_set_cpu (cpu, &nmi_ipi_pending_mask); } - nmi_ipi_busy_count++; +nmi_ipi_unlock (); +/* Interrupts remain hard disabled */ +do_smp_send_nmi_ipi (cpu, safe);nmi_ipi_lock (); -/* nmi_ipi_busy_count is held here, so unlock/lock is okay */ +/* nmi_ipi_busy is set here, so unlock/lock is okay */ while (!cpumask_empty (&nmi_ipi_pending_mask)) {nmi_ipi_unlock ();udelay (1 );
@@ -519,34 +508,19 @@ int __smp_send_nmi_ipi(int cpu, void (*fif (delay_us) { delay_us--;if (!delay_us) - goto timeout; +break ; } } -while (nmi_ipi_busy_count >1 ) { -nmi_ipi_unlock (); -udelay (1 ); -nmi_ipi_lock (); -if (delay_us) { - delay_us--; -if (!delay_us) - goto timeout; - } - } - -timeout:if (!cpumask_empty (&nmi_ipi_pending_mask)) {/* Timeout waiting for CPUs to call smp_handle_nmi_ipi */ ret =0 ;cpumask_clear (&nmi_ipi_pending_mask); } -if (nmi_ipi_busy_count >1 ) { -/* Timeout waiting for CPUs to execute fn */ - ret =0 ; - nmi_ipi_busy_count =1 ; - } - nmi_ipi_busy_count--; + nmi_ipi_function =NULL ; + nmi_ipi_busy = false; +nmi_ipi_unlock_end (&flags);return ret;
@@ -614,17 +588,8 @@ void crash_send_ipi(void (*crash_ipi_calstatic void nmi_stop_this_cpu (struct pt_regs *regs) {/* -* This is a special case because it never returns, so the NMI IPI -* handling would never mark it as done, which makes any later -* smp_send_nmi_ipi() call spin forever. Mark it done now. -* * IRQs are already hard disabled by the smp_handle_nmi_ipi. */ -nmi_ipi_lock (); -if (nmi_ipi_busy_count >1 ) - nmi_ipi_busy_count--; -nmi_ipi_unlock (); -spin_begin ();while (1 )spin_cpu_relax ();
Greg Kroah-Hartman
maintainerPATCH 168/238 powerpc/traps: fix recoverability of machine check handling on book3s/32
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
commit 0bbea75c476b77fa7d7811d6be911cc7583e640f upstream.
Looks like book3s/32 doesn't set RI on machine check, so checking RI before calling die() will always be fatal allthought this is not an issue in most cases.
--- arch/powerpc/kernel/traps.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/kernel/traps.c +4 -4
@@ -763,15 +763,15 @@ void machine_check_exception(struct pt_rif (check_io_access (regs)) goto bail; -/* Must die if the interrupt is not recoverable */ -if (!(regs->msr &MSR_RI )) -nmi_panic (regs,"Unrecoverable Machine check" ); -if (!nested)nmi_exit ();die ("Machine check" , regs,SIGBUS ); +/* Must die if the interrupt is not recoverable */ +if (!(regs->msr &MSR_RI )) +nmi_panic (regs,"Unrecoverable Machine check" ); +return ; bail:
Greg Kroah-Hartman
maintainerPATCH 169/238 powerpc/traps: Fix the message printed when stack overflows
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
commit 9bf3d3c4e4fd82c7174f4856df372ab2a71005b9 upstream.
Today's message is useless:
[ 42.253267] Kernel stack overflow in process (ptrval), r1=c65500b0
This patch fixes it:
[ 66.905235] Kernel stack overflow in process sh[356], r1=c65560b0
--- arch/powerpc/kernel/traps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/traps.c +2 -2
@@ -1542,8 +1542,8 @@ bail:void StackOverflow (struct pt_regs *regs) { -printk (KERN_CRIT "Kernel stack overflow in process %p, r1=%lx\n" , - current, regs->gpr[1 ]); +pr_crit ("Kernel stack overflow in process %s[%d], r1=%lx\n" , + current->comm,task_pid_nr (current), regs->gpr[1 ]);debugger (regs);show_regs (regs);panic ("kernel stack overflow" );
Greg Kroah-Hartman
maintainerPATCH 170/238 ARM: s3c24xx: Fix boolean expressions in osiris_dvs_notify
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
commit e2477233145f2156434afb799583bccd878f3e9f upstream.
Fix boolean expressions by using logical AND operator '&&' instead of bitwise operator '&'.
This issue was detected with the help of Coccinelle.
--- arch/arm/mach-s3c24xx/mach-osiris-dvs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/mach-s3c24xx/mach-osiris-dvs.c +4 -4
@@ -65,16 +65,16 @@ static int osiris_dvs_notify(struct notiswitch (val) {case CPUFREQ_PRECHANGE : -if (old_dvs & !new_dvs || - cur_dvs & !new_dvs) { +if ((old_dvs && !new_dvs) || + (cur_dvs && !new_dvs)) {pr_debug ("%s: exiting dvs\n" , __func__); cur_dvs = false;gpio_set_value (OSIRIS_GPIO_DVS ,1 ); }break ;case CPUFREQ_POSTCHANGE : -if (!old_dvs & new_dvs || - !cur_dvs & new_dvs) { +if ((!old_dvs && new_dvs) || + (!cur_dvs && new_dvs)) {pr_debug ("entering dvs\n" ); cur_dvs = true;gpio_set_value (OSIRIS_GPIO_DVS ,0 );
Greg Kroah-Hartman
maintainerPATCH 171/238 arm64: Fix HCR.TGE status for NMI contexts
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julien Thierry <[email protected]>
commit 5870970b9a828d8693aa6d15742573289d7dbcd0 upstream.
When using VHE, the host needs to clear HCR_EL2.TGE bit in order to interact with guest TLBs, switching from EL2&0 translation regime to EL1&0.
However, some non-maskable asynchronous event could happen while TGE is cleared like SDEI. Because of this address translation operations relying on EL2&0 translation regime could fail (tlb invalidation, userspace access, ...).
Fix this by properly setting HCR_EL2.TGE when entering NMI context and clear it if necessary when returning to the interrupted context.
--- arch/arm64/include/asm/hardirq.h | 31 +++++++++++++++++++++++++++++++ arch/arm64/kernel/irq.c | 3 +++ include/linux/hardirq.h | 7 +++++++ 3 files changed, 41 insertions(+)
arch/arm64/include/asm/hardirq.h +31 -0
@@ -17,8 +17,12 @@#define __ASM_HARDIRQ_H#include <linux/cache.h> +#include <linux/percpu.h> #include <linux/threads.h> +#include <asm/barrier.h> #include <asm/irq.h> +#include <asm/kvm_arm.h> +#include <asm/sysreg.h> #define NR_IPI 7
@@ -37,6 +41,33 @@ u64 smp_irq_stat_cpu(unsigned int cpu);#define __ARCH_IRQ_EXIT_IRQS_DISABLED 1 +struct nmi_ctx { +u64 hcr; +}; + +DECLARE_PER_CPU(struct nmi_ctx, nmi_contexts); + +#define arch_nmi_enter () \ + do { \ + if (is_kernel_in_hyp_mode()) { \ + struct nmi_ctx *nmi_ctx = this_cpu_ptr(&nmi_contexts); \ + nmi_ctx->hcr = read_sysreg(hcr_el2); \ + if (!(nmi_ctx->hcr & HCR_TGE)) { \ + write_sysreg(nmi_ctx->hcr | HCR_TGE, hcr_el2); \ + isb(); \ + } \ + } \ + } while (0) + +#define arch_nmi_exit () \ + do { \ + if (is_kernel_in_hyp_mode()) { \ + struct nmi_ctx *nmi_ctx = this_cpu_ptr(&nmi_contexts); \ + if (!(nmi_ctx->hcr & HCR_TGE)) \ + write_sysreg(nmi_ctx->hcr, hcr_el2); \ + } \ + } while (0) +static inline void ack_bad_irq (unsigned int irq) {extern unsigned long irq_err_count;
arch/arm64/kernel/irq.c +3 -0
@@ -33,6 +33,9 @@unsigned long irq_err_count; +/* Only access this in an NMI enter/exit */ +DEFINE_PER_CPU(struct nmi_ctx, nmi_contexts); + DEFINE_PER_CPU(unsigned long *, irq_stack_ptr);int arch_show_interrupts (struct seq_file *p,int prec)
include/linux/hardirq.h +7 -0
@@ -60,8 +60,14 @@ extern void irq_enter(void);*/ extern void irq_exit (void ); +#ifndef arch_nmi_enter +#define arch_nmi_enter () do { } while (0) +#define arch_nmi_exit () do { } while (0) +#endif +#define nmi_enter () \ do { \ + arch_nmi_enter(); \ printk_nmi_enter(); \ lockdep_off(); \ ftrace_nmi_enter(); \
@@ -80,6 +86,7 @@ extern void irq_exit(void);ftrace_nmi_exit (); \lockdep_on (); \printk_nmi_exit (); \ +arch_nmi_exit (); \ } while (0)#endif /* LINUX_HARDIRQ_H */
Greg Kroah-Hartman
maintainerPATCH 172/238 arm64: debug: Dont propagate UNKNOWN FAR into si_code for debug signals
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit b9a4b9d084d978f80eb9210727c81804588b42ff upstream.
FAR_EL1 is UNKNOWN for all debug exceptions other than those caused by taking a hardware watchpoint. Unfortunately, if a debug handler returns a non-zero value, then we will propagate the UNKNOWN FAR value to userspace via the si_addr field of the SIGTRAP siginfo_t.
Instead, let's set si_addr to take on the PC of the faulting instruction, which we have available in the current pt_regs.
--- arch/arm64/mm/fault.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
arch/arm64/mm/fault.c +5 -4
@@ -824,11 +824,12 @@ void __init hook_debug_fault_code(int nr debug_fault_info[nr].name = name; } -asmlinkage int __exception do_debug_exception(unsigned long addr, +asmlinkage int __exception do_debug_exception(unsigned long addr_if_watchpoint,unsigned int esr,struct pt_regs *regs) {const struct fault_info *inf =esr_to_debug_fault_info (esr); +unsigned long pc =instruction_pointer (regs);int rv;/*
@@ -838,14 +839,14 @@ asmlinkage int __exception do_debug_exceif (interrupts_enabled (regs))trace_hardirqs_off (); -if (user_mode (regs) && !is_ttbr0_addr (instruction_pointer (regs))) +if (user_mode (regs) && !is_ttbr0_addr (pc))arm64_apply_bp_hardening (); -if (!inf->fn (addr, esr, regs)) { +if (!inf->fn (addr_if_watchpoint, esr, regs)) { rv =1 ; }else {arm64_notify_die (inf->name, regs, - inf->sig, inf->code, (void __user *)addr, esr); + inf->sig, inf->code, (void __user *)pc, esr); rv =0 ; }
Greg Kroah-Hartman
maintainerPATCH 173/238 arm64: debug: Ensure debug handlers check triggering exception level
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 6bd288569b50bc89fa5513031086746968f585cb upstream.
Debug exception handlers may be called for exceptions generated both by user and kernel code. In many cases, this is checked explicitly, but in other cases things either happen to work by happy accident or they go slightly wrong. For example, executing 'brk #4' from userspace will enter the kprobes code and be ignored, but the instruction will be retried forever in userspace instead of delivering a SIGTRAP.
Fix this issue in the most stable-friendly fashion by simply adding explicit checks of the triggering exception level to all of our debug exception handlers.
--- arch/arm64/kernel/kgdb.c | 14 ++++++++++---- arch/arm64/kernel/probes/kprobes.c | 6 ++++++ 2 files changed, 16 insertions(+), 4 deletions(-)
arch/arm64/kernel/kgdb.c +10 -4
@@ -244,27 +244,33 @@ int kgdb_arch_handle_exception(int excepstatic int kgdb_brk_fn (struct pt_regs *regs,unsigned int esr) { +if (user_mode (regs)) +return DBG_HOOK_ERROR ; +kgdb_handle_exception (1 ,SIGTRAP ,0 , regs); -return 0 ; +return DBG_HOOK_HANDLED ; }NOKPROBE_SYMBOL (kgdb_brk_fn) static int kgdb_compiled_brk_fn(struct pt_regs *regs, unsigned int esr) { +if (user_mode (regs)) +return DBG_HOOK_ERROR ; + compiled_break =1 ;kgdb_handle_exception (1 ,SIGTRAP ,0 , regs); -return 0 ; +return DBG_HOOK_HANDLED ; }NOKPROBE_SYMBOL (kgdb_compiled_brk_fn);static int kgdb_step_brk_fn (struct pt_regs *regs,unsigned int esr) { -if (!kgdb_single_step) +if (user_mode (regs) || !kgdb_single_step)return DBG_HOOK_ERROR ;kgdb_handle_exception (1 ,SIGTRAP ,0 , regs); -return 0 ; +return DBG_HOOK_HANDLED ; }NOKPROBE_SYMBOL (kgdb_step_brk_fn);
arch/arm64/kernel/probes/kprobes.c +6 -0
@@ -450,6 +450,9 @@ kprobe_single_step_handler(struct pt_regstruct kprobe_ctlblk *kcb =get_kprobe_ctlblk ();int retval; +if (user_mode (regs)) +return DBG_HOOK_ERROR ; +/* return error if this is not our step */ retval =kprobe_ss_hit (kcb,instruction_pointer (regs));
@@ -466,6 +469,9 @@ kprobe_single_step_handler(struct pt_regint __kprobes kprobe_breakpoint_handler (struct pt_regs *regs,unsigned int esr) { +if (user_mode (regs)) +return DBG_HOOK_ERROR ; +kprobe_handler (regs);return DBG_HOOK_HANDLED ; }
Greg Kroah-Hartman
maintainerPATCH 174/238 arm64: KVM: Fix architecturally invalid reset value for FPEXC32_EL2
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Martin <[email protected]>
commit c88b093693ccbe41991ef2e9b1d251945e6e54ed upstream.
Due to what looks like a typo dating back to the original addition of FPEXC32_EL2 handling, KVM currently initialises this register to an architecturally invalid value.
As a result, the VECITR field (RES1) in bits [10:8] is initialised with 0, and the two reserved (RES0) bits [6:5] are initialised with
1. (In the Common VFP Subarchitecture as specified by ARMv7-A, these two bits were IMP DEF. ARMv8-A removes them.)
This patch changes the reset value from 0x70 to 0x700, which reflects the architectural constraints and is presumably what was originally intended.
--- arch/arm64/kvm/sys_regs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kvm/sys_regs.c +1 -1
@@ -1476,7 +1476,7 @@ static const struct sys_reg_desc sys_reg { SYS_DESC(SYS_DACR32_EL2), NULL, reset_unknown, DACR32_EL2 }, { SYS_DESC(SYS_IFSR32_EL2), NULL, reset_unknown, IFSR32_EL2 }, - { SYS_DESC(SYS_FPEXC32_EL2), NULL, reset_val, FPEXC32_EL2, 0x70 }, + { SYS_DESC(SYS_FPEXC32_EL2), NULL, reset_val, FPEXC32_EL2, 0x700 }, }; static bool trap_dbgidr(struct kvm_vcpu *vcpu,
Greg Kroah-Hartman
maintainerPATCH 175/238 Revert "KVM/MMU: Flush tlb directly in the kvm_zap_gfn_range()"
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Gardon <[email protected]>
commit 92da008fa21034c369cdb8ca2b629fe5c196826b upstream.
This reverts commit 71883a62fcd6c70639fa12cda733378b4d997409.
The above commit contains an optimization to kvm_zap_gfn_range which uses gfn-limited TLB flushes, if enabled. If using these limited flushes, kvm_zap_gfn_range passes lock_flush_tlb=false to slot_handle_level_range which creates a race when the function unlocks to call cond_resched. See an example of this race below:
CPU 0 CPU 1 CPU 3
// zap_direct_gfn_rangemmu_lock()
// *ptep == pte_1
*ptep = 0
if (lock_flush_tlb)
flush_tlbs()mmu_unlock()
// In invalidate range
// MMU notifier
mmu_lock()
if (pte != 0)
*ptep = 0
flush = true
if (flush)
flush_remote_tlbs()
mmu_unlock()
return
// Host MM reallocates
// page previously
// backing guest memory.
// Guest accesses
// invalid page
// through pte_1
// in its TLB!!Tested: Ran all kvm-unit-tests on a Intel Haswell machine with and
without this patch. The patch introduced no new failures.
--- arch/x86/kvm/mmu.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
arch/x86/kvm/mmu.c +3 -13
@@ -5635,13 +5635,8 @@ void kvm_zap_gfn_range(struct kvm *kvm, {struct kvm_memslots *slots;struct kvm_memory_slot *memslot; -bool flush_tlb = true; -bool flush = false;int i; -if (kvm_available_flush_tlb_with_range ()) - flush_tlb = false; -spin_lock (&kvm->mmu_lock);for (i =0 ; i <KVM_ADDRESS_SPACE_NUM ; i++) { slots =__kvm_memslots (kvm, i);
@@ -5653,17 +5648,12 @@ void kvm_zap_gfn_range(struct kvm *kvm,if (start >= end)continue ; - flush |=slot_handle_level_range (kvm, memslot, - kvm_zap_rmapp,PT_PAGE_TABLE_LEVEL , -PT_MAX_HUGEPAGE_LEVEL , start, - end -1 , flush_tlb); +slot_handle_level_range (kvm, memslot, kvm_zap_rmapp, +PT_PAGE_TABLE_LEVEL ,PT_MAX_HUGEPAGE_LEVEL , + start, end -1 , true); } } -if (flush) -kvm_flush_remote_tlbs_with_address (kvm, gfn_start, - gfn_end - gfn_start +1 ); -spin_unlock (&kvm->mmu_lock); }
Greg Kroah-Hartman
maintainerPATCH 176/238 ipmi_si: Fix crash when using hard-coded device
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Corey Minyard <[email protected]>
commit 41b766d661bf94a364960862cfc248a78313dbd3 upstream.
When excuting a command like:
modprobe ipmi_si ports=0xffc0e3 type=bt
The system would get an oops.
The trouble here is that ipmi_si_hardcode_find_bmc() is called before ipmi_si_platform_init(), but initialization of the hard-coded device creates an IPMI platform device, which won't be initialized yet.
The real trouble is that hard-coded devices aren't created with any device, and the fixup is done later. So do it right, create the hard-coded devices as normal platform devices.
This required adding some new resource types to the IPMI platform code for passing information required by the hard-coded device and adding some code to remove the hard-coded platform devices on module removal.
To enforce the "hard-coded devices passed by the user take priority over firmware devices" rule, some special code was added to check and see if a hard-coded device already exists.
--- drivers/char/ipmi/ipmi_si.h | 4 drivers/char/ipmi/ipmi_si_hardcode.c | 232 +++++++++++++++++++++++++---------- drivers/char/ipmi/ipmi_si_intf.c | 23 ++- drivers/char/ipmi/ipmi_si_platform.c | 29 +++- 4 files changed, 214 insertions(+), 74 deletions(-)
drivers/char/ipmi/ipmi_si.h +3 -1
@@ -25,7 +25,9 @@ void ipmi_irq_finish_setup(struct si_sm_int ipmi_si_remove_by_dev (struct device *dev);void ipmi_si_remove_by_data (int addr_space,enum si_type si_type,unsigned long addr); -int ipmi_si_hardcode_find_bmc (void ); +void ipmi_hardcode_init (void ); +void ipmi_si_hardcode_exit (void ); +int ipmi_si_hardcode_match (int addr_type,unsigned long addr);void ipmi_si_platform_init (void );void ipmi_si_platform_shutdown (void );
drivers/char/ipmi/ipmi_si_hardcode.c +172 -60
267 lines not on this page · raw message
drivers/char/ipmi/ipmi_si_intf.c +17 -6
@@ -1862,6 +1862,18 @@ int ipmi_si_add_smi(struct si_sm_io *io)int rv =0 ;struct smi_info *new_smi, *dup; +/* +* If the user gave us a hard-coded device at the same +* address, they presumably want us to use it and not what is +* in the firmware. +*/ +if (io->addr_source !=SI_HARDCODED && +ipmi_si_hardcode_match (io->addr_type, io->addr_data)) { +dev_info (io->dev, +"Hard-coded device at this address already exists" ); +return -ENODEV ; + } +if (!io->io_setup) {if (io->addr_type ==IPMI_IO_ADDR_SPACE ) { io->io_setup = ipmi_si_port_setup;
@@ -2089,7 +2101,7 @@ static int try_smi_init(struct smi_inforeturn rv; } -static int init_ipmi_si (void ) +static int __init init_ipmi_si (void ) {struct smi_info *e;enum ipmi_addr_src type =SI_INVALID ;
@@ -2097,11 +2109,9 @@ static int init_ipmi_si(void)if (initialized)return 0 ; -pr_info ("IPMI System Interface driver\n" ); +ipmi_hardcode_init (); -/* If the user gave us a device, they presumably want us to use it */ -if (!ipmi_si_hardcode_find_bmc ()) - goto do_scan; +pr_info ("IPMI System Interface driver\n" );ipmi_si_platform_init ();
@@ -2113,7 +2123,6 @@ static int init_ipmi_si(void)with multiple BMCs we assume that there will be several instances of a given type so if we succeed in registering a type then also try to register everything else of the same type */ -do_scan:mutex_lock (&smi_infos_lock);list_for_each_entry (e, &smi_infos, link) {/* Try to register a device if it has an IRQ and we either
@@ -2299,6 +2308,8 @@ static void cleanup_ipmi_si(void)list_for_each_entry_safe (e, tmp_e, &smi_infos, link)cleanup_one_si (e);mutex_unlock (&smi_infos_lock); + +ipmi_si_hardcode_exit (); }module_exit (cleanup_ipmi_si);
drivers/char/ipmi/ipmi_si_platform.c +22 -7
@@ -128,8 +128,6 @@ ipmi_get_info_from_resources(struct platif (res_second->start > io->addr_data) io->regspacing = res_second->start - io->addr_data; } - io->regsize =DEFAULT_REGSIZE ; - io->regshift =0 ;return res; }
@@ -137,7 +135,7 @@ ipmi_get_info_from_resources(struct platstatic int platform_ipmi_probe (struct platform_device *pdev) {struct si_sm_io io; -u8 type, slave_addr, addr_source; +u8 type, slave_addr, addr_source, regsize, regshift;int rv; rv =device_property_read_u8 (&pdev->dev,"addr-source" , &addr_source);
@@ -149,7 +147,7 @@ static int platform_ipmi_probe(struct plif (addr_source ==SI_SMBIOS ) {if (!si_trydmi)return -ENODEV ; - }else { + }else if (addr_source !=SI_HARDCODED ) {if (!si_tryplatform)return -ENODEV ; }
@@ -169,11 +167,23 @@ static int platform_ipmi_probe(struct plcase SI_BT : io.si_type = type;break ; +case SI_TYPE_INVALID :/* User disabled this in hardcode. */ +return -ENODEV ;default :dev_err (&pdev->dev,"ipmi-type property is invalid\n" );return -EINVAL ; } + io.regsize =DEFAULT_REGSIZE ; + rv =device_property_read_u8 (&pdev->dev,"reg-size" , ®size); +if (!rv) + io.regsize = regsize; + + io.regshift =0 ; + rv =device_property_read_u8 (&pdev->dev,"reg-shift" , ®shift); +if (!rv) + io.regshift = regshift; +if (!ipmi_get_info_from_resources (pdev, &io))return -EINVAL ;
@@ -193,7 +203,8 @@ static int platform_ipmi_probe(struct pl io.dev = &pdev->dev; -pr_info ("ipmi_si: SMBIOS: %s %#lx regsize %d spacing %d irq %d\n" , +pr_info ("ipmi_si: %s: %s %#lx regsize %d spacing %d irq %d\n" , +ipmi_addr_src_to_str (addr_source), (io.addr_type ==IPMI_IO_ADDR_SPACE ) ?"io" :"mem" , io.addr_data, io.regsize, io.regspacing, io.irq);
@@ -358,6 +369,9 @@ static int acpi_ipmi_probe(struct platfo goto err_free; } + io.regsize =DEFAULT_REGSIZE ; + io.regshift =0 ; + res =ipmi_get_info_from_resources (pdev, &io);if (!res) { rv = -EINVAL ;
@@ -420,8 +434,9 @@ static int ipmi_remove(struct platform_d }static const struct platform_device_id si_plat_ids[] = { - {"dmi-ipmi-si" ,0 }, - { } + {"dmi-ipmi-si" ,0 }, + {"hardcode-ipmi-si" ,0 }, + { } };struct platform_driver ipmi_platform_driver = {
Greg Kroah-Hartman
maintainerPATCH 177/238 ipmi_si: fix use-after-free of resource->name
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Yingliang <[email protected]>
commit 401e7e88d4ef80188ffa07095ac00456f901b8c4 upstream.
When we excute the following commands, we got oops rmmod ipmi_si
cat /proc/ioports
[ 1623.482380] Unable to handle kernel paging request at virtual address ffff00000901d478 [ 1623.482382] Mem abort info: [ 1623.482383] ESR = 0x96000007 [ 1623.482385] Exception class = DABT (current EL), IL = 32 bits [ 1623.482386] SET = 0, FnV = 0 [ 1623.482387] EA = 0, S1PTW = 0 [ 1623.482388] Data abort info: [ 1623.482389] ISV = 0, ISS = 0x00000007 [ 1623.482390] CM = 0, WnR = 0 [ 1623.482393] swapper pgtable: 4k pages, 48-bit VAs, pgdp = 00000000d7d94a66 [ 1623.482395] [ffff00000901d478] pgd=000000dffbfff003, pud=000000dffbffe003, pmd=0000003f5d06e003, pte=0000000000000000 [ 1623.482399] Internal error: Oops: 96000007 [#1] SMP [ 1623.487407] Modules linked in: ipmi_si(E) nls_utf8 isofs rpcrdma ib_iser ib_srpt target_core_mod ib_srp scsi_transport_srp ib_ipoib rdma_ucm ib_umad rdma_cm ib_cm dm_mirror dm_region_hash dm_log iw_cm dm_mod aes_ce_blk crypto_simd cryptd aes_ce_cipher ses ghash_ce sha2_ce enclosure sha256_arm64 sg sha1_ce hisi_sas_v2_hw hibmc_drm sbsa_gwdt hisi_sas_main ip_tables mlx5_ib ib_uverbs marvell ib_core mlx5_core ixgbe mdio hns_dsaf ipmi_devintf hns_enet_drv ipmi_msghandler hns_mdio [last unloaded: ipmi_si] [ 1623.532410] CPU: 30 PID: 11438 Comm: cat Kdump: loaded Tainted: G E 5.0.0-rc3+ #168 [ 1623.541498] Hardware name: Huawei TaiShan 2280 /BC11SPCD, BIOS 1.37 11/21/2017 [ 1623.548822] pstate: a0000005 (NzCv daif -PAN -UAO) [ 1623.553684] pc : string+0x28/0x98 [ 1623.557040] lr : vsnprintf+0x368/0x5e8 [ 1623.560837] sp : ffff000013213a80 [ 1623.564191] x29: ffff000013213a80 x28: ffff00001138abb5 [ 1623.569577] x27: ffff000013213c18 x26: ffff805f67d06049 [ 1623.574963] x25: 0000000000000000 x24: ffff00001138abb5 [ 1623.580349] x23: 0000000000000fb7 x22: ffff0000117ed000 [ 1623.585734] x21: ffff000011188fd8 x20: ffff805f67d07000 [ 1623.591119] x19: ffff805f67d06061 x18: ffffffffffffffff [ 1623.596505] x17: 0000000000000200 x16: 0000000000000000 [ 1623.601890] x15: ffff0000117ed748 x14: ffff805f67d07000 [ 1623.607276] x13: ffff805f67d0605e x12: 0000000000000000 [ 1623.612661] x11: 0000000000000000 x10: 0000000000000000 [ 1623.618046] x9 : 0000000000000000 x8 : 000000000000000f [ 1623.623432] x7 : ffff805f67d06061 x6 : fffffffffffffffe [ 1623.628817] x5 : 0000000000000012 x4 : ffff00000901d478 [ 1623.634203] x3 : ffff0a00ffffff04 x2 : ffff805f67d07000 [ 1623.639588] x1 : ffff805f67d07000 x0 : ffffffffffffffff [ 1623.644974] Process cat (pid: 11438, stack limit = 0x000000008d4cbc10) [ 1623.651592] Call trace: [ 1623.654068] string+0x28/0x98 [ 1623.657071] vsnprintf+0x368/0x5e8 [ 1623.660517] seq_vprintf+0x70/0x98 [ 1623.668009] seq_printf+0x7c/0xa0 [ 1623.675530] r_show+0xc8/0xf8 [ 1623.682558] seq_read+0x330/0x440 [ 1623.689877] proc_reg_read+0x78/0xd0 [ 1623.697346] __vfs_read+0x60/0x1a0 [ 1623.704564] vfs_read+0x94/0x150 [ 1623.711339] ksys_read+0x6c/0xd8 [ 1623.717939] __arm64_sys_read+0x24/0x30 [ 1623.725077] el0_svc_common+0x120/0x148 [ 1623.732035] el0_svc_handler+0x30/0x40 [ 1623.738757] el0_svc+0x8/0xc [ 1623.744520] Code: d1000406 aa0103e2 54000149 b4000080 (39400085) [ 1623.753441] ---[ end trace f91b6a4937de9835 ]--- [ 1623.760871] Kernel panic - not syncing: Fatal exception [ 1623.768935] SMP: stopping secondary CPUs [ 1623.775718] Kernel Offset: disabled [ 1623.781998] CPU features: 0x002,21006008 [ 1623.788777] Memory Limit: none [ 1623.798329] Starting crashdump kernel... [ 1623.805202] Bye!
If io_setup is called successful in try_smi_init() but try_smi_init() goes out_err before calling ipmi_register_smi(), so ipmi_unregister_smi() will not be called while removing module. It leads to the resource that allocated in io_setup() can not be freed, but the name(DEVICE_NAME) of resource is freed while removing the module. It causes use-after-free when cat /proc/ioports.
Fix this by calling io_cleanup() while try_smi_init() goes to out_err. and don't call io_cleanup() until io_setup() returns successful to avoid warning prints.
--- drivers/char/ipmi/ipmi_si_intf.c | 5 +++++ drivers/char/ipmi/ipmi_si_mem_io.c | 5 +++-- drivers/char/ipmi/ipmi_si_port_io.c | 5 +++-- 3 files changed, 11 insertions(+), 4 deletions(-)
drivers/char/ipmi/ipmi_si_intf.c +5 -0
@@ -2097,6 +2097,11 @@ static int try_smi_init(struct smi_infoWARN_ON (new_smi->io.dev->init_name !=NULL ); out_err: +if (rv && new_smi->io.io_cleanup) { + new_smi->io.io_cleanup (&new_smi->io); + new_smi->io.io_cleanup =NULL ; + } +kfree (init_name);return rv; }
drivers/char/ipmi/ipmi_si_mem_io.c +3 -2
@@ -81,8 +81,6 @@ int ipmi_si_mem_setup(struct si_sm_io *iif (!addr)return -ENODEV ; - io->io_cleanup = mem_cleanup; -/* * Figure out the actual readb/readw/readl/etc routine to use based * upon the register size.
@@ -141,5 +139,8 @@ int ipmi_si_mem_setup(struct si_sm_io *imem_region_cleanup (io, io->io_size);return -EIO ; } + + io->io_cleanup = mem_cleanup; +return 0 ; }
drivers/char/ipmi/ipmi_si_port_io.c +3 -2
@@ -68,8 +68,6 @@ int ipmi_si_port_setup(struct si_sm_io *if (!addr)return -ENODEV ; - io->io_cleanup = port_cleanup; -/* * Figure out the actual inb/inw/inl/etc routine to use based * upon the register size.
@@ -109,5 +107,8 @@ int ipmi_si_port_setup(struct si_sm_io *return -EIO ; } } + + io->io_cleanup = port_cleanup; +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 178/238 dm: fix to_sector() for 32bit
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 0bdb50c531f7377a9da80d3ce2d61f389c84cb30 upstream.
A dm-raid array with devices larger than 4GB won't assemble on a 32 bit host since _check_data_dev_sectors() was added in 4.16. This is because to_sector() treats its argument as an "unsigned long" which is 32bits (4GB) on a 32bit host. Using "unsigned long long" is more correct.
Kernels as early as 4.2 can have other problems due to to_sector() being used on the size of a device.
--- include/linux/device-mapper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/device-mapper.h +1 -1
@@ -609,7 +609,7 @@ do { \*/ #define dm_target_offset (ti, sector) ((sector) - (ti)->begin) -static inline sector_t to_sector (unsigned long n) +static inline sector_t to_sector (unsigned long long n) {return (n >>SECTOR_SHIFT ); }
Greg Kroah-Hartman
maintainerPATCH 179/238 dm integrity: limit the rate of error messages
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 225557446856448039a9e495da37b72c20071ef2 upstream.
When using dm-integrity underneath md-raid, some tests with raid auto-correction trigger large amounts of integrity failures - and all these failures print an error message. These messages can bring the system to a halt if the system is using serial console.
Fix this by limiting the rate of error messages - it improves the speed of raid recovery and avoids the hang.
--- drivers/md/dm-integrity.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/md/dm-integrity.c +4 -4
@@ -1368,8 +1368,8 @@ again: checksums_ptr - checksums, !dio->write ? TAG_CMP : TAG_WRITE);if (unlikely (r)) {if (r >0 ) { -DMERR ("Checksum failed at sector 0x%llx" , - (unsigned long long )(sector - ((r + ic->tag_size -1 ) / ic->tag_size))); +DMERR_LIMIT ("Checksum failed at sector 0x%llx" , + (unsigned long long )(sector - ((r + ic->tag_size -1 ) / ic->tag_size))); r = -EILSEQ ;atomic64_inc (&ic->number_of_mismatches); }
@@ -1561,8 +1561,8 @@ retry_kmap:integrity_sector_checksum (ic, logical_sector, mem + bv.bv_offset, checksums_onstack);if (unlikely (memcmp (checksums_onstack,journal_entry_tag (ic, je), ic->tag_size))) { -DMERR ("Checksum failed when reading from journal, at sector 0x%llx" , - (unsigned long long )logical_sector); +DMERR_LIMIT ("Checksum failed when reading from journal, at sector 0x%llx" , + (unsigned long long )logical_sector); } }#endif
Greg Kroah-Hartman
maintainerPATCH 180/238 media: cx25840: mark pad sig_types to fix cx231xx init
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cody P Schafer <[email protected]>
commit 46c039d06b6ecabb94bd16c3a999b28dc83b79ce upstream.
Without this, we get failures like this when the kernel attempts to initialize a cx231xx device:
[16046.153653] cx231xx 3-1.2:1.1: New device Hauppauge Hauppauge Device @ 480 Mbps (2040:c200) with 6 interfaces [16046.153900] cx231xx 3-1.2:1.1: can't change interface 3 alt no. to 3: Max. Pkt size = 0 [16046.153907] cx231xx 3-1.2:1.1: Identified as Hauppauge USB Live 2 (card=9) [16046.154350] i2c i2c-11: Added multiplexed i2c bus 13 [16046.154379] i2c i2c-11: Added multiplexed i2c bus 14 [16046.267194] cx25840 10-0044: cx23102 A/V decoder found @ 0x88 (cx231xx #0-0) [16048.424551] cx25840 10-0044: loaded v4l-cx231xx-avcore-01.fw firmware (16382 bytes) [16048.463224] cx231xx 3-1.2:1.1: v4l2 driver version 0.0.3 [16048.567878] cx231xx 3-1.2:1.1: Registered video device video2 [v4l2] [16048.568001] cx231xx 3-1.2:1.1: Registered VBI device vbi0 [16048.568419] cx231xx 3-1.2:1.1: audio EndPoint Addr 0x83, Alternate settings: 3 [16048.568425] cx231xx 3-1.2:1.1: video EndPoint Addr 0x84, Alternate settings: 5 [16048.568431] cx231xx 3-1.2:1.1: VBI EndPoint Addr 0x85, Alternate settings: 2 [16048.568436] cx231xx 3-1.2:1.1: sliced CC EndPoint Addr 0x86, Alternate settings: 2 [16048.568448] usb 3-1.2: couldn't get decoder output pad for V4L I/O [16048.568453] cx231xx 3-1.2:1.1: V4L2 device vbi0 deregistered [16048.568579] cx231xx 3-1.2:1.1: V4L2 device video2 deregistered [16048.569001] cx231xx: probe of 3-1.2:1.1 failed with error -22
Likely a regession since Commit 9d6d20e652c0
("media: v4l2-mc: switch it to use the new approach to setup pipelines") (v4.19-rc1-100-g9d6d20e652c0), which introduced the use of PAD_SIGNAL_DV within v4l2_mc_create_media_graph().
This also modifies cx25840 to remove the VBI pad, matching the action taken in Commit 092a37875a22 ("media: v4l2: remove VBI output pad").
--- drivers/media/i2c/cx25840/cx25840-core.c | 3 ++- drivers/media/i2c/cx25840/cx25840-core.h | 1 - 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/i2c/cx25840/cx25840-core.c +2 -1
@@ -5216,8 +5216,9 @@ static int cx25840_probe(struct i2c_clie* those extra inputs. So, let's add it only when needed. */ state->pads[CX25840_PAD_INPUT ].flags =MEDIA_PAD_FL_SINK ; + state->pads[CX25840_PAD_INPUT ].sig_type =PAD_SIGNAL_ANALOG ; state->pads[CX25840_PAD_VID_OUT ].flags =MEDIA_PAD_FL_SOURCE ; - state->pads[CX25840_PAD_VBI_OUT ].flags =MEDIA_PAD_FL_SOURCE ; + state->pads[CX25840_PAD_VID_OUT ].sig_type =PAD_SIGNAL_DV ; sd->entity.function =MEDIA_ENT_F_ATV_DECODER ; ret = media_entity_pads_init(&sd->entity, ARRAY_SIZE(state->pads),
drivers/media/i2c/cx25840/cx25840-core.h +0 -1
@@ -40,7 +40,6 @@ enum cx25840_model {enum cx25840_media_pads {CX25840_PAD_INPUT ,CX25840_PAD_VID_OUT , -CX25840_PAD_VBI_OUT ,CX25840_NUM_PADS };
Greg Kroah-Hartman
maintainerPATCH 181/238 mfd: sm501: Fix potential NULL pointer dereference
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
commit ae7b8eda27b33b1f688dfdebe4d46f690a8f9162 upstream.
There is a potential NULL pointer dereference in case devm_kzalloc() fails and returns NULL.
Fix this by adding a NULL check on *lookup*
This bug was detected with the help of Coccinelle.
--- drivers/mfd/sm501.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mfd/sm501.c +3 -0
@@ -1145,6 +1145,9 @@ static int sm501_register_gpio_i2c_insta lookup =devm_kzalloc (&pdev->dev,sizeof (*lookup) +3 *sizeof (struct gpiod_lookup ),GFP_KERNEL ); +if (!lookup) +return -ENOMEM ; + lookup->dev_id ="i2c-gpio" ;if (iic->pin_sda <32 ) lookup->table[0 ].chip_label ="SM501-LOW" ;
Greg Kroah-Hartman
maintainerPATCH 182/238 cpcap-charger: generate events for userspace
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Machek <[email protected]>
commit fd10606f93a149a9f3d37574e5385b083b4a7b32 upstream.
The driver doesn't generate uevents on charger connect/disconnect. This leads to UPower not detecting when AC is on or off... and that is bad.
Reported by Arthur D. on github (
https://github.com/maemo-leste/bugtracker/issues/206 ), thanks to Merlijn Wajer for suggesting a fix.
--- drivers/power/supply/cpcap-charger.c | 1 + 1 file changed, 1 insertion(+)
drivers/power/supply/cpcap-charger.c +1 -0
@@ -458,6 +458,7 @@ static void cpcap_usb_detect(struct work goto out_err; } +power_supply_changed (ddata->usb);return ; out_err:
Greg Kroah-Hartman
maintainerPATCH 183/238 cpuidle: governor: Add new governors to cpuidle_governors again
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
commit 22782b3f9bb8ae21c710e2880db21bc729771e92 upstream.
After commit 61cb5758d3c4 ("cpuidle: Add cpuidle.governor= command line parameter") new cpuidle governors are not added to the list of available governors, so governor selection via sysfs doesn't work as expected (even though it is rarely used anyway).
Fix that by making cpuidle_register_governor() add new governors to cpuidle_governors again.
--- drivers/cpuidle/governor.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpuidle/governor.c +1 -0
@@ -89,6 +89,7 @@ int cpuidle_register_governor(struct cpumutex_lock (&cpuidle_lock);if (__cpuidle_find_governor (gov->name) ==NULL ) { ret =0 ; +list_add_tail (&gov->governor_list, &cpuidle_governors); if (!cpuidle_curr_governor || !strncasecmp(param_governor, gov->name, CPUIDLE_NAME_LEN) || (cpuidle_curr_governor->rating < gov->rating &&
Greg Kroah-Hartman
maintainerPATCH 184/238 NFS: Fix I/O request leakages
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit f57dcf4c72113c745d83f1c65f7291299f65c14f upstream.
When we fail to add the request to the I/O queue, we currently leave it to the caller to free the failed request. However since some of the requests that fail are actually created by nfs_pageio_add_request() itself, and are not passed back the caller, this leads to a leakage issue, which can again cause page locks to leak.
This commit addresses the leakage by freeing the created requests on error, using desc->pg_completion_ops->error_cleanup()
--- fs/nfs/pagelist.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-)
fs/nfs/pagelist.c +21 -5
@@ -988,6 +988,17 @@ static void nfs_pageio_doio(struct nfs_p } } +static void +nfs_pageio_cleanup_request (struct nfs_pageio_descriptor *desc, +struct nfs_page *req) +{ +LIST_HEAD (head); + +nfs_list_remove_request (req); +nfs_list_add_request (req, &head); + desc->pg_completion_ops->error_cleanup (&head); +} +/** * nfs_pageio_add_request - Attempt to coalesce a request into a page list. * @desc: destination io descriptor
@@ -1025,10 +1036,8 @@ static int __nfs_pageio_add_request(strunfs_page_group_unlock (req); desc->pg_moreio =1 ;nfs_pageio_doio (desc); -if (desc->pg_error <0 ) -return 0 ; -if (mirror->pg_recoalesce) -return 0 ; +if (desc->pg_error <0 || mirror->pg_recoalesce) + goto out_cleanup_subreq;/* retry add_request for this subreq */ nfs_page_group_lock (req);continue ;
@@ -1061,6 +1070,10 @@ err_ptr: desc->pg_error =PTR_ERR (subreq);nfs_page_group_unlock (req);return 0 ; +out_cleanup_subreq: +if (req != subreq) +nfs_pageio_cleanup_request (desc, subreq); +return 0 ; }static int nfs_do_recoalesce (struct nfs_pageio_descriptor *desc)
@@ -1168,11 +1181,14 @@ int nfs_pageio_add_request(struct nfs_paif (nfs_pgio_has_mirroring (desc)) desc->pg_mirror_idx = midx;if (!nfs_pageio_add_request_mirror (desc, dupreq)) - goto out_failed; + goto out_cleanup_subreq; }return 1 ; +out_cleanup_subreq: +if (req != dupreq) +nfs_pageio_cleanup_request (desc, dupreq); out_failed:nfs_pageio_error_cleanup (desc);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 185/238 NFS: Fix an I/O request leakage in nfs_do_recoalesce
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 4d91969ed4dbcefd0e78f77494f0cb8fada9048a upstream.
Whether we need to exit early, or just reprocess the list, we must not lost track of the request which failed to get recoalesced.
--- fs/nfs/pagelist.c | 1 - 1 file changed, 1 deletion(-)
fs/nfs/pagelist.c +0 -1
@@ -1092,7 +1092,6 @@ static int nfs_do_recoalesce(struct nfs_struct nfs_page *req; req = list_first_entry(&head, struct nfs_page, wb_list); -nfs_list_remove_request (req);if (__nfs_pageio_add_request (desc, req))continue ;if (desc->pg_error <0 ) {
Greg Kroah-Hartman
maintainerPATCH 186/238 NFS: Dont recoalesce on error in nfs_pageio_complete_mirror()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 8127d82705998568b52ac724e28e00941538083d upstream.
If the I/O completion failed with a fatal error, then we should just exit nfs_pageio_complete_mirror() rather than try to recoalesce.
--- fs/nfs/pagelist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/pagelist.c +1 -1
@@ -1209,7 +1209,7 @@ static void nfs_pageio_complete_mirror(s desc->pg_mirror_idx = mirror_idx;for (;;) {nfs_pageio_doio (desc); -if (!mirror->pg_recoalesce) +if (desc->pg_error <0 || !mirror->pg_recoalesce)break ;if (!nfs_do_recoalesce (desc))break ;
Greg Kroah-Hartman
maintainerPATCH 187/238 nfsd: fix performance-limiting session calculation
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: J. Bruce Fields <[email protected]>
commit c54f24e338ed2a35218f117a4a1afb5f9e2b4e64 upstream.
We're unintentionally limiting the number of slots per nfsv4.1 session to 10. Often more than 10 simultaneous RPCs are needed for the best performance.
This calculation was meant to prevent any one client from using up more than a third of the limit we set for total memory use across all clients and sessions. Instead, it's limiting the client to a third of the maximum for a single session.
Fix this.
--- fs/nfsd/nfs4state.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/nfsd/nfs4state.c +4 -4
@@ -1544,16 +1544,16 @@ static u32 nfsd4_get_drc_mem(struct nfsd {u32 slotsize =slot_bytes (ca);u32 num = ca->maxreqs; -int avail; +unsigned long avail, total_avail;spin_lock (&nfsd_drc_lock); - avail =min ((unsigned long )NFSD_MAX_MEM_PER_SESSION , - nfsd_drc_max_mem - nfsd_drc_mem_used); + total_avail = nfsd_drc_max_mem - nfsd_drc_mem_used; + avail =min ((unsigned long )NFSD_MAX_MEM_PER_SESSION , total_avail);/* * Never use more than a third of the remaining memory, * unless it's the only way to give this client a slot: */ - avail =clamp_t (int, avail, slotsize, avail/3 ); + avail =clamp_t (int, avail, slotsize, total_avail/3 ); num =min_t (int, num, avail / slotsize); nfsd_drc_mem_used += num * slotsize;spin_unlock (&nfsd_drc_lock);
Greg Kroah-Hartman
maintainerPATCH 188/238 nfsd: fix memory corruption caused by readdir
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit b602345da6cbb135ba68cf042df8ec9a73da7981 upstream.
If the result of an NFSv3 readdir{,plus} request results in the "offset" on one entry having to be split across 2 pages, and is sized so that the next directory entry doesn't fit in the requested size, then memory corruption can happen.
When encode_entry() is called after encoding the last entry that fits, it notices that ->offset and ->offset1 are set, and so stores the offset value in the two pages as required. It clears ->offset1 but *does not* clear ->offset.
Normally this omission doesn't matter as encode_entry_baggage() will be called, and will set ->offset to a suitable value (not on a page boundary).
But in the case where cd->buflen < elen and nfserr_toosmall is returned, ->offset is not reset.
This means that nfsd3proc_readdirplus will see ->offset with a value 4 bytes before the end of a page, and ->offset1 set to NULL. It will try to write 8bytes to ->offset.
If we are lucky, the next page will be read-only, and the system will
BUG: unable to handle kernel paging request at...
If we are unlucky, some innocent page will have the first 4 bytes corrupted.
nfsd3proc_readdir() doesn't even check for ->offset1, it just blindly writes 8 bytes to the offset wherever it is.
Fix this by clearing ->offset after it is used, and copying the ->offset handling code from nfsd3_proc_readdirplus into nfsd3_proc_readdir.
(Note that the commit hash in the Fixes tag is from the 'history'
tree - this bug predates git).
Fixes-URL: https://git.kernel.org/pub/scm/linux/kernel/git/history/history.git/commit/?id=0b1d57cf7654
--- fs/nfsd/nfs3proc.c | 16 ++++++++++++++-- fs/nfsd/nfs3xdr.c | 1 + 2 files changed, 15 insertions(+), 2 deletions(-)
fs/nfsd/nfs3proc.c +14 -2
@@ -463,8 +463,19 @@ nfsd3_proc_readdir(struct svc_rqst *rqst &resp->common, nfs3svc_encode_entry);memcpy (resp->verf, argp->verf,8 ); resp->count = resp->buffer - argp->buffer; -if (resp->offset) -xdr_encode_hyper (resp->offset, argp->cookie); +if (resp->offset) { +loff_t offset = argp->cookie; + +if (unlikely (resp->offset1)) { +/* we ended up with offset on a page boundary */ + *resp->offset =htonl (offset >>32 ); + *resp->offset1 =htonl (offset &0xffffffff ); + resp->offset1 =NULL ; + }else { +xdr_encode_hyper (resp->offset, offset); + } + resp->offset =NULL ; + }RETURN_STATUS (nfserr); }
@@ -533,6 +544,7 @@ nfsd3_proc_readdirplus(struct svc_rqst * }else {xdr_encode_hyper (resp->offset, offset); } + resp->offset =NULL ; }RETURN_STATUS (nfserr);
fs/nfsd/nfs3xdr.c +1 -0
@@ -921,6 +921,7 @@ encode_entry(struct readdir_cd *ccd, con }else {xdr_encode_hyper (cd->offset, offset64); } + cd->offset =NULL ; }/*
Greg Kroah-Hartman
maintainerPATCH 189/238 nfsd: fix wrong check in write_v4_end_grace()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yihao Wu <[email protected]>
commit dd838821f0a29781b185cd8fb8e48d5c177bd838 upstream.
Commit 62a063b8e7d1 "nfsd4: fix crash on writing v4_end_grace before nfsd startup" is trying to fix a NULL dereference issue, but it mistakenly checks if the nfsd server is started. So fix it.
--- fs/nfsd/nfsctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfsctl.c +1 -1
@@ -1126,7 +1126,7 @@ static ssize_t write_v4_end_grace(structcase 'Y' :case 'y' :case '1' : -if (nn->nfsd_serv) +if (!nn->nfsd_serv)return -EBUSY ;nfsd4_end_grace (nn);break ;
Greg Kroah-Hartman
maintainerPATCH 190/238 NFSv4.1: Reinitialise sequence results before retransmitting a request
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit c1dffe0bf7f9c3d57d9f237a7cb2a81e62babd2b upstream.
If we have to retransmit a request, we should ensure that we reinitialise the sequence results structure, since in the event of a signal we need to treat the request as if it had not been sent.
--- fs/nfs/nfs4proc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
fs/nfs/nfs4proc.c +8 -4
@@ -947,6 +947,13 @@ nfs4_sequence_process_interrupted(struct#endif /* !CONFIG_NFS_V4_1 */ +static void nfs41_sequence_res_init (struct nfs4_sequence_res *res) +{ + res->sr_timestamp = jiffies; + res->sr_status_flags =0 ; + res->sr_status =1 ; +} + static void nfs4_sequence_attach_slot(struct nfs4_sequence_args *args, struct nfs4_sequence_res *res,
@@ -958,10 +965,6 @@ void nfs4_sequence_attach_slot(struct nf args->sa_slot = slot; res->sr_slot = slot; - res->sr_timestamp = jiffies; - res->sr_status_flags =0 ; - res->sr_status =1 ; - } int nfs4_setup_sequence(struct nfs_client *client,
@@ -1007,6 +1010,7 @@ int nfs4_setup_sequence(struct nfs_clientrace_nfs4_setup_sequence (session, args); out_start: +nfs41_sequence_res_init (res);rpc_call_start (task);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 191/238 svcrpc: fix UDP on servers with lots of threads
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: J. Bruce Fields <[email protected]>
commit b7e5034cbecf5a65b7bfdc2b20a8378039577706 upstream.
James Pearson found that an NFS server stopped responding to UDP requests if started with more than 1017 threads.
sv_max_mesg is about 2^20, so that is probably where the calculation performed by
svc_sock_setbufsize(svsk->sk_sock,
(serv->sv_nrthreads+3) * serv->sv_max_mesg,
(serv->sv_nrthreads+3) * serv->sv_max_mesg);starts to overflow an int.
--- net/sunrpc/svcsock.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
net/sunrpc/svcsock.c +10 -10
@@ -349,12 +349,16 @@ static ssize_t svc_recvfrom(struct svc_r/* * Set socket snd and rcv buffer lengths */ -static void svc_sock_setbufsize (struct socket *sock,unsigned int snd, -unsigned int rcv) +static void svc_sock_setbufsize (struct svc_sock *svsk,unsigned int nreqs) { +unsigned int max_mesg = svsk->sk_xprt.xpt_server->sv_max_mesg; +struct socket *sock = svsk->sk_sock; + + nreqs =min (nreqs,INT_MAX /2 / max_mesg); +lock_sock (sock->sk); - sock->sk->sk_sndbuf = snd *2 ; - sock->sk->sk_rcvbuf = rcv *2 ; + sock->sk->sk_sndbuf = nreqs * max_mesg *2 ; + sock->sk->sk_rcvbuf = nreqs * max_mesg *2 ; sock->sk->sk_write_space (sock->sk);release_sock (sock->sk); }
@@ -516,9 +520,7 @@ static int svc_udp_recvfrom(struct svc_r* provides an upper bound on the number of threads * which will access the socket. */ -svc_sock_setbufsize (svsk->sk_sock, - (serv->sv_nrthreads+3 ) * serv->sv_max_mesg, - (serv->sv_nrthreads+3 ) * serv->sv_max_mesg); +svc_sock_setbufsize (svsk, serv->sv_nrthreads +3 );clear_bit (XPT_DATA , &svsk->sk_xprt.xpt_flags); skb =NULL ;
@@ -681,9 +683,7 @@ static void svc_udp_init(struct svc_sock* receive and respond to one request. * svc_udp_recvfrom will re-adjust if necessary */ -svc_sock_setbufsize (svsk->sk_sock, -3 * svsk->sk_xprt.xpt_server->sv_max_mesg, -3 * svsk->sk_xprt.xpt_server->sv_max_mesg); +svc_sock_setbufsize (svsk,3 );/* data might have come in before data_ready set up */ set_bit (XPT_DATA , &svsk->sk_xprt.xpt_flags);
Greg Kroah-Hartman
maintainerPATCH 192/238 PM / wakeup: Rework wakeup source timer cancellation
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viresh Kumar <[email protected]>
commit 1fad17fb1bbcd73159c2b992668a6957ecc5af8a upstream.
If wakeup_source_add() is called right after wakeup_source_remove() for the same wakeup source, timer_setup() may be called for a potentially scheduled timer which is incorrect.
To avoid that, move the wakeup source timer cancellation from wakeup_source_drop() to wakeup_source_remove().
Moreover, make wakeup_source_remove() clear the timer function after canceling the timer to let wakeup_source_not_registered() treat unregistered wakeup sources in the same way as the ones that have never been registered.
--- drivers/base/power/wakeup.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/base/power/wakeup.c +7 -1
@@ -118,7 +118,6 @@ void wakeup_source_drop(struct wakeup_soif (!ws)return ; -del_timer_sync (&ws->timer);__pm_relax (ws); }EXPORT_SYMBOL_GPL (wakeup_source_drop);
@@ -205,6 +204,13 @@ void wakeup_source_remove(struct wakeup_list_del_rcu (&ws->entry);raw_spin_unlock_irqrestore (&events_lock, flags);synchronize_srcu (&wakeup_srcu); + +del_timer_sync (&ws->timer); +/* +* Clear timer.function to make wakeup_source_not_registered() treat +* this wakeup source as not registered. +*/ + ws->timer.function =NULL ; }EXPORT_SYMBOL_GPL (wakeup_source_remove);
Greg Kroah-Hartman
maintainerPATCH 193/238 PM / OPP: Update performance state when freq == old_freq
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viresh Kumar <[email protected]>
commit faef080f6db5320011862f7baf1aa66d0851559f upstream.
At boot up, CPUFreq core performs a sanity check to see if the system is running at a frequency defined in the frequency table of the CPU. If so, we try to find a valid frequency (lowest frequency greater than the currently programmed frequency) from the table and set it. When the call reaches dev_pm_opp_set_rate(), it calls _find_freq_ceil(opp_table, &old_freq) to find the previously configured OPP and this call also updates the old_freq. This eventually sets the old_freq == freq (new target requested by cpufreq core) and we skip updating the performance state in this case.
Fix this by also updating the performance state when the old_freq == freq.
--- drivers/opp/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/opp/core.c +1 -1
@@ -743,7 +743,7 @@ int dev_pm_opp_set_rate(struct device *d old_freq, freq);/* Scaling up? Configure required OPPs before frequency */ -if (freq > old_freq) { +if (freq >= old_freq) { ret =_set_required_opps (dev, opp_table, opp);if (ret) goto put_opp;
Greg Kroah-Hartman
maintainerPATCH 194/238 bcache: never writeback a discard operation
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Axtens <[email protected]>
commit 9951379b0ca88c95876ad9778b9099e19a95d566 upstream.
Some users see panics like the following when performing fstrim on a bcached volume:
[ 529.803060] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008 [ 530.183928] #PF error: [normal kernel read fault] [ 530.412392] PGD 8000001f42163067 P4D 8000001f42163067 PUD 1f42168067 PMD 0 [ 530.750887] Oops: 0000 [#1] SMP PTI [ 530.920869] CPU: 10 PID: 4167 Comm: fstrim Kdump: loaded Not tainted 5.0.0-rc1+ #3 [ 531.290204] Hardware name: HP ProLiant DL360 Gen9/ProLiant DL360 Gen9, BIOS P89 12/27/2015 [ 531.693137] RIP: 0010:blk_queue_split+0x148/0x620 [ 531.922205] Code: 60 38 89 55 a0 45 31 db 45 31 f6 45 31 c9 31 ff 89 4d 98 85 db 0f 84 7f 04 00 00 44 8b 6d 98 4c 89 ee 48 c1 e6 04 49 03 70 78 <8b> 46 08 44 8b 56 0c 48 8b 16 44 29 e0 39 d8 48 89 55 a8 0f 47 c3 [ 532.838634] RSP: 0018:ffffb9b708df39b0 EFLAGS: 00010246 [ 533.093571] RAX: 00000000ffffffff RBX: 0000000000046000 RCX: 0000000000000000 [ 533.441865] RDX: 0000000000000200 RSI: 0000000000000000 RDI: 0000000000000000 [ 533.789922] RBP: ffffb9b708df3a48 R08: ffff940d3b3fdd20 R09: 0000000000000000 [ 534.137512] R10: ffffb9b708df3958 R11: 0000000000000000 R12: 0000000000000000 [ 534.485329] R13: 0000000000000000 R14: 0000000000000000 R15: ffff940d39212020 [ 534.833319] FS: 00007efec26e3840(0000) GS:ffff940d1f480000(0000) knlGS:0000000000000000 [ 535.224098] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 535.504318] CR2: 0000000000000008 CR3: 0000001f4e256004 CR4: 00000000001606e0 [ 535.851759] Call Trace: [ 535.970308] ? mempool_alloc_slab+0x15/0x20 [ 536.174152] ? bch_data_insert+0x42/0xd0 [bcache] [ 536.403399] blk_mq_make_request+0x97/0x4f0 [ 536.607036] generic_make_request+0x1e2/0x410 [ 536.819164] submit_bio+0x73/0x150 [ 536.980168] ? submit_bio+0x73/0x150 [ 537.149731] ? bio_associate_blkg_from_css+0x3b/0x60 [ 537.391595] ? _cond_resched+0x1a/0x50 [ 537.573774] submit_bio_wait+0x59/0x90 [ 537.756105] blkdev_issue_discard+0x80/0xd0 [ 537.959590] ext4_trim_fs+0x4a9/0x9e0 [ 538.137636] ? ext4_trim_fs+0x4a9/0x9e0 [ 538.324087] ext4_ioctl+0xea4/0x1530 [ 538.497712] ? _copy_to_user+0x2a/0x40 [ 538.679632] do_vfs_ioctl+0xa6/0x600 [ 538.853127] ? __do_sys_newfstat+0x44/0x70 [ 539.051951] ksys_ioctl+0x6d/0x80 [ 539.212785] __x64_sys_ioctl+0x1a/0x20 [ 539.394918] do_syscall_64+0x5a/0x110 [ 539.568674] entry_SYSCALL_64_after_hwframe+0x44/0xa9
We have observed it where both:
1) LVM/devmapper is involved (bcache backing device is LVM volume) and
2) writeback cache is involved (bcache cache_mode is writeback)
On one machine, we can reliably reproduce it with:
# echo writeback > /sys/block/bcache0/bcache/cache_mode
(not sure whether above line is required)
# mount /dev/bcache0 /test
# for i in {0..10}; do
file="$(mktemp /test/zero.XXX)"
dd if=/dev/zero of="$file" bs=1M count=256
sync
rm $file
done
# fstrim -v /testObserving this with tracepoints on, we see the following writes:
fstrim-18019 [022] .... 91107.302026: bcache_write: 73f95583-561c-408f-a93a-4cbd2498f5c8 inode 0 DS 4260112 + 196352 hit 0 bypass 1 fstrim-18019 [022] .... 91107.302050: bcache_write: 73f95583-561c-408f-a93a-4cbd2498f5c8 inode 0 DS 4456464 + 262144 hit 0 bypass 1 fstrim-18019 [022] .... 91107.302075: bcache_write: 73f95583-561c-408f-a93a-4cbd2498f5c8 inode 0 DS 4718608 + 81920 hit 0 bypass 1 fstrim-18019 [022] .... 91107.302094: bcache_write: 73f95583-561c-408f-a93a-4cbd2498f5c8 inode 0 DS 5324816 + 180224 hit 0 bypass 1 fstrim-18019 [022] .... 91107.302121: bcache_write: 73f95583-561c-408f-a93a-4cbd2498f5c8 inode 0 DS 5505040 + 262144 hit 0 bypass 1 fstrim-18019 [022] .... 91107.302145: bcache_write: 73f95583-561c-408f-a93a-4cbd2498f5c8 inode 0 DS 5767184 + 81920 hit 0 bypass 1 fstrim-18019 [022] .... 91107.308777: bcache_write: 73f95583-561c-408f-a93a-4cbd2498f5c8 inode 0 DS 6373392 + 180224 hit 1 bypass 0
<crash>
Note the final one has different hit/bypass flags.
This is because in should_writeback(), we were hitting a case where the partial stripe condition was returning true and so should_writeback() was returning true early.
If that hadn't been the case, it would have hit the would_skip test, and as would_skip == s->iop.bypass == true, should_writeback() would have returned false.
Looking at the git history from 'commit 72c270612bd3 ("bcache: Write out full stripes")', it looks like the idea was to optimise for raid5/6:
* If a stripe is already dirty, force writes to that stripe to writeback mode - to help build up full stripes of dirty data
To fix this issue, make sure that should_writeback() on a discard op never returns true.
More details of debugging:
https://www.spinics.net/lists/linux-bcache/msg06996.html
Previous reports:
- https://bugzilla.kernel.org/show_bug.cgi?id=201051
- https://bugzilla.kernel.org/show_bug.cgi?id=196103
- https://www.spinics.net/lists/linux-bcache/msg06885.html
(Coly Li: minor modification to follow maximum 75 chars per line rule)
--- drivers/md/bcache/writeback.h | 3 +++ 1 file changed, 3 insertions(+)
drivers/md/bcache/writeback.h +3 -0
@@ -71,6 +71,9 @@ static inline bool should_writeback(stru in_use > bch_cutoff_writeback_sync)return false; +if (bio_op (bio) ==REQ_OP_DISCARD ) +return false; +if (dc->partial_stripes_expensive &&bcache_dev_stripe_dirty (dc, bio->bi_iter.bi_sector,bio_sectors (bio)))
Greg Kroah-Hartman
maintainerPATCH 195/238 bcache: treat stale && dirty keys as bad keys
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tang Junhui <[email protected]>
commit 58ac323084ebf44f8470eeb8b82660f9d0ee3689 upstream.
Stale && dirty keys can be produced in the follow way:
After writeback in write_dirty_finish(), dirty keys k1 will replace by clean keys k2
==>ret = bch_btree_insert(dc->disk.c, &keys, NULL, &w->key); ==>btree_insert_fn(struct btree_op *b_op, struct btree *b) ==>static int bch_btree_insert_node(struct btree *b,
struct btree_op *op,
struct keylist *insert_keys,
atomic_t *journal_ref,
Then two steps:
A) update k1 to k2 in btree node memory; bch_btree_insert_keys(b, op, insert_keys, replace_key)
B) Write the bset(contains k2) to cache disk by a 30s delay work bch_btree_leaf_dirty(b, journal_ref).
But before the 30s delay work write the bset to cache device, these things happened:
A) GC works, and reclaim the bucket k2 point to;
B) Allocator works, and invalidate the bucket k2 point to, and increase the gen of the bucket, and place it into free_inc fifo;
C) Until now, the 30s delay work still does not finish work, so in the disk, the key still is k1, it is dirty and stale (its gen is smaller than the gen of the bucket). and then the machine power off suddenly happens;
D) When the machine power on again, after the btree reconstruction, the stale dirty key appear.
In bch_extent_bad(), when expensive_debug_checks is off, it would treat the dirty key as good even it is stale keys, and it would cause bellow probelms:
A) In read_dirty() it would cause machine crash:
BUG_ON(ptr_stale(dc->disk.c, &w->key, 0));
B) It could be worse when reads hits stale dirty keys, it would read old incorrect data.
This patch tolerate the existence of these stale && dirty keys, and treat them as bad key in bch_extent_bad().
(Coly Li: fix indent which was modified by sender's email client)
--- drivers/md/bcache/extents.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/md/bcache/extents.c +7 -6
@@ -538,6 +538,7 @@ static bool bch_extent_bad(struct btree_ { struct btree *b = container_of(bk, struct btree, keys);unsigned int i, stale; +char buf[80 ];if (!KEY_PTRS (k) ||bch_extent_invalid (bk, k))
@@ -547,19 +548,19 @@ static bool bch_extent_bad(struct btree_if (!ptr_available (b->c, k, i))return true; -if (!expensive_debug_checks (b->c) &&KEY_DIRTY (k)) -return false; -for (i =0 ; i <KEY_PTRS (k); i++) { stale =ptr_stale (b->c, k, i); +if (stale &&KEY_DIRTY (k)) { +bch_extent_to_text (buf,sizeof (buf), k); +pr_info ("stale dirty pointer, stale %u, key: %s" , + stale, buf); + } +btree_bug_on (stale >BUCKET_GC_GEN_MAX , b,"key too stale: %i, need_gc %u" , stale, b->c->need_gc); -btree_bug_on (stale &&KEY_DIRTY (k) &&KEY_SIZE (k), - b,"stale dirty pointer" ); -if (stale)return true;
Greg Kroah-Hartman
maintainerPATCH 196/238 bcache: use (REQ_META|REQ_PRIO) to indicate bio for metadata
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Coly Li <[email protected]>
commit dc7292a5bcb4c878b076fca2ac3fc22f81b8f8df upstream.
In 'commit 752f66a75aba ("bcache: use REQ_PRIO to indicate bio for metadata")' REQ_META is replaced by REQ_PRIO to indicate metadata bio. This assumption is not always correct, e.g. XFS uses REQ_META to mark metadata bio other than REQ_PRIO. This is why Nix noticed that bcache does not cache metadata for XFS after the above commit.
Thanks to Dave Chinner, he explains the difference between REQ_META and REQ_PRIO from view of file system developer. Here I quote part of his explanation from mailing list,
REQ_META is used for metadata. REQ_PRIO is used to communicate to the lower layers that the submitter considers this IO to be more important that non REQ_PRIO IO and so dispatch should be expedited.
IOWs, if the filesystem considers metadata IO to be more important that user data IO, then it will use REQ_PRIO | REQ_META rather than just REQ_META.
Then it seems bios with REQ_META or REQ_PRIO should both be cached for performance optimation, because they are all probably low I/O latency demand by upper layer (e.g. file system).
So in this patch, when we want to decide whether to bypass the cache, REQ_META and REQ_PRIO are both checked. Then both metadata and high priority I/O requests will be handled properly.
--- drivers/md/bcache/request.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/md/bcache/request.c +4 -3
@@ -392,10 +392,11 @@ static bool check_should_bypass(struct c/* * Flag for bypass if the IO is for read-ahead or background, -* unless the read-ahead request is for metadata (eg, for gfs2). +* unless the read-ahead request is for metadata +* (eg, for gfs2 or xfs). */ if (bio->bi_opf & (REQ_RAHEAD |REQ_BACKGROUND ) && - !(bio->bi_opf &REQ_PRIO )) + !(bio->bi_opf & (REQ_META |REQ_PRIO ))) goto skip; if (bio->bi_iter.bi_sector & (c->sb.block_size - 1) ||
@@ -877,7 +878,7 @@ static int cached_dev_cache_miss(struct }if (!(bio->bi_opf &REQ_RAHEAD ) && - !(bio->bi_opf &REQ_PRIO ) && + !(bio->bi_opf & (REQ_META |REQ_PRIO )) && s->iop.c->gc_stats.in_use <CUTOFF_CACHE_READA ) reada =min_t (sector_t, dc->readahead >>9 ,get_capacity (bio->bi_disk) -bio_end_sector (bio));
Greg Kroah-Hartman
maintainerPATCH 197/238 stable-kernel-rules.rst: add link to networking patch queue
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit a41e8f25fa8f8f67360d88eb0eebbabe95a64bdf upstream.
The networking maintainer keeps a public list of the patches being queued up for the next round of stable releases. Be sure to check there before asking for a patch to be applied so that you do not waste people's time.
--- Documentation/process/stable-kernel-rules.rst | 3 +++ 1 file changed, 3 insertions(+)
Documentation/process/stable-kernel-rules.rst +3 -0
@@ -38,6 +38,9 @@ Procedure for submitting patches to the - If the patch covers files in net/ or drivers/net please follow netdev stable submission guidelines as described in :ref:`Documentation/networking/netdev-FAQ.rst <netdev-FAQ>` + after first checking the stable networking queue at + https://patchwork.ozlabs.org/bundle/davem/stable/?series=&submitter=&state=*&q=&archive= + to ensure the requested patch is not already queued up. - Security patches should not be handled (solely) by the -stable review process but should follow the procedures in :ref:`Documentation/admin-guide/security-bugs.rst <securitybugs>`.
Greg Kroah-Hartman
maintainerPATCH 198/238 vt: perform safe console erase in the right order
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Pitre <[email protected]>
commit a6dbe442755999960ca54a9b8ecfd9606be0ea75 upstream.
Commit 4b4ecd9cb853 ("vt: Perform safe console erase only once") removed what appeared to be an extra call to scr_memsetw(). This missed the fact that set_origin() must be called before clearing the screen otherwise old screen content gets restored on the screen when using vgacon. Let's fix that by moving all the scrollback handling to flush_scrollback() where it logically belongs, and invoking it before the actual screen clearing in csi_J(), making the code simpler in the end.
--- drivers/tty/vt/vt.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/tty/vt/vt.c +7 -8
@@ -935,8 +935,11 @@ static void flush_scrollback(struct vc_d {WARN_CONSOLE_UNLOCKED (); +set_origin (vc);if (vc->vc_sw->con_flush_scrollback) vc->vc_sw->con_flush_scrollback (vc); +else + vc->vc_sw->con_switch (vc); }/*
@@ -1503,8 +1506,10 @@ static void csi_J(struct vc_data *vc, in count = ((vc->vc_pos - vc->vc_origin) >>1 ) +1 ; start = (unsigned short *)vc->vc_origin;break ; +case 3 :/* include scrollback */ +flush_scrollback (vc); +/* fallthrough */ case 2 :/* erase whole display */ -case 3 :/* (and scrollback buffer later) */ vc_uniscr_clear_lines (vc,0 , vc->vc_rows); count = vc->vc_cols * vc->vc_rows; start = (unsigned short *)vc->vc_origin;
@@ -1513,13 +1518,7 @@ static void csi_J(struct vc_data *vc, inreturn ; }scr_memsetw (start, vc->vc_video_erase_char,2 * count); -if (vpar ==3 ) { -set_origin (vc); -flush_scrollback (vc); -if (con_is_visible (vc)) -update_screen (vc); - }else if (con_should_update (vc)) -do_update_region (vc, (unsigned long ) start, count); +update_region (vc, (unsigned long ) start, count); vc->vc_need_wrap =0 ; }
Greg Kroah-Hartman
maintainerPATCH 199/238 x86/unwind/orc: Fix ORC unwind table alignment
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
commit f76a16adc485699f95bb71fce114f97c832fe664 upstream.
The .orc_unwind section is a packed array of 6-byte structs. It's currently aligned to 6 bytes, which is causing warnings in the LLD linker.
Six isn't a power of two, so it's not a valid alignment value. The actual alignment doesn't matter much because it's an array of packed structs. An alignment of two is sufficient. In reality it always gets aligned to four bytes because it comes immediately after the 4-byte-aligned .orc_unwind_ip section.
--- include/asm-generic/vmlinux.lds.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/asm-generic/vmlinux.lds.h +1 -1
@@ -733,7 +733,7 @@ KEEP(*(.orc_unwind_ip)) \ __stop_orc_unwind_ip = .; \ } \ - . = ALIGN(6); \ + . = ALIGN(2); \ .orc_unwind : AT(ADDR(.orc_unwind) - LOAD_OFFSET) { \ __start_orc_unwind = .; \ KEEP(*(.orc_unwind)) \
Greg Kroah-Hartman
maintainerPATCH 200/238 perf intel-pt: Fix CYC timestamp calculation after OVF
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit 03997612904866abe7cdcc992784ef65cb3a4b81 upstream.
CYC packet timestamp calculation depends upon CBR which was being cleared upon overflow (OVF). That can cause errors due to failing to synchronize with sideband events. Even if a CBR change has been lost, the old CBR is still a better estimate than zero. So remove the clearing of CBR.
--- tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 1 - 1 file changed, 1 deletion(-)
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +0 -1
@@ -1394,7 +1394,6 @@ static int intel_pt_overflow(struct inte {intel_pt_log ("ERROR: Buffer overflow\n" );intel_pt_clear_tx_flags (decoder); - decoder->cbr =0 ; decoder->timestamp_insn_cnt =0 ; decoder->pkt_state =INTEL_PT_STATE_ERR_RESYNC ; decoder->overflow = true;
Greg Kroah-Hartman
maintainerPATCH 201/238 perf tools: Fix split_kallsyms_for_kcore() for trampoline symbols
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit d6d457451eb94fa747dc202765592eb8885a7352 upstream.
Kallsyms symbols do not have a size, so the size becomes the distance to the next symbol.
Consequently the recently added trampoline symbols end up with large sizes because the trampolines are some distance from one another and the main kernel map.
However, symbols that end outside their map can disrupt the symbol tree because, after mapping, it can appear incorrectly that they overlap other symbols.
Add logic to truncate symbol size to the end of the corresponding map.
--- tools/perf/util/symbol.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/symbol.c +2 -0
@@ -710,6 +710,8 @@ static int map_groups__split_kallsyms_fo } pos->start -= curr_map->start - curr_map->pgoff; +if (pos->end > curr_map->end) + pos->end = curr_map->end;if (pos->end) pos->end -= curr_map->start - curr_map->pgoff;symbols__insert (&curr_map->dso->symbols, pos);
Greg Kroah-Hartman
maintainerPATCH 202/238 perf auxtrace: Define auxtrace record alignment
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit c3fcadf0bb765faf45d6d562246e1d08885466df upstream.
Define auxtrace record alignment so that it can be referenced elsewhere.
Note this is preparation for patch "perf intel-pt: Fix overlap calculation for padding"
--- tools/perf/util/auxtrace.c | 4 ++-- tools/perf/util/auxtrace.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-)
tools/perf/util/auxtrace.c +2 -2
@@ -1278,9 +1278,9 @@ static int __auxtrace_mmap__read(struct }/* padding must be written by fn() e.g. record__process_auxtrace() */ - padding = size &7 ; + padding = size & (PERF_AUXTRACE_RECORD_ALIGNMENT -1 );if (padding) - padding =8 - padding; + padding =PERF_AUXTRACE_RECORD_ALIGNMENT - padding;memset (&ev,0 ,sizeof (ev)); ev.auxtrace.header.type =PERF_RECORD_AUXTRACE ;
tools/perf/util/auxtrace.h +3 -0
@@ -40,6 +40,9 @@ struct record_opts;struct auxtrace_info_event ;struct events_stats ; +/* Auxtrace records must have the same alignment as perf event records */ +#define PERF_AUXTRACE_RECORD_ALIGNMENT 8 +enum auxtrace_type {PERF_AUXTRACE_UNKNOWN ,PERF_AUXTRACE_INTEL_PT ,
Greg Kroah-Hartman
maintainerPATCH 203/238 perf intel-pt: Fix overlap calculation for padding
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit 5a99d99e3310a565b0cf63f785b347be9ee0da45 upstream.
Auxtrace records might have up to 7 bytes of padding appended. Adjust the overlap accordingly.
--- tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 36 ++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-)
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +34 -2
@@ -26,6 +26,7 @@#include "../cache.h" #include "../util.h" +#include "../auxtrace.h" #include "intel-pt-insn-decoder.h" #include "intel-pt-pkt-decoder.h"
@@ -2574,6 +2575,34 @@ static int intel_pt_tsc_cmp(uint64_t tsc } } +#define MAX_PADDING (PERF_AUXTRACE_RECORD_ALIGNMENT - 1) + +/** +* adj_for_padding - adjust overlap to account for padding. +* @buf_b: second buffer +* @buf_a: first buffer +* @len_a: size of first buffer +* +* @buf_a might have up to 7 bytes of padding appended. Adjust the overlap +* accordingly. +* +* Return: A pointer into @buf_b from where non-overlapped data starts +*/ +static unsigned char *adj_for_padding (unsigned char *buf_b, +unsigned char *buf_a,size_t len_a) +{ +unsigned char *p = buf_b -MAX_PADDING ; +unsigned char *q = buf_a + len_a -MAX_PADDING ; +int i; + +for (i =MAX_PADDING ; i; i--, p++, q++) { +if (*p != *q) +break ; + } + +return p; +} +/** * intel_pt_find_overlap_tsc - determine start of non-overlapped trace data * using TSC.
@@ -2624,8 +2653,11 @@ static unsigned char *intel_pt_find_over/* Same TSC, so buffers are consecutive */ if (!cmp && rem_b >= rem_a) { +unsigned char *start; + *consecutive = true; -return buf_b + len_b - (rem_b - rem_a); + start = buf_b + len_b - (rem_b - rem_a); +return adj_for_padding (start, buf_a, len_a); }if (cmp <0 )return buf_b;/* tsc_a < tsc_b => no overlap */
@@ -2688,7 +2720,7 @@ unsigned char *intel_pt_find_overlap(uns found =memmem (buf_a, len_a, buf_b, len_a);if (found) { *consecutive = true; -return buf_b + len_a; +return adj_for_padding (buf_b + len_a, buf_a, len_a); }/* Try again at next PSB in buffer 'a' */
Greg Kroah-Hartman
maintainerPATCH 204/238 perf/x86/intel/uncore: Fix client IMC events return huge result
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kan Liang <[email protected]>
commit 8041ffd36f42d8521d66dd1e236feb58cecd68bc upstream.
The client IMC bandwidth events currently return very large values:
$ perf stat -e uncore_imc/data_reads/ -e uncore_imc/data_writes/ -I 10000 -a
10.000117222 34,788.76 MiB uncore_imc/data_reads/ 10.000117222 8.26 MiB uncore_imc/data_writes/ 20.000374584 34,842.89 MiB uncore_imc/data_reads/ 20.000374584 10.45 MiB uncore_imc/data_writes/ 30.000633299 37,965.29 MiB uncore_imc/data_reads/ 30.000633299 323.62 MiB uncore_imc/data_writes/ 40.000891548 41,012.88 MiB uncore_imc/data_reads/ 40.000891548 6.98 MiB uncore_imc/data_writes/ 50.001142480 1,125,899,906,621,494.75 MiB uncore_imc/data_reads/ 50.001142480 6.97 MiB uncore_imc/data_writes/
The client IMC events are freerunning counters. They still use the old event encoding format (0x1 for data_read and 0x2 for data write). The counter bit width is calculated by common code, which assume that the standard encoding format is used for the freerunning counters. Error bit width information is calculated.
The patch intends to convert the old client IMC event encoding to the standard encoding format.
Current common code uses event->attr.config which directly copy from user space. We should not implicitly modify it for a converted event. The event->hw.config is used to replace the event->attr.config in common code.
For client IMC events, the event->attr.config is used to calculate a converted event with standard encoding format in the custom event_init(). The converted event is stored in event->hw.config. For other events of freerunning counters, they already use the standard encoding format. The same value as event->attr.config is assigned to event->hw.config in common event_init().
--- arch/x86/events/intel/uncore.c | 1 + arch/x86/events/intel/uncore.h | 12 ++++++------ arch/x86/events/intel/uncore_snb.c | 4 +++- 3 files changed, 10 insertions(+), 7 deletions(-)
arch/x86/events/intel/uncore.c +1 -0
@@ -740,6 +740,7 @@ static int uncore_pmu_event_init(struct/* fixed counters have event field hardcoded to zero */ hwc->config =0ULL ; }else if (is_freerunning_event (event)) { + hwc->config = event->attr.config;if (!check_valid_freerunning_event (box, event))return -EINVAL ; event->hw.idx =UNCORE_PMC_IDX_FREERUNNING ;
arch/x86/events/intel/uncore.h +6 -6
@@ -292,8 +292,8 @@ static inlineunsigned int uncore_freerunning_counter (struct intel_uncore_box *box,struct perf_event *event) { -unsigned int type =uncore_freerunning_type (event->attr.config); -unsigned int idx =uncore_freerunning_idx (event->attr.config); +unsigned int type =uncore_freerunning_type (event->hw.config); +unsigned int idx =uncore_freerunning_idx (event->hw.config);struct intel_uncore_pmu *pmu = box->pmu; return pmu->type->freerunning[type].counter_base +
@@ -377,7 +377,7 @@ static inlineunsigned int uncore_freerunning_bits (struct intel_uncore_box *box,struct perf_event *event) { -unsigned int type =uncore_freerunning_type (event->attr.config); +unsigned int type =uncore_freerunning_type (event->hw.config);return box->pmu->type->freerunning[type].bits; }
@@ -385,7 +385,7 @@ unsigned int uncore_freerunning_bits(strstatic inline int uncore_num_freerunning (struct intel_uncore_box *box,struct perf_event *event) { -unsigned int type =uncore_freerunning_type (event->attr.config); +unsigned int type =uncore_freerunning_type (event->hw.config);return box->pmu->type->freerunning[type].num_counters; }
@@ -399,8 +399,8 @@ static inline int uncore_num_freerunningstatic inline bool check_valid_freerunning_event (struct intel_uncore_box *box,struct perf_event *event) { -unsigned int type =uncore_freerunning_type (event->attr.config); -unsigned int idx =uncore_freerunning_idx (event->attr.config); +unsigned int type =uncore_freerunning_type (event->hw.config); +unsigned int idx =uncore_freerunning_idx (event->hw.config);return (type <uncore_num_freerunning_types (box, event)) && (idx <uncore_num_freerunning (box, event));
arch/x86/events/intel/uncore_snb.c +3 -1
@@ -448,9 +448,11 @@ static int snb_uncore_imc_event_init(str/* must be done before validate_group */ event->hw.event_base = base; - event->hw.config = cfg; event->hw.idx = idx; +/* Convert to standard encoding format for freerunning counters */ + event->hw.config = ((cfg -1 ) <<8 ) |0x10ff ; +/* no group validation needed, we have free running counters */ return 0 ;
Greg Kroah-Hartman
maintainerPATCH 205/238 perf intel-pt: Fix divide by zero when TSC is not available
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit 076333870c2f5bdd9b6d31e7ca1909cf0c84cbfa upstream.
When TSC is not available, "timeless" decoding is used but a divide by zero occurs if perf_time_to_tsc() is called.
Ensure the divisor is not zero.
--- tools/perf/util/intel-pt.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/intel-pt.c +2 -0
@@ -2522,6 +2522,8 @@ int intel_pt_process_auxtrace_info(union } pt->timeless_decoding =intel_pt_timeless_decoding (pt); +if (pt->timeless_decoding && !pt->tc.time_mult) + pt->tc.time_mult =1 ; pt->have_tsc =intel_pt_have_tsc (pt); pt->sampling_mode = false; pt->est_tsc = !pt->timeless_decoding;
Greg Kroah-Hartman
maintainerPATCH 206/238 md: Fix failed allocation of md_register_thread
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aditya Pakki <[email protected]>
commit e406f12dde1a8375d77ea02d91f313fb1a9c6aec upstream.
mddev->sync_thread can be set to NULL on kzalloc failure downstream. The patch checks for such a scenario and frees allocated resources.
Committer node:
Added similar fix to raid5.c, as suggested by Guoqing.
--- drivers/md/raid10.c | 2 ++ drivers/md/raid5.c | 2 ++ 2 files changed, 4 insertions(+)
drivers/md/raid10.c +2 -0
@@ -3939,6 +3939,8 @@ static int raid10_run(struct mddev *mddeset_bit (MD_RECOVERY_RUNNING , &mddev->recovery); mddev->sync_thread =md_register_thread (md_do_sync, mddev,"reshape" ); +if (!mddev->sync_thread) + goto out_free_conf; }return 0 ;
drivers/md/raid5.c +2 -0
@@ -7402,6 +7402,8 @@ static int raid5_run(struct mddev *mddevset_bit (MD_RECOVERY_RUNNING , &mddev->recovery); mddev->sync_thread =md_register_thread (md_do_sync, mddev,"reshape" ); +if (!mddev->sync_thread) + goto abort; }/* Ok, everything is just fine now */
Greg Kroah-Hartman
maintainerPATCH 207/238 x86/kvmclock: set offset for kvm unstable clock
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Tatashin <[email protected]>
commit b5179ec4187251a751832193693d6e474d3445ac upstream.
VMs may show incorrect uptime and dmesg printk offsets on hypervisors with unstable clock. The problem is produced when VM is rebooted without exiting from qemu.
The fix is to calculate clock offset not only for stable clock but for unstable clock as well, and use kvm_sched_clock_read() which substracts the offset for both clocks.
This is safe, because pvclock_clocksource_read() does the right thing and makes sure that clock always goes forward, so once offset is calculated with unstable clock, we won't get new reads that are smaller than offset, and thus won't get negative results.
Thank you Jon DeVree for helping to reproduce this issue.
--- arch/x86/kernel/kvmclock.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
arch/x86/kernel/kvmclock.c +1 -5
@@ -104,12 +104,8 @@ static u64 kvm_sched_clock_read(void)static inline void kvm_sched_clock_init (bool stable) { -if (!stable) { - pv_ops.time.sched_clock = kvm_clock_read; +if (!stable)clear_sched_clock_stable (); -return ; - } - kvm_sched_clock_offset =kvm_clock_read (); pv_ops.time.sched_clock = kvm_sched_clock_read;
Greg Kroah-Hartman
maintainerPATCH 208/238 x86/ftrace: Fix warning and considate ftrace_jmp_replace() and ftrace_call_replace()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt (VMware) <[email protected]>
commit 745cfeaac09ce359130a5451d90cb0bd4094c290 upstream.
Arnd reported the following compiler warning:
arch/x86/kernel/ftrace.c:669:23: error: 'ftrace_jmp_replace' defined but not used [-Werror=unused-function]
The ftrace_jmp_replace() function now only has a single user and should be simply moved by that user. But looking at the code, it shows that ftrace_jmp_replace() is similar to ftrace_call_replace() except that instead of using the opcode of 0xe8 it uses 0xe9. It makes more sense to consolidate that function into one implementation that both ftrace_jmp_replace() and ftrace_call_replace() use by passing in the op code separate.
The structure in ftrace_code_union is also modified to replace the "e8" field with the more appropriate name "op".
--- arch/x86/kernel/ftrace.c | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-)
arch/x86/kernel/ftrace.c +17 -25
@@ -49,7 +49,7 @@ int ftrace_arch_code_modify_post_processunion ftrace_code_union {char code[MCOUNT_INSN_SIZE ];struct { -unsigned char e8; +unsigned char op;int offset; } __attribute__((packed)); };
@@ -59,20 +59,23 @@ static int ftrace_calc_offset(long ip, lreturn (int )(addr - ip); } -static unsigned char *ftrace_call_replace (unsigned long ip,unsigned long addr) +static unsigned char * +ftrace_text_replace (unsigned char op,unsigned long ip,unsigned long addr) {static union ftrace_code_union calc; - calc.e8 =0xe8 ; + calc.op = op; calc.offset =ftrace_calc_offset (ip +MCOUNT_INSN_SIZE , addr); -/* -* No locking needed, this must be called via kstop_machine -* which in essence is like running on a uniprocessor machine. -*/ return calc.code; } +static unsigned char * +ftrace_call_replace (unsigned long ip,unsigned long addr) +{ +return ftrace_text_replace (0xe8 , ip, addr); +} +static inline int within (unsigned long addr,unsigned long start,unsigned long end) {
@@ -664,22 +667,6 @@ int __init ftrace_dyn_arch_init(void)return 0 ; } -#if defined(CONFIG_X86_64 ) || defined(CONFIG_FUNCTION_GRAPH_TRACER ) -static unsigned char *ftrace_jmp_replace (unsigned long ip,unsigned long addr) -{ -static union ftrace_code_union calc; - -/* Jmp not a call (ignore the .e8) */ - calc.e8 =0xe9 ; - calc.offset =ftrace_calc_offset (ip +MCOUNT_INSN_SIZE , addr); - -/* -* ftrace external locks synchronize the access to the static variable. -*/ -return calc.code; -} -#endif -/* Currently only x86_64 supports dynamic trampolines */ #ifdef CONFIG_X86_64
@@ -891,8 +878,8 @@ static void *addr_from_call(void *ptr)return NULL ;/* Make sure this is a call */ -if (WARN_ON_ONCE (calc.e8 !=0xe8 )) { -pr_warn ("Expected e8, got %x\n" , calc.e8); +if (WARN_ON_ONCE (calc.op !=0xe8 )) { +pr_warn ("Expected e8, got %x\n" , calc.op);return NULL ; }
@@ -963,6 +950,11 @@ void arch_ftrace_trampoline_free(struct#ifdef CONFIG_DYNAMIC_FTRACE extern void ftrace_graph_call (void ); +static unsigned char *ftrace_jmp_replace (unsigned long ip,unsigned long addr) +{ +return ftrace_text_replace (0xe9 , ip, addr); +} +static int ftrace_mod_jmp (unsigned long ip,void *func) {unsigned char *new;
Greg Kroah-Hartman
maintainerPATCH 209/238 tpm/tpm_crb: Avoid unaligned reads in crb_recv()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarkko Sakkinen <[email protected]>
commit 3d7a850fdc1a2e4d2adbc95cc0fc962974725e88 upstream.
The current approach to read first 6 bytes from the response and then tail of the response, can cause the 2nd memcpy_fromio() to do an unaligned read (e.g. read 32-bit word from address aligned to a 16-bits), depending on how memcpy_fromio() is implemented. If this happens, the read will fail and the memory controller will fill the read with 1's.
This was triggered by 170d13ca3a2f, which should be probably refined to check and react to the address alignment. Before that commit, on x86 memcpy_fromio() turned out to be memcpy(). By a luck GCC has done the right thing (from tpm_crb's perspective) for us so far, but we should not rely on that. Thus, it makes sense to fix this also in tpm_crb, not least because the fix can be then backported to stable kernels and make them more robust when compiled in differing environments.
--- drivers/char/tpm/tpm_crb.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/char/tpm/tpm_crb.c +16 -6
@@ -287,19 +287,29 @@ static int crb_recv(struct tpm_chip *chistruct crb_priv *priv =dev_get_drvdata (&chip->dev);unsigned int expected; -/* sanity check */ -if (count <6 ) +/* A sanity check that the upper layer wants to get at least the header +* as that is the minimum size for any TPM response. +*/ +if (count <TPM_HEADER_SIZE )return -EIO ; +/* If this bit is set, according to the spec, the TPM is in +* unrecoverable condition. +*/ if (ioread32 (&priv->regs_t->ctrl_sts) &CRB_CTRL_STS_ERROR )return -EIO ; -memcpy_fromio (buf, priv->rsp,6 ); - expected =be32_to_cpup ((__be32 *) &buf[2 ]); -if (expected > count || expected <6 ) +/* Read the first 8 bytes in order to get the length of the response. +* We read exactly a quad word in order to make sure that the remaining +* reads will be aligned. +*/ +memcpy_fromio (buf, priv->rsp,8 ); + + expected =be32_to_cpup ((__be32 *)&buf[2 ]); +if (expected > count || expected <TPM_HEADER_SIZE )return -EIO ; -memcpy_fromio (&buf[6 ], &priv->rsp[6 ], expected -6 ); +memcpy_fromio (&buf[8 ], &priv->rsp[8 ], expected -8 );return expected; }
Greg Kroah-Hartman
maintainerPATCH 210/238 tpm: Unify the send callback behaviour
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarkko Sakkinen <[email protected]>
commit f5595f5baa30e009bf54d0d7653a9a0cc465be60 upstream.
The send() callback should never return length as it does not in every driver except tpm_crb in the success case. The reason is that the main transmit functionality only cares about whether the transmit was successful or not and ignores the count completely.
--- drivers/char/tpm/st33zp24/st33zp24.c | 2 +- drivers/char/tpm/tpm-interface.c | 11 ++++++++++- drivers/char/tpm/tpm_atmel.c | 2 +- drivers/char/tpm/tpm_i2c_atmel.c | 6 +++++- drivers/char/tpm/tpm_i2c_infineon.c | 2 +- drivers/char/tpm/tpm_i2c_nuvoton.c | 2 +- drivers/char/tpm/tpm_ibmvtpm.c | 8 ++++---- drivers/char/tpm/tpm_infineon.c | 2 +- drivers/char/tpm/tpm_nsc.c | 2 +- drivers/char/tpm/tpm_tis_core.c | 2 +- drivers/char/tpm/tpm_vtpm_proxy.c | 3 +-- drivers/char/tpm/xen-tpmfront.c | 2 +- 12 files changed, 28 insertions(+), 16 deletions(-)
drivers/char/tpm/st33zp24/st33zp24.c +1 -1
@@ -436,7 +436,7 @@ static int st33zp24_send(struct tpm_chip goto out_err; } -return len; +return 0 ; out_err:st33zp24_cancel (chip);release_locality (chip);
drivers/char/tpm/tpm-interface.c +10 -1
@@ -230,10 +230,19 @@ static ssize_t tpm_try_transmit(struct tif (rc <0 ) {if (rc != -EPIPE )dev_err (&chip->dev, -"%s: tpm_send: error %d\n" , __func__, rc); +"%s: send(): error %d\n" , __func__, rc); goto out; } +/* A sanity check. send() should just return zero on success e.g. +* not the command length. +*/ +if (rc >0 ) { +dev_warn (&chip->dev, +"%s: send(): invalid value %d\n" , __func__, rc); + rc =0 ; + } +if (chip->flags &TPM_CHIP_FLAG_IRQ ) goto out_recv;
drivers/char/tpm/tpm_atmel.c +1 -1
@@ -105,7 +105,7 @@ static int tpm_atml_send(struct tpm_chipiowrite8 (buf[i], priv->iobase); } -return count; +return 0 ; }static void tpm_atml_cancel (struct tpm_chip *chip)
drivers/char/tpm/tpm_i2c_atmel.c +5 -1
@@ -65,7 +65,11 @@ static int i2c_atmel_send(struct tpm_chidev_dbg (&chip->dev,"%s(buf=%*ph len=%0zx) -> sts=%d\n" , __func__, (int )min_t (size_t,64 , len), buf, len, status); -return status; + +if (status <0 ) +return status; + +return 0 ; }static int i2c_atmel_recv (struct tpm_chip *chip,u8 *buf,size_t count)
drivers/char/tpm/tpm_i2c_infineon.c +1 -1
@@ -587,7 +587,7 @@ static int tpm_tis_i2c_send(struct tpm_c/* go and do it */ iic_tpm_write (TPM_STS (tpm_dev.locality), &sts,1 ); -return len; +return 0 ; out_err:tpm_tis_i2c_ready (chip);/* The TPM needs some time to clean up here,
drivers/char/tpm/tpm_i2c_nuvoton.c +1 -1
@@ -467,7 +467,7 @@ static int i2c_nuvoton_send(struct tpm_c }dev_dbg (dev,"%s() -> %zd\n" , __func__, len); -return len; +return 0 ; }static bool i2c_nuvoton_req_canceled (struct tpm_chip *chip,u8 status)
drivers/char/tpm/tpm_ibmvtpm.c +4 -4
@@ -139,14 +139,14 @@ static int tpm_ibmvtpm_recv(struct tpm_c }/** -* tpm_ibmvtpm_send - Send tpm request -* +* tpm_ibmvtpm_send() - Send a TPM command * @chip: tpm chip struct * @buf: buffer contains data to send * @count: size of buffer * * Return: -* Number of bytes sent or < 0 on error. +* 0 on success, +* -errno on error */ static int tpm_ibmvtpm_send (struct tpm_chip *chip,u8 *buf,size_t count) {
@@ -192,7 +192,7 @@ static int tpm_ibmvtpm_send(struct tpm_c rc =0 ; ibmvtpm->tpm_processing_cmd = false; }else - rc = count; + rc =0 ;spin_unlock (&ibmvtpm->rtce_lock);return rc;
drivers/char/tpm/tpm_infineon.c +1 -1
@@ -354,7 +354,7 @@ static int tpm_inf_send(struct tpm_chipfor (i =0 ; i < count; i++) {wait_and_send (chip, buf[i]); } -return count; +return 0 ; }static void tpm_inf_cancel (struct tpm_chip *chip)
drivers/char/tpm/tpm_nsc.c +1 -1
@@ -226,7 +226,7 @@ static int tpm_nsc_send(struct tpm_chip }outb (NSC_COMMAND_EOC , priv->base +NSC_COMMAND ); -return count; +return 0 ; }static void tpm_nsc_cancel (struct tpm_chip *chip)
drivers/char/tpm/tpm_tis_core.c +1 -1
@@ -481,7 +481,7 @@ static int tpm_tis_send_main(struct tpm_ goto out_err; } } -return len; +return 0 ; out_err:tpm_tis_ready (chip);return rc;
drivers/char/tpm/tpm_vtpm_proxy.c +1 -2
@@ -335,7 +335,6 @@ static int vtpm_proxy_is_driver_command(static int vtpm_proxy_tpm_op_send (struct tpm_chip *chip,u8 *buf,size_t count) {struct proxy_dev *proxy_dev =dev_get_drvdata (&chip->dev); -int rc =0 ;if (count >sizeof (proxy_dev->buffer)) { dev_err(&chip->dev,
@@ -366,7 +365,7 @@ static int vtpm_proxy_tpm_op_send(structwake_up_interruptible (&proxy_dev->wq); -return rc; +return 0 ; }static void vtpm_proxy_tpm_op_cancel (struct tpm_chip *chip)
drivers/char/tpm/xen-tpmfront.c +1 -1
@@ -173,7 +173,7 @@ static int vtpm_send(struct tpm_chip *chreturn -ETIME ; } -return count; +return 0 ; }static int vtpm_recv (struct tpm_chip *chip,u8 *buf,size_t count)
Greg Kroah-Hartman
maintainerPATCH 211/238 rcu: Do RCU GP kthread self-wakeup from softirq and interrupt
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang, Jun <[email protected]>
commit 1d1f898df6586c5ea9aeaf349f13089c6fa37903 upstream.
The rcu_gp_kthread_wake() function is invoked when it might be necessary to wake the RCU grace-period kthread. Because self-wakeups are normally a useless waste of CPU cycles, if rcu_gp_kthread_wake() is invoked from this kthread, it naturally refuses to do the wakeup.
Unfortunately, natural though it might be, this heuristic fails when rcu_gp_kthread_wake() is invoked from an interrupt or softirq handler that interrupted the grace-period kthread just after the final check of the wait-event condition but just before the schedule() call. In this case, a wakeup is required, even though the call to rcu_gp_kthread_wake() is within the RCU grace-period kthread's context. Failing to provide this wakeup can result in grace periods failing to start, which in turn results in out-of-memory conditions.
This race window is quite narrow, but it actually did happen during real testing. It would of course need to be fixed even if it was strictly theoretical in nature.
This patch does not Cc stable because it does not apply cleanly to earlier kernel versions.
Signed-off: "Zhang, Jun" <[email protected]>
Signed-off: "He, Bo" <[email protected]>
Signed-off: "xiao, jin" <[email protected]>
Signed-off: Bai, Jie A <[email protected]>
[ paulmck: Switch from !in_softirq() to "!in_interrupt() &&
!in_serving_softirq() to avoid redundant wakeups and to also handle the interrupt-handler scenario as well as the softirq-handler scenario that actually occurred in testing. ]
--- kernel/rcu/tree.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
kernel/rcu/tree.c +14 -5
@@ -1557,14 +1557,23 @@ static bool rcu_future_gp_cleanup(struct }/* -* Awaken the grace-period kthread. Don't do a self-awaken, and don't -* bother awakening when there is nothing for the grace-period kthread -* to do (as in several CPUs raced to awaken, and we lost), and finally -* don't try to awaken a kthread that has not yet been created. +* Awaken the grace-period kthread. Don't do a self-awaken (unless in +* an interrupt or softirq handler), and don't bother awakening when there +* is nothing for the grace-period kthread to do (as in several CPUs raced +* to awaken, and we lost), and finally don't try to awaken a kthread that +* has not yet been created. If all those checks are passed, track some +* debug information and awaken. +* +* So why do the self-wakeup when in an interrupt or softirq handler +* in the grace-period kthread's context? Because the kthread might have +* been interrupted just as it was going to sleep, and just after the final +* pre-sleep check of the awaken condition. In this case, a wakeup really +* is required, and is therefore supplied. */ static void rcu_gp_kthread_wake (void ) { -if (current == rcu_state.gp_kthread || +if ((current == rcu_state.gp_kthread && + !in_interrupt () && !in_serving_softirq ()) || !READ_ONCE (rcu_state.gp_flags) || !rcu_state.gp_kthread)return ;
Greg Kroah-Hartman
maintainerPATCH 212/238 media: imx: prpencvf: Stop upstream before disabling IDMA channel
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve Longerbeam <[email protected]>
commit a19c22677377b87e4354f7306f46ad99bc982a9f upstream.
Upstream must be stopped immediately after receiving the last EOF and before disabling the IDMA channel. This can be accomplished by moving upstream stream off to just after receiving the last EOF completion in prp_stop(). For symmetry also move upstream stream on to end of prp_start().
This fixes a complete system hard lockup on the SabreAuto when streaming from the ADV7180, by repeatedly sending a stream off immediately followed by stream on:
while true; do v4l2-ctl -d1 --stream-mmap --stream-count=3; done
Eventually this either causes the system lockup or EOF timeouts at all subsequent stream on, until a system reset.
The lockup occurs when disabling the IDMA channel at stream off. Stopping the video data stream entering the IDMA channel before disabling the channel itself appears to be a reliable fix for the hard lockup.
--- drivers/staging/media/imx/imx-ic-prpencvf.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
drivers/staging/media/imx/imx-ic-prpencvf.c +17 -9
@@ -680,12 +680,23 @@ static int prp_start(struct prp_priv *pr goto out_free_nfb4eof_irq; } +/* start upstream */ + ret =v4l2_subdev_call (priv->src_sd, video, s_stream,1 ); + ret = (ret && ret != -ENOIOCTLCMD ) ? ret :0 ; +if (ret) { +v4l2_err (&ic_priv->sd, +"upstream stream on failed: %d\n" , ret); + goto out_free_eof_irq; + } +/* start the EOF timeout timer */ mod_timer (&priv->eof_timeout_timer, jiffies +msecs_to_jiffies (IMX_MEDIA_EOF_TIMEOUT ));return 0 ; +out_free_eof_irq: +devm_free_irq (ic_priv->dev, priv->eof_irq, priv); out_free_nfb4eof_irq:devm_free_irq (ic_priv->dev, priv->nfb4eof_irq, priv); out_unsetup:
@@ -717,6 +728,12 @@ static void prp_stop(struct prp_priv *prif (ret ==0 )v4l2_warn (&ic_priv->sd,"wait last EOF timeout\n" ); +/* stop upstream */ + ret =v4l2_subdev_call (priv->src_sd, video, s_stream,0 ); +if (ret && ret != -ENOIOCTLCMD ) +v4l2_warn (&ic_priv->sd, +"upstream stream off failed: %d\n" , ret); +devm_free_irq (ic_priv->dev, priv->eof_irq, priv);devm_free_irq (ic_priv->dev, priv->nfb4eof_irq, priv);
@@ -1148,15 +1165,6 @@ static int prp_s_stream(struct v4l2_subdif (ret) goto out; -/* start/stop upstream */ - ret =v4l2_subdev_call (priv->src_sd, video, s_stream, enable); - ret = (ret && ret != -ENOIOCTLCMD ) ? ret :0 ; -if (ret) { -if (enable) -prp_stop (priv); - goto out; - } - update_count: priv->stream_count += enable ?1 :-1 ;if (priv->stream_count <0 )
Greg Kroah-Hartman
maintainerPATCH 213/238 media: lgdt330x: fix lock status reporting
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: French, Nicholas A <[email protected]>
commit 1b4fd9de6ec7f3722c2b3e08cc5ad171c11f93be upstream.
A typo in code cleanup commit db9c1007bc07 ("media: lgdt330x: do some cleanups at status logic") broke the FE_HAS_LOCK reporting for 3303 chips by inadvertently modifying the register mask.
The broken lock status is critial as it prevents video capture cards from reporting signal strength, scanning for channels, and capturing video.
Fix regression by reverting mask change.
--- drivers/media/dvb-frontends/lgdt330x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-frontends/lgdt330x.c +1 -1
@@ -783,7 +783,7 @@ static int lgdt3303_read_status(struct dif ((buf[0 ] &0x02 ) ==0x00 ) *status |=FE_HAS_SYNC ; -if ((buf[0 ] &0xfd ) ==0x01 ) +if ((buf[0 ] &0x01 ) ==0x01 ) *status |=FE_HAS_VITERBI |FE_HAS_LOCK ;break ;default :
Greg Kroah-Hartman
maintainerPATCH 214/238 media: sun6i: Fix CSI regmaps max_register
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
commit d31b282e2c0de9c7fb113516820340251f03a625 upstream.
max_register is currently set to 0x1000. This is beyond the mapped address range of the hardware, so attempts to dump the regmap from debugfs would trigger a kernel exception.
Furthermore, the useful registers only occupy a small section at the beginning of the full range. Change the value to 0x9c, the last known register on the V3s and H3.
On the A31, the register range is extended to support additional capture channels. Since this is not yet supported, ignore it for now.
--- drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c +1 -1
@@ -793,7 +793,7 @@ static const struct regmap_config sun6i_ .reg_bits = 32, .reg_stride = 4, .val_bits = 32, - .max_register = 0x1000, + .max_register = 0x9c, }; static int sun6i_csi_resource_request(struct sun6i_csi_dev *sdev,
Greg Kroah-Hartman
maintainerPATCH 215/238 media: uvcvideo: Avoid NULL pointer dereference at the end of streaming
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit 9dd0627d8d62a7ddb001a75f63942d92b5336561 upstream.
The UVC video driver converts the timestamp from hardware specific unit to one known by the kernel at the time when the buffer is dequeued. This is fine in general, but the streamoff operation consists of the following steps (among other things):
1. uvc_video_clock_cleanup --- the hardware clock sample array is released and the pointer to the array is set to NULL,
2. buffers in active state are returned to the user and
3. buf_finish callback is called on buffers that are prepared. buf_finish includes calling uvc_video_clock_update that accesses the hardware clock sample array.
The above is serialised by a queue specific mutex. Address the problem by skipping the clock conversion if the hardware clock sample array is already released.
--- drivers/media/usb/uvc/uvc_video.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/media/usb/uvc/uvc_video.c +8 -0
@@ -676,6 +676,14 @@ void uvc_video_clock_update(struct uvc_sif (!uvc_hw_timestamps_param)return ; +/* +* We will get called from __vb2_queue_cancel() if there are buffers +* done but not dequeued by the user, but the sample array has already +* been released at that time. Just bail out in that case. +*/ +if (!clock->samples) +return ; +spin_lock_irqsave (&clock->lock, flags);if (clock->count < clock->size)
Greg Kroah-Hartman
maintainerPATCH 216/238 media: vimc: Add vimc-streamer for stream control
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lucas A. M. Magalhães <[email protected]>
commit adc589d2a20808fb99d46a78175cd023f2040338 upstream.
Add a linear pipeline logic for the stream control. It's created by walking backwards on the entity graph. When the stream starts it will simply loop through the pipeline calling the respective process_frame function of each entity.
and sensor")
--- drivers/media/platform/vimc/Makefile | 3 drivers/media/platform/vimc/vimc-capture.c | 18 +- drivers/media/platform/vimc/vimc-common.c | 35 ----- drivers/media/platform/vimc/vimc-common.h | 15 -- drivers/media/platform/vimc/vimc-debayer.c | 26 --- drivers/media/platform/vimc/vimc-scaler.c | 28 ---- drivers/media/platform/vimc/vimc-sensor.c | 56 +------- drivers/media/platform/vimc/vimc-streamer.c | 188 ++++++++++++++++++++++++++++ drivers/media/platform/vimc/vimc-streamer.h | 38 +++++ 9 files changed, 260 insertions(+), 147 deletions(-)
drivers/media/platform/vimc/Makefile +2 -1
@@ -5,6 +5,7 @@ vimc_common-objs := vimc-common.o vimc_debayer-objs := vimc-debayer.o vimc_scaler-objs := vimc-scaler.o vimc_sensor-objs := vimc-sensor.o +vimc_streamer-objs := vimc-streamer.o obj-$(CONFIG_VIDEO_VIMC) += vimc.o vimc_capture.o vimc_common.o vimc-debayer.o \ - vimc_scaler.o vimc_sensor.o + vimc_scaler.o vimc_sensor.o vimc_streamer.o
drivers/media/platform/vimc/vimc-capture.c +9 -9
@@ -24,6 +24,7 @@#include <media/videobuf2-vmalloc.h> #include "vimc-common.h" +#include "vimc-streamer.h" #define VIMC_CAP_DRV_NAME "vimc-capture"
@@ -44,7 +45,7 @@ struct vimc_cap_device {spinlock_t qlock;struct mutex lock;u32 sequence; -struct media_pipeline pipe; +struct vimc_stream stream; };static const struct v4l2_pix_format fmt_default = {
@@ -248,14 +249,13 @@ static int vimc_cap_start_streaming(stru vcap->sequence =0 ;/* Start the media pipeline */ - ret =media_pipeline_start (entity, &vcap->pipe); + ret =media_pipeline_start (entity, &vcap->stream.pipe);if (ret) {vimc_cap_return_all_buffers (vcap,VB2_BUF_STATE_QUEUED );return ret; } -/* Enable streaming from the pipe */ - ret =vimc_pipeline_s_stream (&vcap->vdev.entity,1 ); + ret =vimc_streamer_s_stream (&vcap->stream, &vcap->ved,1 );if (ret) {media_pipeline_stop (entity);vimc_cap_return_all_buffers (vcap,VB2_BUF_STATE_QUEUED );
@@ -273,8 +273,7 @@ static void vimc_cap_stop_streaming(stru {struct vimc_cap_device *vcap =vb2_get_drv_priv (vq); -/* Disable streaming from the pipe */ -vimc_pipeline_s_stream (&vcap->vdev.entity,0 ); +vimc_streamer_s_stream (&vcap->stream, &vcap->ved,0 );/* Stop the media pipeline */ media_pipeline_stop (&vcap->vdev.entity);
@@ -355,8 +354,8 @@ static void vimc_cap_comp_unbind(structkfree (vcap); } -static void vimc_cap_process_frame (struct vimc_ent_device *ved, -struct media_pad *sink,const void *frame) +static void *vimc_cap_process_frame (struct vimc_ent_device *ved, +const void *frame) { struct vimc_cap_device *vcap = container_of(ved, struct vimc_cap_device, ved);
@@ -370,7 +369,7 @@ static void vimc_cap_process_frame(struc typeof(*vimc_buf), list);if (!vimc_buf) {spin_unlock (&vcap->qlock); -return ; +return ERR_PTR (-EAGAIN ); }/* Remove this entry from the list */
@@ -391,6 +390,7 @@ static void vimc_cap_process_frame(strucvb2_set_plane_payload (&vimc_buf->vb2.vb2_buf,0 , vcap->format.sizeimage);vb2_buffer_done (&vimc_buf->vb2.vb2_buf,VB2_BUF_STATE_DONE ); +return NULL ; } static int vimc_cap_comp_bind(struct device *comp, struct device *master,
drivers/media/platform/vimc/vimc-common.c +0 -35
@@ -207,41 +207,6 @@ const struct vimc_pix_map *vimc_pix_map_ }EXPORT_SYMBOL_GPL (vimc_pix_map_by_pixelformat); -int vimc_propagate_frame (struct media_pad *src,const void *frame) -{ -struct media_link *link; - -if (!(src->flags &MEDIA_PAD_FL_SOURCE )) -return -EINVAL ; - -/* Send this frame to all sink pads that are direct linked */ -list_for_each_entry (link, &src->entity->links, list) { -if (link->source == src && - (link->flags &MEDIA_LNK_FL_ENABLED )) { -struct vimc_ent_device *ved =NULL ; -struct media_entity *entity = link->sink->entity; - -if (is_media_entity_v4l2_subdev (entity)) { -struct v4l2_subdev *sd = - container_of(entity, struct v4l2_subdev, - entity); - ved =v4l2_get_subdevdata (sd); - }else if (is_media_entity_v4l2_video_device (entity)) { -struct video_device *vdev = -container_of (entity, - struct video_device, - entity); - ved =video_get_drvdata (vdev); - } -if (ved && ved->process_frame) - ved->process_frame (ved, link->sink, frame); - } - } - -return 0 ; -} -EXPORT_SYMBOL_GPL (vimc_propagate_frame); -/* Helper function to allocate and initialize pads */ struct media_pad *vimc_pads_init (u16 num_pads,const unsigned long *pads_flag) {
drivers/media/platform/vimc/vimc-common.h +2 -13
@@ -113,24 +113,13 @@ struct vimc_pix_map {struct vimc_ent_device {struct media_entity *ent;struct media_pad *pads; -void (*process_frame)(struct vimc_ent_device *ved, -struct media_pad *sink,const void *frame); +void * (*process_frame)(struct vimc_ent_device *ved, +const void *frame);void (*vdev_get_format)(struct vimc_ent_device *ved,struct v4l2_pix_format *fmt); };/** -* vimc_propagate_frame - propagate a frame through the topology -* -* @src: the source pad where the frame is being originated -* @frame: the frame to be propagated -* -* This function will call the process_frame callback from the vimc_ent_device -* struct of the nodes directly connected to the @src pad -*/ -int vimc_propagate_frame (struct media_pad *src,const void *frame); - -/** * vimc_pads_init - initialize pads * * @num_pads: number of pads to initialize
drivers/media/platform/vimc/vimc-debayer.c +4 -22
@@ -321,7 +321,6 @@ static void vimc_deb_set_rgb_mbus_fmt_rgstatic int vimc_deb_s_stream (struct v4l2_subdev *sd,int enable) {struct vimc_deb_device *vdeb =v4l2_get_subdevdata (sd); -int ret;if (enable) {const struct vimc_pix_map *vpix;
@@ -351,22 +350,10 @@ static int vimc_deb_s_stream(struct v4l2if (!vdeb->src_frame)return -ENOMEM ; -/* Turn the stream on in the subdevices directly connected */ - ret =vimc_pipeline_s_stream (&vdeb->sd.entity,1 ); -if (ret) { -vfree (vdeb->src_frame); - vdeb->src_frame =NULL ; -return ret; - } }else {if (!vdeb->src_frame)return 0 ; -/* Disable streaming from the pipe */ - ret =vimc_pipeline_s_stream (&vdeb->sd.entity,0 ); -if (ret) -return ret; -vfree (vdeb->src_frame); vdeb->src_frame =NULL ; }
@@ -480,9 +467,8 @@ static void vimc_deb_calc_rgb_sink(struc } } -static void vimc_deb_process_frame (struct vimc_ent_device *ved, -struct media_pad *sink, -const void *sink_frame) +static void *vimc_deb_process_frame (struct vimc_ent_device *ved, +const void *sink_frame) { struct vimc_deb_device *vdeb = container_of(ved, struct vimc_deb_device, ved);
@@ -491,7 +477,7 @@ static void vimc_deb_process_frame(struc/* If the stream in this node is not active, just return */ if (!vdeb->src_frame) -return ; +return ERR_PTR (-EINVAL );for (i =0 ; i < vdeb->sink_fmt.height; i++)for (j =0 ; j < vdeb->sink_fmt.width; j++) {
@@ -499,12 +485,8 @@ static void vimc_deb_process_frame(struc vdeb->set_rgb_src (vdeb, i, j, rgb); } -/* Propagate the frame through all source pads */ -for (i =1 ; i < vdeb->sd.entity.num_pads; i++) { -struct media_pad *pad = &vdeb->sd.entity.pads[i]; +return vdeb->src_frame; -vimc_propagate_frame (pad, vdeb->src_frame); - } } static void vimc_deb_comp_unbind(struct device *comp, struct device *master,
drivers/media/platform/vimc/vimc-scaler.c +4 -24
@@ -217,7 +217,6 @@ static const struct v4l2_subdev_pad_opsstatic int vimc_sca_s_stream (struct v4l2_subdev *sd,int enable) {struct vimc_sca_device *vsca =v4l2_get_subdevdata (sd); -int ret;if (enable) {const struct vimc_pix_map *vpix;
@@ -245,22 +244,10 @@ static int vimc_sca_s_stream(struct v4l2if (!vsca->src_frame)return -ENOMEM ; -/* Turn the stream on in the subdevices directly connected */ - ret =vimc_pipeline_s_stream (&vsca->sd.entity,1 ); -if (ret) { -vfree (vsca->src_frame); - vsca->src_frame =NULL ; -return ret; - } }else {if (!vsca->src_frame)return 0 ; -/* Disable streaming from the pipe */ - ret =vimc_pipeline_s_stream (&vsca->sd.entity,0 ); -if (ret) -return ret; -vfree (vsca->src_frame); vsca->src_frame =NULL ; }
@@ -346,26 +333,19 @@ static void vimc_sca_fill_src_frame(consvimc_sca_scale_pix (vsca, i, j, sink_frame); } -static void vimc_sca_process_frame (struct vimc_ent_device *ved, -struct media_pad *sink, -const void *sink_frame) +static void *vimc_sca_process_frame (struct vimc_ent_device *ved, +const void *sink_frame) { struct vimc_sca_device *vsca = container_of(ved, struct vimc_sca_device, ved); -unsigned int i;/* If the stream in this node is not active, just return */ if (!vsca->src_frame) -return ; +return ERR_PTR (-EINVAL );vimc_sca_fill_src_frame (vsca, sink_frame); -/* Propagate the frame through all source pads */ -for (i =1 ; i < vsca->sd.entity.num_pads; i++) { -struct media_pad *pad = &vsca->sd.entity.pads[i]; - -vimc_propagate_frame (pad, vsca->src_frame); - } +return vsca->src_frame; }; static void vimc_sca_comp_unbind(struct device *comp, struct device *master,
drivers/media/platform/vimc/vimc-sensor.c +13 -43
91 lines not on this page · raw message
drivers/media/platform/vimc/vimc-streamer.c new file +188 -0
188 lines not on this page · raw message
drivers/media/platform/vimc/vimc-streamer.h new file +38 -0
@@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* vimc-streamer.h Virtual Media Controller Driver +* +* Copyright (C) 2018 Lucas A. M. Magalhães <[email protected]> +* +*/ + +#ifndef _VIMC_STREAMER_H_ +#define _VIMC_STREAMER_H_ + +#include <media/media-device.h> + +#include "vimc-common.h" + +#define VIMC_STREAMER_PIPELINE_MAX_SIZE 16 + +struct vimc_stream { +struct media_pipeline pipe; +struct vimc_ent_device *ved_pipeline[VIMC_STREAMER_PIPELINE_MAX_SIZE ]; +unsigned int pipe_size; +u8 *frame; +struct task_struct *kthread; +}; + +/** +* vimc_streamer_s_streamer - start/stop the stream +* +* @stream: the pointer to the stream to start or stop +* @ved: The last entity of the streamer pipeline +* @enable: any non-zero number start the stream, zero stop +* +*/ +int vimc_streamer_s_stream (struct vimc_stream *stream, +struct vimc_ent_device *ved, +int enable); + +#endif //_VIMC_STREAMER_H_
Greg Kroah-Hartman
maintainerPATCH 217/238 media: imx-csi: Input connections to CSI should be optional
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve Longerbeam <[email protected]>
commit 337e90ed028643c7acdfd0d31e3224d05ca03d66 upstream.
Some imx platforms do not have fwnode connections to all CSI input ports, and should not be treated as an error. This includes the imx6q SabreAuto, which has no connections to ipu1_csi1 and ipu2_csi0. Return -ENOTCONN in imx_csi_parse_endpoint() so that v4l2-fwnode endpoint parsing will not treat an unconnected CSI input port as an error.
--- drivers/staging/media/imx/imx-media-csi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/imx/imx-media-csi.c +1 -1
@@ -1787,7 +1787,7 @@ static int imx_csi_parse_endpoint(struct struct v4l2_fwnode_endpoint *vep, struct v4l2_async_subdev *asd) { - return fwnode_device_is_available(asd->match.fwnode) ? 0 : -EINVAL; + return fwnode_device_is_available(asd->match.fwnode) ? 0 : -ENOTCONN; }static int imx_csi_async_register (struct csi_priv *priv)
Greg Kroah-Hartman
maintainerPATCH 218/238 media: imx: csi: Disable CSI immediately after last EOF
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve Longerbeam <[email protected]>
commit 2e0fe66e0a136252f4d89dbbccdcb26deb867eb8 upstream.
Disable the CSI immediately after receiving the last EOF before stream off (and thus before disabling the IDMA channel). Do this by moving the wait for EOF completion into a new function csi_idmac_wait_last_eof().
This fixes a complete system hard lockup on the SabreAuto when streaming from the ADV7180, by repeatedly sending a stream off immediately followed by stream on:
while true; do v4l2-ctl -d4 --stream-mmap --stream-count=3; done
Eventually this either causes the system lockup or EOF timeouts at all subsequent stream on, until a system reset.
The lockup occurs when disabling the IDMA channel at stream off. Disabling the CSI before disabling the IDMA channel appears to be a reliable fix for the hard lockup.
--- drivers/staging/media/imx/imx-media-csi.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/staging/media/imx/imx-media-csi.c +14 -3
@@ -629,7 +629,7 @@ out_put_ipu:return ret; } -static void csi_idmac_stop (struct csi_priv *priv) +static void csi_idmac_wait_last_eof (struct csi_priv *priv) {unsigned long flags;int ret;
@@ -646,7 +646,10 @@ static void csi_idmac_stop(struct csi_pr &priv->last_eof_comp, msecs_to_jiffies(IMX_MEDIA_EOF_TIMEOUT));if (ret ==0 )v4l2_warn (&priv->sd,"wait last EOF timeout\n" ); +} +static void csi_idmac_stop (struct csi_priv *priv) +{devm_free_irq (priv->dev, priv->eof_irq, priv);devm_free_irq (priv->dev, priv->nfb4eof_irq, priv);
@@ -758,6 +761,16 @@ idmac_stop:static void csi_stop (struct csi_priv *priv) { +if (priv->dest ==IPU_CSI_DEST_IDMAC ) +csi_idmac_wait_last_eof (priv); + +/* +* Disable the CSI asap, after syncing with the last EOF. +* Doing so after the IDMA channel is disabled has shown to +* create hard system-wide hangs. +*/ +ipu_csi_disable (priv->csi); +if (priv->dest ==IPU_CSI_DEST_IDMAC ) {csi_idmac_stop (priv);
@@ -765,8 +778,6 @@ static void csi_stop(struct csi_priv *prif (priv->fim)imx_media_fim_set_stream (priv->fim,NULL , false); } - -ipu_csi_disable (priv->csi); }static const struct csi_skip_desc csi_skip[12 ] = {
Greg Kroah-Hartman
maintainerPATCH 219/238 media: imx: csi: Stop upstream before disabling IDMA channel
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve Longerbeam <[email protected]>
commit 4bc1ab41eee9d02ad2483bf8f51a7b72e3504eba upstream.
Move upstream stream off to just after receiving the last EOF completion and disabling the CSI (and thus before disabling the IDMA channel) in csi_stop(). For symmetry also move upstream stream on to beginning of csi_start().
Doing this makes csi_s_stream() more symmetric with prp_s_stream() which will require the same change to fix a hard lockup.
--- drivers/staging/media/imx/imx-media-csi.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
drivers/staging/media/imx/imx-media-csi.c +13 -12
@@ -725,10 +725,16 @@ static int csi_start(struct csi_priv *pr output_fi = &priv->frame_interval[priv->active_output_pad]; +/* start upstream */ + ret =v4l2_subdev_call (priv->src_sd, video, s_stream,1 ); + ret = (ret && ret != -ENOIOCTLCMD ) ? ret :0 ; +if (ret) +return ret; +if (priv->dest ==IPU_CSI_DEST_IDMAC ) { ret =csi_idmac_start (priv);if (ret) -return ret; + goto stop_upstream; } ret =csi_setup (priv);
@@ -756,6 +762,8 @@ fim_off: idmac_stop:if (priv->dest ==IPU_CSI_DEST_IDMAC )csi_idmac_stop (priv); +stop_upstream: +v4l2_subdev_call (priv->src_sd, video, s_stream,0 );return ret; }
@@ -771,6 +779,9 @@ static void csi_stop(struct csi_priv *pr*/ ipu_csi_disable (priv->csi); +/* stop upstream */ +v4l2_subdev_call (priv->src_sd, video, s_stream,0 ); +if (priv->dest ==IPU_CSI_DEST_IDMAC ) {csi_idmac_stop (priv);
@@ -938,23 +949,13 @@ static int csi_s_stream(struct v4l2_subd goto update_count;if (enable) { -/* upstream must be started first, before starting CSI */ - ret =v4l2_subdev_call (priv->src_sd, video, s_stream,1 ); - ret = (ret && ret != -ENOIOCTLCMD ) ? ret :0 ; -if (ret) - goto out; -dev_dbg (priv->dev,"stream ON\n" ); ret =csi_start (priv); -if (ret) { -v4l2_subdev_call (priv->src_sd, video, s_stream,0 ); +if (ret) goto out; - } }else {dev_dbg (priv->dev,"stream OFF\n" ); -/* CSI must be stopped first, then stop upstream */ csi_stop (priv); -v4l2_subdev_call (priv->src_sd, video, s_stream,0 ); } update_count:
Greg Kroah-Hartman
maintainerPATCH 220/238 drm/fb-helper: generic: Fix drm_fbdev_client_restore()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Noralf Trønnes <[email protected]>
commit 78de14c23e031420aa5f61973583635eccd6cd2a upstream.
If fbdev setup has failed, lastclose will give a NULL pointer deref:
[ 77.794295] [drm:drm_lastclose] [ 77.794414] [drm:drm_lastclose] driver lastclose completed [ 77.794660] Unable to handle kernel NULL pointer dereference at virtual address 00000014 [ 77.809460] pgd = b376b71b [ 77.818275] [00000014] *pgd=175ba831, *pte=00000000, *ppte=00000000 [ 77.830813] Internal error: Oops: 17 [#1] ARM [ 77.840963] Modules linked in: mi0283qt mipi_dbi tinydrm raspberrypi_hwmon gpio_backlight backlight snd_bcm2835(C) bcm2835_rng rng_core [ 77.865203] CPU: 0 PID: 527 Comm: lt-modetest Tainted: G C 5.0.0-rc1+ #1 [ 77.879525] Hardware name: BCM2835 [ 77.889185] PC is at restore_fbdev_mode+0x20/0x164 [ 77.900261] LR is at drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0x9c [ 78.002446] Process lt-modetest (pid: 527, stack limit = 0x7a3d5c14) [ 78.291030] Backtrace: [ 78.300815] [<c04f2d0c>] (restore_fbdev_mode) from [<c04f4708>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0x9c) [ 78.319095] r9:d8a8a288 r8:d891acf0 r7:d7697910 r6:00000000 r5:d891ac00 r4:d891ac00 [ 78.334432] [<c04f46b4>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c04f47e8>] (drm_fbdev_client_restore+0x18/0x20) [ 78.353296] r8:d76978c0 r7:d7697910 r6:d7697950 r5:d7697800 r4:d891ac00 r3:c04f47d0 [ 78.368689] [<c04f47d0>] (drm_fbdev_client_restore) from [<c051b6b4>] (drm_client_dev_restore+0x7c/0xc0) [ 78.385982] [<c051b638>] (drm_client_dev_restore) from [<c04f8fd0>] (drm_lastclose+0xc4/0xd4) [ 78.402332] r8:d76978c0 r7:d7471080 r6:c0e0c088 r5:d8a85e00 r4:d7697800 [ 78.416688] [<c04f8f0c>] (drm_lastclose) from [<c04f9088>] (drm_release+0xa8/0x10c) [ 78.431929] r5:d8a85e00 r4:d7697800 [ 78.442989] [<c04f8fe0>] (drm_release) from [<c02640c4>] (__fput+0x104/0x1c8) [ 78.457740] r8:d5ccea10 r7:d96cfb10 r6:00000008 r5:d74c1b90 r4:d8a8a280 [ 78.472043] [<c0263fc0>] (__fput) from [<c02641ec>] (____fput+0x18/0x1c) [ 78.486363] r10:00000006 r9:d7722000 r8:c01011c4 r7:00000000 r6:c0ebac6c r5:d892a340 [ 78.501869] r4:d8a8a280 [ 78.512002] [<c02641d4>] (____fput) from [<c013ef1c>] (task_work_run+0x98/0xac) [ 78.527186] [<c013ee84>] (task_work_run) from [<c010cc54>] (do_work_pending+0x4f8/0x570) [ 78.543238] r7:d7722030 r6:00000004 r5:d7723fb0 r4:00000000 [ 78.556825] [<c010c75c>] (do_work_pending) from [<c0101034>] (slow_work_pending+0xc/0x20) [ 78.674256] ---[ end trace 70d3a60cf739be3b ]---
Fix by using drm_fb_helper_lastclose() which checks if fbdev is in use.
--- drivers/gpu/drm/drm_fb_helper.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +1 -3
@@ -3170,9 +3170,7 @@ static void drm_fbdev_client_unregister(static int drm_fbdev_client_restore (struct drm_client_dev *client) { -struct drm_fb_helper *fb_helper =drm_fb_helper_from_client (client); - -drm_fb_helper_restore_fbdev_mode_unlocked (fb_helper); +drm_fb_helper_lastclose (client->dev);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 221/238 drm/radeon/evergreen_cs: fix missing break in switch statement
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
commit cc5034a5d293dd620484d1d836aa16c6764a1c8c upstream.
Add missing break statement in order to prevent the code from falling through to case CB_TARGET_MASK.
This bug was found thanks to the ongoing efforts to enable -Wimplicit-fallthrough.
--- drivers/gpu/drm/radeon/evergreen_cs.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/radeon/evergreen_cs.c +1 -0
@@ -1299,6 +1299,7 @@ static int evergreen_cs_handle_reg(strucreturn -EINVAL ; } ib[idx] += (u32)((reloc->gpu_offset >>8 ) &0xffffffff ); +break ;case CB_TARGET_MASK : track->cb_target_mask =radeon_get_ib_value (p, idx); track->cb_dirty = true;
Greg Kroah-Hartman
maintainerPATCH 222/238 drm/amd/powerplay: correct power reading on fiji
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Evan Quan <[email protected]>
commit f5742ec36422a39b57f0256e4847f61b3c432f8c upstream.
Set sampling period as 500ms to provide a smooth power reading output. Also, correct the register for power reading.
--- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +3 -3
@@ -3491,14 +3491,14 @@ static int smu7_get_gpu_power(struct pp_smum_send_msg_to_smc (hwmgr, PPSMC_MSG_PmStatusLogStart);cgs_write_ind_register (hwmgr->device,CGS_IND_REG__SMC , - ixSMU_PM_STATUS_94,0 ); + ixSMU_PM_STATUS_95,0 );for (i =0 ; i <10 ; i++) { -mdelay (1 ); +mdelay (500 );smum_send_msg_to_smc (hwmgr, PPSMC_MSG_PmStatusLogSample); tmp =cgs_read_ind_register (hwmgr->device,CGS_IND_REG__SMC , - ixSMU_PM_STATUS_94); + ixSMU_PM_STATUS_95);if (tmp !=0 )break ; }
Greg Kroah-Hartman
maintainerPATCH 223/238 drm/amd/display: dont call dm_pp_ function from an fpu block
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harry Wentland <[email protected]>
commit 59d3191f14dc18881fec1172c7096b7863622803 upstream.
Powerplay functions called from dm_pp_* functions tend to do a mutex_lock which isn't safe to do inside a kernel_fpu_begin/end block as those will disable/enable preemption.
Rearrange the dm_pp_get_clock_levels_by_type_with_voltage calls to make sure they happen outside of kernel_fpu_begin/end.
--- drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +6 -2
@@ -1355,12 +1355,12 @@ void dcn_bw_update_from_pplib(struct dcstruct dm_pp_clock_levels_with_voltage fclks = {0 }, dcfclks = {0 };bool res; -kernel_fpu_begin (); -/* TODO: This is not the proper way to obtain fabric_and_dram_bandwidth, should be min(fclk, memclk) */ res =dm_pp_get_clock_levels_by_type_with_voltage ( ctx,DM_PP_CLOCK_TYPE_FCLK , &fclks); +kernel_fpu_begin (); +if (res) res =verify_clock_values (&fclks);
@@ -1379,9 +1379,13 @@ void dcn_bw_update_from_pplib(struct dc }else BREAK_TO_DEBUGGER (); +kernel_fpu_end (); + res =dm_pp_get_clock_levels_by_type_with_voltage ( ctx,DM_PP_CLOCK_TYPE_DCFCLK , &dcfclks); +kernel_fpu_begin (); +if (res) res =verify_clock_values (&dcfclks);
Greg Kroah-Hartman
maintainerPATCH 224/238 KVM: Call kvm_arch_memslots_updated() before updating memslots
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 152482580a1b0accb60676063a1ac57b2d12daf6 upstream.
kvm_arch_memslots_updated() is at this point in time an x86-specific hook for handling MMIO generation wraparound. x86 stashes 19 bits of the memslots generation number in its MMIO sptes in order to avoid full page fault walks for repeat faults on emulated MMIO addresses. Because only 19 bits are used, wrapping the MMIO generation number is possible, if unlikely. kvm_arch_memslots_updated() alerts x86 that the generation has changed so that it can invalidate all MMIO sptes in case the effective MMIO generation has wrapped so as to avoid using a stale spte, e.g. a (very) old spte that was created with generation==0.
Given that the purpose of kvm_arch_memslots_updated() is to prevent consuming stale entries, it needs to be called before the new generation is propagated to memslots. Invalidating the MMIO sptes after updating memslots means that there is a window where a vCPU could dereference the new memslots generation, e.g. 0, and incorrectly reuse an old MMIO spte that was created with (pre-wrap) generation==0.
--- arch/mips/include/asm/kvm_host.h | 2 +- arch/powerpc/include/asm/kvm_host.h | 2 +- arch/s390/include/asm/kvm_host.h | 2 +- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/mmu.c | 4 ++-- arch/x86/kvm/x86.c | 4 ++-- include/linux/kvm_host.h | 2 +- virt/kvm/arm/mmu.c | 2 +- virt/kvm/kvm_main.c | 7 +++++-- 9 files changed, 15 insertions(+), 12 deletions(-)
arch/mips/include/asm/kvm_host.h +1 -1
@@ -1134,7 +1134,7 @@ static inline void kvm_arch_hardware_unsstatic inline void kvm_arch_sync_events (struct kvm *kvm) {}static inline void kvm_arch_free_memslot (struct kvm *kvm,struct kvm_memory_slot *free,struct kvm_memory_slot *dont) {} -static inline void kvm_arch_memslots_updated (struct kvm *kvm,struct kvm_memslots *slots) {} +static inline void kvm_arch_memslots_updated (struct kvm *kvm,u64 gen) {}static inline void kvm_arch_sched_in (struct kvm_vcpu *vcpu,int cpu) {}static inline void kvm_arch_vcpu_blocking (struct kvm_vcpu *vcpu) {}static inline void kvm_arch_vcpu_unblocking (struct kvm_vcpu *vcpu) {}
arch/powerpc/include/asm/kvm_host.h +1 -1
@@ -837,7 +837,7 @@ struct kvm_vcpu_arch {static inline void kvm_arch_hardware_disable (void ) {}static inline void kvm_arch_hardware_unsetup (void ) {}static inline void kvm_arch_sync_events (struct kvm *kvm) {} -static inline void kvm_arch_memslots_updated (struct kvm *kvm,struct kvm_memslots *slots) {} +static inline void kvm_arch_memslots_updated (struct kvm *kvm,u64 gen) {}static inline void kvm_arch_flush_shadow_all (struct kvm *kvm) {}static inline void kvm_arch_sched_in (struct kvm_vcpu *vcpu,int cpu) {}static inline void kvm_arch_exit (void ) {}
arch/s390/include/asm/kvm_host.h +1 -1
@@ -878,7 +878,7 @@ static inline void kvm_arch_vcpu_uninit(static inline void kvm_arch_sched_in (struct kvm_vcpu *vcpu,int cpu) {}static inline void kvm_arch_free_memslot (struct kvm *kvm,struct kvm_memory_slot *free,struct kvm_memory_slot *dont) {} -static inline void kvm_arch_memslots_updated (struct kvm *kvm,struct kvm_memslots *slots) {} +static inline void kvm_arch_memslots_updated (struct kvm *kvm,u64 gen) {}static inline void kvm_arch_flush_shadow_all (struct kvm *kvm) {}static inline void kvm_arch_flush_shadow_memslot (struct kvm *kvm,struct kvm_memory_slot *slot) {}
arch/x86/include/asm/kvm_host.h +1 -1
@@ -1255,7 +1255,7 @@ void kvm_mmu_clear_dirty_pt_masked(strucstruct kvm_memory_slot *slot, gfn_t gfn_offset, unsigned long mask);void kvm_mmu_zap_all (struct kvm *kvm); -void kvm_mmu_invalidate_mmio_sptes (struct kvm *kvm,struct kvm_memslots *slots); +void kvm_mmu_invalidate_mmio_sptes (struct kvm *kvm,u64 gen);unsigned int kvm_mmu_calculate_mmu_pages (struct kvm *kvm);void kvm_mmu_change_mmu_pages (struct kvm *kvm,unsigned int kvm_nr_mmu_pages);
arch/x86/kvm/mmu.c +2 -2
@@ -5891,13 +5891,13 @@ static bool kvm_has_zapped_obsolete_pagereturn unlikely (!list_empty_careful (&kvm->arch.zapped_obsolete_pages)); } -void kvm_mmu_invalidate_mmio_sptes (struct kvm *kvm,struct kvm_memslots *slots) +void kvm_mmu_invalidate_mmio_sptes (struct kvm *kvm,u64 gen) {/* * The very rare case: if the generation-number is round, * zap all shadow pages. */ -if (unlikely ((slots->generation &MMIO_GEN_MASK ) ==0 )) { +if (unlikely ((gen &MMIO_GEN_MASK ) ==0 )) {kvm_debug_ratelimited ("kvm: zapping shadow pages for mmio generation wraparound\n" );kvm_mmu_invalidate_zap_all_pages (kvm); }
arch/x86/kvm/x86.c +2 -2
@@ -9348,13 +9348,13 @@ out_free:return -ENOMEM ; } -void kvm_arch_memslots_updated (struct kvm *kvm,struct kvm_memslots *slots) +void kvm_arch_memslots_updated (struct kvm *kvm,u64 gen) {/* * memslots->generation has been incremented. * mmio generation may have reached its maximum value. */ -kvm_mmu_invalidate_mmio_sptes (kvm, slots); +kvm_mmu_invalidate_mmio_sptes (kvm, gen); } int kvm_arch_prepare_memory_region(struct kvm *kvm,
include/linux/kvm_host.h +1 -1
@@ -634,7 +634,7 @@ void kvm_arch_free_memslot(struct kvm *k struct kvm_memory_slot *dont);int kvm_arch_create_memslot (struct kvm *kvm,struct kvm_memory_slot *slot,unsigned long npages); -void kvm_arch_memslots_updated (struct kvm *kvm,struct kvm_memslots *slots); +void kvm_arch_memslots_updated (struct kvm *kvm,u64 gen); int kvm_arch_prepare_memory_region(struct kvm *kvm, struct kvm_memory_slot *memslot, const struct kvm_userspace_memory_region *mem,
virt/kvm/arm/mmu.c +1 -1
@@ -2353,7 +2353,7 @@ int kvm_arch_create_memslot(struct kvm *return 0 ; } -void kvm_arch_memslots_updated (struct kvm *kvm,struct kvm_memslots *slots) +void kvm_arch_memslots_updated (struct kvm *kvm,u64 gen) { }
virt/kvm/kvm_main.c +5 -2
@@ -874,6 +874,7 @@ static struct kvm_memslots *install_new_ int as_id, struct kvm_memslots *slots) { struct kvm_memslots *old_memslots = __kvm_memslots(kvm, as_id); +u64 gen;/* * Set the low bit in the generation, which disables SPTE caching
@@ -896,9 +897,11 @@ static struct kvm_memslots *install_new_* space 0 will use generations 0, 4, 8, ... while * address space 1 will * use generations 2, 6, 10, 14, ... */ - slots->generation +=KVM_ADDRESS_SPACE_NUM *2 -1 ; + gen = slots->generation +KVM_ADDRESS_SPACE_NUM *2 -1 ; -kvm_arch_memslots_updated (kvm, slots); +kvm_arch_memslots_updated (kvm, gen); + + slots->generation = gen;return old_memslots; }
Greg Kroah-Hartman
maintainerPATCH 225/238 KVM: VMX: Compare only a single byte for VMCS "launched" in vCPU-run
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 61c08aa9606d4e48a8a50639c956448a720174c3 upstream.
The vCPU-run asm blob does a manual comparison of a VMCS' launched status to execute the correct VM-Enter instruction, i.e. VMLAUNCH vs. VMRESUME. The launched flag is a bool, which is a typedef of _Bool. C99 does not define an exact size for _Bool, stating only that is must be large enough to hold '0' and '1'. Most, if not all, compilers use a single byte for _Bool, including gcc[1].
Originally, 'launched' was of type 'int' and so the asm blob used 'cmpl' to check the launch status. When 'launched' was moved to be stored on a per-VMCS basis, struct vcpu_vmx's "temporary" __launched flag was added in order to avoid having to pass the current VMCS into the asm blob. The new '__launched' was defined as a 'bool' and not an 'int', but the 'cmp' instruction was not updated.
This has not caused any known problems, likely due to compilers aligning variables to 4-byte or 8-byte boundaries and KVM zeroing out struct vcpu_vmx during allocation. I.e. vCPU-run accesses "junk" data, it just happens to always be zero and so doesn't affect the result.
[1] https://gcc.gnu.org/ml/gcc-patches/2000-10/msg01127.html
--- arch/x86/kvm/vmx/vmx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/vmx/vmx.c +1 -1
@@ -6399,7 +6399,7 @@ static void __vmx_vcpu_run(struct kvm_vc"mov %%" _ASM_AX", %%cr2 \n\t" "3: \n\t" /* Check if vmlaunch or vmresume is needed */ -"cmpl $0, %c[launched](%%" _ASM_CX") \n\t" +"cmpb $0, %c[launched](%%" _ASM_CX") \n\t" /* Load guest registers. Don't clobber flags. */ "mov %c[rax](%%" _ASM_CX"), %%" _ASM_AX" \n\t" "mov %c[rbx](%%" _ASM_CX"), %%" _ASM_BX" \n\t"
Greg Kroah-Hartman
maintainerPATCH 226/238 KVM: VMX: Zero out *all* general purpose registers after VM-Exit
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 0e0ab73c9a0243736bcd779b30b717e23ba9a56d upstream.
...except RSP, which is restored by hardware as part of VM-Exit.
Paolo theorized that restoring registers from the stack after a VM-Exit in lieu of zeroing them could lead to speculative execution with the guest's values, e.g. if the stack accesses miss the L1 cache[1]. Zeroing XORs are dirt cheap, so just be ultra-paranoid.
Note that the scratch register (currently RCX) used to save/restore the guest state is also zeroed as its host-defined value is loaded via the stack, just with a MOV instead of a POP.
[1] https://patchwork.kernel.org/patch/10771539/#22441255
--- arch/x86/kvm/vmx/vmx.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
arch/x86/kvm/vmx/vmx.c +11 -3
@@ -6449,10 +6449,15 @@ static void __vmx_vcpu_run(struct kvm_vc"mov %%r13, %c[r13](%%" _ASM_CX") \n\t" "mov %%r14, %c[r14](%%" _ASM_CX") \n\t" "mov %%r15, %c[r15](%%" _ASM_CX") \n\t" +/* -* Clear host registers marked as clobbered to prevent -* speculative use. -*/ +* Clear all general purpose registers (except RSP, which is loaded by +* the CPU during VM-Exit) to prevent speculative use of the guest's +* values, even those that are saved/loaded via the stack. In theory, +* an L1 cache miss when restoring registers could lead to speculative +* execution with the guest's values. Zeroing XORs are dirt cheap, +* i.e. the extra paranoia is essentially free. +*/ "xor %%r8d, %%r8d \n\t" "xor %%r9d, %%r9d \n\t" "xor %%r10d, %%r10d \n\t"
@@ -6467,8 +6472,11 @@ static void __vmx_vcpu_run(struct kvm_vc "xor %%eax, %%eax \n\t" "xor %%ebx, %%ebx \n\t" + "xor %%ecx, %%ecx \n\t" + "xor %%edx, %%edx \n\t" "xor %%esi, %%esi \n\t" "xor %%edi, %%edi \n\t" + "xor %%ebp, %%ebp \n\t" "pop %%" _ASM_BP "; pop %%" _ASM_DX " \n\t" : ASM_CALL_CONSTRAINT : "c"(vmx), "d"((unsigned long)HOST_RSP), "S"(evmcs_rsp),
Greg Kroah-Hartman
maintainerPATCH 227/238 KVM: x86/mmu: Detect MMIO generation wrap in any address space
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit e1359e2beb8b0a1188abc997273acbaedc8ee791 upstream.
The check to detect a wrap of the MMIO generation explicitly looks for a generation number of zero. Now that unique memslots generation numbers are assigned to each address space, only address space 0 will get a generation number of exactly zero when wrapping. E.g. when address space 1 goes from 0x7fffe to 0x80002, the MMIO generation number will wrap to 0x2. Adjust the MMIO generation to strip the address space modifier prior to checking for a wrap.
--- arch/x86/kvm/mmu.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
arch/x86/kvm/mmu.c +19 -2
@@ -5893,11 +5893,28 @@ static bool kvm_has_zapped_obsolete_pagevoid kvm_mmu_invalidate_mmio_sptes (struct kvm *kvm,u64 gen) { + gen &=MMIO_GEN_MASK ; + +/* +* Shift to eliminate the "update in-progress" flag, which isn't +* included in the spte's generation number. +*/ + gen >>=1 ; + +/* +* Generation numbers are incremented in multiples of the number of +* address spaces in order to provide unique generations across all +* address spaces. Strip what is effectively the address space +* modifier prior to checking for a wrap of the MMIO generation so +* that a wrap in any address space is detected. +*/ + gen &= ~((u64 )KVM_ADDRESS_SPACE_NUM -1 ); +/* -* The very rare case: if the generation-number is round, +* The very rare case: if the MMIO generation number has wrapped, * zap all shadow pages. */ -if (unlikely ((gen &MMIO_GEN_MASK ) ==0 )) { +if (unlikely (gen ==0 )) {kvm_debug_ratelimited ("kvm: zapping shadow pages for mmio generation wraparound\n" );kvm_mmu_invalidate_zap_all_pages (kvm); }
Greg Kroah-Hartman
maintainerPATCH 228/238 KVM: x86/mmu: Do not cache MMIO accesses while memslots are in flux
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit ddfd1730fd829743e41213e32ccc8b4aa6dc8325 upstream.
When installing new memslots, KVM sets bit 0 of the generation number to indicate that an update is in-progress. Until the update is complete, there are no guarantees as to whether a vCPU will see the old or the new memslots. Explicity prevent caching MMIO accesses so as to avoid using an access cached from the old memslots after the new memslots have been installed.
Note that it is unclear whether or not disabling caching during the update window is strictly necessary as there is no definitive documentation as to what ordering guarantees KVM provides with respect to updating memslots. That being said, the MMIO spte code does not allow reusing sptes created while an update is in-progress, and the associated documentation explicitly states:
We do not want to use an MMIO sptes created with an odd generation number, ... If KVM is unlucky and creates an MMIO spte while the low bit is 1, the next access to the spte will always be a cache miss.
At the very least, disabling the per-vCPU MMIO cache during updates will make its behavior consistent with the MMIO spte behavior and documentation.
--- arch/x86/kvm/x86.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/x86/kvm/x86.h +6 -1
@@ -181,6 +181,11 @@ static inline bool emul_is_noncanonical_static inline void vcpu_cache_mmio_info (struct kvm_vcpu *vcpu,gva_t gva,gfn_t gfn,unsigned access) { +u64 gen =kvm_memslots (vcpu->kvm)->generation; + +if (unlikely (gen &1 )) +return ; +/* * If this is a shadow nested page table, the "GVA" is * actually a nGPA.
@@ -188,7 +193,7 @@ static inline void vcpu_cache_mmio_info( vcpu->arch.mmio_gva =mmu_is_nested (vcpu) ?0 : gva &PAGE_MASK ; vcpu->arch.access = access; vcpu->arch.mmio_gfn = gfn; - vcpu->arch.mmio_gen =kvm_memslots (vcpu->kvm)->generation; + vcpu->arch.mmio_gen = gen; }static inline bool vcpu_match_mmio_gen (struct kvm_vcpu *vcpu)
Greg Kroah-Hartman
maintainerPATCH 229/238 KVM: nVMX: Sign extend displacements of VMX instrs mem operands
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 946c522b603f281195af1df91837a1d4d1eb3bc9 upstream.
The VMCS.EXIT_QUALIFCATION field reports the displacements of memory operands for various instructions, including VMX instructions, as a naturally sized unsigned value, but masks the value by the addr size, e.g. given a ModRM encoded as -0x28(%ebp), the -0x28 displacement is reported as 0xffffffd8 for a 32-bit address size. Despite some weird wording regarding sign extension, the SDM explicitly states that bits beyond the instructions address size are undefined:
In all cases, bits of this field beyond the instruction’s address size are undefined.
Failure to sign extend the displacement results in KVM incorrectly treating a negative displacement as a large positive displacement when the address size of the VMX instruction is smaller than KVM's native size, e.g. a 32-bit address size on a 64-bit KVM.
The very original decoding, added by commit 064aea774768 ("KVM: nVMX:
Decoding memory operands of VMX instructions"), sort of modeled sign extension by truncating the final virtual/linear address for a 32-bit address size. I.e. it messed up the effective address but made it work by adjusting the final address.
When segmentation checks were added, the truncation logic was kept as-is and no sign extension logic was introduced. In other words, it kept calculating the wrong effective address while mostly generating the correct virtual/linear address. As the effective address is what's used in the segment limit checks, this results in KVM incorreclty injecting #GP/#SS faults due to non-existent segment violations when a nested VMM uses negative displacements with an address size smaller than KVM's native address size.
Using the -0x28(%ebp) example, an EBP value of 0x1000 will result in KVM using 0x100000fd8 as the effective address when checking for a segment limit violation. This causes a 100% failure rate when running a 32-bit KVM build as L1 on top of a 64-bit KVM L0.
--- arch/x86/kvm/vmx/nested.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/kvm/vmx/nested.c +4 -0
@@ -4035,6 +4035,10 @@ int get_vmx_mem_address(struct kvm_vcpu/* Addr = segment_base + offset */ /* offset = base + [index * scale] + displacement */ off = exit_qualification;/* holds the displacement */ +if (addr_size ==1 ) + off = (gva_t )sign_extend64 (off,31 ); +else if (addr_size ==0 ) + off = (gva_t )sign_extend64 (off,15 );if (base_is_valid) off +=kvm_register_read (vcpu, base_reg);if (index_is_valid)
Greg Kroah-Hartman
maintainerPATCH 230/238 KVM: nVMX: Apply addr size mask to effective address for VMX instructions
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 8570f9e881e3fde98801bb3a47eef84dd934d405 upstream.
The address size of an instruction affects the effective address, not the virtual/linear address. The final address may still be truncated, e.g. to 32-bits outside of long mode, but that happens irrespective of the address size, e.g. a 32-bit address size can yield a 64-bit virtual address when using FS/GS with a non-zero base.
--- arch/x86/kvm/vmx/nested.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)
arch/x86/kvm/vmx/nested.c +23 -2
@@ -4044,20 +4044,41 @@ int get_vmx_mem_address(struct kvm_vcpuif (index_is_valid) off +=kvm_register_read (vcpu, index_reg)<<scaling;vmx_get_segment (vcpu, &s, seg_reg); - *ret = s.base + off; +/* +* The effective address, i.e. @off, of a memory operand is truncated +* based on the address size of the instruction. Note that this is +* the *effective address*, i.e. the address prior to accounting for +* the segment's base. +*/ if (addr_size ==1 )/* 32 bit */ - *ret &=0xffffffff ; + off &=0xffffffff ; +else if (addr_size ==0 )/* 16 bit */ + off &=0xffff ;/* Checks for #GP/#SS exceptions. */ exn = false;if (is_long_mode (vcpu)) { +/* +* The virtual/linear address is never truncated in 64-bit +* mode, e.g. a 32-bit address size can yield a 64-bit virtual +* address when using FS/GS with a non-zero base. +*/ + *ret = s.base + off; +/* Long mode: #GP(0)/#SS(0) if the memory address is in a * non-canonical form. This is the only check on the memory * destination for long mode! */ exn =is_noncanonical_address (*ret, vcpu); }else if (is_protmode (vcpu)) { +/* +* When not in long mode, the virtual/linear address is +* unconditionally truncated to 32 bits regardless of the +* address size. +*/ + *ret = (s.base + off) &0xffffffff ; +/* Protected mode: apply checks for segment validity in the * following order: * - segment type check (#GP(0) may be thrown)
Greg Kroah-Hartman
maintainerPATCH 231/238 KVM: nVMX: Ignore limit checks on VMX instructions using flat segments
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 34333cc6c2cb021662fd32e24e618d1b86de95bf upstream.
Regarding segments with a limit==0xffffffff, the SDM officially states:
When the effective limit is FFFFFFFFH (4 GBytes), these accesses may or may not cause the indicated exceptions. Behavior is implementation-specific and may vary from one execution to another.
In practice, all CPUs that support VMX ignore limit checks for "flat segments", i.e. an expand-up data or code segment with base=0 and limit=0xffffffff. This is subtly different than wrapping the effective address calculation based on the address size, as the flat segment behavior also applies to accesses that would wrap the 4g boundary, e.g. a 4-byte access starting at 0xffffffff will access linear addresses 0xffffffff, 0x0, 0x1 and 0x2.
--- arch/x86/kvm/vmx/nested.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
arch/x86/kvm/vmx/nested.c +9 -3
@@ -4102,10 +4102,16 @@ int get_vmx_mem_address(struct kvm_vcpu/* Protected mode: #GP(0)/#SS(0) if the segment is unusable. */ exn = (s.unusable !=0 ); -/* Protected mode: #GP(0)/#SS(0) if the memory -* operand is outside the segment limit. + +/* +* Protected mode: #GP(0)/#SS(0) if the memory operand is +* outside the segment limit. All CPUs that support VMX ignore +* limit checks for flat segments, i.e. segments with base==0, +* limit==0xffffffff and of type expand-up data or code. */ - exn = exn || (off +sizeof (u64) > s.limit); +if (!(s.base ==0 && s.limit ==0xffffffff && + ((s.type &8 ) || !(s.type &4 )))) + exn = exn || (off +sizeof (u64) > s.limit); }if (exn) { kvm_queue_exception_e(vcpu,
Greg Kroah-Hartman
maintainerPATCH 232/238 KVM: nVMX: Check a single byte for VMCS "launched" in nested early checks
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 1ce072cbfd8dba46f117804850398e0b3040a541 upstream.
Nested early checks does a manual comparison of a VMCS' launched status in its asm blob to execute the correct VM-Enter instruction, i.e. VMLAUNCH vs. VMRESUME. The launched flag is a bool, which is a typedef of _Bool. C99 does not define an exact size for _Bool, stating only that is must be large enough to hold '0' and '1'. Most, if not all, compilers use a single byte for _Bool, including gcc[1].
The use of 'cmpl' instead of 'cmpb' was not deliberate, but rather the result of a copy-paste as the asm blob was directly derived from the asm blob for vCPU-run.
This has not caused any known problems, likely due to compilers aligning variables to 4-byte or 8-byte boundaries and KVM zeroing out struct vcpu_vmx during allocation. I.e. vCPU-run accesses "junk" data, it just happens to always be zero and so doesn't affect the result.
[1] https://gcc.gnu.org/ml/gcc-patches/2000-10/msg01127.html
--- arch/x86/kvm/vmx/nested.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/vmx/nested.c +1 -1
@@ -2765,7 +2765,7 @@ static int nested_vmx_check_vmentry_hw(s"add $%c[wordsize], %%" _ASM_SP"\n\t" /* un-adjust RSP */ /* Check if vmlaunch or vmresume is needed */ -"cmpl $0, %c[launched](%% " _ASM_CX")\n\t" +"cmpb $0, %c[launched](%% " _ASM_CX")\n\t" "call vmx_vmenter\n\t"
Greg Kroah-Hartman
maintainerPATCH 233/238 net: dsa: lantiq_gswip: fix use-after-free on failed probe
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit aed13f2e00ce278f039b76e7ac84d419aff48ef6 upstream.
Make sure to disable and deregister the switch on late probe errors to avoid use-after-free when the device-resource-managed switch is freed.
--- drivers/net/dsa/lantiq_gswip.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/dsa/lantiq_gswip.c +4 -1
@@ -1099,7 +1099,7 @@ static int gswip_probe(struct platform_ddev_err (dev,"wrong CPU port defined, HW only supports port: %i" , priv->hw_info->cpu_port); err = -EINVAL ; - goto mdio_bus; + goto disable_switch; }platform_set_drvdata (pdev, priv);
@@ -1109,6 +1109,9 @@ static int gswip_probe(struct platform_d (version & GSWIP_VERSION_MOD_MASK) >> GSWIP_VERSION_MOD_SHIFT);return 0 ; +disable_switch: +gswip_mdio_mask (priv,GSWIP_MDIO_GLOB_ENABLE ,0 ,GSWIP_MDIO_GLOB ); +dsa_unregister_switch (priv->ds); mdio_bus:if (mdio_np)mdiobus_unregister (priv->ds->slave_mii_bus);
Greg Kroah-Hartman
maintainerPATCH 234/238 net: dsa: lantiq_gswip: fix OF child-node lookups
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit c8cbcb0d8bd72d44fad1a5ddc348ac10e0fb1b37 upstream.
Use the new of_get_compatible_child() helper to look up child nodes to avoid ever matching non-child nodes elsewhere in the tree.
Also fix up the related struct device_node leaks.
--- drivers/net/dsa/lantiq_gswip.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/net/dsa/lantiq_gswip.c +9 -7
@@ -1069,10 +1069,10 @@ static int gswip_probe(struct platform_d version =gswip_switch_r (priv,GSWIP_VERSION );/* bring up the mdio bus */ - gphy_fw_np =of_find_compatible_node (pdev->dev.of_node,NULL , -"lantiq,gphy-fw" ); + gphy_fw_np =of_get_compatible_child (dev->of_node,"lantiq,gphy-fw" );if (gphy_fw_np) { err =gswip_gphy_fw_list (priv, gphy_fw_np, version); +of_node_put (gphy_fw_np);if (err) {dev_err (dev,"gphy fw probe failed\n" );return err;
@@ -1080,13 +1080,12 @@ static int gswip_probe(struct platform_d }/* bring up the mdio bus */ - mdio_np =of_find_compatible_node (pdev->dev.of_node,NULL , -"lantiq,xrx200-mdio" ); + mdio_np =of_get_compatible_child (dev->of_node,"lantiq,xrx200-mdio" );if (mdio_np) { err =gswip_mdio (priv, mdio_np);if (err) {dev_err (dev,"mdio probe failed\n" ); - goto gphy_fw; + goto put_mdio_node; } }
@@ -1115,7 +1114,8 @@ disable_switch: mdio_bus:if (mdio_np)mdiobus_unregister (priv->ds->slave_mii_bus); -gphy_fw: +put_mdio_node: +of_node_put (mdio_np);for (i =0 ; i < priv->num_gphy_fw; i++)gswip_gphy_fw_remove (priv, &priv->gphy_fw[i]);return err;
@@ -1134,8 +1134,10 @@ static int gswip_remove(struct platform_dsa_unregister_switch (priv->ds); -if (priv->ds->slave_mii_bus) +if (priv->ds->slave_mii_bus) {mdiobus_unregister (priv->ds->slave_mii_bus); +of_node_put (priv->ds->slave_mii_bus->dev.of_node); + }for (i =0 ; i < priv->num_gphy_fw; i++)gswip_gphy_fw_remove (priv, &priv->gphy_fw[i]);
Greg Kroah-Hartman
maintainerPATCH 235/238 s390/setup: fix boot crash for machine without EDAT-1
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
commit 86a86804e4f18fc3880541b3d5a07f4df0fe29cb upstream.
The fix to make WARN work in the early boot code created a problem on older machines without EDAT-1. The setup_lowcore_dat_on function uses the pointer from lowcore_ptr[0] to set the DAT bit in the new PSWs. That does not work if the kernel page table is set up with 4K pages as the prefix address maps to absolute zero.
To make this work the PSWs need to be changed with via address 0 in form of the S390_lowcore definition.
--- arch/s390/kernel/setup.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
arch/s390/kernel/setup.c +6 -7
@@ -451,13 +451,12 @@ static void __init setup_lowcore_dat_offstatic void __init setup_lowcore_dat_on (void ) { -struct lowcore *lc; - - lc = lowcore_ptr[0 ]; - lc->external_new_psw.mask |=PSW_MASK_DAT ; - lc->svc_new_psw.mask |=PSW_MASK_DAT ; - lc->program_new_psw.mask |=PSW_MASK_DAT ; - lc->io_new_psw.mask |=PSW_MASK_DAT ; +__ctl_clear_bit (0 ,28 ); + S390_lowcore.external_new_psw.mask |=PSW_MASK_DAT ; + S390_lowcore.svc_new_psw.mask |=PSW_MASK_DAT ; + S390_lowcore.program_new_psw.mask |=PSW_MASK_DAT ; + S390_lowcore.io_new_psw.mask |=PSW_MASK_DAT ; +__ctl_set_bit (0 ,28 ); }static struct resource code_resource = {
Greg Kroah-Hartman
maintainerPATCH 236/238 SUNRPC: Prevent thundering herd when the socket is not connected
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit ed7dc973bd91da234d93aff6d033a5206a6c9885 upstream.
If the socket is not connected, then we want to initiate a reconnect rather that trying to transmit requests. If there is a large number of requests queued and waiting for the lock in call_transmit(), then it can take a while for one of the to loop back and retake the lock in call_connect.
--- net/sunrpc/clnt.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
net/sunrpc/clnt.c +17 -4
@@ -1786,7 +1786,12 @@ call_encode(struct rpc_task *task)xprt_request_enqueue_receive (task);xprt_request_enqueue_transmit (task); out: - task->tk_action = call_bind; + task->tk_action = call_transmit; +/* Check that the connection is OK */ +if (!xprt_bound (task->tk_xprt)) + task->tk_action = call_bind; +else if (!xprt_connected (task->tk_xprt)) + task->tk_action = call_connect; }/*
@@ -1978,13 +1983,19 @@ call_transmit(struct rpc_task *task) {dprint_status (task); - task->tk_status =0 ; + task->tk_action = call_transmit_status;if (test_bit (RPC_TASK_NEED_XMIT , &task->tk_runstate)) {if (!xprt_prepare_transmit (task))return ; -xprt_transmit (task); + task->tk_status =0 ; +if (test_bit (RPC_TASK_NEED_XMIT , &task->tk_runstate)) { +if (!xprt_connected (task->tk_xprt)) { + task->tk_status = -ENOTCONN ; +return ; + } +xprt_transmit (task); + } } - task->tk_action = call_transmit_status;xprt_end_transmit (task); }
@@ -2046,6 +2057,8 @@ call_transmit_status(struct rpc_task *tacase -EADDRINUSE :case -ENOTCONN :case -EPIPE : + task->tk_action = call_bind; + task->tk_status =0 ;break ; } }
Greg Kroah-Hartman
maintainerPATCH 237/238 SUNRPC: Fix up RPC back channel transmission
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 477687e1116ad16180caf8633dd830b296a5ce73 upstream.
Now that transmissions happen through a queue, we require the RPC tasks to handle error conditions that may have been set while they were sleeping. The back channel does not currently do this, but assumes that any error condition happens during its own call to xprt_transmit().
The solution is to ensure that the back channel splits out the error handling just like the forward channel does.
--- net/sunrpc/clnt.c | 61 +++++++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 28 deletions(-)
net/sunrpc/clnt.c +33 -28
@@ -66,9 +66,6 @@ static void call_decode(struct rpc_taskstatic void call_bind (struct rpc_task *task);static void call_bind_status (struct rpc_task *task);static void call_transmit (struct rpc_task *task); -#if defined(CONFIG_SUNRPC_BACKCHANNEL ) -static void call_bc_transmit (struct rpc_task *task); -#endif /* CONFIG_SUNRPC_BACKCHANNEL */ static void call_status (struct rpc_task *task);static void call_transmit_status (struct rpc_task *task);static void call_refresh (struct rpc_task *task);
@@ -1131,6 +1128,8 @@ rpc_call_async(struct rpc_clnt *clnt, coEXPORT_SYMBOL_GPL (rpc_call_async);#if defined(CONFIG_SUNRPC_BACKCHANNEL ) +static void call_bc_encode (struct rpc_task *task); +/** * rpc_run_bc_task - Allocate a new RPC task for backchannel use, then run * rpc_execute against it
@@ -1152,7 +1151,7 @@ struct rpc_task *rpc_run_bc_task(struct task =rpc_new_task (&task_setup_data);xprt_init_bc_request (req, task); - task->tk_action = call_bc_transmit; + task->tk_action = call_bc_encode;atomic_inc (&task->tk_count);WARN_ON_ONCE (atomic_read (&task->tk_count) !=2 );rpc_execute (task);
@@ -2064,6 +2063,16 @@ call_transmit_status(struct rpc_task *ta }#if defined(CONFIG_SUNRPC_BACKCHANNEL ) +static void call_bc_transmit (struct rpc_task *task); +static void call_bc_transmit_status (struct rpc_task *task); + +static void +call_bc_encode (struct rpc_task *task) +{ +xprt_request_enqueue_transmit (task); + task->tk_action = call_bc_transmit; +} +/* * 5b. Send the backchannel RPC reply. On error, drop the reply. In * addition, disconnect on connectivity errors.
@@ -2071,26 +2080,23 @@ call_transmit_status(struct rpc_task *tastatic void call_bc_transmit (struct rpc_task *task) { -struct rpc_rqst *req = task->tk_rqstp; - -if (rpc_task_need_encode (task)) -xprt_request_enqueue_transmit (task); -if (!test_bit (RPC_TASK_NEED_XMIT , &task->tk_runstate)) - goto out_wakeup; - -if (!xprt_prepare_transmit (task)) - goto out_retry; - -if (task->tk_status <0 ) { -printk (KERN_NOTICE "RPC: Could not send backchannel reply " -"error: %d\n" , task->tk_status); - goto out_done; + task->tk_action = call_bc_transmit_status; +if (test_bit (RPC_TASK_NEED_XMIT , &task->tk_runstate)) { +if (!xprt_prepare_transmit (task)) +return ; + task->tk_status =0 ; +xprt_transmit (task); } +xprt_end_transmit (task); +} -xprt_transmit (task); +static void +call_bc_transmit_status (struct rpc_task *task) +{ +struct rpc_rqst *req = task->tk_rqstp; -xprt_end_transmit (task);dprint_status (task); +switch (task->tk_status) {case 0 :/* Success */
@@ -2104,8 +2110,14 @@ call_bc_transmit(struct rpc_task *task)case -ENOTCONN :case -EPIPE :break ; +case -ENOBUFS : +rpc_delay (task,HZ >>2 ); +/* fall through */ +case -EBADSLT :case -EAGAIN : - goto out_retry; + task->tk_status =0 ; + task->tk_action = call_bc_transmit; +return ;case -ETIMEDOUT :/* * Problem reaching the server. Disconnect and let the
@@ -2124,18 +2136,11 @@ call_bc_transmit(struct rpc_task *task)* We were unable to reply and will have to drop the * request. The server should reconnect and retransmit. */ -WARN_ON_ONCE (task->tk_status == -EAGAIN );printk (KERN_NOTICE "RPC: Could not send backchannel reply " "error: %d\n" , task->tk_status); break; } -out_wakeup: -rpc_wake_up_queued_task (&req->rq_xprt->pending, task); -out_done: task->tk_action = rpc_exit_task; -return ; -out_retry: - task->tk_status =0 ; }#endif /* CONFIG_SUNRPC_BACKCHANNEL */
Greg Kroah-Hartman
maintainerPATCH 238/238 SUNRPC: Respect RPC call timeouts when retrying transmission
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 7b3fef8e4157ed424bcde039a60a730aa0dfb0eb upstream.
Fix a regression where soft and softconn requests are not timing out as expected.
--- net/sunrpc/clnt.c | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-)
net/sunrpc/clnt.c +24 -18
@@ -77,6 +77,7 @@ static void call_connect_status(struct rstatic __be32 *rpc_encode_header (struct rpc_task *task);static __be32 *rpc_verify_header (struct rpc_task *task);static int rpc_ping (struct rpc_clnt *clnt); +static void rpc_check_timeout (struct rpc_task *task);static void rpc_register_client (struct rpc_clnt *clnt) {
@@ -1941,8 +1942,7 @@ call_connect_status(struct rpc_task *tasbreak ;if (clnt->cl_autobind) {rpc_force_rebind (clnt); - task->tk_action = call_bind; -return ; + goto out_retry; }/* fall through */ case -ECONNRESET :
@@ -1962,16 +1962,19 @@ call_connect_status(struct rpc_task *tas/* fall through */ case -ENOTCONN :case -EAGAIN : -/* Check for timeouts before looping back to call_bind */ case -ETIMEDOUT : - task->tk_action = call_timeout; -return ; + goto out_retry;case 0 : clnt->cl_stats->netreconn++; task->tk_action = call_transmit;return ; }rpc_exit (task, status); +return ; +out_retry: +/* Check for timeouts before looping back to call_bind */ + task->tk_action = call_bind; +rpc_check_timeout (task); }/*
@@ -2048,7 +2051,7 @@ call_transmit_status(struct rpc_task *tatrace_xprt_ping (task->tk_xprt, task->tk_status);rpc_exit (task, task->tk_status); -break ; +return ; }/* fall through */ case -ECONNRESET :
@@ -2060,6 +2063,7 @@ call_transmit_status(struct rpc_task *ta task->tk_status =0 ;break ; } +rpc_check_timeout (task); }#if defined(CONFIG_SUNRPC_BACKCHANNEL )
@@ -2196,7 +2200,7 @@ call_status(struct rpc_task *task)case -EPIPE :case -ENOTCONN :case -EAGAIN : - task->tk_action = call_encode; + task->tk_action = call_timeout;break ;case -EIO :/* shutdown or soft timeout */
@@ -2210,20 +2214,13 @@ call_status(struct rpc_task *task) } } -/* -* 6a. Handle RPC timeout -* We do not release the request slot, so we keep using the -* same XID for all retransmits. -*/ static void -call_timeout (struct rpc_task *task) +rpc_check_timeout (struct rpc_task *task) {struct rpc_clnt *clnt = task->tk_client; -if (xprt_adjust_timeout (task->tk_rqstp) ==0 ) { -dprintk ("RPC: %5u call_timeout (minor)\n" , task->tk_pid); - goto retry; - } +if (xprt_adjust_timeout (task->tk_rqstp) ==0 ) +return ;dprintk ("RPC: %5u call_timeout (major)\n" , task->tk_pid); task->tk_timeouts++;
@@ -2259,10 +2256,19 @@ call_timeout(struct rpc_task *task)* event? RFC2203 requires the server to drop all such requests. */ rpcauth_invalcred (task); +} -retry: +/* +* 6a. Handle RPC timeout +* We do not release the request slot, so we keep using the +* same XID for all retransmits. +*/ +static void +call_timeout (struct rpc_task *task) +{ task->tk_action = call_encode; task->tk_status =0 ; +rpc_check_timeout (task); }/*
stable-rc/linux-5.0.y boot: 55 boots: 1 failed, 54 passed (v5.0.3-239-g6a3b25ca9720)
stable-rc/linux-5.0.y boot: 55 boots: 1 failed, 54 passed (v5.0.3-239-g6a3b25ca9720)
Full Boot Summary: https://kernelci.org/boot/all/job/stable-rc/branch/linux-5.0.y/kernel/v5.0.3-239-g6a3b25ca9720/
Full Build Summary: https://kernelci.org/build/stable-rc/branch/linux-5.0.y/kernel/v5.0.3-239-g6a3b25ca9720/
Tree: stable-rc
Branch: linux-5.0.y
Git Describe: v5.0.3-239-g6a3b25ca9720
Git Commit: 6a3b25ca97204a3891527d88b6691b362fee82c8
Git URL: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Tested: 32 unique boards, 16 SoC families, 10 builds out of 208
Boot Failure Detected:
arm64:
defconfig:
gcc-7:
meson-gxbb-p200: 1 failed lab
---
For more info write to <[email protected]>
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.0.4 release. There are 238 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Mar 24 11:11:13 UTC 2019. Anything received after that time might be too late.
Build results:
total: 159 pass: 159 fail: 0 Qemu test results: total: 345 pass: 345 fail: 0
Guenter
Greg Kroah-Hartman
maintainerQuoted 6 lines · Guenter Roeck
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.0.4 release. There are 238 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 7 lines
Quoted 3 lines
Responses should be made by Sun Mar 24 11:11:13 UTC 2019. Anything received after that time might be too late.
Build results:
total: 159 pass: 159 fail: 0 Qemu test results: total: 345 pass: 345 fail: 0
Wonderful, thanks for testing all 6 of these and letting me know.
greg k-h
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.0.4 release. There are 238 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Mar 24 11:11:13 UTC 2019. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.0.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.0.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 5.0.4-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-5.0.y
git commit: 6a3b25ca97204a3891527d88b6691b362fee82c8
git describe: v5.0.3-239-g6a3b25ca9720
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-5.0-oe/build/v5.0.3-239-g6a3b25ca9720
No regressions (compared to build v5.0.3)
No fixes (compared to build v5.0.3)
Ran 23161 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c
- hi6220-hikey
- i386
- juno-r2
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15
- x86
Test Suites
-----------
* boot
* install-android-platform-tools-r2600
* kselftest
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-timers-tests
* spectre-meltdown-checker-test
* ltp-fs-tests
* ltp-open-posix-tests
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 17 lines · Naresh Kamboju
Quoted 15 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.0.4 release. There are 238 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Mar 24 11:11:13 UTC 2019. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.0.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.0.y
and the diffstat can be found below.
Quoted 7 lines
Quoted 4 lines
thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm,x86_64, and i386.
Great! Thanks for testing 5 of these and letting me know.
greg k-h
Jon Hunter
maintainerQuoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.0.4 release. There are 238 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Mar 24 11:11:13 UTC 2019. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.0.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.0.y
and the diffstat can be found below.thanks,
greg k-h
All tests are passing for Tegra ...
Test results for stable-v5.0:
11 builds: 11 pass, 0 fail
22 boots: 22 pass, 0 fail
28 tests: 28 pass, 0 failLinux version: 5.0.4-rc1-g6a3b25c
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04Cheers
Jon
Signature · 1 line
nvpublic
Greg Kroah-Hartman
maintainerQuoted 18 lines · Jon Hunter
Quoted 16 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.0.4 release. There are 238 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Mar 24 11:11:13 UTC 2019. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.0.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.0.y
and the diffstat can be found below.thanks,
Quoted 8 lines
Quoted 1 line
greg k-h
All tests are passing for Tegra ...
Test results for stable-v5.0:
11 builds: 11 pass, 0 fail 22 boots: 22 pass, 0 fail 28 tests: 28 pass, 0 fail
Thank you for testing all of these and letting me know.
greg k-h