6.1.95-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 125/217 gpio: tqmx86: remove unneeded call to platform_set_drvdata()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrei Coardos <[email protected]>
[ Upstream commit 0a5e9306b812fe3517548fab92b3d3d6ce7576e5 ]
This function call was found to be unnecessary as there is no equivalent platform_get_drvdata() call to access the private data of the driver. Also, the private data is defined in this driver, so there is no risk of it being accessed outside of this driver file.
Stable-dep-of: 9d6a811b522b ("gpio: tqmx86: introduce shadow register for GPIO output value")
--- drivers/gpio/gpio-tqmx86.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpio/gpio-tqmx86.c +0 -2
@@ -259,8 +259,6 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)tqmx86_gpio_write (gpio, (u8 )~TQMX86_DIR_INPUT_MASK ,TQMX86_GPIODD ); -platform_set_drvdata (pdev, gpio); - chip = &gpio->chip; chip->label ="gpio-tqmx86" ; chip->owner =THIS_MODULE ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 126/217 gpio: tqmx86: introduce shadow register for GPIO output value
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthias Schiffer <[email protected]>
[ Upstream commit 9d6a811b522ba558bcb4ec01d12e72a0af8e9f6e ]
The TQMx86 GPIO controller uses the same register address for input and output data. Reading the register will always return current inputs rather than the previously set outputs (regardless of the current direction setting). Therefore, using a RMW pattern does not make sense when setting output values. Instead, the previously set output register value needs to be stored as a shadow register.
As there is no reliable way to get the current output values from the hardware, also initialize all channels to 0, to ensure that stored and actual output values match. This should usually not have any effect in practise, as the TQMx86 UEFI sets all outputs to 0 during boot.
Also prepare for extension of the driver to more than 8 GPIOs by using DECLARE_BITMAP.
--- drivers/gpio/gpio-tqmx86.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/gpio/gpio-tqmx86.c +11 -7
@@ -6,6 +6,7 @@* Vadim V.Vlasov <[email protected]> */ +#include <linux/bitmap.h> #include <linux/bitops.h> #include <linux/errno.h> #include <linux/gpio/driver.h>
@@ -38,6 +39,7 @@ struct tqmx86_gpio_data {void __iomem *io_base;int irq;raw_spinlock_t spinlock; +DECLARE_BITMAP (output,TQMX86_NGPIO );u8 irq_type[TQMX86_NGPI ]; };
@@ -64,15 +66,10 @@ static void tqmx86_gpio_set(struct gpio_chip *chip, unsigned int offset, {struct tqmx86_gpio_data *gpio =gpiochip_get_data (chip);unsigned long flags; -u8 val;raw_spin_lock_irqsave (&gpio->spinlock, flags); - val =tqmx86_gpio_read (gpio,TQMX86_GPIOD ); -if (value) - val |=BIT (offset); -else - val &= ~BIT (offset); -tqmx86_gpio_write (gpio, val,TQMX86_GPIOD ); +__assign_bit (offset, gpio->output, value); +tqmx86_gpio_write (gpio,bitmap_get_value8 (gpio->output,0 ),TQMX86_GPIOD );raw_spin_unlock_irqrestore (&gpio->spinlock, flags); }
@@ -259,6 +256,13 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)tqmx86_gpio_write (gpio, (u8 )~TQMX86_DIR_INPUT_MASK ,TQMX86_GPIODD ); +/* +* Reading the previous output state is not possible with TQMx86 hardware. +* Initialize all outputs to 0 to have a defined state that matches the +* shadow register. +*/ +tqmx86_gpio_write (gpio,0 ,TQMX86_GPIOD ); + chip = &gpio->chip; chip->label ="gpio-tqmx86" ; chip->owner =THIS_MODULE ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 127/217 gpio: tqmx86: Convert to immutable irq_chip
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
[ Upstream commit 8e43827b6ae727a745ce7a8cc19184b28905a965 ]
Convert the driver to immutable irq-chip with a bit of intuition.
Stable-dep-of: 08af509efdf8 ("gpio: tqmx86: store IRQ trigger type and unmask status separately")
--- drivers/gpio/gpio-tqmx86.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-)
drivers/gpio/gpio-tqmx86.c +20 -8
@@ -16,6 +16,7 @@#include <linux/module.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> +#include <linux/seq_file.h> #include <linux/slab.h> #define TQMX86_NGPIO 8
@@ -35,7 +36,6 @@struct tqmx86_gpio_data {struct gpio_chip chip; -struct irq_chip irq_chip;void __iomem *io_base;int irq;raw_spinlock_t spinlock;
@@ -119,6 +119,7 @@ static void tqmx86_gpio_irq_mask(struct irq_data *data) gpiic &= ~mask;tqmx86_gpio_write (gpio, gpiic,TQMX86_GPIIC );raw_spin_unlock_irqrestore (&gpio->spinlock, flags); +gpiochip_disable_irq (&gpio->chip,irqd_to_hwirq (data)); }static void tqmx86_gpio_irq_unmask (struct irq_data *data)
@@ -131,6 +132,7 @@ static void tqmx86_gpio_irq_unmask(struct irq_data *data) mask =TQMX86_GPII_MASK << (offset *TQMX86_GPII_BITS ); +gpiochip_enable_irq (&gpio->chip,irqd_to_hwirq (data));raw_spin_lock_irqsave (&gpio->spinlock, flags); gpiic =tqmx86_gpio_read (gpio,TQMX86_GPIIC ); gpiic &= ~mask;
@@ -223,6 +225,22 @@ static void tqmx86_init_irq_valid_mask(struct gpio_chip *chip,clear_bit (3 , valid_mask); } +static void tqmx86_gpio_irq_print_chip (struct irq_data *d,struct seq_file *p) +{ +struct gpio_chip *gc =irq_data_get_irq_chip_data (d); + +seq_printf (p, gc->label); +} + +static const struct irq_chip tqmx86_gpio_irq_chip = { + .irq_mask = tqmx86_gpio_irq_mask, + .irq_unmask = tqmx86_gpio_irq_unmask, + .irq_set_type = tqmx86_gpio_irq_set_type, + .irq_print_chip = tqmx86_gpio_irq_print_chip, + .flags =IRQCHIP_IMMUTABLE , +GPIOCHIP_IRQ_RESOURCE_HELPERS , +}; +static int tqmx86_gpio_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -279,14 +297,8 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)pm_runtime_enable (&pdev->dev);if (irq >0 ) { -struct irq_chip *irq_chip = &gpio->irq_chip;u8 irq_status; - irq_chip->name = chip->label; - irq_chip->irq_mask = tqmx86_gpio_irq_mask; - irq_chip->irq_unmask = tqmx86_gpio_irq_unmask; - irq_chip->irq_set_type = tqmx86_gpio_irq_set_type; -/* Mask all interrupts */ tqmx86_gpio_write (gpio,0 ,TQMX86_GPIIC );
@@ -295,7 +307,7 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)tqmx86_gpio_write (gpio, irq_status,TQMX86_GPIIS ); girq = &chip->irq; - girq->chip = irq_chip; +gpio_irq_chip_set_chip (girq, &tqmx86_gpio_irq_chip); girq->parent_handler = tqmx86_gpio_irq_handler; girq->num_parents =1 ; girq->parents = devm_kcalloc(&pdev->dev, 1,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 128/217 gpio: tqmx86: store IRQ trigger type and unmask status separately
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthias Schiffer <[email protected]>
[ Upstream commit 08af509efdf8dad08e972b48de0e2c2a7919ea8b ]
irq_set_type() should not implicitly unmask the IRQ.
All accesses to the interrupt configuration register are moved to a new helper tqmx86_gpio_irq_config(). We also introduce the new rule that accessing irq_type must happen while locked, which will become significant for fixing EDGE_BOTH handling.
--- drivers/gpio/gpio-tqmx86.c | 48 ++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 20 deletions(-)
drivers/gpio/gpio-tqmx86.c +28 -20
@@ -29,15 +29,19 @@#define TQMX86_GPIIC 3/* GPI Interrupt Configuration Register */ #define TQMX86_GPIIS 4/* GPI Interrupt Status Register */ +#define TQMX86_GPII_NONE 0#define TQMX86_GPII_FALLING BIT(0)#define TQMX86_GPII_RISING BIT(1)#define TQMX86_GPII_MASK (BIT(0) | BIT(1))#define TQMX86_GPII_BITS 2 +/* Stored in irq_type with GPII bits */ +#define TQMX86_INT_UNMASKED BIT(2)struct tqmx86_gpio_data {struct gpio_chip chip;void __iomem *io_base;int irq; +/* Lock must be held for accessing output and irq_type fields */ raw_spinlock_t spinlock; DECLARE_BITMAP(output, TQMX86_NGPIO);u8 irq_type[TQMX86_NGPI ];
@@ -104,21 +108,32 @@ static int tqmx86_gpio_get_direction(struct gpio_chip *chip,return GPIO_LINE_DIRECTION_OUT ; } +static void tqmx86_gpio_irq_config (struct tqmx86_gpio_data *gpio,int offset) + __must_hold(&gpio->spinlock) +{ +u8 type =TQMX86_GPII_NONE , gpiic; + +if (gpio->irq_type[offset] &TQMX86_INT_UNMASKED ) + type = gpio->irq_type[offset] &TQMX86_GPII_MASK ; + + gpiic =tqmx86_gpio_read (gpio,TQMX86_GPIIC ); + gpiic &= ~(TQMX86_GPII_MASK << (offset *TQMX86_GPII_BITS )); + gpiic |= type << (offset *TQMX86_GPII_BITS ); +tqmx86_gpio_write (gpio, gpiic,TQMX86_GPIIC ); +} +static void tqmx86_gpio_irq_mask (struct irq_data *data) {unsigned int offset = (data->hwirq -TQMX86_NGPO );struct tqmx86_gpio_data *gpio =gpiochip_get_data (irq_data_get_irq_chip_data (data));unsigned long flags; -u8 gpiic, mask; - - mask =TQMX86_GPII_MASK << (offset *TQMX86_GPII_BITS );raw_spin_lock_irqsave (&gpio->spinlock, flags); - gpiic =tqmx86_gpio_read (gpio,TQMX86_GPIIC ); - gpiic &= ~mask; -tqmx86_gpio_write (gpio, gpiic,TQMX86_GPIIC ); + gpio->irq_type[offset] &= ~TQMX86_INT_UNMASKED ; +tqmx86_gpio_irq_config (gpio, offset);raw_spin_unlock_irqrestore (&gpio->spinlock, flags); +gpiochip_disable_irq (&gpio->chip,irqd_to_hwirq (data)); }
@@ -128,16 +143,12 @@ static void tqmx86_gpio_irq_unmask(struct irq_data *data)struct tqmx86_gpio_data *gpio =gpiochip_get_data (irq_data_get_irq_chip_data (data));unsigned long flags; -u8 gpiic, mask; - - mask =TQMX86_GPII_MASK << (offset *TQMX86_GPII_BITS );gpiochip_enable_irq (&gpio->chip,irqd_to_hwirq (data)); +raw_spin_lock_irqsave (&gpio->spinlock, flags); - gpiic =tqmx86_gpio_read (gpio,TQMX86_GPIIC ); - gpiic &= ~mask; - gpiic |= gpio->irq_type[offset] << (offset *TQMX86_GPII_BITS ); -tqmx86_gpio_write (gpio, gpiic,TQMX86_GPIIC ); + gpio->irq_type[offset] |=TQMX86_INT_UNMASKED ; +tqmx86_gpio_irq_config (gpio, offset);raw_spin_unlock_irqrestore (&gpio->spinlock, flags); }
@@ -148,7 +159,7 @@ static int tqmx86_gpio_irq_set_type(struct irq_data *data, unsigned int type)unsigned int offset = (data->hwirq -TQMX86_NGPO );unsigned int edge_type = type &IRQF_TRIGGER_MASK ;unsigned long flags; -u8 new_type, gpiic; +u8 new_type;switch (edge_type) {case IRQ_TYPE_EDGE_RISING :
@@ -164,13 +175,10 @@ static int tqmx86_gpio_irq_set_type(struct irq_data *data, unsigned int type)return -EINVAL ;/* not supported */ } - gpio->irq_type[offset] = new_type; -raw_spin_lock_irqsave (&gpio->spinlock, flags); - gpiic =tqmx86_gpio_read (gpio,TQMX86_GPIIC ); - gpiic &= ~((TQMX86_GPII_MASK ) << (offset *TQMX86_GPII_BITS )); - gpiic |= new_type << (offset *TQMX86_GPII_BITS ); -tqmx86_gpio_write (gpio, gpiic,TQMX86_GPIIC ); + gpio->irq_type[offset] &= ~TQMX86_GPII_MASK ; + gpio->irq_type[offset] |= new_type; +tqmx86_gpio_irq_config (gpio, offset);raw_spin_unlock_irqrestore (&gpio->spinlock, flags);return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 129/217 gpio: tqmx86: fix broken IRQ_TYPE_EDGE_BOTH interrupt type
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthias Schiffer <[email protected]>
[ Upstream commit 90dd7de4ef7ba584823dfbeba834c2919a4bb55b ]
The TQMx86 GPIO controller only supports falling and rising edge triggers, but not both. Fix this by implementing a software both-edge mode that toggles the edge type after every interrupt.
--- drivers/gpio/gpio-tqmx86.c | 46 ++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-)
drivers/gpio/gpio-tqmx86.c +42 -4
@@ -32,6 +32,10 @@#define TQMX86_GPII_NONE 0#define TQMX86_GPII_FALLING BIT(0)#define TQMX86_GPII_RISING BIT(1) +/* Stored in irq_type as a trigger type, but not actually valid as a register +* value, so the name doesn't use "GPII" +*/ +#define TQMX86_INT_BOTH (BIT(0) | BIT(1))#define TQMX86_GPII_MASK (BIT(0) | BIT(1))#define TQMX86_GPII_BITS 2/* Stored in irq_type with GPII bits */
@@ -113,9 +117,15 @@ static void tqmx86_gpio_irq_config(struct tqmx86_gpio_data *gpio, int offset) {u8 type =TQMX86_GPII_NONE , gpiic; -if (gpio->irq_type[offset] &TQMX86_INT_UNMASKED ) +if (gpio->irq_type[offset] &TQMX86_INT_UNMASKED ) { type = gpio->irq_type[offset] &TQMX86_GPII_MASK ; +if (type ==TQMX86_INT_BOTH ) + type =tqmx86_gpio_get (&gpio->chip, offset +TQMX86_NGPO ) + ?TQMX86_GPII_FALLING + :TQMX86_GPII_RISING ; + } + gpiic =tqmx86_gpio_read (gpio,TQMX86_GPIIC ); gpiic &= ~(TQMX86_GPII_MASK << (offset *TQMX86_GPII_BITS )); gpiic |= type << (offset *TQMX86_GPII_BITS );
@@ -169,7 +179,7 @@ static int tqmx86_gpio_irq_set_type(struct irq_data *data, unsigned int type) new_type =TQMX86_GPII_FALLING ;break ;case IRQ_TYPE_EDGE_BOTH : - new_type =TQMX86_GPII_FALLING |TQMX86_GPII_RISING ; + new_type =TQMX86_INT_BOTH ;break ;default :return -EINVAL ;/* not supported */
@@ -189,8 +199,8 @@ static void tqmx86_gpio_irq_handler(struct irq_desc *desc)struct gpio_chip *chip =irq_desc_get_handler_data (desc);struct tqmx86_gpio_data *gpio =gpiochip_get_data (chip);struct irq_chip *irq_chip =irq_desc_get_chip (desc); -unsigned long irq_bits; -int i =0 ; +unsigned long irq_bits, flags; +int i;u8 irq_status;chained_irq_enter (irq_chip, desc);
@@ -199,6 +209,34 @@ static void tqmx86_gpio_irq_handler(struct irq_desc *desc)tqmx86_gpio_write (gpio, irq_status,TQMX86_GPIIS ); irq_bits = irq_status; + +raw_spin_lock_irqsave (&gpio->spinlock, flags); +for_each_set_bit (i, &irq_bits,TQMX86_NGPI ) { +/* +* Edge-both triggers are implemented by flipping the edge +* trigger after each interrupt, as the controller only supports +* either rising or falling edge triggers, but not both. +* +* Internally, the TQMx86 GPIO controller has separate status +* registers for rising and falling edge interrupts. GPIIC +* configures which bits from which register are visible in the +* interrupt status register GPIIS and defines what triggers the +* parent IRQ line. Writing to GPIIS always clears both rising +* and falling interrupt flags internally, regardless of the +* currently configured trigger. +* +* In consequence, we can cleanly implement the edge-both +* trigger in software by first clearing the interrupt and then +* setting the new trigger based on the current GPIO input in +* tqmx86_gpio_irq_config() - even if an edge arrives between +* reading the input and setting the trigger, we will have a new +* interrupt pending. +*/ +if ((gpio->irq_type[i] &TQMX86_GPII_MASK ) ==TQMX86_INT_BOTH ) +tqmx86_gpio_irq_config (gpio, i); + } +raw_spin_unlock_irqrestore (&gpio->spinlock, flags); +for_each_set_bit (i, &irq_bits,TQMX86_NGPI )generic_handle_domain_irq (gpio->chip.irq.domain, i +TQMX86_NGPO );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 130/217 HID: core: remove unnecessary WARN_ON() in implement()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Zhandarovich <[email protected]>
[ Upstream commit 4aa2dcfbad538adf7becd0034a3754e1bd01b2b5 ]
Syzkaller hit a warning [1] in a call to implement() when trying to write a value into a field of smaller size in an output report.
Since implement() already has a warn message printed out with the help of hid_warn() and value in question gets trimmed with:
... value &= m; ...
WARN_ON may be considered superfluous. Remove it to suppress future syzkaller triggers.
[1]
WARNING: CPU: 0 PID: 5084 at drivers/hid/hid-core.c:1451 implement drivers/hid/hid-core.c:1451 [inline] WARNING: CPU: 0 PID: 5084 at drivers/hid/hid-core.c:1451 hid_output_report+0x548/0x760 drivers/hid/hid-core.c:1863 Modules linked in: CPU: 0 PID: 5084 Comm: syz-executor424 Not tainted 6.9.0-rc7-syzkaller-00183-gcf87f46fd34d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 RIP: 0010:implement drivers/hid/hid-core.c:1451 [inline] RIP: 0010:hid_output_report+0x548/0x760 drivers/hid/hid-core.c:1863 ... Call Trace: <TASK> __usbhid_submit_report drivers/hid/usbhid/hid-core.c:591 [inline] usbhid_submit_report+0x43d/0x9e0 drivers/hid/usbhid/hid-core.c:636 hiddev_ioctl+0x138b/0x1f00 drivers/hid/usbhid/hiddev.c:726 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:904 [inline] __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:890 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
...
--- drivers/hid/hid-core.c | 1 - 1 file changed, 1 deletion(-)
drivers/hid/hid-core.c +0 -1
@@ -1451,7 +1451,6 @@ static void implement(const struct hid_device *hid, u8 *report,hid_warn (hid,"%s() called with too large value %d (n: %d)! (%s)\n" , __func__, value, n, current->comm); -WARN_ON (1 ); value &= m; } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 131/217 iommu/amd: Fix sysfs leak in iommu init
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kun(llfl) <[email protected]>
[ Upstream commit a295ec52c8624883885396fde7b4df1a179627c3 ]
During the iommu initialization, iommu_init_pci() adds sysfs nodes. However, these nodes aren't remove in free_iommu_resources() subsequently.
--- drivers/iommu/amd/init.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/iommu/amd/init.c +9 -0
@@ -1655,8 +1655,17 @@ static void __init free_pci_segments(void) } } +static void __init free_sysfs (struct amd_iommu *iommu) +{ +if (iommu->iommu.dev) { +iommu_device_unregister (&iommu->iommu); +iommu_device_sysfs_remove (&iommu->iommu); + } +} +static void __init free_iommu_one (struct amd_iommu *iommu) { +free_sysfs (iommu);free_cwwb_sem (iommu);free_command_buffer (iommu);free_event_buffer (iommu);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 132/217 HID: logitech-dj: Fix memory leak in logi_dj_recv_switch_to_dj_mode()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: José Expósito <[email protected]>
[ Upstream commit ce3af2ee95170b7d9e15fff6e500d67deab1e7b3 ]
Fix a memory leak on logi_dj_recv_send_report() error path.
--- drivers/hid/hid-logitech-dj.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/hid-logitech-dj.c +3 -1
@@ -1284,8 +1284,10 @@ static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev,*/ msleep (50 ); -if (retval) +if (retval) { +kfree (dj_report);return retval; + } }/*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 133/217 drm/vmwgfx: Port the framebuffer code to drm fb helpers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zack Rusin <[email protected]>
[ Upstream commit df42523c12f8d58a41f547f471b46deffd18c203 ]
Instead of using vmwgfx specific framebuffer implementation use the drm fb helpers. There's no change in functionality, the only difference is a reduction in the amount of code inside the vmwgfx module.
drm fb helpers do not deal correctly with changes in crtc preferred mode at runtime, but the old fb code wasn't dealing with it either. Same situation applies to high-res fb consoles - the old code was limited to 1176x885 because it was checking for legacy/deprecated memory limites, the drm fb helpers are limited to the initial resolution set on fb due to first problem (drm fb helpers being unable to handle hotplug crtc preferred mode changes).
This also removes the kernel config for disabling fb support which hasn't been used or supported in a very long time.
Stable-dep-of: 426826933109 ("drm/vmwgfx: Filter modes which exceed graphics memory")
--- drivers/gpu/drm/vmwgfx/Kconfig | 7 - drivers/gpu/drm/vmwgfx/Makefile | 2 - drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 58 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 35 +- drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 831 ---------------------------- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 79 +-- drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 7 - 7 files changed, 28 insertions(+), 991 deletions(-) delete mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
drivers/gpu/drm/vmwgfx/Kconfig +0 -7
@@ -16,13 +16,6 @@ config DRM_VMWGFX virtual hardware. The compiled module will be called "vmwgfx.ko". -config DRM_VMWGFX_FBCON - depends on DRM_VMWGFX && DRM_FBDEV_EMULATION - bool "Enable framebuffer console under vmwgfx by default" - help - Choose this option if you are shipping a new vmwgfx - userspace driver that supports using the kernel driver. - config DRM_VMWGFX_MKSSTATS bool "Enable mksGuestStats instrumentation of vmwgfx by default" depends on DRM_VMWGFX
drivers/gpu/drm/vmwgfx/Makefile +0 -2
@@ -12,6 +12,4 @@ vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o vmwgfx_drv.o \ vmwgfx_devcaps.o ttm_object.o vmwgfx_system_manager.o \ vmwgfx_gem.o -vmwgfx-$(CONFIG_DRM_FBDEV_EMULATION) += vmwgfx_fb.o - obj-$(CONFIG_DRM_VMWGFX) := vmwgfx.o
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +16 -42
158 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +3 -32
@@ -62,6 +62,9 @@#define VMWGFX_MAX_DISPLAYS 16#define VMWGFX_CMD_BOUNCE_INIT_SIZE 32768 +#define VMWGFX_MIN_INITIAL_WIDTH 1280 +#define VMWGFX_MIN_INITIAL_HEIGHT 800 +#define VMWGFX_PCI_ID_SVGA2 0x0405#define VMWGFX_PCI_ID_SVGA3 0x0406
@@ -551,7 +554,6 @@ struct vmw_private {* Framebuffer info. */ -void *fb_info;enum vmw_display_unit_type active_display_unit;struct vmw_legacy_display *ldu_priv;struct vmw_overlay *overlay_priv;
@@ -610,8 +612,6 @@ struct vmw_private {struct mutex cmdbuf_mutex;struct mutex binding_mutex; -bool enable_fb; -/** * PM management. */
@@ -1178,35 +1178,6 @@ extern void vmw_generic_waiter_add(struct vmw_private *dev_priv, u32 flag,extern void vmw_generic_waiter_remove (struct vmw_private *dev_priv,u32 flag,int *waiter_count); - -/** -* Kernel framebuffer - vmwgfx_fb.c -*/ - -#ifdef CONFIG_DRM_FBDEV_EMULATION -int vmw_fb_init (struct vmw_private *vmw_priv); -int vmw_fb_close (struct vmw_private *dev_priv); -int vmw_fb_off (struct vmw_private *vmw_priv); -int vmw_fb_on (struct vmw_private *vmw_priv); -#else -static inline int vmw_fb_init (struct vmw_private *vmw_priv) -{ -return 0 ; -} -static inline int vmw_fb_close (struct vmw_private *dev_priv) -{ -return 0 ; -} -static inline int vmw_fb_off (struct vmw_private *vmw_priv) -{ -return 0 ; -} -static inline int vmw_fb_on (struct vmw_private *vmw_priv) -{ -return 0 ; -} -#endif -/** * Kernel modesetting - vmwgfx_kms.c */
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c deleted +0 -831
831 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +9 -70
114 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +0 -7
@@ -458,13 +458,6 @@ vmw_kms_new_framebuffer(struct vmw_private *dev_priv,struct vmw_surface *surface, bool only_2d, const struct drm_mode_fb_cmd2 *mode_cmd); -int vmw_kms_fbdev_init_data (struct vmw_private *dev_priv, -unsigned unit, -u32 max_width, -u32 max_height, -struct drm_connector **p_con, -struct drm_crtc **p_crtc, -struct drm_display_mode **p_mode);void vmw_guess_mode_timing (struct drm_display_mode *mode);void vmw_kms_update_implicit_fb (struct vmw_private *dev_priv);void vmw_kms_create_implicit_placement_property (struct vmw_private *dev_priv);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 134/217 drm/vmwgfx: Refactor drm connector probing for display modes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Krastev <[email protected]>
[ Upstream commit 935f795045a6f9b13d28d46ebdad04bfea8750dd ]
Implement drm_connector_helper_funcs.mode_valid and .get_modes, replacing custom drm_connector_funcs.fill_modes code with drm_helper_probe_single_connector_modes; for STDU, LDU & SOU display units.
Stable-dep-of: 426826933109 ("drm/vmwgfx: Filter modes which exceed graphics memory")
--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 272 +++++++++------------------ drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 6 +- drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 5 +- drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 5 +- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 4 +- 5 files changed, 101 insertions(+), 191 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +89 -183
@@ -31,6 +31,7 @@#include <drm/drm_fourcc.h> #include <drm/drm_rect.h> #include <drm/drm_sysfs.h> +#include <drm/drm_edid.h> #include "vmwgfx_kms.h"
@@ -2213,107 +2214,6 @@ vmw_du_connector_detect(struct drm_connector *connector, bool force) connector_status_connected : connector_status_disconnected); } -static struct drm_display_mode vmw_kms_connector_builtin[] = { -/* 640x480@60Hz */ - {DRM_MODE ("640x480" ,DRM_MODE_TYPE_DRIVER ,25175 ,640 ,656 , -752 ,800 ,0 ,480 ,489 ,492 ,525 ,0 , -DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_NVSYNC ) }, -/* 800x600@60Hz */ - {DRM_MODE ("800x600" ,DRM_MODE_TYPE_DRIVER ,40000 ,800 ,840 , -968 ,1056 ,0 ,600 ,601 ,605 ,628 ,0 , -DRM_MODE_FLAG_PHSYNC |DRM_MODE_FLAG_PVSYNC ) }, -/* 1024x768@60Hz */ - {DRM_MODE ("1024x768" ,DRM_MODE_TYPE_DRIVER ,65000 ,1024 ,1048 , -1184 ,1344 ,0 ,768 ,771 ,777 ,806 ,0 , -DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_NVSYNC ) }, -/* 1152x864@75Hz */ - {DRM_MODE ("1152x864" ,DRM_MODE_TYPE_DRIVER ,108000 ,1152 ,1216 , -1344 ,1600 ,0 ,864 ,865 ,868 ,900 ,0 , -DRM_MODE_FLAG_PHSYNC |DRM_MODE_FLAG_PVSYNC ) }, -/* 1280x720@60Hz */ - {DRM_MODE ("1280x720" ,DRM_MODE_TYPE_DRIVER ,74500 ,1280 ,1344 , -1472 ,1664 ,0 ,720 ,723 ,728 ,748 ,0 , -DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_PVSYNC ) }, -/* 1280x768@60Hz */ - {DRM_MODE ("1280x768" ,DRM_MODE_TYPE_DRIVER ,79500 ,1280 ,1344 , -1472 ,1664 ,0 ,768 ,771 ,778 ,798 ,0 , -DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_PVSYNC ) }, -/* 1280x800@60Hz */ - {DRM_MODE ("1280x800" ,DRM_MODE_TYPE_DRIVER ,83500 ,1280 ,1352 , -1480 ,1680 ,0 ,800 ,803 ,809 ,831 ,0 , -DRM_MODE_FLAG_PHSYNC |DRM_MODE_FLAG_NVSYNC ) }, -/* 1280x960@60Hz */ - {DRM_MODE ("1280x960" ,DRM_MODE_TYPE_DRIVER ,108000 ,1280 ,1376 , -1488 ,1800 ,0 ,960 ,961 ,964 ,1000 ,0 , -DRM_MODE_FLAG_PHSYNC |DRM_MODE_FLAG_PVSYNC ) }, -/* 1280x1024@60Hz */ - {DRM_MODE ("1280x1024" ,DRM_MODE_TYPE_DRIVER ,108000 ,1280 ,1328 , -1440 ,1688 ,0 ,1024 ,1025 ,1028 ,1066 ,0 , -DRM_MODE_FLAG_PHSYNC |DRM_MODE_FLAG_PVSYNC ) }, -/* 1360x768@60Hz */ - {DRM_MODE ("1360x768" ,DRM_MODE_TYPE_DRIVER ,85500 ,1360 ,1424 , -1536 ,1792 ,0 ,768 ,771 ,777 ,795 ,0 , -DRM_MODE_FLAG_PHSYNC |DRM_MODE_FLAG_PVSYNC ) }, -/* 1440x1050@60Hz */ - {DRM_MODE ("1400x1050" ,DRM_MODE_TYPE_DRIVER ,121750 ,1400 ,1488 , -1632 ,1864 ,0 ,1050 ,1053 ,1057 ,1089 ,0 , -DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_PVSYNC ) }, -/* 1440x900@60Hz */ - {DRM_MODE ("1440x900" ,DRM_MODE_TYPE_DRIVER ,106500 ,1440 ,1520 , -1672 ,1904 ,0 ,900 ,903 ,909 ,934 ,0 , -DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_PVSYNC ) }, -/* 1600x1200@60Hz */ - {DRM_MODE ("1600x1200" ,DRM_MODE_TYPE_DRIVER ,162000 ,1600 ,1664 , -1856 ,2160 ,0 ,1200 ,1201 ,1204 ,1250 ,0 , -DRM_MODE_FLAG_PHSYNC |DRM_MODE_FLAG_PVSYNC ) }, -/* 1680x1050@60Hz */ - {DRM_MODE ("1680x1050" ,DRM_MODE_TYPE_DRIVER ,146250 ,1680 ,1784 , -1960 ,2240 ,0 ,1050 ,1053 ,1059 ,1089 ,0 , -DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_PVSYNC ) }, -/* 1792x1344@60Hz */ - {DRM_MODE ("1792x1344" ,DRM_MODE_TYPE_DRIVER ,204750 ,1792 ,1920 , -2120 ,2448 ,0 ,1344 ,1345 ,1348 ,1394 ,0 , -DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_PVSYNC ) }, -/* 1853x1392@60Hz */ - {DRM_MODE ("1856x1392" ,DRM_MODE_TYPE_DRIVER ,218250 ,1856 ,1952 , -2176 ,2528 ,0 ,1392 ,1393 ,1396 ,1439 ,0 , -DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_PVSYNC ) }, -/* 1920x1080@60Hz */ - {DRM_MODE ("1920x1080" ,DRM_MODE_TYPE_DRIVER ,173000 ,1920 ,2048 , -2248 ,2576 ,0 ,1080 ,1083 ,1088 ,1120 ,0 , -DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_PVSYNC ) }, -/* 1920x1200@60Hz */ - {DRM_MODE ("1920x1200" ,DRM_MODE_TYPE_DRIVER ,193250 ,1920 ,2056 , -2256 ,2592 ,0 ,1200 ,1203 ,1209 ,1245 ,0 , -DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_PVSYNC ) }, -/* 1920x1440@60Hz */ - {DRM_MODE ("1920x1440" ,DRM_MODE_TYPE_DRIVER ,234000 ,1920 ,2048 , -2256 ,2600 ,0 ,1440 ,1441 ,1444 ,1500 ,0 , -DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_PVSYNC ) }, -/* 2560x1440@60Hz */ - {DRM_MODE ("2560x1440" ,DRM_MODE_TYPE_DRIVER ,241500 ,2560 ,2608 , -2640 ,2720 ,0 ,1440 ,1443 ,1448 ,1481 ,0 , -DRM_MODE_FLAG_PHSYNC |DRM_MODE_FLAG_NVSYNC ) }, -/* 2560x1600@60Hz */ - {DRM_MODE ("2560x1600" ,DRM_MODE_TYPE_DRIVER ,348500 ,2560 ,2752 , -3032 ,3504 ,0 ,1600 ,1603 ,1609 ,1658 ,0 , -DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_PVSYNC ) }, -/* 2880x1800@60Hz */ - {DRM_MODE ("2880x1800" ,DRM_MODE_TYPE_DRIVER ,337500 ,2880 ,2928 , -2960 ,3040 ,0 ,1800 ,1803 ,1809 ,1852 ,0 , -DRM_MODE_FLAG_PHSYNC |DRM_MODE_FLAG_NVSYNC ) }, -/* 3840x2160@60Hz */ - {DRM_MODE ("3840x2160" ,DRM_MODE_TYPE_DRIVER ,533000 ,3840 ,3888 , -3920 ,4000 ,0 ,2160 ,2163 ,2168 ,2222 ,0 , -DRM_MODE_FLAG_PHSYNC |DRM_MODE_FLAG_NVSYNC ) }, -/* 3840x2400@60Hz */ - {DRM_MODE ("3840x2400" ,DRM_MODE_TYPE_DRIVER ,592250 ,3840 ,3888 , -3920 ,4000 ,0 ,2400 ,2403 ,2409 ,2469 ,0 , -DRM_MODE_FLAG_PHSYNC |DRM_MODE_FLAG_NVSYNC ) }, -/* Terminate */ - {DRM_MODE ("" ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ) }, -}; -/** * vmw_guess_mode_timing - Provide fake timings for a * 60Hz vrefresh mode.
@@ -2335,88 +2235,6 @@ void vmw_guess_mode_timing(struct drm_display_mode *mode) } -int vmw_du_connector_fill_modes (struct drm_connector *connector, -uint32_t max_width,uint32_t max_height) -{ -struct vmw_display_unit *du =vmw_connector_to_du (connector); -struct drm_device *dev = connector->dev; -struct vmw_private *dev_priv =vmw_priv (dev); -struct drm_display_mode *mode =NULL ; -struct drm_display_mode *bmode; -struct drm_display_mode prefmode = {DRM_MODE ("preferred" , -DRM_MODE_TYPE_DRIVER |DRM_MODE_TYPE_PREFERRED , -0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , -DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_PVSYNC ) - }; -int i; -u32 assumed_bpp =4 ; - -if (dev_priv->assume_16bpp) - assumed_bpp =2 ; - - max_width =min (max_width, dev_priv->texture_max_width); - max_height =min (max_height, dev_priv->texture_max_height); - -/* -* For STDU extra limit for a mode on SVGA_REG_SCREENTARGET_MAX_WIDTH/ -* HEIGHT registers. -*/ -if (dev_priv->active_display_unit == vmw_du_screen_target) { - max_width =min (max_width, dev_priv->stdu_max_width); - max_height =min (max_height, dev_priv->stdu_max_height); - } - -/* Add preferred mode */ - mode =drm_mode_duplicate (dev, &prefmode); -if (!mode) -return 0 ; - mode->hdisplay = du->pref_width; - mode->vdisplay = du->pref_height; -vmw_guess_mode_timing (mode); -drm_mode_set_name (mode); - -if (vmw_kms_validate_mode_vram (dev_priv, - mode->hdisplay * assumed_bpp, - mode->vdisplay)) { -drm_mode_probed_add (connector, mode); - }else { -drm_mode_destroy (dev, mode); - mode =NULL ; - } - -if (du->pref_mode) { -list_del_init (&du->pref_mode->head); -drm_mode_destroy (dev, du->pref_mode); - } - -/* mode might be null here, this is intended */ - du->pref_mode = mode; - -for (i =0 ; vmw_kms_connector_builtin[i].type !=0 ; i++) { - bmode = &vmw_kms_connector_builtin[i]; -if (bmode->hdisplay > max_width || - bmode->vdisplay > max_height) -continue ; - -if (!vmw_kms_validate_mode_vram (dev_priv, - bmode->hdisplay * assumed_bpp, - bmode->vdisplay)) -continue ; - - mode =drm_mode_duplicate (dev, bmode); -if (!mode) -return 0 ; - -drm_mode_probed_add (connector, mode); - } - -drm_connector_list_update (connector); -/* Move the prefered mode first, help apps pick the right mode. */ -drm_mode_sort (&connector->modes); - -return 1 ; -} -/** * vmw_kms_update_layout_ioctl - Handler for DRM_VMW_UPDATE_LAYOUT ioctl * @dev: drm device for the ioctl
@@ -2945,3 +2763,91 @@ int vmw_du_helper_plane_update(struct vmw_du_update_plane *update)vmw_validation_unref_lists (&val_ctx);return ret; } + +/** +* vmw_connector_mode_valid - implements drm_connector_helper_funcs.mode_valid callback +* +* @connector: the drm connector, part of a DU container +* @mode: drm mode to check +* +* Returns MODE_OK on success, or a drm_mode_status error code. +*/ +enum drm_mode_status vmw_connector_mode_valid (struct drm_connector *connector, +struct drm_display_mode *mode) +{ +struct drm_device *dev = connector->dev; +struct vmw_private *dev_priv =vmw_priv (dev); +u32 max_width = dev_priv->texture_max_width; +u32 max_height = dev_priv->texture_max_height; +u32 assumed_cpp =4 ; + +if (dev_priv->assume_16bpp) + assumed_cpp =2 ; + +if (dev_priv->active_display_unit == vmw_du_screen_target) { + max_width =min (dev_priv->stdu_max_width, max_width); + max_height =min (dev_priv->stdu_max_height, max_height); + } + +if (max_width < mode->hdisplay) +return MODE_BAD_HVALUE ; + +if (max_height < mode->vdisplay) +return MODE_BAD_VVALUE ; + +if (!vmw_kms_validate_mode_vram (dev_priv, + mode->hdisplay * assumed_cpp, + mode->vdisplay)) +return MODE_MEM ; + +return MODE_OK ; +} + +/** +* vmw_connector_get_modes - implements drm_connector_helper_funcs.get_modes callback +* +* @connector: the drm connector, part of a DU container +* +* Returns the number of added modes. +*/ +int vmw_connector_get_modes (struct drm_connector *connector) +{ +struct vmw_display_unit *du =vmw_connector_to_du (connector); +struct drm_device *dev = connector->dev; +struct vmw_private *dev_priv =vmw_priv (dev); +struct drm_display_mode *mode =NULL ; +struct drm_display_mode prefmode = {DRM_MODE ("preferred" , +DRM_MODE_TYPE_DRIVER |DRM_MODE_TYPE_PREFERRED , +0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , +DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_PVSYNC ) + }; +u32 max_width; +u32 max_height; +u32 num_modes; + +/* Add preferred mode */ + mode =drm_mode_duplicate (dev, &prefmode); +if (!mode) +return 0 ; + + mode->hdisplay = du->pref_width; + mode->vdisplay = du->pref_height; +vmw_guess_mode_timing (mode); +drm_mode_set_name (mode); + +drm_mode_probed_add (connector, mode); +drm_dbg_kms (dev,"preferred mode " DRM_MODE_FMT "\n" ,DRM_MODE_ARG (mode)); + +/* Probe connector for all modes not exceeding our geom limits */ + max_width = dev_priv->texture_max_width; + max_height = dev_priv->texture_max_height; + +if (dev_priv->active_display_unit == vmw_du_screen_target) { + max_width =min (dev_priv->stdu_max_width, max_width); + max_height =min (dev_priv->stdu_max_height, max_height); + } + + num_modes =1 +drm_add_modes_noedid (connector, max_width, max_height); + +return num_modes; +}
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +3 -3
@@ -379,7 +379,6 @@ struct vmw_display_unit {unsigned pref_width;unsigned pref_height;bool pref_active; -struct drm_display_mode *pref_mode;/* * Gui positioning
@@ -429,8 +428,6 @@ void vmw_du_connector_save(struct drm_connector *connector);void vmw_du_connector_restore (struct drm_connector *connector);enum drm_connector_status vmw_du_connector_detect (struct drm_connector *connector,bool force); -int vmw_du_connector_fill_modes (struct drm_connector *connector, -uint32_t max_width,uint32_t max_height); int vmw_kms_helper_dirty(struct vmw_private *dev_priv, struct vmw_framebuffer *framebuffer, const struct drm_clip_rect *clips,
@@ -439,6 +436,9 @@ int vmw_kms_helper_dirty(struct vmw_private *dev_priv,int num_clips, int increment, struct vmw_kms_dirty *dirty); +enum drm_mode_status vmw_connector_mode_valid (struct drm_connector *connector, +struct drm_display_mode *mode); +int vmw_connector_get_modes (struct drm_connector *connector); void vmw_kms_helper_validation_finish(struct vmw_private *dev_priv, struct drm_file *file_priv,
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +3 -2
@@ -263,7 +263,7 @@ static void vmw_ldu_connector_destroy(struct drm_connector *connector)static const struct drm_connector_funcs vmw_legacy_connector_funcs = { .dpms = vmw_du_connector_dpms, .detect = vmw_du_connector_detect, - .fill_modes = vmw_du_connector_fill_modes, + .fill_modes = drm_helper_probe_single_connector_modes, .destroy = vmw_ldu_connector_destroy, .reset = vmw_du_connector_reset, .atomic_duplicate_state = vmw_du_connector_duplicate_state,
@@ -272,6 +272,8 @@ static const struct drm_connector_funcs vmw_legacy_connector_funcs = {static const struct drm_connector_helper_funcs vmw_ldu_connector_helper_funcs = { + .get_modes = vmw_connector_get_modes, + .mode_valid = vmw_connector_mode_valid }; static int vmw_kms_ldu_do_bo_dirty(struct vmw_private *dev_priv,
@@ -408,7 +410,6 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit) ldu->base.pref_active = (unit ==0 ); ldu->base.pref_width = dev_priv->initial_width; ldu->base.pref_height = dev_priv->initial_height; - ldu->base.pref_mode =NULL ;/* * Remove this after enabling atomic because property values can
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +3 -2
@@ -346,7 +346,7 @@ static void vmw_sou_connector_destroy(struct drm_connector *connector)static const struct drm_connector_funcs vmw_sou_connector_funcs = { .dpms = vmw_du_connector_dpms, .detect = vmw_du_connector_detect, - .fill_modes = vmw_du_connector_fill_modes, + .fill_modes = drm_helper_probe_single_connector_modes, .destroy = vmw_sou_connector_destroy, .reset = vmw_du_connector_reset, .atomic_duplicate_state = vmw_du_connector_duplicate_state,
@@ -356,6 +356,8 @@ static const struct drm_connector_funcs vmw_sou_connector_funcs = {static const struct drm_connector_helper_funcs vmw_sou_connector_helper_funcs = { + .get_modes = vmw_connector_get_modes, + .mode_valid = vmw_connector_mode_valid };
@@ -827,7 +829,6 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit) sou->base.pref_active = (unit ==0 ); sou->base.pref_width = dev_priv->initial_width; sou->base.pref_height = dev_priv->initial_height; - sou->base.pref_mode =NULL ;/* * Remove this after enabling atomic because property values can
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +3 -1
@@ -977,7 +977,7 @@ static void vmw_stdu_connector_destroy(struct drm_connector *connector)static const struct drm_connector_funcs vmw_stdu_connector_funcs = { .dpms = vmw_du_connector_dpms, .detect = vmw_du_connector_detect, - .fill_modes = vmw_du_connector_fill_modes, + .fill_modes = drm_helper_probe_single_connector_modes, .destroy = vmw_stdu_connector_destroy, .reset = vmw_du_connector_reset, .atomic_duplicate_state = vmw_du_connector_duplicate_state,
@@ -987,6 +987,8 @@ static const struct drm_connector_funcs vmw_stdu_connector_funcs = {static const struct drm_connector_helper_funcs vmw_stdu_connector_helper_funcs = { + .get_modes = vmw_connector_get_modes, + .mode_valid = vmw_connector_mode_valid };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 135/217 drm/vmwgfx: Filter modes which exceed graphics memory
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Forbes <[email protected]>
[ Upstream commit 426826933109093503e7ef15d49348fc5ab505fe ]
SVGA requires individual surfaces to fit within graphics memory (max_mob_pages) which means that modes with a final buffer size that would exceed graphics memory must be pruned otherwise creation will fail.
Additionally llvmpipe requires its buffer height and width to be a multiple of its tile size which is 64. As a result we have to anticipate that llvmpipe will round up the mode size passed to it by the compositor when it creates buffers and filter modes where this rounding exceeds graphics memory.
This fixes an issue where VMs with low graphics memory (< 64MiB) configured with high resolution mode boot to a black screen because surface creation fails.
--- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 45 ++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +43 -2
@@ -40,7 +40,14 @@#define vmw_connector_to_stdu (x) \ container_of(x, struct vmw_screen_target_display_unit, base.connector) - +/* +* Some renderers such as llvmpipe will align the width and height of their +* buffers to match their tile size. We need to keep this in mind when exposing +* modes to userspace so that this possible over-allocation will not exceed +* graphics memory. 64x64 pixels seems to be a reasonable upper bound for the +* tile size of current renderers. +*/ +#define GPU_TILE_SIZE 64enum stdu_content_type {SAME_AS_DISPLAY =0 ,
@@ -972,7 +979,41 @@ static void vmw_stdu_connector_destroy(struct drm_connector *connector)vmw_stdu_destroy (vmw_connector_to_stdu (connector)); } +static enum drm_mode_status +vmw_stdu_connector_mode_valid (struct drm_connector *connector, +struct drm_display_mode *mode) +{ +enum drm_mode_status ret; +struct drm_device *dev = connector->dev; +struct vmw_private *dev_priv =vmw_priv (dev); +u64 assumed_cpp = dev_priv->assume_16bpp ?2 :4 ; +/* Align width and height to account for GPU tile over-alignment */ +u64 required_mem =ALIGN (mode->hdisplay,GPU_TILE_SIZE ) * +ALIGN (mode->vdisplay,GPU_TILE_SIZE ) * + assumed_cpp; + required_mem =ALIGN (required_mem,PAGE_SIZE ); + + ret =drm_mode_validate_size (mode, dev_priv->stdu_max_width, + dev_priv->stdu_max_height); +if (ret !=MODE_OK ) +return ret; + ret =drm_mode_validate_size (mode, dev_priv->texture_max_width, + dev_priv->texture_max_height); +if (ret !=MODE_OK ) +return ret; + +if (required_mem > dev_priv->max_primary_mem) +return MODE_MEM ; + +if (required_mem > dev_priv->max_mob_pages *PAGE_SIZE ) +return MODE_MEM ; + +if (required_mem > dev_priv->max_mob_size) +return MODE_MEM ; + +return MODE_OK ; +}static const struct drm_connector_funcs vmw_stdu_connector_funcs = { .dpms = vmw_du_connector_dpms,
@@ -988,7 +1029,7 @@ static const struct drm_connector_funcs vmw_stdu_connector_funcs = {static const struct drm_connector_helper_funcs vmw_stdu_connector_helper_funcs = { .get_modes = vmw_connector_get_modes, - .mode_valid = vmw_connector_mode_valid + .mode_valid = vmw_stdu_connector_mode_valid };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 136/217 drm/vmwgfx: 3D disabled should not effect STDU memory limits
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Forbes <[email protected]>
[ Upstream commit fb5e19d2dd03eb995ccd468d599b2337f7f66555 ]
This limit became a hard cap starting with the change referenced below. Surface creation on the device will fail if the requested size is larger than this limit so altering the value arbitrarily will expose modes that are too large for the device's hard limits.
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +0 -7
@@ -938,13 +938,6 @@ static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id)vmw_read (dev_priv,SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB ); -/* -* Workaround for low memory 2D VMs to compensate for the -* allocation taken by fbdev -*/ -if (!(dev_priv->capabilities &SVGA_CAP_3D )) - mem_size *=3 ; - dev_priv->max_mob_pages = mem_size *1024 /PAGE_SIZE ; dev_priv->max_primary_mem =vmw_read (dev_priv,SVGA_REG_MAX_PRIMARY_MEM );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 137/217 drm/vmwgfx: Remove STDU logic from generic mode_valid function
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Forbes <[email protected]>
[ Upstream commit dde1de06bd7248fd83c4ce5cf0dbe9e4e95bbb91 ]
STDU has its own mode_valid function now so this logic can be removed from the generic version.
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 3 --- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 26 +++++++++----------------- 2 files changed, 9 insertions(+), 20 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +0 -3
@@ -1194,9 +1194,6 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf,int vmw_kms_write_svga (struct vmw_private *vmw_priv,unsigned width,unsigned height,unsigned pitch,unsigned bpp,unsigned depth); -bool vmw_kms_validate_mode_vram (struct vmw_private *dev_priv, -uint32_t pitch, -uint32_t height); int vmw_kms_present(struct vmw_private *dev_priv, struct drm_file *file_priv, struct vmw_framebuffer *vfb,
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +9 -17
@@ -2085,13 +2085,12 @@ int vmw_kms_write_svga(struct vmw_private *vmw_priv,return 0 ; } +static bool vmw_kms_validate_mode_vram (struct vmw_private *dev_priv, -uint32_t pitch, -uint32_t height) +u64 pitch, +u64 height) { -return ((u64 ) pitch * (u64 ) height) < (u64) - ((dev_priv->active_display_unit == vmw_du_screen_target) ? - dev_priv->max_primary_mem : dev_priv->vram_size); +return (pitch * height) < (u64 )dev_priv->vram_size; }/**
@@ -2775,25 +2774,18 @@ int vmw_du_helper_plane_update(struct vmw_du_update_plane *update) enum drm_mode_status vmw_connector_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) { + enum drm_mode_status ret; struct drm_device *dev = connector->dev; struct vmw_private *dev_priv = vmw_priv(dev); - u32 max_width = dev_priv->texture_max_width; - u32 max_height = dev_priv->texture_max_height; u32 assumed_cpp = 4; if (dev_priv->assume_16bpp) assumed_cpp = 2; - if (dev_priv->active_display_unit == vmw_du_screen_target) { - max_width = min(dev_priv->stdu_max_width, max_width); - max_height = min(dev_priv->stdu_max_height, max_height); - } - - if (max_width < mode->hdisplay) - return MODE_BAD_HVALUE; - - if (max_height < mode->vdisplay) - return MODE_BAD_VVALUE; + ret = drm_mode_validate_size(mode, dev_priv->texture_max_width, + dev_priv->texture_max_height); + if (ret != MODE_OK) + return ret; if (!vmw_kms_validate_mode_vram(dev_priv, mode->hdisplay * assumed_cpp,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 138/217 net: sfp: Always call `sfp_sm_mod_remove()` on remove
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Csókás, Bence <[email protected]>
[ Upstream commit e96b2933152fd87b6a41765b2f58b158fde855b6 ]
If the module is in SFP_MOD_ERROR, sfp_sm_mod_remove() will not be run. As a consequence, sfp_hwmon_remove() is not getting run either, leaving a stale hwmon device behind. sfp_sm_mod_remove() itself checks sfp->sm_mod_state anyways, so this check was not really needed in the first place.
--- drivers/net/phy/sfp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/phy/sfp.c +1 -2
@@ -2150,8 +2150,7 @@ static void sfp_sm_module(struct sfp *sfp, unsigned int event)/* Handle remove event globally, it resets this state machine */ if (event ==SFP_E_REMOVE ) { -if (sfp->sm_mod_state >SFP_MOD_PROBE ) -sfp_sm_mod_remove (sfp); +sfp_sm_mod_remove (sfp);sfp_sm_mod_next (sfp,SFP_MOD_EMPTY ,0 );return ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 139/217 net: hns3: fix kernel crash problem in concurrent scenario
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonglong Liu <[email protected]>
[ Upstream commit 12cda920212a49fa22d9e8b9492ac4ea013310a4 ]
When link status change, the nic driver need to notify the roce driver to handle this event, but at this time, the roce driver may uninit, then cause kernel crash.
To fix the problem, when link status change, need to check whether the roce registered, and when uninit, need to wait link update finish.
--- .../hisilicon/hns3/hns3pf/hclge_main.c | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +16 -5
@@ -3129,9 +3129,7 @@ static void hclge_push_link_status(struct hclge_dev *hdev)static void hclge_update_link_status (struct hclge_dev *hdev) { -struct hnae3_handle *rhandle = &hdev->vport[0 ].roce;struct hnae3_handle *handle = &hdev->vport[0 ].nic; -struct hnae3_client *rclient = hdev->roce_client;struct hnae3_client *client = hdev->nic_client;int state;int ret;
@@ -3155,8 +3153,15 @@ static void hclge_update_link_status(struct hclge_dev *hdev) client->ops->link_status_change (handle, state);hclge_config_mac_tnl_int (hdev, state); -if (rclient && rclient->ops->link_status_change) - rclient->ops->link_status_change (rhandle, state); + +if (test_bit (HCLGE_STATE_ROCE_REGISTERED , &hdev->state)) { +struct hnae3_handle *rhandle = &hdev->vport[0 ].roce; +struct hnae3_client *rclient = hdev->roce_client; + +if (rclient && rclient->ops->link_status_change) + rclient->ops->link_status_change (rhandle, + state); + }hclge_push_link_status (hdev); }
@@ -11339,6 +11344,12 @@ static int hclge_init_client_instance(struct hnae3_client *client,return ret; } +static bool hclge_uninit_need_wait (struct hclge_dev *hdev) +{ +return test_bit (HCLGE_STATE_RST_HANDLING , &hdev->state) || +test_bit (HCLGE_STATE_LINK_UPDATING , &hdev->state); +} +static void hclge_uninit_client_instance (struct hnae3_client *client,struct hnae3_ae_dev *ae_dev) {
@@ -11347,7 +11358,7 @@ static void hclge_uninit_client_instance(struct hnae3_client *client,if (hdev->roce_client) {clear_bit (HCLGE_STATE_ROCE_REGISTERED , &hdev->state); -while (test_bit (HCLGE_STATE_RST_HANDLING , &hdev->state)) +while (hclge_uninit_need_wait (hdev))msleep (HCLGE_WAIT_RESET_DONE ); hdev->roce_client->ops->uninit_instance (&vport->roce,0 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 140/217 net: hns3: add cond_resched() to hns3 ring buffer init process
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jie Wang <[email protected]>
[ Upstream commit 968fde83841a8c23558dfbd0a0c69d636db52b55 ]
Currently hns3 ring buffer init process would hold cpu too long with big Tx/Rx ring depth. This could cause soft lockup.
So this patch adds cond_resched() to the process. Then cpu can break to run other tasks instead of busy looping.
--- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 4 ++++ drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 2 ++ 2 files changed, 6 insertions(+)
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +4 -0
@@ -3538,6 +3538,9 @@ static int hns3_alloc_ring_buffers(struct hns3_enet_ring *ring) ret =hns3_alloc_and_attach_buffer (ring, i);if (ret) goto out_buffer_fail; + +if (!(i %HNS3_RESCHED_BD_NUM )) +cond_resched (); }return 0 ;
@@ -5111,6 +5114,7 @@ int hns3_init_all_ring(struct hns3_nic_priv *priv) }u64_stats_init (&priv->ring[i].syncp); +cond_resched (); }return 0 ;
drivers/net/ethernet/hisilicon/hns3/hns3_enet.h +2 -0
@@ -214,6 +214,8 @@ enum hns3_nic_state {#define HNS3_CQ_MODE_EQE 1U#define HNS3_CQ_MODE_CQE 0U +#define HNS3_RESCHED_BD_NUM 1024 +enum hns3_pkt_l2t_type {HNS3_L2_TYPE_UNICAST ,HNS3_L2_TYPE_MULTICAST ,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 141/217 liquidio: Adjust a NULL pointer handling path in lio_vf_rep_copy_packet
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Mishin <[email protected]>
[ Upstream commit c44711b78608c98a3e6b49ce91678cd0917d5349 ]
In lio_vf_rep_copy_packet() pg_info->page is compared to a NULL value, but then it is unconditionally passed to skb_add_rx_frag() which looks strange and could lead to null pointer dereference.
lio_vf_rep_copy_packet() call trace looks like:
octeon_droq_process_packets
octeon_droq_fast_process_packets
octeon_droq_dispatch_pkt
octeon_create_recv_info
...search in the dispatch_list...
->disp_fn(rdisp->rinfo, ...)
lio_vf_rep_pkt_recv(struct octeon_recv_info *recv_info, ...)
In this path there is no code which sets pg_info->page to NULL. So this check looks unneeded and doesn't solve potential problem. But I guess the author had reason to add a check and I have no such card and can't do real test.
In addition, the code in the function liquidio_push_packet() in liquidio/lio_core.c does exactly the same.
Based on this, I consider the most acceptable compromise solution to adjust this issue by moving skb_add_rx_frag() into conditional scope.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c +5 -6
@@ -272,13 +272,12 @@ lio_vf_rep_copy_packet(struct octeon_device *oct, pg_info->page_offset;memcpy (skb->data, va,MIN_SKB_SIZE );skb_put (skb,MIN_SKB_SIZE ); +skb_add_rx_frag (skb,skb_shinfo (skb)->nr_frags, + pg_info->page, + pg_info->page_offset +MIN_SKB_SIZE , + len -MIN_SKB_SIZE , +LIO_RXBUFFER_SZ ); } - -skb_add_rx_frag (skb,skb_shinfo (skb)->nr_frags, - pg_info->page, - pg_info->page_offset +MIN_SKB_SIZE , - len -MIN_SKB_SIZE , -LIO_RXBUFFER_SZ ); }else {struct octeon_skb_page_info *pg_info = ((struct octeon_skb_page_info *)(skb->cb));
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 142/217 drm/komeda: check for error-valued pointer
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amjad Ouled-Ameur <[email protected]>
[ Upstream commit b880018edd3a577e50366338194dee9b899947e0 ]
komeda_pipeline_get_state() may return an error-valued pointer, thus check the pointer for negative or null value before dereferencing.
--- drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +1 -1
@@ -259,7 +259,7 @@ komeda_component_get_avail_scaler(struct komeda_component *c,u32 avail_scalers; pipe_st =komeda_pipeline_get_state (c->pipeline, state); -if (!pipe_st) +if (IS_ERR_OR_NULL (pipe_st))return NULL ; avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 143/217 drm/bridge/panel: Fix runtime warning on panel bridge release
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adam Miotk <[email protected]>
[ Upstream commit ce62600c4dbee8d43b02277669dd91785a9b81d9 ]
Device managed panel bridge wrappers are created by calling to drm_panel_bridge_add_typed() and registering a release handler for clean-up when the device gets unbound.
Since the memory for this bridge is also managed and linked to the panel device, the release function should not try to free that memory. Moreover, the call to devm_kfree() inside drm_panel_bridge_remove() will fail in this case and emit a warning because the panel bridge resource is no longer on the device resources list (it has been removed from there before the call to release handlers).
--- drivers/gpu/drm/bridge/panel.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/panel.c +5 -2
@@ -306,9 +306,12 @@ EXPORT_SYMBOL(drm_panel_bridge_set_orientation);static void devm_drm_panel_bridge_release (struct device *dev,void *res) { -struct drm_bridge **bridge = res; +struct drm_bridge *bridge = *(struct drm_bridge **)res; -drm_panel_bridge_remove (*bridge); +if (!bridge) +return ; + +drm_bridge_remove (bridge); }/**
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 144/217 tcp: fix race in tcp_v6_syn_recv_sock()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit d37fe4255abe8e7b419b90c5847e8ec2b8debb08 ]
tcp_v6_syn_recv_sock() calls ip6_dst_store() before inet_sk(newsk)->pinet6 has been set up.
This means ip6_dst_store() writes over the parent (listener) np->dst_cookie.
This is racy because multiple threads could share the same parent and their final np->dst_cookie could be wrong.
Move ip6_dst_store() call after inet_sk(newsk)->pinet6 has been changed and after the copy of parent ipv6_pinfo.
--- net/ipv6/tcp_ipv6.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv6/tcp_ipv6.c +2 -1
@@ -1291,7 +1291,6 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff **/ newsk->sk_gso_type =SKB_GSO_TCPV6 ; -ip6_dst_store (newsk, dst,NULL ,NULL );inet6_sk_rx_dst_set (newsk, skb);inet_sk (newsk)->pinet6 =tcp_inet6_sk (newsk);
@@ -1302,6 +1301,8 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *memcpy (newnp, np,sizeof (struct ipv6_pinfo )); +ip6_dst_store (newsk, dst,NULL ,NULL ); + newsk->sk_v6_daddr = ireq->ir_v6_rmt_addr; newnp->saddr = ireq->ir_v6_loc_addr; newsk->sk_v6_rcv_saddr = ireq->ir_v6_loc_addr;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 145/217 geneve: Fix incorrect inner network header offset when innerprotoinherit is set
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gal Pressman <[email protected]>
[ Upstream commit c6ae073f5903f6c6439d0ac855836a4da5c0a701 ]
When innerprotoinherit is set, the tunneled packets do not have an inner Ethernet header.
Change 'maclen' to not always assume the header length is ETH_HLEN, as there might not be a MAC header.
This resolves issues with drivers (e.g. mlx5, in mlx5e_tx_tunnel_accel()) who rely on the skb inner network header offset to be correct, and use it for TX offloads.
--- drivers/net/geneve.c | 10 ++++++---- include/net/ip_tunnels.h | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-)
drivers/net/geneve.c +6 -4
@@ -919,6 +919,7 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,struct geneve_dev *geneve, const struct ip_tunnel_info *info) { + bool inner_proto_inherit = geneve->cfg.inner_proto_inherit;bool xnet = !net_eq (geneve->net,dev_net (geneve->dev));struct geneve_sock *gs4 =rcu_dereference (geneve->sock4);const struct ip_tunnel_key *key = &info->key;
@@ -930,7 +931,7 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,__be16 sport;int err; -if (!skb_vlan_inet_prepare (skb)) +if (!skb_vlan_inet_prepare (skb, inner_proto_inherit))return -EINVAL ; sport =udp_flow_src_port (geneve->net, skb,1 ,USHRT_MAX , true);
@@ -1003,7 +1004,7 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, } err =geneve_build_skb (&rt->dst, skb, info, xnet,sizeof (struct iphdr ), - geneve->cfg.inner_proto_inherit); + inner_proto_inherit);if (unlikely (err))return err;
@@ -1019,6 +1020,7 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,struct geneve_dev *geneve, const struct ip_tunnel_info *info) { + bool inner_proto_inherit = geneve->cfg.inner_proto_inherit;bool xnet = !net_eq (geneve->net,dev_net (geneve->dev));struct geneve_sock *gs6 =rcu_dereference (geneve->sock6);const struct ip_tunnel_key *key = &info->key;
@@ -1028,7 +1030,7 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,__be16 sport;int err; -if (!skb_vlan_inet_prepare (skb)) +if (!skb_vlan_inet_prepare (skb, inner_proto_inherit))return -EINVAL ; sport =udp_flow_src_port (geneve->net, skb,1 ,USHRT_MAX , true);
@@ -1083,7 +1085,7 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev, ttl = ttl ? :ip6_dst_hoplimit (dst); } err =geneve_build_skb (dst, skb, info, xnet,sizeof (struct ipv6hdr ), - geneve->cfg.inner_proto_inherit); + inner_proto_inherit);if (unlikely (err))return err;
include/net/ip_tunnels.h +3 -2
@@ -353,9 +353,10 @@ static inline bool pskb_inet_may_pull(struct sk_buff *skb)/* Variant of pskb_inet_may_pull(). */ -static inline bool skb_vlan_inet_prepare (struct sk_buff *skb) +static inline bool skb_vlan_inet_prepare (struct sk_buff *skb, +bool inner_proto_inherit) { -int nhlen =0 , maclen =ETH_HLEN ; +int nhlen =0 , maclen = inner_proto_inherit ?0 :ETH_HLEN ;__be16 type = skb->protocol;/* Essentially this is skb_protocol(skb, true)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 146/217 net/mlx5e: Fix features validation check for tunneled UDP (non-VXLAN) packets
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gal Pressman <[email protected]>
[ Upstream commit 791b4089e326271424b78f2fae778b20e53d071b ]
Move the vxlan_features_check() call to after we verified the packet is a tunneled VXLAN packet.
Without this, tunneled UDP non-VXLAN packets (for ex. GENENVE) might wrongly not get offloaded.
In some cases, it worked by chance as GENEVE header is the same size as VXLAN, but it is obviously incorrect.
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1 -2
@@ -4587,7 +4587,7 @@ static netdev_features_t mlx5e_tunnel_features_check(struct mlx5e_priv *priv,/* Verify if UDP port is being offloaded by HW */ if (mlx5_vxlan_lookup_port (priv->mdev->vxlan, port)) -return features; +return vxlan_features_check (skb, features);#if IS_ENABLED (CONFIG_GENEVE )/* Support Geneve offload for default UDP port */
@@ -4613,7 +4613,6 @@ netdev_features_t mlx5e_features_check(struct sk_buff *skb,struct mlx5e_priv *priv =netdev_priv (netdev); features =vlan_features_check (skb, features); - features =vxlan_features_check (skb, features);/* Validate if the tunneled packet is being offloaded by HW */ if (skb->encapsulation &&
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 147/217 Bluetooth: L2CAP: Fix rejecting L2CAP_CONN_PARAM_UPDATE_REQ
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 806a5198c05987b748b50f3d0c0cfb3d417381a4 ]
This removes the bogus check for max > hcon->le_conn_max_interval since the later is just the initial maximum conn interval not the maximum the stack could support which is really 3200=4000ms.
In order to pass GAP/CONN/CPUP/BV-05-C one shall probably enter values of the following fields in IXIT that would cause hci_check_conn_params to fail:
TSPX_conn_update_int_minTSPX_conn_update_int_maxTSPX_conn_update_peripheral_latencyTSPX_conn_update_supervision_timeout
--- include/net/bluetooth/hci_core.h | 36 ++++++++++++++++++++++++++++---- net/bluetooth/l2cap_core.c | 8 +------ 2 files changed, 33 insertions(+), 11 deletions(-)
include/net/bluetooth/hci_core.h +32 -4
@@ -1936,18 +1936,46 @@ static inline int hci_check_conn_params(u16 min, u16 max, u16 latency, {u16 max_latency; -if (min > max || min <6 || max >3200 ) +if (min > max) { +BT_WARN ("min %d > max %d" , min, max);return -EINVAL ; + } + +if (min <6 ) { +BT_WARN ("min %d < 6" , min); +return -EINVAL ; + } + +if (max >3200 ) { +BT_WARN ("max %d > 3200" , max); +return -EINVAL ; + } + +if (to_multiplier <10 ) { +BT_WARN ("to_multiplier %d < 10" , to_multiplier); +return -EINVAL ; + } -if (to_multiplier <10 || to_multiplier >3200 ) +if (to_multiplier >3200 ) { +BT_WARN ("to_multiplier %d > 3200" , to_multiplier);return -EINVAL ; + } -if (max >= to_multiplier *8 ) +if (max >= to_multiplier *8 ) { +BT_WARN ("max %d >= to_multiplier %d * 8" , max, to_multiplier);return -EINVAL ; + } max_latency = (to_multiplier *4 / max) -1 ; -if (latency >499 || latency > max_latency) +if (latency >499 ) { +BT_WARN ("latency %d > 499" , latency);return -EINVAL ; + } + +if (latency > max_latency) { +BT_WARN ("latency %d > max_latency %d" , latency, max_latency); +return -EINVAL ; + }return 0 ; }
net/bluetooth/l2cap_core.c +1 -7
@@ -5641,13 +5641,7 @@ static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn,memset (&rsp,0 ,sizeof (rsp)); -if (max > hcon->le_conn_max_interval) { -BT_DBG ("requested connection interval exceeds current bounds." ); - err = -EINVAL ; - }else { - err =hci_check_conn_params (min, max, latency, to_multiplier); - } - + err =hci_check_conn_params (min, max, latency, to_multiplier);if (err) rsp.result =cpu_to_le16 (L2CAP_CONN_PARAM_REJECTED );else
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 148/217 netfilter: ipset: Fix race between namespace cleanup and gc in the list:set type
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jozsef Kadlecsik <[email protected]>
[ Upstream commit 4e7aaa6b82d63e8ddcbfb56b4fd3d014ca586f10 ]
Lion Ackermann reported that there is a race condition between namespace cleanup in ipset and the garbage collection of the list:set type. The namespace cleanup can destroy the list:set type of sets while the gc of the set type is waiting to run in rcu cleanup. The latter uses data from the destroyed set which thus leads use after free. The patch contains the following parts:
- When destroying all sets, first remove the garbage collectors, then wait if needed and then destroy the sets.
- Fix the badly ordered "wait then remove gc" for the destroy a single set case.
- Fix the missing rcu locking in the list:set type in the userspace test case.
- Use proper RCU list handlings in the list:set type.
The patch depends on c1193d9bbbd3 (netfilter: ipset: Add list flush to cancel_gc).
--- net/netfilter/ipset/ip_set_core.c | 81 +++++++++++++++------------ net/netfilter/ipset/ip_set_list_set.c | 30 +++++----- 2 files changed, 60 insertions(+), 51 deletions(-)
net/netfilter/ipset/ip_set_core.c +46 -35
@@ -1174,23 +1174,50 @@ ip_set_setname_policy[IPSET_ATTR_CMD_MAX + 1] = { .len = IPSET_MAXNAMELEN - 1 }, }; +/* In order to return quickly when destroying a single set, it is split +* into two stages: +* - Cancel garbage collector +* - Destroy the set itself via call_rcu() +*/ +static void -ip_set_destroy_set (struct ip_set *set) +ip_set_destroy_set_rcu (struct rcu_head *head) { -pr_debug ("set: %s\n" , set->name); + struct ip_set *set = container_of(head, struct ip_set, rcu); -/* Must call it without holding any lock */ set->variant->destroy (set);module_put (set->type->me);kfree (set); }static void -ip_set_destroy_set_rcu (struct rcu_head *head) +_destroy_all_sets (struct ip_set_net *inst) { - struct ip_set *set = container_of(head, struct ip_set, rcu); +struct ip_set *set; +ip_set_id_t i; +bool need_wait = false; -ip_set_destroy_set (set); +/* First cancel gc's: set:list sets are flushed as well */ +for (i =0 ; i < inst->ip_set_max; i++) { + set =ip_set (inst, i); +if (set) { + set->variant->cancel_gc (set); +if (set->type->features &IPSET_TYPE_NAME ) + need_wait = true; + } + } +/* Must wait for flush to be really finished */ +if (need_wait) +rcu_barrier (); +for (i =0 ; i < inst->ip_set_max; i++) { + set =ip_set (inst, i); +if (set) { +ip_set (inst, i) =NULL ; + set->variant->destroy (set); +module_put (set->type->me); +kfree (set); + } + } } static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info,
@@ -1204,11 +1231,10 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info,if (unlikely (protocol_min_failed (attr)))return -IPSET_ERR_PROTOCOL ; -/* Commands are serialized and references are * protected by the ip_set_ref_lock. * External systems (i.e. xt_set) must call -* ip_set_put|get_nfnl_* functions, that way we +* ip_set_nfnl_get_* functions, that way we * can safely check references here. * * list:set timer can only decrement the reference
@@ -1216,8 +1242,6 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info,* without holding the lock. */ if (!attr[IPSET_ATTR_SETNAME ]) { -/* Must wait for flush to be really finished in list:set */ -rcu_barrier ();read_lock_bh (&ip_set_ref_lock);for (i =0 ; i < inst->ip_set_max; i++) { s =ip_set (inst, i);
@@ -1228,15 +1252,7 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info, } inst->is_destroyed = true;read_unlock_bh (&ip_set_ref_lock); -for (i =0 ; i < inst->ip_set_max; i++) { - s =ip_set (inst, i); -if (s) { -ip_set (inst, i) =NULL ; -/* Must cancel garbage collectors */ - s->variant->cancel_gc (s); -ip_set_destroy_set (s); - } - } +_destroy_all_sets (inst);/* Modified by ip_set_destroy() only, which is serialized */ inst->is_destroyed = false; }else {
@@ -1257,12 +1273,12 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info, features = s->type->features;ip_set (inst, i) =NULL ;read_unlock_bh (&ip_set_ref_lock); +/* Must cancel garbage collectors */ + s->variant->cancel_gc (s);if (features &IPSET_TYPE_NAME ) {/* Must wait for flush to be really finished */ rcu_barrier (); } -/* Must cancel garbage collectors */ - s->variant->cancel_gc (s);call_rcu (&s->rcu, ip_set_destroy_set_rcu); }return 0 ;
@@ -2367,30 +2383,25 @@ ip_set_net_init(struct net *net) } static void __net_exit -ip_set_net_exit (struct net *net) +ip_set_net_pre_exit (struct net *net) {struct ip_set_net *inst =ip_set_pernet (net); -struct ip_set *set =NULL ; -ip_set_id_t i; - inst->is_deleted = true;/* flag for ip_set_nfnl_put */ +} -nfnl_lock (NFNL_SUBSYS_IPSET ); -for (i =0 ; i < inst->ip_set_max; i++) { - set =ip_set (inst, i); -if (set) { -ip_set (inst, i) =NULL ; - set->variant->cancel_gc (set); -ip_set_destroy_set (set); - } - } -nfnl_unlock (NFNL_SUBSYS_IPSET ); +static void __net_exit +ip_set_net_exit (struct net *net) +{ +struct ip_set_net *inst =ip_set_pernet (net); + +_destroy_all_sets (inst);kvfree (rcu_dereference_protected (inst->ip_set_list,1 )); }static struct pernet_operations ip_set_net_ops = { .init = ip_set_net_init, + .pre_exit = ip_set_net_pre_exit, .exit = ip_set_net_exit, .id = &ip_set_net_id, .size =sizeof (struct ip_set_net ),
net/netfilter/ipset/ip_set_list_set.c +14 -16
@@ -79,7 +79,7 @@ list_set_kadd(struct ip_set *set, const struct sk_buff *skb,struct set_elem *e;int ret; -list_for_each_entry (e, &map->members, list) { +list_for_each_entry_rcu (e, &map->members, list) {if (SET_WITH_TIMEOUT (set) &&ip_set_timeout_expired (ext_timeout (e, set)))continue ;
@@ -99,7 +99,7 @@ list_set_kdel(struct ip_set *set, const struct sk_buff *skb,struct set_elem *e;int ret; -list_for_each_entry (e, &map->members, list) { +list_for_each_entry_rcu (e, &map->members, list) {if (SET_WITH_TIMEOUT (set) &&ip_set_timeout_expired (ext_timeout (e, set)))continue ;
@@ -188,9 +188,10 @@ list_set_utest(struct ip_set *set, void *value, const struct ip_set_ext *ext,struct list_set *map = set->data;struct set_adt_elem *d = value;struct set_elem *e, *next, *prev =NULL ; -int ret; +int ret =0 ; -list_for_each_entry (e, &map->members, list) { +rcu_read_lock (); +list_for_each_entry_rcu (e, &map->members, list) {if (SET_WITH_TIMEOUT (set) &&ip_set_timeout_expired (ext_timeout (e, set)))continue ;
@@ -201,6 +202,7 @@ list_set_utest(struct ip_set *set, void *value, const struct ip_set_ext *ext,if (d->before ==0 ) { ret =1 ; + goto out; }else if (d->before >0 ) { next =list_next_entry (e, list); ret = !list_is_last(&e->list, &map->members) &&
@@ -208,9 +210,11 @@ list_set_utest(struct ip_set *set, void *value, const struct ip_set_ext *ext, }else { ret = prev && prev->id == d->refid; } -return ret; + goto out; } -return 0 ; +out: +rcu_read_unlock (); +return ret; } static void
@@ -239,7 +243,7 @@ list_set_uadd(struct ip_set *set, void *value, const struct ip_set_ext *ext,/* Find where to add the new entry */ n = prev = next =NULL ; -list_for_each_entry (e, &map->members, list) { +list_for_each_entry_rcu (e, &map->members, list) {if (SET_WITH_TIMEOUT (set) &&ip_set_timeout_expired (ext_timeout (e, set)))continue ;
@@ -316,9 +320,9 @@ list_set_udel(struct ip_set *set, void *value, const struct ip_set_ext *ext, {struct list_set *map = set->data;struct set_adt_elem *d = value; -struct set_elem *e, *next, *prev =NULL ; +struct set_elem *e, *n, *next, *prev =NULL ; -list_for_each_entry (e, &map->members, list) { +list_for_each_entry_safe (e, n, &map->members, list) {if (SET_WITH_TIMEOUT (set) &&ip_set_timeout_expired (ext_timeout (e, set)))continue ;
@@ -424,14 +428,8 @@ static void list_set_destroy(struct ip_set *set) {struct list_set *map = set->data; -struct set_elem *e, *n; -list_for_each_entry_safe (e, n, &map->members, list) { -list_del (&e->list); -ip_set_put_byindex (map->net, e->id); -ip_set_ext_destroy (set, e); -kfree (e); - } +WARN_ON_ONCE (!list_empty (&map->members));kfree (map); set->data =NULL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 149/217 net: pse-pd: Use EOPNOTSUPP error code instead of ENOTSUPP
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kory Maincent <[email protected]>
[ Upstream commit 144ba8580bcb82b2686c3d1a043299d844b9a682 ]
ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP as reported by checkpatch script.
--- include/linux/pse-pd/pse.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/pse-pd/pse.h +2 -2
@@ -114,14 +114,14 @@ static inline int pse_ethtool_get_status(struct pse_control *psec,struct netlink_ext_ack *extack, struct pse_control_status *status) { - return -ENOTSUPP; + return -EOPNOTSUPP; }static inline int pse_ethtool_set_config (struct pse_control *psec,struct netlink_ext_ack *extack,const struct pse_control_config *config) { -return -ENOTSUPP ; +return -EOPNOTSUPP ; }#endif
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 150/217 gve: ignore nonrelevant GSO type bits when processing TSO headers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joshua Washington <[email protected]>
[ Upstream commit 1b9f756344416e02b41439bf2324b26aa25e141c ]
TSO currently fails when the skb's gso_type field has more than one bit set.
TSO packets can be passed from userspace using PF_PACKET, TUNTAP and a few others, using virtio_net_hdr (e.g., PACKET_VNET_HDR). This includes virtualization, such as QEMU, a real use-case.
The gso_type and gso_size fields as passed from userspace in virtio_net_hdr are not trusted blindly by the kernel. It adds gso_type |= SKB_GSO_DODGY to force the packet to enter the software GSO stack for verification.
This issue might similarly come up when the CWR bit is set in the TCP header for congestion control, causing the SKB_GSO_TCP_ECN gso_type bit to be set.
v2 - Remove unnecessary comments, remove line break between fixes tag and signoffs.
v3 - Add back unrelated empty line removal.
--- drivers/net/ethernet/google/gve/gve_tx_dqo.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-)
drivers/net/ethernet/google/gve/gve_tx_dqo.c +5 -15
@@ -370,28 +370,18 @@ static int gve_prep_tso(struct sk_buff *skb)if (unlikely (skb_shinfo (skb)->gso_size <GVE_TX_MIN_TSO_MSS_DQO ))return -1 ; +if (!(skb_shinfo (skb)->gso_type & (SKB_GSO_TCPV4 |SKB_GSO_TCPV6 ))) +return -EINVAL ; +/* Needed because we will modify header. */ err =skb_cow_head (skb,0 );if (err <0 )return err; tcp =tcp_hdr (skb); - -/* Remove payload length from checksum. */ paylen = skb->len -skb_transport_offset (skb); - -switch (skb_shinfo (skb)->gso_type) { -case SKB_GSO_TCPV4 : -case SKB_GSO_TCPV6 : -csum_replace_by_diff (&tcp->check, - (__force __wsum )htonl (paylen)); - -/* Compute length of segmentation header. */ - header_len =skb_tcp_all_headers (skb); -break ; -default : -return -EINVAL ; - } +csum_replace_by_diff (&tcp->check, (__force __wsum )htonl (paylen)); + header_len =skb_tcp_all_headers (skb);if (unlikely (header_len >GVE_TX_MAX_HDR_SIZE_DQO ))return -EINVAL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 151/217 net: stmmac: replace priv->speed with the portTransmitRate from the tc-cbs parameters
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaolei Wang <[email protected]>
[ Upstream commit be27b896529787e23a35ae4befb6337ce73fcca0 ]
The current cbs parameter depends on speed after uplinking, which is not needed and will report a configuration error if the port is not initially connected. The UAPI exposed by tc-cbs requires userspace to recalculate the send slope anyway, because the formula depends on port_transmit_rate (see man tc-cbs), which is not an invariant from tc's perspective. Therefore, we use offload->sendslope and offload->idleslope to derive the original port_transmit_rate from the CBS formula.
--- .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +11 -14
@@ -343,10 +343,11 @@ static int tc_setup_cbs(struct stmmac_priv *priv, struct tc_cbs_qopt_offload *qopt) {u32 tx_queues_count = priv->plat->tx_queues_to_use; +s64 port_transmit_rate_kbps;u32 queue = qopt->queue; -u32 ptr, speed_div;u32 mode_to_use;u64 value; +u32 ptr;int ret;/* Queue 0 is not AVB capable */
@@ -355,30 +356,26 @@ static int tc_setup_cbs(struct stmmac_priv *priv,if (!priv->dma_cap.av)return -EOPNOTSUPP ; + port_transmit_rate_kbps = qopt->idleslope - qopt->sendslope; +/* Port Transmit Rate and Speed Divider */ -switch (priv->speed) { +switch (div_s64 (port_transmit_rate_kbps,1000 )) {case SPEED_10000 : - ptr =32 ; - speed_div =10000000 ; -break ;case SPEED_5000 : ptr =32 ; - speed_div =5000000 ;break ;case SPEED_2500 : - ptr =8 ; - speed_div =2500000 ; -break ;case SPEED_1000 : ptr =8 ; - speed_div =1000000 ;break ;case SPEED_100 : ptr =4 ; - speed_div =100000 ;break ;default : -return -EOPNOTSUPP ; +netdev_err (priv->dev, +"Invalid portTransmitRate %lld (idleSlope - sendSlope)\n" , + port_transmit_rate_kbps); +return -EINVAL ; } mode_to_use = priv->plat->tx_queues_cfg[queue].mode_to_use;
@@ -398,10 +395,10 @@ static int tc_setup_cbs(struct stmmac_priv *priv, }/* Final adjustments for HW */ - value =div_s64 (qopt->idleslope *1024ll * ptr, speed_div); + value =div_s64 (qopt->idleslope *1024ll * ptr, port_transmit_rate_kbps); priv->plat->tx_queues_cfg[queue].idle_slope = value &GENMASK (31 ,0 ); - value =div_s64 (-qopt->sendslope *1024ll * ptr, speed_div); + value =div_s64 (-qopt->sendslope *1024ll * ptr, port_transmit_rate_kbps); priv->plat->tx_queues_cfg[queue].send_slope = value &GENMASK (31 ,0 ); value = qopt->hicredit *1024ll *8 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 152/217 nvmet-passthru: propagate status from id override functions
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Wagner <[email protected]>
[ Upstream commit d76584e53f4244dbc154bec447c3852600acc914 ]
The id override functions return a status which is not propagated to the caller.
--- drivers/nvme/target/passthru.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nvme/target/passthru.c +3 -3
@@ -226,13 +226,13 @@ static void nvmet_passthru_execute_cmd_work(struct work_struct *w) req->cmd->common.opcode == nvme_admin_identify) {switch (req->cmd->identify.cns) {case NVME_ID_CNS_CTRL : -nvmet_passthru_override_id_ctrl (req); + status =nvmet_passthru_override_id_ctrl (req);break ;case NVME_ID_CNS_NS : -nvmet_passthru_override_id_ns (req); + status =nvmet_passthru_override_id_ns (req);break ;case NVME_ID_CNS_NS_DESC_LIST : -nvmet_passthru_override_id_descs (req); + status =nvmet_passthru_override_id_descs (req);break ; } } else if (status < 0)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 153/217 net/ipv6: Fix the RT cache flush via sysctl using a previous delay
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Pavlu <[email protected]>
[ Upstream commit 14a20e5b4ad998793c5f43b0330d9e1388446cf3 ]
The net.ipv6.route.flush system parameter takes a value which specifies a delay used during the flush operation for aging exception routes. The written value is however not used in the currently requested flush and instead utilized only in the next one.
A problem is that ipv6_sysctl_rtcache_flush() first reads the old value of net->ipv6.sysctl.flush_delay into a local delay variable and then calls proc_dointvec() which actually updates the sysctl based on the provided input.
Fix the problem by switching the order of the two operations.
--- net/ipv6/route.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv6/route.c +2 -2
@@ -6335,12 +6335,12 @@ static int ipv6_sysctl_rtcache_flush(struct ctl_table *ctl, int write,if (!write)return -EINVAL ; - net = (struct net *)ctl->extra1; - delay = net->ipv6.sysctl.flush_delay; ret =proc_dointvec (ctl, write, buffer, lenp, ppos);if (ret)return ret; + net = (struct net *)ctl->extra1; + delay = net->ipv6.sysctl.flush_delay;fib6_run_gc (delay <=0 ?0 : (unsigned long )delay, net, delay >0 );return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 154/217 net: bridge: mst: pass vlan group directly to br_mst_vlan_set_state
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
[ Upstream commit 36c92936e868601fa1f43da6758cf55805043509 ]
Pass the already obtained vlan group pointer to br_mst_vlan_set_state() instead of dereferencing it again. Each caller has already correctly dereferenced it for their context. This change is required for the following suspicious RCU dereference fix. No functional changes intended.
--- net/bridge/br_mst.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
net/bridge/br_mst.c +5 -6
@@ -73,11 +73,10 @@ int br_mst_get_state(const struct net_device *dev, u16 msti, u8 *state) }EXPORT_SYMBOL_GPL (br_mst_get_state); -static void br_mst_vlan_set_state (struct net_bridge_port *p,struct net_bridge_vlan *v, +static void br_mst_vlan_set_state (struct net_bridge_vlan_group *vg, +struct net_bridge_vlan *v,u8 state) { -struct net_bridge_vlan_group *vg =nbp_vlan_group (p); -if (br_vlan_get_state (v) == state)return ;
@@ -121,7 +120,7 @@ int br_mst_set_state(struct net_bridge_port *p, u16 msti, u8 state,if (v->brvlan->msti != msti)continue ; -br_mst_vlan_set_state (p, v, state); +br_mst_vlan_set_state (vg, v, state); } out:
@@ -140,13 +139,13 @@ static void br_mst_vlan_sync_state(struct net_bridge_vlan *pv, u16 msti)* it. */ if (v != pv && v->brvlan->msti == msti) { -br_mst_vlan_set_state (pv->port, pv, v->state); +br_mst_vlan_set_state (vg, pv, v->state);return ; } }/* Otherwise, start out in a new MSTI with all ports disabled. */ -return br_mst_vlan_set_state (pv->port, pv,BR_STATE_DISABLED ); +return br_mst_vlan_set_state (vg, pv,BR_STATE_DISABLED ); }int br_mst_vlan_set_msti (struct net_bridge_vlan *mv,u16 msti)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 155/217 net: bridge: mst: fix suspicious rcu usage in br_mst_set_state
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
[ Upstream commit 546ceb1dfdac866648ec959cbc71d9525bd73462 ]
I converted br_mst_set_state to RCU to avoid a vlan use-after-free but forgot to change the vlan group dereference helper. Switch to vlan group RCU deref helper to fix the suspicious rcu usage warning.
--- net/bridge/br_mst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bridge/br_mst.c +1 -1
@@ -102,7 +102,7 @@ int br_mst_set_state(struct net_bridge_port *p, u16 msti, u8 state,int err =0 ;rcu_read_lock (); - vg =nbp_vlan_group (p); + vg =nbp_vlan_group_rcu (p);if (!vg) goto out;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 156/217 ionic: fix use after netif_napi_del()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taehee Yoo <[email protected]>
[ Upstream commit 79f18a41dd056115d685f3b0a419c7cd40055e13 ]
When queues are started, netif_napi_add() and napi_enable() are called. If there are 4 queues and only 3 queues are used for the current configuration, only 3 queues' napi should be registered and enabled. The ionic_qcq_enable() checks whether the .poll pointer is not NULL for enabling only the using queue' napi. Unused queues' napi will not be registered by netif_napi_add(), so the .poll pointer indicates NULL. But it couldn't distinguish whether the napi was unregistered or not because netif_napi_del() doesn't reset the .poll pointer to NULL. So, ionic_qcq_enable() calls napi_enable() for the queue, which was unregistered by netif_napi_del().
Reproducer:
ethtool -L <interface name> rx 1 tx 1 combined 0 ethtool -L <interface name> rx 0 tx 0 combined 1 ethtool -L <interface name> rx 0 tx 0 combined 4
Splat looks like:
kernel BUG at net/core/dev.c:6666!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP NOPTI CPU: 3 PID: 1057 Comm: kworker/3:3 Not tainted 6.10.0-rc2+ #16 Workqueue: events ionic_lif_deferred_work [ionic] RIP: 0010:napi_enable+0x3b/0x40 Code: 48 89 c2 48 83 e2 f6 80 b9 61 09 00 00 00 74 0d 48 83 bf 60 01 00 00 00 74 03 80 ce 01 f0 4f RSP: 0018:ffffb6ed83227d48 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff97560cda0828 RCX: 0000000000000029 RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff97560cda0a28 RBP: ffffb6ed83227d50 R08: 0000000000000400 R09: 0000000000000001 R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000000 R13: ffff97560ce3c1a0 R14: 0000000000000000 R15: ffff975613ba0a20 FS: 0000000000000000(0000) GS:ffff975d5f780000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f8f734ee200 CR3: 0000000103e50000 CR4: 00000000007506f0 PKRU: 55555554 Call Trace: <TASK> ? die+0x33/0x90 ? do_trap+0xd9/0x100 ? napi_enable+0x3b/0x40 ? do_error_trap+0x83/0xb0 ? napi_enable+0x3b/0x40 ? napi_enable+0x3b/0x40 ? exc_invalid_op+0x4e/0x70 ? napi_enable+0x3b/0x40 ? asm_exc_invalid_op+0x16/0x20 ? napi_enable+0x3b/0x40 ionic_qcq_enable+0xb7/0x180 [ionic 59bdfc8a035436e1c4224ff7d10789e3f14643f8] ionic_start_queues+0xc4/0x290 [ionic 59bdfc8a035436e1c4224ff7d10789e3f14643f8] ionic_link_status_check+0x11c/0x170 [ionic 59bdfc8a035436e1c4224ff7d10789e3f14643f8] ionic_lif_deferred_work+0x129/0x280 [ionic 59bdfc8a035436e1c4224ff7d10789e3f14643f8] process_one_work+0x145/0x360 worker_thread+0x2bb/0x3d0 ? __pfx_worker_thread+0x10/0x10 kthread+0xcc/0x100 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x2d/0x50 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30
--- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +1 -3
@@ -292,10 +292,8 @@ static int ionic_qcq_enable(struct ionic_qcq *qcq)if (ret)return ret; -if (qcq->napi.poll) -napi_enable (&qcq->napi); -if (qcq->flags &IONIC_QCQ_F_INTR ) { +napi_enable (&qcq->napi);irq_set_affinity_hint (qcq->intr.vector, &qcq->intr.affinity_mask); ionic_intr_mask(idev->intr_ctrl, qcq->intr.index,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 157/217 af_unix: Read with MSG_PEEK loops if the first unread byte is OOB
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rao Shoaib <[email protected]>
[ Upstream commit a6736a0addd60fccc3a3508461d72314cc609772 ]
Read with MSG_PEEK flag loops if the first byte to read is an OOB byte. commit 22dd70eb2c3d ("af_unix: Don't peek OOB data without MSG_OOB.") addresses the loop issue but does not address the issue that no data beyond OOB byte can be read.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
from socket import *
c1, c2 =socketpair(AF_UNIX, SOCK_STREAM)c1.send(b'a', MSG_OOB)
1
Quoted 1 line
Quoted 1 line
Quoted 1 line
c1.send(b'b')
1
Quoted 1 line
Quoted 1 line
Quoted 1 line
c2.recv(1, MSG_PEEK | MSG_DONTWAIT)
b'b'
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
from socket import *
c1, c2 =socketpair(AF_UNIX, SOCK_STREAM)c2.setsockopt(SOL_SOCKET, SO_OOBINLINE, 1)c1.send(b'a', MSG_OOB)
1
Quoted 1 line
Quoted 1 line
Quoted 1 line
c1.send(b'b')
1
Quoted 1 line
Quoted 1 line
Quoted 1 line
c2.recv(1, MSG_PEEK | MSG_DONTWAIT)
b'a'
Quoted 1 line
Quoted 1 line
Quoted 1 line
c2.recv(1, MSG_PEEK | MSG_DONTWAIT)
b'a'
Quoted 1 line
Quoted 1 line
Quoted 1 line
c2.recv(1, MSG_DONTWAIT)
b'a'
Quoted 1 line
Quoted 1 line
Quoted 1 line
c2.recv(1, MSG_PEEK | MSG_DONTWAIT)
b'b'
Quoted 1 line
Quoted 1 line
Quoted 1 line
--- net/unix/af_unix.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
net/unix/af_unix.c +9 -9
@@ -2682,18 +2682,18 @@ static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk,if (skb == u->oob_skb) {if (copied) { skb =NULL ; - }else if (sock_flag (sk,SOCK_URGINLINE )) { -if (!(flags &MSG_PEEK )) { + }else if (!(flags &MSG_PEEK )) { +if (sock_flag (sk,SOCK_URGINLINE )) {WRITE_ONCE (u->oob_skb,NULL );consume_skb (skb); + }else { +__skb_unlink (skb, &sk->sk_receive_queue); +WRITE_ONCE (u->oob_skb,NULL ); + unlinked_skb = skb; + skb =skb_peek (&sk->sk_receive_queue); } - }else if (flags &MSG_PEEK ) { - skb =NULL ; - }else { -__skb_unlink (skb, &sk->sk_receive_queue); -WRITE_ONCE (u->oob_skb,NULL ); - unlinked_skb = skb; - skb =skb_peek (&sk->sk_receive_queue); + }else if (!sock_flag (sk,SOCK_URGINLINE )) { + skb =skb_peek_next (skb, &sk->sk_receive_queue); } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 158/217 bnxt_en: Adjust logging of firmware messages in case of released token in __hwrm_send()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Mishin <[email protected]>
[ Upstream commit a9b9741854a9fe9df948af49ca5514e0ed0429df ]
In case of token is released due to token->state == BNXT_HWRM_DEFERRED, released token (set to NULL) is used in log messages. This issue is expected to be prevented by HWRM_ERR_CODE_PF_UNAVAILABLE error code. But this error code is returned by recent firmware. So some firmware may not return it. This may lead to NULL pointer dereference.
Adjust this issue by adding token pointer check.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c +1 -1
@@ -678,7 +678,7 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx) req_type); else if (rc && rc != HWRM_ERR_CODE_PF_UNAVAILABLE) hwrm_err(bp, ctx, "hwrm req_type 0x%x seq id 0x%x error 0x%x\n", - req_type, token->seq_id, rc); + req_type, le16_to_cpu(ctx->req->seq_id), rc); rc =__hwrm_to_stderr (rc); exit:if (token)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 159/217 misc: microchip: pci1xxxx: fix double free in the error handling of gp_aux_bus_probe()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yongzhi Liu <[email protected]>
commit 086c6cbcc563c81d55257f9b27e14faf1d0963d3 upstream.
When auxiliary_device_add() returns error and then calls auxiliary_device_uninit(), callback function gp_auxiliary_device_release() calls ida_free() and kfree(aux_device_wrapper) to free memory. We should't call them again in the error handling path.
Fix this by skipping the redundant cleanup functions.
--- drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.c +3 -0
@@ -111,6 +111,7 @@ static int gp_aux_bus_probe(struct pci_d err_aux_dev_add_1:auxiliary_device_uninit (&aux_bus->aux_device_wrapper[1 ]->aux_dev); + goto err_aux_dev_add_0; err_aux_dev_init_1:ida_free (&gp_client_ida, aux_bus->aux_device_wrapper[1 ]->aux_dev.id);
@@ -120,6 +121,7 @@ err_ida_alloc_1: err_aux_dev_add_0:auxiliary_device_uninit (&aux_bus->aux_device_wrapper[0 ]->aux_dev); + goto err_ret; err_aux_dev_init_0:ida_free (&gp_client_ida, aux_bus->aux_device_wrapper[0 ]->aux_dev.id);
@@ -127,6 +129,7 @@ err_aux_dev_init_0: err_ida_alloc_0:kfree (aux_bus->aux_device_wrapper[0 ]); +err_ret:return retval; }
Greg Kroah-Hartman
maintainerPATCH 160/217 x86/boot: Dont add the EFI stub to targets, again
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Segall <[email protected]>
commit b2747f108b8034271fd5289bd8f3a7003e0775a3 upstream.
This is a re-commit of
da05b143a308 ("x86/boot: Don't add the EFI stub to targets")
after the tagged patch incorrectly reverted it.
vmlinux-objs-y is added to targets, with an assumption that they are all relative to $(obj); adding a $(objtree)/drivers/... path causes the build to incorrectly create a useless arch/x86/boot/compressed/drivers/... directory tree.
Fix this just by using a different make variable for the EFI stub.
--- arch/x86/boot/compressed/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/boot/compressed/Makefile +2 -2
@@ -115,9 +115,9 @@ vmlinux-objs-$(CONFIG_INTEL_TDX_GUEST) + vmlinux-objs-$(CONFIG_EFI) += $(obj)/efi.o vmlinux-objs-$(CONFIG_EFI_MIXED) += $(obj)/efi_mixed.o -vmlinux-objs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a +vmlinux-libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a -$(obj)/vmlinux: $(vmlinux-objs-y) FORCE +$(obj)/vmlinux: $(vmlinux-objs-y) $(vmlinux-libs-y) FORCE $(call if_changed,ld) OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
Greg Kroah-Hartman
maintainerPATCH 161/217 iio: adc: ad9467: fix scan type sign
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Lechner <[email protected]>
commit 8a01ef749b0a632f0e1f4ead0f08b3310d99fcb1 upstream.
According to the IIO documentation, the sign in the scan type should be lower case. The ad9467 driver was incorrectly using upper case.
Fix by changing to lower case.
--- drivers/iio/adc/ad9467.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ad9467.c +2 -2
@@ -223,11 +223,11 @@ static void __ad9467_get_scale(struct ad }static const struct iio_chan_spec ad9434_channels[] = { -AD9467_CHAN (0 ,0 ,12 ,'S' ), +AD9467_CHAN (0 ,0 ,12 ,'s' ), };static const struct iio_chan_spec ad9467_channels[] = { -AD9467_CHAN (0 ,0 ,16 ,'S' ), +AD9467_CHAN (0 ,0 ,16 ,'s' ), };static const struct ad9467_chip_info ad9467_chip_tbl[] = {
Greg Kroah-Hartman
maintainerPATCH 162/217 iio: dac: ad5592r: fix temperature channel scaling value
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Ferland <[email protected]>
commit 279428df888319bf68f2686934897301a250bb84 upstream.
The scale value for the temperature channel is (assuming Vref=2.5 and the datasheet):
376.7897513
When calculating both val and val2 for the temperature scale we use (3767897513/25) and multiply it by Vref (here I assume 2500mV) to obtain:
2500 * (3767897513/25) ==> 376789751300
Finally we divide with remainder by 10^9 to get:
val = 376
val2 = 789751300However, we return IIO_VAL_INT_PLUS_MICRO (should have been NANO) as the scale type. So when converting the raw temperature value to the 'processed' temperature value we will get (assuming raw=810, offset=-753):
processed = (raw + offset) * scale_val
= (810 + -753) * 376
= 21432
processed += div((raw + offset) * scale_val2, 10^6)
+= div((810 + -753) * 789751300, 10^6)
+= 45015
==> 66447
==> 66.4 Celciusinstead of the expected 21.5 Celsius.
Fix this issue by changing IIO_VAL_INT_PLUS_MICRO to IIO_VAL_INT_PLUS_NANO.
--- drivers/iio/dac/ad5592r-base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad5592r-base.c +1 -1
@@ -410,7 +410,7 @@ static int ad5592r_read_raw(struct iio_ds64 tmp = *val * (3767897513LL /25LL ); *val =div_s64_rem (tmp,1000000000LL , val2); -return IIO_VAL_INT_PLUS_MICRO ; +return IIO_VAL_INT_PLUS_NANO ; }mutex_lock (&st->lock);
Greg Kroah-Hartman
maintainerPATCH 163/217 iio: imu: inv_icm42600: delete unneeded update watermark call
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean-Baptiste Maneyrol <[email protected]>
commit 245f3b149e6cc3ac6ee612cdb7042263bfc9e73c upstream.
Update watermark will be done inside the hwfifo_set_watermark callback just after the update_scan_mode. It is useless to do it here.
--- drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c | 4 ---- drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c | 4 ---- 2 files changed, 8 deletions(-)
drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c +0 -4
@@ -128,10 +128,6 @@ static int inv_icm42600_accel_update_sca/* update data FIFO write */ inv_icm42600_timestamp_apply_odr (ts,0 ,0 ,0 ); ret =inv_icm42600_buffer_set_fifo_en (st, fifo_en | st->fifo.en); -if (ret) - goto out_unlock; - - ret =inv_icm42600_buffer_update_watermark (st); out_unlock:mutex_unlock (&st->lock);
drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c +0 -4
@@ -128,10 +128,6 @@ static int inv_icm42600_gyro_update_scan/* update data FIFO write */ inv_icm42600_timestamp_apply_odr (ts,0 ,0 ,0 ); ret =inv_icm42600_buffer_set_fifo_en (st, fifo_en | st->fifo.en); -if (ret) - goto out_unlock; - - ret =inv_icm42600_buffer_update_watermark (st); out_unlock:mutex_unlock (&st->lock);
Greg Kroah-Hartman
maintainerPATCH 164/217 drivers: core: synchronize really_probe() and dev_uevent()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dirk Behme <[email protected]>
commit c0a40097f0bc81deafc15f9195d1fb54595cd6d0 upstream.
Synchronize the dev->driver usage in really_probe() and dev_uevent(). These can run in different threads, what can result in the following race condition for dev->driver uninitialization:
Thread #1:
==========
really_probe() {
...probe_failed:
...
device_unbind_cleanup(dev) {
...
dev->driver = NULL; // <= Failed probe sets dev->driver to NULL
...
}...
}
Thread #2:
==========
dev_uevent() {
...
if (dev->driver)
// If dev->driver is NULLed from really_probe() from here on,
// after above check, the system crashes
add_uevent_var(env, "DRIVER=%s", dev->driver->name);...
}
really_probe() holds the lock, already. So nothing needs to be done there. dev_uevent() is called with lock held, often, too. But not always. What implies that we can't add any locking in dev_uevent() itself. So fix this race by adding the lock to the non-protected path. This is the path where above race is observed:
dev_uevent+0x235/0x380 uevent_show+0x10c/0x1f0 <= Add lock here dev_attr_show+0x3a/0xa0 sysfs_kf_seq_show+0x17c/0x250 kernfs_seq_show+0x7c/0x90 seq_read_iter+0x2d7/0x940 kernfs_fop_read_iter+0xc6/0x310 vfs_read+0x5bc/0x6b0 ksys_read+0xeb/0x1b0 __x64_sys_read+0x42/0x50 x64_sys_call+0x27ad/0x2d30 do_syscall_64+0xcd/0x1d0 entry_SYSCALL_64_after_hwframe+0x77/0x7f
Similar cases are reported by syzkaller in
https://syzkaller.appspot.com/bug?extid=ffa8143439596313a85a
But these are regarding the *initialization* of dev->driver
dev->driver = drv;
As this switches dev->driver to non-NULL these reports can be considered to be false-positives (which should be "fixed" by this commit, as well, though).
The same issue was reported and tried to be fixed back in 2015 in
https://lore.kernel.org/lkml/[email protected]/
already.
--- drivers/base/core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/base/core.c +3 -0
@@ -2657,8 +2657,11 @@ static ssize_t uevent_show(struct deviceif (!env)return -ENOMEM ; +/* Synchronize with really_probe() */ +device_lock (dev);/* let the kset specific function add its keys */ retval = kset->uevent_ops->uevent (&dev->kobj, env); +device_unlock (dev);if (retval) goto out;
Greg Kroah-Hartman
maintainerPATCH 165/217 drm/exynos/vidi: fix memory leak in .get_modes()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jani Nikula <[email protected]>
commit 38e3825631b1f314b21e3ade00b5a4d737eb054e upstream.
The duplicated EDID is never freed. Fix it.
--- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_vidi.c +6 -1
@@ -309,6 +309,7 @@ static int vidi_get_modes(struct drm_construct vidi_context *ctx =ctx_from_connector (connector);struct edid *edid;int edid_len; +int count;/* * the edid data comes from user side and it would be set
@@ -328,7 +329,11 @@ static int vidi_get_modes(struct drm_condrm_connector_update_edid_property (connector, edid); -return drm_add_edid_modes (connector, edid); + count =drm_add_edid_modes (connector, edid); + +kfree (edid); + +return count; }static const struct drm_connector_helper_funcs vidi_connector_helper_funcs = {
Greg Kroah-Hartman
maintainerPATCH 166/217 drm/exynos: hdmi: report safe 640x480 mode as a fallback when no EDID found
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
commit 799d4b392417ed6889030a5b2335ccb6dcf030ab upstream.
When reading EDID fails and driver reports no modes available, the DRM core adds an artificial 1024x786 mode to the connector. Unfortunately some variants of the Exynos HDMI (like the one in Exynos4 SoCs) are not able to drive such mode, so report a safe 640x480 mode instead of nothing in case of the EDID reading failure.
This fixes the following issue observed on Trats2 board since commit 13d5b040363c ("drm/exynos: do not return negative values from .get_modes()"):
[drm] Exynos DRM: using 11c00000.fimd device for DMA mapping operations
exynos-drm exynos-drm: bound 11c00000.fimd (ops fimd_component_ops)
exynos-drm exynos-drm: bound 12c10000.mixer (ops mixer_component_ops)
exynos-dsi 11c80000.dsi: [drm:samsung_dsim_host_attach] Attached s6e8aa0 device (lanes:4 bpp:24 mode-flags:0x10b) exynos-drm exynos-drm: bound 11c80000.dsi (ops exynos_dsi_component_ops)
exynos-drm exynos-drm: bound 12d00000.hdmi (ops hdmi_component_ops)
[drm] Initialized exynos 1.1.0 20180330 for exynos-drm on minor 1
exynos-hdmi 12d00000.hdmi: [drm:hdmiphy_enable.part.0] *ERROR* PLL could not reach steady state panel-samsung-s6e8aa0 11c80000.dsi.0: ID: 0xa2, 0x20, 0x8c
exynos-mixer 12c10000.mixer: timeout waiting for VSYNC
------------[ cut here ]------------ WARNING: CPU: 1 PID: 11 at drivers/gpu/drm/drm_atomic_helper.c:1682 drm_atomic_helper_wait_for_vblanks.part.0+0x2b0/0x2b8 [CRTC:70:crtc-1] vblank wait timed out Modules linked in: CPU: 1 PID: 11 Comm: kworker/u16:0 Not tainted 6.9.0-rc5-next-20240424 #14913 Hardware name: Samsung Exynos (Flattened Device Tree) Workqueue: events_unbound deferred_probe_work_func Call trace: unwind_backtrace from show_stack+0x10/0x14 show_stack from dump_stack_lvl+0x68/0x88 dump_stack_lvl from __warn+0x7c/0x1c4 __warn from warn_slowpath_fmt+0x11c/0x1a8 warn_slowpath_fmt from drm_atomic_helper_wait_for_vblanks.part.0+0x2b0/0x2b8 drm_atomic_helper_wait_for_vblanks.part.0 from drm_atomic_helper_commit_tail_rpm+0x7c/0x8c drm_atomic_helper_commit_tail_rpm from commit_tail+0x9c/0x184 commit_tail from drm_atomic_helper_commit+0x168/0x190 drm_atomic_helper_commit from drm_atomic_commit+0xb4/0xe0 drm_atomic_commit from drm_client_modeset_commit_atomic+0x23c/0x27c drm_client_modeset_commit_atomic from drm_client_modeset_commit_locked+0x60/0x1cc drm_client_modeset_commit_locked from drm_client_modeset_commit+0x24/0x40 drm_client_modeset_commit from __drm_fb_helper_restore_fbdev_mode_unlocked+0x9c/0xc4 __drm_fb_helper_restore_fbdev_mode_unlocked from drm_fb_helper_set_par+0x2c/0x3c drm_fb_helper_set_par from fbcon_init+0x3d8/0x550 fbcon_init from visual_init+0xc0/0x108 visual_init from do_bind_con_driver+0x1b8/0x3a4 do_bind_con_driver from do_take_over_console+0x140/0x1ec do_take_over_console from do_fbcon_takeover+0x70/0xd0 do_fbcon_takeover from fbcon_fb_registered+0x19c/0x1ac fbcon_fb_registered from register_framebuffer+0x190/0x21c register_framebuffer from __drm_fb_helper_initial_config_and_unlock+0x350/0x574 __drm_fb_helper_initial_config_and_unlock from exynos_drm_fbdev_client_hotplug+0x6c/0xb0 exynos_drm_fbdev_client_hotplug from drm_client_register+0x58/0x94 drm_client_register from exynos_drm_bind+0x160/0x190 exynos_drm_bind from try_to_bring_up_aggregate_device+0x200/0x2d8 try_to_bring_up_aggregate_device from __component_add+0xb0/0x170 __component_add from mixer_probe+0x74/0xcc mixer_probe from platform_probe+0x5c/0xb8 platform_probe from really_probe+0xe0/0x3d8 really_probe from __driver_probe_device+0x9c/0x1e4 __driver_probe_device from driver_probe_device+0x30/0xc0 driver_probe_device from __device_attach_driver+0xa8/0x120 __device_attach_driver from bus_for_each_drv+0x80/0xcc bus_for_each_drv from __device_attach+0xac/0x1fc __device_attach from bus_probe_device+0x8c/0x90 bus_probe_device from deferred_probe_work_func+0x98/0xe0 deferred_probe_work_func from process_one_work+0x240/0x6d0 process_one_work from worker_thread+0x1a0/0x3f4 worker_thread from kthread+0x104/0x138 kthread from ret_from_fork+0x14/0x28 Exception stack(0xf0895fb0 to 0xf0895ff8) ... irq event stamp: 82357 hardirqs last enabled at (82363): [<c01a96e8>] vprintk_emit+0x308/0x33c hardirqs last disabled at (82368): [<c01a969c>] vprintk_emit+0x2bc/0x33c softirqs last enabled at (81614): [<c0101644>] __do_softirq+0x320/0x500 softirqs last disabled at (81609): [<c012dfe0>] __irq_exit_rcu+0x130/0x184 ---[ end trace 0000000000000000 ]---
exynos-drm exynos-drm: [drm] *ERROR* flip_done timed out
exynos-drm exynos-drm: [drm] *ERROR* [CRTC:70:crtc-1] commit wait timed out exynos-drm exynos-drm: [drm] *ERROR* flip_done timed out
exynos-drm exynos-drm: [drm] *ERROR* [CONNECTOR:74:HDMI-A-1] commit wait timed out exynos-drm exynos-drm: [drm] *ERROR* flip_done timed out
exynos-drm exynos-drm: [drm] *ERROR* [PLANE:56:plane-5] commit wait timed out exynos-mixer 12c10000.mixer: timeout waiting for VSYNC
--- drivers/gpu/drm/exynos/exynos_hdmi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/exynos/exynos_hdmi.c +5 -2
@@ -887,11 +887,11 @@ static int hdmi_get_modes(struct drm_conint ret;if (!hdata->ddc_adpt) -return 0 ; + goto no_edid; edid =drm_get_edid (connector, hdata->ddc_adpt);if (!edid) -return 0 ; + goto no_edid; hdata->dvi_mode = !connector->display_info.is_hdmi; DRM_DEV_DEBUG_KMS(hdata->dev, "%s : width[%d] x height[%d]\n",
@@ -906,6 +906,9 @@ static int hdmi_get_modes(struct drm_conkfree (edid);return ret; + +no_edid: +return drm_add_modes_noedid (connector,640 ,480 ); }static int hdmi_find_phy_conf (struct hdmi_context *hdata,u32 pixel_clock)
Greg Kroah-Hartman
maintainerPATCH 167/217 mptcp: ensure snd_una is properly initialized on connect
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit 8031b58c3a9b1db3ef68b3bd749fbee2e1e1aaa3 upstream.
This is strictly related to commit fb7a0d334894 ("mptcp: ensure snd_nxt is properly initialized on connect"). It turns out that syzkaller can trigger the retransmit after fallback and before processing any other incoming packet - so that snd_una is still left uninitialized.
Address the issue explicitly initializing snd_una together with snd_nxt and write_seq.
--- net/mptcp/protocol.c | 1 + 1 file changed, 1 insertion(+)
net/mptcp/protocol.c +1 -0
@@ -3757,6 +3757,7 @@ static int mptcp_connect(struct sock *skWRITE_ONCE (msk->write_seq, subflow->idsn);WRITE_ONCE (msk->snd_nxt, subflow->idsn); +WRITE_ONCE (msk->snd_una, subflow->idsn);if (likely (!__mptcp_check_fallback (msk)))MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_MPCAPABLEACTIVE );
Greg Kroah-Hartman
maintainerPATCH 168/217 mptcp: pm: inc RmAddr MIB counter once per RM_ADDR ID
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: YonglongLi <[email protected]>
commit 6a09788c1a66e3d8b04b3b3e7618cc817bb60ae9 upstream.
The RmAddr MIB counter is supposed to be incremented once when a valid RM_ADDR has been received. Before this patch, it could have been incremented as many times as the number of subflows connected to the linked address ID, so it could have been 0, 1 or more than 1.
The "RmSubflow" is incremented after a local operation. In this case, it is normal to tied it with the number of subflows that have been actually removed.
The "remove invalid addresses" MP Join subtest has been modified to validate this case. A broadcast IP address is now used instead: the client will not be able to create a subflow to this address. The consequence is that when receiving the RM_ADDR with the ID attached to this broadcast IP address, no subflow linked to this ID will be found.
--- net/mptcp/pm_netlink.c | 5 ++++- tools/testing/selftests/net/mptcp/mptcp_join.sh | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-)
net/mptcp/pm_netlink.c +4 -1
@@ -820,10 +820,13 @@ static void mptcp_pm_nl_rm_addr_or_subflspin_lock_bh (&msk->pm.lock); removed = true; -__MPTCP_INC_STATS (sock_net (sk), rm_type); +if (rm_type ==MPTCP_MIB_RMSUBFLOW ) +__MPTCP_INC_STATS (sock_net (sk), rm_type); }if (rm_type ==MPTCP_MIB_RMSUBFLOW )__set_bit (rm_id ? rm_id : msk->mpc_endpoint_id, msk->pm.id_avail_bitmap); +else if (rm_type ==MPTCP_MIB_RMADDR ) +__MPTCP_INC_STATS (sock_net (sk), rm_type);if (!removed)continue ;
tools/testing/selftests/net/mptcp/mptcp_join.sh +2 -1
@@ -2344,7 +2344,8 @@ remove_tests() pm_nl_set_limits $ns1 3 3 pm_nl_add_endpoint $ns1 10.0.12.1 flags signal pm_nl_add_endpoint $ns1 10.0.3.1 flags signal - pm_nl_add_endpoint $ns1 10.0.14.1 flags signal + # broadcast IP: no packet for this address will be received on ns1 + pm_nl_add_endpoint $ns1 224.0.0.1 flags signal pm_nl_set_limits $ns2 3 3 run_tests $ns1 $ns2 10.0.1.1 0 -3 0 speed_10 chk_join_nr 1 1 1
Greg Kroah-Hartman
maintainerPATCH 169/217 irqchip/gic-v3-its: Fix potential race condition in its_vlpi_prop_update()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hagar Hemdan <[email protected]>
commit b97e8a2f7130a4b30d1502003095833d16c028b3 upstream.
its_vlpi_prop_update() calls lpi_write_config() which obtains the mapping information for a VLPI without lock held. So it could race with its_vlpi_unmap().
Since all calls from its_irq_set_vcpu_affinity() require the same lock to be held, hoist the locking there instead of sprinkling the locking all over the place.
This bug was discovered using Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc.
[ tglx: Use guard() instead of goto ]
--- drivers/irqchip/irq-gic-v3-its.c | 44 ++++++++++----------------------------- 1 file changed, 12 insertions(+), 32 deletions(-)
drivers/irqchip/irq-gic-v3-its.c +12 -32
@@ -1837,28 +1837,22 @@ static int its_vlpi_map(struct irq_data {struct its_device *its_dev =irq_data_get_irq_chip_data (d);u32 event =its_get_event_id (d); -int ret =0 ;if (!info->map)return -EINVAL ; -raw_spin_lock (&its_dev->event_map.vlpi_lock); -if (!its_dev->event_map.vm) {struct its_vlpi_map *maps; maps =kcalloc (its_dev->event_map.nr_lpis,sizeof (*maps),GFP_ATOMIC ); -if (!maps) { - ret = -ENOMEM ; - goto out; - } +if (!maps) +return -ENOMEM ; its_dev->event_map.vm = info->map->vm; its_dev->event_map.vlpi_maps = maps; }else if (its_dev->event_map.vm != info->map->vm) { - ret = -EINVAL ; - goto out; +return -EINVAL ; }/* Get our private copy of the mapping information */
@@ -1890,46 +1884,32 @@ static int its_vlpi_map(struct irq_data its_dev->event_map.nr_vlpis++; } -out: -raw_spin_unlock (&its_dev->event_map.vlpi_lock); -return ret; +return 0 ; }static int its_vlpi_get (struct irq_data *d,struct its_cmd_info *info) {struct its_device *its_dev =irq_data_get_irq_chip_data (d);struct its_vlpi_map *map; -int ret =0 ; - -raw_spin_lock (&its_dev->event_map.vlpi_lock); map =get_vlpi_map (d); -if (!its_dev->event_map.vm || !map) { - ret = -EINVAL ; - goto out; - } +if (!its_dev->event_map.vm || !map) +return -EINVAL ;/* Copy our mapping information to the incoming request */ *info->map = *map; -out: -raw_spin_unlock (&its_dev->event_map.vlpi_lock); -return ret; +return 0 ; }static int its_vlpi_unmap (struct irq_data *d) {struct its_device *its_dev =irq_data_get_irq_chip_data (d);u32 event =its_get_event_id (d); -int ret =0 ; -raw_spin_lock (&its_dev->event_map.vlpi_lock); - -if (!its_dev->event_map.vm || !irqd_is_forwarded_to_vcpu (d)) { - ret = -EINVAL ; - goto out; - } +if (!its_dev->event_map.vm || !irqd_is_forwarded_to_vcpu (d)) +return -EINVAL ;/* Drop the virtual mapping */ its_send_discard (its_dev, event);
@@ -1953,9 +1933,7 @@ static int its_vlpi_unmap(struct irq_datkfree (its_dev->event_map.vlpi_maps); } -out: -raw_spin_unlock (&its_dev->event_map.vlpi_lock); -return ret; +return 0 ; }static int its_vlpi_prop_update (struct irq_data *d,struct its_cmd_info *info)
@@ -1983,6 +1961,8 @@ static int its_irq_set_vcpu_affinity(strif (!is_v4 (its_dev->its))return -EINVAL ; +guard (raw_spinlock_irq)(&its_dev->event_map.vlpi_lock); +/* Unmap request? */ if (!info)return its_vlpi_unmap (d);
Greg Kroah-Hartman
maintainerPATCH 170/217 x86/amd_nb: Check for invalid SMN reads
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yazen Ghannam <[email protected]>
commit c625dabbf1c4a8e77e4734014f2fde7aa9071a1f upstream.
AMD Zen-based systems use a System Management Network (SMN) that provides access to implementation-specific registers.
SMN accesses are done indirectly through an index/data pair in PCI config space. The PCI config access may fail and return an error code. This would prevent the "read" value from being updated.
However, the PCI config access may succeed, but the return value may be invalid. This is in similar fashion to PCI bad reads, i.e. return all bits set.
Most systems will return 0 for SMN addresses that are not accessible. This is in line with AMD convention that unavailable registers are Read-as-Zero/Writes-Ignored.
However, some systems will return a "PCI Error Response" instead. This value, along with an error code of 0 from the PCI config access, will confuse callers of the amd_smn_read() function.
Check for this condition, clear the return value, and set a proper error code.
--- arch/x86/kernel/amd_nb.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
arch/x86/kernel/amd_nb.c +8 -1
@@ -195,7 +195,14 @@ out:int amd_smn_read (u16 node,u32 address,u32 *value) { -return __amd_smn_rw (node, address, value, false); +int err =__amd_smn_rw (node, address, value, false); + +if (PCI_POSSIBLE_ERROR (*value)) { + err = -ENODEV ; + *value =0 ; + } + +return err; }EXPORT_SYMBOL_GPL (amd_smn_read);
Greg Kroah-Hartman
maintainerPATCH 171/217 perf/core: Fix missing wakeup when waiting for context reference
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haifeng Xu <[email protected]>
commit 74751ef5c1912ebd3e65c3b65f45587e05ce5d36 upstream.
In our production environment, we found many hung tasks which are blocked for more than 18 hours. Their call traces are like this:
[346278.191038] __schedule+0x2d8/0x890 [346278.191046] schedule+0x4e/0xb0 [346278.191049] perf_event_free_task+0x220/0x270 [346278.191056] ? init_wait_var_entry+0x50/0x50 [346278.191060] copy_process+0x663/0x18d0 [346278.191068] kernel_clone+0x9d/0x3d0 [346278.191072] __do_sys_clone+0x5d/0x80 [346278.191076] __x64_sys_clone+0x25/0x30 [346278.191079] do_syscall_64+0x5c/0xc0 [346278.191083] ? syscall_exit_to_user_mode+0x27/0x50 [346278.191086] ? do_syscall_64+0x69/0xc0 [346278.191088] ? irqentry_exit_to_user_mode+0x9/0x20 [346278.191092] ? irqentry_exit+0x19/0x30 [346278.191095] ? exc_page_fault+0x89/0x160 [346278.191097] ? asm_exc_page_fault+0x8/0x30 [346278.191102] entry_SYSCALL_64_after_hwframe+0x44/0xae
The task was waiting for the refcount become to 1, but from the vmcore, we found the refcount has already been 1. It seems that the task didn't get woken up by perf_event_release_kernel() and got stuck forever. The below scenario may cause the problem.
Thread A Thread B
... ...perf_event_free_task perf_event_release_kernel
... acquire event->child_mutex ... get_ctx ... release event->child_mutex acquire ctx->mutex ... perf_free_event (acquire/release event->child_mutex) ... release ctx->mutex wait_var_event acquire ctx->mutex acquire event->child_mutex # move existing events to free_list release event->child_mutex release ctx->mutex put_ctx
... ...
In this case, all events of the ctx have been freed, so we couldn't find the ctx in free_list and Thread A will miss the wakeup. It's thus necessary to add a wakeup after dropping the reference.
--- kernel/events/core.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
kernel/events/core.c +13 -0
@@ -5182,6 +5182,7 @@ int perf_event_release_kernel(struct per again:mutex_lock (&event->child_mutex);list_for_each_entry (child, &event->child_list, child_list) { +void *var =NULL ;/* * Cannot change, child events are not migrated, see the
@@ -5222,11 +5223,23 @@ again:* this can't be the last reference. */ put_event (event); + }else { + var = &ctx->refcount; }mutex_unlock (&event->child_mutex);mutex_unlock (&ctx->mutex);put_ctx (ctx); + +if (var) { +/* +* If perf_event_free_task() has deleted all events from the +* ctx while the child_mutex got released above, make sure to +* notify about the preceding put_ctx(). +*/ +smp_mb ();/* pairs with wait_var_event() */ +wake_up_var (var); + } goto again; }mutex_unlock (&event->child_mutex);
Greg Kroah-Hartman
maintainerPATCH 172/217 riscv: fix overlap of allocated page and PTR_ERR
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nam Cao <[email protected]>
commit 994af1825a2aa286f4903ff64a1c7378b52defe6 upstream.
On riscv32, it is possible for the last page in virtual address space (0xfffff000) to be allocated. This page overlaps with PTR_ERR, so that shouldn't happen.
There is already some code to ensure memblock won't allocate the last page. However, buddy allocator is left unchecked.
Fix this by reserving physical memory that would be mapped at virtual addresses greater than 0xfffff000.
--- arch/riscv/mm/init.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
arch/riscv/mm/init.c +11 -10
@@ -213,18 +213,19 @@ static void __init setup_bootmem(void)if (!IS_ENABLED (CONFIG_XIP_KERNEL )) phys_ram_base =memblock_start_of_DRAM ();/* -* memblock allocator is not aware of the fact that last 4K bytes of -* the addressable memory can not be mapped because of IS_ERR_VALUE -* macro. Make sure that last 4k bytes are not usable by memblock -* if end of dram is equal to maximum addressable memory. For 64-bit -* kernel, this problem can't happen here as the end of the virtual -* address space is occupied by the kernel mapping then this check must -* be done as soon as the kernel mapping base address is determined. +* Reserve physical address space that would be mapped to virtual +* addresses greater than (void *)(-PAGE_SIZE) because: +* - This memory would overlap with ERR_PTR +* - This memory belongs to high memory, which is not supported +* +* This is not applicable to 64-bit kernel, because virtual addresses +* after (void *)(-PAGE_SIZE) are not linearly mapped: they are +* occupied by kernel mapping. Also it is unrealistic for high memory +* to exist on 64-bit platforms. */ if (!IS_ENABLED (CONFIG_64BIT )) { - max_mapped_addr =__pa (~(ulong )0 ); -if (max_mapped_addr == (phys_ram_end -1 )) -memblock_set_current_limit (max_mapped_addr -4096 ); + max_mapped_addr =__va_to_pa_nodebug (-PAGE_SIZE ); +memblock_reserve (max_mapped_addr, (phys_addr_t)-max_mapped_addr); } min_low_pfn =PFN_UP (phys_ram_base);
Greg Kroah-Hartman
maintainerPATCH 173/217 tracing/selftests: Fix kprobe event name test for .isra. functions
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt (Google) <[email protected]>
commit 23a4b108accc29a6125ed14de4a044689ffeda78 upstream.
The kprobe_eventname.tc test checks if a function with .isra. can have a kprobe attached to it. It loops through the kallsyms file for all the functions that have the .isra. name, and checks if it exists in the available_filter_functions file, and if it does, it uses it to attach a kprobe to it.
The issue is that kprobes can not attach to functions that are listed more than once in available_filter_functions. With the latest kernel, the function that is found is: rapl_event_update.isra.0
# grep rapl_event_update.isra.0 /sys/kernel/tracing/available_filter_functions rapl_event_update.isra.0 rapl_event_update.isra.0
It is listed twice. This causes the attached kprobe to it to fail which in turn fails the test. Instead of just picking the function function that is found in available_filter_functions, pick the first one that is listed only once in available_filter_functions.
--- tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc +2 -1
@@ -30,7 +30,8 @@ find_dot_func() { fi grep " [tT] .*\.isra\..*" /proc/kallsyms | cut -f 3 -d " " | while read f; do - if grep -s $f available_filter_functions; then + cnt=`grep -s $f available_filter_functions | wc -l`; + if [ $cnt -eq 1 ]; then echo $f break fi
Greg Kroah-Hartman
maintainerPATCH 174/217 null_blk: Print correct max open zones limit in null_init_zoned_dev()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
commit 233e27b4d21c3e44eb863f03e566d3a22e81a7ae upstream.
When changing the maximum number of open zones, print that number instead of the total number of zones.
--- drivers/block/null_blk/zoned.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/null_blk/zoned.c +1 -1
@@ -112,7 +112,7 @@ int null_init_zoned_dev(struct nullb_devif (dev->zone_max_active && dev->zone_max_open > dev->zone_max_active) { dev->zone_max_open = dev->zone_max_active;pr_info ("changed the maximum number of open zones to %u\n" , - dev->nr_zones); + dev->zone_max_open); }else if (dev->zone_max_open >= dev->nr_zones - dev->zone_nr_conv) { dev->zone_max_open =0 ;pr_info ("zone_max_open limit disabled, limit >= zone count\n" );
Greg Kroah-Hartman
maintainerPATCH 175/217 sock_map: avoid race between sock_map_close and sk_psock_put
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>
commit 4b4647add7d3c8530493f7247d11e257ee425bf0 upstream.
sk_psock_get will return NULL if the refcount of psock has gone to 0, which will happen when the last call of sk_psock_put is done. However, sk_psock_drop may not have finished yet, so the close callback will still point to sock_map_close despite psock being NULL.
This can be reproduced with a thread deleting an element from the sock map, while the second one creates a socket, adds it to the map and closes it.
That will trigger the WARN_ON_ONCE:
------------[ cut here ]------------ WARNING: CPU: 1 PID: 7220 at net/core/sock_map.c:1701 sock_map_close+0x2a2/0x2d0 net/core/sock_map.c:1701 Modules linked in: CPU: 1 PID: 7220 Comm: syz-executor380 Not tainted 6.9.0-syzkaller-07726-g3c999d1ae3c7 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 RIP: 0010:sock_map_close+0x2a2/0x2d0 net/core/sock_map.c:1701 Code: df e8 92 29 88 f8 48 8b 1b 48 89 d8 48 c1 e8 03 42 80 3c 20 00 74 08 48 89 df e8 79 29 88 f8 4c 8b 23 eb 89 e8 4f 15 23 f8 90 <0f> 0b 90 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d e9 13 26 3d 02 RSP: 0018:ffffc9000441fda8 EFLAGS: 00010293 RAX: ffffffff89731ae1 RBX: ffffffff94b87540 RCX: ffff888029470000 RDX: 0000000000000000 RSI: ffffffff8bcab5c0 RDI: ffffffff8c1faba0 RBP: 0000000000000000 R08: ffffffff92f9b61f R09: 1ffffffff25f36c3 R10: dffffc0000000000 R11: fffffbfff25f36c4 R12: ffffffff89731840 R13: ffff88804b587000 R14: ffff88804b587000 R15: ffffffff89731870 FS: 000055555e080380(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 00000000207d4000 CR4: 0000000000350ef0 Call Trace: <TASK> unix_release+0x87/0xc0 net/unix/af_unix.c:1048 __sock_release net/socket.c:659 [inline] sock_close+0xbe/0x240 net/socket.c:1421 __fput+0x42b/0x8a0 fs/file_table.c:422 __do_sys_close fs/open.c:1556 [inline] __se_sys_close fs/open.c:1541 [inline] __x64_sys_close+0x7f/0x110 fs/open.c:1541 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fb37d618070 Code: 00 00 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d4 e8 10 2c 00 00 80 3d 31 f0 07 00 00 74 17 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 48 c3 0f 1f 80 00 00 00 00 48 83 ec 18 89 7c RSP: 002b:00007ffcd4a525d8 EFLAGS: 00000202 ORIG_RAX: 0000000000000003 RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007fb37d618070 RDX: 0000000000000010 RSI: 00000000200001c0 RDI: 0000000000000004 RBP: 0000000000000000 R08: 0000000100000000 R09: 0000000100000000 R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 </TASK>
Use sk_psock, which will only check that the pointer is not been set to NULL yet, which should only happen after the callbacks are restored. If, then, a reference can still be gotten, we may call sk_psock_stop and cancel psock->work.
As suggested by Paolo Abeni, reorder the condition so the control flow is less convoluted.
After that change, the reproducer does not trigger the WARN_ON_ONCE anymore.
--- net/core/sock_map.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
net/core/sock_map.c +10 -6
@@ -1623,19 +1623,23 @@ void sock_map_close(struct sock *sk, lonlock_sock (sk);rcu_read_lock (); - psock =sk_psock_get (sk); -if (unlikely (!psock)) { -rcu_read_unlock (); -release_sock (sk); - saved_close =READ_ONCE (sk->sk_prot)->close; - }else { + psock =sk_psock (sk); +if (likely (psock)) { saved_close = psock->saved_close;sock_map_remove_links (sk, psock); + psock =sk_psock_get (sk); +if (unlikely (!psock)) + goto no_psock;rcu_read_unlock ();sk_psock_stop (psock);release_sock (sk);cancel_delayed_work_sync (&psock->work);sk_psock_put (sk, psock); + }else { + saved_close =READ_ONCE (sk->sk_prot)->close; +no_psock: +rcu_read_unlock (); +release_sock (sk); }/* Make sure we do not recurse. This is a bug.
Greg Kroah-Hartman
maintainerPATCH 176/217 vmci: prevent speculation leaks by sanitizing event in event_deliver()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hagar Gamal Halim Hemdan <[email protected]>
commit 8003f00d895310d409b2bf9ef907c56b42a4e0f4 upstream.
Coverity spotted that event_msg is controlled by user-space, event_msg->event_data.event is passed to event_deliver() and used as an index without sanitization.
This change ensures that the event index is sanitized to mitigate any possibility of speculative information leaks.
This bug was discovered and resolved using Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc.
Only compile tested, no access to HW.
--- drivers/misc/vmw_vmci/vmci_event.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/misc/vmw_vmci/vmci_event.c +5 -1
@@ -9,6 +9,7 @@#include <linux/vmw_vmci_api.h> #include <linux/list.h> #include <linux/module.h> +#include <linux/nospec.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/rculist.h>
@@ -86,9 +87,12 @@ static void event_deliver(struct vmci_ev {struct vmci_subscription *cur;struct list_head *subscriber_list; +u32 sanitized_event, max_vmci_event;rcu_read_lock (); - subscriber_list = &subscriber_array[event_msg->event_data.event]; + max_vmci_event =ARRAY_SIZE (subscriber_array); + sanitized_event =array_index_nospec (event_msg->event_data.event, max_vmci_event); + subscriber_list = &subscriber_array[sanitized_event];list_for_each_entry_rcu (cur, subscriber_list, node) { cur->callback (cur->id, &event_msg->event_data, cur->callback_data);
Greg Kroah-Hartman
maintainerPATCH 177/217 spmi: hisi-spmi-controller: Do not override device identifier
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vamshi Gajjela <[email protected]>
commit eda4923d78d634482227c0b189d9b7ca18824146 upstream.
'nr' member of struct spmi_controller, which serves as an identifier for the controller/bus. This value is a dynamic ID assigned in spmi_controller_alloc, and overriding it from the driver results in an ida_free error "ida_free called for id=xx which is not allocated".
--- drivers/spmi/hisi-spmi-controller.c | 1 - 1 file changed, 1 deletion(-)
drivers/spmi/hisi-spmi-controller.c +0 -1
@@ -303,7 +303,6 @@ static int spmi_controller_probe(structspin_lock_init (&spmi_controller->lock); - ctrl->nr = spmi_controller->channel; ctrl->dev.parent = pdev->dev.parent; ctrl->dev.of_node =of_node_get (pdev->dev.of_node);
Greg Kroah-Hartman
maintainerPATCH 178/217 knfsd: LOOKUP can return an illegal error value
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit e221c45da3770962418fb30c27d941bbc70d595a upstream.
The 'NFS error' NFSERR_OPNOTSUPP is not described by any of the official NFS related RFCs, but appears to have snuck into some older .x files for NFSv2.
Either way, it is not in RFC1094, RFC1813 or any of the NFSv4 RFCs, so should not be returned by the knfsd server, and particularly not by the "LOOKUP" operation.
Instead, let's return NFSERR_STALE, which is more appropriate if the filesystem encodes the filehandle as FILEID_INVALID.
--- fs/nfsd/nfsfh.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfsfh.c +2 -2
@@ -569,7 +569,7 @@ fh_compose(struct svc_fh *fhp, struct sv_fh_update (fhp, exp, dentry);if (fhp->fh_handle.fh_fileid_type ==FILEID_INVALID ) {fh_put (fhp); -return nfserr_opnotsupp; +return nfserr_stale; }return 0 ;
@@ -595,7 +595,7 @@ fh_update(struct svc_fh *fhp)_fh_update (fhp, fhp->fh_export, dentry);if (fhp->fh_handle.fh_fileid_type ==FILEID_INVALID ) -return nfserr_opnotsupp; +return nfserr_stale;return 0 ; out_bad:printk (KERN_ERR "fh_update: fh not verified!\n" );
Greg Kroah-Hartman
maintainerPATCH 179/217 fs/proc: fix softlockup in __read_vmcore
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rik van Riel <[email protected]>
commit 5cbcb62dddf5346077feb82b7b0c9254222d3445 upstream.
While taking a kernel core dump with makedumpfile on a larger system, softlockup messages often appear.
While softlockup warnings can be harmless, they can also interfere with things like RCU freeing memory, which can be problematic when the kdump kexec image is configured with as little memory as possible.
Avoid the softlockup, and give things like work items and RCU a chance to do their thing during __read_vmcore by adding a cond_resched.
--- fs/proc/vmcore.c | 2 ++ 1 file changed, 2 insertions(+)
fs/proc/vmcore.c +2 -0
@@ -383,6 +383,8 @@ static ssize_t __read_vmcore(struct iov_/* leave now if filled buffer already */ if (!iov_iter_count (iter))return acc; + +cond_resched (); }list_for_each_entry (m, &vmcore_list, list) {
Greg Kroah-Hartman
maintainerPATCH 180/217 ocfs2: use coarse time for new created files
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Yue <[email protected]>
commit b8cb324277ee16f3eca3055b96fce4735a5a41c6 upstream.
The default atime related mount option is '-o realtime' which means file atime should be updated if atime <= ctime or atime <= mtime. atime should be updated in the following scenario, but it is not:
==========================================================
$ rm /mnt/testfile; $ echo test > /mnt/testfile $ stat -c "%X %Y %Z" /mnt/testfile 1711881646 1711881646 1711881646 $ sleep 5 $ cat /mnt/testfile > /dev/null $ stat -c "%X %Y %Z" /mnt/testfile 1711881646 1711881646 1711881646 ==========================================================
And the reason the atime in the test is not updated is that ocfs2 calls ktime_get_real_ts64() in __ocfs2_mknod_locked during file creation. Then inode_set_ctime_current() is called in inode_set_ctime_current() calls ktime_get_coarse_real_ts64() to get current time.
ktime_get_real_ts64() is more accurate than ktime_get_coarse_real_ts64(). In my test box, I saw ctime set by ktime_get_coarse_real_ts64() is less than ktime_get_real_ts64() even ctime is set later. The ctime of the new inode is smaller than atime.
The call trace is like:
ocfs2_create
ocfs2_mknod
__ocfs2_mknod_locked
....
ktime_get_real_ts64 <------- set atime,ctime,mtime, more accurate
ocfs2_populate_inode
...
ocfs2_init_acl
ocfs2_acl_set_mode
inode_set_ctime_current
current_time
ktime_get_coarse_real_ts64 <-------less accurateocfs2_file_read_iter
ocfs2_inode_lock_atime
ocfs2_should_update_atime
atime <= ctime ? <-------- false, ctime < atime due to accuracy
So here call ktime_get_coarse_real_ts64 to set inode time coarser while creating new files. It may lower the accuracy of file times. But it's not a big deal since we already use coarse time in other places like ocfs2_update_inode_atime and inode_set_ctime_current.
--- fs/ocfs2/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/namei.c +1 -1
@@ -566,7 +566,7 @@ static int __ocfs2_mknod_locked(struct i fe->i_last_eb_blk =0 ;strcpy (fe->i_signature,OCFS2_INODE_SIGNATURE ); fe->i_flags |=cpu_to_le32 (OCFS2_VALID_FL ); -ktime_get_real_ts64 (&ts); +ktime_get_coarse_real_ts64 (&ts); fe->i_atime = fe->i_ctime = fe->i_mtime =cpu_to_le64 (ts.tv_sec); fe->i_mtime_nsec = fe->i_ctime_nsec = fe->i_atime_nsec =
Greg Kroah-Hartman
maintainerPATCH 181/217 ocfs2: fix races between hole punching and AIO+DIO
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Yue <[email protected]>
commit 952b023f06a24b2ad6ba67304c4c84d45bea2f18 upstream.
After commit "ocfs2: return real error code in ocfs2_dio_wr_get_block", fstests/generic/300 become from always failed to sometimes failed:
========================================================================
[ 473.293420 ] run fstests generic/300
[ 475.296983 ] JBD2: Ignoring recovery information on journal [ 475.302473 ] ocfs2: Mounting device (253,1) on (node local, slot 0) with ordered data mode. [ 494.290998 ] OCFS2: ERROR (device dm-1): ocfs2_change_extent_flag: Owner 5668 has an extent at cpos 78723 which can no longer be found [ 494.291609 ] On-disk corruption discovered. Please run fsck.ocfs2 once the filesystem is unmounted. [ 494.292018 ] OCFS2: File system is now read-only. [ 494.292224 ] (kworker/19:11,2628,19):ocfs2_mark_extent_written:5272 ERROR: status = -30 [ 494.292602 ] (kworker/19:11,2628,19):ocfs2_dio_end_io_write:2374 ERROR: status = -3
fio: io_u error on file /mnt/scratch/racer: Read-only file system: write offset=460849152, buflen=131072
=========================================================================
In __blockdev_direct_IO, ocfs2_dio_wr_get_block is called to add unwritten extents to a list. extents are also inserted into extent tree in ocfs2_write_begin_nolock. Then another thread call fallocate to puch a hole at one of the unwritten extent. The extent at cpos was removed by ocfs2_remove_extent(). At end io worker thread, ocfs2_search_extent_list found there is no such extent at the cpos.
T1 T2 T3
inode lock
...
insert extents
...
inode unlockocfs2_fallocate
__ocfs2_change_file_space
inode lock
lock ip_alloc_sem
ocfs2_remove_inode_range inode
ocfs2_remove_btree_range
ocfs2_remove_extent
^---remove the extent at cpos 78723 ...
unlock ip_alloc_sem
inode unlock
ocfs2_dio_end_io
ocfs2_dio_end_io_write
lock ip_alloc_sem ocfs2_mark_extent_written
ocfs2_change_extent_flag
ocfs2_search_extent_list ^---failed to find extent
...
unlock ip_alloc_sem
In most filesystems, fallocate is not compatible with racing with AIO+DIO, so fix it by adding to wait for all dio before fallocate/punch_hole like ext4.
--- fs/ocfs2/file.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ocfs2/file.c +2 -0
@@ -1937,6 +1937,8 @@ static int __ocfs2_change_file_space(strinode_lock (inode); +/* Wait all existing dio workers, newcomers will block on i_rwsem */ +inode_dio_wait (inode);/* * This prevents concurrent writes on other nodes */
Greg Kroah-Hartman
maintainerPATCH 182/217 PCI: rockchip-ep: Remove wrong mask on subsys_vendor_id
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rick Wertenbroek <[email protected]>
commit 2dba285caba53f309d6060fca911b43d63f41697 upstream.
Remove wrong mask on subsys_vendor_id. Both the Vendor ID and Subsystem Vendor ID are u16 variables and are written to a u32 register of the controller. The Subsystem Vendor ID was always 0 because the u16 value was masked incorrectly with GENMASK(31,16) resulting in all lower 16 bits being set to 0 prior to the shift.
Remove both masks as they are unnecessary and set the register correctly i.e., the lower 16-bits are the Vendor ID and the upper 16-bits are the Subsystem Vendor ID.
This is documented in the RK3399 TRM section 17.6.7.1.17
--- drivers/pci/controller/pcie-rockchip-ep.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/pci/controller/pcie-rockchip-ep.c +2 -4
@@ -98,10 +98,8 @@ static int rockchip_pcie_ep_write_header/* All functions share the same vendor ID with function 0 */ if (fn ==0 ) { -u32 vid_regs = (hdr->vendorid &GENMASK (15 ,0 )) | - (hdr->subsys_vendor_id &GENMASK (31 ,16 )) <<16 ; - -rockchip_pcie_write (rockchip, vid_regs, +rockchip_pcie_write (rockchip, + hdr->vendorid | hdr->subsys_vendor_id <<16 ,PCIE_CORE_CONFIG_VENDOR ); }
Greg Kroah-Hartman
maintainerPATCH 183/217 dmaengine: axi-dmac: fix possible race in remove()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nuno Sa <[email protected]>
commit 1bc31444209c8efae98cb78818131950d9a6f4d6 upstream.
We need to first free the IRQ before calling of_dma_controller_free(). Otherwise we could get an interrupt and schedule a tasklet while removing the DMA controller.
--- drivers/dma/dma-axi-dmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/dma-axi-dmac.c +1 -1
@@ -1036,8 +1036,8 @@ static int axi_dmac_remove(struct platfo {struct axi_dmac *dmac =platform_get_drvdata (pdev); -of_dma_controller_free (pdev->dev.of_node);free_irq (dmac->irq, dmac); +of_dma_controller_free (pdev->dev.of_node);tasklet_kill (&dmac->chan.vchan.task);dma_async_device_unregister (&dmac->dma_dev);clk_disable_unprepare (dmac->clk);
Greg Kroah-Hartman
maintainerPATCH 184/217 remoteproc: k3-r5: Wait for core0 power-up before powering up core1
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Apurva Nandan <[email protected]>
commit 61f6f68447aba08aeaa97593af3a7d85a114891f upstream.
PSC controller has a limitation that it can only power-up the second core when the first core is in ON state. Power-state for core0 should be equal to or higher than core1, else the kernel is seen hanging during rproc loading.
Make the powering up of cores sequential, by waiting for the current core to power-up before proceeding to the next core, with a timeout of 2sec. Add a wait queue event in k3_r5_cluster_rproc_init call, that will wait for the current core to be released from reset before proceeding with the next core.
--- drivers/remoteproc/ti_k3_r5_remoteproc.c | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
drivers/remoteproc/ti_k3_r5_remoteproc.c +33 -0
@@ -98,12 +98,14 @@ struct k3_r5_soc_data {* @dev: cached device pointer * @mode: Mode to configure the Cluster - Split or LockStep * @cores: list of R5 cores within the cluster +* @core_transition: wait queue to sync core state changes * @soc_data: SoC-specific feature data for a R5FSS */ struct k3_r5_cluster {struct device *dev;enum cluster_mode mode;struct list_head cores; +wait_queue_head_t core_transition;const struct k3_r5_soc_data *soc_data; };
@@ -123,6 +125,7 @@ struct k3_r5_cluster {* @atcm_enable: flag to control ATCM enablement * @btcm_enable: flag to control BTCM enablement * @loczrama: flag to dictate which TCM is at device address 0x0 +* @released_from_reset: flag to signal when core is out of reset */ struct k3_r5_core {struct list_head elem;
@@ -139,6 +142,7 @@ struct k3_r5_core {u32 atcm_enable;u32 btcm_enable;u32 loczrama; +bool released_from_reset; };/**
@@ -455,6 +459,8 @@ static int k3_r5_rproc_prepare(struct rp ret);return ret; } + core->released_from_reset = true; +wake_up_interruptible (&cluster->core_transition);/* * Newer IP revisions like on J7200 SoCs support h/w auto-initialization
@@ -1137,6 +1143,12 @@ static int k3_r5_rproc_configure_mode(streturn ret; } +/* +* Skip the waiting mechanism for sequential power-on of cores if the +* core has already been booted by another entity. +*/ + core->released_from_reset = c_state; + ret =ti_sci_proc_get_status (core->tsp, &boot_vec, &cfg, &ctrl, &stat);if (ret <0 ) {
@@ -1273,6 +1285,26 @@ init_rmem:if (cluster->mode ==CLUSTER_MODE_LOCKSTEP || cluster->mode ==CLUSTER_MODE_SINGLECPU )break ; + +/* +* R5 cores require to be powered on sequentially, core0 +* should be in higher power state than core1 in a cluster +* So, wait for current core to power up before proceeding +* to next core and put timeout of 2sec for each core. +* +* This waiting mechanism is necessary because +* rproc_auto_boot_callback() for core1 can be called before +* core0 due to thread execution order. +*/ + ret =wait_event_interruptible_timeout (cluster->core_transition, + core->released_from_reset, +msecs_to_jiffies (2000 )); +if (ret <=0 ) { +dev_err (dev, +"Timed out waiting for %s core to power up!\n" , + rproc->name); +return ret; + } }return 0 ;
@@ -1708,6 +1740,7 @@ static int k3_r5_probe(struct platform_d CLUSTER_MODE_SPLIT :CLUSTER_MODE_LOCKSTEP ; cluster->soc_data = data;INIT_LIST_HEAD (&cluster->cores); +init_waitqueue_head (&cluster->core_transition); ret =of_property_read_u32 (np,"ti,cluster-mode" , &cluster->mode);if (ret <0 && ret != -EINVAL ) {
Greg Kroah-Hartman
maintainerPATCH 185/217 remoteproc: k3-r5: Do not allow core1 to power up before core0 via sysfs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Beleswar Padhi <[email protected]>
commit 3c8a9066d584f5010b6f4ba03bf6b19d28973d52 upstream.
PSC controller has a limitation that it can only power-up the second core when the first core is in ON state. Power-state for core0 should be equal to or higher than core1.
Therefore, prevent core1 from powering up before core0 during the start process from sysfs. Similarly, prevent core0 from shutting down before core1 has been shut down from sysfs.
--- drivers/remoteproc/ti_k3_r5_remoteproc.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
drivers/remoteproc/ti_k3_r5_remoteproc.c +21 -2
@@ -543,7 +543,7 @@ static int k3_r5_rproc_start(struct rprostruct k3_r5_rproc *kproc = rproc->priv;struct k3_r5_cluster *cluster = kproc->cluster;struct device *dev = kproc->dev; -struct k3_r5_core *core; +struct k3_r5_core *core0, *core;u32 boot_addr;int ret;
@@ -569,6 +569,15 @@ static int k3_r5_rproc_start(struct rpro goto unroll_core_run; } }else { +/* do not allow core 1 to start before core 0 */ + core0 = list_first_entry(&cluster->cores, struct k3_r5_core, + elem); +if (core != core0 && core0->rproc->state ==RPROC_OFFLINE ) { +dev_err (dev,"%s: can not start core 1 before core 0\n" , + __func__); +return -EPERM ; + } + ret =k3_r5_core_run (core);if (ret) goto put_mbox;
@@ -614,7 +623,8 @@ static int k3_r5_rproc_stop(struct rproc {struct k3_r5_rproc *kproc = rproc->priv;struct k3_r5_cluster *cluster = kproc->cluster; -struct k3_r5_core *core = kproc->core; +struct device *dev = kproc->dev; +struct k3_r5_core *core1, *core = kproc->core;int ret;/* halt all applicable cores */
@@ -627,6 +637,15 @@ static int k3_r5_rproc_stop(struct rproc } } }else { +/* do not allow core 0 to stop before core 1 */ + core1 = list_last_entry(&cluster->cores, struct k3_r5_core, + elem); +if (core != core1 && core1->rproc->state !=RPROC_OFFLINE ) { +dev_err (dev,"%s: can not stop core 0 before core 1\n" , + __func__); +return -EPERM ; + } + ret =k3_r5_core_halt (core);if (ret) goto out;
Greg Kroah-Hartman
maintainerPATCH 186/217 riscv: rewrite __kernel_map_pages() to fix sleeping in invalid context
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nam Cao <[email protected]>
commit fb1cf0878328fe75d47f0aed0a65b30126fcefc4 upstream.
__kernel_map_pages() is a debug function which clears the valid bit in page table entry for deallocated pages to detect illegal memory accesses to freed pages.
This function set/clear the valid bit using __set_memory(). __set_memory() acquires init_mm's semaphore, and this operation may sleep. This is problematic, because __kernel_map_pages() can be called in atomic context, and thus is illegal to sleep. An example warning that this causes:
BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:1578 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 2, name: kthreadd preempt_count: 2, expected: 0 CPU: 0 PID: 2 Comm: kthreadd Not tainted 6.9.0-g1d4c6d784ef6 #37 Hardware name: riscv-virtio,qemu (DT) Call Trace: [<ffffffff800060dc>] dump_backtrace+0x1c/0x24 [<ffffffff8091ef6e>] show_stack+0x2c/0x38 [<ffffffff8092baf8>] dump_stack_lvl+0x5a/0x72 [<ffffffff8092bb24>] dump_stack+0x14/0x1c [<ffffffff8003b7ac>] __might_resched+0x104/0x10e [<ffffffff8003b7f4>] __might_sleep+0x3e/0x62 [<ffffffff8093276a>] down_write+0x20/0x72 [<ffffffff8000cf00>] __set_memory+0x82/0x2fa [<ffffffff8000d324>] __kernel_map_pages+0x5a/0xd4 [<ffffffff80196cca>] __alloc_pages_bulk+0x3b2/0x43a [<ffffffff8018ee82>] __vmalloc_node_range+0x196/0x6ba [<ffffffff80011904>] copy_process+0x72c/0x17ec [<ffffffff80012ab4>] kernel_clone+0x60/0x2fe [<ffffffff80012f62>] kernel_thread+0x82/0xa0 [<ffffffff8003552c>] kthreadd+0x14a/0x1be [<ffffffff809357de>] ret_from_fork+0xe/0x1c
Rewrite this function with apply_to_existing_page_range(). It is fine to not have any locking, because __kernel_map_pages() works with pages being allocated/deallocated and those pages are not changed by anyone else in the meantime.
--- arch/riscv/mm/pageattr.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-)
arch/riscv/mm/pageattr.c +22 -6
@@ -386,17 +386,33 @@ int set_direct_map_default_noflush(struc }#ifdef CONFIG_DEBUG_PAGEALLOC +static int debug_pagealloc_set_page (pte_t *pte,unsigned long addr,void *data) +{ +int enable = *(int *)data; + +unsigned long val =pte_val (ptep_get (pte)); + +if (enable) + val |= _PAGE_PRESENT; +else + val &= ~_PAGE_PRESENT; + +set_pte (pte,__pte (val)); + +return 0 ; +} +void __kernel_map_pages (struct page *page,int numpages,int enable) {if (!debug_pagealloc_enabled ())return ; -if (enable) -__set_memory ((unsigned long )page_address (page), numpages, -__pgprot (_PAGE_PRESENT),__pgprot (0 )); -else -__set_memory ((unsigned long )page_address (page), numpages, -__pgprot (0 ),__pgprot (_PAGE_PRESENT)); +unsigned long start = (unsigned long )page_address (page); +unsigned long size =PAGE_SIZE * numpages; + +apply_to_existing_page_range (&init_mm, start, size, debug_pagealloc_set_page, &enable); + +flush_tlb_kernel_range (start, start + size); }#endif
Greg Kroah-Hartman
maintainerPATCH 187/217 drm/i915/gt: Disarm breadcrumbs if engines are already idle
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit 70cb9188ffc75e643debf292fcddff36c9dbd4ae upstream.
The breadcrumbs use a GT wakeref for guarding the interrupt, but are disarmed during release of the engine wakeref. This leaves a hole where we may attach a breadcrumb just as the engine is parking (after it has parked its breadcrumbs), execute the irq worker with some signalers still attached, but never be woken again.
That issue manifests itself in CI with IGT runner timeouts while tests are waiting indefinitely for release of all GT wakerefs.
<6> [209.151778] i915: Running live_engine_pm_selftests/live_engine_busy_stats
<7> [209.231628] i915 0000:00:02.0: [drm:intel_power_well_disable [i915]] disabling PW_5 <7> [209.231816] i915 0000:00:02.0: [drm:intel_power_well_disable [i915]] disabling PW_4 <7> [209.231944] i915 0000:00:02.0: [drm:intel_power_well_disable [i915]] disabling PW_3 <7> [209.232056] i915 0000:00:02.0: [drm:intel_power_well_disable [i915]] disabling PW_2 <7> [209.232166] i915 0000:00:02.0: [drm:intel_power_well_disable [i915]] disabling DC_off <7> [209.232270] i915 0000:00:02.0: [drm:skl_enable_dc6 [i915]] Enabling DC6
<7> [209.232368] i915 0000:00:02.0: [drm:gen9_set_dc_state.part.0 [i915]] Setting DC state from 00 to 02 <4> [299.356116] [IGT] Inactivity timeout exceeded. Killing the current test with SIGQUIT.
...
<6> [299.356526] sysrq: Show State
...
<6> [299.373964] task:i915_selftest state:D stack:11784 pid:5578 tgid:5578 ppid:873 flags:0x00004002
<6> [299.373967] Call Trace:
<6> [299.373968] <TASK> <6> [299.373970] __schedule+0x3bb/0xda0 <6> [299.373974] schedule+0x41/0x110 <6> [299.373976] intel_wakeref_wait_for_idle+0x82/0x100 [i915] <6> [299.374083] ? __pfx_var_wake_function+0x10/0x10 <6> [299.374087] live_engine_busy_stats+0x9b/0x500 [i915] <6> [299.374173] __i915_subtests+0xbe/0x240 [i915] <6> [299.374277] ? __pfx___intel_gt_live_setup+0x10/0x10 [i915] <6> [299.374369] ? __pfx___intel_gt_live_teardown+0x10/0x10 [i915] <6> [299.374456] intel_engine_live_selftests+0x1c/0x30 [i915] <6> [299.374547] __run_selftests+0xbb/0x190 [i915] <6> [299.374635] i915_live_selftests+0x4b/0x90 [i915] <6> [299.374717] i915_pci_probe+0x10d/0x210 [i915]
At the end of the interrupt worker, if there are no more engines awake, disarm the breadcrumb and go to sleep.
--- drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/gt/intel_breadcrumbs.c +7 -8
@@ -258,8 +258,13 @@ static void signal_irq_work(struct irq_wi915_request_put (rq); } +/* Lazy irq enabling after HW submission */ if (!READ_ONCE (b->irq_armed) && !list_empty (&b->signalers))intel_breadcrumbs_arm_irq (b); + +/* And confirm that we still want irqs enabled before we yield */ +if (READ_ONCE (b->irq_armed) && !atomic_read (&b->active)) +intel_breadcrumbs_disarm_irq (b); } struct intel_breadcrumbs *
@@ -310,13 +315,7 @@ void __intel_breadcrumbs_park(struct intreturn ;/* Kick the work once more to drain the signalers, and disarm the irq */ -irq_work_sync (&b->irq_work); -while (READ_ONCE (b->irq_armed) && !atomic_read (&b->active)) { -local_irq_disable (); -signal_irq_work (&b->irq_work); -local_irq_enable (); -cond_resched (); - } +irq_work_queue (&b->irq_work); }void intel_breadcrumbs_free (struct kref *kref)
@@ -399,7 +398,7 @@ static void insert_breadcrumb(struct i91* the request as it may have completed and raised the interrupt as * we were attaching it into the lists. */ -if (!b->irq_armed ||__i915_request_is_complete (rq)) +if (!READ_ONCE (b->irq_armed) ||__i915_request_is_complete (rq))irq_work_queue (&b->irq_work); }
Greg Kroah-Hartman
maintainerPATCH 188/217 drm/i915/dpt: Make DPT object unshrinkable
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vidya Srinivas <[email protected]>
commit 43e2b37e2ab660c3565d4cff27922bc70e79c3f1 upstream.
In some scenarios, the DPT object gets shrunk but the actual framebuffer did not and thus its still there on the DPT's vm->bound_list. Then it tries to rewrite the PTEs via a stale CPU mapping. This causes panic.
--- drivers/gpu/drm/i915/gem/i915_gem_object.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_object.h +3 -1
@@ -295,7 +295,9 @@ bool i915_gem_object_has_iomem(const strstatic inline bool i915_gem_object_is_shrinkable (const struct drm_i915_gem_object *obj) { -return i915_gem_object_type_has (obj,I915_GEM_OBJECT_IS_SHRINKABLE ); +/* TODO: make DPT shrinkable when it has no bound vmas */ +return i915_gem_object_type_has (obj,I915_GEM_OBJECT_IS_SHRINKABLE ) && + !obj->is_dpt; } static inline bool
Greg Kroah-Hartman
maintainerPATCH 189/217 intel_th: pci: Add Granite Rapids support
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Shishkin <[email protected]>
commit e44937889bdf4ecd1f0c25762b7226406b9b7a69 upstream.
Add support for the Trace Hub in Granite Rapids.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -305,6 +305,11 @@ static const struct pci_device_id intel_ .driver_data = (kernel_ulong_t)&intel_th_2x, }, { +/* Granite Rapids */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0963), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, + {/* Alder Lake CPU */ PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x466f ), .driver_data = (kernel_ulong_t)&intel_th_2x,
Greg Kroah-Hartman
maintainerPATCH 190/217 intel_th: pci: Add Granite Rapids SOC support
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Shishkin <[email protected]>
commit 854afe461b009801a171b3a49c5f75ea43e4c04c upstream.
Add support for the Trace Hub in Granite Rapids SOC.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -310,6 +310,11 @@ static const struct pci_device_id intel_ .driver_data = (kernel_ulong_t)&intel_th_2x, }, { +/* Granite Rapids SOC */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x3256), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, + {/* Alder Lake CPU */ PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x466f ), .driver_data = (kernel_ulong_t)&intel_th_2x,
Greg Kroah-Hartman
maintainerPATCH 191/217 intel_th: pci: Add Sapphire Rapids SOC support
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Shishkin <[email protected]>
commit 2e1da7efabe05cb0cf0b358883b2bc89080ed0eb upstream.
Add support for the Trace Hub in Sapphire Rapids SOC.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -315,6 +315,11 @@ static const struct pci_device_id intel_ .driver_data = (kernel_ulong_t)&intel_th_2x, }, { +/* Sapphire Rapids SOC */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x3456), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, + {/* Alder Lake CPU */ PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x466f ), .driver_data = (kernel_ulong_t)&intel_th_2x,
Greg Kroah-Hartman
maintainerPATCH 192/217 intel_th: pci: Add Meteor Lake-S support
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Shishkin <[email protected]>
commit c4a30def564d75e84718b059d1a62cc79b137cf9 upstream.
Add support for the Trace Hub in Meteor Lake-S.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -295,6 +295,11 @@ static const struct pci_device_id intel_ .driver_data = (kernel_ulong_t)&intel_th_2x, }, { +/* Meteor Lake-S */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7f26), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, + {/* Raptor Lake-S */ PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x7a26 ), .driver_data = (kernel_ulong_t)&intel_th_2x,
Greg Kroah-Hartman
maintainerPATCH 193/217 intel_th: pci: Add Lunar Lake support
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Shishkin <[email protected]>
commit f866b65322bfbc8fcca13c25f49e1a5c5a93ae4d upstream.
Add support for the Trace Hub in Lunar Lake.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -325,6 +325,11 @@ static const struct pci_device_id intel_ .driver_data = (kernel_ulong_t)&intel_th_2x, }, { +/* Lunar Lake */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa824), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, + {/* Alder Lake CPU */ PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x466f ), .driver_data = (kernel_ulong_t)&intel_th_2x,
Greg Kroah-Hartman
maintainerPATCH 194/217 btrfs: zoned: introduce a zone_info struct in btrfs_load_block_group_zone_info
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
commit 15c12fcc50a1b12a747f8b6ec05cdb18c537a4d1 upstream.
Add a new zone_info structure to hold per-zone information in btrfs_load_block_group_zone_info and prepare for breaking out helpers from it.
--- fs/btrfs/zoned.c | 84 ++++++++++++++++++++++++------------------------------- 1 file changed, 37 insertions(+), 47 deletions(-)
fs/btrfs/zoned.c +37 -47
@@ -1270,6 +1270,12 @@ out:return ret; } +struct zone_info { +u64 physical; +u64 capacity; +u64 alloc_offset; +}; +int btrfs_load_block_group_zone_info (struct btrfs_block_group *cache,bool new) {struct btrfs_fs_info *fs_info = cache->fs_info;
@@ -1279,12 +1285,10 @@ int btrfs_load_block_group_zone_info(strstruct btrfs_device *device;u64 logical = cache->start;u64 length = cache->length; +struct zone_info *zone_info =NULL ;int ret;int i;unsigned int nofs_flag; -u64 *alloc_offsets =NULL ; -u64 *caps =NULL ; -u64 *physical =NULL ;unsigned long *active =NULL ;u64 last_alloc =0 ;u32 num_sequential =0 , num_conventional =0 ;
@@ -1316,20 +1320,8 @@ int btrfs_load_block_group_zone_info(str goto out; } - alloc_offsets =kcalloc (map->num_stripes,sizeof (*alloc_offsets),GFP_NOFS ); -if (!alloc_offsets) { - ret = -ENOMEM ; - goto out; - } - - caps =kcalloc (map->num_stripes,sizeof (*caps),GFP_NOFS ); -if (!caps) { - ret = -ENOMEM ; - goto out; - } - - physical =kcalloc (map->num_stripes,sizeof (*physical),GFP_NOFS ); -if (!physical) { + zone_info =kcalloc (map->num_stripes,sizeof (*zone_info),GFP_NOFS ); +if (!zone_info) { ret = -ENOMEM ; goto out; }
@@ -1341,20 +1333,21 @@ int btrfs_load_block_group_zone_info(str }for (i =0 ; i < map->num_stripes; i++) { +struct zone_info *info = &zone_info[i];bool is_sequential;struct blk_zone zone;struct btrfs_dev_replace *dev_replace = &fs_info->dev_replace;int dev_replace_is_ongoing =0 ; device = map->stripes[i].dev; - physical[i] = map->stripes[i].physical; + info->physical = map->stripes[i].physical;if (device->bdev ==NULL ) { - alloc_offsets[i] =WP_MISSING_DEV ; + info->alloc_offset =WP_MISSING_DEV ;continue ; } - is_sequential =btrfs_dev_is_sequential (device, physical[i]); + is_sequential =btrfs_dev_is_sequential (device, info->physical);if (is_sequential) num_sequential++;else
@@ -1368,7 +1361,7 @@ int btrfs_load_block_group_zone_info(str__set_bit (i, active);if (!is_sequential) { - alloc_offsets[i] =WP_CONVENTIONAL ; + info->alloc_offset =WP_CONVENTIONAL ;continue ; }
@@ -1376,25 +1369,25 @@ int btrfs_load_block_group_zone_info(str* This zone will be used for allocation, so mark this zone * non-empty. */ -btrfs_dev_clear_zone_empty (device, physical[i]); +btrfs_dev_clear_zone_empty (device, info->physical);down_read (&dev_replace->rwsem); dev_replace_is_ongoing =btrfs_dev_replace_is_ongoing (dev_replace);if (dev_replace_is_ongoing && dev_replace->tgtdev !=NULL ) -btrfs_dev_clear_zone_empty (dev_replace->tgtdev, physical[i]); +btrfs_dev_clear_zone_empty (dev_replace->tgtdev, info->physical);up_read (&dev_replace->rwsem);/* * The group is mapped to a sequential zone. Get the zone write * pointer to determine the allocation offset within the zone. */ -WARN_ON (!IS_ALIGNED (physical[i], fs_info->zone_size)); +WARN_ON (!IS_ALIGNED (info->physical, fs_info->zone_size)); nofs_flag =memalloc_nofs_save (); - ret =btrfs_get_dev_zone (device, physical[i], &zone); + ret =btrfs_get_dev_zone (device, info->physical, &zone);memalloc_nofs_restore (nofs_flag);if (ret == -EIO || ret == -EOPNOTSUPP ) { ret =0 ; - alloc_offsets[i] =WP_MISSING_DEV ; + info->alloc_offset =WP_MISSING_DEV ;continue ; }else if (ret) { goto out;
@@ -1409,27 +1402,26 @@ int btrfs_load_block_group_zone_info(str goto out; } - caps[i] = (zone.capacity <<SECTOR_SHIFT ); + info->capacity = (zone.capacity <<SECTOR_SHIFT );switch (zone.cond) {case BLK_ZONE_COND_OFFLINE :case BLK_ZONE_COND_READONLY :btrfs_err (fs_info,"zoned: offline/readonly zone %llu on device %s (devid %llu)" , - physical[i] >> device->zone_info->zone_size_shift, + info->physical >> device->zone_info->zone_size_shift,rcu_str_deref (device->name), device->devid); - alloc_offsets[i] =WP_MISSING_DEV ; + info->alloc_offset =WP_MISSING_DEV ;break ;case BLK_ZONE_COND_EMPTY : - alloc_offsets[i] =0 ; + info->alloc_offset =0 ;break ;case BLK_ZONE_COND_FULL : - alloc_offsets[i] = caps[i]; + info->alloc_offset = info->capacity;break ;default :/* Partially used zone */ - alloc_offsets[i] = - ((zone.wp - zone.start) <<SECTOR_SHIFT ); + info->alloc_offset = ((zone.wp - zone.start) <<SECTOR_SHIFT );__set_bit (i, active);break ; }
@@ -1456,15 +1448,15 @@ int btrfs_load_block_group_zone_info(strswitch (map->type &BTRFS_BLOCK_GROUP_PROFILE_MASK ) {case 0 :/* single */ -if (alloc_offsets[0 ] ==WP_MISSING_DEV ) { +if (zone_info[0 ].alloc_offset ==WP_MISSING_DEV ) {btrfs_err (fs_info,"zoned: cannot recover write pointer for zone %llu" , - physical[0 ]); + zone_info[0 ].physical); ret = -EIO ; goto out; } - cache->alloc_offset = alloc_offsets[0 ]; - cache->zone_capacity = caps[0 ]; + cache->alloc_offset = zone_info[0 ].alloc_offset; + cache->zone_capacity = zone_info[0 ].capacity;if (test_bit (0 , active))set_bit (BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE , &cache->runtime_flags);break ;
@@ -1474,21 +1466,21 @@ int btrfs_load_block_group_zone_info(str ret = -EINVAL ; goto out; } -if (alloc_offsets[0 ] ==WP_MISSING_DEV ) { +if (zone_info[0 ].alloc_offset ==WP_MISSING_DEV ) {btrfs_err (fs_info,"zoned: cannot recover write pointer for zone %llu" , - physical[0 ]); + zone_info[0 ].physical); ret = -EIO ; goto out; } -if (alloc_offsets[1 ] ==WP_MISSING_DEV ) { +if (zone_info[1 ].alloc_offset ==WP_MISSING_DEV ) {btrfs_err (fs_info,"zoned: cannot recover write pointer for zone %llu" , - physical[1 ]); + zone_info[1 ].physical); ret = -EIO ; goto out; } -if (alloc_offsets[0 ] != alloc_offsets[1 ]) { +if (zone_info[0 ].alloc_offset != zone_info[1 ].alloc_offset) {btrfs_err (fs_info,"zoned: write pointer offset mismatch of zones in DUP profile" ); ret = -EIO ;
@@ -1504,8 +1496,8 @@ int btrfs_load_block_group_zone_info(strset_bit (BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE , &cache->runtime_flags); } - cache->alloc_offset = alloc_offsets[0 ]; - cache->zone_capacity =min (caps[0 ], caps[1 ]); + cache->alloc_offset = zone_info[0 ].alloc_offset; + cache->zone_capacity =min (zone_info[0 ].capacity, zone_info[1 ].capacity);break ;case BTRFS_BLOCK_GROUP_RAID1 :case BTRFS_BLOCK_GROUP_RAID0 :
@@ -1558,9 +1550,7 @@ out: cache->physical_map =NULL ; }bitmap_free (active); -kfree (physical); -kfree (caps); -kfree (alloc_offsets); +kfree (zone_info);free_extent_map (em);return ret;
Greg Kroah-Hartman
maintainerPATCH 195/217 btrfs: zoned: factor out per-zone logic from btrfs_load_block_group_zone_info
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
commit 09a46725cc84165af452d978a3532d6b97a28796 upstream.
Split out a helper for the body of the per-zone loop in btrfs_load_block_group_zone_info to make the function easier to read and modify.
--- fs/btrfs/zoned.c | 184 +++++++++++++++++++++++++++---------------------------- 1 file changed, 92 insertions(+), 92 deletions(-)
fs/btrfs/zoned.c +92 -92
@@ -1276,19 +1276,103 @@ struct zone_info {u64 alloc_offset; }; +static int btrfs_load_zone_info (struct btrfs_fs_info *fs_info,int zone_idx, +struct zone_info *info,unsigned long *active, +struct map_lookup *map) +{ +struct btrfs_dev_replace *dev_replace = &fs_info->dev_replace; +struct btrfs_device *device = map->stripes[zone_idx].dev; +int dev_replace_is_ongoing =0 ; +unsigned int nofs_flag; +struct blk_zone zone; +int ret; + + info->physical = map->stripes[zone_idx].physical; + +if (!device->bdev) { + info->alloc_offset =WP_MISSING_DEV ; +return 0 ; + } + +/* Consider a zone as active if we can allow any number of active zones. */ +if (!device->zone_info->max_active_zones) +__set_bit (zone_idx, active); + +if (!btrfs_dev_is_sequential (device, info->physical)) { + info->alloc_offset =WP_CONVENTIONAL ; +return 0 ; + } + +/* This zone will be used for allocation, so mark this zone non-empty. */ +btrfs_dev_clear_zone_empty (device, info->physical); + +down_read (&dev_replace->rwsem); + dev_replace_is_ongoing =btrfs_dev_replace_is_ongoing (dev_replace); +if (dev_replace_is_ongoing && dev_replace->tgtdev !=NULL ) +btrfs_dev_clear_zone_empty (dev_replace->tgtdev, info->physical); +up_read (&dev_replace->rwsem); + +/* +* The group is mapped to a sequential zone. Get the zone write pointer +* to determine the allocation offset within the zone. +*/ +WARN_ON (!IS_ALIGNED (info->physical, fs_info->zone_size)); + nofs_flag =memalloc_nofs_save (); + ret =btrfs_get_dev_zone (device, info->physical, &zone); +memalloc_nofs_restore (nofs_flag); +if (ret) { +if (ret != -EIO && ret != -EOPNOTSUPP ) +return ret; + info->alloc_offset =WP_MISSING_DEV ; +return 0 ; + } + +if (zone.type ==BLK_ZONE_TYPE_CONVENTIONAL ) { +btrfs_err_in_rcu (fs_info, +"zoned: unexpected conventional zone %llu on device %s (devid %llu)" , + zone.start <<SECTOR_SHIFT ,rcu_str_deref (device->name), + device->devid); +return -EIO ; + } + + info->capacity = (zone.capacity <<SECTOR_SHIFT ); + +switch (zone.cond) { +case BLK_ZONE_COND_OFFLINE : +case BLK_ZONE_COND_READONLY : +btrfs_err (fs_info, +"zoned: offline/readonly zone %llu on device %s (devid %llu)" , + (info->physical >> device->zone_info->zone_size_shift), +rcu_str_deref (device->name), device->devid); + info->alloc_offset =WP_MISSING_DEV ; +break ; +case BLK_ZONE_COND_EMPTY : + info->alloc_offset =0 ; +break ; +case BLK_ZONE_COND_FULL : + info->alloc_offset = info->capacity; +break ; +default : +/* Partially used zone. */ + info->alloc_offset = ((zone.wp - zone.start) <<SECTOR_SHIFT ); +__set_bit (zone_idx, active); +break ; + } + +return 0 ; +} +int btrfs_load_block_group_zone_info (struct btrfs_block_group *cache,bool new) {struct btrfs_fs_info *fs_info = cache->fs_info;struct extent_map_tree *em_tree = &fs_info->mapping_tree;struct extent_map *em;struct map_lookup *map; -struct btrfs_device *device;u64 logical = cache->start;u64 length = cache->length;struct zone_info *zone_info =NULL ;int ret;int i; -unsigned int nofs_flag;unsigned long *active =NULL ;u64 last_alloc =0 ;u32 num_sequential =0 , num_conventional =0 ;
@@ -1333,98 +1417,14 @@ int btrfs_load_block_group_zone_info(str }for (i =0 ; i < map->num_stripes; i++) { -struct zone_info *info = &zone_info[i]; -bool is_sequential; -struct blk_zone zone; -struct btrfs_dev_replace *dev_replace = &fs_info->dev_replace; -int dev_replace_is_ongoing =0 ; - - device = map->stripes[i].dev; - info->physical = map->stripes[i].physical; - -if (device->bdev ==NULL ) { - info->alloc_offset =WP_MISSING_DEV ; -continue ; - } - - is_sequential =btrfs_dev_is_sequential (device, info->physical); -if (is_sequential) - num_sequential++; -else - num_conventional++; - -/* -* Consider a zone as active if we can allow any number of -* active zones. -*/ -if (!device->zone_info->max_active_zones) -__set_bit (i, active); - -if (!is_sequential) { - info->alloc_offset =WP_CONVENTIONAL ; -continue ; - } - -/* -* This zone will be used for allocation, so mark this zone -* non-empty. -*/ -btrfs_dev_clear_zone_empty (device, info->physical); - -down_read (&dev_replace->rwsem); - dev_replace_is_ongoing =btrfs_dev_replace_is_ongoing (dev_replace); -if (dev_replace_is_ongoing && dev_replace->tgtdev !=NULL ) -btrfs_dev_clear_zone_empty (dev_replace->tgtdev, info->physical); -up_read (&dev_replace->rwsem); - -/* -* The group is mapped to a sequential zone. Get the zone write -* pointer to determine the allocation offset within the zone. -*/ -WARN_ON (!IS_ALIGNED (info->physical, fs_info->zone_size)); - nofs_flag =memalloc_nofs_save (); - ret =btrfs_get_dev_zone (device, info->physical, &zone); -memalloc_nofs_restore (nofs_flag); -if (ret == -EIO || ret == -EOPNOTSUPP ) { - ret =0 ; - info->alloc_offset =WP_MISSING_DEV ; -continue ; - }else if (ret) { + ret =btrfs_load_zone_info (fs_info, i, &zone_info[i], active, map); +if (ret) goto out; - } - -if (zone.type ==BLK_ZONE_TYPE_CONVENTIONAL ) { -btrfs_err_in_rcu (fs_info, -"zoned: unexpected conventional zone %llu on device %s (devid %llu)" , - zone.start <<SECTOR_SHIFT , -rcu_str_deref (device->name), device->devid); - ret = -EIO ; - goto out; - } - - info->capacity = (zone.capacity <<SECTOR_SHIFT ); -switch (zone.cond) { -case BLK_ZONE_COND_OFFLINE : -case BLK_ZONE_COND_READONLY : -btrfs_err (fs_info, -"zoned: offline/readonly zone %llu on device %s (devid %llu)" , - info->physical >> device->zone_info->zone_size_shift, -rcu_str_deref (device->name), device->devid); - info->alloc_offset =WP_MISSING_DEV ; -break ; -case BLK_ZONE_COND_EMPTY : - info->alloc_offset =0 ; -break ; -case BLK_ZONE_COND_FULL : - info->alloc_offset = info->capacity; -break ; -default : -/* Partially used zone */ - info->alloc_offset = ((zone.wp - zone.start) <<SECTOR_SHIFT ); -__set_bit (i, active); -break ; - } +if (zone_info[i].alloc_offset ==WP_CONVENTIONAL ) + num_conventional++; +else + num_sequential++; }if (num_sequential >0 )
Greg Kroah-Hartman
maintainerPATCH 196/217 btrfs: zoned: factor out single bg handling from btrfs_load_block_group_zone_info
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
commit 9e0e3e74dc6928a0956f4e27e24d473c65887e96 upstream.
Split the code handling a type single block group from btrfs_load_block_group_zone_info to make the code more readable.
--- fs/btrfs/zoned.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
fs/btrfs/zoned.c +19 -11
@@ -1362,6 +1362,24 @@ static int btrfs_load_zone_info(struct breturn 0 ; } +static int btrfs_load_block_group_single (struct btrfs_block_group *bg, +struct zone_info *info, +unsigned long *active) +{ +if (info->alloc_offset ==WP_MISSING_DEV ) { +btrfs_err (bg->fs_info, +"zoned: cannot recover write pointer for zone %llu" , + info->physical); +return -EIO ; + } + + bg->alloc_offset = info->alloc_offset; + bg->zone_capacity = info->capacity; +if (test_bit (0 , active)) +set_bit (BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE , &bg->runtime_flags); +return 0 ; +} +int btrfs_load_block_group_zone_info (struct btrfs_block_group *cache,bool new) {struct btrfs_fs_info *fs_info = cache->fs_info;
@@ -1448,17 +1466,7 @@ int btrfs_load_block_group_zone_info(strswitch (map->type &BTRFS_BLOCK_GROUP_PROFILE_MASK ) {case 0 :/* single */ -if (zone_info[0 ].alloc_offset ==WP_MISSING_DEV ) { -btrfs_err (fs_info, -"zoned: cannot recover write pointer for zone %llu" , - zone_info[0 ].physical); - ret = -EIO ; - goto out; - } - cache->alloc_offset = zone_info[0 ].alloc_offset; - cache->zone_capacity = zone_info[0 ].capacity; -if (test_bit (0 , active)) -set_bit (BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE , &cache->runtime_flags); + ret =btrfs_load_block_group_single (cache, &zone_info[0 ], active);break ;case BTRFS_BLOCK_GROUP_DUP :if (map->type &BTRFS_BLOCK_GROUP_DATA ) {
Greg Kroah-Hartman
maintainerPATCH 197/217 btrfs: zoned: factor out DUP bg handling from btrfs_load_block_group_zone_info
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
commit 87463f7e0250d471fac41e7c9c45ae21d83b5f85 upstream.
Split the code handling a type DUP block group from btrfs_load_block_group_zone_info to make the code more readable.
--- fs/btrfs/zoned.c | 79 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 42 insertions(+), 37 deletions(-)
fs/btrfs/zoned.c +42 -37
@@ -1380,6 +1380,47 @@ static int btrfs_load_block_group_singlereturn 0 ; } +static int btrfs_load_block_group_dup (struct btrfs_block_group *bg, +struct map_lookup *map, +struct zone_info *zone_info, +unsigned long *active) +{ +if (map->type &BTRFS_BLOCK_GROUP_DATA ) { +btrfs_err (bg->fs_info, +"zoned: profile DUP not yet supported on data bg" ); +return -EINVAL ; + } + +if (zone_info[0 ].alloc_offset ==WP_MISSING_DEV ) { +btrfs_err (bg->fs_info, +"zoned: cannot recover write pointer for zone %llu" , + zone_info[0 ].physical); +return -EIO ; + } +if (zone_info[1 ].alloc_offset ==WP_MISSING_DEV ) { +btrfs_err (bg->fs_info, +"zoned: cannot recover write pointer for zone %llu" , + zone_info[1 ].physical); +return -EIO ; + } +if (zone_info[0 ].alloc_offset != zone_info[1 ].alloc_offset) { +btrfs_err (bg->fs_info, +"zoned: write pointer offset mismatch of zones in DUP profile" ); +return -EIO ; + } + +if (test_bit (0 , active) !=test_bit (1 , active)) { +if (!btrfs_zone_activate (bg)) +return -EIO ; + }else if (test_bit (0 , active)) { +set_bit (BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE , &bg->runtime_flags); + } + + bg->alloc_offset = zone_info[0 ].alloc_offset; + bg->zone_capacity =min (zone_info[0 ].capacity, zone_info[1 ].capacity); +return 0 ; +} +int btrfs_load_block_group_zone_info (struct btrfs_block_group *cache,bool new) {struct btrfs_fs_info *fs_info = cache->fs_info;
@@ -1469,43 +1510,7 @@ int btrfs_load_block_group_zone_info(str ret =btrfs_load_block_group_single (cache, &zone_info[0 ], active);break ;case BTRFS_BLOCK_GROUP_DUP : -if (map->type &BTRFS_BLOCK_GROUP_DATA ) { -btrfs_err (fs_info,"zoned: profile DUP not yet supported on data bg" ); - ret = -EINVAL ; - goto out; - } -if (zone_info[0 ].alloc_offset ==WP_MISSING_DEV ) { -btrfs_err (fs_info, -"zoned: cannot recover write pointer for zone %llu" , - zone_info[0 ].physical); - ret = -EIO ; - goto out; - } -if (zone_info[1 ].alloc_offset ==WP_MISSING_DEV ) { -btrfs_err (fs_info, -"zoned: cannot recover write pointer for zone %llu" , - zone_info[1 ].physical); - ret = -EIO ; - goto out; - } -if (zone_info[0 ].alloc_offset != zone_info[1 ].alloc_offset) { -btrfs_err (fs_info, -"zoned: write pointer offset mismatch of zones in DUP profile" ); - ret = -EIO ; - goto out; - } -if (test_bit (0 , active) !=test_bit (1 , active)) { -if (!btrfs_zone_activate (cache)) { - ret = -EIO ; - goto out; - } - }else { -if (test_bit (0 , active)) -set_bit (BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE , - &cache->runtime_flags); - } - cache->alloc_offset = zone_info[0 ].alloc_offset; - cache->zone_capacity =min (zone_info[0 ].capacity, zone_info[1 ].capacity); + ret =btrfs_load_block_group_dup (cache, map, zone_info, active);break ;case BTRFS_BLOCK_GROUP_RAID1 :case BTRFS_BLOCK_GROUP_RAID0 :
Greg Kroah-Hartman
maintainerPATCH 198/217 btrfs: zoned: fix use-after-free due to race with dev replace
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 0090d6e1b210551e63cf43958dc7a1ec942cdde9 upstream.
While loading a zone's info during creation of a block group, we can race with a device replace operation and then trigger a use-after-free on the device that was just replaced (source device of the replace operation).
This happens because at btrfs_load_zone_info() we extract a device from the chunk map into a local variable and then use the device while not under the protection of the device replace rwsem. So if there's a device replace operation happening when we extract the device and that device is the source of the replace operation, we will trigger a use-after-free if before we finish using the device the replace operation finishes and frees the device.
Fix this by enlarging the critical section under the protection of the device replace rwsem so that all uses of the device are done inside the critical section.
--- fs/btrfs/zoned.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
fs/btrfs/zoned.c +10 -3
@@ -1281,7 +1281,7 @@ static int btrfs_load_zone_info(struct b struct map_lookup *map) {struct btrfs_dev_replace *dev_replace = &fs_info->dev_replace; -struct btrfs_device *device = map->stripes[zone_idx].dev; +struct btrfs_device *device;int dev_replace_is_ongoing =0 ;unsigned int nofs_flag;struct blk_zone zone;
@@ -1289,7 +1289,11 @@ static int btrfs_load_zone_info(struct b info->physical = map->stripes[zone_idx].physical; +down_read (&dev_replace->rwsem); + device = map->stripes[zone_idx].dev; +if (!device->bdev) { +up_read (&dev_replace->rwsem); info->alloc_offset =WP_MISSING_DEV ;return 0 ; }
@@ -1299,6 +1303,7 @@ static int btrfs_load_zone_info(struct b__set_bit (zone_idx, active);if (!btrfs_dev_is_sequential (device, info->physical)) { +up_read (&dev_replace->rwsem); info->alloc_offset =WP_CONVENTIONAL ;return 0 ; }
@@ -1306,11 +1311,9 @@ static int btrfs_load_zone_info(struct b/* This zone will be used for allocation, so mark this zone non-empty. */ btrfs_dev_clear_zone_empty (device, info->physical); -down_read (&dev_replace->rwsem); dev_replace_is_ongoing =btrfs_dev_replace_is_ongoing (dev_replace);if (dev_replace_is_ongoing && dev_replace->tgtdev !=NULL )btrfs_dev_clear_zone_empty (dev_replace->tgtdev, info->physical); -up_read (&dev_replace->rwsem);/* * The group is mapped to a sequential zone. Get the zone write pointer
@@ -1321,6 +1324,7 @@ static int btrfs_load_zone_info(struct b ret =btrfs_get_dev_zone (device, info->physical, &zone);memalloc_nofs_restore (nofs_flag);if (ret) { +up_read (&dev_replace->rwsem);if (ret != -EIO && ret != -EOPNOTSUPP )return ret; info->alloc_offset =WP_MISSING_DEV ;
@@ -1332,6 +1336,7 @@ static int btrfs_load_zone_info(struct b"zoned: unexpected conventional zone %llu on device %s (devid %llu)" , zone.start <<SECTOR_SHIFT ,rcu_str_deref (device->name), device->devid); +up_read (&dev_replace->rwsem);return -EIO ; }
@@ -1359,6 +1364,8 @@ static int btrfs_load_zone_info(struct bbreak ; } +up_read (&dev_replace->rwsem); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 199/217 nilfs2: fix potential kernel bug due to lack of writeback flag waiting
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit a4ca369ca221bb7e06c725792ac107f0e48e82e7 upstream.
Destructive writes to a block device on which nilfs2 is mounted can cause a kernel bug in the folio/page writeback start routine or writeback end routine (__folio_start_writeback in the log below):
kernel BUG at mm/page-writeback.c:3070!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI ... RIP: 0010:__folio_start_writeback+0xbaa/0x10e0 Code: 25 ff 0f 00 00 0f 84 18 01 00 00 e8 40 ca c6 ff e9 17 f6 ff ff e8 36 ca c6 ff 4c 89 f7 48 c7 c6 80 c0 12 84 e8 e7 b3 0f 00 90 <0f> 0b e8 1f ca c6 ff 4c 89 f7 48 c7 c6 a0 c6 12 84 e8 d0 b3 0f 00 ... Call Trace: <TASK> nilfs_segctor_do_construct+0x4654/0x69d0 [nilfs2] nilfs_segctor_construct+0x181/0x6b0 [nilfs2] nilfs_segctor_thread+0x548/0x11c0 [nilfs2] kthread+0x2f0/0x390 ret_from_fork+0x4b/0x80 ret_from_fork_asm+0x1a/0x30 </TASK>
This is because when the log writer starts a writeback for segment summary blocks or a super root block that use the backing device's page cache, it does not wait for the ongoing folio/page writeback, resulting in an inconsistent writeback state.
Fix this issue by waiting for ongoing writebacks when putting folios/pages on the backing device into writeback state.
--- fs/nilfs2/segment.c | 3 +++ 1 file changed, 3 insertions(+)
fs/nilfs2/segment.c +3 -0
@@ -1692,6 +1692,7 @@ static void nilfs_segctor_prepare_write(if (bh->b_page != bd_page) {if (bd_page) {lock_page (bd_page); +wait_on_page_writeback (bd_page);clear_page_dirty_for_io (bd_page);set_page_writeback (bd_page);unlock_page (bd_page);
@@ -1705,6 +1706,7 @@ static void nilfs_segctor_prepare_write(if (bh == segbuf->sb_super_root) {if (bh->b_page != bd_page) {lock_page (bd_page); +wait_on_page_writeback (bd_page);clear_page_dirty_for_io (bd_page);set_page_writeback (bd_page);unlock_page (bd_page);
@@ -1721,6 +1723,7 @@ static void nilfs_segctor_prepare_write( }if (bd_page) {lock_page (bd_page); +wait_on_page_writeback (bd_page);clear_page_dirty_for_io (bd_page);set_page_writeback (bd_page);unlock_page (bd_page);
Greg Kroah-Hartman
maintainerPATCH 200/217 tick/nohz_full: Dont abuse smp_call_function_single() in tick_setup_device()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
commit 07c54cc5988f19c9642fd463c2dbdac7fc52f777 upstream.
After the recent commit 5097cbcb38e6 ("sched/isolation: Prevent boot crash when the boot CPU is nohz_full") the kernel no longer crashes, but there is another problem.
In this case tick_setup_device() calls tick_take_do_timer_from_boot() to update tick_do_timer_cpu and this triggers the WARN_ON_ONCE(irqs_disabled) in smp_call_function_single().
Kill tick_take_do_timer_from_boot() and just use WRITE_ONCE(), the new comment explains why this is safe (thanks Thomas!).
--- kernel/time/tick-common.c | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-)
kernel/time/tick-common.c +14 -28
@@ -179,26 +179,6 @@ void tick_setup_periodic(struct clock_ev } } -#ifdef CONFIG_NO_HZ_FULL -static void giveup_do_timer (void *info) -{ -int cpu = *(unsigned int *)info; - -WARN_ON (tick_do_timer_cpu !=smp_processor_id ()); - - tick_do_timer_cpu = cpu; -} - -static void tick_take_do_timer_from_boot (void ) -{ -int cpu =smp_processor_id (); -int from = tick_do_timer_boot_cpu; - -if (from >=0 && from != cpu) -smp_call_function_single (from, giveup_do_timer, &cpu,1 ); -} -#endif -/* * Setup the tick device */
@@ -222,19 +202,25 @@ static void tick_setup_device(struct tic tick_next_period =ktime_get ();#ifdef CONFIG_NO_HZ_FULL /* -* The boot CPU may be nohz_full, in which case set -* tick_do_timer_boot_cpu so the first housekeeping -* secondary that comes up will take do_timer from -* us. +* The boot CPU may be nohz_full, in which case the +* first housekeeping secondary will take do_timer() +* from it. */ if (tick_nohz_full_cpu (cpu)) tick_do_timer_boot_cpu = cpu; - }else if (tick_do_timer_boot_cpu !=-1 && - !tick_nohz_full_cpu (cpu)) { -tick_take_do_timer_from_boot (); + }else if (tick_do_timer_boot_cpu !=-1 && !tick_nohz_full_cpu (cpu)) { tick_do_timer_boot_cpu =-1 ; -WARN_ON (tick_do_timer_cpu != cpu); +/* +* The boot CPU will stay in periodic (NOHZ disabled) +* mode until clocksource_done_booting() called after +* smp_init() selects a high resolution clocksource and +* timekeeping_notify() kicks the NOHZ stuff alive. +* +* So this WRITE_ONCE can only race with the READ_ONCE +* check in tick_periodic() but this race is harmless. +*/ +WRITE_ONCE (tick_do_timer_cpu, cpu);#endif }
Greg Kroah-Hartman
maintainerPATCH 201/217 mm/huge_memory: dont unpoison huge_zero_folio
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miaohe Lin <[email protected]>
commit fe6f86f4b40855a130a19aa589f9ba7f650423f4 upstream.
When I did memory failure tests recently, below panic occurs:
kernel BUG at include/linux/mm.h:1135!
invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
CPU: 9 PID: 137 Comm: kswapd1 Not tainted 6.9.0-rc4-00491-gd5ce28f156fe-dirty #14 RIP: 0010:shrink_huge_zero_page_scan+0x168/0x1a0 RSP: 0018:ffff9933c6c57bd0 EFLAGS: 00000246 RAX: 000000000000003e RBX: 0000000000000000 RCX: ffff88f61fc5c9c8 RDX: 0000000000000000 RSI: 0000000000000027 RDI: ffff88f61fc5c9c0 RBP: ffffcd7c446b0000 R08: ffffffff9a9405f0 R09: 0000000000005492 R10: 00000000000030ea R11: ffffffff9a9405f0 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: ffff88e703c4ac00 FS: 0000000000000000(0000) GS:ffff88f61fc40000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000055f4da6e9878 CR3: 0000000c71048000 CR4: 00000000000006f0 Call Trace: <TASK> do_shrink_slab+0x14f/0x6a0 shrink_slab+0xca/0x8c0 shrink_node+0x2d0/0x7d0 balance_pgdat+0x33a/0x720 kswapd+0x1f3/0x410 kthread+0xd5/0x100 ret_from_fork+0x2f/0x50 ret_from_fork_asm+0x1a/0x30 </TASK> Modules linked in: mce_inject hwpoison_inject ---[ end trace 0000000000000000 ]--- RIP: 0010:shrink_huge_zero_page_scan+0x168/0x1a0 RSP: 0018:ffff9933c6c57bd0 EFLAGS: 00000246 RAX: 000000000000003e RBX: 0000000000000000 RCX: ffff88f61fc5c9c8 RDX: 0000000000000000 RSI: 0000000000000027 RDI: ffff88f61fc5c9c0 RBP: ffffcd7c446b0000 R08: ffffffff9a9405f0 R09: 0000000000005492 R10: 00000000000030ea R11: ffffffff9a9405f0 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: ffff88e703c4ac00 FS: 0000000000000000(0000) GS:ffff88f61fc40000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000055f4da6e9878 CR3: 0000000c71048000 CR4: 00000000000006f0
The root cause is that HWPoison flag will be set for huge_zero_folio without increasing the folio refcnt. But then unpoison_memory() will decrease the folio refcnt unexpectedly as it appears like a successfully hwpoisoned folio leading to VM_BUG_ON_PAGE(page_ref_count(page) == 0) when releasing huge_zero_folio.
Skip unpoisoning huge_zero_folio in unpoison_memory() to fix this issue. We're not prepared to unpoison huge_zero_folio yet.
--- mm/memory-failure.c | 7 +++++++ 1 file changed, 7 insertions(+)
mm/memory-failure.c +7 -0
@@ -2346,6 +2346,13 @@ int unpoison_memory(unsigned long pfn) goto unlock_mutex; } +if (is_huge_zero_page (page)) { +unpoison_pr_info ("Unpoison: huge zero page is not supported %#lx\n" , + pfn, &unpoison_rs); + ret = -EOPNOTSUPP ; + goto unlock_mutex; + } +if (!PageHWPoison (p)) {unpoison_pr_info ("Unpoison: Page was already unpoisoned %#lx\n" , pfn, &unpoison_rs);
Greg Kroah-Hartman
maintainerPATCH 202/217 mm/memory-failure: fix handling of dissolved but not taken off from buddy pages
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miaohe Lin <[email protected]>
commit 8cf360b9d6a840700e06864236a01a883b34bbad upstream.
When I did memory failure tests recently, below panic occurs:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x8cee00 flags: 0x6fffe0000000000(node=1|zone=2|lastcpupid=0x7fff) raw: 06fffe0000000000 dead000000000100 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000000009 00000000ffffffff 0000000000000000 page dumped because: VM_BUG_ON_PAGE(!PageBuddy(page)) ------------[ cut here ]------------ kernel BUG at include/linux/page-flags.h:1009! invalid opcode: 0000 [#1] PREEMPT SMP NOPTI RIP: 0010:__del_page_from_free_list+0x151/0x180 RSP: 0018:ffffa49c90437998 EFLAGS: 00000046 RAX: 0000000000000035 RBX: 0000000000000009 RCX: ffff8dd8dfd1c9c8 RDX: 0000000000000000 RSI: 0000000000000027 RDI: ffff8dd8dfd1c9c0 RBP: ffffd901233b8000 R08: ffffffffab5511f8 R09: 0000000000008c69 R10: 0000000000003c15 R11: ffffffffab5511f8 R12: ffff8dd8fffc0c80 R13: 0000000000000001 R14: ffff8dd8fffc0c80 R15: 0000000000000009 FS: 00007ff916304740(0000) GS:ffff8dd8dfd00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000055eae50124c8 CR3: 00000008479e0000 CR4: 00000000000006f0 Call Trace: <TASK> __rmqueue_pcplist+0x23b/0x520 get_page_from_freelist+0x26b/0xe40 __alloc_pages_noprof+0x113/0x1120 __folio_alloc_noprof+0x11/0xb0 alloc_buddy_hugetlb_folio.isra.0+0x5a/0x130 __alloc_fresh_hugetlb_folio+0xe7/0x140 alloc_pool_huge_folio+0x68/0x100 set_max_huge_pages+0x13d/0x340 hugetlb_sysctl_handler_common+0xe8/0x110 proc_sys_call_handler+0x194/0x280 vfs_write+0x387/0x550 ksys_write+0x64/0xe0 do_syscall_64+0xc2/0x1d0 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7ff916114887 RSP: 002b:00007ffec8a2fd78 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 000055eae500e350 RCX: 00007ff916114887 RDX: 0000000000000004 RSI: 000055eae500e390 RDI: 0000000000000003 RBP: 000055eae50104c0 R08: 0000000000000000 R09: 000055eae50104c0 R10: 0000000000000077 R11: 0000000000000246 R12: 0000000000000004 R13: 0000000000000004 R14: 00007ff916216b80 R15: 00007ff916216a00 </TASK> Modules linked in: mce_inject hwpoison_inject ---[ end trace 0000000000000000 ]---
And before the panic, there had an warning about bad page state:
BUG: Bad page state in process page-types pfn:8cee00 page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x8cee00 flags: 0x6fffe0000000000(node=1|zone=2|lastcpupid=0x7fff) page_type: 0xffffff7f(buddy) raw: 06fffe0000000000 ffffd901241c0008 ffffd901240f8008 0000000000000000 raw: 0000000000000000 0000000000000009 00000000ffffff7f 0000000000000000 page dumped because: nonzero mapcount Modules linked in: mce_inject hwpoison_inject CPU: 8 PID: 154211 Comm: page-types Not tainted 6.9.0-rc4-00499-g5544ec3178e2-dirty #22 Call Trace: <TASK> dump_stack_lvl+0x83/0xa0 bad_page+0x63/0xf0 free_unref_page+0x36e/0x5c0 unpoison_memory+0x50b/0x630 simple_attr_write_xsigned.constprop.0.isra.0+0xb3/0x110 debugfs_attr_write+0x42/0x60 full_proxy_write+0x5b/0x80 vfs_write+0xcd/0x550 ksys_write+0x64/0xe0 do_syscall_64+0xc2/0x1d0 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f189a514887 RSP: 002b:00007ffdcd899718 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f189a514887 RDX: 0000000000000009 RSI: 00007ffdcd899730 RDI: 0000000000000003 RBP: 00007ffdcd8997a0 R08: 0000000000000000 R09: 00007ffdcd8994b2 R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffdcda199a8 R13: 0000000000404af1 R14: 000000000040ad78 R15: 00007f189a7a5040 </TASK>
The root cause should be the below race:
memory_failure
try_memory_failure_hugetlb
me_huge_page
__page_handle_poison
dissolve_free_hugetlb_folio
drain_all_pages -- Buddy page can be isolated e.g. for compaction. take_page_off_buddy -- Failed as page is not in the buddy list.
-- Page can be putback into buddy after compaction.
page_ref_inc -- Leads to buddy page with refcnt = 1.
Then unpoison_memory() can unpoison the page and send the buddy page back into buddy list again leading to the above bad page state warning. And bad_page() will call page_mapcount_reset() to remove PageBuddy from buddy page leading to later VM_BUG_ON_PAGE(!PageBuddy(page)) when trying to allocate this page.
Fix this issue by only treating __page_handle_poison() as successful when it returns 1.
--- mm/memory-failure.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/memory-failure.c +2 -2
@@ -1110,7 +1110,7 @@ static int me_huge_page(struct page_stat* subpages. */ put_page (hpage); -if (__page_handle_poison (p) >=0 ) { +if (__page_handle_poison (p) >0 ) {page_ref_inc (p); res =MF_RECOVERED ; }else {
@@ -1888,7 +1888,7 @@ retry:*/ if (res ==0 ) {unlock_page (head); -if (__page_handle_poison (p) >=0 ) { +if (__page_handle_poison (p) >0 ) {page_ref_inc (p); res =MF_RECOVERED ; }else {
Greg Kroah-Hartman
maintainerPATCH 203/217 serial: 8250_pxa: Configure tx_loadsz to match FIFO IRQ level
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Doug Brown <[email protected]>
commit 5208e7ced520a813b4f4774451fbac4e517e78b2 upstream.
The FIFO is 64 bytes, but the FCR is configured to fire the TX interrupt when the FIFO is half empty (bit 3 = 0). Thus, we should only write 32 bytes when a TX interrupt occurs.
This fixes a problem observed on the PXA168 that dropped a bunch of TX bytes during large transmissions.
--- drivers/tty/serial/8250/8250_pxa.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/8250/8250_pxa.c +1 -0
@@ -124,6 +124,7 @@ static int serial_pxa_probe(struct platf uart.port.regshift =2 ; uart.port.irq = irq; uart.port.fifosize =64 ; + uart.tx_loadsz =32 ; uart.port.flags =UPF_IOREMAP |UPF_SKIP_TEST |UPF_FIXED_TYPE ; uart.port.dev = &pdev->dev; uart.port.uartclk =clk_get_rate (data->clk);
Greg Kroah-Hartman
maintainerPATCH 204/217 mptcp: pm: update add_addr counters after connect
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: YonglongLi <[email protected]>
commit 40eec1795cc27b076d49236649a29507c7ed8c2d upstream.
The creation of new subflows can fail for different reasons. If no subflow have been created using the received ADD_ADDR, the related counters should not be updated, otherwise they will never be decremented for events related to this ID later on.
For the moment, the number of accepted ADD_ADDR is only decremented upon the reception of a related RM_ADDR, and only if the remote address ID is currently being used by at least one subflow. In other words, if no subflow can be created with the received address, the counter will not be decremented. In this case, it is then important not to increment pm.add_addr_accepted counter, and not to modify pm.accept_addr bit.
Note that this patch does not modify the behaviour in case of failures later on, e.g. if the MP Join is dropped or rejected.
The "remove invalid addresses" MP Join subtest has been modified to validate this case. The broadcast IP address is added before the "valid" address that will be used to successfully create a subflow, and the limit is decreased by one: without this patch, it was not possible to create the last subflow, because:
- the broadcast address would have been accepted even if it was not
usable: the creation of a subflow to this address results in an error,
- the limit of 2 accepted ADD_ADDR would have then been reached.
[ Conflicts in the selftests, in the same context, because the next line
with 'run_tests' has been updated later by a few commits like commit e571fb09c893 ("selftests: mptcp: add speed env var"). We don't need to touch this line, nor to backport the long refactoring series. ]
--- net/mptcp/pm_netlink.c | 16 ++++++++++------ tools/testing/selftests/net/mptcp/mptcp_join.sh | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-)
net/mptcp/pm_netlink.c +10 -6
@@ -685,6 +685,7 @@ static void mptcp_pm_nl_add_addr_receiveunsigned int add_addr_accept_max;struct mptcp_addr_info remote;unsigned int subflows_max; +bool sf_created = false;int i, nr; add_addr_accept_max =mptcp_pm_get_add_addr_accept_max (msk);
@@ -710,15 +711,18 @@ static void mptcp_pm_nl_add_addr_receive*/ nr =fill_local_addresses_vec (msk, addrs); - msk->pm.add_addr_accepted++; -if (msk->pm.add_addr_accepted >= add_addr_accept_max || - msk->pm.subflows >= subflows_max) -WRITE_ONCE (msk->pm.accept_addr, false); -spin_unlock_bh (&msk->pm.lock);for (i =0 ; i < nr; i++) -__mptcp_subflow_connect (sk, &addrs[i], &remote); +if (__mptcp_subflow_connect (sk, &addrs[i], &remote) ==0 ) + sf_created = true;spin_lock_bh (&msk->pm.lock); + +if (sf_created) { + msk->pm.add_addr_accepted++; +if (msk->pm.add_addr_accepted >= add_addr_accept_max || + msk->pm.subflows >= subflows_max) +WRITE_ONCE (msk->pm.accept_addr, false); + } }void mptcp_pm_nl_addr_send_ack (struct mptcp_sock *msk)
tools/testing/selftests/net/mptcp/mptcp_join.sh +2 -2
@@ -2343,10 +2343,10 @@ remove_tests() if reset "remove invalid addresses"; then pm_nl_set_limits $ns1 3 3 pm_nl_add_endpoint $ns1 10.0.12.1 flags signal - pm_nl_add_endpoint $ns1 10.0.3.1 flags signal # broadcast IP: no packet for this address will be received on ns1 pm_nl_add_endpoint $ns1 224.0.0.1 flags signal - pm_nl_set_limits $ns2 3 3 + pm_nl_add_endpoint $ns1 10.0.3.1 flags signal + pm_nl_set_limits $ns2 2 2 run_tests $ns1 $ns2 10.0.1.1 0 -3 0 speed_10 chk_join_nr 1 1 1 chk_add_nr 3 3
Greg Kroah-Hartman
maintainerPATCH 205/217 Revert "fork: defer linking file vma until vma is fully initialized"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sam James <[email protected]>
This reverts commit 0c42f7e039aba3de6d7dbf92da708e2b2ecba557 which is commit 35e351780fa9d8240dd6f7e4f245f9ea37e96c19 upstream.
The backport is incomplete and causes xfstests failures. The consequences of the incomplete backport seem worse than the original issue, so pick the lesser evil and revert until a full backport is ready.
--- kernel/fork.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
kernel/fork.c +9 -9
@@ -662,15 +662,6 @@ static __latent_entropy int dup_mmap(str }else if (anon_vma_fork (tmp, mpnt)) goto fail_nomem_anon_vma_fork; tmp->vm_flags &= ~(VM_LOCKED |VM_LOCKONFAULT ); -/* -* Copy/update hugetlb private vma information. -*/ -if (is_vm_hugetlb_page (tmp)) -hugetlb_dup_vma_private (tmp); - -if (tmp->vm_ops && tmp->vm_ops->open) - tmp->vm_ops->open (tmp); - file = tmp->vm_file;if (file) {struct address_space *mapping = file->f_mapping;
@@ -687,6 +678,12 @@ static __latent_entropy int dup_mmap(stri_mmap_unlock_write (mapping); } +/* +* Copy/update hugetlb private vma information. +*/ +if (is_vm_hugetlb_page (tmp)) +hugetlb_dup_vma_private (tmp); +/* Link the vma into the MT */ mas.index = tmp->vm_start; mas.last = tmp->vm_end -1 ;
@@ -698,6 +695,9 @@ static __latent_entropy int dup_mmap(strif (!(tmp->vm_flags &VM_WIPEONFORK )) retval =copy_page_range (tmp, mpnt); +if (tmp->vm_ops && tmp->vm_ops->open) + tmp->vm_ops->open (tmp); +if (retval) goto loop_out; }
Greg Kroah-Hartman
maintainerPATCH 206/217 remoteproc: k3-r5: Jump to error handling labels in start/stop errors
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Beleswar Padhi <[email protected]>
commit 1dc7242f6ee0c99852cb90676d7fe201cf5de422 upstream.
In case of errors during core start operation from sysfs, the driver directly returns with the -EPERM error code. Fix this to ensure that mailbox channels are freed on error before returning by jumping to the 'put_mbox' error handling label. Similarly, jump to the 'out' error handling label to return with required -EPERM error code during the core stop operation from sysfs.
--- drivers/remoteproc/ti_k3_r5_remoteproc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/remoteproc/ti_k3_r5_remoteproc.c +4 -2
@@ -575,7 +575,8 @@ static int k3_r5_rproc_start(struct rproif (core != core0 && core0->rproc->state ==RPROC_OFFLINE ) {dev_err (dev,"%s: can not start core 1 before core 0\n" , __func__); -return -EPERM ; + ret = -EPERM ; + goto put_mbox; } ret =k3_r5_core_run (core);
@@ -643,7 +644,8 @@ static int k3_r5_rproc_stop(struct rprocif (core != core1 && core1->rproc->state !=RPROC_OFFLINE ) {dev_err (dev,"%s: can not stop core 0 before core 1\n" , __func__); -return -EPERM ; + ret = -EPERM ; + goto out; } ret =k3_r5_core_halt (core);
Greg Kroah-Hartman
maintainerPATCH 207/217 cachefiles, erofs: Fix NULL deref in when cachefiles is not doing ondemand-mode
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
commit c3d6569a43322f371e7ba0ad386112723757ac8f upstream.
cachefiles_ondemand_init_object() as called from cachefiles_open_file() and cachefiles_create_tmpfile() does not check if object->ondemand is set before dereferencing it, leading to an oops something like:
RIP: 0010:cachefiles_ondemand_init_object+0x9/0x41 ... Call Trace: <TASK> cachefiles_open_file+0xc9/0x187 cachefiles_lookup_cookie+0x122/0x2be fscache_cookie_state_machine+0xbe/0x32b fscache_cookie_worker+0x1f/0x2d process_one_work+0x136/0x208 process_scheduled_works+0x3a/0x41 worker_thread+0x1a2/0x1f6 kthread+0xca/0xd2 ret_from_fork+0x21/0x33
Fix this by making cachefiles_ondemand_init_object() return immediately if cachefiles->ondemand is NULL.
--- fs/cachefiles/ondemand.c | 3 +++ 1 file changed, 3 insertions(+)
fs/cachefiles/ondemand.c +3 -0
@@ -611,6 +611,9 @@ int cachefiles_ondemand_init_object(strustruct fscache_volume *volume = object->volume->vcookie;size_t volume_key_size, cookie_key_size, data_len; +if (!object->ondemand) +return 0 ; +/* * CacheFiles will firstly check the cache file under the root cache * directory. If the coherency check failed, it will fallback to
Greg Kroah-Hartman
maintainerPATCH 208/217 Bluetooth: qca: fix wcn3991 device address check
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 66c39332d02d65e311ec89b0051130bfcd00c9ac upstream.
Qualcomm Bluetooth controllers may not have been provisioned with a valid device address and instead end up using the default address 00:00:00:00:5a:ad.
This address is now used to determine if a controller has a valid address or if one needs to be provided through devicetree or by user space before the controller can be used.
It turns out that the WCN3991 controllers used in Chromium Trogdor machines use a different default address, 39:98:00:00:5a:ad, which also needs to be marked as invalid so that the correct address is fetched from the devicetree.
Qualcomm has unfortunately not yet provided any answers as to whether the 39:98 encodes a hardware id and if there are other variants of the default address that needs to be handled by the driver.
For now, add the Trogdor WCN3991 default address to the device address check to avoid having these controllers start with the default address instead of their assigned addresses.
--- drivers/bluetooth/btqca.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/bluetooth/btqca.c +4 -1
@@ -16,6 +16,7 @@#define VERSION "0.1"#define QCA_BDADDR_DEFAULT (&(bdaddr_t) {{ 0xad, 0x5a, 0x00, 0x00, 0x00, 0x00 }}) +#define QCA_BDADDR_WCN3991 (&(bdaddr_t) {{ 0xad, 0x5a, 0x00, 0x00, 0x98, 0x39 }})int qca_read_soc_version (struct hci_dev *hdev,struct qca_btsoc_version *ver,enum qca_btsoc_type soc_type)
@@ -708,8 +709,10 @@ static int qca_check_bdaddr(struct hci_d } bda = (struct hci_rp_read_bd_addr *)skb->data; -if (!bacmp (&bda->bdaddr,QCA_BDADDR_DEFAULT )) +if (!bacmp (&bda->bdaddr,QCA_BDADDR_DEFAULT ) || + !bacmp (&bda->bdaddr,QCA_BDADDR_WCN3991 )) {set_bit (HCI_QUIRK_USE_BDADDR_PROPERTY , &hdev->quirks); + }kfree_skb (skb);
Greg Kroah-Hartman
maintainerPATCH 209/217 Bluetooth: qca: generalise device address check
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit dd336649ba89789c845618dcbc09867010aec673 upstream.
The default device address apparently comes from the NVM configuration file and can differ quite a bit between controllers.
Store the default address when parsing the configuration file and use it to determine whether the controller has been provisioned with an address.
This makes sure that devices without a unique address start as unconfigured unless a valid address has been provided in the devicetree.
--- drivers/bluetooth/btqca.c | 21 ++++++++++++--------- drivers/bluetooth/btqca.h | 2 ++ 2 files changed, 14 insertions(+), 9 deletions(-)
drivers/bluetooth/btqca.c +12 -9
@@ -15,9 +15,6 @@#define VERSION "0.1" -#define QCA_BDADDR_DEFAULT (&(bdaddr_t) {{ 0xad, 0x5a, 0x00, 0x00, 0x00, 0x00 }}) -#define QCA_BDADDR_WCN3991 (&(bdaddr_t) {{ 0xad, 0x5a, 0x00, 0x00, 0x98, 0x39 }}) -int qca_read_soc_version (struct hci_dev *hdev,struct qca_btsoc_version *ver,enum qca_btsoc_type soc_type) {
@@ -411,6 +408,14 @@ static int qca_tlv_check_data(struct hci/* Update NVM tags as needed */ switch (tag_id) { +case EDL_TAG_ID_BD_ADDR : +if (tag_len !=sizeof (bdaddr_t)) +return -EINVAL ; + +memcpy (&config->bdaddr, tlv_nvm->data,sizeof (bdaddr_t)); + +break ; +case EDL_TAG_ID_HCI :if (tag_len <3 )return -EINVAL ;
@@ -685,7 +690,7 @@ int qca_set_bdaddr_rome(struct hci_dev * }EXPORT_SYMBOL_GPL (qca_set_bdaddr_rome); -static int qca_check_bdaddr (struct hci_dev *hdev) +static int qca_check_bdaddr (struct hci_dev *hdev,const struct qca_fw_config *config) {struct hci_rp_read_bd_addr *bda;struct sk_buff *skb;
@@ -709,10 +714,8 @@ static int qca_check_bdaddr(struct hci_d } bda = (struct hci_rp_read_bd_addr *)skb->data; -if (!bacmp (&bda->bdaddr,QCA_BDADDR_DEFAULT ) || - !bacmp (&bda->bdaddr,QCA_BDADDR_WCN3991 )) { +if (!bacmp (&bda->bdaddr, &config->bdaddr))set_bit (HCI_QUIRK_USE_BDADDR_PROPERTY , &hdev->quirks); - }kfree_skb (skb);
@@ -740,7 +743,7 @@ int qca_uart_setup(struct hci_dev *hdev, enum qca_btsoc_type soc_type, struct qca_btsoc_version ver, const char *firmware_name) { - struct qca_fw_config config; + struct qca_fw_config config = {};int err;u8 rom_ver =0 ;u32 soc_ver;
@@ -925,7 +928,7 @@ int qca_uart_setup(struct hci_dev *hdev,break ; } - err =qca_check_bdaddr (hdev); + err =qca_check_bdaddr (hdev, &config);if (err)return err;
drivers/bluetooth/btqca.h +2 -0
@@ -29,6 +29,7 @@#define EDL_PATCH_CONFIG_RES_EVT (0x00)#define QCA_DISABLE_LOGGING_SUB_OP (0x14) +#define EDL_TAG_ID_BD_ADDR 2#define EDL_TAG_ID_HCI (17)#define EDL_TAG_ID_DEEP_SLEEP (27)
@@ -93,6 +94,7 @@ struct qca_fw_config {uint8_t user_baud_rate;enum qca_tlv_dnld_mode dnld_mode;enum qca_tlv_dnld_mode dnld_type; +bdaddr_t bdaddr; };struct edl_event_hdr {
Greg Kroah-Hartman
maintainerPATCH 210/217 greybus: Fix use-after-free bug in gb_interface_release due to race condition.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sicong Huang <[email protected]>
commit 5c9c5d7f26acc2c669c1dcf57d1bb43ee99220ce upstream.
In gb_interface_create, &intf->mode_switch_completion is bound with gb_interface_mode_switch_work. Then it will be started by gb_interface_request_mode_switch. Here is the relevant code.
if (!queue_work(system_long_wq, &intf->mode_switch_work)) {
...
}If we call gb_interface_release to make cleanup, there may be an unfinished work. This function will call kfree to free the object "intf". However, if gb_interface_mode_switch_work is scheduled to run after kfree, it may cause use-after-free error as gb_interface_mode_switch_work will use the object "intf". The possible execution flow that may lead to the issue is as follows:
CPU0 CPU1
| gb_interface_create
| gb_interface_request_mode_switch
gb_interface_release |
kfree(intf) (free) |
| gb_interface_mode_switch_work
| mutex_lock(&intf->mutex) (use)Fix it by canceling the work before kfree.
--- drivers/greybus/interface.c | 1 + 1 file changed, 1 insertion(+)
drivers/greybus/interface.c +1 -0
@@ -694,6 +694,7 @@ static void gb_interface_release(structtrace_gb_interface_release (intf); +cancel_work_sync (&intf->mode_switch_work);kfree (intf); }
Greg Kroah-Hartman
maintainerPATCH 211/217 serial: 8250_dw: fall back to poll if theres no interrupt
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jisheng Zhang <[email protected]>
[ Upstream commit 22130dae0533c474e4e0db930a88caa9b397d083 ]
When there's no irq(this can be due to various reasons, for example, no irq from HW support, or we just want to use poll solution, and so on), falling back to poll is still better than no support at all.
Stable-dep-of: 87d80bfbd577 ("serial: 8250_dw: Don't use struct dw8250_data outside of 8250_dw")
--- drivers/tty/serial/8250/8250_dw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250_dw.c +4 -1
@@ -523,7 +523,10 @@ static int dw8250_probe(struct platform_device *pdev)if (!regs)return dev_err_probe (dev, -EINVAL ,"no registers defined\n" ); - irq =platform_get_irq (pdev,0 ); + irq =platform_get_irq_optional (pdev,0 ); +/* no interrupt -> fall back to polling */ +if (irq == -ENXIO ) + irq =0 ;if (irq <0 )return irq;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 212/217 serial: core: Add UPIO_UNKNOWN constant for unknown port type
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 79d713baf63c8f23cc58b304c40be33d64a12aaf ]
In some APIs we would like to assign the special value to iotype and compare against it in another places. Introduce UPIO_UNKNOWN for this purpose.
Note, we can't use 0, because it's a valid value for IO port access.
Stable-dep-of: 87d80bfbd577 ("serial: 8250_dw: Don't use struct dw8250_data outside of 8250_dw")
--- include/linux/serial_core.h | 1 + 1 file changed, 1 insertion(+)
include/linux/serial_core.h +1 -0
@@ -467,6 +467,7 @@ struct uart_port {unsigned char iotype;/* io access style */ unsigned char quirks;/* internal quirks */ +#define UPIO_UNKNOWN ((unsigned char)~0U)/* UCHAR_MAX */ #define UPIO_PORT (SERIAL_IO_PORT)/* 8b I/O port access */ #define UPIO_HUB6 (SERIAL_IO_HUB6)/* Hub6 ISA card */ #define UPIO_MEM (SERIAL_IO_MEM)/* driver-specific */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 213/217 usb-storage: alauda: Check whether the media is initialized
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shichao Lai <[email protected]>
[ Upstream commit 16637fea001ab3c8df528a8995b3211906165a30 ]
The member "uzonesize" of struct alauda_info will remain 0 if alauda_init_media() fails, potentially causing divide errors in alauda_read_data() and alauda_write_lba().
- Add a member "media_initialized" to struct alauda_info.
- Change a condition in alauda_check_media() to ensure the first initialization.
- Add an error check for the return value of alauda_init_media().
--- drivers/usb/storage/alauda.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/usb/storage/alauda.c +6 -3
@@ -105,6 +105,8 @@ struct alauda_info {unsigned char sense_key;unsigned long sense_asc;/* additional sense code */ unsigned long sense_ascq;/* additional sense code qualifier */ + +bool media_initialized; };#define short_pack (lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) )
@@ -476,11 +478,12 @@ static int alauda_check_media(struct us_data *us) }/* Check for media change */ -if (status[0 ] &0x08 ) { +if (status[0 ] &0x08 || !info->media_initialized) {usb_stor_dbg (us,"Media change detected\n" );alauda_free_maps (&MEDIA_INFO (us)); -alauda_init_media (us); - + rc =alauda_init_media (us); +if (rc ==USB_STOR_TRANSPORT_GOOD ) + info->media_initialized = true; info->sense_key =UNIT_ATTENTION ; info->sense_asc =0x28 ; info->sense_ascq =0x00 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 214/217 misc: microchip: pci1xxxx: Fix a memory leak in the error handling of gp_aux_bus_probe()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yongzhi Liu <[email protected]>
[ Upstream commit 77427e3d5c353e3dd98c7c0af322f8d9e3131ace ]
There is a memory leak (forget to free allocated buffers) in a memory allocation failure path.
Fix it to jump to the correct error handling code.
--- drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.c +4 -2
@@ -69,8 +69,10 @@ static int gp_aux_bus_probe(struct pci_dev *pdev, const struct pci_device_id *id aux_bus->aux_device_wrapper[1 ] =kzalloc (sizeof (*aux_bus->aux_device_wrapper[1 ]),GFP_KERNEL ); -if (!aux_bus->aux_device_wrapper[1 ]) -return -ENOMEM ; +if (!aux_bus->aux_device_wrapper[1 ]) { + retval = -ENOMEM ; + goto err_aux_dev_add_0; + } retval =ida_alloc (&gp_client_ida,GFP_KERNEL );if (retval <0 )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 215/217 i2c: at91: Fix the functionality flags of the slave-only interface
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean Delvare <[email protected]>
[ Upstream commit d6d5645e5fc1233a7ba950de4a72981c394a2557 ]
When an I2C adapter acts only as a slave, it should not claim to support I2C master capabilities.
--- drivers/i2c/busses/i2c-at91-slave.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/i2c/busses/i2c-at91-slave.c +1 -2
@@ -106,8 +106,7 @@ static int at91_unreg_slave(struct i2c_client *slave)static u32 at91_twi_func (struct i2c_adapter *adapter) { -return I2C_FUNC_SLAVE |I2C_FUNC_I2C |I2C_FUNC_SMBUS_EMUL - |I2C_FUNC_SMBUS_READ_BLOCK_DATA ; +return I2C_FUNC_SLAVE ; }static const struct i2c_algorithm at91_twi_algorithm_slave = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 216/217 i2c: designware: Fix the functionality flags of the slave-only interface
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean Delvare <[email protected]>
[ Upstream commit cbf3fb5b29e99e3689d63a88c3cddbffa1b8de99 ]
When an I2C adapter acts only as a slave, it should not claim to support I2C master capabilities.
--- drivers/i2c/busses/i2c-designware-slave.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-designware-slave.c +1 -1
@@ -232,7 +232,7 @@ static const struct i2c_algorithm i2c_dw_algo = {void i2c_dw_configure_slave (struct dw_i2c_dev *dev) { - dev->functionality =I2C_FUNC_SLAVE |DW_IC_DEFAULT_FUNCTIONALITY ; + dev->functionality =I2C_FUNC_SLAVE ; dev->slave_cfg =DW_IC_CON_RX_FIFO_FULL_HLD_CTRL |DW_IC_CON_RESTART_EN |DW_IC_CON_STOP_DET_IFADDRESSED ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 217/217 zap_pid_ns_processes: clear TIF_NOTIFY_SIGNAL along with TIF_SIGPENDING
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
[ Upstream commit 7fea700e04bd3f424c2d836e98425782f97b494e ]
kernel_wait4() doesn't sleep and returns -EINTR if there is no eligible child and signal_pending() is true.
That is why zap_pid_ns_processes() clears TIF_SIGPENDING but this is not enough, it should also clear TIF_NOTIFY_SIGNAL to make signal_pending() return false and avoid a busy-wait loop.
--- kernel/pid_namespace.c | 1 + 1 file changed, 1 insertion(+)
kernel/pid_namespace.c +1 -0
@@ -214,6 +214,7 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)*/ do {clear_thread_flag (TIF_SIGPENDING ); +clear_thread_flag (TIF_NOTIFY_SIGNAL ); rc =kernel_wait4 (-1 ,NULL , __WALL,NULL ); }while (rc != -ECHILD );
Signature · 1 line
2.43.0
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.95 release. There are 217 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 Fri, 21 Jun 2024 12:55:11 +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/v6.x/stable-review/patch-6.1.95-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Hello,
Quoted 5 lines · On Wed, 19 Jun 2024 14:54:03 +0200 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.1.95 release. There are 217 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 8 lines
Responses should be made by Fri, 21 Jun 2024 12:55:11 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.95-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.
This rc kernel passes DAMON functionality test[1] on my test machine. Attaching the test results summary below. Please note that I retrieved the kernel from linux-stable-rc tree[2].
[1] https://github.com/awslabs/damon-tests/tree/next/corr
[2] 7035314997c8 ("Linux 6.1.95-rc1")
Thanks,
SJ
[...]
---
ok 1 selftests: damon: debugfs_attrs.sh
ok 2 selftests: damon: debugfs_schemes.sh
ok 3 selftests: damon: debugfs_target_ids.sh
ok 4 selftests: damon: debugfs_empty_targets.sh
ok 5 selftests: damon: debugfs_huge_count_read_write.sh
ok 6 selftests: damon: debugfs_duplicate_context_creation.sh
ok 7 selftests: damon: sysfs.sh
ok 1 selftests: damon-tests: kunit.sh
ok 2 selftests: damon-tests: huge_count_read_write.sh
ok 3 selftests: damon-tests: buffer_overflow.sh
ok 4 selftests: damon-tests: rm_contexts.sh
ok 5 selftests: damon-tests: record_null_deref.sh
ok 6 selftests: damon-tests: dbgfs_target_ids_read_before_terminate_race.sh ok 7 selftests: damon-tests: dbgfs_target_ids_pid_leak.sh
ok 8 selftests: damon-tests: damo_tests.sh
ok 9 selftests: damon-tests: masim-record.sh
ok 10 selftests: damon-tests: build_i386.sh
ok 11 selftests: damon-tests: build_arm64.sh
ok 12 selftests: damon-tests: build_m68k.sh
ok 13 selftests: damon-tests: build_i386_idle_flag.sh
ok 14 selftests: damon-tests: build_i386_highpte.sh
ok 15 selftests: damon-tests: build_nomemcg.sh
[33m
[92mPASS [39m
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.95 release. There are 217 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 Fri, 21 Jun 2024 12:55:11 +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/v6.x/stable-review/patch-6.1.95-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v6.1:
10 builds: 10 pass, 0 fail
26 boots: 26 pass, 0 fail
116 tests: 116 pass, 0 failLinux version: 6.1.95-rc1-g0891d95b9db3
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
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 6.1.95 release. There are 217 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.
CIP testing did not find any problems here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-6.1.y
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Quoted 9 lines
This is the start of the stable review cycle for the 6.1.95 release. There are 217 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 Fri, 21 Jun 2024 12:55:11 +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/v6.x/stable-review/patch-6.1.95-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my x86_64 and ARM64 test systems. No errors or regressions.
Thanks.
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.95 release. There are 217 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 Fri, 21 Jun 2024 12:55:11 +0000. Anything received after that time might be too late.
No regressions found on WSL (x86 and arm64).
Built, booted, and reviewed dmesg.
Thank you. :)
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.95 release. There are 217 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.95 release. There are 217 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 Fri, 21 Jun 2024 12:55:11 +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/v6.x/stable-review/patch-6.1.95-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.95 release. There are 217 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 Fri, 21 Jun 2024 12:55:11 +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/v6.x/stable-review/patch-6.1.95-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.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: 6.1.95-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-6.1.y
* git commit: 0891d95b9db39ae51c0edef73f56d41521be9fbd
* git describe: v6.1.94-218-g0891d95b9db3
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.1.y/build/v6.1.94-218-g0891d95b9db3
## Test Regressions (compared to v6.1.94)
## Metric Regressions (compared to v6.1.94)
## Test Fixes (compared to v6.1.94)
## Metric Fixes (compared to v6.1.94)
## Test result summary
total: 171975, pass: 145682, fail: 3002, skip: 23038, xfail: 253
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 135 total, 135 passed, 0 failed
* arm64: 38 total, 38 passed, 0 failed
* i386: 29 total, 29 passed, 0 failed
* mips: 24 total, 24 passed, 0 failed
* parisc: 3 total, 3 passed, 0 failed
* powerpc: 33 total, 33 passed, 0 failed
* riscv: 9 total, 9 passed, 0 failed
* s390: 12 total, 12 passed, 0 failed
* sh: 10 total, 10 passed, 0 failed
* sparc: 6 total, 6 passed, 0 failed
* x86_64: 33 total, 33 passed, 0 failed
## Test suites summary
* boot
* kselftest-android
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers-dma-buf
* kselftest-efivarfs
* kselftest-exec
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-filesystems-epoll
* kselftest-firmware
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mm
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-net-forwarding
* kselftest-net-mptcp
* 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-user_events
* kselftest-vDSO
* kselftest-watchdog
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libgpiod
* log-parser-boot
* log-parser-test
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-hugetlb
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-smoke
* ltp-smoketest
* ltp-syscalls
* ltp-tracing
* perf
* rcutorture
--
Linaro LKFT
https://lkft.linaro.org
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.95 release. There are 217 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 Fri, 21 Jun 2024 12:55:11 +0000. Anything received after that time might be too late.
Works fine for me on x86_64.
Cheers,
Sven
Am 19.06.2024 um 14:54 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.1.95 release. There are 217 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.
Built and booted successfully, I don't see any regressions nor any scary or suspicious dmesg outout, running for an hour now. Built on dual socket Ivy Bridge Xeon E5-2697 v2.
Still no goal in Spain vs Italy... 🙄
Beste Grüße,
Peter Schneider
Signature · 8 lines
Climb the mountain not to plant your flag, but to embrace the challenge, enjoy the air and behold the view. Climb it so you can see the world, not so the world can see you. -- David McCullough Jr. OpenPGP: 0xA3828BD796CCE11A8CADE8866E3A92C92C3FF244 Download: https://www.peters-netzplatz.de/download/pschneider1968_pub.asc https://keys.mailvelope.com/pks/lookup?op=get&[email protected] https://keys.mailvelope.com/pks/lookup?op=get&[email protected]
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.95 release. There are 217 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 Fri, 21 Jun 2024 12:55:11 +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/v6.x/stable-review/patch-6.1.95-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Re: [PATCH 6.1 000/217] 6.1.95-rc1 review [parisc64/C3700 boot failures]
In reply to Greg Kroah-Hartman[ Copying parisc maintainers - maybe they can test on real hardware ]
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.95 release. There are 217 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 Fri, 21 Jun 2024 12:55:11 +0000. Anything received after that time might be too late.
...
Quoted 3 lines
Oleg Nesterov <[email protected]>
zap_pid_ns_processes: clearTIF_NOTIFY_SIGNALalong withTIF_SIGPENDING
I can not explain it, but this patch causes all my parisc64 (C3700) boot tests to crash. There are lots of memory corruption BUGs such as
[ 0.000000] ============================================================================= [ 0.000000] BUG kmalloc-96 (Not tainted): Padding overwritten. 0x0000000043411dd0-0x0000000043411f5f @offset=3536
ultimately followed by
[ 0.462562] Unaligned handler failed, ret = -14 ... [ 0.469160] IAOQ[0]: idr_alloc_cyclic+0x48/0x118 [ 0.469372] IAOQ[1]: idr_alloc_cyclic+0x54/0x118 [ 0.469548] RP(r2): __kernfs_new_node.constprop.0+0x160/0x420 [ 0.469782] Backtrace: [ 0.469928] [<00000000404af108>] __kernfs_new_node.constprop.0+0x160/0x420 [ 0.470285] [<00000000404b0cac>] kernfs_new_node+0xbc/0x118 [ 0.470523] [<00000000404b158c>] kernfs_create_empty_dir+0x54/0xf0 [ 0.470756] [<00000000404b665c>] sysfs_create_mount_point+0x4c/0xb0 [ 0.470996] [<00000000401181cc>] cgroup_init+0x5b4/0x738 [ 0.471213] [<0000000040102220>] start_kernel+0x1238/0x1308 [ 0.471429] [<0000000040107c90>] start_parisc+0x188/0x1d0 ... [ 0.474956] Kernel panic - not syncing: Attempted to kill the idle task!
SeaBIOS wants SYSTEM RESET.
This is with qemu v9.0.1.
Reverting this patch fixes the problem (I tried several times to be sure since I don't see the connection). I don't see the problem in any other branch. Bisect log is attached for reference.
Guenter
---
# bad: [a6398e37309000e35cedb5cc328a0f8d00d7d7b9] Linux 6.1.95
# good: [eb44d83053d66372327e69145e8d2fa7400a4991] Linux 6.1.94
git bisect start 'HEAD' 'v6.1.94'
# good: [f17443d52d805c9a7fab5e67a4e8b973626fe1cd] cachefiles: resend an open request if the read request's object is closed git bisect good f17443d52d805c9a7fab5e67a4e8b973626fe1cd
# good: [cc09e1d3519feab823685f4297853d468f44549d] iio: imu: inv_icm42600: delete unneeded update watermark call
git bisect good cc09e1d3519feab823685f4297853d468f44549d
# good: [b7b6bc60edb2132a569899bcd9ca099a0556c6ee] intel_th: pci: Add Granite Rapids SOC support
git bisect good b7b6bc60edb2132a569899bcd9ca099a0556c6ee
# good: [35e395373ecd14b64da7d54f565927a9368dcf20] mptcp: pm: update add_addr counters after connect
git bisect good 35e395373ecd14b64da7d54f565927a9368dcf20
# good: [29d35f0b53d4bd82ebc37c500a8dd73da61318ff] serial: 8250_dw: fall back to poll if there's no interrupt
git bisect good 29d35f0b53d4bd82ebc37c500a8dd73da61318ff
# good: [ea25a4c0de5700928c7fd0aa789eee39a457ba95] misc: microchip: pci1xxxx: Fix a memory leak in the error handling of gp_aux_bus_probe() git bisect good ea25a4c0de5700928c7fd0aa789eee39a457ba95
# good: [e44999ec0b49dca9a9a2090c5432d893ea4f8d20] i2c: designware: Fix the functionality flags of the slave-only interface git bisect good e44999ec0b49dca9a9a2090c5432d893ea4f8d20
# bad: [edd2754a62bee8d97b4808a15de024f66a1ddccf] zap_pid_ns_processes: clear TIF_NOTIFY_SIGNAL along with TIF_SIGPENDING git bisect bad edd2754a62bee8d97b4808a15de024f66a1ddccf
# first bad commit: [edd2754a62bee8d97b4808a15de024f66a1ddccf] zap_pid_ns_processes: clear TIF_NOTIFY_SIGNAL along with TIF_SIGPENDING
Re: [PATCH 6.1 000/217] 6.1.95-rc1 review [parisc64/C3700 boot failures]
Quoted 41 lines · Guenter Roeck
[ Copying parisc maintainers - maybe they can test on real hardware ]
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.95 release. There are 217 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 Fri, 21 Jun 2024 12:55:11 +0000. Anything received after that time might be too late.
...
Quoted 3 lines
Oleg Nesterov <[email protected]>
zap_pid_ns_processes: clearTIF_NOTIFY_SIGNALalong withTIF_SIGPENDINGI can not explain it, but this patch causes all my parisc64 (C3700) boot tests to crash. There are lots of memory corruption BUGs such as
[ 0.000000] =============================================================================
[ 0.000000] BUG kmalloc-96 (Not tainted): Padding overwritten. 0x0000000043411dd0-0x0000000043411f5f @offset=3536ultimately followed by
[ 0.462562] Unaligned handler failed, ret = -14
...
[ 0.469160] IAOQ[0]:idr_alloc_cyclic+0x48/0x118
[ 0.469372] IAOQ[1]:idr_alloc_cyclic+0x54/0x118
[ 0.469548] RP(r2): __kernfs_new_node.constprop.0+0x160/0x420 [ 0.469782] Backtrace:
[ 0.469928] [<00000000404af108>] __kernfs_new_node.constprop.0+0x160/0x420 [ 0.470285] [<00000000404b0cac>]kernfs_new_node+0xbc/0x118
[ 0.470523] [<00000000404b158c>]kernfs_create_empty_dir+0x54/0xf0[ 0.470756] [<00000000404b665c>]sysfs_create_mount_point+0x4c/0xb0[ 0.470996] [<00000000401181cc>]cgroup_init+0x5b4/0x738
[ 0.471213] [<0000000040102220>]start_kernel+0x1238/0x1308
[ 0.471429] [<0000000040107c90>]start_parisc+0x188/0x1d0
...
[ 0.474956] Kernel panic - not syncing: Attempted to kill the idle task! SeaBIOS wants SYSTEM RESET.
Quoted 1 line
This is with qemu v9.0.1.
Just to be sure, did you tested the same kernel on physical hardware as well?
Please note, that 64-bit hppa (C3700) support in qemu was just recently added and is still considered experimental.
So, maybe it's not a bug in the source, but in qemu...?!?
Quoted 29 lines
Reverting this patch fixes the problem (I tried several times to be sure since I don't see the connection). I don't see the problem in any other branch. Bisect log is attached for reference.
Guenter
---
# bad: [a6398e37309000e35cedb5cc328a0f8d00d7d7b9] Linux 6.1.95
# good: [eb44d83053d66372327e69145e8d2fa7400a4991] Linux 6.1.94
git bisect start 'HEAD' 'v6.1.94'
# good: [f17443d52d805c9a7fab5e67a4e8b973626fe1cd] cachefiles: resend an open request if the read request's object is closed git bisect goodf17443d52d805c9a7fab5e67a4e8b973626fe1cd
# good: [cc09e1d3519feab823685f4297853d468f44549d] iio: imu:inv_icm42600: delete unneeded update watermark call
git bisect goodcc09e1d3519feab823685f4297853d468f44549d
# good: [b7b6bc60edb2132a569899bcd9ca099a0556c6ee]intel_th: pci: Add Granite Rapids SOC support
git bisect goodb7b6bc60edb2132a569899bcd9ca099a0556c6ee
# good: [35e395373ecd14b64da7d54f565927a9368dcf20] mptcp: pm: updateadd_addrcounters after connect
git bisect good35e395373ecd14b64da7d54f565927a9368dcf20
# good: [29d35f0b53d4bd82ebc37c500a8dd73da61318ff] serial: 8250_dw: fall back to poll if there's no interrupt
git bisect good29d35f0b53d4bd82ebc37c500a8dd73da61318ff
# good: [ea25a4c0de5700928c7fd0aa789eee39a457ba95] misc: microchip: pci1xxxx: Fix a memory leak in the error handling ofgp_aux_bus_probe()git bisect goodea25a4c0de5700928c7fd0aa789eee39a457ba95
# good: [e44999ec0b49dca9a9a2090c5432d893ea4f8d20] i2c: designware: Fix the functionality flags of the slave-only interface git bisect goode44999ec0b49dca9a9a2090c5432d893ea4f8d20
# bad: [edd2754a62bee8d97b4808a15de024f66a1ddccf]zap_pid_ns_processes: clearTIF_NOTIFY_SIGNALalong withTIF_SIGPENDINGgit bisect badedd2754a62bee8d97b4808a15de024f66a1ddccf# first bad commit: [edd2754a62bee8d97b4808a15de024f66a1ddccf] zap_pid_ns_processes: clear TIF_NOTIFY_SIGNAL along with TIF_SIGPENDING
Re: [PATCH 6.1 000/217] 6.1.95-rc1 review [parisc64/C3700 boot failures]
Quoted 42 lines · Helge Deller
Quoted 41 lines · Guenter Roeck
[ Copying parisc maintainers - maybe they can test on real hardware ]
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.95 release. There are 217 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 Fri, 21 Jun 2024 12:55:11 +0000. Anything received after that time might be too late.
...
Quoted 3 lines
Oleg Nesterov <[email protected]>
zap_pid_ns_processes: clearTIF_NOTIFY_SIGNALalong withTIF_SIGPENDINGI can not explain it, but this patch causes all my parisc64 (C3700) boot tests to crash. There are lots of memory corruption BUGs such as
[ 0.000000] =============================================================================
[ 0.000000] BUG kmalloc-96 (Not tainted): Padding overwritten. 0x0000000043411dd0-0x0000000043411f5f @offset=3536ultimately followed by
[ 0.462562] Unaligned handler failed, ret = -14
...
[ 0.469160] IAOQ[0]:idr_alloc_cyclic+0x48/0x118
[ 0.469372] IAOQ[1]:idr_alloc_cyclic+0x54/0x118
[ 0.469548] RP(r2): __kernfs_new_node.constprop.0+0x160/0x420 [ 0.469782] Backtrace:
[ 0.469928] [<00000000404af108>] __kernfs_new_node.constprop.0+0x160/0x420 [ 0.470285] [<00000000404b0cac>]kernfs_new_node+0xbc/0x118
[ 0.470523] [<00000000404b158c>]kernfs_create_empty_dir+0x54/0xf0[ 0.470756] [<00000000404b665c>]sysfs_create_mount_point+0x4c/0xb0[ 0.470996] [<00000000401181cc>]cgroup_init+0x5b4/0x738
[ 0.471213] [<0000000040102220>]start_kernel+0x1238/0x1308
[ 0.471429] [<0000000040107c90>]start_parisc+0x188/0x1d0
...
[ 0.474956] Kernel panic - not syncing: Attempted to kill the idle task! SeaBIOS wants SYSTEM RESET.
Quoted 4 lines
Quoted 1 line
This is with qemu v9.0.1.
Just to be sure, did you tested the same kernel on physical hardware as well?
No, I don't have hardware. I only have qemu. That is why I copied you and the parisc mailing list. I would hope that someone can either confirm that this is a real problem or that it is qemu related. If it is qemu related, I'll just stop testing c3700 64-bit support with qemu on v6.1.y and other branches if/when the problem shows up there as well.
Quoted 4 lines
Please note, that 64-bit hppa (C3700) support in qemu was just recently added and is still considered experimental.
So, maybe it's not a bug in the source, but in qemu...?!?
Sure, that is possible, though it is a bit unusual that it is only seen in 6.1.95 and not in any other branches or releases.
In summary, please see this report as "This is a problem seen in qemu. It may or may not be seen on real hardware". Maybe I should add this as a common disclaimer to all my reports to avoid misunderstandings.
Thanks,
Guenter
Re: [PATCH 6.1 000/217] 6.1.95-rc1 review [parisc64/C3700 boot failures]
Quoted 43 lines · Guenter Roeck
Quoted 42 lines · Helge Deller
Quoted 41 lines · Guenter Roeck
[ Copying parisc maintainers - maybe they can test on real hardware ]
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.95 release. There are 217 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 Fri, 21 Jun 2024 12:55:11 +0000. Anything received after that time might be too late.
...
Quoted 3 lines
Oleg Nesterov <[email protected]>
zap_pid_ns_processes: clearTIF_NOTIFY_SIGNALalong withTIF_SIGPENDINGI can not explain it, but this patch causes all my parisc64 (C3700) boot tests to crash. There are lots of memory corruption BUGs such as
[ 0.000000] =============================================================================
[ 0.000000] BUG kmalloc-96 (Not tainted): Padding overwritten. 0x0000000043411dd0-0x0000000043411f5f @offset=3536ultimately followed by
[ 0.462562] Unaligned handler failed, ret = -14
...
[ 0.469160] IAOQ[0]:idr_alloc_cyclic+0x48/0x118
[ 0.469372] IAOQ[1]:idr_alloc_cyclic+0x54/0x118
[ 0.469548] RP(r2): __kernfs_new_node.constprop.0+0x160/0x420 [ 0.469782] Backtrace:
[ 0.469928] [<00000000404af108>] __kernfs_new_node.constprop.0+0x160/0x420 [ 0.470285] [<00000000404b0cac>]kernfs_new_node+0xbc/0x118
[ 0.470523] [<00000000404b158c>]kernfs_create_empty_dir+0x54/0xf0[ 0.470756] [<00000000404b665c>]sysfs_create_mount_point+0x4c/0xb0[ 0.470996] [<00000000401181cc>]cgroup_init+0x5b4/0x738
[ 0.471213] [<0000000040102220>]start_kernel+0x1238/0x1308
[ 0.471429] [<0000000040107c90>]start_parisc+0x188/0x1d0
...
[ 0.474956] Kernel panic - not syncing: Attempted to kill the idle task! SeaBIOS wants SYSTEM RESET.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
This is with qemu v9.0.1.
Just to be sure, did you tested the same kernel on physical hardware as well?
No, I don't have hardware. I only have qemu. That is why I copied you and the parisc mailing list.
Yes, sorry, I saw your top line in the mail after I already sent my reply....
Quoted 4 lines
I would hope that someone can either confirm that
this is a real problem or that it is qemu related. If it is qemu related, I'll just stop testing c3700 64-bit support with qemu on v6.1.y and other branches if/when the problem shows up there as well.
I just booted 6.1.95 successfully in qemu and on my physical C3700 machine. I assume the problem can be reproduced with your .config ? Please send it to me off-list, then I can try again.
I know there are still some issues with the 64-bit hppa emulation in qemu, which are quite hard for me to trigger and to find the cause. So, maybe you now found one easier-to-trigger reproducer? :-)
Helge
Quoted 15 lines
Quoted 4 lines
Please note, that 64-bit hppa (C3700) support in qemu was just recently added and is still considered experimental.
So, maybe it's not a bug in the source, but in qemu...?!?Sure, that is possible, though it is a bit unusual that it is only seen in 6.1.95 and not in any other branches or releases.
In summary, please see this report as "This is a problem seen in qemu. It may or may not be seen on real hardware". Maybe I should add this as a common disclaimer to all my reports to avoid misunderstandings.
Thanks,
Guenter
Re: [PATCH 6.1 000/217] 6.1.95-rc1 review [parisc64/C3700 boot failures]
Quoted 54 lines · Helge Deller
Quoted 43 lines · Guenter Roeck
Quoted 42 lines · Helge Deller
Quoted 41 lines · Guenter Roeck
[ Copying parisc maintainers - maybe they can test on real hardware ]
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.95 release. There are 217 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 Fri, 21 Jun 2024 12:55:11 +0000. Anything received after that time might be too late.
...
Quoted 3 lines
Oleg Nesterov <[email protected]>
zap_pid_ns_processes: clearTIF_NOTIFY_SIGNALalong withTIF_SIGPENDINGI can not explain it, but this patch causes all my parisc64 (C3700) boot tests to crash. There are lots of memory corruption BUGs such as
[ 0.000000] =============================================================================
[ 0.000000] BUG kmalloc-96 (Not tainted): Padding overwritten. 0x0000000043411dd0-0x0000000043411f5f @offset=3536ultimately followed by
[ 0.462562] Unaligned handler failed, ret = -14
...
[ 0.469160] IAOQ[0]:idr_alloc_cyclic+0x48/0x118
[ 0.469372] IAOQ[1]:idr_alloc_cyclic+0x54/0x118
[ 0.469548] RP(r2): __kernfs_new_node.constprop.0+0x160/0x420 [ 0.469782] Backtrace:
[ 0.469928] [<00000000404af108>] __kernfs_new_node.constprop.0+0x160/0x420 [ 0.470285] [<00000000404b0cac>]kernfs_new_node+0xbc/0x118
[ 0.470523] [<00000000404b158c>]kernfs_create_empty_dir+0x54/0xf0[ 0.470756] [<00000000404b665c>]sysfs_create_mount_point+0x4c/0xb0[ 0.470996] [<00000000401181cc>]cgroup_init+0x5b4/0x738
[ 0.471213] [<0000000040102220>]start_kernel+0x1238/0x1308
[ 0.471429] [<0000000040107c90>]start_parisc+0x188/0x1d0
...
[ 0.474956] Kernel panic - not syncing: Attempted to kill the idle task! SeaBIOS wants SYSTEM RESET.Quoted 7 lines
Quoted 4 lines
Quoted 1 line
This is with qemu v9.0.1.
Just to be sure, did you tested the same kernel on physical hardware as well?
No, I don't have hardware. I only have qemu. That is why I copied you and the parisc mailing list.
Yes, sorry, I saw your top line in the mail after I already sent my reply....
Quoted 9 lines
Quoted 4 lines
I would hope that someone can either confirm that
this is a real problem or that it is qemu related. If it is qemu related, I'll just stop testing c3700 64-bit support with qemu on v6.1.y and other branches if/when the problem shows up there as well.I just booted 6.1.95 successfully in qemu and on my physical C3700 machine. I assume the problem can be reproduced with your .config ? Please send it to me off-list, then I can try again.
Done.
Thanks,
Guenter
Re: [PATCH 6.1 000/217] 6.1.95-rc1 review [parisc64/C3700 boot failures]
In reply to Helge DellerOn 6/22/24 08:49, Helge Deller wrote:
[ ... ]
Quoted 2 lines
I just booted 6.1.95 successfully in qemu and on my physical C3700 machine.
FWIW, I don't see the problem either if I just build and boot generic-64bit_defconfig. Sorry, I didn't really expect this, so I didn't mention that my configuration adds lots of debug and unit test options.
Guenter
Re: [PATCH 6.1 000/217] 6.1.95-rc1 review [parisc64/C3700 boot failures]
In reply to Helge DellerQuoted 42 lines · Helge Deller
Quoted 41 lines · Guenter Roeck
[ Copying parisc maintainers - maybe they can test on real hardware ]
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.95 release. There are 217 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 Fri, 21 Jun 2024 12:55:11 +0000. Anything received after that time might be too late.
...
Quoted 3 lines
Oleg Nesterov <[email protected]>
zap_pid_ns_processes: clearTIF_NOTIFY_SIGNALalong withTIF_SIGPENDINGI can not explain it, but this patch causes all my parisc64 (C3700) boot tests to crash. There are lots of memory corruption BUGs such as
[ 0.000000] =============================================================================
[ 0.000000] BUG kmalloc-96 (Not tainted): Padding overwritten. 0x0000000043411dd0-0x0000000043411f5f @offset=3536ultimately followed by
[ 0.462562] Unaligned handler failed, ret = -14
...
[ 0.469160] IAOQ[0]:idr_alloc_cyclic+0x48/0x118
[ 0.469372] IAOQ[1]:idr_alloc_cyclic+0x54/0x118
[ 0.469548] RP(r2): __kernfs_new_node.constprop.0+0x160/0x420 [ 0.469782] Backtrace:
[ 0.469928] [<00000000404af108>] __kernfs_new_node.constprop.0+0x160/0x420 [ 0.470285] [<00000000404b0cac>]kernfs_new_node+0xbc/0x118
[ 0.470523] [<00000000404b158c>]kernfs_create_empty_dir+0x54/0xf0[ 0.470756] [<00000000404b665c>]sysfs_create_mount_point+0x4c/0xb0[ 0.470996] [<00000000401181cc>]cgroup_init+0x5b4/0x738
[ 0.471213] [<0000000040102220>]start_kernel+0x1238/0x1308
[ 0.471429] [<0000000040107c90>]start_parisc+0x188/0x1d0
...
[ 0.474956] Kernel panic - not syncing: Attempted to kill the idle task! SeaBIOS wants SYSTEM RESET.
Quoted 8 lines
Quoted 1 line
This is with qemu v9.0.1.
Just to be sure, did you tested the same kernel on physical hardware as well?
Please note, that 64-bit hppa (C3700) support in qemu was just recently added and is still considered experimental.
So, maybe it's not a bug in the source, but in qemu...?!?
Following up on this for everyone: Helge doesn't see the problem on real hardware. I can make the problem disappear by any of the following:
- Use gcc 13.3 instead of 12.3
- Disable CONFIG_KUNIT
- Enable CONFIG_PAGE_POISONING (without actually enabling it in the runtime)
Overall, that suggests some kind of heisenbug, most likely in qemu, unrelated to the commit above.
Thanks, and sorry for the noise.
Guenter