5.13.2-rc1 review
Subsystems (8)
Greg Kroah-Hartman
maintainerPATCH 713/800 iio: magn: rm3100: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit b8f939fd20690623cb24845a563e7bc1e4a21482 ]
Add __aligned(8) to ensure the buffer passed to iio_push_to_buffers_with_timestamp() is suitable for the naturally aligned timestamp that will be inserted.
Here an explicit structure is not used, because this buffer is used in a non-trivial way for data repacking.
--- drivers/iio/magnetometer/rm3100-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/magnetometer/rm3100-core.c +2 -1
@@ -78,7 +78,8 @@ struct rm3100_data {bool use_interrupt;int conversion_time;int scale; -u8 buffer[RM3100_SCAN_BYTES ]; +/* Ensure naturally aligned timestamp */ +u8 buffer[RM3100_SCAN_BYTES ]__aligned(8) ;struct iio_trigger *drdy_trig;/*
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 714/800 iio: light: vcnl4000: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit dce793c0ab00c35039028fdcd5ce123805a01361 ]
Add __aligned(8) to ensure the buffer passed to iio_push_to_buffers_with_timestamp() is suitable for the naturally aligned timestamp that will be inserted.
Here an explicit structure is not used, because the holes would necessitate the addition of an explict memset(), to avoid a kernel data leak, making for a less minimal fix.
Found during an audit of all callers of iio_push_to_buffers_with_timestamp()
--- drivers/iio/light/vcnl4000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/vcnl4000.c +1 -1
@@ -910,7 +910,7 @@ static irqreturn_t vcnl4010_trigger_handler(int irq, void *p)struct iio_dev *indio_dev = pf->indio_dev;struct vcnl4000_data *data =iio_priv (indio_dev);const unsigned long *active_scan_mask = indio_dev->active_scan_mask; -u16 buffer[8 ] = {0 };/* 1x16-bit + ts */ +u16 buffer[8 ]__aligned(8) = {0 };/* 1x16-bit + naturally aligned ts */ bool data_read = false;unsigned long isr;int val =0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 715/800 ASoC: fsl_spdif: Fix error handler with pm_runtime_enable
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit 28108d71ee11a7232e1102effab3361049dcd3b8 ]
There is error message when defer probe happens:
fsl-spdif-dai 2dab0000.spdif: Unbalanced pm_runtime_enable!
Fix the error handler with pm_runtime_enable and add fsl_spdif_remove() for pm_runtime_disable.
--- sound/soc/fsl/fsl_spdif.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
sound/soc/fsl/fsl_spdif.c +17 -3
@@ -1375,16 +1375,29 @@ static int fsl_spdif_probe(struct platform_device *pdev) &spdif_priv->cpu_dai_drv, 1);if (ret) {dev_err (&pdev->dev,"failed to register DAI: %d\n" , ret); -return ret; + goto err_pm_disable; } ret =imx_pcm_dma_init (pdev,IMX_SPDIF_DMABUF_SIZE ); -if (ret && ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"imx_pcm_dma_init failed: %d\n" , ret); +if (ret) { +dev_err_probe (&pdev->dev, ret,"imx_pcm_dma_init failed\n" ); + goto err_pm_disable; + } + +return ret; +err_pm_disable: +pm_runtime_disable (&pdev->dev);return ret; } +static int fsl_spdif_remove (struct platform_device *pdev) +{ +pm_runtime_disable (&pdev->dev); + +return 0 ; +} +#ifdef CONFIG_PM static int fsl_spdif_runtime_suspend (struct device *dev) {
@@ -1487,6 +1500,7 @@ static struct platform_driver fsl_spdif_driver = { .pm = &fsl_spdif_pm, }, .probe = fsl_spdif_probe, + .remove = fsl_spdif_remove, };module_platform_driver (fsl_spdif_driver);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 716/800 staging: gdm724x: check for buffer overflow in gdm_lte_multi_sdu_pkt()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 4a36e160856db8a8ddd6a3d2e5db5a850ab87f82 ]
There needs to be a check to verify that we don't read beyond the end of "buf". This function is called from do_rx(). The "buf" is the USB transfer_buffer and "len" is "urb->actual_length".
--- drivers/staging/gdm724x/gdm_lte.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/staging/gdm724x/gdm_lte.c +9 -1
@@ -677,6 +677,7 @@ static void gdm_lte_multi_sdu_pkt(struct phy_dev *phy_dev, char *buf, int len)struct sdu *sdu =NULL ;u8 endian = phy_dev->get_endian (phy_dev->priv_dev);u8 *data = (u8 *)multi_sdu->data; +int copied;u16 i =0 ;u16 num_packet;u16 hci_len;
@@ -688,6 +689,12 @@ static void gdm_lte_multi_sdu_pkt(struct phy_dev *phy_dev, char *buf, int len) num_packet =gdm_dev16_to_cpu (endian, multi_sdu->num_packet);for (i =0 ; i < num_packet; i++) { + copied = data - multi_sdu->data; +if (len < copied +sizeof (*sdu)) { +pr_err ("rx prevent buffer overflow" ); +return ; + } + sdu = (struct sdu *)data; cmd_evt =gdm_dev16_to_cpu (endian, sdu->cmd_evt);
@@ -698,7 +705,8 @@ static void gdm_lte_multi_sdu_pkt(struct phy_dev *phy_dev, char *buf, int len)pr_err ("rx sdu wrong hci %04x\n" , cmd_evt);return ; } -if (hci_len <12 ) { +if (hci_len <12 || + len < copied +sizeof (*sdu) + (hci_len -12 )) {pr_err ("rx sdu invalid len %d\n" , hci_len);return ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 717/800 staging: gdm724x: check for overflow in gdm_lte_netif_rx()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 7002b526f4ff1f6da34356e67085caafa6be383a ]
This code assumes that "len" is at least 62 bytes, but we need a check to prevent a read overflow.
--- drivers/staging/gdm724x/gdm_lte.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/staging/gdm724x/gdm_lte.c +6 -4
@@ -611,10 +611,12 @@ static void gdm_lte_netif_rx(struct net_device *dev, char *buf,* bytes (99,130,83,99 dec) */ } __packed; -void *addr = buf +sizeof (struct iphdr ) + -sizeof (struct udphdr ) + - offsetof(struct dhcp_packet , chaddr); -ether_addr_copy (nic->dest_mac_addr, addr); +int offset =sizeof (struct iphdr ) + +sizeof (struct udphdr ) + + offsetof(struct dhcp_packet , chaddr); +if (offset +ETH_ALEN > len) +return ; +ether_addr_copy (nic->dest_mac_addr, buf + offset); } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 718/800 staging: rtl8712: fix error handling in r871xu_drv_init
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit d1d3e3cdfda8eb91f0e24be7ec8be1e6e01b3a1c ]
Previous error handling path was unique for all possible errors and there was unnecessary branching. Also, one step for freeing drv_sw was missing. All these problems was fixed by restructuring error handling path.
Also, moved out free_netdev() from r8712_free_drv_sw() for correct error handling.
--- drivers/staging/rtl8712/os_intfs.c | 4 ---- drivers/staging/rtl8712/usb_intf.c | 24 ++++++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-)
drivers/staging/rtl8712/os_intfs.c +0 -4
@@ -328,8 +328,6 @@ int r8712_init_drv_sw(struct _adapter *padapter)void r8712_free_drv_sw (struct _adapter *padapter) { -struct net_device *pnetdev = padapter->pnetdev; -r8712_free_cmd_priv (&padapter->cmdpriv);r8712_free_evt_priv (&padapter->evtpriv);r8712_DeInitSwLeds (padapter);
@@ -339,8 +337,6 @@ void r8712_free_drv_sw(struct _adapter *padapter)_r8712_free_sta_priv (&padapter->stapriv);_r8712_free_recv_priv (&padapter->recvpriv);mp871xdeinit (padapter); -if (pnetdev) -free_netdev (pnetdev); }static void enable_video_mode (struct _adapter *padapter,int cbw40_value)
drivers/staging/rtl8712/usb_intf.c +14 -10
@@ -361,7 +361,7 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,/* step 1. */ pnetdev =r8712_init_netdev ();if (!pnetdev) - goto error; + goto put_dev; padapter =netdev_priv (pnetdev);disable_ht_for_spec_devid (pdid, padapter); pdvobjpriv = &padapter->dvobjpriv;
@@ -381,16 +381,16 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,* initialize the dvobj_priv */ if (!padapter->dvobj_init) { - goto error; + goto put_dev; }else { status = padapter->dvobj_init (padapter);if (status != _SUCCESS) - goto error; + goto free_netdev; }/* step 4. */ status =r8712_init_drv_sw (padapter);if (status) - goto error; + goto dvobj_deinit;/* step 5. read efuse/eeprom data and get mac_addr */ {int i, offset;
@@ -570,17 +570,20 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf, }/* step 6. Load the firmware asynchronously */ if (rtl871x_load_fw (padapter)) - goto error; + goto deinit_drv_sw;spin_lock_init (&padapter->lock_rx_ff0_filter);mutex_init (&padapter->mutex_start);return 0 ; -error: + +deinit_drv_sw: +r8712_free_drv_sw (padapter); +dvobj_deinit: + padapter->dvobj_deinit (padapter); +free_netdev: +free_netdev (pnetdev); +put_dev:usb_put_dev (udev);usb_set_intfdata (pusb_intf,NULL ); -if (padapter && padapter->dvobj_deinit) - padapter->dvobj_deinit (padapter); -if (pnetdev) -free_netdev (pnetdev);return -ENODEV ; }
@@ -612,6 +615,7 @@ static void r871xu_dev_remove(struct usb_interface *pusb_intf)r8712_stop_drv_timers (padapter);r871x_dev_unload (padapter);r8712_free_drv_sw (padapter); +free_netdev (pnetdev);/* decrease the reference count of the usb device structure * when disconnect
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 719/800 staging: rtl8712: fix memory leak in rtl871x_load_fw_cb
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit e02a3b945816a77702a2769a70ef5f9b06e49d54 ]
There is a leak in rtl8712 driver.
The problem was in non-freed adapter data if
firmware load failed.
This leak can be reproduced with this code:
https://syzkaller.appspot.com/text?tag=ReproC&x=16612f02d00000,
Autoload must fail (to not hit memory leak reported by syzkaller)
There are 2 possible ways how rtl871x_load_fw_cb() and r871xu_dev_remove() can be called (in case of fw load error).
1st case:
r871xu_dev_remove() then rtl871x_load_fw_cb()
In this case r871xu_dev_remove() will wait for
completion and then will jump to the end, because
rtl871x_load_fw_cb() set intfdata to NULL:
if (pnetdev) {
struct _adapter *padapter = netdev_priv(pnetdev);
/* never exit with a firmware callback pending */
wait_for_completion(&padapter->rtl8712_fw_ready);
pnetdev = usb_get_intfdata(pusb_intf);
usb_set_intfdata(pusb_intf, NULL);
if (!pnetdev)
goto firmware_load_fail;
... clean up code here ...
}2nd case:
rtl871x_load_fw_cb() then r871xu_dev_remove()
In this case pnetdev (from code snippet above) will be zero (because rtl871x_load_fw_cb() set it to NULL) And clean up code won't be executed again.
So, in all cases we need to free adapted data in rtl871x_load_fw_cb(), because disconnect function cannot take care of it. And there won't be any race conditions, because complete() call happens after setting intfdata to NULL.
In previous patch I moved out free_netdev() from r8712_free_drv_sw() and that's why now it's possible to free adapter data and then call complete.
--- drivers/staging/rtl8712/hal_init.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/staging/rtl8712/hal_init.c +3 -0
@@ -40,7 +40,10 @@ static void rtl871x_load_fw_cb(const struct firmware *firmware, void *context)dev_err (&udev->dev,"r8712u: Firmware request failed\n" );usb_put_dev (udev);usb_set_intfdata (usb_intf,NULL ); +r8712_free_drv_sw (adapter); + adapter->dvobj_deinit (adapter);complete (&adapter->rtl8712_fw_ready); +free_netdev (adapter->pnetdev);return ; } adapter->fw = firmware;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 720/800 coresight: core: Fix use of uninitialized pointer
In reply to Greg Kroah-HartmanFrom: Junhao He <[email protected]>
[ Upstream commit d777a8991847729ec4e2a13fcad58c2b00bb19dc ]
Currently the pointer "sink" might be checked before initialized. Fix this by initializing this pointer.
--- drivers/hwtracing/coresight/coresight-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwtracing/coresight/coresight-core.c +1 -1
@@ -608,7 +608,7 @@ static struct coresight_device * coresight_find_enabled_sink(struct coresight_device *csdev) {int i; -struct coresight_device *sink; +struct coresight_device *sink =NULL ; if ((csdev->type == CORESIGHT_DEV_TYPE_SINK || csdev->type == CORESIGHT_DEV_TYPE_LINKSINK) &&
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 721/800 staging: mt7621-dts: fix pci address for PCI memory range
In reply to Greg Kroah-HartmanFrom: Sergio Paracuellos <[email protected]>
[ Upstream commit 5b4f167ef3555ec4c334a8dc89c1b44bb2c6bff5 ]
Driver code call 'devm_of_pci_get_host_bridge_resources' to get resources and properly fill 'bridge->windows' and 'bridge->dma_ranges'. After parsing the ranges and store as resources, at the end it makes a call to pci function 'pci_add_resource_offset' to set the offset for the memory resource. To calculate offset, resource start address subtracts pci address of the range. MT7621 does not need any offset for the memory resource. Moreover, setting an offset got into 'WARN_ON' calls from pci devices driver code. Until now memory range pci_addr was being '0x00000000' and res->start is '0x60000000' but becase pci controller driver was manually setting resources and adding them using pci function 'pci_add_resource' where a zero is passed as offset, things was properly working. Since PCI_IOBASE is defined now for ralink we don't set nothing manually anymore so we have to properly fix PCI address for this range to make things work and the new pci address must be set to '0x60000000'. Doing in this way the subtract result obtain zero as offset and pci device driver code properly works.
--- drivers/staging/mt7621-dts/mt7621.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/mt7621-dts/mt7621.dtsi +1 -1
@@ -498,7 +498,7 @@ bus-range = <0 255>; ranges = < - 0x02000000 0 0x00000000 0x60000000 0 0x10000000 /* pci memory */ + 0x02000000 0 0x60000000 0x60000000 0 0x10000000 /* pci memory */ 0x01000000 0 0x00000000 0x1e160000 0 0x00010000 /* io space */ >;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 722/800 usb: phy: tegra: Wait for VBUS wakeup status deassertion on suspend
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
[ Upstream commit 6f8d39a8ef55efde414b6e574384acbce70c3119 ]
Some devices need an extra delay after losing VBUS, otherwise VBUS may be detected as active at suspend time, preventing the PHY's suspension by the VBUS detection sensor. This problem was found on Asus Transformer TF700T (Tegra30) tablet device, where the USB PHY wakes up immediately from suspend because VBUS sensor continues to detect VBUS as active after disconnection. We need to poll the PHY's VBUS wakeup status until it's deasserted before suspending PHY in order to fix this minor trouble.
--- drivers/usb/phy/phy-tegra-usb.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/usb/phy/phy-tegra-usb.c +10 -0
@@ -64,6 +64,7 @@#define A_VBUS_VLD_WAKEUP_EN BIT(30)#define USB_PHY_VBUS_WAKEUP_ID 0x408 +#define VBUS_WAKEUP_STS BIT(10)#define VBUS_WAKEUP_WAKEUP_EN BIT(30)#define USB1_LEGACY_CTRL 0x410
@@ -642,6 +643,15 @@ static int utmi_phy_power_off(struct tegra_usb_phy *phy)void __iomem *base = phy->regs;u32 val; +/* +* Give hardware time to settle down after VBUS disconnection, +* otherwise PHY will immediately wake up from suspend. +*/ +if (phy->wakeup_enabled && phy->mode !=USB_DR_MODE_HOST ) +readl_relaxed_poll_timeout (base +USB_PHY_VBUS_WAKEUP_ID , + val, !(val &VBUS_WAKEUP_STS ), +5000 ,100000 ); +utmi_phy_clk_disable (phy);/* PHY won't resume if reset is asserted */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 723/800 usb: phy: tegra: Correct definition of B_SESS_VLD_WAKEUP_EN bit
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
[ Upstream commit 7917e90667bc8dce02daa3c2e6df47f6fc9481f7 ]
The B_SESS_VLD_WAKEUP_EN bit 6 was added by a mistake in a previous commit. This bit corresponds to B_SESS_END_WAKEUP_EN, which we don't use. The B_VBUS_VLD_WAKEUP_EN doesn't exist at all and B_SESS_VLD_WAKEUP_EN needs to be in place of it. We don't utilize B-sensors in the driver, so it never was a problem, nevertheless let's correct the definition of the bits.
--- drivers/usb/phy/phy-tegra-usb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/phy/phy-tegra-usb.c +2 -3
@@ -58,8 +58,7 @@#define USB_WAKEUP_DEBOUNCE_COUNT (x) (((x) & 0x7) << 16)#define USB_PHY_VBUS_SENSORS 0x404 -#define B_SESS_VLD_WAKEUP_EN BIT(6) -#define B_VBUS_VLD_WAKEUP_EN BIT(14) +#define B_SESS_VLD_WAKEUP_EN BIT(14)#define A_SESS_VLD_WAKEUP_EN BIT(22)#define A_VBUS_VLD_WAKEUP_EN BIT(30)
@@ -545,7 +544,7 @@ static int utmi_phy_power_on(struct tegra_usb_phy *phy) val =readl_relaxed (base +USB_PHY_VBUS_SENSORS ); val &= ~(A_VBUS_VLD_WAKEUP_EN |A_SESS_VLD_WAKEUP_EN ); - val &= ~(B_VBUS_VLD_WAKEUP_EN |B_SESS_VLD_WAKEUP_EN ); + val &= ~(B_SESS_VLD_WAKEUP_EN );writel_relaxed (val, base +USB_PHY_VBUS_SENSORS ); val =readl_relaxed (base +UTMIP_BAT_CHRG_CFG0 );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 724/800 serial: 8250: Actually allow UPF_MAGIC_MULTIPLIER baud rates
In reply to Greg Kroah-HartmanFrom: Maciej W. Rozycki <[email protected]>
[ Upstream commit 78bcae8616ac277d6cb7f38e211493948ed73e30 ]
Support for magic baud rate divisors of 32770 and 32769 used with SMSC Super I/O chips for extra baud rates of 230400 and 460800 respectively where base rate is 115200[1] has been added around Linux 2.5.64, which predates our repo history, but the origin could be identified as commit 2a717aad772f ("Merge with Linux 2.5.64.") with the old MIPS/Linux repo also at: <git://git.kernel.org/pub/scm/linux/kernel/git/ralf/linux.git>.
Code that is now in serial8250_do_get_divisor' was added back then to serial8250_get_divisor', but that code would only ever trigger if one of the higher baud rates was actually requested, and that cannot ever happen, because the earlier call to serial8250_get_baud_rate' never returns them. This is because it calls uart_get_baud_rate' with the maximum requested being the base rate, that is clk/16 or 115200 for SMSC chips at their nominal clock rate.
Fix it then and allow UPF_MAGIC_MULTIPLIER baud rates to be selected, by requesting the maximum baud rate of clk/4 rather than clk/16 if the flag has been set. Also correct the minimum baud rate, observing that these ports only support actual (non-magic) divisors of up to 32767 only.
[1] "FDC37M81x, PC98/99 Compliant Enhanced Super I/O Controller with Keyboard/Mouse Wake-Up", Standard Microsystems Corporation, Rev. 03/27/2000, Table 31 - "Baud Rates", p. 77
--- drivers/tty/serial/8250/8250_port.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/tty/serial/8250/8250_port.c +16 -3
@@ -2629,6 +2629,21 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port, struct ktermios *old) {unsigned int tolerance = port->uartclk /100 ; +unsigned int min; +unsigned int max; + +/* +* Handle magic divisors for baud rates above baud_base on SMSC +* Super I/O chips. Enable custom rates of clk/4 and clk/8, but +* disable divisor values beyond 32767, which are unavailable. +*/ +if (port->flags &UPF_MAGIC_MULTIPLIER ) { + min = port->uartclk /16 /UART_DIV_MAX >>1 ; + max = (port->uartclk + tolerance) /4 ; + }else { + min = port->uartclk /16 /UART_DIV_MAX ; + max = (port->uartclk + tolerance) /16 ; + }/* * Ask the core to calculate the divisor for us.
@@ -2636,9 +2651,7 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port,* slower than nominal still match standard baud rates without * causing transmission errors. */ -return uart_get_baud_rate (port, termios, old, - port->uartclk /16 /UART_DIV_MAX , - (port->uartclk + tolerance) /16 ); +return uart_get_baud_rate (port, termios, old, min, max); }/*
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 725/800 iio: light: vcnl4035: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit ec90b52c07c0403a6db60d752484ec08d605ead0 ]
Add __aligned(8) to ensure the buffer passed to iio_push_to_buffers_with_timestamp() is suitable for the naturally aligned timestamp that will be inserted.
Here an explicit structure is not used, because the holes would necessitate the addition of an explict memset(), to avoid a potential kernel data leak, making for a less minimal fix.
--- drivers/iio/light/vcnl4035.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/light/vcnl4035.c +2 -1
@@ -102,7 +102,8 @@ static irqreturn_t vcnl4035_trigger_consumer_handler(int irq, void *p)struct iio_poll_func *pf = p;struct iio_dev *indio_dev = pf->indio_dev;struct vcnl4035_data *data =iio_priv (indio_dev); -u8 buffer[ALIGN (sizeof (u16),sizeof (s64)) +sizeof (s64)]; +/* Ensure naturally aligned timestamp */ +u8 buffer[ALIGN (sizeof (u16),sizeof (s64)) +sizeof (s64)]__aligned(8) ;int ret; ret =regmap_read (data->regmap,VCNL4035_ALS_DATA , (int *)buffer);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 726/800 iio: prox: isl29501: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 92babc9938ebbf4050f2fba774836f7edc16a570 ]
Add __aligned(8) to ensure the buffer passed to iio_push_to_buffers_with_timestamp() is suitable for the naturally aligned timestamp that will be inserted.
Here an explicit structure is not used, because the holes would necessitate the addition of an explict memset(), to avoid a kernel data leak, making for a less minimal fix.
--- drivers/iio/proximity/isl29501.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/proximity/isl29501.c +1 -1
@@ -938,7 +938,7 @@ static irqreturn_t isl29501_trigger_handler(int irq, void *p)struct iio_dev *indio_dev = pf->indio_dev;struct isl29501_private *isl29501 =iio_priv (indio_dev);const unsigned long *active_mask = indio_dev->active_scan_mask; -u32 buffer[4 ] = {};/* 1x16-bit + ts */ +u32 buffer[4 ]__aligned(8) = {};/* 1x16-bit + naturally aligned ts */ if (test_bit (ISL29501_DISTANCE_SCAN_INDEX , active_mask))isl29501_register_read (isl29501,REG_DISTANCE , buffer);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 727/800 ASoC: cs42l42: Correct definition of CS42L42_ADC_PDN_MASK
In reply to Greg Kroah-HartmanFrom: Richard Fitzgerald <[email protected]>
[ Upstream commit fac165f22ac947b55407cd3a60a2a9824f905235 ]
The definition of CS42L42_ADC_PDN_MASK was incorrectly defined as the HP_PDN bit.
--- sound/soc/codecs/cs42l42.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/cs42l42.h +1 -1
@@ -79,7 +79,7 @@#define CS42L42_HP_PDN_SHIFT 3#define CS42L42_HP_PDN_MASK (1 << CS42L42_HP_PDN_SHIFT)#define CS42L42_ADC_PDN_SHIFT 2 -#define CS42L42_ADC_PDN_MASK (1 << CS42L42_HP_PDN_SHIFT) +#define CS42L42_ADC_PDN_MASK (1 << CS42L42_ADC_PDN_SHIFT)#define CS42L42_PDN_ALL_SHIFT 0#define CS42L42_PDN_ALL_MASK (1 << CS42L42_PDN_ALL_SHIFT)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 728/800 of: Fix truncation of memory sizes on 32-bit platforms
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 2892d8a00d23d511a0591ac4b2ff3f050ae1f004 ]
Variable "size" has type "phys_addr_t", which can be either 32-bit or 64-bit on 32-bit systems, while "unsigned long" is always 32-bit on 32-bit systems. Hence the cast in
(unsigned long)size / SZ_1M
may truncate a 64-bit size to 32-bit, as casts have a higher operator precedence than divisions.
Fix this by inverting the order of the cast and division, which should be safe for memory blocks smaller than 4 PiB. Note that the division is actually a shift, as SZ_1M is a power-of-two constant, hence there is no need to use div_u64().
While at it, use "%lu" to format "unsigned long".
--- drivers/of/fdt.c | 8 ++++---- drivers/of/of_reserved_mem.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/of/fdt.c +4 -4
@@ -510,11 +510,11 @@ static int __init __reserved_mem_reserve_reg(unsigned long node,if (size &&early_init_dt_reserve_memory_arch (base, size, nomap) ==0 ) -pr_debug ("Reserved memory: reserved region for node '%s': base %pa, size %ld MiB\n" , - uname, &base, (unsigned long )size /SZ_1M ); +pr_debug ("Reserved memory: reserved region for node '%s': base %pa, size %lu MiB\n" , + uname, &base, (unsigned long )(size /SZ_1M ));else -pr_info ("Reserved memory: failed to reserve memory for node '%s': base %pa, size %ld MiB\n" , - uname, &base, (unsigned long )size /SZ_1M ); +pr_info ("Reserved memory: failed to reserve memory for node '%s': base %pa, size %lu MiB\n" , + uname, &base, (unsigned long )(size /SZ_1M )); len -= t_len;if (first) {
drivers/of/of_reserved_mem.c +4 -4
@@ -134,9 +134,9 @@ static int __init __reserved_mem_alloc_size(unsigned long node, ret =early_init_dt_alloc_reserved_memory_arch (size, align, start, end, nomap, &base);if (ret ==0 ) { -pr_debug ("allocated memory for '%s' node: base %pa, size %ld MiB\n" , +pr_debug ("allocated memory for '%s' node: base %pa, size %lu MiB\n" , uname, &base, - (unsigned long )size /SZ_1M ); + (unsigned long )(size /SZ_1M ));break ; } len -= t_len;
@@ -146,8 +146,8 @@ static int __init __reserved_mem_alloc_size(unsigned long node, ret =early_init_dt_alloc_reserved_memory_arch (size, align,0 ,0 , nomap, &base);if (ret ==0 ) -pr_debug ("allocated memory for '%s' node: base %pa, size %ld MiB\n" , - uname, &base, (unsigned long )size /SZ_1M ); +pr_debug ("allocated memory for '%s' node: base %pa, size %lu MiB\n" , + uname, &base, (unsigned long )(size /SZ_1M )); }if (base ==0 ) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 729/800 mtd: rawnand: marvell: add missing clk_disable_unprepare() on error in marvell_nfc_resume()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit ae94c49527aa9bd3b563349adc4b5617747ca6bd ]
Add clk_disable_unprepare() on error path in marvell_nfc_resume().
--- drivers/mtd/nand/raw/marvell_nand.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mtd/nand/raw/marvell_nand.c +3 -1
@@ -3030,8 +3030,10 @@ static int __maybe_unused marvell_nfc_resume(struct device *dev)return ret; ret =clk_prepare_enable (nfc->reg_clk); -if (ret <0 ) +if (ret <0 ) { +clk_disable_unprepare (nfc->core_clk);return ret; + }/* * Reset nfc->selected_chip so the next command will cause the timing
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 730/800 habanalabs: Fix an error handling path in hl_pci_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 3002f467a0b0a70aec01d9f446da4ac8c6fda10b ]
If an error occurs after a 'pci_enable_pcie_error_reporting()' call, it must be undone by a corresponding 'pci_disable_pcie_error_reporting()' call, as already done in the remove function.
--- drivers/misc/habanalabs/common/habanalabs_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/misc/habanalabs/common/habanalabs_drv.c +1 -0
@@ -464,6 +464,7 @@ static int hl_pci_probe(struct pci_dev *pdev,return 0 ; disable_device: +pci_disable_pcie_error_reporting (pdev);pci_set_drvdata (pdev,NULL );destroy_hdev (hdev);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 731/800 scsi: mpt3sas: Fix error return value in _scsih_expander_add()
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit d6c2ce435ffe23ef7f395ae76ec747414589db46 ]
When an expander does not contain any 'phys', an appropriate error code -1 should be returned, as done elsewhere in this function. However, we currently do not explicitly assign this error code to 'rc'. As a result, 0 was incorrectly returned.
--- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/mpt3sas/mpt3sas_scsih.c +3 -1
@@ -6884,8 +6884,10 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) handle, parent_handle, (u64)sas_expander->sas_address, sas_expander->num_phys); -if (!sas_expander->num_phys) +if (!sas_expander->num_phys) { + rc =-1 ; goto out_fail; + } sas_expander->phy =kcalloc (sas_expander->num_phys,sizeof (struct _sas_phy ),GFP_KERNEL );if (!sas_expander->phy) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 732/800 soundwire: stream: Fix test for DP prepare complete
In reply to Greg Kroah-HartmanFrom: Richard Fitzgerald <[email protected]>
[ Upstream commit 3d3e88e336338834086278236d42039f3cde50e1 ]
In sdw_prep_deprep_slave_ports(), after the wait_for_completion() the DP prepare status register is read. If this indicates that the port is now prepared, the code should continue with the port setup. It is irrelevant whether the wait_for_completion() timed out if the port is now ready.
The previous implementation would always fail if the wait_for_completion() timed out, even if the port was reporting successful prepare.
This patch also fixes a minor bug where the return from sdw_read() was not checked for error - any error code with LSBits clear could be misinterpreted as a successful port prepare.
--- drivers/soundwire/stream.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/soundwire/stream.c +6 -7
@@ -422,7 +422,6 @@ static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus,struct completion *port_ready;struct sdw_dpn_prop *dpn_prop;struct sdw_prepare_ch prep_ch; -unsigned int time_left;bool intr = false;int ret =0 , val;u32 addr;
@@ -479,15 +478,15 @@ static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus,/* Wait for completion on port ready */ port_ready = &s_rt->slave->port_ready[prep_ch.num]; - time_left =wait_for_completion_timeout (port_ready, -msecs_to_jiffies (dpn_prop->ch_prep_timeout)); +wait_for_completion_timeout (port_ready, +msecs_to_jiffies (dpn_prop->ch_prep_timeout)); val =sdw_read (s_rt->slave,SDW_DPN_PREPARESTATUS (p_rt->num)); - val &= p_rt->ch_mask; -if (!time_left || val) { +if ((val <0 ) || (val & p_rt->ch_mask)) { + ret = (val <0 ) ? val : -ETIMEDOUT ;dev_err (&s_rt->slave->dev, -"Chn prep failed for port:%d\n" , prep_ch.num); -return -ETIMEDOUT ; +"Chn prep failed for port %d: %d\n" , prep_ch.num, ret); +return ret; } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 733/800 phy: uniphier-pcie: Fix updating phy parameters
In reply to Greg Kroah-HartmanFrom: Kunihiko Hayashi <[email protected]>
[ Upstream commit 4a90bbb478dbf18ecdec9dcf8eb708e319d24264 ]
The current driver uses a value from register TEST_O as the original value for register TEST_I, though, the value is overwritten by "param", so there is a bug that the original value isn't no longer used.
The value of TEST_O[7:0] should be masked with "mask", replaced with "param", and placed in the bitfield TESTI_DAT_MASK as new TEST_I value.
--- drivers/phy/socionext/phy-uniphier-pcie.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/phy/socionext/phy-uniphier-pcie.c +7 -4
@@ -24,11 +24,13 @@#define PORT_SEL_1 FIELD_PREP(PORT_SEL_MASK, 1)#define PCL_PHY_TEST_I 0x2000 -#define PCL_PHY_TEST_O 0x2004#define TESTI_DAT_MASK GENMASK(13, 6)#define TESTI_ADR_MASK GENMASK(5, 1)#define TESTI_WR_EN BIT(0) +#define PCL_PHY_TEST_O 0x2004 +#define TESTO_DAT_MASK GENMASK(7, 0) +#define PCL_PHY_RESET 0x200c#define PCL_PHY_RESET_N_MNMODE BIT(8)/* =1:manual */ #define PCL_PHY_RESET_N BIT(0)/* =1:deasssert */
@@ -77,11 +79,12 @@ static void uniphier_pciephy_set_param(struct uniphier_pciephy_priv *priv, val =FIELD_PREP (TESTI_DAT_MASK ,1 ); val |=FIELD_PREP (TESTI_ADR_MASK , reg);uniphier_pciephy_testio_write (priv, val); - val =readl (priv->base +PCL_PHY_TEST_O ); + val =readl (priv->base +PCL_PHY_TEST_O ) &TESTO_DAT_MASK ;/* update value */ - val &= ~FIELD_PREP (TESTI_DAT_MASK , mask); - val =FIELD_PREP (TESTI_DAT_MASK , mask & param); + val &= ~mask; + val |= mask & param; + val =FIELD_PREP (TESTI_DAT_MASK , val); val |=FIELD_PREP (TESTI_ADR_MASK , reg);uniphier_pciephy_testio_write (priv, val);uniphier_pciephy_testio_write (priv, val |TESTI_WR_EN );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 734/800 phy: ti: dm816x: Fix the error handling path in dm816x_usb_phy_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit f7eedcb8539ddcbb6fe7791f1b4ccf43f905c72f ]
Add an error handling path in the probe to release some resources, as already done in the remove function.
--- drivers/phy/ti/phy-dm816x-usb.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/phy/ti/phy-dm816x-usb.c +13 -4
@@ -242,19 +242,28 @@ static int dm816x_usb_phy_probe(struct platform_device *pdev)pm_runtime_enable (phy->dev); generic_phy =devm_phy_create (phy->dev,NULL , &ops); -if (IS_ERR (generic_phy)) -return PTR_ERR (generic_phy); +if (IS_ERR (generic_phy)) { + error =PTR_ERR (generic_phy); + goto clk_unprepare; + }phy_set_drvdata (generic_phy, phy); phy_provider =devm_of_phy_provider_register (phy->dev, of_phy_simple_xlate); -if (IS_ERR (phy_provider)) -return PTR_ERR (phy_provider); +if (IS_ERR (phy_provider)) { + error =PTR_ERR (phy_provider); + goto clk_unprepare; + }usb_add_phy_dev (&phy->phy);return 0 ; + +clk_unprepare: +pm_runtime_disable (phy->dev); +clk_unprepare (phy->refclk); +return error; }static int dm816x_usb_phy_remove (struct platform_device *pdev)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 735/800 extcon: sm5502: Drop invalid register write in sm5502_reg_data
In reply to Greg Kroah-HartmanFrom: Stephan Gerhold <[email protected]>
[ Upstream commit d25b224f8e5507879b36a769a6d1324cf163466c ]
When sm5502_init_dev_type() iterates over sm5502_reg_data to initialize the registers it is limited by ARRAY_SIZE(sm5502_reg_data). There is no need to add another empty element to sm5502_reg_data.
Having the additional empty element in sm5502_reg_data will just result in writing 0xff to register 0x00, which does not really make sense.
--- drivers/extcon/extcon-sm5502.c | 1 - 1 file changed, 1 deletion(-)
drivers/extcon/extcon-sm5502.c +0 -1
@@ -88,7 +88,6 @@ static struct reg_data sm5502_reg_data[] = { | SM5502_REG_INTM2_MHL_MASK, .invert = true, }, - { } };/* List of detectable cables */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 736/800 extcon: max8997: Add missing modalias string
In reply to Greg Kroah-HartmanFrom: Marek Szyprowski <[email protected]>
[ Upstream commit dc11fc2991e9efbceef93912b83e333d2835fb19 ]
The platform device driver name is "max8997-muic", so advertise it properly in the modalias string. This fixes automated module loading when this driver is compiled as a module.
--- drivers/extcon/extcon-max8997.c | 1 + 1 file changed, 1 insertion(+)
drivers/extcon/extcon-max8997.c +1 -0
@@ -788,3 +788,4 @@ module_platform_driver(max8997_muic_driver);MODULE_DESCRIPTION ("Maxim MAX8997 Extcon driver" );MODULE_AUTHOR ("Donggeun Kim <[email protected]>" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:max8997-muic" );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 737/800 powerpc/powernv: Fix machine check reporting of async store errors
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 3729e0ec59a20825bd4c8c70996b2df63915e1dd ]
POWER9 and POWER10 asynchronous machine checks due to stores have their cause reported in SRR1 but SRR1[42] is set, which in other cases indicates DSISR cause.
Check for these cases and clear SRR1[42], so the cause matching uses the i-side (SRR1) table.
--- arch/powerpc/kernel/mce_power.c | 48 +++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 8 deletions(-)
arch/powerpc/kernel/mce_power.c +40 -8
@@ -481,12 +481,11 @@ static int mce_find_instr_ea_and_phys(struct pt_regs *regs, uint64_t *addr,return -1 ; } -static int mce_handle_ierror (struct pt_regs *regs, +static int mce_handle_ierror (struct pt_regs *regs,unsigned long srr1,const struct mce_ierror_table table[],struct mce_error_info *mce_err,uint64_t *addr,uint64_t *phys_addr) { -uint64_t srr1 = regs->msr;int handled =0 ;int i;
@@ -695,19 +694,19 @@ static long mce_handle_ue_error(struct pt_regs *regs, }static long mce_handle_error (struct pt_regs *regs, +unsigned long srr1,const struct mce_derror_table dtable[],const struct mce_ierror_table itable[]) {struct mce_error_info mce_err = {0 };uint64_t addr, phys_addr =ULONG_MAX ; -uint64_t srr1 = regs->msr;long handled;if (SRR1_MC_LOADSTORE (srr1)) handled =mce_handle_derror (regs, dtable, &mce_err, &addr, &phys_addr);else - handled =mce_handle_ierror (regs, itable, &mce_err, &addr, + handled =mce_handle_ierror (regs, srr1, itable, &mce_err, &addr, &phys_addr);if (!handled && mce_err.error_type ==MCE_ERROR_TYPE_UE )
@@ -723,16 +722,20 @@ long __machine_check_early_realmode_p7(struct pt_regs *regs)/* P7 DD1 leaves top bits of DSISR undefined */ regs->dsisr &=0x0000ffff ; -return mce_handle_error (regs, mce_p7_derror_table, mce_p7_ierror_table); +return mce_handle_error (regs, regs->msr, + mce_p7_derror_table, mce_p7_ierror_table); }long __machine_check_early_realmode_p8 (struct pt_regs *regs) { -return mce_handle_error (regs, mce_p8_derror_table, mce_p8_ierror_table); +return mce_handle_error (regs, regs->msr, + mce_p8_derror_table, mce_p8_ierror_table); }long __machine_check_early_realmode_p9 (struct pt_regs *regs) { +unsigned long srr1 = regs->msr; +/* * On POWER9 DD2.1 and below, it's possible to get a machine check * caused by a paste instruction where only DSISR bit 25 is set. This
@@ -746,10 +749,39 @@ long __machine_check_early_realmode_p9(struct pt_regs *regs)if (SRR1_MC_LOADSTORE (regs->msr) && regs->dsisr ==0x02000000 )return 1 ; -return mce_handle_error (regs, mce_p9_derror_table, mce_p9_ierror_table); +/* +* Async machine check due to bad real address from store or foreign +* link time out comes with the load/store bit (PPC bit 42) set in +* SRR1, but the cause comes in SRR1 not DSISR. Clear bit 42 so we're +* directed to the ierror table so it will find the cause (which +* describes it correctly as a store error). +*/ +if (SRR1_MC_LOADSTORE (srr1) && + ((srr1 &0x081c0000 ) ==0x08140000 || + (srr1 &0x081c0000 ) ==0x08180000 )) { + srr1 &= ~PPC_BIT (42 ); + } + +return mce_handle_error (regs, srr1, + mce_p9_derror_table, mce_p9_ierror_table); }long __machine_check_early_realmode_p10 (struct pt_regs *regs) { -return mce_handle_error (regs, mce_p10_derror_table, mce_p10_ierror_table); +unsigned long srr1 = regs->msr; + +/* +* Async machine check due to bad real address from store comes with +* the load/store bit (PPC bit 42) set in SRR1, but the cause comes in +* SRR1 not DSISR. Clear bit 42 so we're directed to the ierror table +* so it will find the cause (which describes it correctly as a store +* error). +*/ +if (SRR1_MC_LOADSTORE (srr1) && + (srr1 &0x081c0000 ) ==0x08140000 ) { + srr1 &= ~PPC_BIT (42 ); + } + +return mce_handle_error (regs, srr1, + mce_p10_derror_table, mce_p10_ierror_table); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 738/800 ASoC: atmel-i2s: Set symmetric sample bits
In reply to Greg Kroah-HartmanFrom: Codrin Ciubotariu <[email protected]>
[ Upstream commit 489a830a25e1730aebf7ff53430c170db9a1771b ]
The I2S needs to have the same sample bits for both capture and playback streams.
--- sound/soc/atmel/atmel-i2s.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/atmel/atmel-i2s.c +1 -0
@@ -542,6 +542,7 @@ static struct snd_soc_dai_driver atmel_i2s_dai = { }, .ops = &atmel_i2s_dai_ops, .symmetric_rate = 1, + .symmetric_sample_bits = 1, };static const struct snd_soc_component_driver atmel_i2s_component = {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 739/800 ASoC: atmel-i2s: Fix usage of capture and playback at the same time
In reply to Greg Kroah-HartmanFrom: Codrin Ciubotariu <[email protected]>
[ Upstream commit 3b7961a326f8a7e03f54a19f02fedae8d488b80f ]
For both capture and playback streams to work at the same time, only the needed values from a register need to be updated. Also, clocks should be enabled only when the first stream is started and stopped when there is no running stream.
--- sound/soc/atmel/atmel-i2s.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-)
sound/soc/atmel/atmel-i2s.c +26 -8
@@ -200,6 +200,7 @@ struct atmel_i2s_dev {unsigned int fmt;const struct atmel_i2s_gck_param *gck_param;const struct atmel_i2s_caps *caps; +int clk_use_no; };static irqreturn_t atmel_i2s_interrupt (int irq,void *dev_id)
@@ -321,9 +322,16 @@ static int atmel_i2s_hw_params(struct snd_pcm_substream *substream, {struct atmel_i2s_dev *dev =snd_soc_dai_get_drvdata (dai);bool is_playback = (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ); -unsigned int mr =0 ; +unsigned int mr =0 , mr_mask;int ret; + mr_mask =ATMEL_I2SC_MR_FORMAT_MASK |ATMEL_I2SC_MR_MODE_MASK | +ATMEL_I2SC_MR_DATALENGTH_MASK ; +if (is_playback) + mr_mask |=ATMEL_I2SC_MR_TXMONO ; +else + mr_mask |=ATMEL_I2SC_MR_RXMONO ; +switch (dev->fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {case SND_SOC_DAIFMT_I2S : mr |=ATMEL_I2SC_MR_FORMAT_I2S ;
@@ -402,7 +410,7 @@ static int atmel_i2s_hw_params(struct snd_pcm_substream *substream,return -EINVAL ; } -return regmap_write (dev->regmap,ATMEL_I2SC_MR , mr); +return regmap_update_bits (dev->regmap,ATMEL_I2SC_MR , mr_mask, mr); } static int atmel_i2s_switch_mck_generator(struct atmel_i2s_dev *dev,
@@ -495,18 +503,28 @@ static int atmel_i2s_trigger(struct snd_pcm_substream *substream, int cmd, is_master = (mr &ATMEL_I2SC_MR_MODE_MASK ) ==ATMEL_I2SC_MR_MODE_MASTER ;/* If master starts, enable the audio clock. */ -if (is_master && mck_enabled) - err =atmel_i2s_switch_mck_generator (dev, true); -if (err) -return err; +if (is_master && mck_enabled) { +if (!dev->clk_use_no) { + err =atmel_i2s_switch_mck_generator (dev, true); +if (err) +return err; + } + dev->clk_use_no++; + } err =regmap_write (dev->regmap,ATMEL_I2SC_CR , cr);if (err)return err;/* If master stops, disable the audio clock. */ -if (is_master && !mck_enabled) - err =atmel_i2s_switch_mck_generator (dev, false); +if (is_master && !mck_enabled) { +if (dev->clk_use_no ==1 ) { + err =atmel_i2s_switch_mck_generator (dev, false); +if (err) +return err; + } + dev->clk_use_no--; + }return err; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 740/800 ASoC: fsl_xcvr: disable all interrupts when suspend happens
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit ea837090b388245744988083313f6e9c7c9b9699 ]
There is an unhandled interrupt after suspend, which cause endless interrupt when system resume, so system may hang.
Disable all interrupts in runtime suspend callback to avoid above issue.
--- sound/soc/fsl/fsl_xcvr.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/soc/fsl/fsl_xcvr.c +10 -0
@@ -1233,6 +1233,16 @@ static __maybe_unused int fsl_xcvr_runtime_suspend(struct device *dev)struct fsl_xcvr *xcvr =dev_get_drvdata (dev);int ret; +/* +* Clear interrupts, when streams starts or resumes after +* suspend, interrupts are enabled in prepare(), so no need +* to enable interrupts in resume(). +*/ + ret =regmap_update_bits (xcvr->regmap,FSL_XCVR_EXT_IER0 , +FSL_XCVR_IRQ_EARC_ALL ,0 ); +if (ret <0 ) +dev_err (dev,"Failed to clear IER0: %d\n" , ret); +/* Assert M0+ reset */ ret = regmap_update_bits(xcvr->regmap, FSL_XCVR_EXT_CTRL, FSL_XCVR_EXT_CTRL_CORE_RESET,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 741/800 configfs: fix memleak in configfs_release_bin_file
In reply to Greg Kroah-HartmanFrom: Chung-Chiang Cheng <[email protected]>
[ Upstream commit 3c252b087de08d3cb32468b54a158bd7ad0ae2f7 ]
When reading binary attributes in progress, buffer->bin_buffer is setup in configfs_read_bin_file() but never freed.
--- fs/configfs/file.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/configfs/file.c +5 -5
@@ -480,13 +480,13 @@ static int configfs_release_bin_file(struct inode *inode, struct file *file) buffer->bin_buffer_size); }up_read (&frag->frag_sem); -/* vfree on NULL is safe */ -vfree (buffer->bin_buffer); - buffer->bin_buffer =NULL ; - buffer->bin_buffer_size =0 ; - buffer->needs_read_fill =1 ; } +vfree (buffer->bin_buffer); + buffer->bin_buffer =NULL ; + buffer->bin_buffer_size =0 ; + buffer->needs_read_fill =1 ; +configfs_release (inode, file);return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 742/800 ASoC: Intel: sof_sdw: add SOF_RT715_DAI_ID_FIX for AlderLake
In reply to Greg Kroah-HartmanFrom: Libin Yang <[email protected]>
[ Upstream commit 81cd42e5174ba7918edd3d006406ce21ebaa8507 ]
AlderLake needs the flag SOF_RT715_DAI_ID_FIX if it is using the rt715 DMIC.
--- sound/soc/intel/boards/sof_sdw.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/intel/boards/sof_sdw.c +1 -0
@@ -196,6 +196,7 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { }, .driver_data = (void *)(SOF_RT711_JD_SRC_JD1 | SOF_SDW_TGL_HDMI | + SOF_RT715_DAI_ID_FIX | SOF_SDW_PCH_DMIC), }, {}
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 743/800 ASoC: Intel: sof_sdw: add quirk support for Brya and BT-offload
In reply to Greg Kroah-HartmanFrom: Vamshi Krishna Gopal <[email protected]>
[ Upstream commit 03effde3a2ea1d82c4dd6b634fc6174545d2c34f ]
Brya is another ADL-P product.
AlderLake has support for Bluetooth audio offload capability. Enable the BT-offload quirk for ADL-P Brya and the Intel RVP.
--- sound/soc/intel/boards/sof_sdw.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
sound/soc/intel/boards/sof_sdw.c +15 -1
@@ -197,7 +197,21 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { .driver_data = (void *)(SOF_RT711_JD_SRC_JD1 | SOF_SDW_TGL_HDMI | SOF_RT715_DAI_ID_FIX | - SOF_SDW_PCH_DMIC), + SOF_SDW_PCH_DMIC | + SOF_BT_OFFLOAD_SSP(2) | + SOF_SSP_BT_OFFLOAD_PRESENT), + }, + { + .callback = sof_sdw_quirk_cb, + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Google"), + DMI_MATCH(DMI_PRODUCT_NAME, "Brya"), + }, + .driver_data = (void *)(SOF_SDW_TGL_HDMI | + SOF_SDW_PCH_DMIC | + SOF_SDW_FOUR_SPK | + SOF_BT_OFFLOAD_SSP(2) | + SOF_SSP_BT_OFFLOAD_PRESENT), }, {} };
Signature · 1 line
2.30.2
Re: [PATCH 5.13 743/800] ASoC: Intel: sof_sdw: add quirk support for Brya and BT-offload
Hi
Quoted 8 lines · Greg Kroah-Hartman
From: Vamshi Krishna Gopal <[email protected]>
[ Upstream commit
03effde3a2ea1d82c4dd6b634fc6174545d2c34f]Brya is another ADL-P product.
AlderLake has support for Bluetooth audio offload capability. Enable the BT-offload quirk for ADL-P Brya and the Intel RVP.
[...]
This patch seems to introduce a build failure into v5.13.2-rc1 on x86_64:
CC [M] sound/soc/intel/boards/sof_sdw.o
CC [M] sound/soc/intel/boards/sof_sdw_rt5682.o
CC [M] sound/soc/intel/boards/sof_sdw_rt700.o
CC [M] sound/soc/intel/boards/sof_sdw_rt711.o
CC [M] sound/soc/intel/boards/sof_sdw_rt711_sdca.o
CC [M] sound/soc/intel/boards/sof_sdw_rt715.o
CC [M] sound/soc/intel/boards/sof_sdw_rt715_sdca.o
CC [M] sound/soc/intel/boards/sof_sdw_dmic.o
CC [M] sound/soc/intel/boards/sof_sdw_hdmi.o
LD [M] sound/soc/intel/boards/snd-soc-sof_rt5682.o
LD [M] sound/soc/intel/boards/snd-soc-sst-haswell.o
LD [M] sound/soc/intel/boards/snd-soc-sst-bxt-da7219_max98357a.o
LD [M] sound/soc/intel/boards/snd-soc-sst-bxt-rt298.o
LD [M] sound/soc/intel/boards/snd-soc-sst-sof-pcm512x.o
LD [M] sound/soc/intel/boards/snd-soc-sst-sof-wm8804.o
LD [M] sound/soc/intel/boards/snd-soc-sst-glk-rt5682_max98357a.o
LD [M] sound/soc/intel/boards/snd-soc-sst-broadwell.o
LD [M] sound/soc/intel/boards/snd-soc-sst-bdw-rt5650-mach.o
LD [M] sound/soc/intel/boards/snd-soc-sst-bytcr-rt5640.o
LD [M] sound/soc/intel/boards/snd-soc-sst-bytcr-rt5651.o
LD [M] sound/soc/intel/boards/snd-soc-sst-cht-bsw-rt5672.o
LD [M] sound/soc/intel/boards/snd-soc-sst-cht-bsw-rt5645.o
LD [M] sound/soc/intel/boards/snd-soc-sst-cht-bsw-max98090_ti.o
LD [M] sound/soc/intel/boards/snd-soc-sst-cht-bsw-nau8824.o
LD [M] sound/soc/intel/boards/snd-soc-sst-byt-cht-cx2072x.o
LD [M] sound/soc/intel/boards/snd-soc-sst-byt-cht-da7213.o
LD [M] sound/soc/intel/boards/snd-soc-sst-byt-cht-es8316.o
LD [M] sound/soc/intel/boards/snd-soc-sst-byt-cht-nocodec.o
LD [M] sound/soc/intel/boards/snd-soc-cml_rt1011_rt5682.o
LD [M] sound/soc/intel/boards/snd-soc-kbl_da7219_max98357a.o
LD [M] sound/soc/intel/boards/snd-soc-kbl_da7219_max98927.o
CHK kernel/kheaders_data.tar.xz
LD [M] sound/soc/intel/boards/snd-soc-kbl_rt5663_max98927.o
LD [M] sound/soc/intel/boards/snd-soc-kbl_rt5660.o
LD [M] sound/soc/intel/boards/snd-soc-skl_rt286.o
LD [M] sound/soc/intel/boards/snd-skl_nau88l25_max98357a.o
LD [M] sound/soc/intel/boards/snd-soc-skl_nau88l25_ssm4567.o
LD [M] sound/soc/intel/boards/snd-soc-skl_hda_dsp.o
LD [M] sound/soc/intel/boards/snd-soc-sof_da7219_max98373.o
LD [M] sound/soc/intel/boards/snd-soc-ehl-rt5660.o
LD [M] sound/soc/snd-soc-acpi.o
/build/linux-aptosid-5.13/sound/soc/intel/boards/sof_sdw.c:200:6: error: implicit declaration of function 'SOF_BT_OFFLOAD_SSP' [-Werror=implicit-function-declaration]
200 | SOF_BT_OFFLOAD_SSP(2) |
| ^~~~~~~~~~~~~~~~~~
LD [M] sound/soundcore.o
LD [M] sound/soc/sof/xtensa/snd-sof-xtensa-dsp.o
/build/linux-aptosid-5.13/sound/soc/intel/boards/sof_sdw.c:201:6: error: 'SOF_SSP_BT_OFFLOAD_PRESENT' undeclared here (not in a function)
201 | SOF_SSP_BT_OFFLOAD_PRESENT),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
LD [M] sound/soc/sof/intel/snd-sof-acpi-intel-bdw.o
LD [M] sound/soc/sof/intel/snd-sof-intel-hda.o
LD [M] sound/soc/sof/intel/snd-sof-pci-intel-tng.o
LD [M] sound/soc/sof/intel/snd-sof-pci-intel-apl.o
LD [M] sound/soc/sof/intel/snd-sof-pci-intel-cnl.o
LD [M] sound/soc/sof/intel/snd-sof-pci-intel-icl.o
LD [M] sound/soc/sof/intel/snd-sof-pci-intel-tgl.occ1: some warnings being treated as errors
make[5]: *** [/build/linux-aptosid-5.13/scripts/Makefile.build:273: sound/soc/intel/boards/sof_sdw.o] Error 1
Quoted 17 lines
sound/soc/intel/boards/sof_sdw.c +8
-1@@ -197,7 +197,21 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { .driver_data = (void *)(SOF_RT711_JD_SRC_JD1 | SOF_SDW_TGL_HDMI | SOF_RT715_DAI_ID_FIX | - SOF_SDW_PCH_DMIC), + SOF_SDW_PCH_DMIC | + SOF_BT_OFFLOAD_SSP(2) | + SOF_SSP_BT_OFFLOAD_PRESENT), + }, + { + .callback = sof_sdw_quirk_cb, + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Google"),
sound/soc/intel/boards/sof_sdw.c static const struct dmi_system_id sof_sdw_quirk_table[] = { · line 217
Quoted 10 lines
sound/soc/intel/boards/sof_sdw.c +7
-0+ DMI_MATCH(DMI_PRODUCT_NAME, "Brya"), + }, + .driver_data = (void *)(SOF_SDW_TGL_HDMI | +SOF_SDW_PCH_DMIC | +SOF_SDW_FOUR_SPK | +SOF_BT_OFFLOAD_SSP (2 ) | + SOF_SSP_BT_OFFLOAD_PRESENT), }, {} };
Regards
Stefan Lippers-Hollmann
Greg Kroah-Hartman
maintainerRe: [PATCH 5.13 743/800] ASoC: Intel: sof_sdw: add quirk support for Brya and BT-offload
Quoted 93 lines · Stefan Lippers-Hollmann
Hi
Quoted 8 lines · Greg Kroah-Hartman
From: Vamshi Krishna Gopal <[email protected]>
[ Upstream commit
03effde3a2ea1d82c4dd6b634fc6174545d2c34f]Brya is another ADL-P product.
AlderLake has support for Bluetooth audio offload capability. Enable the BT-offload quirk for ADL-P Brya and the Intel RVP.
[...]
This patch seems to introduce a build failure into v5.13.2-rc1 on
x86_64:CC [M] sound/soc/intel/boards/sof_sdw.o CC [M] sound/soc/intel/boards/sof_sdw_rt5682.o CC [M] sound/soc/intel/boards/sof_sdw_rt700.o CC [M] sound/soc/intel/boards/sof_sdw_rt711.o CC [M] sound/soc/intel/boards/sof_sdw_rt711_sdca.o CC [M] sound/soc/intel/boards/sof_sdw_rt715.o CC [M] sound/soc/intel/boards/sof_sdw_rt715_sdca.o CC [M] sound/soc/intel/boards/sof_sdw_dmic.o CC [M] sound/soc/intel/boards/sof_sdw_hdmi.o LD [M] sound/soc/intel/boards/snd-soc-sof_rt5682.o LD [M] sound/soc/intel/boards/snd-soc-sst-haswell.o LD [M] sound/soc/intel/boards/snd-soc-sst-bxt-da7219_max98357a.o LD [M] sound/soc/intel/boards/snd-soc-sst-bxt-rt298.o LD [M] sound/soc/intel/boards/snd-soc-sst-sof-pcm512x.o LD [M] sound/soc/intel/boards/snd-soc-sst-sof-wm8804.o LD [M] sound/soc/intel/boards/snd-soc-sst-glk-rt5682_max98357a.o LD [M] sound/soc/intel/boards/snd-soc-sst-broadwell.o LD [M] sound/soc/intel/boards/snd-soc-sst-bdw-rt5650-mach.o LD [M] sound/soc/intel/boards/snd-soc-sst-bytcr-rt5640.o LD [M] sound/soc/intel/boards/snd-soc-sst-bytcr-rt5651.o LD [M] sound/soc/intel/boards/snd-soc-sst-cht-bsw-rt5672.o LD [M] sound/soc/intel/boards/snd-soc-sst-cht-bsw-rt5645.o LD [M] sound/soc/intel/boards/snd-soc-sst-cht-bsw-max98090_ti.o LD [M] sound/soc/intel/boards/snd-soc-sst-cht-bsw-nau8824.o LD [M] sound/soc/intel/boards/snd-soc-sst-byt-cht-cx2072x.o LD [M] sound/soc/intel/boards/snd-soc-sst-byt-cht-da7213.o LD [M] sound/soc/intel/boards/snd-soc-sst-byt-cht-es8316.o LD [M] sound/soc/intel/boards/snd-soc-sst-byt-cht-nocodec.o LD [M] sound/soc/intel/boards/snd-soc-cml_rt1011_rt5682.o LD [M] sound/soc/intel/boards/snd-soc-kbl_da7219_max98357a.o LD [M] sound/soc/intel/boards/snd-soc-kbl_da7219_max98927.o CHK kernel/kheaders_data.tar.xz LD [M] sound/soc/intel/boards/snd-soc-kbl_rt5663_max98927.o LD [M] sound/soc/intel/boards/snd-soc-kbl_rt5660.o LD [M] sound/soc/intel/boards/snd-soc-skl_rt286.o LD [M] sound/soc/intel/boards/snd-skl_nau88l25_max98357a.o LD [M] sound/soc/intel/boards/snd-soc-skl_nau88l25_ssm4567.o LD [M] sound/soc/intel/boards/snd-soc-skl_hda_dsp.o LD [M] sound/soc/intel/boards/snd-soc-sof_da7219_max98373.o LD [M] sound/soc/intel/boards/snd-soc-ehl-rt5660.o LD [M] sound/soc/snd-soc-acpi.o /build/linux-aptosid-5.13/sound/soc/intel/boards/sof_sdw.c:200:6: error: implicit declaration of function 'SOF_BT_OFFLOAD_SSP' [-Werror=implicit-function-declaration] 200 | SOF_BT_OFFLOAD_SSP(2) | | ^~~~~~~~~~~~~~~~~~ LD [M] sound/soundcore.o LD [M] sound/soc/sof/xtensa/snd-sof-xtensa-dsp.o /build/linux-aptosid-5.13/sound/soc/intel/boards/sof_sdw.c:201:6: error: 'SOF_SSP_BT_OFFLOAD_PRESENT' undeclared here (not in a function) 201 | SOF_SSP_BT_OFFLOAD_PRESENT), | ^~~~~~~~~~~~~~~~~~~~~~~~~~ LD [M] sound/soc/sof/intel/snd-sof-acpi-intel-bdw.o LD [M] sound/soc/sof/intel/snd-sof-intel-hda.o LD [M] sound/soc/sof/intel/snd-sof-pci-intel-tng.o LD [M] sound/soc/sof/intel/snd-sof-pci-intel-apl.o LD [M] sound/soc/sof/intel/snd-sof-pci-intel-cnl.o LD [M] sound/soc/sof/intel/snd-sof-pci-intel-icl.o LD [M] sound/soc/sof/intel/snd-sof-pci-intel-tgl.occ1: some warnings being treated as errors
make[5]: *** [/build/linux-aptosid-5.13/scripts/Makefile.build:273:sound/soc/intel/boards/sof_sdw.o] Error 1Quoted 19 lines
sound/soc/intel/boards/sof_sdw.c +10
-1@@ -197,7 +197,21 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { .driver_data = (void *)(SOF_RT711_JD_SRC_JD1 | SOF_SDW_TGL_HDMI | SOF_RT715_DAI_ID_FIX | - SOF_SDW_PCH_DMIC), + SOF_SDW_PCH_DMIC | + SOF_BT_OFFLOAD_SSP(2) | + SOF_SSP_BT_OFFLOAD_PRESENT), + }, + { + .callback = sof_sdw_quirk_cb, + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Google" ), + DMI_MATCH(DMI_PRODUCT_NAME, "Brya"), + },
Quoted 9 lines
sound/soc/intel/boards/sof_sdw.c static const struct dmi_system_id sof_sdw_quirk_table[] = { · line 217
Quoted 8 lines
sound/soc/intel/boards/sof_sdw.c +5
-0+ .driver_data = (void *)(SOF_SDW_TGL_HDMI | + SOF_SDW_PCH_DMIC | + SOF_SDW_FOUR_SPK | + SOF_BT_OFFLOAD_SSP(2) | + SOF_SSP_BT_OFFLOAD_PRESENT), }, {} };
Already dropped, thanks!
greg k-h
Greg Kroah-Hartman
maintainerPATCH 744/800 ASoC: Intel: sof_sdw: use mach data for ADL RVP DMIC count
In reply to Greg Kroah-HartmanFrom: Kai Vehmanen <[email protected]>
[ Upstream commit 505351329d26e684588a6919c0407b8a0f5c3813 ]
On the reference boards, number of PCH dmics may vary and the number should be taken from driver machine data. Remove the SOF_SDW_PCH_DMIC quirk to make DMIC number configurable.
--- sound/soc/intel/boards/sof_sdw.c | 1 - 1 file changed, 1 deletion(-)
sound/soc/intel/boards/sof_sdw.c +0 -1
@@ -197,7 +197,6 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { .driver_data = (void *)(SOF_RT711_JD_SRC_JD1 |SOF_SDW_TGL_HDMI |SOF_RT715_DAI_ID_FIX | -SOF_SDW_PCH_DMIC |SOF_BT_OFFLOAD_SSP (2 ) | SOF_SSP_BT_OFFLOAD_PRESENT), },
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 745/800 ASoC: fsl_spdif: Fix unexpected interrupt after suspend
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit a7a0a2feb957e446b2bcf732f245ba04fc8b6314 ]
When system enter suspend, the machine driver suspend callback function will be called, then the cpu driver trigger callback (SNDRV_PCM_TRIGGER_SUSPEND) be called, it would disable the interrupt.
But the machine driver suspend and cpu dai driver suspend order maybe changed, the cpu dai driver's suspend callback is called before machine driver's suppend callback, then the interrupt is not cleared successfully in trigger callback.
So need to clear interrupts in cpu dai driver's suspend callback to avoid such issue.
--- sound/soc/fsl/fsl_spdif.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/fsl/fsl_spdif.c +3 -0
@@ -1404,6 +1404,9 @@ static int fsl_spdif_runtime_suspend(struct device *dev)struct fsl_spdif_priv *spdif_priv =dev_get_drvdata (dev);int i; +/* Disable all the interrupts */ +regmap_update_bits (spdif_priv->regmap,REG_SPDIF_SIE ,0xffffff ,0 ); +regmap_read (spdif_priv->regmap,REG_SPDIF_SRPC , &spdif_priv->regcache_srpc);regcache_cache_only (spdif_priv->regmap, true);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 746/800 leds: as3645a: Fix error return code in as3645a_parse_node()
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit 96a30960a2c5246c8ffebe8a3c9031f9df094d97 ]
Return error code -ENODEV rather than '0' when the indicator node can not be found.
--- drivers/leds/leds-as3645a.c | 1 + 1 file changed, 1 insertion(+)
drivers/leds/leds-as3645a.c +1 -0
@@ -545,6 +545,7 @@ static int as3645a_parse_node(struct as3645a *flash,if (!flash->indicator_node) {dev_warn (&flash->client->dev,"can't find indicator node\n" ); + rval = -ENODEV ; goto out_err; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 747/800 leds: ktd2692: Fix an error handling path
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit ee78b9360e14c276f5ceaa4a0d06f790f04ccdad ]
In 'ktd2692_parse_dt()', if an error occurs after a successful 'regulator_enable()' call, we should call 'regulator_enable()'.
This is the same in 'ktd2692_probe()', if an error occurs after a successful 'ktd2692_parse_dt()' call.
Instead of adding 'regulator_enable()' in several places, implement a resource managed solution and simplify the remove function accordingly.
--- drivers/leds/leds-ktd2692.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-)
drivers/leds/leds-ktd2692.c +18 -9
@@ -256,6 +256,17 @@ static void ktd2692_setup(struct ktd2692_context *led) | KTD2692_REG_FLASH_CURRENT_BASE); } +static void regulator_disable_action (void *_data) +{ +struct device *dev = _data; +struct ktd2692_context *led =dev_get_drvdata (dev); +int ret; + + ret =regulator_disable (led->regulator); +if (ret) +dev_err (dev,"Failed to disable supply: %d\n" , ret); +} +static int ktd2692_parse_dt (struct ktd2692_context *led,struct device *dev,struct ktd2692_led_config_data *cfg) {
@@ -286,8 +297,14 @@ static int ktd2692_parse_dt(struct ktd2692_context *led, struct device *dev,if (led->regulator) { ret =regulator_enable (led->regulator); -if (ret) +if (ret) {dev_err (dev,"Failed to enable supply: %d\n" , ret); + }else { + ret =devm_add_action_or_reset (dev, + regulator_disable_action, dev); +if (ret) +return ret; + } } child_node =of_get_next_available_child (np,NULL );
@@ -377,17 +394,9 @@ static int ktd2692_probe(struct platform_device *pdev)static int ktd2692_remove (struct platform_device *pdev) {struct ktd2692_context *led =platform_get_drvdata (pdev); -int ret;led_classdev_flash_unregister (&led->fled_cdev); -if (led->regulator) { - ret =regulator_disable (led->regulator); -if (ret) -dev_err (&pdev->dev, -"Failed to disable supply: %d\n" , ret); - } -mutex_destroy (&led->lock);return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 748/800 selftests/ftrace: fix event-no-pid on 1-core machine
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 07b60713b57a8f952d029a2b6849d003d9c16108 ]
When running event-no-pid test on small machines (e.g. cloud 1-core instance), other events might not happen:
+ cat trace
+ cnt=0
+ [ 0 -eq 0 ]
+ fail No other events were recorded
[15] event tracing - restricts events based on pid notrace filtering [FAIL]
Schedule a simple sleep task to be sure that some other process events get recorded.
--- .../testing/selftests/ftrace/test.d/event/event-no-pid.tc | 7 +++++++ 1 file changed, 7 insertions(+)
tools/testing/selftests/ftrace/test.d/event/event-no-pid.tc +7 -0
@@ -57,6 +57,10 @@ enable_events() { echo 1 > tracing_on } +other_task() { + sleep .001 || usleep 1 || sleep 1 +} + echo 0 > options/event-fork do_reset
@@ -94,6 +98,9 @@ child=$! echo "child = $child" wait $child +# Be sure some other events will happen for small systems (e.g. 1 core) +other_task + echo 0 > tracing_on cnt=`count_pid $mypid`
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 749/800 selftests/sgx: remove checks for file execute permissions
In reply to Greg Kroah-HartmanFrom: Dave Hansen <[email protected]>
[ Upstream commit 4896df9d53ae5521f3ce83751e828ad70bc65c80 ]
The SGX selftests can fail for a bunch of non-obvious reasons like 'noexec' permissions on /dev (which is the default *EVERYWHERE* it seems).
A new test mistakenly also looked for +x permission on the /dev/sgx_enclave. File execute permissions really only apply to the ability of execve() to work on a file, *NOT* on the ability for an application to map the file with PROT_EXEC. SGX needs to mmap(PROT_EXEC), but doesn't need to execve() the device file.
Remove the check.
--- tools/testing/selftests/sgx/load.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
tools/testing/selftests/sgx/load.c +3 -13
@@ -150,16 +150,6 @@ bool encl_load(const char *path, struct encl *encl) goto err; } -/* -* This just checks if the /dev file has these permission -* bits set. It does not check that the current user is -* the owner or in the owning group. -*/ -if (!(sb.st_mode & (S_IXUSR |S_IXGRP |S_IXOTH ))) { -fprintf (stderr,"no execute permissions on device file %s\n" , device_path); - goto err; - } - ptr =mmap (NULL ,PAGE_SIZE ,PROT_READ ,MAP_SHARED , fd,0 );if (ptr == (void *)-1 ) {perror ("mmap for read" );
@@ -169,13 +159,13 @@ bool encl_load(const char *path, struct encl *encl)#define ERR_MSG \ "mmap() succeeded for PROT_READ, but failed for PROT_EXEC.\n" \ -" Check that current user has execute permissions on %s and \n" \ -" that /dev does not have noexec set: mount | grep \"/dev .*noexec\"\n" \ +" Check that /dev does not have noexec set:\n" \ +" \tmount | grep \"/dev .*noexec\"\n" \ " If so, remount it executable: mount -o remount,exec /dev\n\n" ptr =mmap (NULL ,PAGE_SIZE ,PROT_EXEC ,MAP_SHARED , fd,0 );if (ptr == (void *)-1 ) { -fprintf (stderr,ERR_MSG , device_path); +fprintf (stderr,ERR_MSG ); goto err; }munmap (ptr,PAGE_SIZE );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 750/800 staging: rtl8723bs: Fix an error handling path
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit eb64c6f60ed5406da496cf772fee4b29674bcbb1 ]
'ret' is known to be 0 at this point. It must be set to -ENOMEM if a memory allocation occurs.
--- drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +3 -1
@@ -420,8 +420,10 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, wep_key_len = wep_key_len <=5 ?5 :13 ; wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial); pwep =kzalloc (wep_total_len,GFP_KERNEL ); -if (!pwep) +if (!pwep) { + ret = -ENOMEM ; goto exit; + } pwep->KeyLength = wep_key_len; pwep->Length = wep_total_len;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 751/800 serial: 8250: 8250_omap: Fix possible interrupt storm on K3 SoCs
In reply to Greg Kroah-HartmanFrom: Vignesh Raghavendra <[email protected]>
[ Upstream commit b67e830d38fa9335d927fe67e812e3ed81b4689c ]
On K3 family of SoCs (which includes AM654 SoC), it is observed that RX TIMEOUT is signalled after RX FIFO has been drained, in which case a dummy read of RX FIFO is required to clear RX TIMEOUT condition. Otherwise, this would lead to an interrupt storm.
Fix this by introducing UART_RX_TIMEOUT_QUIRK flag and doing a dummy read in IRQ handler when RX TIMEOUT is reported with no data in RX FIFO.
--- drivers/tty/serial/8250/8250_omap.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250_omap.c +19 -1
@@ -43,6 +43,7 @@#define UART_ERRATA_CLOCK_DISABLE (1 << 3)#define UART_HAS_EFR2 BIT(4)#define UART_HAS_RHR_IT_DIS BIT(5) +#define UART_RX_TIMEOUT_QUIRK BIT(6)#define OMAP_UART_FCR_RX_TRIG 6#define OMAP_UART_FCR_TX_TRIG 4
@@ -104,6 +105,9 @@#define UART_OMAP_EFR2 0x23#define UART_OMAP_EFR2_TIMEOUT_BEHAVE BIT(6) +/* RX FIFO occupancy indicator */ +#define UART_OMAP_RX_LVL 0x64 +struct omap8250_priv {int line;u8 habit;
@@ -611,6 +615,7 @@ static int omap_8250_dma_handle_irq(struct uart_port *port);static irqreturn_t omap8250_irq (int irq,void *dev_id) {struct uart_port *port = dev_id; +struct omap8250_priv *priv = port->private_data;struct uart_8250_port *up =up_to_u8250p (port);unsigned int iir;int ret;
@@ -625,6 +630,18 @@ static irqreturn_t omap8250_irq(int irq, void *dev_id)serial8250_rpm_get (up); iir =serial_port_in (port,UART_IIR ); ret =serial8250_handle_irq (port, iir); + +/* +* On K3 SoCs, it is observed that RX TIMEOUT is signalled after +* FIFO has been drained, in which case a dummy read of RX FIFO +* is required to clear RX TIMEOUT condition. +*/ +if (priv->habit &UART_RX_TIMEOUT_QUIRK && + (iir &UART_IIR_RX_TIMEOUT ) ==UART_IIR_RX_TIMEOUT && +serial_port_in (port,UART_OMAP_RX_LVL ) ==0 ) { +serial_port_in (port,UART_RX ); + } +serial8250_rpm_put (up);return IRQ_RETVAL (ret);
@@ -1218,7 +1235,8 @@ static struct omap8250_dma_params am33xx_dma = {static struct omap8250_platdata am654_platdata = { .dma_params = &am654_dma, - .habit =UART_HAS_EFR2 |UART_HAS_RHR_IT_DIS , + .habit =UART_HAS_EFR2 |UART_HAS_RHR_IT_DIS | +UART_RX_TIMEOUT_QUIRK , };static struct omap8250_platdata am33xx_platdata = {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 752/800 powerpc: Offline CPU in stop_this_cpu()
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit bab26238bbd44d5a4687c0a64fd2c7f2755ea937 ]
printk_safe_flush_on_panic() has special lock breaking code for the case where we panic()ed with the console lock held. It relies on panic IPI causing other CPUs to mark themselves offline.
Do as most other architectures do.
This effectively reverts commit de6e5d38417e ("powerpc: smp_send_stop do not offline stopped CPUs"), unfortunately it may result in some false positive warnings, but the alternative is more situations where we can crash without getting messages out.
--- arch/powerpc/kernel/smp.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/powerpc/kernel/smp.c +11 -0
@@ -619,6 +619,8 @@ static void nmi_stop_this_cpu(struct pt_regs *regs)/* * IRQs are already hard disabled by the smp_handle_nmi_ipi. */ +set_cpu_online (smp_processor_id (), false); +spin_begin ();while (1 )spin_cpu_relax ();
@@ -634,6 +636,15 @@ void smp_send_stop(void)static void stop_this_cpu (void *dummy) {hard_irq_disable (); + +/* +* Offlining CPUs in stop_this_cpu can result in scheduler warnings, +* (see commit de6e5d38417e), but printk_safe_flush_on_panic() wants +* to know other CPUs are offline before it breaks locks to flush +* printk buffers, in case we panic()ed while holding the lock. +*/ +set_cpu_online (smp_processor_id (), false); +spin_begin ();while (1 )spin_cpu_relax ();
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 753/800 powerpc/papr_scm: Properly handle UUID types and API
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 0e8554b5d7801b0aebc6c348a0a9f7706aa17b3b ]
Parse to and export from UUID own type, before dereferencing. This also fixes wrong comment (Little Endian UUID is something else) and should eliminate the direct strict types assignments.
--- arch/powerpc/platforms/pseries/papr_scm.c | 27 +++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-)
arch/powerpc/platforms/pseries/papr_scm.c +18 -9
@@ -18,6 +18,7 @@#include <asm/plpar_wrappers.h> #include <asm/papr_pdsm.h> #include <asm/mce.h> +#include <asm/unaligned.h> #define BIND_ANY_ADDR (~0ul)
@@ -1094,8 +1095,9 @@ static int papr_scm_probe(struct platform_device *pdev)u32 drc_index, metadata_size;u64 blocks, block_size;struct papr_scm_priv *p; +u8 uuid_raw[UUID_SIZE ];const char *uuid_str; -u64 uuid[2 ]; +uuid_t uuid;int rc;/* check we have all the required DT properties */
@@ -1138,16 +1140,23 @@ static int papr_scm_probe(struct platform_device *pdev) p->hcall_flush_required =of_property_read_bool (dn,"ibm,hcall-flush-required" );/* We just need to ensure that set cookies are unique across */ -uuid_parse (uuid_str, (uuid_t *) uuid); +uuid_parse (uuid_str, &uuid); +/* -* cookie1 and cookie2 are not really little endian -* we store a little endian representation of the -* uuid str so that we can compare this with the label -* area cookie irrespective of the endian config with which -* the kernel is built. +* The cookie1 and cookie2 are not really little endian. +* We store a raw buffer representation of the +* uuid string so that we can compare this with the label +* area cookie irrespective of the endian configuration +* with which the kernel is built. +* +* Historically we stored the cookie in the below format. +* for a uuid string 72511b67-0b3b-42fd-8d1d-5be3cae8bcaa +* cookie1 was 0xfd423b0b671b5172 +* cookie2 was 0xaabce8cae35b1d8d */ - p->nd_set.cookie1 =cpu_to_le64 (uuid[0 ]); - p->nd_set.cookie2 =cpu_to_le64 (uuid[1 ]); +export_uuid (uuid_raw, &uuid); + p->nd_set.cookie1 =get_unaligned_le64 (&uuid_raw[0 ]); + p->nd_set.cookie2 =get_unaligned_le64 (&uuid_raw[8 ]);/* might be zero */ p->metadata_size = metadata_size;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 754/800 powerpc/64s: Fix copy-paste data exposure into newly created tasks
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit f35d2f249ef05b9671e7898f09ad89aa78f99122 ]
copy-paste contains implicit "copy buffer" state that can contain arbitrary user data (if the user process executes a copy instruction). This could be snooped by another process if a context switch hits while the state is live. So cp_abort is executed on context switch to clear out possible sensitive data and prevent the leak.
cp_abort is done after the low level _switch(), which means it is never reached by newly created tasks, so they could snoop on this buffer between their first and second context switch.
Fix this by doing the cp_abort before calling _switch. Add some comments which should make the issue harder to miss.
--- arch/powerpc/kernel/process.c | 48 +++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 16 deletions(-)
arch/powerpc/kernel/process.c +32 -16
@@ -1213,6 +1213,19 @@ struct task_struct *__switch_to(struct task_struct *prev,__flush_tlb_pending (batch); batch->active = 0; } + +/* +* On POWER9 the copy-paste buffer can only paste into +* foreign real addresses, so unprivileged processes can not +* see the data or use it in any way unless they have +* foreign real mappings. If the new process has the foreign +* real address mappings, we must issue a cp_abort to clear +* any state and prevent snooping, corruption or a covert +* channel. ISA v3.1 supports paste into local memory. +*/ +if (new->mm && (cpu_has_feature (CPU_FTR_ARCH_31 ) || +atomic_read (&new->mm->context.vas_windows))) + asm volatile(PPC_CP_ABORT);#endif /* CONFIG_PPC_BOOK3S_64 */ #ifdef CONFIG_PPC_ADV_DEBUG_REGS
@@ -1261,30 +1274,33 @@ struct task_struct *__switch_to(struct task_struct *prev,#endif last =_switch (old_thread, new_thread); +/* +* Nothing after _switch will be run for newly created tasks, +* because they switch directly to ret_from_fork/ret_from_kernel_thread +* etc. Code added here should have a comment explaining why that is +* okay. +*/ +#ifdef CONFIG_PPC_BOOK3S_64 +/* +* This applies to a process that was context switched while inside +* arch_enter_lazy_mmu_mode(), to re-activate the batch that was +* deactivated above, before _switch(). This will never be the case +* for new tasks. +*/ if (current_thread_info ()->local_flags & _TLF_LAZY_MMU) {current_thread_info ()->local_flags &= ~_TLF_LAZY_MMU; batch =this_cpu_ptr (&ppc64_tlb_batch); batch->active =1 ; } -if (current->thread.regs) { +/* +* Math facilities are masked out of the child MSR in copy_thread. +* A new task does not need to restore_math because it will +* demand fault them. +*/ +if (current->thread.regs)restore_math (current->thread.regs); - -/* -* On POWER9 the copy-paste buffer can only paste into -* foreign real addresses, so unprivileged processes can not -* see the data or use it in any way unless they have -* foreign real mappings. If the new process has the foreign -* real address mappings, we must issue a cp_abort to clear -* any state and prevent snooping, corruption or a covert -* channel. ISA v3.1 supports paste into local memory. -*/ -if (current->mm && - (cpu_has_feature (CPU_FTR_ARCH_31 ) || -atomic_read (¤t->mm->context.vas_windows))) - asm volatile(PPC_CP_ABORT); - }#endif /* CONFIG_PPC_BOOK3S_64 */ return last;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 755/800 powerpc/papr_scm: Make perf_stats invisible if perf-stats unavailable
In reply to Greg Kroah-HartmanFrom: Vaibhav Jain <[email protected]>
[ Upstream commit ed78f56e1271f108e8af61baeba383dcd77adbec ]
In case performance stats for an nvdimm are not available, reading the 'perf_stats' sysfs file returns an -ENOENT error. A better approach is to make the 'perf_stats' file entirely invisible to indicate that performance stats for an nvdimm are unavailable.
So this patch updates 'papr_nd_attribute_group' to add a 'is_visible' callback implemented as newly introduced 'papr_nd_attribute_visible()' that returns an appropriate mode in case performance stats aren't supported in a given nvdimm.
Also the initialization of 'papr_scm_priv.stat_buffer_len' is moved from papr_scm_nvdimm_init() to papr_scm_probe() so that it value is available when 'papr_nd_attribute_visible()' is called during nvdimm initialization.
Even though 'perf_stats' attribute is available since v5.9, there are no known user-space tools/scripts that are dependent on presence of its sysfs file. Hence I dont expect any user-space breakage with this patch.
--- Documentation/ABI/testing/sysfs-bus-papr-pmem | 8 +++-- arch/powerpc/platforms/pseries/papr_scm.c | 35 +++++++++++++------ 2 files changed, 29 insertions(+), 14 deletions(-)
Documentation/ABI/testing/sysfs-bus-papr-pmem +5 -3
@@ -39,9 +39,11 @@ KernelVersion: v5.9 Contact: linuxppc-dev <[email protected]>, [email protected], Description: (RO) Report various performance stats related to papr-scm NVDIMM - device. Each stat is reported on a new line with each line - composed of a stat-identifier followed by it value. Below are - currently known dimm performance stats which are reported: + device. This attribute is only available for NVDIMM devices + that support reporting NVDIMM performance stats. Each stat is + reported on a new line with each line composed of a + stat-identifier followed by it value. Below are currently known + dimm performance stats which are reported: * "CtlResCt" : Controller Reset Count * "CtlResTm" : Controller Reset Elapsed Time
arch/powerpc/platforms/pseries/papr_scm.c +24 -11
@@ -901,6 +901,20 @@ static ssize_t flags_show(struct device *dev, }DEVICE_ATTR_RO (flags); +static umode_t papr_nd_attribute_visible (struct kobject *kobj, +struct attribute *attr,int n) +{ +struct device *dev =kobj_to_dev (kobj); +struct nvdimm *nvdimm =to_nvdimm (dev); +struct papr_scm_priv *p =nvdimm_provider_data (nvdimm); + +/* For if perf-stats not available remove perf_stats sysfs */ +if (attr == &dev_attr_perf_stats.attr && p->stat_buffer_len ==0 ) +return 0 ; + +return attr->mode; +} +/* papr_scm specific dimm attributes */ static struct attribute *papr_nd_attributes[] = { &dev_attr_flags.attr,
@@ -910,6 +924,7 @@ static struct attribute *papr_nd_attributes[] = {static struct attribute_group papr_nd_attribute_group = { .name ="papr" , + .is_visible = papr_nd_attribute_visible, .attrs = papr_nd_attributes, };
@@ -925,7 +940,6 @@ static int papr_scm_nvdimm_init(struct papr_scm_priv *p)struct nd_region_desc ndr_desc;unsigned long dimm_flags;int target_nid, online_nid; -ssize_t stat_size; p->bus_desc.ndctl = papr_scm_ndctl; p->bus_desc.module =THIS_MODULE ;
@@ -1010,16 +1024,6 @@ static int papr_scm_nvdimm_init(struct papr_scm_priv *p)list_add_tail (&p->region_list, &papr_nd_regions);mutex_unlock (&papr_ndr_lock); -/* Try retriving the stat buffer and see if its supported */ - stat_size =drc_pmem_query_stats (p,NULL ,0 ); -if (stat_size >0 ) { - p->stat_buffer_len = stat_size; -dev_dbg (&p->pdev->dev,"Max perf-stat size %lu-bytes\n" , - p->stat_buffer_len); - }else { -dev_info (&p->pdev->dev,"Dimm performance stats unavailable\n" ); - } -return 0 ; err:nvdimm_bus_unregister (p->bus);
@@ -1097,6 +1101,7 @@ static int papr_scm_probe(struct platform_device *pdev)struct papr_scm_priv *p;u8 uuid_raw[UUID_SIZE ];const char *uuid_str; +ssize_t stat_size;uuid_t uuid;int rc;
@@ -1181,6 +1186,14 @@ static int papr_scm_probe(struct platform_device *pdev) p->res.name = pdev->name; p->res.flags =IORESOURCE_MEM ; +/* Try retrieving the stat buffer and see if its supported */ + stat_size =drc_pmem_query_stats (p,NULL ,0 ); +if (stat_size >0 ) { + p->stat_buffer_len = stat_size; +dev_dbg (&p->pdev->dev,"Max perf-stat size %lu-bytes\n" , + p->stat_buffer_len); + } + rc =papr_scm_nvdimm_init (p);if (rc) goto err2;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 756/800 powerpc: Fix is_kvm_guest() / kvm_para_available()
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit 95839225639ba7c3d8d7231b542728dcf222bf2d ]
Commit a21d1becaa3f ("powerpc: Reintroduce is_kvm_guest() as a fast-path check") added is_kvm_guest() and changed kvm_para_available() to use it.
is_kvm_guest() checks a static key, kvm_guest, and that static key is set in check_kvm_guest().
The problem is check_kvm_guest() is only called on pseries, and even then only in some configurations. That means is_kvm_guest() always returns false on all non-pseries and some pseries depending on configuration. That's a bug.
For PR KVM guests this is noticable because they no longer do live patching of themselves, which can be detected by the omission of a message in dmesg such as:
KVM: Live patching for a fast VM worked
To fix it make check_kvm_guest() an initcall, to ensure it's always called at boot. It needs to be core so that it runs before kvm_guest_init() which is postcore. To be an initcall it needs to return int, where 0 means success, so update that.
We still call it manually in pSeries_smp_probe(), because that runs before init calls are run.
--- arch/powerpc/include/asm/kvm_guest.h | 4 ++-- arch/powerpc/kernel/firmware.c | 10 ++++++---- arch/powerpc/platforms/pseries/smp.c | 4 +++- 3 files changed, 11 insertions(+), 7 deletions(-)
arch/powerpc/include/asm/kvm_guest.h +2 -2
@@ -16,10 +16,10 @@ static inline bool is_kvm_guest(void)return static_branch_unlikely (&kvm_guest); } -bool check_kvm_guest (void ); +int check_kvm_guest (void );#else static inline bool is_kvm_guest (void ) {return false; } -static inline bool check_kvm_guest (void ) {return false; } +static inline int check_kvm_guest (void ) {return 0 ; }#endif #endif /* _ASM_POWERPC_KVM_GUEST_H_ */
arch/powerpc/kernel/firmware.c +6 -4
@@ -23,18 +23,20 @@ EXPORT_SYMBOL_GPL(powerpc_firmware_features);#if defined(CONFIG_PPC_PSERIES ) || defined(CONFIG_KVM_GUEST )DEFINE_STATIC_KEY_FALSE (kvm_guest); -bool check_kvm_guest (void ) +int __init check_kvm_guest (void ) {struct device_node *hyper_node; hyper_node =of_find_node_by_path ("/hypervisor" );if (!hyper_node) -return false; +return 0 ;if (!of_device_is_compatible (hyper_node,"linux,kvm" )) -return false; +return 0 ;static_branch_enable (&kvm_guest); -return true; + +return 0 ; } +core_initcall (check_kvm_guest);// before kvm_guest_init() #endif
arch/powerpc/platforms/pseries/smp.c +3 -1
@@ -211,7 +211,9 @@ static __init void pSeries_smp_probe(void)if (!cpu_has_feature (CPU_FTR_SMT ))return ; -if (check_kvm_guest ()) { +check_kvm_guest (); + +if (is_kvm_guest ()) {/* * KVM emulates doorbells by disabling FSCR[MSGP] so msgsndp * faults to the hypervisor which then reads the instruction
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 757/800 ALSA: firewire-lib: Fix amdtp_domain_start() when no AMDTP_OUT_STREAM stream is found
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 0cbbeaf370221fc469c95945dd3c1198865c5fe4 ]
The intent here is to return an error code if we don't find what we are looking for in the 'list_for_each_entry()' loop.
's' is not NULL if the list is empty or if we scan the complete list. Introduce a new 'found' variable to handle such cases.
--- sound/firewire/amdtp-stream.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
sound/firewire/amdtp-stream.c +5 -2
@@ -1404,14 +1404,17 @@ int amdtp_domain_start(struct amdtp_domain *d, unsigned int ir_delay_cycle)unsigned int queue_size;struct amdtp_stream *s;int cycle; +bool found = false;int err;// Select an IT context as IRQ target. list_for_each_entry (s, &d->streams, list) { -if (s->direction ==AMDTP_OUT_STREAM ) +if (s->direction ==AMDTP_OUT_STREAM ) { + found = true;break ; + } } -if (!s) +if (!found)return -ENXIO ; d->irq_target = s;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 758/800 serial: mvebu-uart: do not allow changing baudrate when uartclk is not available
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit ecd6b010d81f97b06b2f64d2d4f50ebf5acddaa9 ]
Testing mvuart->clk for non-error is not enough as mvuart->clk may contain valid clk pointer but when clk_prepare_enable(mvuart->clk) failed then port->uartclk is zero.
When mvuart->clk is not available then port->uartclk is zero too.
Parent clock rate port->uartclk is needed to calculate UART clock divisor and without it is not possible to change baudrate.
So fix test condition when it is possible to change baudrate.
--- drivers/tty/serial/mvebu-uart.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/tty/serial/mvebu-uart.c +2 -3
@@ -445,12 +445,11 @@ static void mvebu_uart_shutdown(struct uart_port *port)static int mvebu_uart_baud_rate_set (struct uart_port *port,unsigned int baud) { -struct mvebu_uart *mvuart =to_mvuart (port);unsigned int d_divisor, m_divisor;u32 brdv, osamp; -if (IS_ERR (mvuart->clk)) -return -PTR_ERR (mvuart->clk); +if (!port->uartclk) +return -EOPNOTSUPP ;/* * The baudrate is derived from the UART clock thanks to two divisors:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 759/800 serial: mvebu-uart: correctly calculate minimal possible baudrate
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit deeaf963569a0d9d1b08babb771f61bb501a5704 ]
For default (x16) scheme which is currently used by mvebu-uart.c driver, maximal divisor of UART base clock is 1023*16. Therefore there is limit for minimal supported baudrate. This change calculate it correctly and prevents setting invalid divisor 0 into hardware registers.
--- drivers/tty/serial/mvebu-uart.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/tty/serial/mvebu-uart.c +8 -3
@@ -481,7 +481,7 @@ static void mvebu_uart_set_termios(struct uart_port *port, struct ktermios *old) {unsigned long flags; -unsigned int baud; +unsigned int baud, min_baud, max_baud;spin_lock_irqsave (&port->lock, flags);
@@ -500,16 +500,21 @@ static void mvebu_uart_set_termios(struct uart_port *port, port->ignore_status_mask |=STAT_RX_RDY (port) |STAT_BRK_ERR ;/* +* Maximal divisor is 1023 * 16 when using default (x16) scheme. * Maximum achievable frequency with simple baudrate divisor is 230400. * Since the error per bit frame would be of more than 15%, achieving * higher frequencies would require to implement the fractional divisor * feature. */ - baud =uart_get_baud_rate (port, termios, old,0 ,230400 ); + min_baud =DIV_ROUND_UP (port->uartclk,1023 *16 ); + max_baud =230400 ; + + baud =uart_get_baud_rate (port, termios, old, min_baud, max_baud);if (mvebu_uart_baud_rate_set (port, baud)) {/* No clock available, baudrate cannot be changed */ if (old) - baud =uart_get_baud_rate (port, old,NULL ,0 ,230400 ); + baud =uart_get_baud_rate (port, old,NULL , + min_baud, max_baud); }else {tty_termios_encode_baud_rate (termios, baud, baud);uart_update_timeout (port, termios->c_cflag, baud);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 760/800 arm64: dts: marvell: armada-37xx: Fix reg for standard variant of UART
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 2cbfdedef39fb5994b8f1e1df068eb8440165975 ]
UART1 (standard variant with DT node name 'uart0') has register space 0x12000-0x12018 and not whole size 0x200. So fix also this in example.
--- arch/arm64/boot/dts/marvell/armada-37xx.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/marvell/armada-37xx.dtsi +1 -1
@@ -134,7 +134,7 @@ uart0: serial@12000 { compatible = "marvell,armada-3700-uart"; - reg = <0x12000 0x200>; + reg = <0x12000 0x18>; clocks = <&xtalclk>; interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 761/800 powerpc/64s: fix hash page fault interrupt handler
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 5567b1ee29b7a83e8c01d99d34b5bbd306ce0bcf ]
The early bad fault or key fault test in do_hash_fault() ends up calling into ___do_page_fault without having gone through an interrupt handler wrapper (except the initial _RAW one). This can end up calling local irq functions while the interrupt has not been reconciled, which will likely cause crashes and it trips up on a later patch that adds more assertions.
pkey_exec_prot from selftests causes this path to be executed.
There is no real reason to run the in_nmi() test should be performed before the key fault check. In fact if a perf interrupt in the hash fault code did a stack walk that was made to take a key fault somehow then running ___do_page_fault could possibly cause another hash fault causing problems. Move the in_nmi() test first, and then do everything else inside the regular interrupt handler function.
--- arch/powerpc/mm/book3s64/hash_utils.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
arch/powerpc/mm/book3s64/hash_utils.c +11 -13
@@ -1522,8 +1522,8 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap, }EXPORT_SYMBOL_GPL (hash_page); -DECLARE_INTERRUPT_HANDLER_RET (__do_hash_fault); -DEFINE_INTERRUPT_HANDLER_RET (__do_hash_fault) +DECLARE_INTERRUPT_HANDLER (__do_hash_fault); +DEFINE_INTERRUPT_HANDLER (__do_hash_fault) {unsigned long ea = regs->dar;unsigned long dsisr = regs->dsisr;
@@ -1533,6 +1533,11 @@ DEFINE_INTERRUPT_HANDLER_RET(__do_hash_fault)unsigned int region_id;long err; +if (unlikely (dsisr & (DSISR_BAD_FAULT_64S |DSISR_KEYFAULT ))) { +hash__do_page_fault (regs); +return ; + } + region_id =get_region_id (ea);if ((region_id ==VMALLOC_REGION_ID ) || (region_id ==IO_REGION_ID )) mm = &init_mm;
@@ -1571,9 +1576,10 @@ DEFINE_INTERRUPT_HANDLER_RET(__do_hash_fault)bad_page_fault (regs,SIGBUS ); } err =0 ; - } -return err; + }else if (err) { +hash__do_page_fault (regs); + } }/*
@@ -1582,13 +1588,6 @@ DEFINE_INTERRUPT_HANDLER_RET(__do_hash_fault)*/ DEFINE_INTERRUPT_HANDLER_RAW (do_hash_fault) { -unsigned long dsisr = regs->dsisr; - -if (unlikely (dsisr & (DSISR_BAD_FAULT_64S |DSISR_KEYFAULT ))) { -hash__do_page_fault (regs); -return 0 ; - } -/* * If we are in an "NMI" (e.g., an interrupt when soft-disabled), then * don't call hash_page, just fail the fault. This is required to
@@ -1607,8 +1606,7 @@ DEFINE_INTERRUPT_HANDLER_RAW(do_hash_fault)return 0 ; } -if (__do_hash_fault (regs)) -hash__do_page_fault (regs); +__do_hash_fault (regs);return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 762/800 powerpc/64s/interrupt: preserve regs->softe for NMI interrupts
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 1b0482229c302a3c6afd00d6b3bf0169cf279b44 ]
If an NMI interrupt hits in an implicit soft-masked region, regs->softe is modified to reflect that. This may not be necessary for correctness at the moment, but it is less surprising and it's unhelpful when debugging or adding checks.
Make sure this is changed back to how it was found before returning.
--- arch/powerpc/include/asm/interrupt.h | 3 +++ 1 file changed, 3 insertions(+)
arch/powerpc/include/asm/interrupt.h +3 -0
@@ -186,6 +186,7 @@ struct interrupt_nmi_state {u8 irq_soft_mask;u8 irq_happened;u8 ftrace_enabled; +u64 softe;#endif };
@@ -211,6 +212,7 @@ static inline void interrupt_nmi_enter_prepare(struct pt_regs *regs, struct inte#ifdef CONFIG_PPC64 state->irq_soft_mask = local_paca->irq_soft_mask; state->irq_happened = local_paca->irq_happened; + state->softe = regs->softe;/* * Set IRQS_ALL_DISABLED unconditionally so irqs_disabled() does
@@ -263,6 +265,7 @@ static inline void interrupt_nmi_exit_prepare(struct pt_regs *regs, struct inter/* Check we didn't change the pending interrupt mask. */ WARN_ON_ONCE ((state->irq_happened |PACA_IRQ_HARD_DIS ) != local_paca->irq_happened); + regs->softe = state->softe; local_paca->irq_happened = state->irq_happened; local_paca->irq_soft_mask = state->irq_soft_mask;#endif
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 763/800 vfio/pci: Handle concurrent vma faults
In reply to Greg Kroah-HartmanFrom: Alex Williamson <[email protected]>
[ Upstream commit 6a45ece4c9af473555f01f0f8b97eba56e3c7d0d ]
io_remap_pfn_range() will trigger a BUG_ON if it encounters a populated pte within the mapping range. This can occur because we map the entire vma on fault and multiple faults can be blocked behind the vma_lock. This leads to traces like the one reported below.
We can use our vma_list to test whether a given vma is mapped to avoid this issue.
[ 1591.733256] kernel BUG at mm/memory.c:2177! [ 1591.739515] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP [ 1591.747381] Modules linked in: vfio_iommu_type1 vfio_pci vfio_virqfd vfio pv680_mii(O) [ 1591.760536] CPU: 2 PID: 227 Comm: lcore-worker-2 Tainted: G O 5.11.0-rc3+ #1 [ 1591.770735] Hardware name: , BIOS HixxxxFPGA 1P B600 V121-1 [ 1591.778872] pstate: 40400009 (nZcv daif +PAN -UAO -TCO BTYPE=--) [ 1591.786134] pc : remap_pfn_range+0x214/0x340 [ 1591.793564] lr : remap_pfn_range+0x1b8/0x340 [ 1591.799117] sp : ffff80001068bbd0 [ 1591.803476] x29: ffff80001068bbd0 x28: 0000042eff6f0000 [ 1591.810404] x27: 0000001100910000 x26: 0000001300910000 [ 1591.817457] x25: 0068000000000fd3 x24: ffffa92f1338e358 [ 1591.825144] x23: 0000001140000000 x22: 0000000000000041 [ 1591.832506] x21: 0000001300910000 x20: ffffa92f141a4000 [ 1591.839520] x19: 0000001100a00000 x18: 0000000000000000 [ 1591.846108] x17: 0000000000000000 x16: ffffa92f11844540 [ 1591.853570] x15: 0000000000000000 x14: 0000000000000000 [ 1591.860768] x13: fffffc0000000000 x12: 0000000000000880 [ 1591.868053] x11: ffff0821bf3d01d0 x10: ffff5ef2abd89000 [ 1591.875932] x9 : ffffa92f12ab0064 x8 : ffffa92f136471c0 [ 1591.883208] x7 : 0000001140910000 x6 : 0000000200000000 [ 1591.890177] x5 : 0000000000000001 x4 : 0000000000000001 [ 1591.896656] x3 : 0000000000000000 x2 : 0168044000000fd3 [ 1591.903215] x1 : ffff082126261880 x0 : fffffc2084989868 [ 1591.910234] Call trace: [ 1591.914837] remap_pfn_range+0x214/0x340 [ 1591.921765] vfio_pci_mmap_fault+0xac/0x130 [vfio_pci] [ 1591.931200] __do_fault+0x44/0x12c [ 1591.937031] handle_mm_fault+0xcc8/0x1230 [ 1591.942475] do_page_fault+0x16c/0x484 [ 1591.948635] do_translation_fault+0xbc/0xd8 [ 1591.954171] do_mem_abort+0x4c/0xc0 [ 1591.960316] el0_da+0x40/0x80 [ 1591.965585] el0_sync_handler+0x168/0x1b0 [ 1591.971608] el0_sync+0x174/0x180 [ 1591.978312] Code: eb1b027f 540000c0 f9400022 b4fffe02 (d4210000)
--- drivers/vfio/pci/vfio_pci.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-)
drivers/vfio/pci/vfio_pci.c +21 -8
@@ -1594,6 +1594,7 @@ static vm_fault_t vfio_pci_mmap_fault(struct vm_fault *vmf) {struct vm_area_struct *vma = vmf->vma;struct vfio_pci_device *vdev = vma->vm_private_data; +struct vfio_pci_mmap_vma *mmap_vma;vm_fault_t ret =VM_FAULT_NOPAGE ;mutex_lock (&vdev->vma_lock);
@@ -1601,24 +1602,36 @@ static vm_fault_t vfio_pci_mmap_fault(struct vm_fault *vmf)if (!__vfio_pci_memory_enabled (vdev)) { ret =VM_FAULT_SIGBUS ; -mutex_unlock (&vdev->vma_lock); goto up_out; } -if (__vfio_pci_add_vma (vdev, vma)) { - ret =VM_FAULT_OOM ; -mutex_unlock (&vdev->vma_lock); - goto up_out; +/* +* We populate the whole vma on fault, so we need to test whether +* the vma has already been mapped, such as for concurrent faults +* to the same vma. io_remap_pfn_range() will trigger a BUG_ON if +* we ask it to fill the same range again. +*/ +list_for_each_entry (mmap_vma, &vdev->vma_list, vma_next) { +if (mmap_vma->vma == vma) + goto up_out; } -mutex_unlock (&vdev->vma_lock); -if (io_remap_pfn_range (vma, vma->vm_start, vma->vm_pgoff, - vma->vm_end - vma->vm_start, vma->vm_page_prot)) + vma->vm_end - vma->vm_start, + vma->vm_page_prot)) { ret =VM_FAULT_SIGBUS ; +zap_vma_ptes (vma, vma->vm_start, vma->vm_end - vma->vm_start); + goto up_out; + } + +if (__vfio_pci_add_vma (vdev, vma)) { + ret =VM_FAULT_OOM ; +zap_vma_ptes (vma, vma->vm_start, vma->vm_end - vma->vm_start); + } up_out:up_read (&vdev->memory_lock); +mutex_unlock (&vdev->vma_lock);return ret; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 764/800 mm/huge_memory.c: remove dedicated macro HPAGE_CACHE_INDEX_MASK
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit b2bd53f18bb7f7cfc91b3bb527d7809376700a8e ]
Patch series "Cleanup and fixup for huge_memory:, v3.
This series contains cleanups to remove dedicated macro and remove unnecessary tlb_remove_page_size() for huge zero pmd. Also this adds missing read-only THP checking for transparent_hugepage_enabled() and avoids discarding hugepage if other processes are mapping it. More details can be found in the respective changelogs.
Thi patch (of 5):
Rewrite the pgoff checking logic to remove macro HPAGE_CACHE_INDEX_MASK which is only used here to simplify the code.
--- include/linux/huge_mm.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
include/linux/huge_mm.h +2 -4
@@ -152,15 +152,13 @@ static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma)bool transparent_hugepage_enabled (struct vm_area_struct *vma); -#define HPAGE_CACHE_INDEX_MASK (HPAGE_PMD_NR - 1) -static inline bool transhuge_vma_suitable (struct vm_area_struct *vma,unsigned long haddr) {/* Don't have to check pgoff for anonymous vma */ if (!vma_is_anonymous (vma)) { -if (((vma->vm_start >>PAGE_SHIFT ) &HPAGE_CACHE_INDEX_MASK ) != - (vma->vm_pgoff &HPAGE_CACHE_INDEX_MASK )) +if (!IS_ALIGNED ((vma->vm_start >>PAGE_SHIFT ) - vma->vm_pgoff, +HPAGE_PMD_NR ))return false; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 765/800 mm/huge_memory.c: add missing read-only THP checking in transparent_hugepage_enabled()
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit e6be37b2e7bddfe0c76585ee7c7eee5acc8efeab ]
Since commit 99cb0dbd47a1 ("mm,thp: add read-only THP support for (non-shmem) FS"), read-only THP file mapping is supported. But it forgot to add checking for it in transparent_hugepage_enabled(). To fix it, we add checking for read-only THP file mapping and also introduce helper transhuge_vma_enabled() to check whether thp is enabled for specified vma to reduce duplicated code. We rename transparent_hugepage_enabled to transparent_hugepage_active to make the code easier to follow as suggested by David Hildenbrand.
--- fs/proc/task_mmu.c | 2 +- include/linux/huge_mm.h | 57 +++++++++++++++++++++++++---------------- mm/huge_memory.c | 11 +++++++- mm/khugepaged.c | 4 +-- mm/shmem.c | 3 +-- 5 files changed, 48 insertions(+), 29 deletions(-)
fs/proc/task_mmu.c +1 -1
@@ -832,7 +832,7 @@ static int show_smap(struct seq_file *m, void *v)__show_smap (m, &mss, false);seq_printf (m,"THPeligible: %d\n" , -transparent_hugepage_enabled (vma)); +transparent_hugepage_active (vma));if (arch_pkeys_enabled ())seq_printf (m,"ProtectionKey: %8u\n" ,vma_pkey (vma));
include/linux/huge_mm.h +35 -22
94 lines not on this page · raw message
mm/huge_memory.c +10 -1
@@ -64,7 +64,14 @@ static atomic_t huge_zero_refcount;struct page *huge_zero_page__read_mostly ;unsigned long huge_zero_pfn__read_mostly = ~0UL ; -bool transparent_hugepage_enabled (struct vm_area_struct *vma) +static inline bool file_thp_enabled (struct vm_area_struct *vma) +{ +return transhuge_vma_enabled (vma, vma->vm_flags) && vma->vm_file && + !inode_is_open_for_write (vma->vm_file->f_inode) && + (vma->vm_flags &VM_EXEC ); +} + +bool transparent_hugepage_active (struct vm_area_struct *vma) {/* The addr is used to check if the vma size fits */ unsigned long addr = (vma->vm_end &HPAGE_PMD_MASK ) -HPAGE_PMD_SIZE ;
@@ -75,6 +82,8 @@ bool transparent_hugepage_enabled(struct vm_area_struct *vma)return __transparent_hugepage_enabled (vma);if (vma_is_shmem (vma))return shmem_huge_enabled (vma); +if (IS_ENABLED (CONFIG_READ_ONLY_THP_FOR_FS )) +return file_thp_enabled (vma);return false; }
mm/khugepaged.c +1 -3
@@ -442,9 +442,7 @@ static inline int khugepaged_test_exit(struct mm_struct *mm)static bool hugepage_vma_check (struct vm_area_struct *vma,unsigned long vm_flags) { -/* Explicitly disabled through madvise. */ -if ((vm_flags &VM_NOHUGEPAGE ) || -test_bit (MMF_DISABLE_THP , &vma->vm_mm->flags)) +if (!transhuge_vma_enabled (vma, vm_flags))return false;/* Enabled via shmem mount options or sysfs settings. */
mm/shmem.c +1 -2
@@ -4040,8 +4040,7 @@ bool shmem_huge_enabled(struct vm_area_struct *vma)loff_t i_size;pgoff_t off; -if ((vma->vm_flags &VM_NOHUGEPAGE ) || -test_bit (MMF_DISABLE_THP , &vma->vm_mm->flags)) +if (!transhuge_vma_enabled (vma, vma->vm_flags))return false;if (shmem_huge ==SHMEM_HUGE_FORCE )return true;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 766/800 mm/huge_memory.c: dont discard hugepage if other processes are mapping it
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit babbbdd08af98a59089334eb3effbed5a7a0cf7f ]
If other processes are mapping any other subpages of the hugepage, i.e. in pte-mapped thp case, page_mapcount() will return 1 incorrectly. Then we would discard the page while other processes are still mapping it. Fix it by using total_mapcount() which can tell whether other processes are still mapping it.
--- mm/huge_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/huge_memory.c +1 -1
@@ -1613,7 +1613,7 @@ bool madvise_free_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,* If other processes are mapping this page, we couldn't discard * the page unless they all do MADV_FREE so let's skip the page. */ -if (page_mapcount (page) !=1 ) +if (total_mapcount (page) !=1 ) goto out;if (!trylock_page (page))
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 767/800 hugetlb: remove prep_compound_huge_page cleanup
In reply to Greg Kroah-HartmanFrom: Mike Kravetz <[email protected]>
[ Upstream commit 48b8d744ea841b8adf8d07bfe7a2d55f22e4d179 ]
Patch series "Fix prep_compound_gigantic_page ref count adjustment".
These patches address the possible race between prep_compound_gigantic_page and __page_cache_add_speculative as described by Jann Horn in [1].
The first patch simply removes the unnecessary/obsolete helper routine prep_compound_huge_page to make the actual fix a little simpler.
The second patch is the actual fix and has a detailed explanation in the commit message.
This potential issue has existed for almost 10 years and I am unaware of anyone actually hitting the race. I did not cc stable, but would be happy to squash the patches and send to stable if anyone thinks that is a good idea.
[1] https://lore.kernel.org/linux-mm/CAG48ez23q0Jy9cuVnwAe7t_fdhMk2S7N5Hdi-GLcCeq5bsfLxw@mail.gmail.com/
This patch (of 2):
I could not think of a reliable way to recreate the issue for testing. Rather, I 'simulated errors' to exercise all the error paths.
The routine prep_compound_huge_page is a simple wrapper to call either prep_compound_gigantic_page or prep_compound_page. However, it is only called from gather_bootmem_prealloc which only processes gigantic pages. Eliminate the routine and call prep_compound_gigantic_page directly.
--- mm/hugetlb.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-)
mm/hugetlb.c +10 -19
@@ -1318,8 +1318,6 @@ static struct page *alloc_gigantic_page(struct hstate *h, gfp_t gfp_mask, return alloc_contig_pages(nr_pages, gfp_mask, nid, nodemask); } -static void prep_new_huge_page (struct hstate *h,struct page *page,int nid); -static void prep_compound_gigantic_page (struct page *page,unsigned int order);#else /* !CONFIG_CONTIG_ALLOC */ static struct page *alloc_gigantic_page (struct hstate *h,gfp_t gfp_mask,int nid,nodemask_t *nodemask)
@@ -2625,16 +2623,10 @@ found:return 1 ; } -static void __init prep_compound_huge_page (struct page *page, -unsigned int order) -{ -if (unlikely (order > (MAX_ORDER -1 ))) -prep_compound_gigantic_page (page, order); -else -prep_compound_page (page, order); -} - -/* Put bootmem huge pages into the standard lists after mem_map is up */ +/* +* Put bootmem huge pages into the standard lists after mem_map is up. +* Note: This only applies to gigantic (order > MAX_ORDER) pages. +*/ static void __init gather_bootmem_prealloc (void ) {struct huge_bootmem_page *m;
@@ -2643,20 +2635,19 @@ static void __init gather_bootmem_prealloc(void)struct page *page =virt_to_page (m);struct hstate *h = m->hstate; +VM_BUG_ON (!hstate_is_gigantic (h));WARN_ON (page_count (page) !=1 ); -prep_compound_huge_page (page,huge_page_order (h)); +prep_compound_gigantic_page (page,huge_page_order (h));WARN_ON (PageReserved (page));prep_new_huge_page (h, page,page_to_nid (page));put_page (page);/* free it into the hugepage allocator */ /* -* If we had gigantic hugepages allocated at boot time, we need -* to restore the 'stolen' pages to totalram_pages in order to -* fix confusing memory reports from free(1) and another -* side-effects, like CommitLimit going negative. +* We need to restore the 'stolen' pages to totalram_pages +* in order to fix confusing memory reports from free(1) and +* other side-effects, like CommitLimit going negative. */ -if (hstate_is_gigantic (h)) -adjust_managed_page_count (page,pages_per_huge_page (h)); +adjust_managed_page_count (page,pages_per_huge_page (h));cond_resched (); } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 768/800 hugetlb: address ref count racing in prep_compound_gigantic_page
In reply to Greg Kroah-HartmanFrom: Mike Kravetz <[email protected]>
[ Upstream commit 7118fc2906e2925d7edb5ed9c8a57f2a5f23b849 ]
In [1], Jann Horn points out a possible race between prep_compound_gigantic_page and __page_cache_add_speculative. The root cause of the possible race is prep_compound_gigantic_page uncondittionally setting the ref count of pages to zero. It does this because prep_compound_gigantic_page is handed a 'group' of pages from an allocator and needs to convert that group of pages to a compound page. The ref count of each page in this 'group' is one as set by the allocator. However, the ref count of compound page tail pages must be zero.
The potential race comes about when ref counted pages are returned from the allocator. When this happens, other mm code could also take a reference on the page. __page_cache_add_speculative is one such example. Therefore, prep_compound_gigantic_page can not just set the ref count of pages to zero as it does today. Doing so would lose the reference taken by any other code. This would lead to BUGs in code checking ref counts and could possibly even lead to memory corruption.
There are two possible ways to address this issue.
1) Make all allocators of gigantic groups of pages be able to return a properly constructed compound page.
2) Make prep_compound_gigantic_page be more careful when constructing a compound page.
This patch takes approach 2.
In prep_compound_gigantic_page, use cmpxchg to only set ref count to zero if it is one. If the cmpxchg fails, call synchronize_rcu() in the hope that the extra ref count will be driopped during a rcu grace period. This is not a performance critical code path and the wait should be accceptable. If the ref count is still inflated after the grace period, then undo any modifications made and return an error.
Currently prep_compound_gigantic_page is type void and does not return errors. Modify the two callers to check for and handle error returns. On error, the caller must free the 'group' of pages as they can not be used to form a gigantic page. After freeing pages, the runtime caller (alloc_fresh_huge_page) will retry the allocation once. Boot time allocations can not be retried.
The routine prep_compound_page also unconditionally sets the ref count of compound page tail pages to zero. However, in this case the buddy allocator is constructing a compound page from freshly allocated pages. The ref count on those freshly allocated pages is already zero, so the set_page_count(p, 0) is unnecessary and could lead to confusion. Just remove it.
[1] https://lore.kernel.org/linux-mm/CAG48ez23q0Jy9cuVnwAe7t_fdhMk2S7N5Hdi-GLcCeq5bsfLxw@mail.gmail.com/
--- mm/hugetlb.c | 72 +++++++++++++++++++++++++++++++++++++++++++------ mm/page_alloc.c | 1 - 2 files changed, 64 insertions(+), 9 deletions(-)
mm/hugetlb.c +64 -8
@@ -1508,9 +1508,9 @@ static void prep_new_huge_page(struct hstate *h, struct page *page, int nid)spin_unlock_irq (&hugetlb_lock); } -static void prep_compound_gigantic_page (struct page *page,unsigned int order) +static bool prep_compound_gigantic_page (struct page *page,unsigned int order) { -int i; +int i, j;int nr_pages =1 << order;struct page *p = page +1 ;
@@ -1532,11 +1532,48 @@ static void prep_compound_gigantic_page(struct page *page, unsigned int order)* after get_user_pages(). */ __ClearPageReserved (p); +/* +* Subtle and very unlikely +* +* Gigantic 'page allocators' such as memblock or cma will +* return a set of pages with each page ref counted. We need +* to turn this set of pages into a compound page with tail +* page ref counts set to zero. Code such as speculative page +* cache adding could take a ref on a 'to be' tail page. +* We need to respect any increased ref count, and only set +* the ref count to zero if count is currently 1. If count +* is not 1, we call synchronize_rcu in the hope that a rcu +* grace period will cause ref count to drop and then retry. +* If count is still inflated on retry we return an error and +* must discard the pages. +*/ +if (!page_ref_freeze (p,1 )) { +pr_info ("HugeTLB unexpected inflated ref count on freshly allocated page\n" ); +synchronize_rcu (); +if (!page_ref_freeze (p,1 )) + goto out_error; + }set_page_count (p,0 );set_compound_head (p, page); }atomic_set (compound_mapcount_ptr (page),-1 );atomic_set (compound_pincount_ptr (page),0 ); +return true; + +out_error: +/* undo tail page modifications made above */ + p = page +1 ; +for (j =1 ; j < i; j++, p =mem_map_next (p, page, j)) { +clear_compound_head (p); +set_page_refcounted (p); + } +/* need to clear PG_reserved on remaining tail pages */ +for (; j < nr_pages; j++, p =mem_map_next (p, page, j)) +__ClearPageReserved (p); +set_compound_order (page,0 ); + page[1 ].compound_nr =0 ; +__ClearPageHead (page); +return false; }/*
@@ -1656,7 +1693,9 @@ static struct page *alloc_fresh_huge_page(struct hstate *h, nodemask_t *node_alloc_noretry) {struct page *page; +bool retry = false; +retry:if (hstate_is_gigantic (h)) page =alloc_gigantic_page (h, gfp_mask, nid, nmask);else
@@ -1665,8 +1704,21 @@ static struct page *alloc_fresh_huge_page(struct hstate *h,if (!page)return NULL ; -if (hstate_is_gigantic (h)) -prep_compound_gigantic_page (page,huge_page_order (h)); +if (hstate_is_gigantic (h)) { +if (!prep_compound_gigantic_page (page,huge_page_order (h))) { +/* +* Rare failure to convert pages to compound page. +* Free pages and try again - ONCE! +*/ +free_gigantic_page (page,huge_page_order (h)); +if (!retry) { + retry = true; + goto retry; + } +pr_warn ("HugeTLB page can not be used due to unexpected inflated ref count\n" ); +return NULL ; + } + }prep_new_huge_page (h, page,page_to_nid (page));return page;
@@ -2637,10 +2689,14 @@ static void __init gather_bootmem_prealloc(void)VM_BUG_ON (!hstate_is_gigantic (h));WARN_ON (page_count (page) !=1 ); -prep_compound_gigantic_page (page,huge_page_order (h)); -WARN_ON (PageReserved (page)); -prep_new_huge_page (h, page,page_to_nid (page)); -put_page (page);/* free it into the hugepage allocator */ +if (prep_compound_gigantic_page (page,huge_page_order (h))) { +WARN_ON (PageReserved (page)); +prep_new_huge_page (h, page,page_to_nid (page)); +put_page (page);/* add to the hugepage allocator */ + }else { +free_gigantic_page (page,huge_page_order (h)); +pr_warn ("HugeTLB page can not be used due to unexpected inflated ref count\n" ); + }/* * We need to restore the 'stolen' pages to totalram_pages
mm/page_alloc.c +0 -1
@@ -698,7 +698,6 @@ void prep_compound_page(struct page *page, unsigned int order)__SetPageHead (page);for (i =1 ; i < nr_pages; i++) {struct page *p = page + i; -set_page_count (p,0 ); p->mapping =TAIL_MAPPING ;set_compound_head (p, page); }
Signature · 1 line
2.30.2
Re: [PATCH 5.13 768/800] hugetlb: address ref count racing in prep_compound_gigantic_page
Quoted 4 lines · Greg Kroah-Hartman
From: Mike Kravetz <[email protected]>
[ Upstream commit
7118fc2906e2925d7edb5ed9c8a57f2a5f23b849]
Please do not add or the requisite patch to stable tree.
Although this is a real potential issue, it was only found during code inspection. It has existed for more than 10 years and I am unaware of anyone hitting this in actual use. In addition, this proposed fix will likely be updated/simplified based on more discussions.
Signature · 1 line
Mike Kravetz
Greg Kroah-Hartman
maintainerRe: [PATCH 5.13 768/800] hugetlb: address ref count racing in prep_compound_gigantic_page
Quoted 6 lines · Mike Kravetz
Quoted 4 lines · Greg Kroah-Hartman
From: Mike Kravetz <[email protected]>
[ Upstream commit
7118fc2906e2925d7edb5ed9c8a57f2a5f23b849]
Quoted 6 lines
Please do not add or the requisite patch to stable tree.
Although this is a real potential issue, it was only found during code inspection. It has existed for more than 10 years and I am unaware of anyone hitting this in actual use. In addition, this proposed fix will likely be updated/simplified based on more discussions.
Now dropped from all queues, thanks.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 769/800 mm/z3fold: fix potential memory leak in z3fold_destroy_pool()
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit dac0d1cfda56472378d330b1b76b9973557a7b1d ]
There is a memory leak in z3fold_destroy_pool() as it forgets to free_percpu pool->unbuddied. Call free_percpu for pool->unbuddied to fix this issue.
--- mm/z3fold.c | 1 + 1 file changed, 1 insertion(+)
mm/z3fold.c +1 -0
@@ -1059,6 +1059,7 @@ static void z3fold_destroy_pool(struct z3fold_pool *pool)destroy_workqueue (pool->compact_wq);destroy_workqueue (pool->release_wq);z3fold_unregister_migration (pool); +free_percpu (pool->unbuddied);kfree (pool); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 770/800 mm/z3fold: use release_z3fold_page_locked() to release locked z3fold page
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit 28473d91ff7f686d58047ff55f2fa98ab59114a4 ]
We should use release_z3fold_page_locked() to release z3fold page when it's locked, although it looks harmless to use release_z3fold_page() now.
--- mm/z3fold.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/z3fold.c +1 -1
@@ -1383,7 +1383,7 @@ static int z3fold_reclaim_page(struct z3fold_pool *pool, unsigned int retries)if (zhdr->foreign_handles ||test_and_set_bit (PAGE_CLAIMED , &page->private)) {if (kref_put (&zhdr->refcount, - release_z3fold_page)) + release_z3fold_page_locked))atomic64_dec (&pool->pages_nr);else z3fold_page_unlock (zhdr);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 771/800 mm: migrate: fix missing update page_private to hugetlb_page_subpool
In reply to Greg Kroah-HartmanFrom: Muchun Song <[email protected]>
[ Upstream commit 6acfb5ba150cf75005ce85e0e25d79ef2fec287c ]
Since commit d6995da31122 ("hugetlb: use page.private for hugetlb specific page flags") converts page.private for hugetlb specific page flags. We should use hugetlb_page_subpool() to get the subpool pointer instead of page_private().
This 'could' prevent the migration of hugetlb pages. page_private(hpage) is now used for hugetlb page specific flags. At migration time, the only flag which could be set is HPageVmemmapOptimized. This flag will only be set if the new vmemmap reduction feature is enabled. In addition, !page_mapping() implies an anonymous mapping. So, this will prevent migration of hugetb pages in anonymous mappings if the vmemmap reduction feature is enabled.
In addition, that if statement checked for the rare race condition of a page being migrated while in the process of being freed. Since that check is now wrong, we could leak hugetlb subpool usage counts.
The commit forgot to update it in the page migration routine. So fix it.
--- include/linux/hugetlb.h | 5 +++++ mm/migrate.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-)
include/linux/hugetlb.h +5 -0
@@ -875,6 +875,11 @@ static inline void huge_ptep_modify_prot_commit(struct vm_area_struct *vma,#else /* CONFIG_HUGETLB_PAGE */ struct hstate {}; +static inline struct hugepage_subpool *hugetlb_page_subpool (struct page *hpage) +{ +return NULL ; +} +static inline int isolate_or_dissolve_huge_page (struct page *page,struct list_head *list) {
mm/migrate.c +1 -1
@@ -1288,7 +1288,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,* page_mapping() set, hugetlbfs specific move page routine will not * be called and we could leak usage counts for subpools. */ -if (page_private (hpage) && !page_mapping (hpage)) { +if (hugetlb_page_subpool (hpage) && !page_mapping (hpage)) { rc = -EBUSY ; goto out_unlock; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 772/800 mm/zswap.c: fix two bugs in zswap_writeback_entry()
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit 46b76f2e09dc35f70aca2f4349eb0d158f53fe93 ]
In the ZSWAP_SWAPCACHE_FAIL and ZSWAP_SWAPCACHE_EXIST case, we forgot to call zpool_unmap_handle() when zpool can't sleep. And we might sleep in zswap_get_swap_cache_page() while zpool can't sleep. To fix all of these, zpool_unmap_handle() should be done before zswap_get_swap_cache_page() when zpool can't sleep.
--- mm/zswap.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
mm/zswap.c +7 -10
@@ -967,6 +967,13 @@ static int zswap_writeback_entry(struct zpool *pool, unsigned long handle)spin_unlock (&tree->lock);BUG_ON (offset != entry->offset); + src = (u8 *)zhdr +sizeof (struct zswap_header ); +if (!zpool_can_sleep_mapped (pool)) { +memcpy (tmp, src, entry->length); + src = tmp; +zpool_unmap_handle (pool, handle); + } +/* try to allocate swap cache page */ switch (zswap_get_swap_cache_page (swpentry, &page)) {case ZSWAP_SWAPCACHE_FAIL :/* no memory or invalidate happened */
@@ -982,17 +989,7 @@ static int zswap_writeback_entry(struct zpool *pool, unsigned long handle)case ZSWAP_SWAPCACHE_NEW :/* page is locked */ /* decompress */ acomp_ctx =raw_cpu_ptr (entry->pool->acomp_ctx); - dlen =PAGE_SIZE ; - src = (u8 *)zhdr +sizeof (struct zswap_header ); - -if (!zpool_can_sleep_mapped (pool)) { - -memcpy (tmp, src, entry->length); - src = tmp; - -zpool_unmap_handle (pool, handle); - }mutex_lock (acomp_ctx->mutex);sg_init_one (&input, src, entry->length);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 773/800 kfence: unconditionally use unbound work queue
In reply to Greg Kroah-HartmanFrom: Marco Elver <[email protected]>
[ Upstream commit ff06e45d3aace3f93d23956c1e655224f363ebe2 ]
Unconditionally use unbound work queue, and not just if wq_power_efficient is true. Because if the system is idle, KFENCE may wait, and by being run on the unbound work queue, we permit the scheduler to make better scheduling decisions and not require pinning KFENCE to the same CPU upon waking up.
--- mm/kfence/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/kfence/core.c +2 -2
@@ -636,7 +636,7 @@ static void toggle_allocation_gate(struct work_struct *work)/* Disable static key and reset timer. */ static_branch_disable (&kfence_allocation_key);#endif -queue_delayed_work (system_power_efficient_wq, &kfence_timer, +queue_delayed_work (system_unbound_wq, &kfence_timer,msecs_to_jiffies (kfence_sample_interval)); } static DECLARE_DELAYED_WORK(kfence_timer, toggle_allocation_gate);
@@ -666,7 +666,7 @@ void __init kfence_init(void) }WRITE_ONCE (kfence_enabled, true); -queue_delayed_work (system_power_efficient_wq, &kfence_timer,0 ); +queue_delayed_work (system_unbound_wq, &kfence_timer,0 );pr_info ("initialized - using %lu bytes for %d objects at 0x%p-0x%p\n" ,KFENCE_POOL_SIZE ,CONFIG_KFENCE_NUM_OBJECTS , (void *)__kfence_pool, (void *)(__kfence_pool +KFENCE_POOL_SIZE ));
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 774/800 lib/math/rational.c: fix divide by zero
In reply to Greg Kroah-HartmanFrom: Trent Piepho <[email protected]>
[ Upstream commit 65a0d3c14685663ba111038a35db70f559e39336 ]
If the input is out of the range of the allowed values, either larger than the largest value or closer to zero than the smallest non-zero allowed value, then a division by zero would occur.
In the case of input too large, the division by zero will occur on the first iteration. The best result (largest allowed value) will be found by always choosing the semi-convergent and excluding the denominator based limit when finding it.
In the case of the input too small, the division by zero will occur on the second iteration. The numerator based semi-convergent should not be calculated to avoid the division by zero. But the semi-convergent vs previous convergent test is still needed, which effectively chooses between 0 (the previous convergent) vs the smallest allowed fraction (best semi-convergent) as the result.
--- lib/math/rational.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
lib/math/rational.c +11 -5
@@ -12,6 +12,7 @@#include <linux/compiler.h> #include <linux/export.h> #include <linux/minmax.h> +#include <linux/limits.h> /* * calculate best rational approximation for a given fraction
@@ -78,13 +79,18 @@ void rational_best_approximation(* found below as 't'. */ if ((n2 > max_numerator) || (d2 > max_denominator)) { -unsigned long t =min ((max_numerator - n0) / n1, - (max_denominator - d0) / d1); +unsigned long t =ULONG_MAX ; -/* This tests if the semi-convergent is closer -* than the previous convergent. +if (d1) + t = (max_denominator - d0) / d1; +if (n1) + t =min (t, (max_numerator - n0) / n1); + +/* This tests if the semi-convergent is closer than the previous +* convergent. If d1 is zero there is no previous convergent as this +* is the 1st iteration, so always choose the semi-convergent. */ -if (2u * t > a || (2u * t == a && d0 * dp > d1 * d)) { +if (!d1 ||2u * t > a || (2u * t == a && d0 * dp > d1 * d)) { n1 = n0 + t * n1; d1 = d0 + t * d1; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 775/800 selftests/vm/pkeys: fix alloc_random_pkey() to make it really, really random
In reply to Greg Kroah-HartmanFrom: Dave Hansen <[email protected]>
[ Upstream commit f36ef407628835a7d7fb3d235b1f1aac7022d9a3 ]
Patch series "selftests/vm/pkeys: Bug fixes and a new test".
There has been a lot of activity on the x86 front around the XSAVE architecture which is used to context-switch processor state (among other things). In addition, AMD has recently joined the protection keys club by adding processor support for PKU.
The AMD implementation helped uncover a kernel bug around the PKRU "init state", which actually applied to Intel's implementation but was just harder to hit. This series adds a test which is expected to help find this class of bug both on AMD and Intel. All the work around pkeys on x86 also uncovered a few bugs in the selftest.
This patch (of 4):
The "random" pkey allocation code currently does the good old:
srand((unsigned int)time(NULL));
*But*, it unfortunately does this on every random pkey allocation.
There may be thousands of these a second. time() has a one second resolution. So, each time alloc_random_pkey() is called, the PRNG is *RESET* to time(). This is nasty. Normally, if you do:
srand(<ANYTHING>); foo = rand(); bar = rand();
You'll be quite guaranteed that 'foo' and 'bar' are different. But, if you do:
srand(1); foo = rand(); srand(1); bar = rand();
You are quite guaranteed that 'foo' and 'bar' are the *SAME*. The recent "fix" effectively forced the test case to use the same "random" pkey for the whole test, unless the test run crossed a second boundary.
Only run srand() once at program startup.
This explains some very odd and persistent test failures I've been seeing.
--- tools/testing/selftests/vm/protection_keys.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/vm/protection_keys.c +2 -1
@@ -561,7 +561,6 @@ int alloc_random_pkey(void)int nr_alloced =0 ;int random_index;memset (alloced_pkeys,0 ,sizeof (alloced_pkeys)); -srand ((unsigned int )time (NULL ));/* allocate every possible key and make a note of which ones we got */ max_nr_pkey_allocs =NR_PKEYS ;
@@ -1552,6 +1551,8 @@ int main(void)int nr_iterations =22 ;int pkeys_supported =is_pkeys_supported (); +srand ((unsigned int )time (NULL )); +setup_handlers ();printf ("has pkeys: %d\n" , pkeys_supported);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 776/800 selftests/vm/pkeys: handle negative sys_pkey_alloc() return code
In reply to Greg Kroah-HartmanFrom: Dave Hansen <[email protected]>
[ Upstream commit bf68294a2ec39ed7fec6a5b45d52034e6983157a ]
The alloc_pkey() sefltest function wraps the sys_pkey_alloc() system call. On success, it updates its "shadow" register value because sys_pkey_alloc() updates the real register.
But, the success check is wrong. pkey_alloc() considers any non-zero return code to indicate success where the pkey register will be modified. This fails to take negative return codes into account.
Consider only a positive return value as a successful call.
--- tools/testing/selftests/vm/protection_keys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/vm/protection_keys.c +1 -1
@@ -510,7 +510,7 @@ int alloc_pkey(void)" shadow: 0x%016llx\n" , __func__, __LINE__, ret,__read_pkey_reg (), shadow_pkey_reg); -if (ret) { +if (ret >0 ) {/* clear both the bits: */ shadow_pkey_reg =set_pkey_bits (shadow_pkey_reg, ret, ~PKEY_MASK );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 777/800 selftests/vm/pkeys: refill shadow register after implicit kernel write
In reply to Greg Kroah-HartmanFrom: Dave Hansen <[email protected]>
[ Upstream commit 6039ca254979694c5362dfebadd105e286c397bb ]
The pkey test code keeps a "shadow" of the pkey register around. This ensures that any bugs which might write to the register can be caught more quickly.
Generally, userspace has a good idea when the kernel is going to write to the register. For instance, alloc_pkey() is passed a permission mask. The caller of alloc_pkey() can update the shadow based on the return value and the mask.
But, the kernel can also modify the pkey register in a more sneaky way. For mprotect(PROT_EXEC) mappings, the kernel will allocate a pkey and write the pkey register to create an execute-only mapping. The kernel never tells userspace what key it uses for this.
This can cause the test to fail with messages like:
protection_keys_64.2: pkey-helpers.h:132: _read_pkey_reg: Assertion `pkey_reg == shadow_pkey_reg' failed.
because the shadow was not updated with the new kernel-set value.
Forcibly update the shadow value immediately after an mprotect().
--- tools/testing/selftests/vm/protection_keys.c | 7 +++++++ 1 file changed, 7 insertions(+)
tools/testing/selftests/vm/protection_keys.c +7 -0
@@ -1448,6 +1448,13 @@ void test_implicit_mprotect_exec_only_memory(int *ptr, u16 pkey) ret =mprotect (p1,PAGE_SIZE ,PROT_EXEC );pkey_assert (!ret); +/* +* Reset the shadow, assuming that the above mprotect() +* correctly changed PKRU, but to an unknown value since +* the actual alllocated pkey is unknown. +*/ + shadow_pkey_reg =__read_pkey_reg (); +dprintf2 ("pkey_reg: %016llx\n" ,read_pkey_reg ());/* Make sure this is an *instruction* fault */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 778/800 perf llvm: Return -ENOMEM when asprintf() fails
In reply to Greg Kroah-HartmanFrom: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit c435c166dcf526ac827bc964d82cc0d5e7a1fd0b ]
Zhihao sent a patch but it made llvm__compile_bpf() return what asprintf() returns on error, which is just -1, but since this function returns -errno, fix it by returning -ENOMEM for this case instead.
--- tools/perf/util/llvm-utils.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/llvm-utils.c +2 -0
@@ -504,6 +504,7 @@ int llvm__compile_bpf(const char *path, void **p_obj_buf, goto errout; } + err = -ENOMEM ;if (asprintf (&pipe_template,"%s -emit-llvm | %s -march=bpf %s -filetype=obj -o -" , template, llc_path, opts) <0 ) {pr_err ("ERROR:\tnot enough memory to setup command line\n" );
@@ -524,6 +525,7 @@ int llvm__compile_bpf(const char *path, void **p_obj_buf,pr_debug ("llvm compiling command template: %s\n" , template); + err = -ENOMEM ;if (asprintf (&command_echo,"echo -n \"%s\"" , template) <0 ) goto errout;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 779/800 i2c: mpc: Restore reread of I2C status register
In reply to Greg Kroah-HartmanFrom: Chris Packham <[email protected]>
[ Upstream commit 763778cd79267dadf0ec7e044caf7563df0ab597 ]
Prior to commit 1538d82f4647 ("i2c: mpc: Interrupt driven transfer") the old interrupt handler would reread MPC_I2C_SR after checking the CSR_MIF bit. When the driver was re-written this was removed as it seemed unnecessary. However as it turns out this is necessary for i2c devices which do clock stretching otherwise we end up thinking the bus is still busy when processing the interrupt.
--- drivers/i2c/busses/i2c-mpc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/i2c/busses/i2c-mpc.c +2 -0
@@ -635,6 +635,8 @@ static irqreturn_t mpc_i2c_isr(int irq, void *dev_id) status =readb (i2c->base +MPC_I2C_SR );if (status &CSR_MIF ) { +/* Read again to allow register to stabilise */ + status =readb (i2c->base +MPC_I2C_SR );writeb (0 , i2c->base +MPC_I2C_SR );mpc_i2c_do_intr (i2c, status);return IRQ_HANDLED ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 780/800 csky: syscache: Fixup duplicate cache flush
In reply to Greg Kroah-HartmanFrom: Guo Ren <[email protected]>
[ Upstream commit 6ea42c84f33368eb3fe1ec1bff8d7cb1a5c7b07a ]
The current csky logic of sys_cacheflush is wrong, it'll cause icache flush call dcache flush again. Now fixup it with a conditional "break & fallthrough".
--- arch/csky/mm/syscache.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
arch/csky/mm/syscache.c +7 -5
@@ -12,15 +12,17 @@ SYSCALL_DEFINE3(cacheflush, int, cache) {switch (cache) { -case ICACHE :case BCACHE : -flush_icache_mm_range (current->mm, - (unsigned long )addr, - (unsigned long )addr + bytes); - fallthrough;case DCACHE :dcache_wb_range ((unsigned long )addr, (unsigned long )addr + bytes); +if (cache !=BCACHE ) +break ; + fallthrough; +case ICACHE : +flush_icache_mm_range (current->mm, + (unsigned long )addr, + (unsigned long )addr + bytes);break ;default :return -EINVAL ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 781/800 exfat: handle wrong stream entry size in exfat_readdir()
In reply to Greg Kroah-HartmanFrom: Namjae Jeon <[email protected]>
commit 1e5654de0f51890f88abd409ebf4867782431e81 upstream.
The compatibility issue between linux exfat and exfat of some camera company was reported from Florian. In their exfat, if the number of files exceeds any limit, the DataLength in stream entry of the directory is no longer updated. So some files created from camera does not show in linux exfat. because linux exfat doesn't allow that cpos becomes larger than DataLength of stream entry. This patch check DataLength in stream entry only if the type is ALLOC_NO_FAT_CHAIN and add the check ensure that dentry offset does not exceed max dentries size(256 MB) to avoid the circular FAT chain issue.
--- fs/exfat/dir.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/exfat/dir.c +5 -3
@@ -63,7 +63,7 @@ static void exfat_get_uniname_from_ext_estatic int exfat_readdir (struct inode *inode,loff_t *cpos,struct exfat_dir_entry *dir_entry) {int i, dentries_per_clu, dentries_per_clu_bits =0 , num_ext; -unsigned int type, clu_offset; +unsigned int type, clu_offset, max_dentries;sector_t sector;struct exfat_chain dir, clu;struct exfat_uni_name uni_name;
@@ -86,6 +86,8 @@ static int exfat_readdir(struct inode *i dentries_per_clu = sbi->dentries_per_clu; dentries_per_clu_bits =ilog2 (dentries_per_clu); + max_dentries = (unsigned int )min_t (u64,MAX_EXFAT_DENTRIES , + (u64 )sbi->num_clusters << dentries_per_clu_bits); clu_offset = dentry >> dentries_per_clu_bits;exfat_chain_dup (&clu, &dir);
@@ -109,7 +111,7 @@ static int exfat_readdir(struct inode *i } } -while (clu.dir !=EXFAT_EOF_CLUSTER ) { +while (clu.dir !=EXFAT_EOF_CLUSTER && dentry < max_dentries) { i = dentry & (dentries_per_clu -1 );for ( ; i < dentries_per_clu; i++, dentry++) {
@@ -245,7 +247,7 @@ static int exfat_iterate(struct file *fiif (err) goto unlock; get_new: -if (cpos >=i_size_read (inode)) +if (ei->flags ==ALLOC_NO_FAT_CHAIN && cpos >=i_size_read (inode)) goto end_of_dir; err =exfat_readdir (inode, &cpos, &de);
Greg Kroah-Hartman
maintainerPATCH 782/800 scsi: megaraid_sas: Send all non-RW I/Os for TYPE_ENCLOSURE device through firmware
In reply to Greg Kroah-HartmanFrom: Chandrakanth Patil <[email protected]>
commit 79db830162b733f5f3ee80f0673eeeb0245fe38b upstream.
The driver issues all non-ReadWrite I/Os for TYPE_ENCLOSURE devices through the fast path with invalid dev handle. Fast path in turn directs all the I/Os to the firmware. As firmware stopped handling those I/Os from SAS3.5 generation of controllers (Ventura generation and onwards) this will lead to I/O failures.
Switch the driver to issue all the non-ReadWrite I/Os for TYPE_ENCLOSURE devices directly to firmware for SAS3.5 generation of controllers and later.
--- drivers/scsi/megaraid/megaraid_sas_fusion.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/scsi/megaraid/megaraid_sas_fusion.c +8 -2
@@ -3203,6 +3203,8 @@ megasas_build_io_fusion(struct megasas_i {int sge_count;u8 cmd_type; +u16 pd_index =0 ; +u8 drive_type =0 ;struct MPI2_RAID_SCSI_IO_REQUEST *io_request = cmd->io_request;struct MR_PRIV_DEVICE *mr_device_priv_data; mr_device_priv_data = scp->device->hostdata;
@@ -3237,8 +3239,12 @@ megasas_build_io_fusion(struct megasas_imegasas_build_syspd_fusion (instance, scp, cmd, true);break ;case NON_READ_WRITE_SYSPDIO : -if (instance->secure_jbod_support || - mr_device_priv_data->is_tm_capable) + pd_index =MEGASAS_PD_INDEX (scp); + drive_type = instance->pd_list[pd_index].driveType; +if ((instance->secure_jbod_support || + mr_device_priv_data->is_tm_capable) || + (instance->adapter_type >=VENTURA_SERIES && + drive_type ==TYPE_ENCLOSURE ))megasas_build_syspd_fusion (instance, scp, cmd, false);else megasas_build_syspd_fusion (instance, scp, cmd, true);
Greg Kroah-Hartman
maintainerPATCH 783/800 scsi: fc: Correct RHBA attributes length
In reply to Greg Kroah-HartmanFrom: Javed Hasan <[email protected]>
commit 40445fd2c9fa427297acdfcc2c573ff10493f209 upstream.
As per the FC-GS-5 specification, attribute lengths of node_name and manufacturer should in range of "4 to 64 Bytes" only.
--- include/scsi/fc/fc_ms.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/scsi/fc/fc_ms.h +2 -2
@@ -63,8 +63,8 @@ enum fc_fdmi_hba_attr_type {* HBA Attribute Length */ #define FC_FDMI_HBA_ATTR_NODENAME_LEN 8 -#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 80 -#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 80 +#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 64 +#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 64#define FC_FDMI_HBA_ATTR_MODEL_LEN 256#define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 256#define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 256
Greg Kroah-Hartman
maintainerPATCH 784/800 scsi: target: cxgbit: Unmap DMA buffer before calling target_execute_cmd()
In reply to Greg Kroah-HartmanFrom: Varun Prakash <[email protected]>
commit 6ecdafaec79d4b3388a5b017245f23a0ff9d852d upstream.
Instead of calling dma_unmap_sg() after completing WRITE I/O, call dma_unmap_sg() before calling target_execute_cmd() to sync the DMA buffer.
--- drivers/target/iscsi/cxgbit/cxgbit_ddp.c | 19 ++++++++++--------- drivers/target/iscsi/cxgbit/cxgbit_target.c | 21 ++++++++++++++++++--- 2 files changed, 28 insertions(+), 12 deletions(-)
drivers/target/iscsi/cxgbit/cxgbit_ddp.c +10 -9
@@ -265,12 +265,13 @@ void cxgbit_unmap_cmd(struct iscsi_connstruct cxgbit_cmd *ccmd =iscsit_priv_cmd (cmd);if (ccmd->release) { -struct cxgbi_task_tag_info *ttinfo = &ccmd->ttinfo; - -if (ttinfo->sgl) { +if (cmd->se_cmd.se_cmd_flags &SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC ) { +put_page (sg_page (&ccmd->sg)); + }else {struct cxgbit_sock *csk = conn->context;struct cxgbit_device *cdev = csk->com.cdev;struct cxgbi_ppm *ppm =cdev2ppm (cdev); +struct cxgbi_task_tag_info *ttinfo = &ccmd->ttinfo;/* Abort the TCP conn if DDP is not complete to * avoid any possibility of DDP after freeing
@@ -280,14 +281,14 @@ void cxgbit_unmap_cmd(struct iscsi_conn cmd->se_cmd.data_length))cxgbit_abort_conn (csk); +if (unlikely (ttinfo->sgl)) { +dma_unmap_sg (&ppm->pdev->dev, ttinfo->sgl, + ttinfo->nents,DMA_FROM_DEVICE ); + ttinfo->nents =0 ; + ttinfo->sgl =NULL ; + }cxgbi_ppm_ppod_release (ppm, ttinfo->idx); - -dma_unmap_sg (&ppm->pdev->dev, ttinfo->sgl, - ttinfo->nents,DMA_FROM_DEVICE ); - }else { -put_page (sg_page (&ccmd->sg)); } - ccmd->release = false; } }
drivers/target/iscsi/cxgbit/cxgbit_target.c +18 -3
@@ -997,17 +997,18 @@ static int cxgbit_handle_iscsi_dataout(sstruct scatterlist *sg_start;struct iscsi_conn *conn = csk->conn;struct iscsi_cmd *cmd =NULL ; +struct cxgbit_cmd *ccmd; +struct cxgbi_task_tag_info *ttinfo;struct cxgbit_lro_pdu_cb *pdu_cb =cxgbit_rx_pdu_cb (csk->skb);struct iscsi_data *hdr = (struct iscsi_data *)pdu_cb->hdr;u32 data_offset =be32_to_cpu (hdr->offset); -u32 data_len = pdu_cb->dlen; +u32 data_len =ntoh24 (hdr->dlength);int rc, sg_nents, sg_off;bool dcrc_err = false;if (pdu_cb->flags &PDUCBF_RX_DDP_CMP ) {u32 offset =be32_to_cpu (hdr->offset);u32 ddp_data_len; -u32 payload_length =ntoh24 (hdr->dlength);bool success = false; cmd =iscsit_find_cmd_from_itt_or_dump (conn, hdr->itt,0 );
@@ -1022,7 +1023,7 @@ static int cxgbit_handle_iscsi_dataout(s cmd->data_sn =be32_to_cpu (hdr->datasn); rc =__iscsit_check_dataout_hdr (conn, (unsigned char *)hdr, - cmd, payload_length, &success); + cmd, data_len, &success);if (rc <0 )return rc;else if (!success)
@@ -1060,6 +1061,20 @@ static int cxgbit_handle_iscsi_dataout(scxgbit_skb_copy_to_sg (csk->skb, sg_start, sg_nents, skip); } + ccmd =iscsit_priv_cmd (cmd); + ttinfo = &ccmd->ttinfo; + +if (ccmd->release && ttinfo->sgl && + (cmd->se_cmd.data_length == (cmd->write_data_done + data_len))) { +struct cxgbit_device *cdev = csk->com.cdev; +struct cxgbi_ppm *ppm =cdev2ppm (cdev); + +dma_unmap_sg (&ppm->pdev->dev, ttinfo->sgl, ttinfo->nents, +DMA_FROM_DEVICE ); + ttinfo->nents =0 ; + ttinfo->sgl =NULL ; + } + check_payload: rc =iscsit_check_dataout_payload (cmd, hdr, dcrc_err);
Greg Kroah-Hartman
maintainerPATCH 785/800 scsi: lpfc: Fix unreleased RPIs when NPIV ports are created
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
commit 01131e7aae5d30e23e3cdd1eebe51bbc5489ae8f upstream.
While testing NPIV and watching logins and used RPI levels, it was seen the used RPI count was much higher than the number of remote ports discovered.
Code inspection showed that remote port removals on any NPIV instance are releasing the RPI, but not performing an UNREG_RPI with the adapter thus the reference counting never fully drops and the RPI is never fully released. This was happening on NPIV nodes due to a log of fabric ELS's to fabric addresses. This lack of UNREG_RPI was introduced by a prior node rework patch that performed the UNREG_RPI as part of node cleanup.
To resolve the issue, do the following:
- Restore the RPI release code, but move the location to so that it is in line with the new node cleanup design.
- NPIV ports now release the RPI and drop the node when the caller sets the NLP_RELEASE_RPI flag.
- Set the NLP_RELEASE_RPI flag in node cleanup which will trigger a release of RPI to free pool.
- Ensure there's an UNREG_RPI at LOGO completion so that RPI release is completed.
- Stop offline_prep from skipping nodes that are UNUSED. The RPI may not have been released.
- Stop the default RPI handling in lpfc_cmpl_els_rsp() for SLI4.
- Fixed up debugfs RPI displays for better debugging.
--- drivers/scsi/lpfc/lpfc_debugfs.c | 7 --- drivers/scsi/lpfc/lpfc_els.c | 79 +++++++++++++++++++++++++++++-------- drivers/scsi/lpfc/lpfc_hbadisc.c | 27 +++++++++++- drivers/scsi/lpfc/lpfc_init.c | 7 --- drivers/scsi/lpfc/lpfc_nportdisc.c | 25 +++++++---- drivers/scsi/lpfc/lpfc_sli.c | 10 +++- 6 files changed, 115 insertions(+), 40 deletions(-)
drivers/scsi/lpfc/lpfc_debugfs.c +2 -5
@@ -868,11 +868,8 @@ lpfc_debugfs_nodelist_data(struct lpfc_v len +=scnprintf (buf+len, size-len,"WWNN x%llx " ,wwn_to_u64 (ndlp->nlp_nodename.u.wwn)); -if (ndlp->nlp_flag &NLP_RPI_REGISTERED ) - len +=scnprintf (buf+len, size-len,"RPI:%04d " , - ndlp->nlp_rpi); -else - len +=scnprintf (buf+len, size-len,"RPI:none " ); + len +=scnprintf (buf+len, size-len,"RPI:x%04x " , + ndlp->nlp_rpi); len +=scnprintf (buf+len, size-len,"flag:x%08x " , ndlp->nlp_flag);if (!ndlp->nlp_type)
drivers/scsi/lpfc/lpfc_els.c +63 -16
145 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_hbadisc.c +25 -2
@@ -4789,12 +4789,17 @@ lpfc_nlp_logo_unreg(struct lpfc_hba *phb ndlp->nlp_defer_did =NLP_EVT_NOTHING_PENDING ;lpfc_issue_els_plogi (vport, ndlp->nlp_DID,0 ); }else { +/* NLP_RELEASE_RPI is only set for SLI4 ports. */ if (ndlp->nlp_flag &NLP_RELEASE_RPI ) {lpfc_sli4_free_rpi (vport->phba, ndlp->nlp_rpi); +spin_lock_irq (&ndlp->lock); ndlp->nlp_flag &= ~NLP_RELEASE_RPI ; ndlp->nlp_rpi =LPFC_RPI_ALLOC_ERROR ; +spin_unlock_irq (&ndlp->lock); } +spin_lock_irq (&ndlp->lock); ndlp->nlp_flag &= ~NLP_UNREG_INP ; +spin_unlock_irq (&ndlp->lock); } }
@@ -5129,8 +5134,10 @@ lpfc_cleanup_node(struct lpfc_vport *vpolist_del_init (&ndlp->dev_loss_evt.evt_listp);list_del_init (&ndlp->recovery_evt.evt_listp);lpfc_cleanup_vports_rrqs (vport, ndlp); +if (phba->sli_rev ==LPFC_SLI_REV4 ) ndlp->nlp_flag |=NLP_RELEASE_RPI ; +return 0 ; }
@@ -6176,8 +6183,23 @@ lpfc_nlp_release(struct kref *kref)lpfc_cancel_retry_delay_tmo (vport, ndlp);lpfc_cleanup_node (vport, ndlp); -/* Clear Node key fields to give other threads notice -* that this node memory is not valid anymore. +/* Not all ELS transactions have registered the RPI with the port. +* In these cases the rpi usage is temporary and the node is +* released when the WQE is completed. Catch this case to free the +* RPI to the pool. Because this node is in the release path, a lock +* is unnecessary. All references are gone and the node has been +* dequeued. +*/ +if (ndlp->nlp_flag &NLP_RELEASE_RPI ) { +if (ndlp->nlp_rpi !=LPFC_RPI_ALLOC_ERROR && + !(ndlp->nlp_flag & (NLP_RPI_REGISTERED |NLP_UNREG_INP ))) { +lpfc_sli4_free_rpi (vport->phba, ndlp->nlp_rpi); + ndlp->nlp_rpi =LPFC_RPI_ALLOC_ERROR ; + } + } + +/* The node is not freed back to memory, it is released to a pool so +* the node fields need to be cleaned up. */ ndlp->vport =NULL ; ndlp->nlp_state =NLP_STE_FREED_NODE ;
@@ -6257,6 +6279,7 @@ lpfc_nlp_not_used(struct lpfc_nodelist *"node not used: did:x%x flg:x%x refcnt:x%x" , ndlp->nlp_DID, ndlp->nlp_flag, kref_read(&ndlp->kref)); +if (kref_read (&ndlp->kref) ==1 )if (lpfc_nlp_put (ndlp))return 1 ;
drivers/scsi/lpfc/lpfc_init.c +0 -7
@@ -3532,13 +3532,6 @@ lpfc_offline_prep(struct lpfc_hba *phba,list_for_each_entry_safe (ndlp, next_ndlp, &vports[i]->fc_nodes, nlp_listp) { -if (ndlp->nlp_state ==NLP_STE_UNUSED_NODE ) { -/* Driver must assume RPI is invalid for -* any unused or inactive node. -*/ - ndlp->nlp_rpi =LPFC_RPI_ALLOC_ERROR ; -continue ; - }spin_lock_irq (&ndlp->lock); ndlp->nlp_flag &= ~NLP_NPR_ADISC ;
drivers/scsi/lpfc/lpfc_nportdisc.c +17 -8
@@ -567,15 +567,24 @@ lpfc_rcv_plogi(struct lpfc_vport *vport,/* no deferred ACC */ kfree (save_iocb); -/* In order to preserve RPIs, we want to cleanup -* the default RPI the firmware created to rcv -* this ELS request. The only way to do this is -* to register, then unregister the RPI. +/* This is an NPIV SLI4 instance that does not need to register +* a default RPI. */ -spin_lock_irq (&ndlp->lock); - ndlp->nlp_flag |= (NLP_RM_DFLT_RPI |NLP_ACC_REGLOGIN | -NLP_RCV_PLOGI ); -spin_unlock_irq (&ndlp->lock); +if (phba->sli_rev ==LPFC_SLI_REV4 ) { +mempool_free (login_mbox, phba->mbox_mem_pool); + login_mbox =NULL ; + }else { +/* In order to preserve RPIs, we want to cleanup +* the default RPI the firmware created to rcv +* this ELS request. The only way to do this is +* to register, then unregister the RPI. +*/ +spin_lock_irq (&ndlp->lock); + ndlp->nlp_flag |= (NLP_RM_DFLT_RPI |NLP_ACC_REGLOGIN | +NLP_RCV_PLOGI ); +spin_unlock_irq (&ndlp->lock); + } + stat.un.b.lsRjtRsnCode =LSRJT_INVALID_CMD ; stat.un.b.lsRjtRsnCodeExp =LSEXP_NOTHING_MORE ; rc = lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb,
drivers/scsi/lpfc/lpfc_sli.c +8 -2
@@ -13625,9 +13625,15 @@ lpfc_sli4_sp_handle_mbox_event(struct lpif (mcqe_status ==MB_CQE_STATUS_SUCCESS ) { mp = (struct lpfc_dmabuf *)(pmb->ctx_buf); ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; -/* Reg_LOGIN of dflt RPI was successful. Now lets get -* RID of the PPI using the same mbox buffer. + +/* Reg_LOGIN of dflt RPI was successful. Mark the +* node as having an UNREG_LOGIN in progress to stop +* an unsolicited PLOGI from the same NPortId from +* starting another mailbox transaction. */ +spin_lock_irqsave (&ndlp->lock, iflags); + ndlp->nlp_flag |=NLP_UNREG_INP ; +spin_unlock_irqrestore (&ndlp->lock, iflags);lpfc_unreg_login (phba, vport->vpi, pmbox->un.varWords[0 ], pmb); pmb->mbox_cmpl = lpfc_mbx_cmpl_dflt_rpi;
Greg Kroah-Hartman
maintainerPATCH 786/800 scsi: lpfc: Fix Node recovery when driver is handling simultaneous PLOGIs
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
commit 4012baeab6ca22b7f7beb121b6d0da0a62942fdd upstream.
When lpfc is handling a solicited and unsolicited PLOGI with another initiator, the remote initiator is never recovered. The node for the initiator is erroneouosly removed and all resources released.
In lpfc_cmpl_els_plogi(), when lpfc_els_retry() returns a failure code, the driver is calling the state machine with a device remove event because the remote port is not currently registered with the SCSI or NVMe transports. The issue is that on a PLOGI "collision" the driver correctly aborts the solicited PLOGI and allows the unsolicited PLOGI to complete the process, but this process is interrupted with a device_rm event.
Introduce logic in the PLOGI completion to capture the PLOGI collision event and jump out of the routine. This will avoid removal of the node. If there is no collision, the normal node removal will occur.
--- drivers/scsi/lpfc/lpfc_els.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +18 -3
@@ -1998,9 +1998,20 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phblpfc_disc_state_machine (vport, ndlp, cmdiocb,NLP_EVT_CMPL_PLOGI ); -/* As long as this node is not registered with the scsi or nvme -* transport, it is no longer an active node. Otherwise -* devloss handles the final cleanup. +/* If a PLOGI collision occurred, the node needs to continue +* with the reglogin process. +*/ +spin_lock_irq (&ndlp->lock); +if ((ndlp->nlp_flag & (NLP_ACC_REGLOGIN |NLP_RCV_PLOGI )) && + ndlp->nlp_state ==NLP_STE_REG_LOGIN_ISSUE ) { +spin_unlock_irq (&ndlp->lock); + goto out; + } +spin_unlock_irq (&ndlp->lock); + +/* No PLOGI collision and the node is not registered with the +* scsi or nvme transport. It is no longer an active node. Just +* start the device remove process. */ if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD |NVME_XPT_REGD ))) {spin_lock_irq (&ndlp->lock);
@@ -4620,6 +4631,10 @@ out: (vport && vport->port_type == LPFC_NPIV_PORT) && ndlp->nlp_flag & NLP_RELEASE_RPI) {lpfc_sli4_free_rpi (phba, ndlp->nlp_rpi); +spin_lock_irq (&ndlp->lock); + ndlp->nlp_rpi =LPFC_RPI_ALLOC_ERROR ; + ndlp->nlp_flag &= ~NLP_RELEASE_RPI ; +spin_unlock_irq (&ndlp->lock);lpfc_drop_node (vport, ndlp); }
Greg Kroah-Hartman
maintainerPATCH 787/800 scsi: libfc: Correct the condition check and invalid argument passed
In reply to Greg Kroah-HartmanFrom: Javed Hasan <[email protected]>
commit 8f70328c068f9f5c5db82848724cb276f657b9cd upstream.
Incorrect condition check was leading to data corruption.
--- drivers/scsi/libfc/fc_encode.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/scsi/libfc/fc_encode.h +5 -3
@@ -166,9 +166,11 @@ static inline int fc_ct_ns_fill(struct fstatic inline void fc_ct_ms_fill_attr (struct fc_fdmi_attr_entry *entry,const char *in,size_t len) { -int copied =strscpy (entry->value, in, len); -if (copied >0 ) -memset (entry->value, copied, len - copied); +int copied; + + copied =strscpy ((char *)&entry->value, in, len); +if (copied >0 && (copied +1 ) < len) +memset ((entry->value + copied +1 ),0 , len - copied -1 ); }/**
Greg Kroah-Hartman
maintainerPATCH 788/800 mailbox: qcom-ipcc: Fix IPCC mbox channel exhaustion
In reply to Greg Kroah-HartmanFrom: Sibi Sankar <[email protected]>
commit d6fbfdbc12745ce24bcd348dbf7e652353b3e59c upstream.
Fix IPCC (Inter-Processor Communication Controller) channel exhaustion by setting the channel private data to NULL on mbox shutdown.
Err Logs:
remoteproc: MBA booted without debug policy, loading mpss
remoteproc: glink-edge: failed to acquire IPC channel
remoteproc: failed to probe subdevices for remoteproc: -16
--- drivers/mailbox/qcom-ipcc.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/mailbox/qcom-ipcc.c +6 -0
@@ -155,6 +155,11 @@ static int qcom_ipcc_mbox_send_data(strureturn 0 ; } +static void qcom_ipcc_mbox_shutdown (struct mbox_chan *chan) +{ + chan->con_priv =NULL ; +} +static struct mbox_chan *qcom_ipcc_mbox_xlate (struct mbox_controller *mbox,const struct of_phandle_args *ph) {
@@ -184,6 +189,7 @@ static struct mbox_chan *qcom_ipcc_mbox_static const struct mbox_chan_ops ipcc_mbox_chan_ops = { .send_data = qcom_ipcc_mbox_send_data, + .shutdown = qcom_ipcc_mbox_shutdown, };static int qcom_ipcc_setup_mbox (struct qcom_ipcc *ipcc)
Greg Kroah-Hartman
maintainerPATCH 789/800 fscrypt: dont ignore minor_hash when hash is 0
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit 77f30bfcfcf484da7208affd6a9e63406420bf91 upstream.
When initializing a no-key name, fscrypt_fname_disk_to_usr() sets the minor_hash to 0 if the (major) hash is 0.
This doesn't make sense because 0 is a valid hash code, so we shouldn't ignore the filesystem-provided minor_hash in that case. Fix this by removing the special case for 'hash == 0'.
This is an old bug that appears to have originated when the encryption code in ext4 and f2fs was moved into fs/crypto/. The original ext4 and f2fs code passed the hash by pointer instead of by value. So 'if (hash)' actually made sense then, as it was checking whether a pointer was NULL. But now the hashes are passed by value, and filesystems just pass 0 for any hashes they don't have. There is no need to handle this any differently from the hashes actually being 0.
It is difficult to reproduce this bug, as it only made a difference in the case where a filename's 32-bit major hash happened to be 0. However, it probably had the largest chance of causing problems on ubifs, since ubifs uses minor_hash to do lookups of no-key names, in addition to using it as a readdir cookie. ext4 only uses minor_hash as a readdir cookie, and f2fs doesn't use minor_hash at all.
--- fs/crypto/fname.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
fs/crypto/fname.c +3 -7
@@ -344,13 +344,9 @@ int fscrypt_fname_disk_to_usr(const stru offsetof(struct fscrypt_nokey_name, sha256));BUILD_BUG_ON (BASE64_CHARS (FSCRYPT_NOKEY_NAME_MAX ) >NAME_MAX ); -if (hash) { - nokey_name.dirhash[0 ] = hash; - nokey_name.dirhash[1 ] = minor_hash; - }else { - nokey_name.dirhash[0 ] =0 ; - nokey_name.dirhash[1 ] =0 ; - } + nokey_name.dirhash[0 ] = hash; + nokey_name.dirhash[1 ] = minor_hash; +if (iname->len <=sizeof (nokey_name.bytes)) {memcpy (nokey_name.bytes, iname->name, iname->len); size = offsetof(struct fscrypt_nokey_name, bytes[iname->len]);
Greg Kroah-Hartman
maintainerPATCH 790/800 fscrypt: fix derivation of SipHash keys on big endian CPUs
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit 2fc2b430f559fdf32d5d1dd5ceaa40e12fb77bdf upstream.
Typically, the cryptographic APIs that fscrypt uses take keys as byte arrays, which avoids endianness issues. However, siphash_key_t is an exception. It is defined as 'u64 key[2];', i.e. the 128-bit key is expected to be given directly as two 64-bit words in CPU endianness.
fscrypt_derive_dirhash_key() and fscrypt_setup_iv_ino_lblk_32_key() forgot to take this into account. Therefore, the SipHash keys used to index encrypted+casefolded directories differ on big endian vs. little endian platforms, as do the SipHash keys used to hash inode numbers for IV_INO_LBLK_32-encrypted directories. This makes such directories non-portable between these platforms.
Fix this by always using the little endian order. This is a breaking change for big endian platforms, but this should be fine in practice since these features (encrypt+casefold support, and the IV_INO_LBLK_32 flag) aren't known to actually be used on any big endian platforms yet.
--- fs/crypto/keysetup.c | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-)
fs/crypto/keysetup.c +32 -8
@@ -210,15 +210,40 @@ out_unlock:return err; } +/* +* Derive a SipHash key from the given fscrypt master key and the given +* application-specific information string. +* +* Note that the KDF produces a byte array, but the SipHash APIs expect the key +* as a pair of 64-bit words. Therefore, on big endian CPUs we have to do an +* endianness swap in order to get the same results as on little endian CPUs. +*/ +static int fscrypt_derive_siphash_key (const struct fscrypt_master_key *mk, +u8 context,const u8 *info, +unsigned int infolen,siphash_key_t *key) +{ +int err; + + err =fscrypt_hkdf_expand (&mk->mk_secret.hkdf, context, info, infolen, + (u8 *)key,sizeof (*key)); +if (err) +return err; + +BUILD_BUG_ON (sizeof (*key) !=16 ); +BUILD_BUG_ON (ARRAY_SIZE (key->key) !=2 ); +le64_to_cpus (&key->key[0 ]); +le64_to_cpus (&key->key[1 ]); +return 0 ; +} +int fscrypt_derive_dirhash_key (struct fscrypt_info *ci,const struct fscrypt_master_key *mk) {int err; - err =fscrypt_hkdf_expand (&mk->mk_secret.hkdf,HKDF_CONTEXT_DIRHASH_KEY , - ci->ci_nonce,FSCRYPT_FILE_NONCE_SIZE , - (u8 *)&ci->ci_dirhash_key, -sizeof (ci->ci_dirhash_key)); + err =fscrypt_derive_siphash_key (mk,HKDF_CONTEXT_DIRHASH_KEY , + ci->ci_nonce,FSCRYPT_FILE_NONCE_SIZE , + &ci->ci_dirhash_key);if (err)return err; ci->ci_dirhash_key_initialized = true;
@@ -253,10 +278,9 @@ static int fscrypt_setup_iv_ino_lblk_32_if (mk->mk_ino_hash_key_initialized) goto unlock; - err =fscrypt_hkdf_expand (&mk->mk_secret.hkdf, -HKDF_CONTEXT_INODE_HASH_KEY ,NULL ,0 , - (u8 *)&mk->mk_ino_hash_key, -sizeof (mk->mk_ino_hash_key)); + err =fscrypt_derive_siphash_key (mk, +HKDF_CONTEXT_INODE_HASH_KEY , +NULL ,0 , &mk->mk_ino_hash_key);if (err) goto unlock;/* pairs with smp_load_acquire() above */
Greg Kroah-Hartman
maintainerPATCH 791/800 tpm: Replace WARN_ONCE() with dev_err_once() in tpm_tis_status()
In reply to Greg Kroah-HartmanFrom: Jarkko Sakkinen <[email protected]>
commit 0178f9d0f60ba07e09bab57381a3ef18e2c1fd7f upstream.
Do not tear down the system when getting invalid status from a TPM chip. This can happen when panic-on-warn is used.
Instead, introduce TPM_TIS_INVALID_STATUS bitflag and use it to trigger once the error reporting per chip. In addition, print out the value of TPM_STS for improved forensics.
--- drivers/char/tpm/tpm_tis_core.c | 25 ++++++++++++++++++------- drivers/char/tpm/tpm_tis_core.h | 3 ++- 2 files changed, 20 insertions(+), 8 deletions(-)
drivers/char/tpm/tpm_tis_core.c +18 -7
@@ -196,13 +196,24 @@ static u8 tpm_tis_status(struct tpm_chipreturn 0 ;if (unlikely ((status &TPM_STS_READ_ZERO ) !=0 )) { -/* -* If this trips, the chances are the read is -* returning 0xff because the locality hasn't been -* acquired. Usually because tpm_try_get_ops() hasn't -* been called before doing a TPM operation. -*/ -WARN_ONCE (1 ,"TPM returned invalid status\n" ); +if (!test_and_set_bit (TPM_TIS_INVALID_STATUS , &priv->flags)) { +/* +* If this trips, the chances are the read is +* returning 0xff because the locality hasn't been +* acquired. Usually because tpm_try_get_ops() hasn't +* been called before doing a TPM operation. +*/ +dev_err (&chip->dev,"invalid TPM_STS.x 0x%02x, dumping stack for forensics\n" , + status); + +/* +* Dump stack for forensics, as invalid TPM_STS.x could be +* potentially triggered by impaired tpm_try_get_ops() or +* tpm_find_get_ops(). +*/ +dump_stack (); + } +return 0 ; }
drivers/char/tpm/tpm_tis_core.h +2 -1
@@ -83,6 +83,7 @@ enum tis_defaults {enum tpm_tis_flags {TPM_TIS_ITPM_WORKAROUND =BIT (0 ), +TPM_TIS_INVALID_STATUS =BIT (1 ), };struct tpm_tis_data {
@@ -90,7 +91,7 @@ struct tpm_tis_data {int locality;int irq;bool irq_tested; -unsigned int flags; +unsigned long flags;void __iomem *ilb_base_addr;u16 clkrun_enabled;wait_queue_head_t int_queue;
Greg Kroah-Hartman
maintainerPATCH 792/800 erofs: fix error return code in erofs_read_superblock()
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
commit 0508c1ad0f264a24c4643701823a45f6c9bd8146 upstream.
'ret' will be overwritten to 0 if erofs_sb_has_sb_chksum() return true, thus 0 will return in some error handling cases. Fix to return negative error code -EINVAL instead of 0.
--- fs/erofs/super.c | 1 + 1 file changed, 1 insertion(+)
fs/erofs/super.c +1 -0
@@ -285,6 +285,7 @@ static int erofs_read_superblock(struct goto out; } + ret = -EINVAL ; blkszbits = dsb->blkszbits;/* 9(512 bytes) + LOG_SECTORS_PER_BLOCK == LOG_BLOCK_SIZE */ if (blkszbits !=LOG_BLOCK_SIZE ) {
Greg Kroah-Hartman
maintainerPATCH 793/800 block: return the correct bvec when checking for gaps
In reply to Greg Kroah-HartmanFrom: Long Li <[email protected]>
commit c9c9762d4d44dcb1b2ba90cfb4122dc11ceebf31 upstream.
After commit 07173c3ec276 ("block: enable multipage bvecs"), a bvec can have multiple pages. But bio_will_gap() still assumes one page bvec while checking for merging. If the pages in the bvec go across the seg_boundary_mask, this check for merging can potentially succeed if only the 1st page is tested, and can fail if all the pages are tested.
Later, when SCSI builds the SG list the same check for merging is done in __blk_segment_map_sg_merge() with all the pages in the bvec tested. This time the check may fail if the pages in bvec go across the seg_boundary_mask (but tested okay in bio_will_gap() earlier, so those BIOs were merged). If this check fails, we end up with a broken SG list for drivers assuming the SG list not having offsets in intermediate pages. This results in incorrect pages written to the disk.
Fix this by returning the multi-page bvec when testing gaps for merging.
--- include/linux/bio.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
include/linux/bio.h +4 -8
@@ -44,9 +44,6 @@ static inline unsigned int bio_max_segs(#define bio_offset (bio) bio_iter_offset((bio), (bio)->bi_iter)#define bio_iovec (bio) bio_iter_iovec((bio), (bio)->bi_iter) -#define bio_multiple_segments (bio) \ - ((bio)->bi_iter.bi_size != bio_iovec(bio).bv_len) -#define bvec_iter_sectors (iter) ((iter).bi_size >> 9)#define bvec_iter_end_sector (iter) ((iter).bi_sector + bvec_iter_sectors((iter)))
@@ -271,7 +268,7 @@ static inline void bio_clear_flag(structstatic inline void bio_get_first_bvec (struct bio *bio,struct bio_vec *bv) { - *bv =bio_iovec (bio); + *bv =mp_bvec_iter_bvec (bio->bi_io_vec, bio->bi_iter); }static inline void bio_get_last_bvec (struct bio *bio,struct bio_vec *bv)
@@ -279,10 +276,9 @@ static inline void bio_get_last_bvec(strstruct bvec_iter iter = bio->bi_iter;int idx; -if (unlikely (!bio_multiple_segments (bio))) { - *bv =bio_iovec (bio); -return ; - } +bio_get_first_bvec (bio, bv); +if (bv->bv_len == bio->bi_iter.bi_size) +return ;/* this bio only has a single bvec */ bio_advance_iter (bio, &iter, iter.bi_size);
Greg Kroah-Hartman
maintainerPATCH 794/800 io_uring: fix blocking inline submission
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
commit 976517f162a05f4315b2373fd11585c395506259 upstream.
There is a complaint against sys_io_uring_enter() blocking if it submits stdin reads. The problem is in __io_file_supports_async(), which sees that it's a cdev and allows it to be processed inline.
Punt char devices using generic rules of io_file_supports_async(), including checking for presence of *_iter() versions of rw callbacks. Apparently, it will affect most of cdevs with some exceptions like null and zero devices.
--- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/io_uring.c +1 -1
@@ -2621,7 +2621,7 @@ static bool __io_file_supports_async(strreturn true;return false; } -if (S_ISCHR (mode) ||S_ISSOCK (mode)) +if (S_ISSOCK (mode))return true;if (S_ISREG (mode)) { if (IS_ENABLED(CONFIG_BLOCK) &&
Greg Kroah-Hartman
maintainerPATCH 795/800 io_uring: add IOPOLL and reserved field checks to IORING_OP_RENAMEAT
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
commit ed7eb2592286ead7d3bfdf8adf65e65392167cc4 upstream.
We can't support IOPOLL with non-pollable request types, and we should check for unused/reserved fields like we do for other request types.
--- fs/io_uring.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/io_uring.c +4 -0
@@ -3453,6 +3453,10 @@ static int io_renameat_prep(struct io_kistruct io_rename *ren = &req->rename;const char __user *oldf, *newf; +if (unlikely (req->ctx->flags &IORING_SETUP_IOPOLL )) +return -EINVAL ; +if (sqe->ioprio || sqe->buf_index) +return -EINVAL ;if (unlikely (req->flags &REQ_F_FIXED_FILE ))return -EBADF ;
Greg Kroah-Hartman
maintainerPATCH 796/800 io_uring: add IOPOLL and reserved field checks to IORING_OP_UNLINKAT
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
commit 22634bc5620d29765e5199c7b230a372c7ddcda2 upstream.
We can't support IOPOLL with non-pollable request types, and we should check for unused/reserved fields like we do for other request types.
--- fs/io_uring.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/io_uring.c +4 -0
@@ -3504,6 +3504,10 @@ static int io_unlinkat_prep(struct io_kistruct io_unlink *un = &req->unlink;const char __user *fname; +if (unlikely (req->ctx->flags &IORING_SETUP_IOPOLL )) +return -EINVAL ; +if (sqe->ioprio || sqe->off || sqe->len || sqe->buf_index) +return -EINVAL ;if (unlikely (req->flags &REQ_F_FIXED_FILE ))return -EBADF ;
Greg Kroah-Hartman
maintainerPATCH 797/800 mmc: block: Disable CMDQ on the ioctl path
In reply to Greg Kroah-HartmanFrom: Bean Huo <[email protected]>
commit 70b52f09080565030a530a784f1c9948a7f48ca3 upstream.
According to the eMMC Spec:
"When command queuing is enabled (CMDQ Mode En bit in CMDQ_MODE_EN field is set to ‘1’) class 11 commands are the only method through which data transfer tasks can be issued. Existing data transfer commands, namely CMD18/CMD17 and CMD25/CMD24, are not supported when command queuing is enabled."
which means if CMDQ is enabled, the FFU commands will not be supported. To fix this issue, just simply disable CMDQ on the ioctl path, and re-enable CMDQ once ioctl request is completed.
--- drivers/mmc/core/block.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/mmc/core/block.c +8 -0
@@ -1004,6 +1004,12 @@ static void mmc_blk_issue_drv_op(structswitch (mq_rq->drv_op) {case MMC_DRV_OP_IOCTL : +if (card->ext_csd.cmdq_en) { + ret =mmc_cmdq_disable (card); +if (ret) +break ; + } + fallthrough;case MMC_DRV_OP_IOCTL_RPMB : idata = mq_rq->drv_op_data;for (i =0 , ret =0 ; i < mq_rq->ioc_count; i++) {
@@ -1014,6 +1020,8 @@ static void mmc_blk_issue_drv_op(struct/* Always switch back to main area after RPMB access */ if (rpmb_ioctl)mmc_blk_part_switch (card,0 ); +else if (card->reenable_cmdq && !card->ext_csd.cmdq_en) +mmc_cmdq_enable (card);break ;case MMC_DRV_OP_BOOT_WP : ret = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BOOT_WP,
Greg Kroah-Hartman
maintainerPATCH 798/800 mmc: vub3000: fix control-request direction
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 3c0bb3107703d2c58f7a0a7a2060bb57bc120326 upstream.
The direction of the pipe argument must match the request-type direction bit or control requests may fail depending on the host-controller-driver implementation.
Fix the SET_ROM_WAIT_STATES request which erroneously used usb_rcvctrlpipe().
--- drivers/mmc/host/vub300.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/vub300.c +1 -1
@@ -2279,7 +2279,7 @@ static int vub300_probe(struct usb_interif (retval <0 ) goto error5; retval = -usb_control_msg (vub300->udev,usb_rcvctrlpipe (vub300->udev,0 ), +usb_control_msg (vub300->udev,usb_sndctrlpipe (vub300->udev,0 ),SET_ROM_WAIT_STATES ,USB_DIR_OUT |USB_TYPE_VENDOR |USB_RECIP_DEVICE , firmware_rom_wait_states,0x0000 ,NULL ,0 ,HZ );
Greg Kroah-Hartman
maintainerPATCH 799/800 media: exynos4-is: remove a now unused integer
In reply to Greg Kroah-HartmanFrom: Mauro Carvalho Chehab <[email protected]>
commit 29dd19e3ac7b2a8671ebeac02859232ce0e34f58 upstream.
The usage of pm_runtime_resume_and_get() removed the need of a temporary integer. So, drop it.
--- drivers/media/platform/exynos4-is/media-dev.c | 1 - 1 file changed, 1 deletion(-)
drivers/media/platform/exynos4-is/media-dev.c +0 -1
@@ -1284,7 +1284,6 @@ static DEVICE_ATTR(subdev_conf_mode, S_Istatic int cam_clk_prepare (struct clk_hw *hw) {struct cam_clk *camclk =to_cam_clk (hw); -int ret;if (camclk->fmd->pmf ==NULL )return -ENODEV ;
Greg Kroah-Hartman
maintainerPATCH 800/800 scsi: core: Retry I/O for Notify (Enable Spinup) Required error
In reply to Greg Kroah-HartmanFrom: Quat Le <[email protected]>
commit 104739aca4488909175e9e31d5cd7d75b82a2046 upstream.
If the device is power-cycled, it takes time for the initiator to transmit the periodic NOTIFY (ENABLE SPINUP) SAS primitive, and for the device to respond to the primitive to become ACTIVE. Retry the I/O request to allow the device time to become ACTIVE.
--- drivers/scsi/scsi_lib.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/scsi_lib.c +1 -0
@@ -728,6 +728,7 @@ static void scsi_io_completion_action(stcase 0x07 :/* operation in progress */ case 0x08 :/* Long write in progress */ case 0x09 :/* self test in progress */ +case 0x11 :/* notify (enable spinup) required */ case 0x14 :/* space allocation in progress */ case 0x1a :/* start stop unit in progress */ case 0x1b :/* sanitize in progress */
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.2 release. There are 800 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 Wed, 14 Jul 2021 06:02:46 +0000. 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.13.2-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.13.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.13:
10 builds: 10 pass, 0 fail
28 boots: 28 pass, 0 fail
104 tests: 104 pass, 0 failLinux version: 5.13.2-rc1-ge75ae70be576
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.2 release. There are 800 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 Wed, 14 Jul 2021 06:02:46 +0000. 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.13.2-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.13.y
and the diffstat can be found below.thanks,
greg k-h
5.13.2-rc1 Successfully Compiled and booted on my Raspberry PI 4b (8g) (bcm2711)
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.2 release. There are 800 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 Wed, 14 Jul 2021 06:02:46 +0000. 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.13.2-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.13.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB, using 32-bit and 64-bit ARM kernels:
Signature · 1 line
Florian
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.2 release. There are 800 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 Wed, 14 Jul 2021 06:02:46 +0000. Anything received after that time might be too late.
Build results:
total: 154 pass: 152 fail: 2
Failed builds:
riscv32:allmodconfig
riscv:allmodconfig
Qemu test results:
total: 462 pass: 462 fail: 0
riscv build failures as before, inherited from mainline.
Error log:
cc1: error: '5904' is not a valid offset in '-mstack-protector-guard-offset='
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.2 release. There are 800 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 Wed, 14 Jul 2021 06:02:46 +0000. 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.13.2-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.13.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.2 release. There are 800 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 Wed, 14 Jul 2021 06:02:46 +0000. 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.13.2-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.13.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.
## Build
* kernel: 5.13.2-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git branch: linux-5.13.y
* git commit: 949241ad55a91465aea61c7afa51c1ec7540d5d7
* git describe: v5.13.1-805-g949241ad55a9
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.13.y/build/v5.13.1-805-g949241ad55a9
## No regressions (compared to v5.13.1-800-g0e69649203d5)
## No fixes (compared to v5.13.1-800-g0e69649203d5)
## Test result summary
total: 84521, pass: 69640, fail: 1673, skip: 12072, xfail: 1136,
## Build Summary
* arc: 10 total, 10 passed, 0 failed
* arm: 193 total, 193 passed, 0 failed
* arm64: 27 total, 27 passed, 0 failed
* dragonboard-410c: 1 total, 1 passed, 0 failed
* hi6220-hikey: 1 total, 1 passed, 0 failed
* i386: 26 total, 26 passed, 0 failed
* juno-r2: 1 total, 1 passed, 0 failed
* mips: 45 total, 45 passed, 0 failed
* parisc: 9 total, 9 passed, 0 failed
* powerpc: 27 total, 27 passed, 0 failed
* riscv: 21 total, 21 passed, 0 failed
* s390: 18 total, 18 passed, 0 failed
* sh: 18 total, 18 passed, 0 failed
* sparc: 9 total, 9 passed, 0 failed
* x15: 1 total, 0 passed, 1 failed
* x86: 1 total, 1 passed, 0 failed
* x86_64: 27 total, 27 passed, 0 failed
## Test suites summary
* fwts
* igt-gpu-tools
* install-android-platform-tools-r2600
* kselftest-
* kselftest-android
* kselftest-bpf
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-lkdtm
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-vm
* kselftest-vsyscall-mode-native-
* kselftest-vsyscall-mode-none-
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-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-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-tracing-tests
* network-basic-tests
* packetdrill
* perf
* rcutorture
* v4l2-compliance
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.2 release. There are 800 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 Wed, 14 Jul 2021 06:02:46 +0000. 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.13.2-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.13.y
and the diffstat can be found below.thanks,
greg k-h
Tested rc1 minus the offending patch against the Fedora build system (aarch64, armv7, ppc64le, s390x, x86_64), and boot tested x86_64. No regressions noted.
Hello,
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.2 release. There are 800 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 Wed, 14 Jul 2021 06:02:46 +0000. Anything received after that time might be too late.
With this my system no longer boots:
[ OK ] Reached target Swap.
[ 75.213852] NMI watchdog: Watchdog detected hard LOCKUP on cpu 0
[ 75.213926] NMI watchdog: Watchdog detected hard LOCKUP on cpu 2
[ 75.213962] NMI watchdog: Watchdog detected hard LOCKUP on cpu 4
[FAILED] Failed to start Wait for udev To Complete Device Initialization.
See 'systemctl status systemd-udev-settle.service' for details.
Starting Activation of DM RAID sets...
[ ] (1 of 2) A start job is running for Activation of DM RAID sets (..min ..s / no limit)
[ ] (2 of 2) A start job is running for Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling (..min ..s / no limit)System is a Fedora 34 with all updates applied. Two other similar systems with AMD CPUs (Ryzen 4750G + 3400G) this does not happen and boots fine. The system where it does not boot has an Intel Xeon E3-1285L v4 CPU. All of them use a dm_crypt root filesystem.
Any idea which patch I should drop to see if it boots again. I already dropped
[PATCH 5.13 743/800] ASoC: Intel: sof_sdw: add quirk support for Brya and BT-offload
and I just see that this one should also be dropped:
[PATCH 5.13 768/800] hugetlb: address ref count racing in prep_compound_gigantic_page
Will still need to test this.
Holger
Greg Kroah-Hartman
maintainerQuoted 32 lines · Holger Kiehl
Hello,
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.2 release. There are 800 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 Wed, 14 Jul 2021 06:02:46 +0000. Anything received after that time might be too late.
With this my system no longer boots:
[ OK ] Reached target Swap.
[ 75.213852] NMI watchdog: Watchdog detected hard LOCKUP on cpu 0 [ 75.213926] NMI watchdog: Watchdog detected hard LOCKUP on cpu 2 [ 75.213962] NMI watchdog: Watchdog detected hard LOCKUP on cpu 4 [FAILED] Failed to start Wait for udev To Complete Device Initialization. See 'systemctl status systemd-udev-settle.service' for details. Starting Activation of DM RAID sets... [ ] (1 of 2) A start job is running for Activation of DM RAID sets (..min ..s / no limit) [ ] (2 of 2) A start job is running for Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling (..min ..s / no limit)System is a Fedora 34 with all updates applied. Two other similar systems with AMD CPUs (Ryzen 4750G + 3400G) this does not happen and boots fine. The system where it does not boot has an Intel Xeon E3-1285L v4 CPU. All of them use a
dm_cryptroot filesystem.Any idea which patch I should drop to see if it boots again. I already dropped
Quoted 7 lines
[PATCH 5.13 743/800] ASoC: Intel:
sof_sdw: add quirk support for Brya and BT-offloadand I just see that this one should also be dropped:
[PATCH 5.13 768/800] hugetlb: address ref count racing in
prep_compound_gigantic_pageWill still need to test this.
Can you run 'git bisect' to see what commit causes the problem?
thanks,
greg k-h
Quoted 35 lines · Greg Kroah-Hartman
Quoted 34 lines · Holger Kiehl
Hello,
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.2 release. There are 800 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 Wed, 14 Jul 2021 06:02:46 +0000. Anything received after that time might be too late.
With this my system no longer boots:
[ OK ] Reached target Swap.
[ 75.213852] NMI watchdog: Watchdog detected hard LOCKUP on cpu 0 [ 75.213926] NMI watchdog: Watchdog detected hard LOCKUP on cpu 2 [ 75.213962] NMI watchdog: Watchdog detected hard LOCKUP on cpu 4 [FAILED] Failed to start Wait for udev To Complete Device Initialization. See 'systemctl status systemd-udev-settle.service' for details. Starting Activation of DM RAID sets... [ ] (1 of 2) A start job is running for Activation of DM RAID sets (..min ..s / no limit) [ ] (2 of 2) A start job is running for Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling (..min ..s / no limit)System is a Fedora 34 with all updates applied. Two other similar systems with AMD CPUs (Ryzen 4750G + 3400G) this does not happen and boots fine. The system where it does not boot has an Intel Xeon E3-1285L v4 CPU. All of them use a
dm_cryptroot filesystem.Any idea which patch I should drop to see if it boots again. I already dropped
[PATCH 5.13 743/800] ASoC: Intel:
sof_sdw: add quirk support for Brya and BT-offload
Quoted 8 lines
Quoted 5 lines
and I just see that this one should also be dropped:
[PATCH 5.13 768/800] hugetlb: address ref count racing in
prep_compound_gigantic_pageWill still need to test this.
Can you run 'git bisect' to see what commit causes the problem?
Yes, will try to do that. I think it will take some time ...
Holger
Quoted 39 lines · Holger Kiehl
Quoted 37 lines · Greg Kroah-Hartman
Quoted 36 lines · Holger Kiehl
Hello,
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.2 release. There are 800 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 Wed, 14 Jul 2021 06:02:46 +0000. Anything received after that time might be too late.
With this my system no longer boots:
[ OK ] Reached target Swap.
[ 75.213852] NMI watchdog: Watchdog detected hard LOCKUP on cpu 0 [ 75.213926] NMI watchdog: Watchdog detected hard LOCKUP on cpu 2 [ 75.213962] NMI watchdog: Watchdog detected hard LOCKUP on cpu 4 [FAILED] Failed to start Wait for udev To Complete Device Initialization. See 'systemctl status systemd-udev-settle.service' for details. Starting Activation of DM RAID sets... [ ] (1 of 2) A start job is running for Activation of DM RAID sets (..min ..s / no limit) [ ] (2 of 2) A start job is running for Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling (..min ..s / no limit)System is a Fedora 34 with all updates applied. Two other similar systems with AMD CPUs (Ryzen 4750G + 3400G) this does not happen and boots fine. The system where it does not boot has an Intel Xeon E3-1285L v4 CPU. All of them use a
dm_cryptroot filesystem.Any idea which patch I should drop to see if it boots again. I already dropped
[PATCH 5.13 743/800] ASoC: Intel:
sof_sdw: add quirk support for Brya and BT-offloadand I just see that this one should also be dropped:
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
[PATCH 5.13 768/800] hugetlb: address ref count racing in
prep_compound_gigantic_pageWill still need to test this.
Can you run 'git bisect' to see what commit causes the problem?
Yes, will try to do that. I think it will take some time ...
Hmm, I am doing something wrong?
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.13.y cd linux-5.13.y/
git tag|grep v5.13
v5.13
v5.13-rc1
v5.13-rc2
v5.13-rc3
v5.13-rc4
v5.13-rc5
v5.13-rc6
v5.13-rc7
v5.13.1
There is no v5.13.2-rc1. It is my first time with 'git bisect'. Must be doing something wrong. How can I get the correct git kernel rc version?
Holger
Quoted 3 lines · Holger Kiehl
Quoted 2 lines
Yes, will try to do that. I think it will take some time ...
Hmm, I am doing something wrong?
No, you are not: -rcs are not tagged.
Quoted 13 lines
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.13.y
cd linux-5.13.y/
git tag|grep v5.13
v5.13
v5.13-rc1
v5.13-rc2
v5.13-rc3
v5.13-rc4
v5.13-rc5
v5.13-rc6
v5.13-rc7
v5.13.1Quoted 2 lines
There is no v5.13.2-rc1. It is my first time with 'git bisect'. Must be doing something wrong. How can I get the correct git kernel rc version?
So just bisect v5.13.1..linux-5.13.y.
regards,
Signature · 2 lines
js suse labs
Quoted 22 lines · Jiri Slaby
Quoted 3 lines · Holger Kiehl
Quoted 2 lines
Yes, will try to do that. I think it will take some time ...
Hmm, I am doing something wrong?
No, you are not: -rcs are not tagged.
Quoted 15 lines
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.13.y cd linux-5.13.y/ git tag|grep v5.13 v5.13 v5.13-rc1 v5.13-rc2 v5.13-rc3 v5.13-rc4 v5.13-rc5 v5.13-rc6 v5.13-rc7 v5.13.1
Quoted 5 lines
Quoted 2 lines
There is no v5.13.2-rc1. It is my first time with 'git bisect'. Must be doing something wrong. How can I get the correct git kernel rc version?
So just bisect v5.13.1..linux-5.13.y.
But what do I say for bad?
git bisect bad linux-5.13.y
error: Bad rev input: linux-5.13.y
Just saying:
git bisect bad
git bisect good v5.13.1
Bisecting: a merge base must be tested [62fb9874f5da54fdb243003b386128037319b219] Linux 5.13
If I read this correctly it now set v5.13 as bad and v5.13.1 as good. How to set the correct bad?
Holger
Hi!
Quoted 35 lines
Quoted 23 lines · Holger Kiehl
Quoted 3 lines
Quoted 2 lines
Yes, will try to do that. I think it will take some time ...
Hmm, I am doing something wrong?
No, you are not: -rcs are not tagged.
Quoted 15 lines
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.13.y cd linux-5.13.y/ git tag|grep v5.13 v5.13 v5.13-rc1 v5.13-rc2 v5.13-rc3 v5.13-rc4 v5.13-rc5 v5.13-rc6 v5.13-rc7 v5.13.1Quoted 5 lines
Quoted 2 lines
There is no v5.13.2-rc1. It is my first time with 'git bisect'. Must be doing something wrong. How can I get the correct git kernel rc version?
So just bisect v5.13.1..linux-5.13.y.
But what do I say for bad?
git bisect bad linux-5.13.y
error: Bad rev input: linux-5.13.yJust saying:
Quoted 7 lines
git bisect bad
git bisect good v5.13.1
Bisecting: a merge base must be tested [62fb9874f5da54fdb243003b386128037319b219] Linux 5.13If I read this correctly it now set v5.13 as bad and v5.13.1 as good. How to set the correct bad?
You can use hashes instead of symbolic revisions, and that may be easier. I suspect you want to say "git bisect bad origin/linux-5.13.y". You can also just do git show and note the hash.
There's other option: git bisect can be quite confusing, but you are searching for a bug in linear history, so you can just git log --pretty=oneline into a file, then do the binary search manually. Should be 10 steps or so...
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Quoted 44 lines · Pavel Machek
Hi!
Quoted 35 lines
Quoted 23 lines · Holger Kiehl
Quoted 3 lines
Quoted 2 lines
Yes, will try to do that. I think it will take some time ...
Hmm, I am doing something wrong?
No, you are not: -rcs are not tagged.
Quoted 15 lines
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.13.y cd linux-5.13.y/ git tag|grep v5.13 v5.13 v5.13-rc1 v5.13-rc2 v5.13-rc3 v5.13-rc4 v5.13-rc5 v5.13-rc6 v5.13-rc7 v5.13.1Quoted 5 lines
Quoted 2 lines
There is no v5.13.2-rc1. It is my first time with 'git bisect'. Must be doing something wrong. How can I get the correct git kernel rc version?
So just bisect v5.13.1..linux-5.13.y.
But what do I say for bad?
git bisect bad linux-5.13.y
error: Bad rev input: linux-5.13.yJust saying:
Quoted 7 lines
git bisect bad
git bisect good v5.13.1
Bisecting: a merge base must be tested [62fb9874f5da54fdb243003b386128037319b219] Linux 5.13If I read this correctly it now set v5.13 as bad and v5.13.1 as good. How to set the correct bad?
Quoted 9 lines
You can use hashes instead of symbolic revisions, and that may be easier. I suspect you want to say "git bisect bad origin/linux-5.13.y". You can also just do git show and note the hash.
There's other option: git bisect can be quite confusing, but you are searching for a bug in linear history, so you can just git log --pretty=oneline into a file, then do the binary search manually. Should be 10 steps or so...
Thanks! That 'git bisect bad origin/linux-5.13.y' got me going!
Holger
Holger Kiehl
Acked-by Paolo ValenteQuoted 39 lines · Holger Kiehl
Quoted 37 lines · Greg Kroah-Hartman
Quoted 36 lines · Holger Kiehl
Hello,
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.2 release. There are 800 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 Wed, 14 Jul 2021 06:02:46 +0000. Anything received after that time might be too late.
With this my system no longer boots:
[ OK ] Reached target Swap.
[ 75.213852] NMI watchdog: Watchdog detected hard LOCKUP on cpu 0 [ 75.213926] NMI watchdog: Watchdog detected hard LOCKUP on cpu 2 [ 75.213962] NMI watchdog: Watchdog detected hard LOCKUP on cpu 4 [FAILED] Failed to start Wait for udev To Complete Device Initialization. See 'systemctl status systemd-udev-settle.service' for details. Starting Activation of DM RAID sets... [ ] (1 of 2) A start job is running for Activation of DM RAID sets (..min ..s / no limit) [ ] (2 of 2) A start job is running for Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling (..min ..s / no limit)System is a Fedora 34 with all updates applied. Two other similar systems with AMD CPUs (Ryzen 4750G + 3400G) this does not happen and boots fine. The system where it does not boot has an Intel Xeon E3-1285L v4 CPU. All of them use a
dm_cryptroot filesystem.Any idea which patch I should drop to see if it boots again. I already dropped
[PATCH 5.13 743/800] ASoC: Intel:
sof_sdw: add quirk support for Brya and BT-offloadand I just see that this one should also be dropped:
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
[PATCH 5.13 768/800] hugetlb: address ref count racing in
prep_compound_gigantic_pageWill still need to test this.
Can you run 'git bisect' to see what commit causes the problem?
Yes, will try to do that. I think it will take some time ...
With the help of Pavel Machek and Jiri Slaby I was able 'git bisect' this to:
yoda:/usr/src/kernels/linux-5.13.y# git bisect good a483f513670541227e6a31ac7141826b8c785842 is the first bad commit commit a483f513670541227e6a31ac7141826b8c785842 Author: Jan Kara <[email protected]> Date: Wed Jun 23 11:36:33 2021 +0200
bfq: Remove merged request already in bfq_requests_merged()
[ Upstream commit a921c655f2033dd1ce1379128efe881dda23ea37 ]
Currently, bfq does very little in bfq_requests_merged() and handles all the request cleanup in bfq_finish_requeue_request() called from blk_mq_free_request(). That is currently safe only because blk_mq_free_request() is called shortly after bfq_requests_merged() while bfqd->lock is still held. However to fix a lock inversion between bfqd->lock and ioc->lock, we need to call blk_mq_free_request() after dropping bfqd->lock. That would mean that already merged request could be seen by other processes inside bfq queues and possibly dispatched to the device which is wrong. So move cleanup of the request from bfq_finish_requeue_request() to bfq_requests_merged().
block/bfq-iosched.c | 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-)
Holger
Greg Kroah-Hartman
maintainerQuoted 79 lines · Holger Kiehl
Quoted 39 lines · Holger Kiehl
Quoted 37 lines · Greg Kroah-Hartman
Quoted 36 lines · Holger Kiehl
Hello,
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.2 release. There are 800 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 Wed, 14 Jul 2021 06:02:46 +0000. Anything received after that time might be too late.
With this my system no longer boots:
[ OK ] Reached target Swap.
[ 75.213852] NMI watchdog: Watchdog detected hard LOCKUP on cpu 0 [ 75.213926] NMI watchdog: Watchdog detected hard LOCKUP on cpu 2 [ 75.213962] NMI watchdog: Watchdog detected hard LOCKUP on cpu 4 [FAILED] Failed to start Wait for udev To Complete Device Initialization. See 'systemctl status systemd-udev-settle.service' for details. Starting Activation of DM RAID sets... [ ] (1 of 2) A start job is running for Activation of DM RAID sets (..min ..s / no limit) [ ] (2 of 2) A start job is running for Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling (..min ..s / no limit)System is a Fedora 34 with all updates applied. Two other similar systems with AMD CPUs (Ryzen 4750G + 3400G) this does not happen and boots fine. The system where it does not boot has an Intel Xeon E3-1285L v4 CPU. All of them use a
dm_cryptroot filesystem.Any idea which patch I should drop to see if it boots again. I already dropped
[PATCH 5.13 743/800] ASoC: Intel:
sof_sdw: add quirk support for Brya and BT-offloadand I just see that this one should also be dropped:
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
[PATCH 5.13 768/800] hugetlb: address ref count racing in
prep_compound_gigantic_pageWill still need to test this.
Can you run 'git bisect' to see what commit causes the problem?
Yes, will try to do that. I think it will take some time ...
With the help of Pavel Machek and Jiri Slaby I was able 'git bisect' this to:
yoda:/usr/src/kernels/linux-5.13.y# git bisect good a483f513670541227e6a31ac7141826b8c785842 is the first bad commit commit a483f513670541227e6a31ac7141826b8c785842 Author: Jan Kara <[email protected]> Date: Wed Jun 23 11:36:33 2021 +0200bfq: Remove merged request already in
bfq_requests_merged()[ Upstream commit
a921c655f2033dd1ce1379128efe881dda23ea37]Currently, bfq does very little in
bfq_requests_merged()and handles all the request cleanup inbfq_finish_requeue_request()called fromblk_mq_free_request(). That is currently safe only becauseblk_mq_free_request()is called shortly afterbfq_requests_merged()whilebfqd->lockis still held. However to fix a lock inversion betweenbfqd->lockandioc->lock, we need to callblk_mq_free_request()after droppingbfqd->lock. That would mean that already merged request could be seen by other processes inside bfq queues and possibly dispatched to the device which is wrong. So move cleanup of the request frombfq_finish_requeue_request()tobfq_requests_merged().Acked-by Paolo Valente <[email protected]>Signed-off-by Jan Kara <[email protected]>Signed-off-by Jens Axboe <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 4 lines
block/bfq-iosched.c| 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-)Holger
Wonderful!
So if you drop that, all works well? I'll go drop that from the queues now.
thanks,
greg k-h
Quoted 81 lines · Greg Kroah-Hartman
Quoted 79 lines · Holger Kiehl
Quoted 39 lines · Holger Kiehl
Quoted 37 lines · Greg Kroah-Hartman
Quoted 36 lines · Holger Kiehl
Hello,
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.2 release. There are 800 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 Wed, 14 Jul 2021 06:02:46 +0000. Anything received after that time might be too late.
With this my system no longer boots:
[ OK ] Reached target Swap.
[ 75.213852] NMI watchdog: Watchdog detected hard LOCKUP on cpu 0 [ 75.213926] NMI watchdog: Watchdog detected hard LOCKUP on cpu 2 [ 75.213962] NMI watchdog: Watchdog detected hard LOCKUP on cpu 4 [FAILED] Failed to start Wait for udev To Complete Device Initialization. See 'systemctl status systemd-udev-settle.service' for details. Starting Activation of DM RAID sets... [ ] (1 of 2) A start job is running for Activation of DM RAID sets (..min ..s / no limit) [ ] (2 of 2) A start job is running for Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling (..min ..s / no limit)System is a Fedora 34 with all updates applied. Two other similar systems with AMD CPUs (Ryzen 4750G + 3400G) this does not happen and boots fine. The system where it does not boot has an Intel Xeon E3-1285L v4 CPU. All of them use a
dm_cryptroot filesystem.Any idea which patch I should drop to see if it boots again. I already dropped
[PATCH 5.13 743/800] ASoC: Intel:
sof_sdw: add quirk support for Brya and BT-offloadand I just see that this one should also be dropped:
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
[PATCH 5.13 768/800] hugetlb: address ref count racing in
prep_compound_gigantic_pageWill still need to test this.
Can you run 'git bisect' to see what commit causes the problem?
Yes, will try to do that. I think it will take some time ...
With the help of Pavel Machek and Jiri Slaby I was able 'git bisect' this to:
yoda:/usr/src/kernels/linux-5.13.y# git bisect good a483f513670541227e6a31ac7141826b8c785842 is the first bad commit commit a483f513670541227e6a31ac7141826b8c785842 Author: Jan Kara <[email protected]> Date: Wed Jun 23 11:36:33 2021 +0200bfq: Remove merged request already in
bfq_requests_merged()[ Upstream commit
a921c655f2033dd1ce1379128efe881dda23ea37]Currently, bfq does very little in
bfq_requests_merged()and handles all the request cleanup inbfq_finish_requeue_request()called fromblk_mq_free_request(). That is currently safe only becauseblk_mq_free_request()is called shortly afterbfq_requests_merged()whilebfqd->lockis still held. However to fix a lock inversion betweenbfqd->lockandioc->lock, we need to callblk_mq_free_request()after droppingbfqd->lock. That would mean that already merged request could be seen by other processes inside bfq queues and possibly dispatched to the device which is wrong. So move cleanup of the request frombfq_finish_requeue_request()tobfq_requests_merged().Acked-by Paolo Valente <[email protected]>Signed-off-by Jan Kara <[email protected]>Signed-off-by Jens Axboe <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 6 lines
Quoted 4 lines
block/bfq-iosched.c | 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-)Holger
Wonderful!
My two cents,
While running ssuite long running stress testing we have noticed deadlock.
Quoted 2 lines
So if you drop that, all works well? I'll go drop that from the queues now.
Let me drop that patch and test it again.
Crash log,
[ 1957.278399] ============================================
[ 1957.283717] WARNING: possible recursive locking detected
[ 1957.289031] 5.13.2-rc1 #1 Not tainted
[ 1957.292703] --------------------------------------------
[ 1957.298016] kworker/u8:7/236 is trying to acquire lock:
[ 1957.303241] ffff8cc203f92c38 (&bfqd->lock){-.-.}-{2:2}, at:
bfq_finish_requeue_request+0x55/0x500 [bfq]
[ 1957.312643]
[ 1957.312643] but task is already holding lock:
[ 1957.318467] ffff8cc203f92c38 (&bfqd->lock){-.-.}-{2:2}, at:
bfq_insert_requests+0x81/0x1750 [bfq]
[ 1957.327334]
[ 1957.327334] other info that might help us debug this:
[ 1957.333852] Possible unsafe locking scenario:
[ 1957.333852]
[ 1957.339762] CPU0
[ 1957.342206] ----
[ 1957.344651] lock(&bfqd->lock);
[ 1957.347873] lock(&bfqd->lock);
[ 1957.351097]
[ 1957.351097] *** DEADLOCK ***
[ 1957.351097]
[ 1957.357008] May be due to missing lock nesting notation
[ 1957.357008]
[ 1957.363783] 3 locks held by kworker/u8:7/236:
[ 1957.368136] #0: ffff8cc2009c5938
((wq_completion)writeback){+.+.}-{0:0}, at:
process_one_work+0x207/0x5e0
[ 1957.377782] #1: ffff9ba980d57e68
((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at:
process_one_work+0x207/0x5e0
[ 1957.388640] #2: ffff8cc203f92c38 (&bfqd->lock){-.-.}-{2:2}, at:
bfq_insert_requests+0x81/0x1750 [bfq]
[ 1957.397938]
[ 1957.397938] stack backtrace:
[ 1957.402291] CPU: 1 PID: 236 Comm: kworker/u8:7 Not tainted 5.13.2-rc1 #1
[ 1957.408989] Hardware name: Supermicro SYS-5019S-ML/X11SSH-F, BIOS
2.2 05/23/2018
[ 1957.416374] Workqueue: writeback wb_workfn (flush-8:0)
[ 1957.421513] Call Trace:
[ 1957.423966] dump_stack+0x76/0x95
[ 1957.427283] __lock_acquire+0xb70/0x1a50
[ 1957.431203] ? lock_is_held_type+0xa0/0x110
[ 1957.435388] ? bfq_init_rq+0x30e/0x1140 [bfq]
[ 1957.439748] lock_acquire+0x258/0x2e0
[ 1957.443413] ? bfq_finish_requeue_request+0x55/0x500 [bfq]
[ 1957.448923] ? __lock_acquire+0x4a6/0x1a50
[ 1957.453016] ? __lock_acquire+0x3e0/0x1a50
[ 1957.457107] _raw_spin_lock_irqsave+0x3f/0x60
[ 1957.461466] ? bfq_finish_requeue_request+0x55/0x500 [bfq]
[ 1957.466950] bfq_finish_requeue_request+0x55/0x500 [bfq]
[ 1957.472256] ? rcu_read_lock_sched_held+0x4f/0x80
[ 1957.476960] blk_mq_free_request+0x3e/0x140
[ 1957.481146] blk_put_request+0xe/0x10
[ 1957.484804] blk_attempt_req_merge+0x1d/0x30
[ 1957.489075] elv_attempt_insert_merge+0x34/0x90
[ 1957.493599] blk_mq_sched_try_insert_merge+0x2c/0x50
[ 1957.498556] bfq_insert_requests+0x8d/0x1750 [bfq]
[ 1957.503342] ? find_held_lock+0x35/0xa0
[ 1957.507180] ? writeback_sb_inodes+0x35a/0x550
[ 1957.511618] blk_mq_sched_insert_requests+0xd9/0x2a0
[ 1957.516580] blk_mq_flush_plug_list+0x138/0x270
[ 1957.521110] blk_flush_plug_list+0xd1/0x100
[ 1957.525295] blk_finish_plug+0x2c/0x40
[ 1957.529045] wb_writeback+0x1ab/0x430
[ 1957.532702] ? _raw_spin_unlock_bh+0x30/0x40
[ 1957.536970] wb_workfn+0xcb/0x660
[ 1957.540286] ? wb_workfn+0xcb/0x660
[ 1957.543770] ? lock_acquire+0x258/0x2e0
[ 1957.547600] ? process_one_work+0x207/0x5e0
[ 1957.551778] process_one_work+0x289/0x5e0
[ 1957.555782] ? inode_wait_for_writeback+0x40/0x40
[ 1957.560477] ? process_one_work+0x289/0x5e0
[ 1957.564656] worker_thread+0x3c/0x3f0
[ 1957.568315] ? process_one_work+0x5e0/0x5e0
[ 1957.572500] kthread+0x14c/0x170
[ 1957.575733] ? set_kthread_struct+0x40/0x40
[ 1957.579921] ret_from_fork+0x22/0x30
Waiting for transitory to terminate: 5[0KWaiting for transitory to
terminate: 4[0K[ 2106.390977] systemd[1]: systemd-resolved.service:
Watchdog timeout (limit 3min)!
[ 2106.398454] systemd[1]: systemd-resolved.service: Killing process349 (systemd-resolve) with signal SIGABRT.
ref:
https://lkft.validation.linaro.org/scheduler/job/3058868#L2922
- Naresh
Quoted 4 lines · Naresh Kamboju
Quoted 1 line · Greg Kroah-Hartman
<trim>
Quoted 24 lines
My two cents,
While running ssuite long running stress testing we have noticed deadlock.Quoted 2 lines
So if you drop that, all works well? I'll go drop that from the queues now.
Let me drop that patch and test it again.
Crash log,
[ 1957.278399] ============================================ [ 1957.283717] WARNING: possible recursive locking detected [ 1957.289031] 5.13.2-rc1 #1 Not tainted [ 1957.292703] -------------------------------------------- [ 1957.298016] kworker/u8:7/236 is trying to acquire lock: [ 1957.303241] ffff8cc203f92c38 (&bfqd->lock){-.-.}-{2:2}, at: bfq_finish_requeue_request+0x55/0x500 [bfq] [ 1957.312643] [ 1957.312643] but task is already holding lock: [ 1957.318467] ffff8cc203f92c38 (&bfqd->lock){-.-.}-{2:2}, at: bfq_insert_requests+0x81/0x1750 [bfq] [ 1957.327334] [ 1957.327334] other info that might help us debug this: [ 1957.333852] Possible unsafe locking scenario:
Quoted 8 lines
[ 1957.333852] [ 1957.339762] CPU0 [ 1957.342206] ---- [ 1957.344651] lock(&bfqd->lock); [ 1957.347873] lock(&bfqd->lock); [ 1957.351097] [ 1957.351097] *** DEADLOCK *** [ 1957.351097]
Also noticed on stable-rc 5.12.17-rc1.
Quoted 4 lines
ref:
https://lkft.validation.linaro.org/scheduler/job/3058868#L2922
ref:
https://lkft.validation.linaro.org/scheduler/job/3058423#L3125
- Naresh
Greg Kroah-Hartman
maintainerQuoted 41 lines · Naresh Kamboju
Quoted 4 lines · Naresh Kamboju
Quoted 1 line · Greg Kroah-Hartman
<trim>
Quoted 24 lines
My two cents,
While running ssuite long running stress testing we have noticed deadlock.Quoted 2 lines
So if you drop that, all works well? I'll go drop that from the queues now.
Let me drop that patch and test it again.
Crash log,
[ 1957.278399] ============================================ [ 1957.283717] WARNING: possible recursive locking detected [ 1957.289031] 5.13.2-rc1 #1 Not tainted [ 1957.292703] -------------------------------------------- [ 1957.298016] kworker/u8:7/236 is trying to acquire lock: [ 1957.303241] ffff8cc203f92c38 (&bfqd->lock){-.-.}-{2:2}, at: bfq_finish_requeue_request+0x55/0x500 [bfq] [ 1957.312643] [ 1957.312643] but task is already holding lock: [ 1957.318467] ffff8cc203f92c38 (&bfqd->lock){-.-.}-{2:2}, at: bfq_insert_requests+0x81/0x1750 [bfq] [ 1957.327334] [ 1957.327334] other info that might help us debug this: [ 1957.333852] Possible unsafe locking scenario:Quoted 8 lines
[ 1957.333852] [ 1957.339762] CPU0 [ 1957.342206] ---- [ 1957.344651] lock(&bfqd->lock); [ 1957.347873] lock(&bfqd->lock); [ 1957.351097] [ 1957.351097] *** DEADLOCK *** [ 1957.351097]
Quoted 1 line
Also noticed on stable-rc 5.12.17-rc1.
I dropped the same patch from there as well already, thanks.
greg k-h
Jan Kara
reviewerQuoted 42 lines · Greg Kroah-Hartman
Quoted 41 lines · Naresh Kamboju
Quoted 4 lines · Naresh Kamboju
Quoted 1 line · Greg Kroah-Hartman
<trim>
Quoted 32 lines
My two cents,
While running ssuite long running stress testing we have noticed deadlock.Quoted 2 lines
So if you drop that, all works well? I'll go drop that from the queues now.
Let me drop that patch and test it again.
Crash log,
[ 1957.278399] ============================================ [ 1957.283717] WARNING: possible recursive locking detected [ 1957.289031] 5.13.2-rc1 #1 Not tainted [ 1957.292703] -------------------------------------------- [ 1957.298016] kworker/u8:7/236 is trying to acquire lock: [ 1957.303241] ffff8cc203f92c38 (&bfqd->lock){-.-.}-{2:2}, at: bfq_finish_requeue_request+0x55/0x500 [bfq] [ 1957.312643] [ 1957.312643] but task is already holding lock: [ 1957.318467] ffff8cc203f92c38 (&bfqd->lock){-.-.}-{2:2}, at: bfq_insert_requests+0x81/0x1750 [bfq] [ 1957.327334] [ 1957.327334] other info that might help us debug this: [ 1957.333852] Possible unsafe locking scenario: [ 1957.333852] [ 1957.339762] CPU0 [ 1957.342206] ---- [ 1957.344651] lock(&bfqd->lock); [ 1957.347873] lock(&bfqd->lock); [ 1957.351097] [ 1957.351097] *** DEADLOCK *** [ 1957.351097]
Quoted 3 lines
Quoted 1 line
Also noticed on stable-rc 5.12.17-rc1.
I dropped the same patch from there as well already, thanks.
OK, when you dropped this patch, please also drop upstream commit fd2ef39cc9a6b ("blk: Fix lock inversion between ioc lock and bfqd lock"). Because without BFQ patch this block layer patch could cause some use-after-free issues. I'll have a look if I can understand why BFQ patch causes problems in stable kernels...
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Greg Kroah-Hartman
maintainerQuoted 43 lines · Jan Kara
Quoted 42 lines · Greg Kroah-Hartman
Quoted 41 lines · Naresh Kamboju
Quoted 4 lines · Naresh Kamboju
Quoted 1 line · Greg Kroah-Hartman
<trim>
Quoted 32 lines
My two cents,
While running ssuite long running stress testing we have noticed deadlock.Quoted 2 lines
So if you drop that, all works well? I'll go drop that from the queues now.
Let me drop that patch and test it again.
Crash log,
[ 1957.278399] ============================================ [ 1957.283717] WARNING: possible recursive locking detected [ 1957.289031] 5.13.2-rc1 #1 Not tainted [ 1957.292703] -------------------------------------------- [ 1957.298016] kworker/u8:7/236 is trying to acquire lock: [ 1957.303241] ffff8cc203f92c38 (&bfqd->lock){-.-.}-{2:2}, at: bfq_finish_requeue_request+0x55/0x500 [bfq] [ 1957.312643] [ 1957.312643] but task is already holding lock: [ 1957.318467] ffff8cc203f92c38 (&bfqd->lock){-.-.}-{2:2}, at: bfq_insert_requests+0x81/0x1750 [bfq] [ 1957.327334] [ 1957.327334] other info that might help us debug this: [ 1957.333852] Possible unsafe locking scenario: [ 1957.333852] [ 1957.339762] CPU0 [ 1957.342206] ---- [ 1957.344651] lock(&bfqd->lock); [ 1957.347873] lock(&bfqd->lock); [ 1957.351097] [ 1957.351097] *** DEADLOCK *** [ 1957.351097]
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Also noticed on stable-rc 5.12.17-rc1.
I dropped the same patch from there as well already, thanks.
OK, when you dropped this patch, please also drop upstream commit
fd2ef39cc9a6b("blk: Fix lock inversion between ioc lock and bfqd lock").
That commit did not end up in the tree either, so all should be good.
thanks,
greg k-h
Jan Kara
reviewerHi Naresh!
Quoted 92 lines · Naresh Kamboju
My two cents,
While running ssuite long running stress testing we have noticed deadlock.Quoted 2 lines
So if you drop that, all works well? I'll go drop that from the queues now.
Let me drop that patch and test it again.
Crash log,
[ 1957.278399] ============================================ [ 1957.283717] WARNING: possible recursive locking detected [ 1957.289031] 5.13.2-rc1 #1 Not tainted [ 1957.292703] -------------------------------------------- [ 1957.298016] kworker/u8:7/236 is trying to acquire lock: [ 1957.303241] ffff8cc203f92c38 (&bfqd->lock){-.-.}-{2:2}, at: bfq_finish_requeue_request+0x55/0x500 [bfq] [ 1957.312643] [ 1957.312643] but task is already holding lock: [ 1957.318467] ffff8cc203f92c38 (&bfqd->lock){-.-.}-{2:2}, at: bfq_insert_requests+0x81/0x1750 [bfq] [ 1957.327334] [ 1957.327334] other info that might help us debug this: [ 1957.333852] Possible unsafe locking scenario: [ 1957.333852] [ 1957.339762] CPU0 [ 1957.342206] ---- [ 1957.344651] lock(&bfqd->lock); [ 1957.347873] lock(&bfqd->lock); [ 1957.351097] [ 1957.351097] *** DEADLOCK *** [ 1957.351097] [ 1957.357008] May be due to missing lock nesting notation [ 1957.357008] [ 1957.363783] 3 locks held by kworker/u8:7/236: [ 1957.368136] #0: ffff8cc2009c5938 ((wq_completion)writeback){+.+.}-{0:0}, at: process_one_work+0x207/0x5e0 [ 1957.377782] #1: ffff9ba980d57e68 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_one_work+0x207/0x5e0 [ 1957.388640] #2: ffff8cc203f92c38 (&bfqd->lock){-.-.}-{2:2}, at: bfq_insert_requests+0x81/0x1750 [bfq] [ 1957.397938] [ 1957.397938] stack backtrace: [ 1957.402291] CPU: 1 PID: 236 Comm: kworker/u8:7 Not tainted 5.13.2-rc1 #1 [ 1957.408989] Hardware name: Supermicro SYS-5019S-ML/X11SSH-F, BIOS 2.2 05/23/2018 [ 1957.416374] Workqueue: writeback wb_workfn (flush-8:0) [ 1957.421513] Call Trace: [ 1957.423966] dump_stack+0x76/0x95 [ 1957.427283] __lock_acquire+0xb70/0x1a50 [ 1957.431203] ? lock_is_held_type+0xa0/0x110 [ 1957.435388] ? bfq_init_rq+0x30e/0x1140 [bfq] [ 1957.439748] lock_acquire+0x258/0x2e0 [ 1957.443413] ? bfq_finish_requeue_request+0x55/0x500 [bfq] [ 1957.448923] ? __lock_acquire+0x4a6/0x1a50 [ 1957.453016] ? __lock_acquire+0x3e0/0x1a50 [ 1957.457107] _raw_spin_lock_irqsave+0x3f/0x60 [ 1957.461466] ? bfq_finish_requeue_request+0x55/0x500 [bfq] [ 1957.466950] bfq_finish_requeue_request+0x55/0x500 [bfq] [ 1957.472256] ? rcu_read_lock_sched_held+0x4f/0x80 [ 1957.476960] blk_mq_free_request+0x3e/0x140 [ 1957.481146] blk_put_request+0xe/0x10 [ 1957.484804] blk_attempt_req_merge+0x1d/0x30 [ 1957.489075] elv_attempt_insert_merge+0x34/0x90 [ 1957.493599] blk_mq_sched_try_insert_merge+0x2c/0x50 [ 1957.498556] bfq_insert_requests+0x8d/0x1750 [bfq] [ 1957.503342] ? find_held_lock+0x35/0xa0 [ 1957.507180] ? writeback_sb_inodes+0x35a/0x550 [ 1957.511618] blk_mq_sched_insert_requests+0xd9/0x2a0 [ 1957.516580] blk_mq_flush_plug_list+0x138/0x270 [ 1957.521110] blk_flush_plug_list+0xd1/0x100 [ 1957.525295] blk_finish_plug+0x2c/0x40 [ 1957.529045] wb_writeback+0x1ab/0x430 [ 1957.532702] ? _raw_spin_unlock_bh+0x30/0x40 [ 1957.536970] wb_workfn+0xcb/0x660 [ 1957.540286] ? wb_workfn+0xcb/0x660 [ 1957.543770] ? lock_acquire+0x258/0x2e0 [ 1957.547600] ? process_one_work+0x207/0x5e0 [ 1957.551778] process_one_work+0x289/0x5e0 [ 1957.555782] ? inode_wait_for_writeback+0x40/0x40 [ 1957.560477] ? process_one_work+0x289/0x5e0 [ 1957.564656] worker_thread+0x3c/0x3f0 [ 1957.568315] ? process_one_work+0x5e0/0x5e0 [ 1957.572500] kthread+0x14c/0x170 [ 1957.575733] ? set_kthread_struct+0x40/0x40 [ 1957.579921] ret_from_fork+0x22/0x30 Waiting for transitory to terminate: 5[0KWaiting for transitory to terminate: 4[0K[ 2106.390977] systemd[1]: systemd-resolved.service: Watchdog timeout (limit 3min)! [ 2106.398454] systemd[1]: systemd-resolved.service: Killing process
Quoted 1 line
349 (systemd-resolve) with signal SIGABRT.
Thanks for testing and the report! So this looks like you didn't have commit fd2ef39cc9a ("blk: Fix lock inversion between ioc lock and bfqd lock") applied. As I was looking into BFQ code indeed commit a921c655f2 ("bfq: Remove merged request already in bfq_requests_merged()") on its own would introduce this deadlock which then gets fixed up by commit fd2ef39cc9a (I didn't realize this when writing the series). So we either need to apply both commits or none of them. Do you see some problems with both commits applied?
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Quoted 83 lines · Greg Kroah-Hartman
Quoted 82 lines · Holger Kiehl
Quoted 39 lines · Holger Kiehl
Quoted 37 lines · Greg Kroah-Hartman
Quoted 36 lines · Holger Kiehl
Hello,
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.2 release. There are 800 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 Wed, 14 Jul 2021 06:02:46 +0000. Anything received after that time might be too late.
With this my system no longer boots:
[ OK ] Reached target Swap.
[ 75.213852] NMI watchdog: Watchdog detected hard LOCKUP on cpu 0 [ 75.213926] NMI watchdog: Watchdog detected hard LOCKUP on cpu 2 [ 75.213962] NMI watchdog: Watchdog detected hard LOCKUP on cpu 4 [FAILED] Failed to start Wait for udev To Complete Device Initialization. See 'systemctl status systemd-udev-settle.service' for details. Starting Activation of DM RAID sets... [ ] (1 of 2) A start job is running for Activation of DM RAID sets (..min ..s / no limit) [ ] (2 of 2) A start job is running for Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling (..min ..s / no limit)System is a Fedora 34 with all updates applied. Two other similar systems with AMD CPUs (Ryzen 4750G + 3400G) this does not happen and boots fine. The system where it does not boot has an Intel Xeon E3-1285L v4 CPU. All of them use a
dm_cryptroot filesystem.Any idea which patch I should drop to see if it boots again. I already dropped
[PATCH 5.13 743/800] ASoC: Intel:
sof_sdw: add quirk support for Brya and BT-offloadand I just see that this one should also be dropped:
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
[PATCH 5.13 768/800] hugetlb: address ref count racing in
prep_compound_gigantic_pageWill still need to test this.
Can you run 'git bisect' to see what commit causes the problem?
Yes, will try to do that. I think it will take some time ...
With the help of Pavel Machek and Jiri Slaby I was able 'git bisect' this to:
yoda:/usr/src/kernels/linux-5.13.y# git bisect good a483f513670541227e6a31ac7141826b8c785842 is the first bad commit commit a483f513670541227e6a31ac7141826b8c785842 Author: Jan Kara <[email protected]> Date: Wed Jun 23 11:36:33 2021 +0200bfq: Remove merged request already in
bfq_requests_merged()[ Upstream commit
a921c655f2033dd1ce1379128efe881dda23ea37]Currently, bfq does very little in
bfq_requests_merged()and handles all the request cleanup inbfq_finish_requeue_request()called fromblk_mq_free_request(). That is currently safe only becauseblk_mq_free_request()is called shortly afterbfq_requests_merged()whilebfqd->lockis still held. However to fix a lock inversion betweenbfqd->lockandioc->lock, we need to callblk_mq_free_request()after droppingbfqd->lock. That would mean that already merged request could be seen by other processes inside bfq queues and possibly dispatched to the device which is wrong. So move cleanup of the request frombfq_finish_requeue_request()tobfq_requests_merged().Acked-by Paolo Valente <[email protected]>Signed-off-by Jan Kara <[email protected]>Signed-off-by Jens Axboe <[email protected]>Signed-off-by Sasha Levin <[email protected]>
block/bfq-iosched.c| 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-)
Quoted 7 lines
Quoted 1 line
Holger
Wonderful!
So if you drop that, all works well? I'll go drop that from the queues now.
Yes. Just double checked it took a plain 5.13.1, patched it with patch-5.13.2-rc1.xz and then reverted
PATCH-5.13-259-800-bfq-Remove-merged-request-already-in-bfq_requests_merged
and it booted fine with no problems. Tested several times. Just wonder why it only happens on the Intel Broadwell CPU. Maybe it is the 128MB eDRAM L4 Cache ...
Holger
Greg Kroah-Hartman
maintainerQuoted 92 lines · Holger Kiehl
Quoted 83 lines · Greg Kroah-Hartman
Quoted 82 lines · Holger Kiehl
Quoted 39 lines · Holger Kiehl
Quoted 37 lines · Greg Kroah-Hartman
Quoted 36 lines · Holger Kiehl
Hello,
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.2 release. There are 800 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 Wed, 14 Jul 2021 06:02:46 +0000. Anything received after that time might be too late.
With this my system no longer boots:
[ OK ] Reached target Swap.
[ 75.213852] NMI watchdog: Watchdog detected hard LOCKUP on cpu 0 [ 75.213926] NMI watchdog: Watchdog detected hard LOCKUP on cpu 2 [ 75.213962] NMI watchdog: Watchdog detected hard LOCKUP on cpu 4 [FAILED] Failed to start Wait for udev To Complete Device Initialization. See 'systemctl status systemd-udev-settle.service' for details. Starting Activation of DM RAID sets... [ ] (1 of 2) A start job is running for Activation of DM RAID sets (..min ..s / no limit) [ ] (2 of 2) A start job is running for Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling (..min ..s / no limit)System is a Fedora 34 with all updates applied. Two other similar systems with AMD CPUs (Ryzen 4750G + 3400G) this does not happen and boots fine. The system where it does not boot has an Intel Xeon E3-1285L v4 CPU. All of them use a
dm_cryptroot filesystem.Any idea which patch I should drop to see if it boots again. I already dropped
[PATCH 5.13 743/800] ASoC: Intel:
sof_sdw: add quirk support for Brya and BT-offloadand I just see that this one should also be dropped:
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
[PATCH 5.13 768/800] hugetlb: address ref count racing in
prep_compound_gigantic_pageWill still need to test this.
Can you run 'git bisect' to see what commit causes the problem?
Yes, will try to do that. I think it will take some time ...
With the help of Pavel Machek and Jiri Slaby I was able 'git bisect' this to:
yoda:/usr/src/kernels/linux-5.13.y# git bisect good a483f513670541227e6a31ac7141826b8c785842 is the first bad commit commit a483f513670541227e6a31ac7141826b8c785842 Author: Jan Kara <[email protected]> Date: Wed Jun 23 11:36:33 2021 +0200bfq: Remove merged request already in
bfq_requests_merged()[ Upstream commit
a921c655f2033dd1ce1379128efe881dda23ea37]Currently, bfq does very little in
bfq_requests_merged()and handles all the request cleanup inbfq_finish_requeue_request()called fromblk_mq_free_request(). That is currently safe only becauseblk_mq_free_request()is called shortly afterbfq_requests_merged()whilebfqd->lockis still held. However to fix a lock inversion betweenbfqd->lockandioc->lock, we need to callblk_mq_free_request()after droppingbfqd->lock. That would mean that already merged request could be seen by other processes inside bfq queues and possibly dispatched to the device which is wrong. So move cleanup of the request frombfq_finish_requeue_request()tobfq_requests_merged().Acked-by Paolo Valente <[email protected]>Signed-off-by Jan Kara <[email protected]>Signed-off-by Jens Axboe <[email protected]>Signed-off-by Sasha Levin <[email protected]>
block/bfq-iosched.c| 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-)Quoted 7 lines
Quoted 1 line
Holger
Wonderful!
So if you drop that, all works well? I'll go drop that from the queues now.
Quoted 8 lines
Yes. Just double checked it took a plain 5.13.1, patched it with patch-5.13.2-rc1.xz and then reverted
PATCH-5.13-259-800-bfq-Remove-merged-request-already-in-bfq_requests_mergedand it booted fine with no problems. Tested several times. Just wonder why it only happens on the Intel Broadwell CPU. Maybe it is the 128MB eDRAM L4 Cache ...
Wondeful!
Could you test 5.14-rc1 to verify if this problem is there or not? If it is, the developers need to know this so that they can work to fix the regression.
thanks,
greg k-h
Quoted 102 lines · Greg Kroah-Hartman
Quoted 92 lines · Holger Kiehl
Quoted 83 lines · Greg Kroah-Hartman
Quoted 82 lines · Holger Kiehl
Quoted 39 lines · Holger Kiehl
Quoted 37 lines · Greg Kroah-Hartman
Quoted 36 lines · Holger Kiehl
Hello,
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.2 release. There are 800 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 Wed, 14 Jul 2021 06:02:46 +0000. Anything received after that time might be too late.
With this my system no longer boots:
[ OK ] Reached target Swap.
[ 75.213852] NMI watchdog: Watchdog detected hard LOCKUP on cpu 0 [ 75.213926] NMI watchdog: Watchdog detected hard LOCKUP on cpu 2 [ 75.213962] NMI watchdog: Watchdog detected hard LOCKUP on cpu 4 [FAILED] Failed to start Wait for udev To Complete Device Initialization. See 'systemctl status systemd-udev-settle.service' for details. Starting Activation of DM RAID sets... [ ] (1 of 2) A start job is running for Activation of DM RAID sets (..min ..s / no limit) [ ] (2 of 2) A start job is running for Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling (..min ..s / no limit)System is a Fedora 34 with all updates applied. Two other similar systems with AMD CPUs (Ryzen 4750G + 3400G) this does not happen and boots fine. The system where it does not boot has an Intel Xeon E3-1285L v4 CPU. All of them use a
dm_cryptroot filesystem.Any idea which patch I should drop to see if it boots again. I already dropped
[PATCH 5.13 743/800] ASoC: Intel:
sof_sdw: add quirk support for Brya and BT-offloadand I just see that this one should also be dropped:
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
[PATCH 5.13 768/800] hugetlb: address ref count racing in
prep_compound_gigantic_pageWill still need to test this.
Can you run 'git bisect' to see what commit causes the problem?
Yes, will try to do that. I think it will take some time ...
With the help of Pavel Machek and Jiri Slaby I was able 'git bisect' this to:
yoda:/usr/src/kernels/linux-5.13.y# git bisect good a483f513670541227e6a31ac7141826b8c785842 is the first bad commit commit a483f513670541227e6a31ac7141826b8c785842 Author: Jan Kara <[email protected]> Date: Wed Jun 23 11:36:33 2021 +0200bfq: Remove merged request already in
bfq_requests_merged()[ Upstream commit
a921c655f2033dd1ce1379128efe881dda23ea37]Currently, bfq does very little in
bfq_requests_merged()and handles all the request cleanup inbfq_finish_requeue_request()called fromblk_mq_free_request(). That is currently safe only becauseblk_mq_free_request()is called shortly afterbfq_requests_merged()whilebfqd->lockis still held. However to fix a lock inversion betweenbfqd->lockandioc->lock, we need to callblk_mq_free_request()after droppingbfqd->lock. That would mean that already merged request could be seen by other processes inside bfq queues and possibly dispatched to the device which is wrong. So move cleanup of the request frombfq_finish_requeue_request()tobfq_requests_merged().Acked-by Paolo Valente <[email protected]>Signed-off-by Jan Kara <[email protected]>Signed-off-by Jens Axboe <[email protected]>Signed-off-by Sasha Levin <[email protected]>
block/bfq-iosched.c| 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-)Quoted 7 lines
Quoted 1 line
Holger
Wonderful!
So if you drop that, all works well? I'll go drop that from the queues now.
Quoted 8 lines
Yes. Just double checked it took a plain 5.13.1, patched it with patch-5.13.2-rc1.xz and then reverted
PATCH-5.13-259-800-bfq-Remove-merged-request-already-in-bfq_requests_mergedand it booted fine with no problems. Tested several times. Just wonder why it only happens on the Intel Broadwell CPU. Maybe it is the 128MB eDRAM L4 Cache ...
Quoted 6 lines
Wondeful!
Could you test 5.14-rc1 to verify if this problem is there or not? If it is, the developers need to know this so that they can work to fix the regression.
No. 5.14-rc1 boots fine. Could not see any problems with it. Just tried it.
Holger
Quoted 32 lines · Holger Kiehl
Hello,
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.2 release. There are 800 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 Wed, 14 Jul 2021 06:02:46 +0000. Anything received after that time might be too late.
With this my system no longer boots:
[ OK ] Reached target Swap.
[ 75.213852] NMI watchdog: Watchdog detected hard LOCKUP on cpu 0 [ 75.213926] NMI watchdog: Watchdog detected hard LOCKUP on cpu 2 [ 75.213962] NMI watchdog: Watchdog detected hard LOCKUP on cpu 4 [FAILED] Failed to start Wait for udev To Complete Device Initialization. See 'systemctl status systemd-udev-settle.service' for details. Starting Activation of DM RAID sets... [ ] (1 of 2) A start job is running for Activation of DM RAID sets (..min ..s / no limit) [ ] (2 of 2) A start job is running for Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling (..min ..s / no limit)System is a Fedora 34 with all updates applied. Two other similar systems with AMD CPUs (Ryzen 4750G + 3400G) this does not happen and boots fine. The system where it does not boot has an Intel Xeon E3-1285L v4 CPU. All of them use a
dm_cryptroot filesystem.Any idea which patch I should drop to see if it boots again. I already dropped
Quoted 8 lines
[PATCH 5.13 743/800] ASoC: Intel:
sof_sdw: add quirk support for Brya and BT-offloadand I just see that this one should also be dropped:
[PATCH 5.13 768/800] hugetlb: address ref count racing in
prep_compound_gigantic_pageWill still need to test this.
Dropping that did not fix it.
Holger