6.12.16-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainerPATCH 145/230 serial: 8250: Fix fifo underflow on flush
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Keeping <[email protected]>
commit 9e512eaaf8f4008c44ede3dfc0fbc9d9c5118583 upstream.
When flushing the serial port's buffer, uart_flush_buffer() calls kfifo_reset() but if there is an outstanding DMA transfer then the completion function will consume data from the kfifo via uart_xmit_advance(), underflowing and leading to ongoing DMA as the driver tries to transmit another 2^32 bytes.
This is readily reproduced with serial-generic and amidi sending even short messages as closing the device on exit will wait for the fifo to drain and in the underflow case amidi hangs for 30 seconds on exit in tty_wait_until_sent(). A trace of that gives:
kworker/1:1-84 [001] 51.769423: bprint: serial8250_tx_dma: tx_size=3 fifo_len=3
amidi-763 [001] 51.769460: bprint: uart_flush_buffer: resetting fifo
irq/21-fe530000-76 [000] 51.769474: bprint: __dma_tx_complete: tx_size=3
irq/21-fe530000-76 [000] 51.769479: bprint: serial8250_tx_dma: tx_size=4096 fifo_len=4294967293
irq/21-fe530000-76 [000] 51.781295: bprint: __dma_tx_complete: tx_size=4096
irq/21-fe530000-76 [000] 51.781301: bprint: serial8250_tx_dma: tx_size=4096 fifo_len=4294963197
irq/21-fe530000-76 [000] 51.793131: bprint: __dma_tx_complete: tx_size=4096
irq/21-fe530000-76 [000] 51.793135: bprint: serial8250_tx_dma: tx_size=4096 fifo_len=4294959101
irq/21-fe530000-76 [000] 51.804949: bprint: __dma_tx_complete: tx_size=4096Since the port lock is held in when the kfifo is reset in uart_flush_buffer() and in __dma_tx_complete(), adding a flush_buffer hook to adjust the outstanding DMA byte count is sufficient to avoid the kfifo underflow.
--- drivers/tty/serial/8250/8250.h | 2 ++ drivers/tty/serial/8250/8250_dma.c | 16 ++++++++++++++++ drivers/tty/serial/8250/8250_port.c | 9 +++++++++ 3 files changed, 27 insertions(+)
drivers/tty/serial/8250/8250.h +2 -0
@@ -374,6 +374,7 @@ static inline int is_omap1510_8250(struc#ifdef CONFIG_SERIAL_8250_DMA extern int serial8250_tx_dma (struct uart_8250_port *); +extern void serial8250_tx_dma_flush (struct uart_8250_port *);extern int serial8250_rx_dma (struct uart_8250_port *);extern void serial8250_rx_dma_flush (struct uart_8250_port *);extern int serial8250_request_dma (struct uart_8250_port *);
@@ -406,6 +407,7 @@ static inline int serial8250_tx_dma(stru {return -1 ; } +static inline void serial8250_tx_dma_flush (struct uart_8250_port *p) { }static inline int serial8250_rx_dma (struct uart_8250_port *p) {return -1 ;
drivers/tty/serial/8250/8250_dma.c +16 -0
@@ -149,6 +149,22 @@ err:return ret; } +void serial8250_tx_dma_flush (struct uart_8250_port *p) +{ +struct uart_8250_dma *dma = p->dma; + +if (!dma->tx_running) +return ; + +/* +* kfifo_reset() has been called by the serial core, avoid +* advancing and underflowing in __dma_tx_complete(). +*/ + dma->tx_size =0 ; + +dmaengine_terminate_async (dma->rxchan); +} +int serial8250_rx_dma (struct uart_8250_port *p) {struct uart_8250_dma *dma = p->dma;
drivers/tty/serial/8250/8250_port.c +9 -0
@@ -2524,6 +2524,14 @@ static void serial8250_shutdown(struct userial8250_do_shutdown (port); } +static void serial8250_flush_buffer (struct uart_port *port) +{ +struct uart_8250_port *up =up_to_u8250p (port); + +if (up->dma) +serial8250_tx_dma_flush (up); +} +static unsigned int serial8250_do_get_divisor (struct uart_port *port,unsigned int baud,unsigned int *frac)
@@ -3207,6 +3215,7 @@ static const struct uart_ops serial8250_ .break_ctl = serial8250_break_ctl, .startup = serial8250_startup, .shutdown = serial8250_shutdown, + .flush_buffer = serial8250_flush_buffer, .set_termios = serial8250_set_termios, .set_ldisc = serial8250_set_ldisc, .pm = serial8250_pm,
Greg Kroah-Hartman
maintainerPATCH 146/230 alpha: replace hardcoded stack offsets with autogenerated ones
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Kokshaysky <[email protected]>
commit 77b823fa619f97d16409ca37ad4f7936e28c5f83 upstream.
This allows the assembly in entry.S to automatically keep in sync with changes in the stack layout (struct pt_regs and struct switch_stack).
--- arch/alpha/kernel/asm-offsets.c | 4 ++++ arch/alpha/kernel/entry.S | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/alpha/kernel/asm-offsets.c +4 -0
@@ -19,9 +19,13 @@ static void __used foo(void)DEFINE (TI_STATUS , offsetof(struct thread_info , status));BLANK (); +DEFINE (SP_OFF , offsetof(struct pt_regs , ps));DEFINE (SIZEOF_PT_REGS ,sizeof (struct pt_regs ));BLANK (); +DEFINE (SWITCH_STACK_SIZE ,sizeof (struct switch_stack )); +BLANK (); +DEFINE (HAE_CACHE , offsetof(struct alpha_machine_vector , hae_cache));DEFINE (HAE_REG , offsetof(struct alpha_machine_vector , hae_register)); }
arch/alpha/kernel/entry.S +0 -4
@@ -15,10 +15,6 @@ .set noat .cfi_sections .debug_frame -/* Stack offsets. */ -#define SP_OFF 184 -#define SWITCH_STACK_SIZE 64 - .macro CFI_START_OSF_FRAME func .align 4 .globl \func
Greg Kroah-Hartman
maintainerPATCH 147/230 alpha: align stack for page fault and user unaligned trap handlers
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Kokshaysky <[email protected]>
commit 3b35a171060f846b08b48646b38c30b5d57d17ff upstream.
do_page_fault() and do_entUna() are special because they use non-standard stack frame layout. Fix them manually.
--- arch/alpha/kernel/entry.S | 20 ++++++++++---------- arch/alpha/kernel/traps.c | 2 +- arch/alpha/mm/fault.c | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-)
arch/alpha/kernel/entry.S +10 -10
@@ -194,8 +194,8 @@ CFI_END_OSF_FRAME entArith CFI_START_OSF_FRAME entMM SAVE_ALL /* save $9 - $15 so the inline exception code can manipulate them. */ - subq $sp, 56, $sp - .cfi_adjust_cfa_offset 56 + subq $sp, 64, $sp + .cfi_adjust_cfa_offset 64 stq $9, 0($sp) stq $10, 8($sp) stq $11, 16($sp)
@@ -210,7 +210,7 @@ CFI_START_OSF_FRAME entMM .cfi_rel_offset $13, 32 .cfi_rel_offset $14, 40 .cfi_rel_offset $15, 48 - addq $sp, 56, $19 + addq $sp, 64, $19 /* handle the fault */ lda $8, 0x3fff bic $sp, $8, $8
@@ -223,7 +223,7 @@ CFI_START_OSF_FRAME entMM ldq $13, 32($sp) ldq $14, 40($sp) ldq $15, 48($sp) - addq $sp, 56, $sp + addq $sp, 64, $sp .cfi_restore $9 .cfi_restore $10 .cfi_restore $11
@@ -231,7 +231,7 @@ CFI_START_OSF_FRAME entMM .cfi_restore $13 .cfi_restore $14 .cfi_restore $15 - .cfi_adjust_cfa_offset -56 + .cfi_adjust_cfa_offset -64 /* finish up the syscall as normal. */ br ret_from_sys_call CFI_END_OSF_FRAME entMM
@@ -378,8 +378,8 @@ entUnaUser: .cfi_restore $0 .cfi_adjust_cfa_offset -256 SAVE_ALL /* setup normal kernel stack */ - lda $sp, -56($sp) - .cfi_adjust_cfa_offset 56 + lda $sp, -64($sp) + .cfi_adjust_cfa_offset 64 stq $9, 0($sp) stq $10, 8($sp) stq $11, 16($sp)
@@ -395,7 +395,7 @@ entUnaUser: .cfi_rel_offset $14, 40 .cfi_rel_offset $15, 48 lda $8, 0x3fff - addq $sp, 56, $19 + addq $sp, 64, $19 bic $sp, $8, $8 jsr $26, do_entUnaUser ldq $9, 0($sp)
@@ -405,7 +405,7 @@ entUnaUser: ldq $13, 32($sp) ldq $14, 40($sp) ldq $15, 48($sp) - lda $sp, 56($sp) + lda $sp, 64($sp) .cfi_restore $9 .cfi_restore $10 .cfi_restore $11
@@ -413,7 +413,7 @@ entUnaUser: .cfi_restore $13 .cfi_restore $14 .cfi_restore $15 - .cfi_adjust_cfa_offset -56 + .cfi_adjust_cfa_offset -64 br ret_from_sys_call CFI_END_OSF_FRAME entUna
arch/alpha/kernel/traps.c +1 -1
@@ -649,7 +649,7 @@ s_reg_to_mem (unsigned long s_reg)static int unauser_reg_offsets[32 ] = {R (r0),R (r1),R (r2),R (r3),R (r4),R (r5),R (r6),R (r7),R (r8),/* r9 ... r15 are stored in front of regs. */ --56 ,-48 ,-40 ,-32 ,-24 ,-16 ,-8 , +-64 ,-56 ,-48 ,-40 ,-32 ,-24 ,-16 ,/* padding at -8 */ R (r16),R (r17),R (r18),R (r19),R (r20),R (r21),R (r22),R (r23),R (r24),R (r25),R (r26),R (r27),R (r28),R (gp),
arch/alpha/mm/fault.c +2 -2
@@ -78,8 +78,8 @@ __load_new_mm_context(struct mm_struct */* Macro for exception fixup code to access integer registers. */ #define dpf_reg (r) \ - (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-16 : \ - (r) <= 18 ? (r)+10 : (r)-10]) + (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-17 : \ + (r) <= 18 ? (r)+11 : (r)-10]) asmlinkage void do_page_fault(unsigned long address, unsigned long mmcsr,
Greg Kroah-Hartman
maintainerPATCH 148/230 s390/pci: Pull search for parent PF out of zpci_iov_setup_virtfn()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Schnelle <[email protected]>
commit 05793884a1f30509e477de9da233ab73584b1c8c upstream.
This creates a new zpci_iov_find_parent_pf() function which a future commit can use to find if a VF has a configured parent PF. Use zdev->rid instead of zdev->devfn such that the new function can be used before it has been decided if the RID will be exposed and zdev->devfn is set. Also handle the hypotheical case that the RID is not available but there is an otherwise matching zbus.
--- arch/s390/pci/pci_iov.c | 56 ++++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 14 deletions(-)
arch/s390/pci/pci_iov.c +42 -14
@@ -60,18 +60,35 @@ static int zpci_iov_link_virtfn(struct pci_dev *pdev, struct pci_dev *virtfn, inreturn 0 ; } -int zpci_iov_setup_virtfn (struct zpci_bus *zbus,struct pci_dev *virtfn,int vfn) +/** +* zpci_iov_find_parent_pf - Find the parent PF, if any, of the given function +* @zbus: The bus that the PCI function is on, or would be added on +* @zdev: The PCI function +* +* Finds the parent PF, if it exists and is configured, of the given PCI function +* and increments its refcount. Th PF is searched for on the provided bus so the +* caller has to ensure that this is the correct bus to search. This function may +* be used before adding the PCI function to a zbus. +* +* Return: Pointer to the struct pci_dev of the parent PF or NULL if it not +* found. If the function is not a VF or has no RequesterID information, +* NULL is returned as well. +*/ +static struct pci_dev *zpci_iov_find_parent_pf (struct zpci_bus *zbus,struct zpci_dev *zdev) { -int i, cand_devfn; -struct zpci_dev *zdev; +int i, vfid, devfn, cand_devfn;struct pci_dev *pdev; -int vfid = vfn -1 ;/* Linux' vfid's start at 0 vfn at 1*/ -int rc =0 ;if (!zbus->multifunction) -return 0 ; - -/* If the parent PF for the given VF is also configured in the +return NULL ; +/* Non-VFs and VFs without RID available don't have a parent */ +if (!zdev->vfn || !zdev->rid_available) +return NULL ; +/* Linux vfid starts at 0 vfn at 1 */ + vfid = zdev->vfn -1 ; + devfn = zdev->rid &ZPCI_RID_MASK_DEVFN ; +/* +* If the parent PF for the given VF is also configured in the * instance, it must be on the same zbus. * We can then identify the parent PF by checking what * devfn the VF would have if it belonged to that PF using the PF's
@@ -85,15 +102,26 @@ int zpci_iov_setup_virtfn(struct zpci_bus *zbus, struct pci_dev *virtfn, int vfnif (!pdev)continue ; cand_devfn =pci_iov_virtfn_devfn (pdev, vfid); -if (cand_devfn == virtfn->devfn) { - rc =zpci_iov_link_virtfn (pdev, virtfn, vfid); -/* balance pci_get_slot() */ -pci_dev_put (pdev); -break ; - } +if (cand_devfn == devfn) +return pdev;/* balance pci_get_slot() */ pci_dev_put (pdev); } } +return NULL ; +} + +int zpci_iov_setup_virtfn (struct zpci_bus *zbus,struct pci_dev *virtfn,int vfn) +{ +struct zpci_dev *zdev =to_zpci (virtfn); +struct pci_dev *pdev_pf; +int rc =0 ; + + pdev_pf =zpci_iov_find_parent_pf (zbus, zdev); +if (pdev_pf) { +/* Linux' vfids start at 0 while zdev->vfn starts at 1 */ + rc =zpci_iov_link_virtfn (pdev_pf, virtfn, zdev->vfn -1 ); +pci_dev_put (pdev_pf); + }return rc; }
Signature · 1 line
2.48.1
Greg Kroah-Hartman
maintainerPATCH 149/230 s390/pci: Fix handling of isolated VFs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Schnelle <[email protected]>
commit 2844ddbd540fc84d7571cca65d6c43088e4d6952 upstream.
In contrast to the commit message of the fixed commit VFs whose parent PF is not configured are not always isolated, that is put on their own PCI domain. This is because for VFs to be added to an existing PCI domain it is enough for that PCI domain to share the same topology ID or PCHID. Such a matching PCI domain without a parent PF may exist when a PF from the same PCI card created the domain with the VF being a child of a different, non accessible, PF. While not causing technical issues it makes the rules which VFs are isolated inconsistent.
Fix this by explicitly checking that the parent PF exists on the PCI domain determined by the topology ID or PCHID before registering the VF. This works because a parent PF which is under control of this Linux instance must be enabled and configured at the point where its child VFs appear because otherwise SR-IOV could not have been enabled on the parent.
--- arch/s390/pci/pci_bus.c | 20 ++++++++++++++++++++ arch/s390/pci/pci_iov.c | 2 +- arch/s390/pci/pci_iov.h | 7 +++++++ 3 files changed, 28 insertions(+), 1 deletion(-)
arch/s390/pci/pci_bus.c +20 -0
@@ -331,6 +331,17 @@ error:return rc; } +static bool zpci_bus_is_isolated_vf (struct zpci_bus *zbus,struct zpci_dev *zdev) +{ +struct pci_dev *pdev; + + pdev =zpci_iov_find_parent_pf (zbus, zdev); +if (!pdev) +return true; +pci_dev_put (pdev); +return false; +} +int zpci_bus_device_register (struct zpci_dev *zdev,struct pci_ops *ops) {bool topo_is_tid = zdev->tid_avail;
@@ -345,6 +356,15 @@ int zpci_bus_device_register(struct zpci topo = topo_is_tid ? zdev->tid : zdev->pchid; zbus =zpci_bus_get (topo, topo_is_tid); +/* +* An isolated VF gets its own domain/bus even if there exists +* a matching domain/bus already +*/ +if (zbus &&zpci_bus_is_isolated_vf (zbus, zdev)) { +zpci_bus_put (zbus); + zbus =NULL ; + } +if (!zbus) { zbus =zpci_bus_alloc (topo, topo_is_tid);if (!zbus)
arch/s390/pci/pci_iov.c +1 -1
@@ -74,7 +74,7 @@ static int zpci_iov_link_virtfn(struct p* found. If the function is not a VF or has no RequesterID information, * NULL is returned as well. */ -static struct pci_dev *zpci_iov_find_parent_pf (struct zpci_bus *zbus,struct zpci_dev *zdev) +struct pci_dev *zpci_iov_find_parent_pf (struct zpci_bus *zbus,struct zpci_dev *zdev) {int i, vfid, devfn, cand_devfn;struct pci_dev *pdev;
arch/s390/pci/pci_iov.h +7 -0
@@ -17,6 +17,8 @@ void zpci_iov_map_resources(struct pci_dint zpci_iov_setup_virtfn (struct zpci_bus *zbus,struct pci_dev *virtfn,int vfn); +struct pci_dev *zpci_iov_find_parent_pf (struct zpci_bus *zbus,struct zpci_dev *zdev); +#else /* CONFIG_PCI_IOV */ static inline void zpci_iov_remove_virtfn (struct pci_dev *pdev,int vfn) {}
@@ -26,5 +28,10 @@ static inline int zpci_iov_setup_virtfn( {return 0 ; } + +static inline struct pci_dev *zpci_iov_find_parent_pf (struct zpci_bus *zbus,struct zpci_dev *zdev) +{ +return NULL ; +}#endif /* CONFIG_PCI_IOV */ #endif /* __S390_PCI_IOV_h */
Greg Kroah-Hartman
maintainerPATCH 150/230 gpiolib: acpi: Add a quirk for Acer Nitro ANV14
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
commit 8743d66979e494c5378563e6b5a32e913380abd8 upstream.
Spurious immediate wake up events are reported on Acer Nitro ANV14. GPIO 11 is specified as an edge triggered input and also a wake source but this pin is supposed to be an output pin for an LED, so it's effectively floating.
Block the interrupt from getting set up for this GPIO on this device.
--- drivers/gpio/gpiolib-acpi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpio/gpiolib-acpi.c +14 -0
@@ -1691,6 +1691,20 @@ static const struct dmi_system_id gpioli .ignore_wake = "PNP0C50:00@8", }, }, + { + /* + * Spurious wakeups from GPIO 11 + * Found in BIOS 1.04 + * https://gitlab.freedesktop.org/drm/amd/-/issues/3954 + */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), + DMI_MATCH(DMI_PRODUCT_FAMILY, "Acer Nitro V 14"), + }, + .driver_data = &(struct acpi_gpiolib_dmi_quirk) { + .ignore_interrupt = "AMDI0030:00@11", + }, + }, {} /* Terminating entry */ };
Greg Kroah-Hartman
maintainerPATCH 151/230 gpio: stmpe: Check return value of stmpe_reg_read in stmpe_gpio_irq_sync_unlock
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
commit b9644fbfbcab13da7f8b37bef7c51e5b8407d031 upstream.
The stmpe_reg_read function can fail, but its return value is not checked in stmpe_gpio_irq_sync_unlock. This can lead to silent failures and incorrect behavior if the hardware access fails.
This patch adds checks for the return value of stmpe_reg_read. If the function fails, an error message is logged and the function returns early to avoid further issues.
--- drivers/gpio/gpio-stmpe.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/gpio/gpio-stmpe.c +12 -3
@@ -191,7 +191,7 @@ static void stmpe_gpio_irq_sync_unlock(s [REG_IE][CSB] = STMPE_IDX_IEGPIOR_CSB, [REG_IE][MSB] = STMPE_IDX_IEGPIOR_MSB, }; -int i, j; +int ret, i, j;/* * STMPE1600: to be able to get IRQ from pins,
@@ -199,8 +199,16 @@ static void stmpe_gpio_irq_sync_unlock(s* GPSR or GPCR registers */ if (stmpe->partnum ==STMPE1600 ) { -stmpe_reg_read (stmpe, stmpe->regs[STMPE_IDX_GPMR_LSB ]); -stmpe_reg_read (stmpe, stmpe->regs[STMPE_IDX_GPMR_CSB ]); + ret =stmpe_reg_read (stmpe, stmpe->regs[STMPE_IDX_GPMR_LSB ]); +if (ret <0 ) { +dev_err (stmpe->dev,"Failed to read GPMR_LSB: %d\n" , ret); + goto err; + } + ret =stmpe_reg_read (stmpe, stmpe->regs[STMPE_IDX_GPMR_CSB ]); +if (ret <0 ) { +dev_err (stmpe->dev,"Failed to read GPMR_CSB: %d\n" , ret); + goto err; + } }for (i =0 ; i <CACHE_NR_REGS ; i++) {
@@ -222,6 +230,7 @@ static void stmpe_gpio_irq_sync_unlock(s } } +err:mutex_unlock (&stmpe_gpio->irq_lock); }
Greg Kroah-Hartman
maintainerPATCH 152/230 partitions: mac: fix handling of bogus partition table
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 80e648042e512d5a767da251d44132553fe04ae0 upstream.
Fix several issues in partition probing:
- The bailout for a bad partoffset must use put_dev_sector(), since the preceding read_part_sector() succeeded.
- If the partition table claims a silly sector size like 0xfff bytes (which results in partition table entries straddling sector boundaries), bail out instead of accessing out-of-bounds memory.
- We must not assume that the partition table contains proper NUL termination - use strnlen() and strncmp() instead of strlen() and strcmp().
--- block/partitions/mac.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
block/partitions/mac.c +15 -3
@@ -53,13 +53,25 @@ int mac_partition(struct parsed_partitio } secsize =be16_to_cpu (md->block_size);put_dev_sector (sect); + +/* +* If the "block size" is not a power of 2, things get weird - we might +* end up with a partition straddling a sector boundary, so we wouldn't +* be able to read a partition entry with read_part_sector(). +* Real block sizes are probably (?) powers of two, so just require +* that. +*/ +if (!is_power_of_2 (secsize)) +return -1 ; datasize =round_down (secsize,512 ); data =read_part_sector (state, datasize /512 , §);if (!data)return -1 ; partoffset = secsize %512 ; -if (partoffset +sizeof (*part) > datasize) +if (partoffset +sizeof (*part) > datasize) { +put_dev_sector (sect);return -1 ; + } part = (struct mac_partition *) (data + partoffset);if (be16_to_cpu (part->signature) !=MAC_PARTITION_MAGIC ) {put_dev_sector (sect);
@@ -112,8 +124,8 @@ int mac_partition(struct parsed_partitioint i, l; goodness++; - l =strlen (part->name); -if (strcmp (part->name,"/" ) ==0 ) + l =strnlen (part->name,sizeof (part->name)); +if (strncmp (part->name,"/" ,sizeof (part->name)) ==0 ) goodness++;for (i =0 ; i <= l -4 ; ++i) { if (strncasecmp(part->name + i, "root",
Greg Kroah-Hartman
maintainerPATCH 153/230 sched_ext: Fix incorrect autogroup migration detection
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit d6f3e7d564b2309e1f17e709a70eca78d7ca2bb8 upstream.
scx_move_task() is called from sched_move_task() and tells the BPF scheduler that cgroup migration is being committed. sched_move_task() is used by both cgroup and autogroup migrations and scx_move_task() tried to filter out autogroup migrations by testing the destination cgroup and PF_EXITING but this is not enough. In fact, without explicitly tagging the thread which is doing the cgroup migration, there is no good way to tell apart scx_move_task() invocations for racing migration to the root cgroup and an autogroup migration.
This led to scx_move_task() incorrectly ignoring a migration from non-root cgroup to an autogroup of the root cgroup triggering the following warning:
WARNING: CPU: 7 PID: 1 at kernel/sched/ext.c:3725 scx_cgroup_can_attach+0x196/0x340
...
Call Trace:
<TASK>
cgroup_migrate_execute+0x5b1/0x700
cgroup_attach_task+0x296/0x400
__cgroup_procs_write+0x128/0x140
cgroup_procs_write+0x17/0x30
kernfs_fop_write_iter+0x141/0x1f0
vfs_write+0x31d/0x4a0
__x64_sys_write+0x72/0xf0
do_syscall_64+0x82/0x160
entry_SYSCALL_64_after_hwframe+0x76/0x7eFix it by adding an argument to sched_move_task() that indicates whether the moving is for a cgroup or autogroup migration. After the change, scx_move_task() is called only for cgroup migrations and renamed to scx_cgroup_move_task().
--- kernel/sched/autogroup.c | 4 ++-- kernel/sched/core.c | 7 ++++--- kernel/sched/ext.c | 15 +-------------- kernel/sched/ext.h | 4 ++-- kernel/sched/sched.h | 2 +- 5 files changed, 10 insertions(+), 22 deletions(-)
kernel/sched/autogroup.c +2 -2
@@ -150,7 +150,7 @@ void sched_autogroup_exit_task(struct ta* see this thread after that: we can no longer use signal->autogroup. * See the PF_EXITING check in task_wants_autogroup(). */ -sched_move_task (p); +sched_move_task (p, true); } static void
@@ -182,7 +182,7 @@ autogroup_move_group(struct task_struct* sched_autogroup_exit_task(). */ for_each_thread (p, t) -sched_move_task (t); +sched_move_task (t, true);unlock_task_sighand (p, &flags);autogroup_kref_put (prev);
kernel/sched/core.c +4 -3
@@ -8953,7 +8953,7 @@ static void sched_change_group(struct ta* now. This function just updates tsk->se.cfs_rq and tsk->se.parent to reflect * its new group. */ -void sched_move_task (struct task_struct *tsk) +void sched_move_task (struct task_struct *tsk,bool for_autogroup) {int queued, running, queue_flags =DEQUEUE_SAVE |DEQUEUE_MOVE |DEQUEUE_NOCLOCK ;
@@ -8982,7 +8982,8 @@ void sched_move_task(struct task_structput_prev_task (rq, tsk);sched_change_group (tsk, group); -scx_move_task (tsk); +if (!for_autogroup) +scx_cgroup_move_task (tsk);if (queued)enqueue_task (rq, tsk, queue_flags);
@@ -9083,7 +9084,7 @@ static void cpu_cgroup_attach(struct cgrstruct cgroup_subsys_state *css;cgroup_taskset_for_each (task, css, tset) -sched_move_task (task); +sched_move_task (task, false);scx_cgroup_finish_attach (); }
kernel/sched/ext.c +1 -14
@@ -3919,25 +3919,12 @@ err:return ops_sanitize_err ("cgroup_prep_move" , ret); } -void scx_move_task (struct task_struct *p) +void scx_cgroup_move_task (struct task_struct *p) {if (!scx_cgroup_enabled)return ;/* -* We're called from sched_move_task() which handles both cgroup and -* autogroup moves. Ignore the latter. -* -* Also ignore exiting tasks, because in the exit path tasks transition -* from the autogroup to the root group, so task_group_is_autogroup() -* alone isn't able to catch exiting autogroup tasks. This is safe for -* cgroup_move(), because cgroup migrations never happen for PF_EXITING -* tasks. -*/ -if (task_group_is_autogroup (task_group (p)) || (p->flags &PF_EXITING )) -return ; - -/* * @p must have ops.cgroup_prep_move() called on it and thus * cgrp_moving_from set. */
kernel/sched/ext.h +2 -2
@@ -73,7 +73,7 @@ static inline void scx_update_idle(strucint scx_tg_online (struct task_group *tg);void scx_tg_offline (struct task_group *tg);int scx_cgroup_can_attach (struct cgroup_taskset *tset); -void scx_move_task (struct task_struct *p); +void scx_cgroup_move_task (struct task_struct *p);void scx_cgroup_finish_attach (void );void scx_cgroup_cancel_attach (struct cgroup_taskset *tset);void scx_group_set_weight (struct task_group *tg,unsigned long cgrp_weight);
@@ -82,7 +82,7 @@ void scx_group_set_idle(struct task_groustatic inline int scx_tg_online (struct task_group *tg) {return 0 ; }static inline void scx_tg_offline (struct task_group *tg) {}static inline int scx_cgroup_can_attach (struct cgroup_taskset *tset) {return 0 ; } -static inline void scx_move_task (struct task_struct *p) {} +static inline void scx_cgroup_move_task (struct task_struct *p) {}static inline void scx_cgroup_finish_attach (void ) {}static inline void scx_cgroup_cancel_attach (struct cgroup_taskset *tset) {}static inline void scx_group_set_weight (struct task_group *tg,unsigned long cgrp_weight) {}
kernel/sched/sched.h +1 -1
@@ -572,7 +572,7 @@ extern void sched_online_group(struct taextern void sched_destroy_group (struct task_group *tg);extern void sched_release_group (struct task_group *tg); -extern void sched_move_task (struct task_struct *tsk); +extern void sched_move_task (struct task_struct *tsk,bool for_autogroup);#ifdef CONFIG_FAIR_GROUP_SCHED extern int sched_group_set_shares (struct task_group *tg,unsigned long shares);
Greg Kroah-Hartman
maintainerPATCH 154/230 regulator: qcom_smd: Add l2, l5 sub-node to mp5496 regulator
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Varadarajan Narayanan <[email protected]>
commit b0eddc21900fb44f8c5db95710479865e3700fbd upstream.
Adding l2, l5 sub-node entry to mp5496 regulator node.
--- Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.yaml +1 -1
@@ -22,7 +22,7 @@ description: Each sub-node is identified using the node's name, with valid values listed for each of the pmics below. - For mp5496, s1, s2 + For mp5496, s1, s2, l2, l5 For pm2250, s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17, l18, l19, l20, l21, l22
Greg Kroah-Hartman
maintainerPATCH 155/230 iommu: Fix potential memory leak in iopf_queue_remove_device()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lu Baolu <[email protected]>
commit 9759ae2cee7cd42b95f1c48aa3749bd02b5ddb08 upstream.
The iopf_queue_remove_device() helper removes a device from the per-iommu iopf queue when PRI is disabled on the device. It responds to all outstanding iopf's with an IOMMU_PAGE_RESP_INVALID code and detaches the device from the queue.
However, it fails to release the group structure that represents a group of iopf's awaiting for a response after responding to the hardware. This can cause a memory leak if iopf_queue_remove_device() is called with pending iopf's.
Fix it by calling iopf_free_group() after the iopf group is responded.
--- drivers/iommu/io-pgfault.c | 1 + 1 file changed, 1 insertion(+)
drivers/iommu/io-pgfault.c +1 -0
@@ -478,6 +478,7 @@ void iopf_queue_remove_device(struct iop ops->page_response (dev, iopf, &resp);list_del_init (&group->pending_node); +iopf_free_group (group); }mutex_unlock (&fault_param->lock);
Greg Kroah-Hartman
maintainerPATCH 156/230 regmap-irq: Add missing kfree()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
commit 32ffed055dcee17f6705f545b069e44a66067808 upstream.
Add kfree() for "d->main_status_buf" to the error-handling path to prevent a memory leak.
--- drivers/base/regmap/regmap-irq.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/base/regmap/regmap-irq.c +2 -0
@@ -909,6 +909,7 @@ err_alloc:kfree (d->wake_buf);kfree (d->mask_buf_def);kfree (d->mask_buf); +kfree (d->main_status_buf);kfree (d->status_buf);kfree (d->status_reg_buf);if (d->config_buf) {
@@ -984,6 +985,7 @@ void regmap_del_irq_chip(int irq, structkfree (d->wake_buf);kfree (d->mask_buf_def);kfree (d->mask_buf); +kfree (d->main_status_buf);kfree (d->status_reg_buf);kfree (d->status_buf);if (d->config_buf) {
Greg Kroah-Hartman
maintainerPATCH 157/230 arm64: Handle .ARM.attributes section in linker scripts
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit ca0f4fe7cf7183bfbdc67ca2de56ae1fc3a8db2b upstream.
A recent LLVM commit [1] started generating an .ARM.attributes section similar to the one that exists for 32-bit, which results in orphan section warnings (or errors if CONFIG_WERROR is enabled) from the linker because it is not handled in the arm64 linker scripts.
ld.lld: error: arch/arm64/kernel/vdso/vgettimeofday.o:(.ARM.attributes) is being placed in '.ARM.attributes' ld.lld: error: arch/arm64/kernel/vdso/vgetrandom.o:(.ARM.attributes) is being placed in '.ARM.attributes'
ld.lld: error: vmlinux.a(lib/vsprintf.o):(.ARM.attributes) is being placed in '.ARM.attributes' ld.lld: error: vmlinux.a(lib/win_minmax.o):(.ARM.attributes) is being placed in '.ARM.attributes' ld.lld: error: vmlinux.a(lib/xarray.o):(.ARM.attributes) is being placed in '.ARM.attributes'
Discard the new sections in the necessary linker scripts to resolve the warnings, as the kernel and vDSO do not need to retain it, similar to the .note.gnu.property section.
--- arch/arm64/kernel/vdso/vdso.lds.S | 1 + arch/arm64/kernel/vmlinux.lds.S | 1 + 2 files changed, 2 insertions(+)
arch/arm64/kernel/vdso/vdso.lds.S +1 -0
@@ -41,6 +41,7 @@ SECTIONS */ /DISCARD/ : { *(.note.GNU-stack .note.gnu.property) + *(.ARM.attributes) } .note : { *(.note.*) } :text :note
arch/arm64/kernel/vmlinux.lds.S +1 -0
@@ -162,6 +162,7 @@ SECTIONS /DISCARD/ : { *(.interp .dynamic) *(.dynsym .dynstr .hash .gnu.hash) + *(.ARM.attributes) } . = KIMAGE_VADDR;
Greg Kroah-Hartman
maintainerPATCH 158/230 mmc: mtk-sd: Fix register settings for hs400(es) mode
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy-ld Lu <[email protected]>
commit 3e68abf2b9cebe76c6cd4b1aca8e95cd671035a3 upstream.
For hs400(es) mode, the 'hs400-ds-delay' is typically configured in the dts. However, some projects may only define 'mediatek,hs400-ds-dly3', which can lead to initialization failures in hs400es mode. CMD13 reported response crc error in the mmc_switch_status() just after switching to hs400es mode.
[ 1.914038][ T82] mmc0: mmc_select_hs400es failed, error -84 [ 1.914954][ T82] mmc0: error -84 whilst initialising MMC card
Currently, the hs400_ds_dly3 value is set within the tuning function. This means that the PAD_DS_DLY3 field is not configured before tuning process, which is the reason for the above-mentioned CMD13 response crc error.
Move the PAD_DS_DLY3 field configuration into msdc_prepare_hs400_tuning(), and add a value check of hs400_ds_delay to prevent overwriting by zero when the 'hs400-ds-delay' is not set in the dts. In addition, since hs400(es) only tune the PAD_DS_DLY1, the PAD_DS_DLY2_SEL bit should be cleared to bypass it.
--- drivers/mmc/host/mtk-sd.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)
drivers/mmc/host/mtk-sd.c +20 -11
@@ -263,6 +263,7 @@#define MSDC_PAD_TUNE_CMD2_SEL BIT(21)/* RW */ #define PAD_DS_TUNE_DLY_SEL BIT(0)/* RW */ +#define PAD_DS_TUNE_DLY2_SEL BIT(1)/* RW */ #define PAD_DS_TUNE_DLY1 GENMASK(6, 2)/* RW */ #define PAD_DS_TUNE_DLY2 GENMASK(11, 7)/* RW */ #define PAD_DS_TUNE_DLY3 GENMASK(16, 12)/* RW */
@@ -308,6 +309,7 @@/* EMMC50_PAD_DS_TUNE mask */ #define PAD_DS_DLY_SEL BIT(16)/* RW */ +#define PAD_DS_DLY2_SEL BIT(15)/* RW */ #define PAD_DS_DLY1 GENMASK(14, 10)/* RW */ #define PAD_DS_DLY3 GENMASK(4, 0)/* RW */
@@ -2361,13 +2363,23 @@ tune_done:static int msdc_prepare_hs400_tuning (struct mmc_host *mmc,struct mmc_ios *ios) {struct msdc_host *host =mmc_priv (mmc); + host->hs400_mode = true; -if (host->top_base) -writel (host->hs400_ds_delay, - host->top_base +EMMC50_PAD_DS_TUNE ); -else -writel (host->hs400_ds_delay, host->base +PAD_DS_TUNE ); +if (host->top_base) { +if (host->hs400_ds_dly3) +sdr_set_field (host->top_base +EMMC50_PAD_DS_TUNE , +PAD_DS_DLY3 , host->hs400_ds_dly3); +if (host->hs400_ds_delay) +writel (host->hs400_ds_delay, + host->top_base +EMMC50_PAD_DS_TUNE ); + }else { +if (host->hs400_ds_dly3) +sdr_set_field (host->base +PAD_DS_TUNE , +PAD_DS_TUNE_DLY3 , host->hs400_ds_dly3); +if (host->hs400_ds_delay) +writel (host->hs400_ds_delay, host->base +PAD_DS_TUNE ); + }/* hs400 mode must set it to 0 */ sdr_clr_bits (host->base +MSDC_PATCH_BIT2 ,MSDC_PATCH_BIT2_CFGCRCSTS );/* to improve read performance, set outstanding to 2 */
@@ -2387,14 +2399,11 @@ static int msdc_execute_hs400_tuning(strif (host->top_base) {sdr_set_bits (host->top_base +EMMC50_PAD_DS_TUNE ,PAD_DS_DLY_SEL ); -if (host->hs400_ds_dly3) -sdr_set_field (host->top_base +EMMC50_PAD_DS_TUNE , -PAD_DS_DLY3 , host->hs400_ds_dly3); +sdr_clr_bits (host->top_base +EMMC50_PAD_DS_TUNE , +PAD_DS_DLY2_SEL ); }else {sdr_set_bits (host->base +PAD_DS_TUNE ,PAD_DS_TUNE_DLY_SEL ); -if (host->hs400_ds_dly3) -sdr_set_field (host->base +PAD_DS_TUNE , -PAD_DS_TUNE_DLY3 , host->hs400_ds_dly3); +sdr_clr_bits (host->base +PAD_DS_TUNE ,PAD_DS_TUNE_DLY2_SEL ); } host->hs400_tuning = true;
Greg Kroah-Hartman
maintainerPATCH 159/230 igc: Set buffer type for empty frames in igc_init_empty_frame
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Song Yoong Siang <[email protected]>
commit 63f20f00d23d569e4e67859b4e8dcc9de79221cb upstream.
Set the buffer type to IGC_TX_BUFFER_TYPE_SKB for empty frame in the igc_init_empty_frame function. This ensures that the buffer type is correctly identified and handled during Tx ring cleanup.
--- drivers/net/ethernet/intel/igc/igc_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/igc/igc_main.c +1 -0
@@ -1096,6 +1096,7 @@ static int igc_init_empty_frame(struct ireturn -ENOMEM ; } + buffer->type =IGC_TX_BUFFER_TYPE_SKB ; buffer->skb = skb; buffer->protocol =0 ; buffer->bytecount = skb->len;
Greg Kroah-Hartman
maintainerPATCH 160/230 cifs: pick channels for individual subrequests
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shyam Prasad N <[email protected]>
commit f1bf10d7e909fe898a112f5cae1e97ce34d6484d upstream.
The netfs library could break down a read request into multiple subrequests. When multichannel is used, there is potential to improve performance when each of these subrequests pick a different channel.
Today we call cifs_pick_channel when the main read request is initialized in cifs_init_request. This change moves this to cifs_prepare_read, which is the right place to pick channel since it gets called for each subrequest.
Interestingly cifs_prepare_write already does channel selection for individual subreq, but looks like it was missed for read. This is especially important when multichannel is used with increased rasize.
In my test setup, with rasize set to 8MB, a sequential read of large file was taking 11.5s without this change. With the change, it completed in 9s. The difference is even more signigicant with bigger rasize.
--- fs/smb/client/cifsglob.h | 1 - fs/smb/client/file.c | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-)
fs/smb/client/cifsglob.h +0 -1
@@ -1476,7 +1476,6 @@ struct cifs_io_parms {struct cifs_io_request {struct netfs_io_request rreq;struct cifsFileInfo *cfile; -struct TCP_Server_Info *server;pid_t pid; };
fs/smb/client/file.c +4 -3
@@ -147,7 +147,7 @@ static int cifs_prepare_read(struct netfstruct netfs_io_request *rreq = subreq->rreq; struct cifs_io_subrequest *rdata = container_of(subreq, struct cifs_io_subrequest, subreq); struct cifs_io_request *req = container_of(subreq->rreq, struct cifs_io_request, rreq); -struct TCP_Server_Info *server = req->server; +struct TCP_Server_Info *server;struct cifs_sb_info *cifs_sb =CIFS_SB (rreq->inode->i_sb);size_t size;int rc =0 ;
@@ -156,6 +156,8 @@ static int cifs_prepare_read(struct netf rdata->xid =get_xid (); rdata->have_xid = true; } + + server =cifs_pick_channel (tlink_tcon (req->cfile->tlink)->ses); rdata->server = server;if (cifs_sb->ctx->rsize ==0 )
@@ -198,7 +200,7 @@ static void cifs_issue_read(struct netfsstruct netfs_io_request *rreq = subreq->rreq; struct cifs_io_subrequest *rdata = container_of(subreq, struct cifs_io_subrequest, subreq); struct cifs_io_request *req = container_of(subreq->rreq, struct cifs_io_request, rreq); -struct TCP_Server_Info *server = req->server; +struct TCP_Server_Info *server = rdata->server;int rc =0 ; cifs_dbg(FYI, "%s: op=%08x[%x] mapping=%p len=%zu/%zu\n",
@@ -265,7 +267,6 @@ static int cifs_init_request(struct netf open_file = file->private_data; rreq->netfs_priv = file->private_data; req->cfile =cifsFileInfo_get (open_file); - req->server =cifs_pick_channel (tlink_tcon (req->cfile->tlink)->ses);if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_RWPIDFORWARD ) req->pid = req->cfile->pid; }else if (rreq->origin !=NETFS_WRITEBACK ) {
Greg Kroah-Hartman
maintainerPATCH 161/230 mlxsw: Add return value check for mlxsw_sp_port_get_stats_raw()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
commit fee5d688940690cc845937459e340e4e02598e90 upstream.
Add a check for the return value of mlxsw_sp_port_get_stats_raw() in __mlxsw_sp_port_get_stats(). If mlxsw_sp_port_get_stats_raw() returns an error, exit the function to prevent further processing with potentially invalid data.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c +3 -1
@@ -768,7 +768,9 @@ static void __mlxsw_sp_port_get_stats(st err =mlxsw_sp_get_hw_stats_by_group (&hw_stats, &len, grp);if (err)return ; -mlxsw_sp_port_get_stats_raw (dev, grp, prio, ppcnt_pl); + err =mlxsw_sp_port_get_stats_raw (dev, grp, prio, ppcnt_pl); +if (err) +return ;for (i =0 ; i < len; i++) { data[data_index + i] = hw_stats[i].getter (ppcnt_pl);if (!hw_stats[i].cells_bytes)
Greg Kroah-Hartman
maintainerPATCH 162/230 btrfs: fix hole expansion when writing at an offset beyond EOF
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit da2dccd7451de62b175fb8f0808d644959e964c7 upstream.
At btrfs_write_check() if our file's i_size is not sector size aligned and we have a write that starts at an offset larger than the i_size that falls within the same page of the i_size, then we end up not zeroing the file range [i_size, write_offset).
The code is this:
start_pos = round_down(pos, fs_info->sectorsize);
oldsize = i_size_read(inode);
if (start_pos > oldsize) {
/* Expand hole size to cover write data, preventing empty gap */
loff_t end_pos = round_up(pos + count, fs_info->sectorsize);
ret = btrfs_cont_expand(BTRFS_I(inode), oldsize, end_pos);
if (ret)
return ret;
}So if our file's i_size is 90269 bytes and a write at offset 90365 bytes comes in, we get 'start_pos' set to 90112 bytes, which is less than the i_size and therefore we don't zero out the range [90269, 90365) by calling btrfs_cont_expand().
This is an old bug introduced in commit 9036c10208e1 ("Btrfs: update hole handling v2"), from 2008, and the buggy code got moved around over the years.
Fix this by discarding 'start_pos' and comparing against the write offset ('pos') without any alignment.
This bug was recently exposed by test case generic/363 which tests this scenario by polluting ranges beyond EOF with an mmap write and than verify that after a file increases we get zeroes for the range which is supposed to be a hole and not what we wrote with the previous mmaped write.
We're only seeing this exposed now because generic/363 used to run only on xfs until last Sunday's fstests update.
The test was failing like this:
$ ./check generic/363 FSTYP -- btrfs PLATFORM -- Linux/x86_64 debian0 6.13.0-rc7-btrfs-next-185+ #17 SMP PREEMPT_DYNAMIC Mon Feb 3 12:28:46 WET 2025 MKFS_OPTIONS -- /dev/sdc MOUNT_OPTIONS -- /dev/sdc /home/fdmanana/btrfs-tests/scratch_1
generic/363 0s ... [failed, exit status 1]- output mismatch (see /home/fdmanana/git/hub/xfstests/results//generic/363.out.bad)
# --- tests/generic/363.out 2025-02-05 15:31:14.013646509 +0000
# +++ /home/fdmanana/git/hub/xfstests/results//generic/363.out.bad 2025-02-05 17:25:33.112630781 +0000
@@ -1 +1,46 @@
QA output created by 363
+READ BAD DATA: offset = 0xdcad, size = 0xd921, fname = /home/fdmanana/btrfs-tests/dev/junk
+OFFSET GOOD BAD RANGE
+0x1609d 0x0000 0x3104 0x0
+operation# (mod 256) for the bad data may be 4
+0x1609e 0x0000 0x0472 0x1
+operation# (mod 256) for the bad data may be 4
...
(Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/generic/363.out /home/fdmanana/git/hub/xfstests/results//generic/363.out.bad' to see the entire diff)
Ran: generic/363
Failures: generic/363
Failed 1 of 1 tests
--- fs/btrfs/file.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/btrfs/file.c +1 -3
@@ -1148,7 +1148,6 @@ int btrfs_write_check(struct kiocb *iocbloff_t pos = iocb->ki_pos;int ret;loff_t oldsize; -loff_t start_pos;/* * Quickly bail out on NOWAIT writes if we don't have the nodatacow or
@@ -1172,9 +1171,8 @@ int btrfs_write_check(struct kiocb *iocb*/ update_time_for_write (inode); - start_pos =round_down (pos, fs_info->sectorsize); oldsize =i_size_read (inode); -if (start_pos > oldsize) { +if (pos > oldsize) {/* Expand hole size to cover write data, preventing empty gap */ loff_t end_pos =round_up (pos + count, fs_info->sectorsize);
Greg Kroah-Hartman
maintainerPATCH 163/230 include: net: add static inline dst_dev_overhead() to dst.h
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Iurman <[email protected]>
[ Upstream commit 0600cf40e9b36fe17f9c9f04d4f9cef249eaa5e7 ]
Add static inline dst_dev_overhead() function to include/net/dst.h. This helper function is used by ioam6_iptunnel, rpl_iptunnel and seg6_iptunnel to get the dev's overhead based on a cache entry (dst_entry). If the cache is empty, the default and generic value skb->mac_len is returned. Otherwise, LL_RESERVED_SPACE() over dst's dev is returned.
Stable-dep-of: 92191dd10730 ("net: ipv6: fix dst ref loops in rpl, seg6 and ioam6 lwtunnels")
--- include/net/dst.h | 9 +++++++++ 1 file changed, 9 insertions(+)
include/net/dst.h +9 -0
@@ -440,6 +440,15 @@ static inline void dst_set_expires(struct dst_entry *dst, int timeout) dst->expires = expires; } +static inline unsigned int dst_dev_overhead (struct dst_entry *dst, +struct sk_buff *skb) +{ +if (likely (dst)) +return LL_RESERVED_SPACE (dst->dev); + +return skb->mac_len; +} + INDIRECT_CALLABLE_DECLARE(int ip6_output(struct net *, struct sock *,struct sk_buff *)); INDIRECT_CALLABLE_DECLARE(int ip_output(struct net *, struct sock *,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 164/230 net: ipv6: ioam6_iptunnel: mitigate 2-realloc issue
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Iurman <[email protected]>
[ Upstream commit dce525185bc92864e5a318040285ee070563fe34 ]
This patch mitigates the two-reallocations issue with ioam6_iptunnel by providing the dst_entry (in the cache) to the first call to skb_cow_head(). As a result, the very first iteration may still trigger two reallocations (i.e., empty cache), while next iterations would only trigger a single reallocation.
Performance tests before/after applying this patch, which clearly shows the improvement:
- inline mode:
- before: https://ibb.co/LhQ8V63
- after: https://ibb.co/x5YT2bS
- encap mode:
- before: https://ibb.co/3Cjm5m0
- after: https://ibb.co/TwpsxTC
- encap mode with tunsrc:
- before: https://ibb.co/Gpy9QPg
- after: https://ibb.co/PW1bZFT
This patch also fixes an incorrect behavior: after the insertion, the second call to skb_cow_head() makes sure that the dev has enough headroom in the skb for layer 2 and stuff. In that case, the "old" dst_entry was used, which is now fixed. After discussing with Paolo, it appears that both patches can be merged into a single one -this one- (for the sake of readability) and target net-next.
Stable-dep-of: 92191dd10730 ("net: ipv6: fix dst ref loops in rpl, seg6 and ioam6 lwtunnels")
--- net/ipv6/ioam6_iptunnel.c | 73 ++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 36 deletions(-)
net/ipv6/ioam6_iptunnel.c +37 -36
@@ -255,14 +255,15 @@ static int ioam6_do_fill(struct net *net, struct sk_buff *skb) }static int ioam6_do_inline (struct net *net,struct sk_buff *skb, -struct ioam6_lwt_encap *tuninfo) +struct ioam6_lwt_encap *tuninfo, +struct dst_entry *cache_dst) {struct ipv6hdr *oldhdr, *hdr;int hdrlen, err; hdrlen = (tuninfo->eh.hdrlen +1 ) <<3 ; - err =skb_cow_head (skb, hdrlen + skb->mac_len); + err =skb_cow_head (skb, hdrlen +dst_dev_overhead (cache_dst, skb));if (unlikely (err))return err;
@@ -293,7 +294,8 @@ static int ioam6_do_encap(struct net *net, struct sk_buff *skb,struct ioam6_lwt_encap *tuninfo, bool has_tunsrc, struct in6_addr *tunsrc, - struct in6_addr *tundst) + struct in6_addr *tundst, + struct dst_entry *cache_dst) { struct dst_entry *dst = skb_dst(skb);struct ipv6hdr *hdr, *inner_hdr;
@@ -302,7 +304,7 @@ static int ioam6_do_encap(struct net *net, struct sk_buff *skb, hdrlen = (tuninfo->eh.hdrlen +1 ) <<3 ; len =sizeof (*hdr) + hdrlen; - err =skb_cow_head (skb, len + skb->mac_len); + err =skb_cow_head (skb, len +dst_dev_overhead (cache_dst, skb));if (unlikely (err))return err;
@@ -336,7 +338,7 @@ static int ioam6_do_encap(struct net *net, struct sk_buff *skb,static int ioam6_output (struct net *net,struct sock *sk,struct sk_buff *skb) { -struct dst_entry *dst =skb_dst (skb); +struct dst_entry *dst =skb_dst (skb), *cache_dst;struct in6_addr orig_daddr;struct ioam6_lwt *ilwt;int err = -EINVAL ;
@@ -354,6 +356,10 @@ static int ioam6_output(struct net *net, struct sock *sk, struct sk_buff *skb) orig_daddr =ipv6_hdr (skb)->daddr; +local_bh_disable (); + cache_dst =dst_cache_get (&ilwt->cache); +local_bh_enable (); +switch (ilwt->mode) {case IOAM6_IPTUNNEL_MODE_INLINE : do_inline:
@@ -361,7 +367,7 @@ static int ioam6_output(struct net *net, struct sock *sk, struct sk_buff *skb)if (ipv6_hdr (skb)->nexthdr ==NEXTHDR_HOP ) goto out; - err =ioam6_do_inline (net, skb, &ilwt->tuninfo); + err =ioam6_do_inline (net, skb, &ilwt->tuninfo, cache_dst);if (unlikely (err)) goto drop;
@@ -371,7 +377,7 @@ static int ioam6_output(struct net *net, struct sock *sk, struct sk_buff *skb)/* Encapsulation (ip6ip6) */ err =ioam6_do_encap (net, skb, &ilwt->tuninfo, ilwt->has_tunsrc, &ilwt->tunsrc, - &ilwt->tundst); + &ilwt->tundst, cache_dst);if (unlikely (err)) goto drop;
@@ -389,41 +395,36 @@ static int ioam6_output(struct net *net, struct sock *sk, struct sk_buff *skb) goto drop; } - err =skb_cow_head (skb,LL_RESERVED_SPACE (dst->dev)); -if (unlikely (err)) - goto drop; +if (unlikely (!cache_dst)) { +struct ipv6hdr *hdr =ipv6_hdr (skb); +struct flowi6 fl6; + +memset (&fl6,0 ,sizeof (fl6)); + fl6.daddr = hdr->daddr; + fl6.saddr = hdr->saddr; + fl6.flowlabel =ip6_flowinfo (hdr); + fl6.flowi6_mark = skb->mark; + fl6.flowi6_proto = hdr->nexthdr; + + cache_dst =ip6_route_output (net,NULL , &fl6); +if (cache_dst->error) { + err = cache_dst->error; +dst_release (cache_dst); + goto drop; + } -if (!ipv6_addr_equal (&orig_daddr, &ipv6_hdr (skb)->daddr)) {local_bh_disable (); - dst =dst_cache_get (&ilwt->cache); +dst_cache_set_ip6 (&ilwt->cache, cache_dst, &fl6.saddr);local_bh_enable (); -if (unlikely (!dst)) { -struct ipv6hdr *hdr =ipv6_hdr (skb); -struct flowi6 fl6; - -memset (&fl6,0 ,sizeof (fl6)); - fl6.daddr = hdr->daddr; - fl6.saddr = hdr->saddr; - fl6.flowlabel =ip6_flowinfo (hdr); - fl6.flowi6_mark = skb->mark; - fl6.flowi6_proto = hdr->nexthdr; - - dst =ip6_route_output (net,NULL , &fl6); -if (dst->error) { - err = dst->error; -dst_release (dst); - goto drop; - } - -local_bh_disable (); -dst_cache_set_ip6 (&ilwt->cache, dst, &fl6.saddr); -local_bh_enable (); - } + err =skb_cow_head (skb,LL_RESERVED_SPACE (cache_dst->dev)); +if (unlikely (err)) + goto drop; + } +if (!ipv6_addr_equal (&orig_daddr, &ipv6_hdr (skb)->daddr)) {skb_dst_drop (skb); -skb_dst_set (skb, dst); - +skb_dst_set (skb, cache_dst);return dst_output (net, sk, skb); } out:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 165/230 net: ipv6: seg6_iptunnel: mitigate 2-realloc issue
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Iurman <[email protected]>
[ Upstream commit 40475b63761abb6f8fdef960d03228a08662c9c4 ]
This patch mitigates the two-reallocations issue with seg6_iptunnel by providing the dst_entry (in the cache) to the first call to skb_cow_head(). As a result, the very first iteration would still trigger two reallocations (i.e., empty cache), while next iterations would only trigger a single reallocation.
Performance tests before/after applying this patch, which clearly shows the improvement:
- before: https://ibb.co/3Cg4sNH
- after: https://ibb.co/8rQ350r
Stable-dep-of: 92191dd10730 ("net: ipv6: fix dst ref loops in rpl, seg6 and ioam6 lwtunnels")
--- net/ipv6/seg6_iptunnel.c | 85 ++++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 33 deletions(-)
net/ipv6/seg6_iptunnel.c +52 -33
@@ -124,8 +124,8 @@ static __be32 seg6_make_flowlabel(struct net *net, struct sk_buff *skb,return flowlabel; } -/* encapsulate an IPv6 packet within an outer IPv6 header with a given SRH */ -int seg6_do_srh_encap (struct sk_buff *skb,struct ipv6_sr_hdr *osrh,int proto) +static int __seg6_do_srh_encap (struct sk_buff *skb,struct ipv6_sr_hdr *osrh, +int proto,struct dst_entry *cache_dst) {struct dst_entry *dst =skb_dst (skb);struct net *net =dev_net (dst->dev);
@@ -137,7 +137,7 @@ int seg6_do_srh_encap(struct sk_buff *skb, struct ipv6_sr_hdr *osrh, int proto) hdrlen = (osrh->hdrlen +1 ) <<3 ; tot_len = hdrlen +sizeof (*hdr); - err =skb_cow_head (skb, tot_len + skb->mac_len); + err =skb_cow_head (skb, tot_len +dst_dev_overhead (cache_dst, skb));if (unlikely (err))return err;
@@ -197,11 +197,18 @@ int seg6_do_srh_encap(struct sk_buff *skb, struct ipv6_sr_hdr *osrh, int proto)return 0 ; } + +/* encapsulate an IPv6 packet within an outer IPv6 header with a given SRH */ +int seg6_do_srh_encap (struct sk_buff *skb,struct ipv6_sr_hdr *osrh,int proto) +{ +return __seg6_do_srh_encap (skb, osrh, proto,NULL ); +}EXPORT_SYMBOL_GPL (seg6_do_srh_encap);/* encapsulate an IPv6 packet within an outer IPv6 header with reduced SRH */ static int seg6_do_srh_encap_red (struct sk_buff *skb, -struct ipv6_sr_hdr *osrh,int proto) +struct ipv6_sr_hdr *osrh,int proto, +struct dst_entry *cache_dst) {__u8 first_seg = osrh->first_segment;struct dst_entry *dst =skb_dst (skb);
@@ -230,7 +237,7 @@ static int seg6_do_srh_encap_red(struct sk_buff *skb, tot_len = red_hdrlen +sizeof (struct ipv6hdr ); - err =skb_cow_head (skb, tot_len + skb->mac_len); + err =skb_cow_head (skb, tot_len +dst_dev_overhead (cache_dst, skb));if (unlikely (err))return err;
@@ -317,8 +324,8 @@ static int seg6_do_srh_encap_red(struct sk_buff *skb,return 0 ; } -/* insert an SRH within an IPv6 packet, just after the IPv6 header */ -int seg6_do_srh_inline (struct sk_buff *skb,struct ipv6_sr_hdr *osrh) +static int __seg6_do_srh_inline (struct sk_buff *skb,struct ipv6_sr_hdr *osrh, +struct dst_entry *cache_dst) {struct ipv6hdr *hdr, *oldhdr;struct ipv6_sr_hdr *isrh;
@@ -326,7 +333,7 @@ int seg6_do_srh_inline(struct sk_buff *skb, struct ipv6_sr_hdr *osrh) hdrlen = (osrh->hdrlen +1 ) <<3 ; - err =skb_cow_head (skb, hdrlen + skb->mac_len); + err =skb_cow_head (skb, hdrlen +dst_dev_overhead (cache_dst, skb));if (unlikely (err))return err;
@@ -369,9 +376,8 @@ int seg6_do_srh_inline(struct sk_buff *skb, struct ipv6_sr_hdr *osrh)return 0 ; } -EXPORT_SYMBOL_GPL (seg6_do_srh_inline); -static int seg6_do_srh (struct sk_buff *skb) +static int seg6_do_srh (struct sk_buff *skb,struct dst_entry *cache_dst) {struct dst_entry *dst =skb_dst (skb);struct seg6_iptunnel_encap *tinfo;
@@ -384,7 +390,7 @@ static int seg6_do_srh(struct sk_buff *skb)if (skb->protocol !=htons (ETH_P_IPV6 ))return -EINVAL ; - err =seg6_do_srh_inline (skb, tinfo->srh); + err =__seg6_do_srh_inline (skb, tinfo->srh, cache_dst);if (err)return err;break ;
@@ -402,9 +408,11 @@ static int seg6_do_srh(struct sk_buff *skb)return -EINVAL ;if (tinfo->mode ==SEG6_IPTUN_MODE_ENCAP ) - err =seg6_do_srh_encap (skb, tinfo->srh, proto); + err =__seg6_do_srh_encap (skb, tinfo->srh, + proto, cache_dst);else - err =seg6_do_srh_encap_red (skb, tinfo->srh, proto); + err =seg6_do_srh_encap_red (skb, tinfo->srh, + proto, cache_dst);if (err)return err;
@@ -425,11 +433,13 @@ static int seg6_do_srh(struct sk_buff *skb)skb_push (skb, skb->mac_len);if (tinfo->mode ==SEG6_IPTUN_MODE_L2ENCAP ) - err =seg6_do_srh_encap (skb, tinfo->srh, -IPPROTO_ETHERNET ); + err =__seg6_do_srh_encap (skb, tinfo->srh, +IPPROTO_ETHERNET , + cache_dst);else err =seg6_do_srh_encap_red (skb, tinfo->srh, -IPPROTO_ETHERNET ); +IPPROTO_ETHERNET , + cache_dst);if (err)return err;
@@ -444,6 +454,13 @@ static int seg6_do_srh(struct sk_buff *skb)return 0 ; } +/* insert an SRH within an IPv6 packet, just after the IPv6 header */ +int seg6_do_srh_inline (struct sk_buff *skb,struct ipv6_sr_hdr *osrh) +{ +return __seg6_do_srh_inline (skb, osrh,NULL ); +} +EXPORT_SYMBOL_GPL (seg6_do_srh_inline); +static int seg6_input_finish (struct net *net,struct sock *sk,struct sk_buff *skb) {
@@ -458,31 +475,33 @@ static int seg6_input_core(struct net *net, struct sock *sk,struct seg6_lwt *slwt;int err; - err =seg6_do_srh (skb); -if (unlikely (err)) - goto drop; - slwt =seg6_lwt_lwtunnel (orig_dst->lwtstate);local_bh_disable (); dst =dst_cache_get (&slwt->cache); +local_bh_enable (); + + err =seg6_do_srh (skb, dst); +if (unlikely (err)) + goto drop;if (!dst) {ip6_route_input (skb); dst =skb_dst (skb);if (!dst->error) { +local_bh_disable ();dst_cache_set_ip6 (&slwt->cache, dst, &ipv6_hdr (skb)->saddr); +local_bh_enable (); } + + err =skb_cow_head (skb,LL_RESERVED_SPACE (dst->dev)); +if (unlikely (err)) + goto drop; }else {skb_dst_drop (skb);skb_dst_set (skb, dst); } -local_bh_enable (); - - err =skb_cow_head (skb,LL_RESERVED_SPACE (dst->dev)); -if (unlikely (err)) - goto drop;if (static_branch_unlikely (&nf_hooks_lwtunnel_enabled)) return NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT,
@@ -528,16 +547,16 @@ static int seg6_output_core(struct net *net, struct sock *sk,struct seg6_lwt *slwt;int err; - err =seg6_do_srh (skb); -if (unlikely (err)) - goto drop; - slwt =seg6_lwt_lwtunnel (orig_dst->lwtstate);local_bh_disable (); dst =dst_cache_get (&slwt->cache);local_bh_enable (); + err =seg6_do_srh (skb, dst); +if (unlikely (err)) + goto drop; +if (unlikely (!dst)) {struct ipv6hdr *hdr =ipv6_hdr (skb);struct flowi6 fl6;
@@ -559,15 +578,15 @@ static int seg6_output_core(struct net *net, struct sock *sk,local_bh_disable ();dst_cache_set_ip6 (&slwt->cache, dst, &fl6.saddr);local_bh_enable (); + + err =skb_cow_head (skb,LL_RESERVED_SPACE (dst->dev)); +if (unlikely (err)) + goto drop; }skb_dst_drop (skb);skb_dst_set (skb, dst); - err =skb_cow_head (skb,LL_RESERVED_SPACE (dst->dev)); -if (unlikely (err)) - goto drop; -if (static_branch_unlikely (&nf_hooks_lwtunnel_enabled))return NF_HOOK (NFPROTO_IPV6 ,NF_INET_LOCAL_OUT , net, sk, skb,NULL ,skb_dst (skb)->dev, dst_output);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 166/230 net: ipv6: rpl_iptunnel: mitigate 2-realloc issue
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Iurman <[email protected]>
[ Upstream commit 985ec6f5e6235242191370628acb73d7a9f0c0ea ]
This patch mitigates the two-reallocations issue with rpl_iptunnel by providing the dst_entry (in the cache) to the first call to skb_cow_head(). As a result, the very first iteration would still trigger two reallocations (i.e., empty cache), while next iterations would only trigger a single reallocation.
Performance tests before/after applying this patch, which clearly shows there is no impact (it even shows improvement):
- before: https://ibb.co/nQJhqwc
- after: https://ibb.co/4ZvW6wV
Stable-dep-of: 92191dd10730 ("net: ipv6: fix dst ref loops in rpl, seg6 and ioam6 lwtunnels")
--- net/ipv6/rpl_iptunnel.c | 46 ++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 21 deletions(-)
net/ipv6/rpl_iptunnel.c +25 -21
@@ -125,7 +125,8 @@ static void rpl_destroy_state(struct lwtunnel_state *lwt) }static int rpl_do_srh_inline (struct sk_buff *skb,const struct rpl_lwt *rlwt, -const struct ipv6_rpl_sr_hdr *srh) +const struct ipv6_rpl_sr_hdr *srh, +struct dst_entry *cache_dst) {struct ipv6_rpl_sr_hdr *isrh, *csrh;const struct ipv6hdr *oldhdr;
@@ -153,7 +154,7 @@ static int rpl_do_srh_inline(struct sk_buff *skb, const struct rpl_lwt *rlwt, hdrlen = ((csrh->hdrlen +1 ) <<3 ); - err =skb_cow_head (skb, hdrlen + skb->mac_len); + err =skb_cow_head (skb, hdrlen +dst_dev_overhead (cache_dst, skb));if (unlikely (err)) {kfree (buf);return err;
@@ -186,7 +187,8 @@ static int rpl_do_srh_inline(struct sk_buff *skb, const struct rpl_lwt *rlwt,return 0 ; } -static int rpl_do_srh (struct sk_buff *skb,const struct rpl_lwt *rlwt) +static int rpl_do_srh (struct sk_buff *skb,const struct rpl_lwt *rlwt, +struct dst_entry *cache_dst) {struct dst_entry *dst =skb_dst (skb);struct rpl_iptunnel_encap *tinfo;
@@ -196,7 +198,7 @@ static int rpl_do_srh(struct sk_buff *skb, const struct rpl_lwt *rlwt) tinfo =rpl_encap_lwtunnel (dst->lwtstate); -return rpl_do_srh_inline (skb, rlwt, tinfo->srh); +return rpl_do_srh_inline (skb, rlwt, tinfo->srh, cache_dst); }static int rpl_output (struct net *net,struct sock *sk,struct sk_buff *skb)
@@ -208,14 +210,14 @@ static int rpl_output(struct net *net, struct sock *sk, struct sk_buff *skb) rlwt =rpl_lwt_lwtunnel (orig_dst->lwtstate); - err =rpl_do_srh (skb, rlwt); -if (unlikely (err)) - goto drop; -local_bh_disable (); dst =dst_cache_get (&rlwt->cache);local_bh_enable (); + err =rpl_do_srh (skb, rlwt, dst); +if (unlikely (err)) + goto drop; +if (unlikely (!dst)) {struct ipv6hdr *hdr =ipv6_hdr (skb);struct flowi6 fl6;
@@ -237,15 +239,15 @@ static int rpl_output(struct net *net, struct sock *sk, struct sk_buff *skb)local_bh_disable ();dst_cache_set_ip6 (&rlwt->cache, dst, &fl6.saddr);local_bh_enable (); + + err =skb_cow_head (skb,LL_RESERVED_SPACE (dst->dev)); +if (unlikely (err)) + goto drop; }skb_dst_drop (skb);skb_dst_set (skb, dst); - err =skb_cow_head (skb,LL_RESERVED_SPACE (dst->dev)); -if (unlikely (err)) - goto drop; -return dst_output (net, sk, skb); drop:
@@ -262,29 +264,31 @@ static int rpl_input(struct sk_buff *skb) rlwt =rpl_lwt_lwtunnel (orig_dst->lwtstate); - err =rpl_do_srh (skb, rlwt); -if (unlikely (err)) - goto drop; -local_bh_disable (); dst =dst_cache_get (&rlwt->cache); +local_bh_enable (); + + err =rpl_do_srh (skb, rlwt, dst); +if (unlikely (err)) + goto drop;if (!dst) {ip6_route_input (skb); dst =skb_dst (skb);if (!dst->error) { +local_bh_disable ();dst_cache_set_ip6 (&rlwt->cache, dst, &ipv6_hdr (skb)->saddr); +local_bh_enable (); } + + err =skb_cow_head (skb,LL_RESERVED_SPACE (dst->dev)); +if (unlikely (err)) + goto drop; }else {skb_dst_drop (skb);skb_dst_set (skb, dst); } -local_bh_enable (); - - err =skb_cow_head (skb,LL_RESERVED_SPACE (dst->dev)); -if (unlikely (err)) - goto drop;return dst_input (skb);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 167/230 net: ipv6: fix dst ref loops in rpl, seg6 and ioam6 lwtunnels
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 92191dd1073088753821b862b791dcc83e558e07 ]
Some lwtunnels have a dst cache for post-transformation dst. If the packet destination did not change we may end up recording a reference to the lwtunnel in its own cache, and the lwtunnel state will never be freed.
Discovered by the ioam6.sh test, kmemleak was recently fixed to catch per-cpu memory leaks. I'm not sure if rpl and seg6 can actually hit this, but in principle I don't see why not.
--- net/ipv6/ioam6_iptunnel.c | 9 ++++++--- net/ipv6/rpl_iptunnel.c | 9 ++++++--- net/ipv6/seg6_iptunnel.c | 9 ++++++--- 3 files changed, 18 insertions(+), 9 deletions(-)
net/ipv6/ioam6_iptunnel.c +6 -3
@@ -413,9 +413,12 @@ static int ioam6_output(struct net *net, struct sock *sk, struct sk_buff *skb) goto drop; } -local_bh_disable (); -dst_cache_set_ip6 (&ilwt->cache, cache_dst, &fl6.saddr); -local_bh_enable (); +/* cache only if we don't create a dst reference loop */ +if (dst->lwtstate != cache_dst->lwtstate) { +local_bh_disable (); +dst_cache_set_ip6 (&ilwt->cache, cache_dst, &fl6.saddr); +local_bh_enable (); + } err =skb_cow_head (skb,LL_RESERVED_SPACE (cache_dst->dev));if (unlikely (err))
net/ipv6/rpl_iptunnel.c +6 -3
@@ -236,9 +236,12 @@ static int rpl_output(struct net *net, struct sock *sk, struct sk_buff *skb) goto drop; } -local_bh_disable (); -dst_cache_set_ip6 (&rlwt->cache, dst, &fl6.saddr); -local_bh_enable (); +/* cache only if we don't create a dst reference loop */ +if (orig_dst->lwtstate != dst->lwtstate) { +local_bh_disable (); +dst_cache_set_ip6 (&rlwt->cache, dst, &fl6.saddr); +local_bh_enable (); + } err =skb_cow_head (skb,LL_RESERVED_SPACE (dst->dev));if (unlikely (err))
net/ipv6/seg6_iptunnel.c +6 -3
@@ -575,9 +575,12 @@ static int seg6_output_core(struct net *net, struct sock *sk, goto drop; } -local_bh_disable (); -dst_cache_set_ip6 (&slwt->cache, dst, &fl6.saddr); -local_bh_enable (); +/* cache only if we don't create a dst reference loop */ +if (orig_dst->lwtstate != dst->lwtstate) { +local_bh_disable (); +dst_cache_set_ip6 (&slwt->cache, dst, &fl6.saddr); +local_bh_enable (); + } err =skb_cow_head (skb,LL_RESERVED_SPACE (dst->dev));if (unlikely (err))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 168/230 clocksource: Use pr_info() for "Checking clocksource synchronization" message
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <[email protected]>
[ Upstream commit 1f566840a82982141f94086061927a90e79440e5 ]
The "Checking clocksource synchronization" message is normally printed when clocksource_verify_percpu() is called for a given clocksource if both the CLOCK_SOURCE_UNSTABLE and CLOCK_SOURCE_VERIFY_PERCPU flags are set.
It is an informational message and so pr_info() is the correct choice.
Stable-dep-of: 6bb05a33337b ("clocksource: Use migrate_disable() to avoid calling get_random_u32() in atomic context")
--- kernel/time/clocksource.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/time/clocksource.c +2 -1
@@ -374,7 +374,8 @@ void clocksource_verify_percpu(struct clocksource *cs)return ; } testcpu =smp_processor_id (); -pr_warn ("Checking clocksource %s synchronization from CPU %d to CPUs %*pbl.\n" , cs->name, testcpu,cpumask_pr_args (&cpus_chosen)); +pr_info ("Checking clocksource %s synchronization from CPU %d to CPUs %*pbl.\n" , + cs->name, testcpu,cpumask_pr_args (&cpus_chosen));for_each_cpu (cpu, &cpus_chosen) {if (cpu == testcpu)continue ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 169/230 clocksource: Use migrate_disable() to avoid calling get_random_u32() in atomic context
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <[email protected]>
[ Upstream commit 6bb05a33337b2c842373857b63de5c9bf1ae2a09 ]
The following bug report happened with a PREEMPT_RT kernel:
BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 2012, name: kwatchdog preempt_count: 1, expected: 0 RCU nest depth: 0, expected: 0 get_random_u32+0x4f/0x110 clocksource_verify_choose_cpus+0xab/0x1a0 clocksource_verify_percpu.part.0+0x6b/0x330 clocksource_watchdog_kthread+0x193/0x1a0
It is due to the fact that clocksource_verify_choose_cpus() is invoked with preemption disabled. This function invokes get_random_u32() to obtain random numbers for choosing CPUs. The batched_entropy_32 local lock and/or the base_crng.lock spinlock in driver/char/random.c will be acquired during the call. In PREEMPT_RT kernel, they are both sleeping locks and so cannot be acquired in atomic context.
Fix this problem by using migrate_disable() to allow smp_processor_id() to be reliably used without introducing atomic context. preempt_disable() is then called after clocksource_verify_choose_cpus() but before the clocksource measurement is being run to avoid introducing unexpected latency.
--- kernel/time/clocksource.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/time/clocksource.c +4 -2
@@ -365,10 +365,10 @@ void clocksource_verify_percpu(struct clocksource *cs)cpumask_clear (&cpus_ahead);cpumask_clear (&cpus_behind);cpus_read_lock (); -preempt_disable (); +migrate_disable ();clocksource_verify_choose_cpus ();if (cpumask_empty (&cpus_chosen)) { -preempt_enable (); +migrate_enable ();cpus_read_unlock ();pr_warn ("Not enough CPUs to check clocksource '%s'.\n" , cs->name);return ;
@@ -376,6 +376,7 @@ void clocksource_verify_percpu(struct clocksource *cs) testcpu =smp_processor_id ();pr_info ("Checking clocksource %s synchronization from CPU %d to CPUs %*pbl.\n" , cs->name, testcpu,cpumask_pr_args (&cpus_chosen)); +preempt_disable ();for_each_cpu (cpu, &cpus_chosen) {if (cpu == testcpu)continue ;
@@ -395,6 +396,7 @@ void clocksource_verify_percpu(struct clocksource *cs) cs_nsec_min = cs_nsec; }preempt_enable (); +migrate_enable ();cpus_read_unlock ();if (!cpumask_empty (&cpus_ahead)) pr_warn(" CPUs %*pbl ahead of CPU %d for clocksource %s.\n",
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 170/230 scsi: ufs: core: Introduce ufshcd_has_pending_tasks()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avri Altman <[email protected]>
[ Upstream commit e738ba458e7539be1757dcdf85835a5c7b11fad4 ]
Prepare to remove hba->clk_gating.active_reqs check from ufshcd_is_ufs_dev_busy().
Stable-dep-of: 839a74b5649c ("scsi: ufs: Fix toggling of clk_gating.state when clock gating is not allowed")
--- drivers/ufs/core/ufshcd.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/ufs/core/ufshcd.c +9 -4
@@ -258,10 +258,16 @@ ufs_get_desired_pm_lvl_for_dev_link_state(enum ufs_dev_pwr_mode dev_state,return UFS_PM_LVL_0 ; } +static bool ufshcd_has_pending_tasks (struct ufs_hba *hba) +{ +return hba->outstanding_tasks || hba->active_uic_cmd || + hba->uic_async_done; +} +static bool ufshcd_is_ufs_dev_busy (struct ufs_hba *hba) { -return (hba->clk_gating.active_reqs || hba->outstanding_reqs || hba->outstanding_tasks || - hba->active_uic_cmd || hba->uic_async_done); +return hba->clk_gating.active_reqs || hba->outstanding_reqs || +ufshcd_has_pending_tasks (hba); }static const struct ufs_dev_quirk ufs_fixups[] = {
@@ -2023,8 +2029,7 @@ static void __ufshcd_release(struct ufs_hba *hba)if (hba->clk_gating.active_reqs || hba->clk_gating.is_suspended || hba->ufshcd_state !=UFSHCD_STATE_OPERATIONAL || - hba->outstanding_tasks || !hba->clk_gating.is_initialized || - hba->active_uic_cmd || hba->uic_async_done || +ufshcd_has_pending_tasks (hba) || !hba->clk_gating.is_initialized || hba->clk_gating.state ==CLKS_OFF )return ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 171/230 scsi: ufs: core: Prepare to introduce a new clock_gating lock
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avri Altman <[email protected]>
[ Upstream commit 7869c6521f5715688b3d1f1c897374a68544eef0 ]
Remove hba->clk_gating.active_reqs check from ufshcd_is_ufs_dev_busy() function to separate clock gating logic from general device busy checks.
Stable-dep-of: 839a74b5649c ("scsi: ufs: Fix toggling of clk_gating.state when clock gating is not allowed")
--- drivers/ufs/core/ufshcd.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/ufs/core/ufshcd.c +7 -4
@@ -266,8 +266,7 @@ static bool ufshcd_has_pending_tasks(struct ufs_hba *hba)static bool ufshcd_is_ufs_dev_busy (struct ufs_hba *hba) { -return hba->clk_gating.active_reqs || hba->outstanding_reqs || -ufshcd_has_pending_tasks (hba); +return hba->outstanding_reqs ||ufshcd_has_pending_tasks (hba); }static const struct ufs_dev_quirk ufs_fixups[] = {
@@ -1973,7 +1972,9 @@ static void ufshcd_gate_work(struct work_struct *work) goto rel_lock; } -if (ufshcd_is_ufs_dev_busy (hba) || hba->ufshcd_state !=UFSHCD_STATE_OPERATIONAL ) +if (ufshcd_is_ufs_dev_busy (hba) || + hba->ufshcd_state !=UFSHCD_STATE_OPERATIONAL || + hba->clk_gating.active_reqs) goto rel_lock;spin_unlock_irqrestore (hba->host->host_lock, flags);
@@ -8272,7 +8273,9 @@ static void ufshcd_rtc_work(struct work_struct *work) hba = container_of(to_delayed_work(work), struct ufs_hba, ufs_rtc_update_work);/* Update RTC only when there are no requests in progress and UFSHCI is operational */ -if (!ufshcd_is_ufs_dev_busy (hba) && hba->ufshcd_state ==UFSHCD_STATE_OPERATIONAL ) +if (!ufshcd_is_ufs_dev_busy (hba) && + hba->ufshcd_state ==UFSHCD_STATE_OPERATIONAL && + !hba->clk_gating.active_reqs)ufshcd_update_rtc (hba);if (ufshcd_is_ufs_dev_active (hba) && hba->dev_info.rtc_update_period)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 172/230 scsi: ufs: core: Introduce a new clock_gating lock
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avri Altman <[email protected]>
[ Upstream commit 209f4e43b8068c24cde227f464111030430153fa ]
Introduce a new clock gating lock to serialize access to some of the clock gating members instead of the host_lock.
While at it, simplify the code with the guard() macro and co for automatic cleanup of the new lock. There are some explicit spin_lock_irqsave()/spin_unlock_irqrestore() snaking instances I left behind because I couldn't make heads or tails of it.
Additionally, move the trace_ufshcd_clk_gating() call from inside the region protected by the lock as it doesn't needs protection.
Stable-dep-of: 839a74b5649c ("scsi: ufs: Fix toggling of clk_gating.state when clock gating is not allowed")
--- drivers/ufs/core/ufshcd.c | 109 ++++++++++++++++++-------------------- include/ufs/ufshcd.h | 9 +++- 2 files changed, 59 insertions(+), 59 deletions(-)
drivers/ufs/core/ufshcd.c +52 -57
@@ -1840,19 +1840,16 @@ static void ufshcd_exit_clk_scaling(struct ufs_hba *hba)static void ufshcd_ungate_work (struct work_struct *work) {int ret; -unsigned long flags; struct ufs_hba *hba = container_of(work, struct ufs_hba, clk_gating.ungate_work);cancel_delayed_work_sync (&hba->clk_gating.gate_work); -spin_lock_irqsave (hba->host->host_lock, flags); -if (hba->clk_gating.state ==CLKS_ON ) { -spin_unlock_irqrestore (hba->host->host_lock, flags); -return ; + scoped_guard(spinlock_irqsave, &hba->clk_gating.lock) { +if (hba->clk_gating.state ==CLKS_ON ) +return ; } -spin_unlock_irqrestore (hba->host->host_lock, flags);ufshcd_hba_vreg_set_hpm (hba);ufshcd_setup_clocks (hba, true);
@@ -1887,7 +1884,7 @@ void ufshcd_hold(struct ufs_hba *hba)if (!ufshcd_is_clkgating_allowed (hba) || !hba->clk_gating.is_initialized)return ; -spin_lock_irqsave (hba->host->host_lock, flags); +spin_lock_irqsave (&hba->clk_gating.lock, flags); hba->clk_gating.active_reqs++; start:
@@ -1903,11 +1900,11 @@ void ufshcd_hold(struct ufs_hba *hba)*/ if (ufshcd_can_hibern8_during_gating (hba) &&ufshcd_is_link_hibern8 (hba)) { -spin_unlock_irqrestore (hba->host->host_lock, flags); +spin_unlock_irqrestore (&hba->clk_gating.lock, flags); flush_result =flush_work (&hba->clk_gating.ungate_work);if (hba->clk_gating.is_suspended && !flush_result)return ; -spin_lock_irqsave (hba->host->host_lock, flags); +spin_lock_irqsave (&hba->clk_gating.lock, flags); goto start; }break ;
@@ -1936,17 +1933,17 @@ void ufshcd_hold(struct ufs_hba *hba)*/ fallthrough;case REQ_CLKS_ON : -spin_unlock_irqrestore (hba->host->host_lock, flags); +spin_unlock_irqrestore (&hba->clk_gating.lock, flags);flush_work (&hba->clk_gating.ungate_work);/* Make sure state is CLKS_ON before returning */ -spin_lock_irqsave (hba->host->host_lock, flags); +spin_lock_irqsave (&hba->clk_gating.lock, flags); goto start;default :dev_err (hba->dev,"%s: clk gating is in invalid state %d\n" , __func__, hba->clk_gating.state);break ; } -spin_unlock_irqrestore (hba->host->host_lock, flags); +spin_unlock_irqrestore (&hba->clk_gating.lock, flags); }EXPORT_SYMBOL_GPL (ufshcd_hold);
@@ -1954,30 +1951,32 @@ static void ufshcd_gate_work(struct work_struct *work) { struct ufs_hba *hba = container_of(work, struct ufs_hba, clk_gating.gate_work.work); -unsigned long flags;int ret; -spin_lock_irqsave (hba->host->host_lock, flags); -/* -* In case you are here to cancel this work the gating state -* would be marked as REQ_CLKS_ON. In this case save time by -* skipping the gating work and exit after changing the clock -* state to CLKS_ON. -*/ -if (hba->clk_gating.is_suspended || - (hba->clk_gating.state !=REQ_CLKS_OFF )) { - hba->clk_gating.state =CLKS_ON ; -trace_ufshcd_clk_gating (dev_name (hba->dev), - hba->clk_gating.state); - goto rel_lock; - } + scoped_guard(spinlock_irqsave, &hba->clk_gating.lock) { +/* +* In case you are here to cancel this work the gating state +* would be marked as REQ_CLKS_ON. In this case save time by +* skipping the gating work and exit after changing the clock +* state to CLKS_ON. +*/ +if (hba->clk_gating.is_suspended || + hba->clk_gating.state !=REQ_CLKS_OFF ) { + hba->clk_gating.state =CLKS_ON ; +trace_ufshcd_clk_gating (dev_name (hba->dev), + hba->clk_gating.state); +return ; + } -if (ufshcd_is_ufs_dev_busy (hba) || - hba->ufshcd_state !=UFSHCD_STATE_OPERATIONAL || - hba->clk_gating.active_reqs) - goto rel_lock; +if (hba->clk_gating.active_reqs) +return ; + } -spin_unlock_irqrestore (hba->host->host_lock, flags); + scoped_guard(spinlock_irqsave, hba->host->host_lock) { +if (ufshcd_is_ufs_dev_busy (hba) || + hba->ufshcd_state !=UFSHCD_STATE_OPERATIONAL ) +return ; + }/* put the link into hibern8 mode before turning off clocks */ if (ufshcd_can_hibern8_during_gating (hba)) {
@@ -1988,7 +1987,7 @@ static void ufshcd_gate_work(struct work_struct *work) __func__, ret);trace_ufshcd_clk_gating (dev_name (hba->dev), hba->clk_gating.state); - goto out; +return ; }ufshcd_set_link_hibern8 (hba); }
@@ -2008,32 +2007,34 @@ static void ufshcd_gate_work(struct work_struct *work)* prevent from doing cancel work multiple times when there are * new requests arriving before the current cancel work is done. */ -spin_lock_irqsave (hba->host->host_lock, flags); +guard (spinlock_irqsave)(&hba->clk_gating.lock);if (hba->clk_gating.state ==REQ_CLKS_OFF ) { hba->clk_gating.state =CLKS_OFF ;trace_ufshcd_clk_gating (dev_name (hba->dev), hba->clk_gating.state); } -rel_lock: -spin_unlock_irqrestore (hba->host->host_lock, flags); -out: -return ; } -/* host lock must be held before calling this variant */ static void __ufshcd_release (struct ufs_hba *hba) { +lockdep_assert_held (&hba->clk_gating.lock); +if (!ufshcd_is_clkgating_allowed (hba))return ; hba->clk_gating.active_reqs--;if (hba->clk_gating.active_reqs || hba->clk_gating.is_suspended || - hba->ufshcd_state !=UFSHCD_STATE_OPERATIONAL || -ufshcd_has_pending_tasks (hba) || !hba->clk_gating.is_initialized || + !hba->clk_gating.is_initialized || hba->clk_gating.state ==CLKS_OFF )return ; + scoped_guard(spinlock_irqsave, hba->host->host_lock) { +if (ufshcd_has_pending_tasks (hba) || + hba->ufshcd_state !=UFSHCD_STATE_OPERATIONAL ) +return ; + } + hba->clk_gating.state =REQ_CLKS_OFF ;trace_ufshcd_clk_gating (dev_name (hba->dev), hba->clk_gating.state); queue_delayed_work(hba->clk_gating.clk_gating_workq,
@@ -2043,11 +2044,8 @@ static void __ufshcd_release(struct ufs_hba *hba)void ufshcd_release (struct ufs_hba *hba) { -unsigned long flags; - -spin_lock_irqsave (hba->host->host_lock, flags); +guard (spinlock_irqsave)(&hba->clk_gating.lock);__ufshcd_release (hba); -spin_unlock_irqrestore (hba->host->host_lock, flags); }EXPORT_SYMBOL_GPL (ufshcd_release);
@@ -2062,11 +2060,9 @@ static ssize_t ufshcd_clkgate_delay_show(struct device *dev,void ufshcd_clkgate_delay_set (struct device *dev,unsigned long value) {struct ufs_hba *hba =dev_get_drvdata (dev); -unsigned long flags; -spin_lock_irqsave (hba->host->host_lock, flags); +guard (spinlock_irqsave)(&hba->clk_gating.lock); hba->clk_gating.delay_ms = value; -spin_unlock_irqrestore (hba->host->host_lock, flags); }EXPORT_SYMBOL_GPL (ufshcd_clkgate_delay_set);
@@ -2094,7 +2090,6 @@ static ssize_t ufshcd_clkgate_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct ufs_hba *hba = dev_get_drvdata(dev); -unsigned long flags;u32 value;if (kstrtou32 (buf,0 , &value))
@@ -2102,9 +2097,10 @@ static ssize_t ufshcd_clkgate_enable_store(struct device *dev, value = !!value; -spin_lock_irqsave (hba->host->host_lock, flags); +guard (spinlock_irqsave)(&hba->clk_gating.lock); +if (value == hba->clk_gating.is_enabled) - goto out; +return count;if (value)__ufshcd_release (hba);
@@ -2112,8 +2108,7 @@ static ssize_t ufshcd_clkgate_enable_store(struct device *dev, hba->clk_gating.active_reqs++; hba->clk_gating.is_enabled = value; -out: -spin_unlock_irqrestore (hba->host->host_lock, flags); +return count; }
@@ -2155,6 +2150,8 @@ static void ufshcd_init_clk_gating(struct ufs_hba *hba)INIT_DELAYED_WORK (&hba->clk_gating.gate_work, ufshcd_gate_work);INIT_WORK (&hba->clk_gating.ungate_work, ufshcd_ungate_work); +spin_lock_init (&hba->clk_gating.lock); + hba->clk_gating.clk_gating_workq =alloc_ordered_workqueue ("ufs_clk_gating_%d" ,WQ_MEM_RECLAIM |WQ_HIGHPRI , hba->host->host_no);
@@ -9194,7 +9191,6 @@ static int ufshcd_setup_clocks(struct ufs_hba *hba, bool on)int ret =0 ;struct ufs_clk_info *clki;struct list_head *head = &hba->clk_list_head; -unsigned long flags;ktime_t start =ktime_get ();bool clk_state_changed = false;
@@ -9245,11 +9241,10 @@ static int ufshcd_setup_clocks(struct ufs_hba *hba, bool on)clk_disable_unprepare (clki->clk); } }else if (!ret && on) { -spin_lock_irqsave (hba->host->host_lock, flags); - hba->clk_gating.state =CLKS_ON ; +scoped_guard (spinlock_irqsave, &hba->clk_gating.lock) + hba->clk_gating.state = CLKS_ON;trace_ufshcd_clk_gating (dev_name (hba->dev), hba->clk_gating.state); -spin_unlock_irqrestore (hba->host->host_lock, flags); }if (clk_state_changed)
include/ufs/ufshcd.h +7 -2
@@ -402,6 +402,9 @@ enum clk_gating_state {* delay_ms * @ungate_work: worker to turn on clocks that will be used in case of * interrupt context +* @clk_gating_workq: workqueue for clock gating work. +* @lock: serialize access to some struct ufs_clk_gating members. An outer lock +* relative to the host lock * @state: the current clocks state * @delay_ms: gating delay in ms * @is_suspended: clk gating is suspended when set to 1 which can be used
@@ -412,11 +415,14 @@ enum clk_gating_state {* @is_initialized: Indicates whether clock gating is initialized or not * @active_reqs: number of requests that are pending and should be waited for * completion before gating clocks. -* @clk_gating_workq: workqueue for clock gating work. */ struct ufs_clk_gating {struct delayed_work gate_work;struct work_struct ungate_work; +struct workqueue_struct *clk_gating_workq; + +spinlock_t lock; +enum clk_gating_state state;unsigned long delay_ms;bool is_suspended;
@@ -425,7 +431,6 @@ struct ufs_clk_gating {bool is_enabled;bool is_initialized;int active_reqs; -struct workqueue_struct *clk_gating_workq; };/**
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 173/230 scsi: ufs: Fix toggling of clk_gating.state when clock gating is not allowed
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avri Altman <[email protected]>
[ Upstream commit 839a74b5649c9f41d939a05059b5ca6b17156d03 ]
This commit addresses an issue where clk_gating.state is being toggled in ufshcd_setup_clocks() even if clock gating is not allowed.
The fix is to add a check for hba->clk_gating.is_initialized before toggling clk_gating.state in ufshcd_setup_clocks().
Since clk_gating.lock is now initialized unconditionally, it can no longer lead to the spinlock being used before it is properly initialized, but instead it is mostly for documentation purposes.
--- drivers/ufs/core/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c +1 -1
@@ -9240,7 +9240,7 @@ static int ufshcd_setup_clocks(struct ufs_hba *hba, bool on)if (!IS_ERR_OR_NULL (clki->clk) && clki->enabled)clk_disable_unprepare (clki->clk); } - }else if (!ret && on) { + }else if (!ret && on && hba->clk_gating.is_initialized) {scoped_guard (spinlock_irqsave, &hba->clk_gating.lock) hba->clk_gating.state = CLKS_ON; trace_ufshcd_clk_gating(dev_name(hba->dev),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 174/230 rust: kbuild: add -fzero-init-padding-bits to bindgen_skip_cflags
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin M. Forbes <[email protected]>
[ Upstream commit a9c621a217128eb3fb7522cf763992d9437fd5ba ]
This seems to break the build when building with gcc15:
Unable to generate bindings: ClangDiagnostic("error: unknown
argument: '-fzero-init-padding-bits=all'\n")
Thus skip that flag.
--- rust/Makefile | 1 + 1 file changed, 1 insertion(+)
rust/Makefile +1 -0
@@ -229,6 +229,7 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \ -fzero-call-used-regs=% -fno-stack-clash-protection \ -fno-inline-functions-called-once -fsanitize=bounds-strict \ -fstrict-flex-arrays=% -fmin-function-alignment=% \ + -fzero-init-padding-bits=% \ --param=% --param asan-% # Derived from `scripts/Makefile.clang`.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 175/230 cpufreq/amd-pstate: Call cppc_set_epp_perf in the reenable function
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dhananjay Ugwekar <[email protected]>
[ Upstream commit 796ff50e127af8362035f87ba29b6b84e2dd9742 ]
The EPP value being set in perf_ctrls.energy_perf is not being propagated to the shared memory, fix that.
Stable-dep-of: 3ace20038e19 ("cpufreq/amd-pstate: Fix cpufreq_policy ref counting")
--- drivers/cpufreq/amd-pstate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/cpufreq/amd-pstate.c +4 -2
@@ -1594,8 +1594,9 @@ static void amd_pstate_epp_reenable(struct amd_cpudata *cpudata)wrmsrl_on_cpu (cpudata->cpu,MSR_AMD_CPPC_REQ , value); }else { perf_ctrls.max_perf = max_perf; - perf_ctrls.energy_perf =AMD_CPPC_ENERGY_PERF_PREF (cpudata->epp_cached);cppc_set_perf (cpudata->cpu, &perf_ctrls); + perf_ctrls.energy_perf =AMD_CPPC_ENERGY_PERF_PREF (cpudata->epp_cached); +cppc_set_epp_perf (cpudata->cpu, &perf_ctrls,1 ); } }
@@ -1636,8 +1637,9 @@ static void amd_pstate_epp_offline(struct cpufreq_policy *policy) }else { perf_ctrls.desired_perf =0 ; perf_ctrls.max_perf = min_perf; - perf_ctrls.energy_perf =AMD_CPPC_ENERGY_PERF_PREF (HWP_EPP_BALANCE_POWERSAVE );cppc_set_perf (cpudata->cpu, &perf_ctrls); + perf_ctrls.energy_perf =AMD_CPPC_ENERGY_PERF_PREF (HWP_EPP_BALANCE_POWERSAVE ); +cppc_set_epp_perf (cpudata->cpu, &perf_ctrls,1 ); }mutex_unlock (&amd_pstate_limits_lock); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 176/230 cpufreq/amd-pstate: Align offline flow of shared memory and MSR based systems
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dhananjay Ugwekar <[email protected]>
[ Upstream commit a6960e6b1b0e2cb268f427a99040c408a8d10665 ]
Set min_perf to lowest_perf for shared memory systems, similar to the MSR based systems.
Stable-dep-of: 3ace20038e19 ("cpufreq/amd-pstate: Fix cpufreq_policy ref counting")
--- drivers/cpufreq/amd-pstate.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/amd-pstate.c +1 -0
@@ -1636,6 +1636,7 @@ static void amd_pstate_epp_offline(struct cpufreq_policy *policy)wrmsrl_on_cpu (cpudata->cpu,MSR_AMD_CPPC_REQ , value); }else { perf_ctrls.desired_perf =0 ; + perf_ctrls.min_perf = min_perf; perf_ctrls.max_perf = min_perf;cppc_set_perf (cpudata->cpu, &perf_ctrls); perf_ctrls.energy_perf =AMD_CPPC_ENERGY_PERF_PREF (HWP_EPP_BALANCE_POWERSAVE );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 177/230 cpufreq/amd-pstate: Refactor amd_pstate_epp_reenable() and amd_pstate_epp_offline()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dhananjay Ugwekar <[email protected]>
[ Upstream commit b1089e0c8817fda93d474eaa82ad86386887aefe ]
Replace similar code chunks with amd_pstate_update_perf() and amd_pstate_set_epp() function calls.
Stable-dep-of: 3ace20038e19 ("cpufreq/amd-pstate: Fix cpufreq_policy ref counting")
--- drivers/cpufreq/amd-pstate.c | 38 +++++++----------------------------- 1 file changed, 7 insertions(+), 31 deletions(-)
drivers/cpufreq/amd-pstate.c +7 -31
@@ -1579,25 +1579,17 @@ static int amd_pstate_epp_set_policy(struct cpufreq_policy *policy)static void amd_pstate_epp_reenable (struct amd_cpudata *cpudata) { -struct cppc_perf_ctrls perf_ctrls; -u64 value, max_perf; +u64 max_perf;int ret; ret =amd_pstate_enable (true);if (ret)pr_err ("failed to enable amd pstate during resume, return %d\n" , ret); - value =READ_ONCE (cpudata->cppc_req_cached); max_perf =READ_ONCE (cpudata->highest_perf); -if (cpu_feature_enabled (X86_FEATURE_CPPC )) { -wrmsrl_on_cpu (cpudata->cpu,MSR_AMD_CPPC_REQ , value); - }else { - perf_ctrls.max_perf = max_perf; -cppc_set_perf (cpudata->cpu, &perf_ctrls); - perf_ctrls.energy_perf =AMD_CPPC_ENERGY_PERF_PREF (cpudata->epp_cached); -cppc_set_epp_perf (cpudata->cpu, &perf_ctrls,1 ); - } +amd_pstate_update_perf (cpudata,0 ,0 , max_perf, false); +amd_pstate_set_epp (cpudata, cpudata->epp_cached); }static int amd_pstate_epp_cpu_online (struct cpufreq_policy *policy)
@@ -1617,31 +1609,15 @@ static int amd_pstate_epp_cpu_online(struct cpufreq_policy *policy)static void amd_pstate_epp_offline (struct cpufreq_policy *policy) {struct amd_cpudata *cpudata = policy->driver_data; -struct cppc_perf_ctrls perf_ctrls;int min_perf; -u64 value; min_perf =READ_ONCE (cpudata->lowest_perf); - value =READ_ONCE (cpudata->cppc_req_cached);mutex_lock (&amd_pstate_limits_lock); -if (cpu_feature_enabled (X86_FEATURE_CPPC )) { - cpudata->epp_policy =CPUFREQ_POLICY_UNKNOWN ; - -/* Set max perf same as min perf */ - value &= ~AMD_CPPC_MAX_PERF (~0L ); - value |=AMD_CPPC_MAX_PERF (min_perf); - value &= ~AMD_CPPC_MIN_PERF (~0L ); - value |=AMD_CPPC_MIN_PERF (min_perf); -wrmsrl_on_cpu (cpudata->cpu,MSR_AMD_CPPC_REQ , value); - }else { - perf_ctrls.desired_perf =0 ; - perf_ctrls.min_perf = min_perf; - perf_ctrls.max_perf = min_perf; -cppc_set_perf (cpudata->cpu, &perf_ctrls); - perf_ctrls.energy_perf =AMD_CPPC_ENERGY_PERF_PREF (HWP_EPP_BALANCE_POWERSAVE ); -cppc_set_epp_perf (cpudata->cpu, &perf_ctrls,1 ); - } + +amd_pstate_update_perf (cpudata, min_perf,0 , min_perf, false); +amd_pstate_set_epp (cpudata,AMD_CPPC_EPP_BALANCE_POWERSAVE ); +mutex_unlock (&amd_pstate_limits_lock); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 178/230 cpufreq/amd-pstate: Remove the cppc_state check in offline/online functions
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dhananjay Ugwekar <[email protected]>
[ Upstream commit b78f8c87ec3e7499bb049986838636d3afbc7ece ]
Only amd_pstate_epp driver (i.e. cppc_state = ACTIVE) enters the amd_pstate_epp_offline() and amd_pstate_epp_cpu_online() functions, so remove the unnecessary if condition checking if cppc_state is equal to AMD_PSTATE_ACTIVE.
Stable-dep-of: 3ace20038e19 ("cpufreq/amd-pstate: Fix cpufreq_policy ref counting")
--- drivers/cpufreq/amd-pstate.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/cpufreq/amd-pstate.c +3 -6
@@ -1598,10 +1598,8 @@ static int amd_pstate_epp_cpu_online(struct cpufreq_policy *policy)pr_debug ("AMD CPU Core %d going online\n" , cpudata->cpu); -if (cppc_state ==AMD_PSTATE_ACTIVE ) { -amd_pstate_epp_reenable (cpudata); - cpudata->suspended = false; - } +amd_pstate_epp_reenable (cpudata); + cpudata->suspended = false;return 0 ; }
@@ -1630,8 +1628,7 @@ static int amd_pstate_epp_cpu_offline(struct cpufreq_policy *policy)if (cpudata->suspended)return 0 ; -if (cppc_state ==AMD_PSTATE_ACTIVE ) -amd_pstate_epp_offline (policy); +amd_pstate_epp_offline (policy);return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 179/230 cpufreq/amd-pstate: Merge amd_pstate_epp_cpu_offline() and amd_pstate_epp_offline()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dhananjay Ugwekar <[email protected]>
[ Upstream commit 53ec2101dfede8fecdd240662281a12e537c3411 ]
amd_pstate_epp_offline() is only called from within amd_pstate_epp_cpu_offline() and doesn't make much sense to have it at all. Hence, remove it.
Also remove the unncessary debug print in the offline path while at it.
Stable-dep-of: 3ace20038e19 ("cpufreq/amd-pstate: Fix cpufreq_policy ref counting")
--- drivers/cpufreq/amd-pstate.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
drivers/cpufreq/amd-pstate.c +4 -13
@@ -1604,11 +1604,14 @@ static int amd_pstate_epp_cpu_online(struct cpufreq_policy *policy)return 0 ; } -static void amd_pstate_epp_offline (struct cpufreq_policy *policy) +static int amd_pstate_epp_cpu_offline (struct cpufreq_policy *policy) {struct amd_cpudata *cpudata = policy->driver_data;int min_perf; +if (cpudata->suspended) +return 0 ; + min_perf =READ_ONCE (cpudata->lowest_perf);mutex_lock (&amd_pstate_limits_lock);
@@ -1617,18 +1620,6 @@ static void amd_pstate_epp_offline(struct cpufreq_policy *policy)amd_pstate_set_epp (cpudata,AMD_CPPC_EPP_BALANCE_POWERSAVE );mutex_unlock (&amd_pstate_limits_lock); -} - -static int amd_pstate_epp_cpu_offline (struct cpufreq_policy *policy) -{ -struct amd_cpudata *cpudata = policy->driver_data; - -pr_debug ("AMD CPU Core %d going offline\n" , cpudata->cpu); - -if (cpudata->suspended) -return 0 ; - -amd_pstate_epp_offline (policy);return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 180/230 cpufreq/amd-pstate: convert mutex use to guard()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit 6c093d5a5b73ec1caf1e706510ae6031af2f9d43 ]
Using scoped guard declaration will unlock mutexes automatically.
Stable-dep-of: 3ace20038e19 ("cpufreq/amd-pstate: Fix cpufreq_policy ref counting")
--- drivers/cpufreq/amd-pstate.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-)
drivers/cpufreq/amd-pstate.c +12 -20
@@ -696,12 +696,12 @@ static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state)pr_err ("Boost mode is not supported by this processor or SBIOS\n" );return -EOPNOTSUPP ; } -mutex_lock (&amd_pstate_driver_lock); +guard (mutex)(&amd_pstate_driver_lock); + ret =amd_pstate_cpu_boost_update (policy, state);WRITE_ONCE (cpudata->boost_state, !ret ? state : false); policy->boost_enabled = !ret ? state : false;refresh_frequency_limits (policy); -mutex_unlock (&amd_pstate_driver_lock);return ret; }
@@ -792,7 +792,8 @@ static void amd_pstate_update_limits(unsigned int cpu)if (!amd_pstate_prefcore)return ; -mutex_lock (&amd_pstate_driver_lock); +guard (mutex)(&amd_pstate_driver_lock); + ret =amd_get_highest_perf (cpu, &cur_high);if (ret) goto free_cpufreq_put;
@@ -812,7 +813,6 @@ static void amd_pstate_update_limits(unsigned int cpu)if (!highest_perf_changed)cpufreq_update_policy (cpu); -mutex_unlock (&amd_pstate_driver_lock); }/*
@@ -1145,11 +1145,11 @@ static ssize_t store_energy_performance_preference(if (ret <0 )return -EINVAL ; -mutex_lock (&amd_pstate_limits_lock); +guard (mutex)(&amd_pstate_limits_lock); + ret =amd_pstate_set_energy_pref_index (cpudata, ret); -mutex_unlock (&amd_pstate_limits_lock); -return ret ?: count; +return ret ? ret : count; } static ssize_t show_energy_performance_preference(
@@ -1297,13 +1297,10 @@ EXPORT_SYMBOL_GPL(amd_pstate_update_status);static ssize_t status_show (struct device *dev,struct device_attribute *attr,char *buf) { -ssize_t ret; -mutex_lock (&amd_pstate_driver_lock); - ret =amd_pstate_show_status (buf); -mutex_unlock (&amd_pstate_driver_lock); +guard (mutex)(&amd_pstate_driver_lock); -return ret; +return amd_pstate_show_status (buf); } static ssize_t status_store(struct device *a, struct device_attribute *b,
@@ -1312,9 +1309,8 @@ static ssize_t status_store(struct device *a, struct device_attribute *b,char *p =memchr (buf,'\n' , count);int ret; -mutex_lock (&amd_pstate_driver_lock); +guard (mutex)(&amd_pstate_driver_lock); ret =amd_pstate_update_status (buf, p ? p - buf : count); -mutex_unlock (&amd_pstate_driver_lock);return ret <0 ? ret : count; }
@@ -1614,13 +1610,11 @@ static int amd_pstate_epp_cpu_offline(struct cpufreq_policy *policy) min_perf =READ_ONCE (cpudata->lowest_perf); -mutex_lock (&amd_pstate_limits_lock); +guard (mutex)(&amd_pstate_limits_lock);amd_pstate_update_perf (cpudata, min_perf,0 , min_perf, false);amd_pstate_set_epp (cpudata,AMD_CPPC_EPP_BALANCE_POWERSAVE ); -mutex_unlock (&amd_pstate_limits_lock); -return 0 ; }
@@ -1656,13 +1650,11 @@ static int amd_pstate_epp_resume(struct cpufreq_policy *policy)struct amd_cpudata *cpudata = policy->driver_data;if (cpudata->suspended) { -mutex_lock (&amd_pstate_limits_lock); +guard (mutex)(&amd_pstate_limits_lock);/* enable amd pstate from suspend state*/ amd_pstate_epp_reenable (cpudata); -mutex_unlock (&amd_pstate_limits_lock); - cpudata->suspended = false; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 181/230 cpufreq/amd-pstate: Fix cpufreq_policy ref counting
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dhananjay Ugwekar <[email protected]>
[ Upstream commit 3ace20038e19f23fe73259513f1f08d4bf1a3c83 ]
amd_pstate_update_limits() takes a cpufreq_policy reference but doesn't decrement the refcount in one of the exit paths, fix that.
--- drivers/cpufreq/amd-pstate.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/cpufreq/amd-pstate.c +5 -4
@@ -778,20 +778,21 @@ static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata)static void amd_pstate_update_limits (unsigned int cpu) { -struct cpufreq_policy *policy =cpufreq_cpu_get (cpu); +struct cpufreq_policy *policy =NULL ;struct amd_cpudata *cpudata;u32 prev_high =0 , cur_high =0 ;int ret;bool highest_perf_changed = false; +if (!amd_pstate_prefcore) +return ; + + policy =cpufreq_cpu_get (cpu);if (!policy)return ; cpudata = policy->driver_data; -if (!amd_pstate_prefcore) -return ; -guard (mutex)(&amd_pstate_driver_lock); ret =amd_get_highest_perf (cpu, &cur_high);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 182/230 ipv4: add RCU protection to ip4_dst_hoplimit()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 469308552ca4560176cfc100e7ca84add1bebd7c ]
ip4_dst_hoplimit() must use RCU protection to make sure the net structure it reads does not disappear.
--- include/net/route.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
include/net/route.h +7 -2
@@ -363,10 +363,15 @@ static inline int inet_iif(const struct sk_buff *skb)static inline int ip4_dst_hoplimit (const struct dst_entry *dst) {int hoplimit =dst_metric_raw (dst,RTAX_HOPLIMIT ); -struct net *net =dev_net (dst->dev); -if (hoplimit ==0 ) +if (hoplimit ==0 ) { +const struct net *net; + +rcu_read_lock (); + net =dev_net_rcu (dst->dev); hoplimit =READ_ONCE (net->ipv4.sysctl_ip_default_ttl); +rcu_read_unlock (); + }return hoplimit; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 183/230 ipv4: use RCU protection in ip_dst_mtu_maybe_forward()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 071d8012869b6af352acca346ade13e7be90a49f ]
ip_dst_mtu_maybe_forward() must use RCU protection to make sure the net structure it reads does not disappear.
--- include/net/ip.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
include/net/ip.h +10 -3
@@ -465,9 +465,12 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst, bool forwarding) {const struct rtable *rt =dst_rtable (dst); -struct net *net =dev_net (dst->dev); -unsigned int mtu; +unsigned int mtu, res; +struct net *net; + +rcu_read_lock (); + net =dev_net_rcu (dst->dev);if (READ_ONCE (net->ipv4.sysctl_ip_fwd_use_pmtu) ||ip_mtu_locked (dst) || !forwarding) {
@@ -491,7 +494,11 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst, out: mtu = min_t(unsigned int, mtu, IP_MAX_MTU); -return mtu -lwtunnel_headroom (dst->lwtstate, mtu); + res = mtu -lwtunnel_headroom (dst->lwtstate, mtu); + +rcu_read_unlock (); + +return res; } static inline unsigned int ip_skb_dst_mtu(struct sock *sk,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 184/230 net: add dev_net_rcu() helper
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 482ad2a4ace2740ca0ff1cbc8f3c7f862f3ab507 ]
dev->nd_net can change, readers should either
use rcu_read_lock() or RTNL.
We currently use a generic helper, dev_net() with no debugging support. We probably have many hidden bugs.
Add dev_net_rcu() helper for callers using rcu_read_lock() protection.
Stable-dep-of: 71b8471c93fa ("ipv4: use RCU protection in ipv4_default_advmss()")
--- include/linux/netdevice.h | 6 ++++++ include/net/net_namespace.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)
include/linux/netdevice.h +6 -0
@@ -2577,6 +2577,12 @@ struct net *dev_net(const struct net_device *dev)return read_pnet (&dev->nd_net); } +static inline +struct net *dev_net_rcu (const struct net_device *dev) +{ +return read_pnet_rcu (&dev->nd_net); +} +static inline void dev_net_set (struct net_device *dev,struct net *net) {
include/net/net_namespace.h +1 -1
@@ -387,7 +387,7 @@ static inline struct net *read_pnet(const possible_net_t *pnet)#endif } -static inline struct net *read_pnet_rcu (possible_net_t *pnet) +static inline struct net *read_pnet_rcu (const possible_net_t *pnet) {#ifdef CONFIG_NET_NS return rcu_dereference (pnet->net);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 185/230 ipv4: use RCU protection in ipv4_default_advmss()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 71b8471c93fa0bcab911fcb65da1eb6c4f5f735f ]
ipv4_default_advmss() must use RCU protection to make sure the net structure it reads does not disappear.
--- net/ipv4/route.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
net/ipv4/route.c +8 -3
@@ -1294,10 +1294,15 @@ static void set_class_tag(struct rtable *rt, u32 tag)static unsigned int ipv4_default_advmss (const struct dst_entry *dst) { -struct net *net =dev_net (dst->dev);unsigned int header_size =sizeof (struct tcphdr ) +sizeof (struct iphdr ); - unsigned int advmss = max_t(unsigned int, ipv4_mtu(dst) - header_size, - net->ipv4.ip_rt_min_advmss); +unsigned int advmss; +struct net *net; + +rcu_read_lock (); + net =dev_net_rcu (dst->dev); + advmss = max_t(unsigned int, ipv4_mtu(dst) - header_size, + net->ipv4.ip_rt_min_advmss); +rcu_read_unlock ();return min (advmss,IPV4_MAX_PMTU - header_size); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 186/230 ipv4: use RCU protection in rt_is_expired()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit dd205fcc33d92d54eee4d7f21bb073af9bd5ce2b ]
rt_is_expired() must use RCU protection to make sure the net structure it reads does not disappear.
--- net/ipv4/route.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/ipv4/route.c +7 -1
@@ -390,7 +390,13 @@ static inline int ip_rt_proc_init(void)static inline bool rt_is_expired (const struct rtable *rth) { -return rth->rt_genid !=rt_genid_ipv4 (dev_net (rth->dst.dev)); +bool res; + +rcu_read_lock (); + res = rth->rt_genid !=rt_genid_ipv4 (dev_net_rcu (rth->dst.dev)); +rcu_read_unlock (); + +return res; }void rt_cache_flush (struct net *net)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 187/230 ipv4: use RCU protection in inet_select_addr()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 719817cd293e4fa389e1f69c396f3f816ed5aa41 ]
inet_select_addr() must use RCU protection to make sure the net structure it reads does not disappear.
--- net/ipv4/devinet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/devinet.c +2 -1
@@ -1351,10 +1351,11 @@ __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope)__be32 addr =0 ;unsigned char localnet_scope =RT_SCOPE_HOST ;struct in_device *in_dev; -struct net *net =dev_net (dev); +struct net *net;int master_idx;rcu_read_lock (); + net =dev_net_rcu (dev); in_dev =__in_dev_get_rcu (dev);if (!in_dev) goto no_in_dev;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 188/230 net: ipv4: Cache pmtu for all packet paths if multipath enabled
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Vdovin <[email protected]>
[ Upstream commit 7d3f3b4367f315a61fc615e3138f3d320da8c466 ]
Check number of paths by fib_info_num_path(), and update_or_create_fnhe() for every path. Problem is that pmtu is cached only for the oif that has received icmp message "need to frag", other oifs will still try to use "default" iface mtu.
An example topology showing the problem:
| host1
+---------+
| dummy0 | 10.179.20.18/32 mtu9000
+---------+
+-----------+----------------+
+---------+ +---------+
| ens17f0 | 10.179.2.141/31 | ens17f1 | 10.179.2.13/31
+---------+ +---------+
| (all here have mtu 9000) |
+------+ +------+
| ro1 | 10.179.2.140/31 | ro2 | 10.179.2.12/31
+------+ +------+
| |
---------+------------+-------------------+------
|
+-----+
| ro3 | 10.10.10.10 mtu1500
+-----+
|
========================================
some networks
========================================
|
+-----+
| eth0| 10.10.30.30 mtu9000
+-----+
| host2host1 have enabled multipath and
sysctl net.ipv4.fib_multipath_hash_policy = 1:
default proto static src 10.179.20.18
nexthop via 10.179.2.12 dev ens17f1 weight 1
nexthop via 10.179.2.140 dev ens17f0 weight 1When host1 tries to do pmtud from 10.179.20.18/32 to host2, host1 receives at ens17f1 iface an icmp packet from ro3 that ro3 mtu=1500. And host1 caches it in nexthop exceptions cache.
Problem is that it is cached only for the iface that has received icmp, and there is no way that ro3 will send icmp msg to host1 via another path.
Host1 now have this routes to host2:
ip r g 10.10.30.30 sport 30000 dport 443
10.10.30.30 via 10.179.2.12 dev ens17f1 src 10.179.20.18 uid 0
cache expires 521sec mtu 1500
ip r g 10.10.30.30 sport 30033 dport 443
10.10.30.30 via 10.179.2.140 dev ens17f0 src 10.179.20.18 uid 0
cache
So when host1 tries again to reach host2 with mtu>1500,
if packet flow is lucky enough to be hashed with oif=ens17f1 its ok, if oif=ens17f0 it blackholes and still gets icmp msgs from ro3 to ens17f1, until lucky day when ro3 will send it through another flow to ens17f0.
Stable-dep-of: 139512191bd0 ("ipv4: use RCU protection in __ip_rt_update_pmtu()")
--- net/ipv4/route.c | 13 ++++ tools/testing/selftests/net/pmtu.sh | 112 +++++++++++++++++++++++----- 2 files changed, 108 insertions(+), 17 deletions(-)
net/ipv4/route.c +13 -0
@@ -1034,6 +1034,19 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)struct fib_nh_common *nhc;fib_select_path (net, &res, fl4,NULL ); +#ifdef CONFIG_IP_ROUTE_MULTIPATH +if (fib_info_num_path (res.fi) >1 ) { +int nhsel; + +for (nhsel =0 ; nhsel <fib_info_num_path (res.fi); nhsel++) { + nhc =fib_info_nhc (res.fi, nhsel); +update_or_create_fnhe (nhc, fl4->daddr,0 , mtu, lock, + jiffies + net->ipv4.ip_rt_mtu_expires); + } +rcu_read_unlock (); +return ; + } +#endif /* CONFIG_IP_ROUTE_MULTIPATH */ nhc =FIB_RES_NHC (res);update_or_create_fnhe (nhc, fl4->daddr,0 , mtu, lock, jiffies + net->ipv4.ip_rt_mtu_expires);
tools/testing/selftests/net/pmtu.sh +95 -17
168 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 189/230 ipv4: use RCU protection in __ip_rt_update_pmtu()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 139512191bd06f1b496117c76372b2ce372c9a41 ]
__ip_rt_update_pmtu() must use RCU protection to make sure the net structure it reads does not disappear.
--- net/ipv4/route.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
net/ipv4/route.c +6 -5
@@ -1008,9 +1008,9 @@ out: kfree_skb_reason(skb, reason);static void __ip_rt_update_pmtu (struct rtable *rt,struct flowi4 *fl4,u32 mtu) {struct dst_entry *dst = &rt->dst; -struct net *net =dev_net (dst->dev);struct fib_result res;bool lock = false; +struct net *net;u32 old_mtu;if (ip_mtu_locked (dst))
@@ -1020,6 +1020,8 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)if (old_mtu < mtu)return ; +rcu_read_lock (); + net =dev_net_rcu (dst->dev);if (mtu < net->ipv4.ip_rt_min_pmtu) { lock = true; mtu =min (old_mtu, net->ipv4.ip_rt_min_pmtu);
@@ -1027,9 +1029,8 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)if (rt->rt_pmtu == mtu && !lock &&time_before (jiffies, dst->expires - net->ipv4.ip_rt_mtu_expires /2 )) -return ; + goto out; -rcu_read_lock ();if (fib_lookup (net, fl4, &res,0 ) ==0 ) {struct fib_nh_common *nhc;
@@ -1043,14 +1044,14 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)update_or_create_fnhe (nhc, fl4->daddr,0 , mtu, lock, jiffies + net->ipv4.ip_rt_mtu_expires); } -rcu_read_unlock (); -return ; + goto out; }#endif /* CONFIG_IP_ROUTE_MULTIPATH */ nhc =FIB_RES_NHC (res);update_or_create_fnhe (nhc, fl4->daddr,0 , mtu, lock, jiffies + net->ipv4.ip_rt_mtu_expires); } +out:rcu_read_unlock (); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 190/230 ipv4: icmp: convert to dev_net_rcu()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 4b8474a0951e605d2a27a2c483da4eb4b8c63760 ]
__icmp_send() must ensure rcu_read_lock() is held, as spotted by Jakub.
Other ICMP uses of dev_net() seem safe, change them to dev_net_rcu() to get LOCKDEP support.
--- net/ipv4/icmp.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-)
net/ipv4/icmp.c +17 -14
@@ -399,10 +399,10 @@ static void icmp_push_reply(struct sock *sk,static void icmp_reply (struct icmp_bxm *icmp_param,struct sk_buff *skb) { -struct ipcm_cookie ipc;struct rtable *rt =skb_rtable (skb); -struct net *net =dev_net (rt->dst.dev); +struct net *net =dev_net_rcu (rt->dst.dev);bool apply_ratelimit = false; +struct ipcm_cookie ipc;struct flowi4 fl4;struct sock *sk;struct inet_sock *inet;
@@ -610,12 +610,14 @@ void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,struct sock *sk;if (!rt) - goto out; +return ; + +rcu_read_lock ();if (rt->dst.dev) - net =dev_net (rt->dst.dev); + net =dev_net_rcu (rt->dst.dev);else if (skb_in->dev) - net =dev_net (skb_in->dev); + net =dev_net_rcu (skb_in->dev);else goto out;
@@ -786,7 +788,8 @@ void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,icmp_xmit_unlock (sk); out_bh_enable:local_bh_enable (); -out:; +out: +rcu_read_unlock (); }EXPORT_SYMBOL (__icmp_send);
@@ -835,7 +838,7 @@ static void icmp_socket_deliver(struct sk_buff *skb, u32 info)* avoid additional coding at protocol handlers. */ if (!pskb_may_pull (skb, iph->ihl *4 +8 )) { -__ICMP_INC_STATS (dev_net (skb->dev),ICMP_MIB_INERRORS ); +__ICMP_INC_STATS (dev_net_rcu (skb->dev),ICMP_MIB_INERRORS );return ; }
@@ -869,7 +872,7 @@ static enum skb_drop_reason icmp_unreach(struct sk_buff *skb)struct net *net;u32 info =0 ; - net =dev_net (skb_dst (skb)->dev); + net =dev_net_rcu (skb_dst (skb)->dev);/* * Incomplete header ?
@@ -980,7 +983,7 @@ static enum skb_drop_reason icmp_unreach(struct sk_buff *skb)static enum skb_drop_reason icmp_redirect (struct sk_buff *skb) {if (skb->len <sizeof (struct iphdr )) { -__ICMP_INC_STATS (dev_net (skb->dev),ICMP_MIB_INERRORS ); +__ICMP_INC_STATS (dev_net_rcu (skb->dev),ICMP_MIB_INERRORS );return SKB_DROP_REASON_PKT_TOO_SMALL ; }
@@ -1012,7 +1015,7 @@ static enum skb_drop_reason icmp_echo(struct sk_buff *skb)struct icmp_bxm icmp_param;struct net *net; - net =dev_net (skb_dst (skb)->dev); + net =dev_net_rcu (skb_dst (skb)->dev);/* should there be an ICMP stat for ignored echos? */ if (READ_ONCE (net->ipv4.sysctl_icmp_echo_ignore_all))return SKB_NOT_DROPPED_YET ;
@@ -1041,9 +1044,9 @@ static enum skb_drop_reason icmp_echo(struct sk_buff *skb)bool icmp_build_probe (struct sk_buff *skb,struct icmphdr *icmphdr) { +struct net *net =dev_net_rcu (skb->dev);struct icmp_ext_hdr *ext_hdr, _ext_hdr;struct icmp_ext_echo_iio *iio, _iio; -struct net *net =dev_net (skb->dev);struct inet6_dev *in6_dev;struct in_device *in_dev;struct net_device *dev;
@@ -1182,7 +1185,7 @@ static enum skb_drop_reason icmp_timestamp(struct sk_buff *skb)return SKB_NOT_DROPPED_YET ; out_err: -__ICMP_INC_STATS (dev_net (skb_dst (skb)->dev),ICMP_MIB_INERRORS ); +__ICMP_INC_STATS (dev_net_rcu (skb_dst (skb)->dev),ICMP_MIB_INERRORS );return SKB_DROP_REASON_PKT_TOO_SMALL ; }
@@ -1199,7 +1202,7 @@ int icmp_rcv(struct sk_buff *skb) {enum skb_drop_reason reason =SKB_DROP_REASON_NOT_SPECIFIED ;struct rtable *rt =skb_rtable (skb); -struct net *net =dev_net (rt->dst.dev); +struct net *net =dev_net_rcu (rt->dst.dev);struct icmphdr *icmph;if (!xfrm4_policy_check (NULL ,XFRM_POLICY_IN , skb)) {
@@ -1372,9 +1375,9 @@ int icmp_err(struct sk_buff *skb, u32 info)struct iphdr *iph = (struct iphdr *)skb->data;int offset = iph->ihl<<2 ;struct icmphdr *icmph = (struct icmphdr *)(skb->data + offset); +struct net *net =dev_net_rcu (skb->dev);int type =icmp_hdr (skb)->type;int code =icmp_hdr (skb)->code; -struct net *net =dev_net (skb->dev);/* * Use ping_err to handle all icmp errors except those
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 191/230 flow_dissector: use RCU protection to fetch dev_net()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit afec62cd0a4191cde6dd3a75382be4d51a38ce9b ]
__skb_flow_dissect() can be called from arbitrary contexts.
It must extend its RCU protection section to include the call to dev_net(), which can become dev_net_rcu().
This makes sure the net structure can not disappear under us.
--- net/core/flow_dissector.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
net/core/flow_dissector.c +11 -10
@@ -1108,10 +1108,12 @@ bool __skb_flow_dissect(const struct net *net,FLOW_DISSECTOR_KEY_BASIC , target_container); +rcu_read_lock (); +if (skb) {if (!net) {if (skb->dev) - net =dev_net (skb->dev); + net =dev_net_rcu (skb->dev);else if (skb->sk) net =sock_net (skb->sk); }
@@ -1122,7 +1124,6 @@ bool __skb_flow_dissect(const struct net *net,enum netns_bpf_attach_type type =NETNS_BPF_FLOW_DISSECTOR ;struct bpf_prog_array *run_array; -rcu_read_lock (); run_array =rcu_dereference (init_net.bpf.run_array[type]);if (!run_array) run_array =rcu_dereference (net->bpf.run_array[type]);
@@ -1150,17 +1151,17 @@ bool __skb_flow_dissect(const struct net *net, prog =READ_ONCE (run_array->items[0 ].prog); result =bpf_flow_dissect (prog, &ctx, n_proto, nhoff, hlen, flags); -if (result ==BPF_FLOW_DISSECTOR_CONTINUE ) - goto dissect_continue; -__skb_flow_bpf_to_target (&flow_keys, flow_dissector, - target_container); -rcu_read_unlock (); -return result ==BPF_OK ; +if (result !=BPF_FLOW_DISSECTOR_CONTINUE ) { +__skb_flow_bpf_to_target (&flow_keys, flow_dissector, + target_container); +rcu_read_unlock (); +return result ==BPF_OK ; + } } -dissect_continue: -rcu_read_unlock (); } +rcu_read_unlock (); +if (dissector_uses_key (flow_dissector,FLOW_DISSECTOR_KEY_ETH_ADDRS )) {struct ethhdr *eth =eth_hdr (skb);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 192/230 ipv6: use RCU protection in ip6_default_advmss()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 3c8ffcd248da34fc41e52a46e51505900115fc2a ]
ip6_default_advmss() needs rcu protection to make sure the net structure it reads does not disappear.
--- net/ipv6/route.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/ipv6/route.c +6 -1
@@ -3196,13 +3196,18 @@ static unsigned int ip6_default_advmss(const struct dst_entry *dst) {struct net_device *dev = dst->dev;unsigned int mtu =dst_mtu (dst); -struct net *net =dev_net (dev); +struct net *net; mtu -=sizeof (struct ipv6hdr ) +sizeof (struct tcphdr ); +rcu_read_lock (); + + net =dev_net_rcu (dev);if (mtu < net->ipv6.sysctl.ip6_rt_min_advmss) mtu = net->ipv6.sysctl.ip6_rt_min_advmss; +rcu_read_unlock (); +/* * Maximal non-jumbo IPv6 payload is IPV6_MAXPLEN and * corresponding MSS is IPV6_MAXPLEN - tcp_header_size.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 193/230 ipv6: icmp: convert to dev_net_rcu()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 34aef2b0ce3aa4eb4ef2e1f5cad3738d527032f5 ]
icmp6_send() must acquire rcu_read_lock() sooner to ensure the dev_net() call done from a safe context.
Other ICMPv6 uses of dev_net() seem safe, change them to dev_net_rcu() to get LOCKDEP support to catch bugs.
--- net/ipv6/icmp.c | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-)
net/ipv6/icmp.c +23 -19
@@ -76,7 +76,7 @@ static int icmpv6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, {/* icmpv6_notify checks 8 bytes can be pulled, icmp6hdr is 8 bytes */ struct icmp6hdr *icmp6 = (struct icmp6hdr *) (skb->data + offset); -struct net *net =dev_net (skb->dev); +struct net *net =dev_net_rcu (skb->dev);if (type ==ICMPV6_PKT_TOOBIG )ip6_update_pmtu (skb, net, info, skb->dev->ifindex,0 ,sock_net_uid (net,NULL ));
@@ -473,7 +473,10 @@ void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,if (!skb->dev)return ; - net =dev_net (skb->dev); + +rcu_read_lock (); + + net =dev_net_rcu (skb->dev); mark =IP6_REPLY_MARK (net, skb->mark);/* * Make sure we respect the rules
@@ -496,7 +499,7 @@ void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, !(type ==ICMPV6_PARAMPROB && code ==ICMPV6_UNK_OPTION && (opt_unrec(skb, info)))) - return; + goto out; saddr =NULL ; }
@@ -526,7 +529,7 @@ void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,if ((addr_type ==IPV6_ADDR_ANY ) || (addr_type &IPV6_ADDR_MULTICAST )) {net_dbg_ratelimited ("icmp6_send: addr_any/mcast source [%pI6c > %pI6c]\n" , &hdr->saddr, &hdr->daddr); -return ; + goto out; }/*
@@ -535,7 +538,7 @@ void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,if (is_ineligible (skb)) {net_dbg_ratelimited ("icmp6_send: no reply to icmp error [%pI6c > %pI6c]\n" , &hdr->saddr, &hdr->daddr); -return ; + goto out; }/* Needed by both icmpv6_global_allow and icmpv6_xmit_lock */
@@ -582,7 +585,7 @@ void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, np =inet6_sk (sk);if (!icmpv6_xrlim_allow (sk, type, &fl6, apply_ratelimit)) - goto out; + goto out_unlock; tmp_hdr.icmp6_type = type; tmp_hdr.icmp6_code = code;
@@ -600,7 +603,7 @@ void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, dst =icmpv6_route_lookup (net, skb, sk, &fl6);if (IS_ERR (dst)) - goto out; + goto out_unlock; ipc6.hlimit =ip6_sk_dst_hoplimit (np, &fl6, dst);
@@ -616,7 +619,6 @@ void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, goto out_dst_release; } -rcu_read_lock (); idev =__in6_dev_get (skb->dev); if (ip6_append_data(sk, icmpv6_getfrag, &msg,
@@ -630,13 +632,15 @@ void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,icmpv6_push_pending_frames (sk, &fl6, &tmp_hdr, len +sizeof (struct icmp6hdr )); } -rcu_read_unlock (); + out_dst_release:dst_release (dst); -out: +out_unlock:icmpv6_xmit_unlock (sk); out_bh_enable:local_bh_enable (); +out: +rcu_read_unlock (); }EXPORT_SYMBOL (icmp6_send);
@@ -679,8 +683,8 @@ int ip6_err_gen_icmpv6_unreach(struct sk_buff *skb, int nhs, int type,skb_pull (skb2, nhs);skb_reset_network_header (skb2); - rt =rt6_lookup (dev_net (skb->dev), &ipv6_hdr (skb2)->saddr,NULL ,0 , - skb,0 ); + rt =rt6_lookup (dev_net_rcu (skb->dev), &ipv6_hdr (skb2)->saddr, +NULL ,0 , skb,0 );if (rt && rt->dst.dev) skb2->dev = rt->dst.dev;
@@ -717,7 +721,7 @@ EXPORT_SYMBOL(ip6_err_gen_icmpv6_unreach);static enum skb_drop_reason icmpv6_echo_reply (struct sk_buff *skb) { -struct net *net =dev_net (skb->dev); +struct net *net =dev_net_rcu (skb->dev);struct sock *sk;struct inet6_dev *idev;struct ipv6_pinfo *np;
@@ -832,7 +836,7 @@ enum skb_drop_reason icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info) {struct inet6_skb_parm *opt =IP6CB (skb); -struct net *net =dev_net (skb->dev); +struct net *net =dev_net_rcu (skb->dev);const struct inet6_protocol *ipprot;enum skb_drop_reason reason;int inner_offset;
@@ -889,7 +893,7 @@ enum skb_drop_reason icmpv6_notify(struct sk_buff *skb, u8 type,static int icmpv6_rcv (struct sk_buff *skb) {enum skb_drop_reason reason =SKB_DROP_REASON_NOT_SPECIFIED ; -struct net *net =dev_net (skb->dev); +struct net *net =dev_net_rcu (skb->dev);struct net_device *dev =icmp6_dev (skb);struct inet6_dev *idev =__in6_dev_get (dev);const struct in6_addr *saddr, *daddr;
@@ -921,7 +925,7 @@ static int icmpv6_rcv(struct sk_buff *skb)skb_set_network_header (skb, nh); } -__ICMP6_INC_STATS (dev_net (dev), idev,ICMP6_MIB_INMSGS ); +__ICMP6_INC_STATS (dev_net_rcu (dev), idev,ICMP6_MIB_INMSGS ); saddr = &ipv6_hdr (skb)->saddr; daddr = &ipv6_hdr (skb)->daddr;
@@ -939,7 +943,7 @@ static int icmpv6_rcv(struct sk_buff *skb) type = hdr->icmp6_type; -ICMP6MSGIN_INC_STATS (dev_net (dev), idev, type); +ICMP6MSGIN_INC_STATS (dev_net_rcu (dev), idev, type);switch (type) {case ICMPV6_ECHO_REQUEST :
@@ -1034,9 +1038,9 @@ static int icmpv6_rcv(struct sk_buff *skb) csum_error: reason =SKB_DROP_REASON_ICMP_CSUM ; -__ICMP6_INC_STATS (dev_net (dev), idev,ICMP6_MIB_CSUMERRORS ); +__ICMP6_INC_STATS (dev_net_rcu (dev), idev,ICMP6_MIB_CSUMERRORS ); discard_it: -__ICMP6_INC_STATS (dev_net (dev), idev,ICMP6_MIB_INERRORS ); +__ICMP6_INC_STATS (dev_net_rcu (dev), idev,ICMP6_MIB_INERRORS ); drop_no_count:kfree_skb_reason (skb, reason);return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 194/230 HID: hid-steam: Make sure rumble work is canceled on removal
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vicki Pfau <[email protected]>
[ Upstream commit cc4f952427aaa44ecfd92542e10a65cce67bd6f4 ]
When a force feedback command is sent from userspace, work is scheduled to pass this data to the controller without blocking userspace itself. However, in theory, this work might not be properly canceled if the controller is removed at the exact right time. This patch ensures the work is properly canceled when the device is removed.
Stable-dep-of: 79504249d7e2 ("HID: hid-steam: Move hidraw input (un)registering to work")
--- drivers/hid/hid-steam.c | 1 + 1 file changed, 1 insertion(+)
drivers/hid/hid-steam.c +1 -0
@@ -1306,6 +1306,7 @@ static void steam_remove(struct hid_device *hdev)cancel_delayed_work_sync (&steam->mode_switch);cancel_work_sync (&steam->work_connect); +cancel_work_sync (&steam->rumble_work);hid_destroy_device (steam->client_hdev); steam->client_hdev =NULL ; steam->client_opened =0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 195/230 HID: hid-steam: Move hidraw input (un)registering to work
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vicki Pfau <[email protected]>
[ Upstream commit 79504249d7e27cad4a3eeb9afc6386e418728ce0 ]
Due to an interplay between locking in the input and hid transport subsystems, attempting to register or deregister the relevant input devices during the hidraw open/close events can lead to a lock ordering issue. Though this shouldn't cause a deadlock, this commit moves the input device manipulation to deferred work to sidestep the issue.
--- drivers/hid/hid-steam.c | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-)
drivers/hid/hid-steam.c +31 -7
@@ -313,6 +313,7 @@ struct steam_device {u16 rumble_left;u16 rumble_right;unsigned int sensor_timestamp_us; +struct work_struct unregister_work; }; static int steam_recv_report(struct steam_device *steam,
@@ -1072,6 +1073,31 @@ static void steam_mode_switch_cb(struct work_struct *work) } } +static void steam_work_unregister_cb (struct work_struct *work) +{ + struct steam_device *steam = container_of(work, struct steam_device, + unregister_work); +unsigned long flags; +bool connected; +bool opened; + +spin_lock_irqsave (&steam->lock, flags); + opened = steam->client_opened; + connected = steam->connected; +spin_unlock_irqrestore (&steam->lock, flags); + +if (connected) { +if (opened) { +steam_sensors_unregister (steam); +steam_input_unregister (steam); + }else { +steam_set_lizard_mode (steam, lizard_mode); +steam_input_register (steam); +steam_sensors_register (steam); + } + } +} +static bool steam_is_valve_interface (struct hid_device *hdev) {struct hid_report_enum *rep_enum;
@@ -1117,8 +1143,7 @@ static int steam_client_ll_open(struct hid_device *hdev) steam->client_opened++;spin_unlock_irqrestore (&steam->lock, flags); -steam_sensors_unregister (steam); -steam_input_unregister (steam); +schedule_work (&steam->unregister_work);return 0 ; }
@@ -1135,11 +1160,7 @@ static void steam_client_ll_close(struct hid_device *hdev) connected = steam->connected && !steam->client_opened;spin_unlock_irqrestore (&steam->lock, flags); -if (connected) { -steam_set_lizard_mode (steam, lizard_mode); -steam_input_register (steam); -steam_sensors_register (steam); - } +schedule_work (&steam->unregister_work); } static int steam_client_ll_raw_request(struct hid_device *hdev,
@@ -1231,6 +1252,7 @@ static int steam_probe(struct hid_device *hdev,INIT_LIST_HEAD (&steam->list);INIT_WORK (&steam->rumble_work, steam_haptic_rumble_cb); steam->sensor_timestamp_us =0 ; +INIT_WORK (&steam->unregister_work, steam_work_unregister_cb);/* * With the real steam controller interface, do not connect hidraw.
@@ -1291,6 +1313,7 @@ static int steam_probe(struct hid_device *hdev,cancel_work_sync (&steam->work_connect);cancel_delayed_work_sync (&steam->mode_switch);cancel_work_sync (&steam->rumble_work); +cancel_work_sync (&steam->unregister_work);return ret; }
@@ -1307,6 +1330,7 @@ static void steam_remove(struct hid_device *hdev)cancel_delayed_work_sync (&steam->mode_switch);cancel_work_sync (&steam->work_connect);cancel_work_sync (&steam->rumble_work); +cancel_work_sync (&steam->unregister_work);hid_destroy_device (steam->client_hdev); steam->client_hdev =NULL ; steam->client_opened =0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 196/230 ndisc: use RCU protection in ndisc_alloc_skb()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 628e6d18930bbd21f2d4562228afe27694f66da9 ]
ndisc_alloc_skb() can be called without RTNL or RCU being held.
Add RCU protection to avoid possible UAF.
--- net/ipv6/ndisc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
net/ipv6/ndisc.c +4 -6
@@ -418,15 +418,11 @@ static struct sk_buff *ndisc_alloc_skb(struct net_device *dev, {int hlen =LL_RESERVED_SPACE (dev);int tlen = dev->needed_tailroom; -struct sock *sk =dev_net (dev)->ipv6.ndisc_sk;struct sk_buff *skb; skb =alloc_skb (hlen +sizeof (struct ipv6hdr ) + len + tlen,GFP_ATOMIC ); -if (!skb) { -ND_PRINTK (0 , err,"ndisc: %s failed to allocate an skb\n" , - __func__); +if (!skb)return NULL ; - } skb->protocol =htons (ETH_P_IPV6 ); skb->dev = dev;
@@ -437,7 +433,9 @@ static struct sk_buff *ndisc_alloc_skb(struct net_device *dev,/* Manually assign socket ownership as we avoid calling * sock_alloc_send_pskb() to bypass wmem buffer limits */ -skb_set_owner_w (skb, sk); +rcu_read_lock (); +skb_set_owner_w (skb,dev_net_rcu (dev)->ipv6.ndisc_sk); +rcu_read_unlock ();return skb; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 197/230 neighbour: use RCU protection in __neigh_notify()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit becbd5850c03ed33b232083dd66c6e38c0c0e569 ]
__neigh_notify() can be called without RTNL or RCU protection.
Use RCU protection to avoid potential UAF.
--- net/core/neighbour.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/core/neighbour.c +6 -2
@@ -3513,10 +3513,12 @@ static const struct seq_operations neigh_stat_seq_ops = {static void __neigh_notify (struct neighbour *n,int type,int flags,u32 pid) { -struct net *net =dev_net (n->dev);struct sk_buff *skb;int err = -ENOBUFS ; +struct net *net; +rcu_read_lock (); + net =dev_net_rcu (n->dev); skb =nlmsg_new (neigh_nlmsg_size (),GFP_ATOMIC );if (skb ==NULL ) goto errout;
@@ -3529,9 +3531,11 @@ static void __neigh_notify(struct neighbour *n, int type, int flags, goto errout; }rtnl_notify (skb, net,0 ,RTNLGRP_NEIGH ,NULL ,GFP_ATOMIC ); -return ; + goto out; errout:rtnl_set_sk_err (net,RTNLGRP_NEIGH , err); +out: +rcu_read_unlock (); }void neigh_app_ns (struct neighbour *n)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 198/230 arp: use RCU protection in arp_xmit()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit a42b69f692165ec39db42d595f4f65a4c8f42e44 ]
arp_xmit() can be called without RTNL or RCU protection.
Use RCU protection to avoid potential UAF.
--- net/ipv4/arp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv4/arp.c +3 -1
@@ -659,10 +659,12 @@ static int arp_xmit_finish(struct net *net, struct sock *sk, struct sk_buff *skb*/ void arp_xmit (struct sk_buff *skb) { +rcu_read_lock ();/* Send it off, maybe filter it using firewalling first. */ NF_HOOK (NFPROTO_ARP ,NF_ARP_OUT , -dev_net (skb->dev),NULL , skb,NULL , skb->dev, +dev_net_rcu (skb->dev),NULL , skb,NULL , skb->dev, arp_xmit_finish); +rcu_read_unlock (); }EXPORT_SYMBOL (arp_xmit);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 199/230 openvswitch: use RCU protection in ovs_vport_cmd_fill_info()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 90b2f49a502fa71090d9f4fe29a2f51fe5dff76d ]
ovs_vport_cmd_fill_info() can be called without RTNL or RCU.
Use RCU protection and dev_net_rcu() to avoid potential UAF.
--- net/openvswitch/datapath.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
net/openvswitch/datapath.c +9 -3
@@ -2102,6 +2102,7 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb, {struct ovs_header *ovs_header;struct ovs_vport_stats vport_stats; +struct net *net_vport;int err; ovs_header = genlmsg_put(skb, portid, seq, &dp_vport_genl_family,
@@ -2118,12 +2119,15 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb, nla_put_u32(skb, OVS_VPORT_ATTR_IFINDEX, vport->dev->ifindex)) goto nla_put_failure; -if (!net_eq (net,dev_net (vport->dev))) { -int id =peernet2id_alloc (net,dev_net (vport->dev), gfp); +rcu_read_lock (); + net_vport =dev_net_rcu (vport->dev); +if (!net_eq (net, net_vport)) { +int id =peernet2id_alloc (net, net_vport,GFP_ATOMIC );if (nla_put_s32 (skb,OVS_VPORT_ATTR_NETNSID , id)) - goto nla_put_failure; + goto nla_put_failure_unlock; } +rcu_read_unlock ();ovs_vport_get_stats (vport, &vport_stats); if (nla_put_64bit(skb, OVS_VPORT_ATTR_STATS,
@@ -2144,6 +2148,8 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb,genlmsg_end (skb, ovs_header);return 0 ; +nla_put_failure_unlock: +rcu_read_unlock (); nla_put_failure: err = -EMSGSIZE ; error:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 200/230 ndisc: extend RCU protection in ndisc_send_skb()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit ed6ae1f325d3c43966ec1b62ac1459e2b8e45640 ]
ndisc_send_skb() can be called without RTNL or RCU held.
Acquire rcu_read_lock() earlier, so that we can use dev_net_rcu() and avoid a potential UAF.
--- net/ipv6/ndisc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
net/ipv6/ndisc.c +8 -4
@@ -471,16 +471,20 @@ static void ip6_nd_hdr(struct sk_buff *skb,void ndisc_send_skb (struct sk_buff *skb,const struct in6_addr *daddr,const struct in6_addr *saddr) { +struct icmp6hdr *icmp6h =icmp6_hdr (skb);struct dst_entry *dst =skb_dst (skb); -struct net *net =dev_net (skb->dev); -struct sock *sk = net->ipv6.ndisc_sk;struct inet6_dev *idev; +struct net *net; +struct sock *sk;int err; -struct icmp6hdr *icmp6h =icmp6_hdr (skb);u8 type; type = icmp6h->icmp6_type; +rcu_read_lock (); + + net =dev_net_rcu (skb->dev); + sk = net->ipv6.ndisc_sk;if (!dst) {struct flowi6 fl6;int oif = skb->dev->ifindex;
@@ -488,6 +492,7 @@ void ndisc_send_skb(struct sk_buff *skb, const struct in6_addr *daddr,icmpv6_flow_init (sk, &fl6, type, saddr, daddr, oif); dst =icmp6_dst_alloc (skb->dev, &fl6);if (IS_ERR (dst)) { +rcu_read_unlock ();kfree_skb (skb);return ; }
@@ -502,7 +507,6 @@ void ndisc_send_skb(struct sk_buff *skb, const struct in6_addr *daddr,ip6_nd_hdr (skb, saddr, daddr,READ_ONCE (inet6_sk (sk)->hop_limit), skb->len); -rcu_read_lock (); idev =__in6_dev_get (dst->dev);IP6_INC_STATS (net, idev,IPSTATS_MIB_OUTREQUESTS );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 201/230 ipv6: mcast: extend RCU protection in igmp6_send()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 087c1faa594fa07a66933d750c0b2610aa1a2946 ]
igmp6_send() can be called without RTNL or RCU being held.
Extend RCU protection so that we can safely fetch the net pointer and avoid a potential UAF.
Note that we no longer can use sock_alloc_send_skb() because ipv6.igmp_sk uses GFP_KERNEL allocations which can sleep.
Instead use alloc_skb() and charge the net->ipv6.igmp_sk socket under RCU protection.
--- net/ipv6/mcast.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-)
net/ipv6/mcast.c +15 -16
@@ -2122,21 +2122,21 @@ static void mld_send_cr(struct inet6_dev *idev)static void igmp6_send (struct in6_addr *addr,struct net_device *dev,int type) { -struct net *net =dev_net (dev); -struct sock *sk = net->ipv6.igmp_sk; +const struct in6_addr *snd_addr, *saddr; +int err, len, payload_len, full_len; +struct in6_addr addr_buf;struct inet6_dev *idev;struct sk_buff *skb;struct mld_msg *hdr; -const struct in6_addr *snd_addr, *saddr; -struct in6_addr addr_buf;int hlen =LL_RESERVED_SPACE (dev);int tlen = dev->needed_tailroom; -int err, len, payload_len, full_len;u8 ra[8 ] = {IPPROTO_ICMPV6 ,0 ,IPV6_TLV_ROUTERALERT ,2 ,0 ,0 ,IPV6_TLV_PADN ,0 }; -struct flowi6 fl6;struct dst_entry *dst; +struct flowi6 fl6; +struct net *net; +struct sock *sk;if (type ==ICMPV6_MGM_REDUCTION ) snd_addr = &in6addr_linklocal_allrouters;
@@ -2147,19 +2147,21 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) payload_len = len +sizeof (ra); full_len =sizeof (struct ipv6hdr ) + payload_len; -rcu_read_lock (); -IP6_INC_STATS (net,__in6_dev_get (dev),IPSTATS_MIB_OUTREQUESTS ); -rcu_read_unlock (); + skb =alloc_skb (hlen + tlen + full_len,GFP_KERNEL ); - skb =sock_alloc_send_skb (sk, hlen + tlen + full_len,1 , &err); +rcu_read_lock (); + net =dev_net_rcu (dev); + idev =__in6_dev_get (dev); +IP6_INC_STATS (net, idev,IPSTATS_MIB_OUTREQUESTS );if (!skb) { -rcu_read_lock (); -IP6_INC_STATS (net,__in6_dev_get (dev), -IPSTATS_MIB_OUTDISCARDS ); +IP6_INC_STATS (net, idev,IPSTATS_MIB_OUTDISCARDS );rcu_read_unlock ();return ; } + sk = net->ipv6.igmp_sk; +skb_set_owner_w (skb, sk); + skb->priority =TC_PRIO_CONTROL ;skb_reserve (skb, hlen);
@@ -2184,9 +2186,6 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)IPPROTO_ICMPV6 , csum_partial(hdr, len, 0)); -rcu_read_lock (); - idev =__in6_dev_get (skb->dev); -icmpv6_flow_init (sk, &fl6, type, &ipv6_hdr (skb)->saddr, &ipv6_hdr (skb)->daddr, skb->dev->ifindex);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 202/230 btrfs: rename __get_extent_map() and pass btrfs_inode
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
[ Upstream commit 06de96faf795b5c276a3be612da6b08c6112e747 ]
The double underscore naming scheme does not apply here, there's only only get_extent_map(). As the definition is changed also pass the struct btrfs_inode.
Stable-dep-of: acc18e1c1d8c ("btrfs: fix stale page cache after race between readahead and direct IO write")
--- fs/btrfs/extent_io.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
fs/btrfs/extent_io.c +7 -8
@@ -901,9 +901,9 @@ void clear_folio_extent_mapped(struct folio *folio)folio_detach_private (folio); } -static struct extent_map *__get_extent_map (struct inode *inode, -struct folio *folio,u64 start, -u64 len,struct extent_map **em_cached) +static struct extent_map *get_extent_map (struct btrfs_inode *inode, +struct folio *folio,u64 start, +u64 len,struct extent_map **em_cached) {struct extent_map *em;struct extent_state *cached_state =NULL ;
@@ -922,14 +922,14 @@ static struct extent_map *__get_extent_map(struct inode *inode, *em_cached =NULL ; } -btrfs_lock_and_flush_ordered_range (BTRFS_I (inode), start, start + len -1 , &cached_state); - em =btrfs_get_extent (BTRFS_I (inode), folio, start, len); +btrfs_lock_and_flush_ordered_range (inode, start, start + len -1 , &cached_state); + em =btrfs_get_extent (inode, folio, start, len);if (!IS_ERR (em)) {BUG_ON (*em_cached);refcount_inc (&em->refs); *em_cached = em; } -unlock_extent (&BTRFS_I (inode)->io_tree, start, start + len -1 , &cached_state); +unlock_extent (&inode->io_tree, start, start + len -1 , &cached_state);return em; }
@@ -985,8 +985,7 @@ static int btrfs_do_readpage(struct folio *folio, struct extent_map **em_cached,end_folio_read (folio, true, cur, iosize);break ; } - em =__get_extent_map (inode, folio, cur, end - cur +1 , - em_cached); + em =get_extent_map (BTRFS_I (inode), folio, cur, end - cur +1 , em_cached);if (IS_ERR (em)) {end_folio_read (folio, false, cur, end +1 - cur);return PTR_ERR (em);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 203/230 btrfs: fix stale page cache after race between readahead and direct IO write
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit acc18e1c1d8c0d59d793cf87790ccfcafb1bf5f0 ]
After commit ac325fc2aad5 ("btrfs: do not hold the extent lock for entire read") we can now trigger a race between a task doing a direct IO write and readahead. When this race is triggered it results in tasks getting stale data when they attempt do a buffered read (including the task that did the direct IO write).
This race can be sporadically triggered with test case generic/418, failing like this:
$ ./check generic/418 FSTYP -- btrfs PLATFORM -- Linux/x86_64 debian0 6.13.0-rc7-btrfs-next-185+ #17 SMP PREEMPT_DYNAMIC Mon Feb 3 12:28:46 WET 2025 MKFS_OPTIONS -- /dev/sdc MOUNT_OPTIONS -- /dev/sdc /home/fdmanana/btrfs-tests/scratch_1
generic/418 14s ... - output mismatch (see /home/fdmanana/git/hub/xfstests/results//generic/418.out.bad)
# --- tests/generic/418.out 2020-06-10 19:29:03.850519863 +0100
# +++ /home/fdmanana/git/hub/xfstests/results//generic/418.out.bad 2025-02-03 15:42:36.974609476 +0000
@@ -1,2 +1,5 @@
QA output created by 418
+cmpbuf: offset 0: Expected: 0x1, got 0x0
+[6:0] FAIL - comparison failed, offset 24576
+diotest -wp -b 4096 -n 8 -i 4 failed at loop 3
Silence is golden
...
(Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/generic/418.out /home/fdmanana/git/hub/xfstests/results//generic/418.out.bad' to see the entire diff) Ran: generic/418
Failures: generic/418
Failed 1 of 1 tests
The race happens like this:
1) A file has a prealloc extent for the range [16K, 28K);
2) Task A starts a direct IO write against file range [24K, 28K). At the start of the direct IO write it invalidates the page cache at __iomap_dio_rw() with kiocb_invalidate_pages() for the 4K page at file offset 24K;
3) Task A enters btrfs_dio_iomap_begin() and locks the extent range [24K, 28K);
4) Task B starts a readahead for file range [16K, 28K), entering btrfs_readahead().
First it attempts to read the page at offset 16K by entering btrfs_do_readpage(), where it calls get_extent_map(), locks the range [16K, 20K) and gets the extent map for the range [16K, 28K), caching it into the 'em_cached' variable declared in the local stack of btrfs_readahead(), and then unlocks the range [16K, 20K).
Since the extent map has the prealloc flag, at btrfs_do_readpage() we zero out the page's content and don't submit any bio to read the page from the extent.
Then it attempts to read the page at offset 20K entering btrfs_do_readpage() where we reuse the previously cached extent map (decided by get_extent_map()) since it spans the page's range and it's still in the inode's extent map tree.
Just like for the previous page, we zero out the page's content since the extent map has the prealloc flag set.
Then it attempts to read the page at offset 24K entering btrfs_do_readpage() where we reuse the previously cached extent map (decided by get_extent_map()) since it spans the page's range and it's still in the inode's extent map tree.
Just like for the previous pages, we zero out the page's content since the extent map has the prealloc flag set. Note that we didn't lock the extent range [24K, 28K), so we didn't synchronize with the ongoing direct IO write being performed by task A;
5) Task A enters btrfs_create_dio_extent() and creates an ordered extent for the range [24K, 28K), with the flags BTRFS_ORDERED_DIRECT and BTRFS_ORDERED_PREALLOC set;
6) Task A unlocks the range [24K, 28K) at btrfs_dio_iomap_begin();
7) The ordered extent enters btrfs_finish_one_ordered() and locks the range [24K, 28K);
8) Task A enters fs/iomap/direct-io.c:iomap_dio_complete() and it tries to invalidate the page at offset 24K by calling kiocb_invalidate_post_direct_write(), resulting in a call chain that ends up at btrfs_release_folio().
The btrfs_release_folio() call ends up returning false because the range for the page at file offset 24K is currently locked by the task doing the ordered extent completion in the previous step (7), so we have:
btrfs_release_folio() ->
__btrfs_release_folio() ->
try_release_extent_mapping() ->
try_release_extent_state() This last function checking that the range is locked and returning false and propagating it up to btrfs_release_folio().
So this results in a failure to invalidate the page and kiocb_invalidate_post_direct_write() triggers this message logged in dmesg:
Page cache invalidation failure on direct I/O. Possible data corruption due to collision with buffered I/O!
After this we leave the page cache with stale data for the file range [24K, 28K), filled with zeroes instead of the data written by direct IO write (all bytes with a 0x01 value), so any task attempting to read with buffered IO, including the task that did the direct IO write, will get all bytes in the range with a 0x00 value instead of the written data.
Fix this by locking the range, with btrfs_lock_and_flush_ordered_range(), at the two callers of btrfs_do_readpage() instead of doing it at get_extent_map(), just like we did before commit ac325fc2aad5 ("btrfs: do not hold the extent lock for entire read"), and unlocking the range after all the calls to btrfs_do_readpage(). This way we never reuse a cached extent map without flushing any pending ordered extents from a concurrent direct IO write.
--- fs/btrfs/extent_io.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
fs/btrfs/extent_io.c +15 -3
@@ -906,7 +906,6 @@ static struct extent_map *get_extent_map(struct btrfs_inode *inode, u64 len, struct extent_map **em_cached) { struct extent_map *em; -struct extent_state *cached_state =NULL ;ASSERT (em_cached);
@@ -922,14 +921,12 @@ static struct extent_map *get_extent_map(struct btrfs_inode *inode, *em_cached =NULL ; } -btrfs_lock_and_flush_ordered_range (inode, start, start + len -1 , &cached_state); em =btrfs_get_extent (inode, folio, start, len);if (!IS_ERR (em)) {BUG_ON (*em_cached);refcount_inc (&em->refs); *em_cached = em; } -unlock_extent (&inode->io_tree, start, start + len -1 , &cached_state);return em; }
@@ -1086,11 +1083,18 @@ static int btrfs_do_readpage(struct folio *folio, struct extent_map **em_cached,int btrfs_read_folio (struct file *file,struct folio *folio) { +struct btrfs_inode *inode =folio_to_inode (folio); +const u64 start =folio_pos (folio); +const u64 end = start +folio_size (folio) -1 ; +struct extent_state *cached_state =NULL ;struct btrfs_bio_ctrl bio_ctrl = { .opf =REQ_OP_READ };struct extent_map *em_cached =NULL ;int ret; +btrfs_lock_and_flush_ordered_range (inode, start, end, &cached_state); ret =btrfs_do_readpage (folio, &em_cached, &bio_ctrl,NULL ); +unlock_extent (&inode->io_tree, start, end, &cached_state); +free_extent_map (em_cached);/*
@@ -2267,12 +2271,20 @@ void btrfs_readahead(struct readahead_control *rac) {struct btrfs_bio_ctrl bio_ctrl = { .opf =REQ_OP_READ |REQ_RAHEAD };struct folio *folio; +struct btrfs_inode *inode =BTRFS_I (rac->mapping->host); +const u64 start =readahead_pos (rac); +const u64 end = start +readahead_length (rac) -1 ; +struct extent_state *cached_state =NULL ;struct extent_map *em_cached =NULL ;u64 prev_em_start = (u64)-1 ; +btrfs_lock_and_flush_ordered_range (inode, start, end, &cached_state); +while ((folio =readahead_folio (rac)) !=NULL )btrfs_do_readpage (folio, &em_cached, &bio_ctrl, &prev_em_start); +unlock_extent (&inode->io_tree, start, end, &cached_state); +if (em_cached)free_extent_map (em_cached);submit_one_bio (&bio_ctrl);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 204/230 ipv6: mcast: add RCU protection to mld_newpack()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit a527750d877fd334de87eef81f1cb5f0f0ca3373 ]
mld_newpack() can be called without RTNL or RCU being held.
Note that we no longer can use sock_alloc_send_skb() because ipv6.igmp_sk uses GFP_KERNEL allocations which can sleep.
Instead use alloc_skb() and charge the net->ipv6.igmp_sk socket under RCU protection.
--- net/ipv6/mcast.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
net/ipv6/mcast.c +10 -4
@@ -1730,21 +1730,19 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu)struct net_device *dev = idev->dev;int hlen =LL_RESERVED_SPACE (dev);int tlen = dev->needed_tailroom; -struct net *net =dev_net (dev);const struct in6_addr *saddr;struct in6_addr addr_buf;struct mld2_report *pmr;struct sk_buff *skb;unsigned int size;struct sock *sk; -int err; +struct net *net; - sk = net->ipv6.igmp_sk;/* we assume size > sizeof(ra) here * Also try to not allocate high-order pages for big MTU */ size =min_t (int, mtu,PAGE_SIZE /2 ) + hlen + tlen; - skb =sock_alloc_send_skb (sk, size,1 , &err); + skb =alloc_skb (size,GFP_KERNEL );if (!skb)return NULL ;
@@ -1752,6 +1750,12 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu)skb_reserve (skb, hlen);skb_tailroom_reserve (skb, mtu, tlen); +rcu_read_lock (); + + net =dev_net_rcu (dev); + sk = net->ipv6.igmp_sk; +skb_set_owner_w (skb, sk); +if (ipv6_get_lladdr (dev, &addr_buf,IFA_F_TENTATIVE )) {/* <draft-ietf-magma-mld-source-05.txt>: * use unspecified address as the source address
@@ -1763,6 +1767,8 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu)ip6_mc_hdr (sk, skb, dev, saddr, &mld2_all_mcr,NEXTHDR_HOP ,0 ); +rcu_read_unlock (); +skb_put_data (skb, ra,sizeof (ra));skb_set_transport_header (skb,skb_tail_pointer (skb) - skb->data);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 205/230 drm/tidss: Fix issue in irq handling causing irq-flood issue
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
commit 44b6730ab53ef04944fbaf6da0e77397531517b7 upstream.
It has been observed that sometimes DSS will trigger an interrupt and the top level interrupt (DISPC_IRQSTATUS) is not zero, but the VP and VID level interrupt-statuses are zero.
As the top level irqstatus is supposed to tell whether we have VP/VID interrupts, the thinking of the driver authors was that this particular case could never happen. Thus the driver only clears the DISPC_IRQSTATUS bits which has corresponding interrupts in VP/VID status. So when this issue happens, the driver will not clear DISPC_IRQSTATUS, and we get an interrupt flood.
It is unclear why the issue happens. It could be a race issue in the driver, but no such race has been found. It could also be an issue with the HW. However a similar case can be easily triggered by manually writing to DISPC_IRQSTATUS_RAW. This will forcibly set a bit in the DISPC_IRQSTATUS and trigger an interrupt, and as the driver never clears the bit, we get an interrupt flood.
To fix the issue, always clear DISPC_IRQSTATUS. The concern with this solution is that if the top level irqstatus is the one that triggers the interrupt, always clearing DISPC_IRQSTATUS might leave some interrupts unhandled if VP/VID interrupt statuses have bits set. However, testing shows that if any of the irqstatuses is set (i.e. even if DISPC_IRQSTATUS == 0, but a VID irqstatus has a bit set), we will get an interrupt.
--- drivers/gpu/drm/tidss/tidss_dispc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/tidss/tidss_dispc.c +4 -8
@@ -780,24 +780,20 @@ staticvoid dispc_k3_clear_irqstatus (struct dispc_device *dispc,dispc_irq_t clearmask) {unsigned int i; -u32 top_clear =0 ;for (i =0 ; i < dispc->feat->num_vps; ++i) { -if (clearmask &DSS_IRQ_VP_MASK (i)) { +if (clearmask &DSS_IRQ_VP_MASK (i))dispc_k3_vp_write_irqstatus (dispc, i, clearmask); - top_clear |=BIT (i); - } }for (i =0 ; i < dispc->feat->num_planes; ++i) { -if (clearmask &DSS_IRQ_PLANE_MASK (i)) { +if (clearmask &DSS_IRQ_PLANE_MASK (i))dispc_k3_vid_write_irqstatus (dispc, i, clearmask); - top_clear |=BIT (4 + i); - } }if (dispc->feat->subrev ==DISPC_K2G )return ; -dispc_write (dispc,DISPC_IRQSTATUS , top_clear); +/* always clear the top level irqstatus */ +dispc_write (dispc,DISPC_IRQSTATUS ,dispc_read (dispc,DISPC_IRQSTATUS ));/* Flush posted writes */ dispc_read (dispc,DISPC_IRQSTATUS );
Greg Kroah-Hartman
maintainerPATCH 206/230 drm/tidss: Fix race condition while handling interrupt registers
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Devarsh Thakkar <[email protected]>
commit a9a73f2661e6f625d306c9b0ef082e4593f45a21 upstream.
The driver has a spinlock for protecting the irq_masks field and irq enable registers. However, the driver misses protecting the irq status registers which can lead to races.
Take the spinlock when accessing irqstatus too.
--- drivers/gpu/drm/tidss/tidss_dispc.c | 4 ++++ drivers/gpu/drm/tidss/tidss_irq.c | 2 ++ 2 files changed, 6 insertions(+)
drivers/gpu/drm/tidss/tidss_dispc.c +4 -0
@@ -2763,8 +2763,12 @@ static void dispc_init_errata(struct dis*/ static void dispc_softreset_k2g (struct dispc_device *dispc) { +unsigned long flags; + +spin_lock_irqsave (&dispc->tidss->wait_lock, flags);dispc_set_irqenable (dispc,0 );dispc_read_and_clear_irqstatus (dispc); +spin_unlock_irqrestore (&dispc->tidss->wait_lock, flags);for (unsigned int vp_idx =0 ; vp_idx < dispc->feat->num_vps; ++vp_idx)VP_REG_FLD_MOD (dispc, vp_idx,DISPC_VP_CONTROL ,0 ,0 ,0 );
drivers/gpu/drm/tidss/tidss_irq.c +2 -0
@@ -60,7 +60,9 @@ static irqreturn_t tidss_irq_handler(intunsigned int id;dispc_irq_t irqstatus; +spin_lock (&tidss->wait_lock); irqstatus =dispc_read_and_clear_irqstatus (tidss->dispc); +spin_unlock (&tidss->wait_lock);for (id =0 ; id < tidss->num_crtcs; id++) {struct drm_crtc *crtc = tidss->crtcs[id];
Greg Kroah-Hartman
maintainerPATCH 207/230 drm/tidss: Clear the interrupt status for interrupts being disabled
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Devarsh Thakkar <[email protected]>
commit 361a2ebb5cad211732ec3c5d962de49b21895590 upstream.
The driver does not touch the irqstatus register when it is disabling interrupts. This might cause an interrupt to trigger for an interrupt that was just disabled.
To fix the issue, clear the irqstatus registers right after disabling the interrupts.
--- drivers/gpu/drm/tidss/tidss_dispc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/tidss/tidss_dispc.c +8 -2
@@ -700,7 +700,7 @@ void dispc_k2g_set_irqenable(struct disp {dispc_irq_t old_mask =dispc_k2g_read_irqenable (dispc); -/* clear the irqstatus for newly enabled irqs */ +/* clear the irqstatus for irqs that will be enabled */ dispc_k2g_clear_irqstatus (dispc, (mask ^ old_mask) & mask);dispc_k2g_vp_set_irqenable (dispc,0 , mask);
@@ -708,6 +708,9 @@ void dispc_k2g_set_irqenable(struct dispdispc_write (dispc,DISPC_IRQENABLE_SET , (1 <<0 ) | (1 <<7 )); +/* clear the irqstatus for irqs that were disabled */ +dispc_k2g_clear_irqstatus (dispc, (mask ^ old_mask) & old_mask); +/* flush posted write */ dispc_k2g_read_irqenable (dispc); }
@@ -839,7 +842,7 @@ static void dispc_k3_set_irqenable(struc old_mask =dispc_k3_read_irqenable (dispc); -/* clear the irqstatus for newly enabled irqs */ +/* clear the irqstatus for irqs that will be enabled */ dispc_k3_clear_irqstatus (dispc, (old_mask ^ mask) & mask);for (i =0 ; i < dispc->feat->num_vps; ++i) {
@@ -864,6 +867,9 @@ static void dispc_k3_set_irqenable(strucif (main_disable)dispc_write (dispc,DISPC_IRQENABLE_CLR , main_disable); +/* clear the irqstatus for irqs that were disabled */ +dispc_k3_clear_irqstatus (dispc, (old_mask ^ mask) & old_mask); +/* Flush posted writes */ dispc_read (dispc,DISPC_IRQENABLE_SET ); }
Greg Kroah-Hartman
maintainerPATCH 208/230 drm/msm/gem: prevent integer overflow in msm_ioctl_gem_submit()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 3a47f4b439beb98e955d501c609dfd12b7836d61 upstream.
The "submit->cmd[i].size" and "submit->cmd[i].offset" variables are u32 values that come from the user via the submit_lookup_cmds() function. This addition could lead to an integer wrapping bug so use size_add() to prevent that.
Patchwork: https://patchwork.freedesktop.org/patch/624696/
--- drivers/gpu/drm/msm/msm_gem_submit.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/msm/msm_gem_submit.c +1 -2
@@ -787,8 +787,7 @@ int msm_ioctl_gem_submit(struct drm_devi goto out;if (!submit->cmd[i].size || - ((submit->cmd[i].size + submit->cmd[i].offset) > - obj->size /4 )) { + (size_add (submit->cmd[i].size, submit->cmd[i].offset) > obj->size /4 )) {SUBMIT_ERROR (submit,"invalid cmdstream size: %u\n" , submit->cmd[i].size *4 ); ret = -EINVAL ; goto out;
Greg Kroah-Hartman
maintainerPATCH 209/230 drm/rcar-du: dsi: Fix PHY lock bit check
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
commit 6389e616fae8a101ce00068f7690461ab57b29d8 upstream.
The driver checks for bit 16 (using CLOCKSET1_LOCK define) in CLOCKSET1 register when waiting for the PPI clock. However, the right bit to check is bit 17 (CLOCKSET1_LOCK_PHY define). Not only that, but there's nothing in the documents for bit 16 for V3U nor V4H.
So, fix the check to use bit 17, and drop the define for bit 16.
--- drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c | 2 +- drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi_regs.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c +1 -1
@@ -587,7 +587,7 @@ static int rcar_mipi_dsi_startup(structfor (timeout =10 ; timeout >0 ; --timeout) {if ((rcar_mipi_dsi_read (dsi,PPICLSR ) &PPICLSR_STPST ) && (rcar_mipi_dsi_read (dsi,PPIDLSR ) &PPIDLSR_STPST ) && - (rcar_mipi_dsi_read (dsi,CLOCKSET1 ) &CLOCKSET1_LOCK )) + (rcar_mipi_dsi_read (dsi,CLOCKSET1 ) &CLOCKSET1_LOCK_PHY ))break ;usleep_range (1000 ,2000 );
drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi_regs.h +0 -1
@@ -142,7 +142,6 @@#define CLOCKSET1 0x101c#define CLOCKSET1_LOCK_PHY (1 << 17) -#define CLOCKSET1_LOCK (1 << 16)#define CLOCKSET1_CLKSEL (1 << 8)#define CLOCKSET1_CLKINSEL_EXTAL (0 << 2)#define CLOCKSET1_CLKINSEL_DIG (1 << 2)
Greg Kroah-Hartman
maintainerPATCH 210/230 drm/msm/dpu: fix x1e80100 intf_6 underrun/vsync interrupt
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Gerhold <[email protected]>
commit ce55101e6ba188296dbdb9506665d26f23110292 upstream.
The IRQ indexes for the intf_6 underrun/vsync interrupts are swapped. DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 16) is the actual underrun interrupt and DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 17) is the vsync interrupt.
This causes timeout errors when using the DP2 controller, e.g.
[dpu error]enc37 frame done timeout
*ERROR* irq timeout id=37, intf_mode=INTF_MODE_VIDEO intf=6 wb=-1, pp=2, intr=0 *ERROR* wait disable failed: id:37 intf:6 ret:-110
Correct them to fix these errors and make DP2 work properly.
Patchwork: https://patchwork.freedesktop.org/patch/624681/
--- drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_2_x1e80100.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_2_x1e80100.h +2 -2
@@ -391,8 +391,8 @@ static const struct dpu_intf_cfg x1e8010 .type = INTF_DP, .controller_id = MSM_DP_CONTROLLER_2, .prog_fetch_lines_worst_case = 24, - .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 17), - .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 16), + .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 16), + .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 17), }, { .name = "intf_7", .id = INTF_7, .base = 0x3b000, .len = 0x280,
Greg Kroah-Hartman
maintainerPATCH 211/230 drm/msm/dpu1: dont choke on disabling the writeback connector
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
commit d9f55e2abfb933818c772eba659a9b7ab28a44d0 upstream.
During suspend/resume process all connectors are explicitly disabled and then reenabled. However resume fails because of the connector_status check:
[dpu error]connector not connected 3 [drm:drm_mode_config_helper_resume [drm_kms_helper]] *ERROR* Failed to resume (-22)
It doesn't make sense to check for the Writeback connected status (and other drivers don't perform such check), so drop the check.
It wasn't a problem before the commit 71174f362d67 ("drm/msm/dpu: move writeback's atomic_check to dpu_writeback.c"), since encoder's atomic_check() is called under a different conditions that the connector's atomic_check() (e.g. it is not called if there is no connected CRTC or if the corresponding connector is not a part of the new state).
Patchwork: https://patchwork.freedesktop.org/patch/627828/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c +0 -3
@@ -42,9 +42,6 @@ static int dpu_wb_conn_atomic_check(struif (!conn_state || !conn_state->connector) {DPU_ERROR ("invalid connector state\n" );return -EINVAL ; - }else if (conn_state->connector->status != connector_status_connected) { -DPU_ERROR ("connector not connected %d\n" , conn_state->connector->status); -return -EINVAL ; } crtc = conn_state->crtc;
Greg Kroah-Hartman
maintainerPATCH 212/230 drm/v3d: Stop active perfmon if it is being destroyed
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Gmeiner <[email protected]>
commit 21f1435b1e6b012a07c42f36b206d2b66fc8f13b upstream.
If the active performance monitor (v3d->active_perfmon) is being destroyed, stop it first. Currently, the active perfmon is not stopped during destruction, leaving the v3d->active_perfmon pointer stale. This can lead to undefined behavior and instability.
This patch ensures that the active perfmon is stopped before being destroyed, aligning with the behavior introduced in commit 7d1fd3638ee3 ("drm/v3d: Stop the active perfmon before being destroyed").
--- drivers/gpu/drm/v3d/v3d_perfmon.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/v3d/v3d_perfmon.c +5 -0
@@ -384,6 +384,7 @@ int v3d_perfmon_destroy_ioctl(struct drm {struct v3d_file_priv *v3d_priv = file_priv->driver_priv;struct drm_v3d_perfmon_destroy *req = data; +struct v3d_dev *v3d = v3d_priv->v3d;struct v3d_perfmon *perfmon;mutex_lock (&v3d_priv->perfmon.lock);
@@ -393,6 +394,10 @@ int v3d_perfmon_destroy_ioctl(struct drmif (!perfmon)return -EINVAL ; +/* If the active perfmon is being destroyed, stop it first */ +if (perfmon == v3d->active_perfmon) +v3d_perfmon_stop (v3d, perfmon, false); +v3d_perfmon_put (perfmon);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 213/230 drm/xe/tracing: Fix a potential TP_printk UAF
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Hellström <[email protected]>
commit 07089083a526ea19daa72a1edf9d6e209615b77c upstream.
The commitafd2627f727b ("tracing: Check "%s" dereference via the field and not the TP_printk format") exposes potential UAFs in the xe_bo_move trace event.
Fix those by avoiding dereferencing the
xe_mem_type_to_name[] array at TP_printk time.
Since some code refactoring has taken place, explicit backporting may be needed for kernels older than 6.10.
--- drivers/gpu/drm/xe/xe_trace_bo.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/xe/xe_trace_bo.h +6 -6
@@ -55,8 +55,8 @@ TRACE_EVENT(xe_bo_move,TP_STRUCT__entry (__field (struct xe_bo *,bo )__field (size_t, size) -__field (u32, new_placement) -__field (u32, old_placement) + __string(new_placement_name, xe_mem_type_to_name[new_placement]) + __string(old_placement_name, xe_mem_type_to_name[old_placement]) __string(device_id, __dev_name_bo(bo))__field (bool, move_lacks_source) ),
@@ -64,15 +64,15 @@ TRACE_EVENT(xe_bo_move,TP_fast_assign ( __entry->bo = bo; __entry->size = bo->size; - __entry->new_placement = new_placement; - __entry->old_placement = old_placement; +__assign_str (new_placement_name); +__assign_str (old_placement_name);__assign_str (device_id); __entry->move_lacks_source = move_lacks_source; ),TP_printk ("move_lacks_source:%s, migrate object %p [size %zu] from %s to %s device_id:%s" , __entry->move_lacks_source ?"yes" :"no" , __entry->bo, __entry->size, - xe_mem_type_to_name[__entry->old_placement], - xe_mem_type_to_name[__entry->new_placement],__get_str (device_id)) +__get_str (old_placement_name), +__get_str (new_placement_name),__get_str (device_id)) ); DECLARE_EVENT_CLASS(xe_vma,
Greg Kroah-Hartman
maintainerPATCH 214/230 drm: renesas: rz-du: Increase supported resolutions
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Brandt <[email protected]>
commit 226570680bbde0a698f2985db20d9faf4f23cc6e upstream.
The supported resolutions were misrepresented in earlier versions of hardware manuals.
--- drivers/gpu/drm/renesas/rz-du/rzg2l_du_kms.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/renesas/rz-du/rzg2l_du_kms.c +3 -3
@@ -311,11 +311,11 @@ int rzg2l_du_modeset_init(struct rzg2l_d dev->mode_config.helper_private = &rzg2l_du_mode_config_helper;/* -* The RZ DU uses the VSP1 for memory access, and is limited -* to frame sizes of 1920x1080. +* The RZ DU was designed to support a frame size of 1920x1200 (landscape) +* or 1200x1920 (portrait). */ dev->mode_config.max_width =1920 ; - dev->mode_config.max_height =1080 ; + dev->mode_config.max_height =1920 ; rcdu->num_crtcs =hweight8 (rcdu->info->channels_mask);
Greg Kroah-Hartman
maintainerPATCH 215/230 netdevsim: print human readable IP address
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
commit c71bc6da6198a6d88df86094f1052bb581951d65 upstream.
Currently, IPSec addresses are printed in hexadecimal format, which is not user-friendly. e.g.
# cat /sys/kernel/debug/netdevsim/netdevsim0/ports/0/ipsec SA count=2 tx=20 sa[0] rx ipaddr=0x00000000 00000000 00000000 0100a8c0 sa[0] spi=0x00000101 proto=0x32 salt=0x0adecc3a crypt=1 sa[0] key=0x3167608a ca4f1397 43565909 941fa627 sa[1] tx ipaddr=0x00000000 00000000 00000000 00000000 sa[1] spi=0x00000100 proto=0x32 salt=0x0adecc3a crypt=1 sa[1] key=0x3167608a ca4f1397 43565909 941fa627
This patch updates the code to print the IPSec address in a human-readable format for easier debug. e.g.
# cat /sys/kernel/debug/netdevsim/netdevsim0/ports/0/ipsec SA count=4 tx=40 sa[0] tx ipaddr=0.0.0.0 sa[0] spi=0x00000100 proto=0x32 salt=0x0adecc3a crypt=1 sa[0] key=0x3167608a ca4f1397 43565909 941fa627 sa[1] rx ipaddr=192.168.0.1 sa[1] spi=0x00000101 proto=0x32 salt=0x0adecc3a crypt=1 sa[1] key=0x3167608a ca4f1397 43565909 941fa627 sa[2] tx ipaddr=:: sa[2] spi=0x00000100 proto=0x32 salt=0x0adecc3a crypt=1 sa[2] key=0x3167608a ca4f1397 43565909 941fa627 sa[3] rx ipaddr=2000::1 sa[3] spi=0x00000101 proto=0x32 salt=0x0adecc3a crypt=1 sa[3] key=0x3167608a ca4f1397 43565909 941fa627
--- drivers/net/netdevsim/ipsec.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/netdevsim/ipsec.c +8 -4
@@ -39,10 +39,14 @@ static ssize_t nsim_dbg_netdev_ops_read(if (!sap->used)continue ; - p +=scnprintf (p, bufsize - (p - buf), -"sa[%i] %cx ipaddr=0x%08x %08x %08x %08x\n" , - i, (sap->rx ?'r' :'t' ), sap->ipaddr[0 ], - sap->ipaddr[1 ], sap->ipaddr[2 ], sap->ipaddr[3 ]); +if (sap->xs->props.family ==AF_INET6 ) + p +=scnprintf (p, bufsize - (p - buf), +"sa[%i] %cx ipaddr=%pI6c\n" , + i, (sap->rx ?'r' :'t' ), &sap->ipaddr); +else + p +=scnprintf (p, bufsize - (p - buf), +"sa[%i] %cx ipaddr=%pI4\n" , + i, (sap->rx ?'r' :'t' ), &sap->ipaddr[3 ]); p += scnprintf(p, bufsize - (p - buf), "sa[%i] spi=0x%08x proto=0x%x salt=0x%08x crypt=%d\n", i, be32_to_cpu(sap->xs->id.spi),
Greg Kroah-Hartman
maintainerPATCH 216/230 selftests: rtnetlink: update netdevsim ipsec output format
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
commit 3ec920bb978ccdc68a7dfb304d303d598d038cb1 upstream.
After the netdevsim update to use human-readable IP address formats for IPsec, we can now use the source and destination IPs directly in testing. Here is the result:
# ./rtnetlink.sh -t kci_test_ipsec_offload PASS: ipsec_offload
--- tools/testing/selftests/net/rtnetlink.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/net/rtnetlink.sh +2 -2
@@ -809,10 +809,10 @@ kci_test_ipsec_offload() # does driver have correct offload info run_cmd diff $sysfsf - << EOF SA count=2 tx=3 -sa[0] tx ipaddr=0x00000000 00000000 00000000 00000000 +sa[0] tx ipaddr=$dstip sa[0] spi=0x00000009 proto=0x32 salt=0x61626364 crypt=1 sa[0] key=0x34333231 38373635 32313039 36353433 -sa[1] rx ipaddr=0x00000000 00000000 00000000 037ba8c0 +sa[1] rx ipaddr=$srcip sa[1] spi=0x00000009 proto=0x32 salt=0x61626364 crypt=1 sa[1] key=0x34333231 38373635 32313039 36353433 EOF
Greg Kroah-Hartman
maintainerPATCH 217/230 sched/deadline: Restore dl_server bandwidth on non-destructive root domain changes
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juri Lelli <[email protected]>
commit 41d4200b7103152468552ee50998cda914102049 upstream.
When root domain non-destructive changes (e.g., only modifying one of the existing root domains while the rest is not touched) happen we still need to clear DEADLINE bandwidth accounting so that it's then properly restored, taking into account DEADLINE tasks associated to each cpuset (associated to each root domain). After the introduction of dl_servers, we fail to restore such servers contribution after non-destructive changes (as they are only considered on destructive changes when runqueues are attached to the new domains).
Fix this by making sure we iterate over the dl_servers attached to domains that have not been destroyed and add their bandwidth contribution back correctly.
--- kernel/sched/deadline.c | 17 ++++++++++++++--- kernel/sched/topology.c | 8 +++++--- 2 files changed, 19 insertions(+), 6 deletions(-)
kernel/sched/deadline.c +14 -3
@@ -2975,11 +2975,22 @@ void dl_add_task_root_domain(struct taskvoid dl_clear_root_domain (struct root_domain *rd) { -unsigned long flags; +int i; -raw_spin_lock_irqsave (&rd->dl_bw.lock, flags); +guard (raw_spinlock_irqsave)(&rd->dl_bw.lock); rd->dl_bw.total_bw =0 ; -raw_spin_unlock_irqrestore (&rd->dl_bw.lock, flags); + +/* +* dl_server bandwidth is only restored when CPUs are attached to root +* domains (after domains are created or CPUs moved back to the +* default root doamin). +*/ +for_each_cpu (i, rd->span) { +struct sched_dl_entity *dl_se = &cpu_rq (i)->fair_server; + +if (dl_server (dl_se) &&cpu_active (i)) + rd->dl_bw.total_bw += dl_se->dl_bw; + } }#endif /* CONFIG_SMP */
kernel/sched/topology.c +5 -3
@@ -2721,9 +2721,11 @@ void partition_sched_domains_locked(int/* * This domain won't be destroyed and as such -* its dl_bw->total_bw needs to be cleared. It -* will be recomputed in function -* update_tasks_root_domain(). +* its dl_bw->total_bw needs to be cleared. +* Tasks contribution will be then recomputed +* in function dl_update_tasks_root_domain(), +* dl_servers contribution in function +* dl_restore_server_root_domain(). */ rd =cpu_rq (cpumask_any (doms_cur[i]))->rd;dl_clear_root_domain (rd);
Greg Kroah-Hartman
maintainerPATCH 218/230 sched/deadline: Correctly account for allocated bandwidth during hotplug
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juri Lelli <[email protected]>
commit d4742f6ed7ea6df56e381f82ba4532245fa1e561 upstream.
For hotplug operations, DEADLINE needs to check that there is still enough bandwidth left after removing the CPU that is going offline. We however fail to do so currently.
Restore the correct behavior by restructuring dl_bw_manage() a bit, so that overflow conditions (not enough bandwidth left) are properly checked. Also account for dl_server bandwidth, i.e. discount such bandwidth in the calculation since NORMAL tasks will be anyway moved away from the CPU as a result of the hotplug operation.
--- kernel/sched/core.c | 2 +- kernel/sched/deadline.c | 48 +++++++++++++++++++++++++++++++++++++++--------- kernel/sched/sched.h | 2 +- 3 files changed, 41 insertions(+), 11 deletions(-)
kernel/sched/core.c +1 -1
@@ -8094,7 +8094,7 @@ static void cpuset_cpu_active(void)static int cpuset_cpu_inactive (unsigned int cpu) {if (!cpuhp_tasks_frozen) { -int ret =dl_bw_check_overflow (cpu); +int ret =dl_bw_deactivate (cpu);if (ret)return ret;
kernel/sched/deadline.c +39 -9
83 lines not on this page · raw message
kernel/sched/sched.h +1 -1
@@ -362,7 +362,7 @@ extern void __getparam_dl(struct task_stextern bool __checkparam_dl (const struct sched_attr *attr);extern bool dl_param_changed (struct task_struct *p,const struct sched_attr *attr);extern int dl_cpuset_cpumask_can_shrink (const struct cpumask *cur,const struct cpumask *trial); -extern int dl_bw_check_overflow (int cpu); +extern int dl_bw_deactivate (int cpu);extern s64 dl_scaled_delta_exec (struct rq *rq,struct sched_dl_entity *dl_se,s64 delta_exec);/* * SCHED_DEADLINE supports servers (nested scheduling) with the following
Greg Kroah-Hartman
maintainerPATCH 219/230 sched/deadline: Check bandwidth overflow earlier for hotplug
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juri Lelli <[email protected]>
commit 53916d5fd3c0b658de3463439dd2b7ce765072cb upstream.
Currently we check for bandwidth overflow potentially due to hotplug operations at the end of sched_cpu_deactivate(), after the cpu going offline has already been removed from scheduling, active_mask, etc. This can create issues for DEADLINE tasks, as there is a substantial race window between the start of sched_cpu_deactivate() and the moment we possibly decide to roll-back the operation if dl_bw_deactivate() returns failure in cpuset_cpu_inactive(). An example is a throttled task that sees its replenishment timer firing while the cpu it was previously running on is considered offline, but before dl_bw_deactivate() had a chance to say no and roll-back happened.
Fix this by directly calling dl_bw_deactivate() first thing in sched_cpu_deactivate() and do the required calculation in the former function considering the cpu passed as an argument as offline already.
By doing so we also simplify sched_cpu_deactivate(), as there is no need anymore for any kind of roll-back if we fail early.
--- kernel/sched/core.c | 22 +++++++--------------- kernel/sched/deadline.c | 12 ++++++++++-- 2 files changed, 17 insertions(+), 17 deletions(-)
kernel/sched/core.c +7 -15
@@ -8091,19 +8091,14 @@ static void cpuset_cpu_active(void)cpuset_update_active_cpus (); } -static int cpuset_cpu_inactive (unsigned int cpu) +static void cpuset_cpu_inactive (unsigned int cpu) {if (!cpuhp_tasks_frozen) { -int ret =dl_bw_deactivate (cpu); - -if (ret) -return ret;cpuset_update_active_cpus (); }else { num_cpus_frozen++;partition_sched_domains (1 ,NULL ,NULL ); } -return 0 ; }static inline void sched_smt_present_inc (int cpu)
@@ -8165,6 +8160,11 @@ int sched_cpu_deactivate(unsigned int cpstruct rq *rq =cpu_rq (cpu);int ret; + ret =dl_bw_deactivate (cpu); + +if (ret) +return ret; +/* * Remove CPU from nohz.idle_cpus_mask to prevent participating in * load balancing when not active
@@ -8210,15 +8210,7 @@ int sched_cpu_deactivate(unsigned int cpreturn 0 ;sched_update_numa (cpu, false); - ret =cpuset_cpu_inactive (cpu); -if (ret) { -sched_smt_present_inc (cpu); -sched_set_rq_online (rq, cpu); -balance_push_set (cpu, false); -set_cpu_active (cpu, true); -sched_update_numa (cpu, true); -return ret; - } +cpuset_cpu_inactive (cpu);sched_domains_numa_masks_clear (cpu);return 0 ; }
kernel/sched/deadline.c +10 -2
@@ -3511,6 +3511,13 @@ static int dl_bw_manage(enum dl_bw_requebreak ;case dl_bw_req_deactivate:/* +* cpu is not off yet, but we need to do the math by +* considering it off already (i.e., what would happen if we +* turn cpu off?). +*/ + cap -=arch_scale_cpu_capacity (cpu); + +/* * cpu is going offline and NORMAL tasks will be moved away * from it. We can thus discount dl_server bandwidth * contribution as it won't need to be servicing tasks after
@@ -3527,9 +3534,10 @@ static int dl_bw_manage(enum dl_bw_requeif (dl_b->total_bw - fair_server_bw >0 ) {/* * Leaving at least one CPU for DEADLINE tasks seems a -* wise thing to do. +* wise thing to do. As said above, cpu is not offline +* yet, so account for that. */ -if (dl_bw_cpus (cpu)) +if (dl_bw_cpus (cpu) -1 ) overflow =__dl_overflow (dl_b, cap, fair_server_bw,0 );else overflow =1 ;
Greg Kroah-Hartman
maintainerPATCH 220/230 x86/static-call: Remove early_boot_irqs_disabled check to fix Xen PVH dom0
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Cooper <[email protected]>
commit 5cc2db37124bb33914996d6fdbb2ddb3811f2945 upstream.
__static_call_update_early() has a check for early_boot_irqs_disabled, but is used before early_boot_irqs_disabled is set up in start_kernel().
Xen PV has always special cased early_boot_irqs_disabled, but Xen PVH does not and falls over the BUG when booting as dom0.
It is very suspect that early_boot_irqs_disabled starts as 0, becomes 1 for a time, then becomes 0 again, but as this needs backporting to fix a breakage in a security fix, dropping the BUG_ON() is the far safer option.
--- arch/x86/kernel/static_call.c | 1 - 1 file changed, 1 deletion(-)
arch/x86/kernel/static_call.c +0 -1
@@ -175,7 +175,6 @@ EXPORT_SYMBOL_GPL(arch_static_call_trans noinstr void __static_call_update_early(void *tramp, void *func) {BUG_ON (system_state !=SYSTEM_BOOTING ); -BUG_ON (!early_boot_irqs_disabled);BUG_ON (static_call_initialized);__text_gen_insn (tramp,JMP32_INSN_OPCODE , tramp, func,JMP32_INSN_SIZE );sync_core ();
Greg Kroah-Hartman
maintainerPATCH 221/230 bpf: handle implicit declaration of function gettid in bpf_iter.c
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Xing <[email protected]>
commit 42602e3a06f8e5b9a059344e305c9bee2dcc87c8 upstream.
As we can see from the title, when I compiled the selftests/bpf, I
saw the error:
implicit declaration of function ‘gettid’ ; did you mean ‘getgid’? [-Werror=implicit-function-declaration]
skel->bss->tid = gettid();
^~~~~~
getgidDirectly call the syscall solves this issue.
--- tools/testing/selftests/bpf/prog_tests/bpf_iter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/prog_tests/bpf_iter.c +3 -3
@@ -226,7 +226,7 @@ static void test_task_common_nocheck(strASSERT_OK (pthread_create (&thread_id,NULL , &do_nothing_wait,NULL ),"pthread_create" ); - skel->bss->tid =gettid (); + skel->bss->tid =syscall (SYS_gettid);do_dummy_read_opts (skel->progs.dump_task, opts);
@@ -255,10 +255,10 @@ static void *run_test_task_tid(void *argunion bpf_iter_link_info linfo;int num_unknown_tid, num_known_tid; -ASSERT_NEQ (getpid (),gettid (),"check_new_thread_id" ); +ASSERT_NEQ (getpid (),syscall (SYS_gettid),"check_new_thread_id" );memset (&linfo,0 ,sizeof (linfo)); - linfo.task.tid =gettid (); + linfo.task.tid =syscall (SYS_gettid); opts.link_info = &linfo; opts.link_info_len =sizeof (linfo);test_task_common (&opts,0 ,1 );
Greg Kroah-Hartman
maintainerPATCH 222/230 selftests/bpf: Fix uprobe consumer test
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
commit 4b7c05598a644782b8451e415bb56f31e5c9d3ee upstream.
With newly merged code the uprobe behaviour is slightly different and affects uprobe consumer test.
We no longer need to check if the uprobe object is still preserved after removing last uretprobe, because it stays as long as there's pending/installed uretprobe instance.
This allows to run uretprobe consumers registered 'after' uprobe was hit even if previous uretprobe got unregistered before being hit.
The uprobe object will be now removed after the last uprobe ref is released and in such case it's held by ri->uprobe (return instance) which is released after the uretprobe is hit.
--- tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c +1 -8
@@ -869,21 +869,14 @@ static void consumer_test(struct uprobe_ fmt ="prog 0/1: uprobe" ; }else {/* -* uprobe return is tricky ;-) -* * to trigger uretprobe consumer, the uretprobe needs to be installed, * which means one of the 'return' uprobes was alive when probe was hit: * * idxs: 2/3 uprobe return in 'installed' mask -* -* in addition if 'after' state removes everything that was installed in -* 'before' state, then uprobe kernel object goes away and return uprobe -* is not installed and we won't hit it even if it's in 'after' state. */ unsigned long had_uretprobes = before &0b1100 ;/* is uretprobe installed */ -unsigned long probe_preserved = before & after;/* did uprobe go away */ -if (had_uretprobes && probe_preserved &&test_bit (idx, after)) +if (had_uretprobes &&test_bit (idx, after)) val++; fmt ="idx 2/3: uretprobe" ; }
Greg Kroah-Hartman
maintainerPATCH 223/230 wifi: rtw89: pci: disable PCIE wake bit when PCIE deinit
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ping-Ke Shih <[email protected]>
commit 9c1df813e08832c3836c254bc8a2f83ff22dbc06 upstream.
The PCIE wake bit is to control PCIE wake signal to host. When PCIE is going down, clear this bit to prevent waking up host unexpectedly.
--- drivers/net/wireless/realtek/rtw89/pci.c | 17 ++++++++++++++--- drivers/net/wireless/realtek/rtw89/pci.h | 11 +++++++++++ drivers/net/wireless/realtek/rtw89/pci_be.c | 2 ++ 3 files changed, 27 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtw89/pci.c +14 -3
@@ -2492,7 +2492,7 @@ static int rtw89_pci_dphy_delay(struct r PCIE_DPHY_DLY_25US, PCIE_PHY_GEN1); } -static void rtw89_pci_power_wake (struct rtw89_dev *rtwdev,bool pwr_up) +static void rtw89_pci_power_wake_ax (struct rtw89_dev *rtwdev,bool pwr_up) {if (pwr_up)rtw89_write32_set (rtwdev,R_AX_HCI_OPT_CTRL ,BIT_WAKE_CTRL );
@@ -2799,6 +2799,8 @@ static int rtw89_pci_ops_deinit(struct r {const struct rtw89_pci_info *info = rtwdev->pci_info; +rtw89_pci_power_wake (rtwdev, false); +if (rtwdev->chip->chip_id ==RTL8852A ) {/* ltr sw trigger */ rtw89_write32_set (rtwdev,R_AX_LTR_CTRL_0 ,B_AX_APP_LTR_IDLE );
@@ -2841,7 +2843,7 @@ static int rtw89_pci_ops_mac_pre_init_axreturn ret; } -rtw89_pci_power_wake (rtwdev, true); +rtw89_pci_power_wake_ax (rtwdev, true);rtw89_pci_autoload_hang (rtwdev);rtw89_pci_l12_vmain (rtwdev);rtw89_pci_gen2_force_ib (rtwdev);
@@ -2886,6 +2888,13 @@ static int rtw89_pci_ops_mac_pre_init_axreturn 0 ; } +static int rtw89_pci_ops_mac_pre_deinit_ax (struct rtw89_dev *rtwdev) +{ +rtw89_pci_power_wake_ax (rtwdev, false); + +return 0 ; +} +int rtw89_pci_ltr_set (struct rtw89_dev *rtwdev,bool en) {u32 val;
@@ -4264,7 +4273,7 @@ const struct rtw89_pci_gen_def rtw89_pci B_AX_RDU_INT}, .mac_pre_init = rtw89_pci_ops_mac_pre_init_ax, - .mac_pre_deinit = NULL, + .mac_pre_deinit = rtw89_pci_ops_mac_pre_deinit_ax, .mac_post_init = rtw89_pci_ops_mac_post_init_ax, .clr_idx_all = rtw89_pci_clr_idx_all_ax,
@@ -4280,6 +4289,8 @@ const struct rtw89_pci_gen_def rtw89_pci .aspm_set = rtw89_pci_aspm_set_ax, .clkreq_set = rtw89_pci_clkreq_set_ax, .l1ss_set = rtw89_pci_l1ss_set_ax, + + .power_wake = rtw89_pci_power_wake_ax, };EXPORT_SYMBOL (rtw89_pci_gen_ax);
drivers/net/wireless/realtek/rtw89/pci.h +11 -0
@@ -1276,6 +1276,8 @@ struct rtw89_pci_gen_def {void (*aspm_set)(struct rtw89_dev *rtwdev,bool enable);void (*clkreq_set)(struct rtw89_dev *rtwdev,bool enable);void (*l1ss_set)(struct rtw89_dev *rtwdev,bool enable); + +void (*power_wake)(struct rtw89_dev *rtwdev,bool pwr_up); };struct rtw89_pci_info {
@@ -1766,4 +1768,13 @@ static inline int rtw89_pci_poll_txdma_c return gen_def->poll_txdma_ch_idle(rtwdev); } + +static inline void rtw89_pci_power_wake (struct rtw89_dev *rtwdev,bool pwr_up) +{ +const struct rtw89_pci_info *info = rtwdev->pci_info; +const struct rtw89_pci_gen_def *gen_def = info->gen_def; + + gen_def->power_wake (rtwdev, pwr_up); +} +#endif
drivers/net/wireless/realtek/rtw89/pci_be.c +2 -0
@@ -614,5 +614,7 @@ const struct rtw89_pci_gen_def rtw89_pci .aspm_set = rtw89_pci_aspm_set_be, .clkreq_set = rtw89_pci_clkreq_set_be, .l1ss_set = rtw89_pci_l1ss_set_be, + + .power_wake = _patch_pcie_power_wake_be, };EXPORT_SYMBOL (rtw89_pci_gen_be);
Greg Kroah-Hartman
maintainerPATCH 224/230 cpufreq/amd-pstate: Remove the goto label in amd_pstate_update_limits
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dhananjay Ugwekar <[email protected]>
commit d364eee14c682b141f4667efc3c65191339d88bd upstream.
Scope based guard/cleanup macros should not be used together with goto labels. Hence, remove the goto label.
--- drivers/cpufreq/amd-pstate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/cpufreq/amd-pstate.c +4 -4
@@ -796,8 +796,10 @@ static void amd_pstate_update_limits(unsguard (mutex)(&amd_pstate_driver_lock); ret =amd_get_highest_perf (cpu, &cur_high); -if (ret) - goto free_cpufreq_put; +if (ret) { +cpufreq_cpu_put (policy); +return ; + } prev_high =READ_ONCE (cpudata->prefcore_ranking); highest_perf_changed = (prev_high != cur_high);
@@ -807,8 +809,6 @@ static void amd_pstate_update_limits(unsif (cur_high <CPPC_MAX_PERF )sched_set_itmt_core_prio ((int )cur_high, cpu); } - -free_cpufreq_put:cpufreq_cpu_put (policy);if (!highest_perf_changed)
Greg Kroah-Hartman
maintainerPATCH 225/230 net: ipv6: fix dst refleaks in rpl, seg6 and ioam6 lwtunnels
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
commit c71a192976ded2f2f416d03c4f595cdd4478b825 upstream.
dst_cache_get() gives us a reference, we need to release it.
Discovered by the ioam6.sh test, kmemleak was recently fixed to catch per-cpu memory leaks.
--- net/ipv6/ioam6_iptunnel.c | 5 +++-- net/ipv6/rpl_iptunnel.c | 6 ++++-- net/ipv6/seg6_iptunnel.c | 6 ++++-- 3 files changed, 11 insertions(+), 6 deletions(-)
net/ipv6/ioam6_iptunnel.c +3 -2
@@ -338,7 +338,7 @@ static int ioam6_do_encap(struct net *nestatic int ioam6_output (struct net *net,struct sock *sk,struct sk_buff *skb) { -struct dst_entry *dst =skb_dst (skb), *cache_dst; +struct dst_entry *dst =skb_dst (skb), *cache_dst =NULL ;struct in6_addr orig_daddr;struct ioam6_lwt *ilwt;int err = -EINVAL ;
@@ -409,7 +409,6 @@ do_encap: cache_dst =ip6_route_output (net,NULL , &fl6);if (cache_dst->error) { err = cache_dst->error; -dst_release (cache_dst); goto drop; }
@@ -431,8 +430,10 @@ do_encap:return dst_output (net, sk, skb); } out: +dst_release (cache_dst);return dst->lwtstate->orig_output (net, sk, skb); drop: +dst_release (cache_dst);kfree_skb (skb);return err; }
net/ipv6/rpl_iptunnel.c +4 -2
@@ -232,7 +232,6 @@ static int rpl_output(struct net *net, s dst =ip6_route_output (net,NULL , &fl6);if (dst->error) { err = dst->error; -dst_release (dst); goto drop; }
@@ -254,6 +253,7 @@ static int rpl_output(struct net *net, sreturn dst_output (net, sk, skb); drop: +dst_release (dst);kfree_skb (skb);return err; }
@@ -272,8 +272,10 @@ static int rpl_input(struct sk_buff *skblocal_bh_enable (); err =rpl_do_srh (skb, rlwt, dst); -if (unlikely (err)) +if (unlikely (err)) { +dst_release (dst); goto drop; + }if (!dst) {ip6_route_input (skb);
net/ipv6/seg6_iptunnel.c +4 -2
@@ -482,8 +482,10 @@ static int seg6_input_core(struct net *nlocal_bh_enable (); err =seg6_do_srh (skb, dst); -if (unlikely (err)) +if (unlikely (err)) { +dst_release (dst); goto drop; + }if (!dst) {ip6_route_input (skb);
@@ -571,7 +573,6 @@ static int seg6_output_core(struct net * dst =ip6_route_output (net,NULL , &fl6);if (dst->error) { err = dst->error; -dst_release (dst); goto drop; }
@@ -596,6 +597,7 @@ static int seg6_output_core(struct net *return dst_output (net, sk, skb); drop: +dst_release (dst);kfree_skb (skb);return err; }
Greg Kroah-Hartman
maintainerPATCH 226/230 scsi: ufs: core: Ensure clk_gating.lock is used only after initialization
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avri Altman <[email protected]>
commit 3d4114a1d34413dfffa0094c2eb7b95e61087abd upstream.
Address a lockdep warning triggered by the use of the clk_gating.lock before it is properly initialized. The warning is as follows:
[ 4.388838] INFO: trying to register non-static key. [ 4.395673] The code is fine but needs lockdep annotation, or maybe [ 4.402118] you didn't initialize this object before use? [ 4.407673] turning off the locking correctness validator. [ 4.413334] CPU: 5 UID: 0 PID: 58 Comm: kworker/u32:1 Not tainted 6.12-rc1 #185 [ 4.413343] Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT) [ 4.413362] Call trace: [ 4.413364] show_stack+0x18/0x24 (C) [ 4.413374] dump_stack_lvl+0x90/0xd0 [ 4.413384] dump_stack+0x18/0x24 [ 4.413392] register_lock_class+0x498/0x4a8 [ 4.413400] __lock_acquire+0xb4/0x1b90 [ 4.413406] lock_acquire+0x114/0x310 [ 4.413413] _raw_spin_lock_irqsave+0x60/0x88 [ 4.413423] ufshcd_setup_clocks+0x2c0/0x490 [ 4.413433] ufshcd_init+0x198/0x10ec [ 4.413437] ufshcd_pltfrm_init+0x600/0x7c0 [ 4.413444] ufs_qcom_probe+0x20/0x58 [ 4.413449] platform_probe+0x68/0xd8 [ 4.413459] really_probe+0xbc/0x268 [ 4.413466] __driver_probe_device+0x78/0x12c [ 4.413473] driver_probe_device+0x40/0x11c [ 4.413481] __device_attach_driver+0xb8/0xf8 [ 4.413489] bus_for_each_drv+0x84/0xe4 [ 4.413495] __device_attach+0xfc/0x18c [ 4.413502] device_initial_probe+0x14/0x20 [ 4.413510] bus_probe_device+0xb0/0xb4 [ 4.413517] deferred_probe_work_func+0x8c/0xc8 [ 4.413524] process_scheduled_works+0x250/0x658 [ 4.413534] worker_thread+0x15c/0x2c8 [ 4.413542] kthread+0x134/0x200 [ 4.413550] ret_from_fork+0x10/0x20
To fix this issue, ensure that the spinlock is only used after it has been properly initialized before using it in ufshcd_setup_clocks(). Do that unconditionally as initializing a spinlock is a fast operation.
--- drivers/ufs/core/ufshcd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/ufs/core/ufshcd.c +6 -2
@@ -2150,8 +2150,6 @@ static void ufshcd_init_clk_gating(strucINIT_DELAYED_WORK (&hba->clk_gating.gate_work, ufshcd_gate_work);INIT_WORK (&hba->clk_gating.ungate_work, ufshcd_ungate_work); -spin_lock_init (&hba->clk_gating.lock); - hba->clk_gating.clk_gating_workq =alloc_ordered_workqueue ("ufs_clk_gating_%d" ,WQ_MEM_RECLAIM |WQ_HIGHPRI , hba->host->host_no);
@@ -10453,6 +10451,12 @@ int ufshcd_init(struct ufs_hba *hba, voi hba->irq = irq; hba->vps = &ufs_hba_vps; +/* +* Initialize clk_gating.lock early since it is being used in +* ufshcd_setup_clocks() +*/ +spin_lock_init (&hba->clk_gating.lock); + err =ufshcd_hba_init (hba);if (err) goto out_error;
Greg Kroah-Hartman
maintainerPATCH 227/230 io_uring/kbuf: reallocate buf lists on upgrade
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
commit 8802766324e1f5d414a81ac43365c20142e85603 upstream.
IORING_REGISTER_PBUF_RING can reuse an old struct io_buffer_list if it was created for legacy selected buffer and has been emptied. It violates the requirement that most of the field should stay stable after publish. Always reallocate it instead.
--- io_uring/kbuf.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
io_uring/kbuf.c +11 -4
@@ -420,6 +420,12 @@ void io_destroy_buffers(struct io_ring_c } } +static void io_destroy_bl (struct io_ring_ctx *ctx,struct io_buffer_list *bl) +{ +xa_erase (&ctx->io_bl_xa, bl->bgid); +io_put_bl (ctx, bl); +} +int io_remove_buffers_prep (struct io_kiocb *req,const struct io_uring_sqe *sqe) { struct io_provide_buf *p = io_kiocb_to_cmd(req, struct io_provide_buf);
@@ -717,12 +723,13 @@ int io_register_pbuf_ring(struct io_ring/* if mapped buffer ring OR classic exists, don't allow */ if (bl->flags &IOBL_BUF_RING || !list_empty (&bl->buf_list))return -EEXIST ; - }else { - free_bl = bl =kzalloc (sizeof (*bl),GFP_KERNEL ); -if (!bl) -return -ENOMEM ; +io_destroy_bl (ctx, bl); } + free_bl = bl =kzalloc (sizeof (*bl),GFP_KERNEL ); +if (!bl) +return -ENOMEM ; +if (!(reg.flags &IOU_PBUF_RING_MMAP )) ret =io_pin_pbuf_ring (®, bl);else
Greg Kroah-Hartman
maintainerPATCH 228/230 vsock: Keep the binding until socket destruction
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Luczaj <[email protected]>
commit fcdd2242c0231032fc84e1404315c245ae56322a upstream.
Preserve sockets bindings; this includes both resulting from an explicit bind() and those implicitly bound through autobind during connect().
Prevents socket unbinding during a transport reassignment, which fixes a use-after-free:
1. vsock_create() (refcnt=1) calls vsock_insert_unbound() (refcnt=2)
2. transport->release() calls vsock_remove_bound() without checking if sk was bound and moved to bound list (refcnt=1)
3. vsock_bind() assumes sk is in unbound list and before __vsock_insert_bound(vsock_bound_sockets()) calls __vsock_remove_bound() which does:
list_del_init(&vsk->bound_table); // nop
sock_put(&vsk->sk); // refcnt=0
BUG: KASAN: slab-use-after-free in __vsock_bind+0x62e/0x730 Read of size 4 at addr ffff88816b46a74c by task a.out/2057 dump_stack_lvl+0x68/0x90 print_report+0x174/0x4f6 kasan_report+0xb9/0x190 __vsock_bind+0x62e/0x730 vsock_bind+0x97/0xe0 __sys_bind+0x154/0x1f0 __x64_sys_bind+0x6e/0xb0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e Allocated by task 2057: kasan_save_stack+0x1e/0x40 kasan_save_track+0x10/0x30 __kasan_slab_alloc+0x85/0x90 kmem_cache_alloc_noprof+0x131/0x450 sk_prot_alloc+0x5b/0x220 sk_alloc+0x2c/0x870 __vsock_create.constprop.0+0x2e/0xb60 vsock_create+0xe4/0x420 __sock_create+0x241/0x650 __sys_socket+0xf2/0x1a0 __x64_sys_socket+0x6e/0xb0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e Freed by task 2057: kasan_save_stack+0x1e/0x40 kasan_save_track+0x10/0x30 kasan_save_free_info+0x37/0x60 __kasan_slab_free+0x4b/0x70 kmem_cache_free+0x1a1/0x590 __sk_destruct+0x388/0x5a0 __vsock_bind+0x5e1/0x730 vsock_bind+0x97/0xe0 __sys_bind+0x154/0x1f0 __x64_sys_bind+0x6e/0xb0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
refcount_t: addition on 0; use-after-free.
WARNING: CPU: 7 PID: 2057 at lib/refcount.c:25 refcount_warn_saturate+0xce/0x150 RIP: 0010:refcount_warn_saturate+0xce/0x150 __vsock_bind+0x66d/0x730 vsock_bind+0x97/0xe0 __sys_bind+0x154/0x1f0 __x64_sys_bind+0x6e/0xb0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
refcount_t: underflow; use-after-free.
WARNING: CPU: 7 PID: 2057 at lib/refcount.c:28 refcount_warn_saturate+0xee/0x150 RIP: 0010:refcount_warn_saturate+0xee/0x150 vsock_remove_bound+0x187/0x1e0 __vsock_release+0x383/0x4a0 vsock_release+0x90/0x120 __sock_release+0xa3/0x250 sock_close+0x14/0x20 __fput+0x359/0xa80 task_work_run+0x107/0x1d0 do_exit+0x847/0x2560 do_group_exit+0xb8/0x250 __x64_sys_exit_group+0x3a/0x50 x64_sys_call+0xfec/0x14f0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
--- net/vmw_vsock/af_vsock.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/vmw_vsock/af_vsock.c +6 -2
@@ -337,7 +337,10 @@ EXPORT_SYMBOL_GPL(vsock_find_connected_svoid vsock_remove_sock (struct vsock_sock *vsk) { -vsock_remove_bound (vsk); +/* Transport reassignment must not remove the binding. */ +if (sock_flag (sk_vsock (vsk),SOCK_DEAD )) +vsock_remove_bound (vsk); +vsock_remove_connected (vsk); }EXPORT_SYMBOL_GPL (vsock_remove_sock);
@@ -821,12 +824,13 @@ static void __vsock_release(struct sock*/ lock_sock_nested (sk, level); +sock_orphan (sk); +if (vsk->transport) vsk->transport->release (vsk);else if (sock_type_connectible (sk->sk_type))vsock_remove_sock (vsk); -sock_orphan (sk); sk->sk_shutdown =SHUTDOWN_MASK ;skb_queue_purge (&sk->sk_receive_queue);
Greg Kroah-Hartman
maintainerPATCH 229/230 vsock: Orphan socket after transport release
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Luczaj <[email protected]>
commit 78dafe1cf3afa02ed71084b350713b07e72a18fb upstream.
During socket release, sock_orphan() is called without considering that it sets sk->sk_wq to NULL. Later, if SO_LINGER is enabled, this leads to a null pointer dereferenced in virtio_transport_wait_close().
Orphan the socket only after transport release.
Partially reverts the 'Fixes:' commit.
KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f] lock_acquire+0x19e/0x500 _raw_spin_lock_irqsave+0x47/0x70 add_wait_queue+0x46/0x230 virtio_transport_release+0x4e7/0x7f0 __vsock_release+0xfd/0x490 vsock_release+0x90/0x120 __sock_release+0xa3/0x250 sock_close+0x14/0x20 __fput+0x35e/0xa90 __x64_sys_close+0x78/0xd0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
--- net/vmw_vsock/af_vsock.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/vmw_vsock/af_vsock.c +7 -1
@@ -824,13 +824,19 @@ static void __vsock_release(struct sock*/ lock_sock_nested (sk, level); -sock_orphan (sk); +/* Indicate to vsock_remove_sock() that the socket is being released and +* can be removed from the bound_table. Unlike transport reassignment +* case, where the socket must remain bound despite vsock_remove_sock() +* being called from the transport release() callback. +*/ +sock_set_flag (sk,SOCK_DEAD );if (vsk->transport) vsk->transport->release (vsk);else if (sock_type_connectible (sk->sk_type))vsock_remove_sock (vsk); +sock_orphan (sk); sk->sk_shutdown =SHUTDOWN_MASK ;skb_queue_purge (&sk->sk_receive_queue);
Greg Kroah-Hartman
maintainerPATCH 230/230 Revert "vfio/platform: check the bounds of read/write syscalls"
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
This reverts commit 61ba518195d61c38c6cb86f83135e51f93735442.
It had been committed multiple times to the tree, and isn't needed again.
--- drivers/vfio/platform/vfio_platform_common.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/vfio/platform/vfio_platform_common.c +0 -10
@@ -393,11 +393,6 @@ static ssize_t vfio_platform_read_mmio(s count =min_t (size_t, count, reg->size - off); -if (off >= reg->size) -return -EINVAL ; - - count =min_t (size_t, count, reg->size - off); -if (!reg->ioaddr) { reg->ioaddr =ioremap (reg->addr, reg->size);
@@ -479,11 +474,6 @@ static ssize_t vfio_platform_write_mmio(if (off >= reg->size)return -EINVAL ; - - count =min_t (size_t, count, reg->size - off); - -if (off >= reg->size) -return -EINVAL ; count =min_t (size_t, count, reg->size - off);
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 6.12.16 release. There are 230 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.
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-6.12.y
6.13, 6.6 pass our testing, too:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-6.13.y
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-6.6.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
Jon Hunter
maintainerQuoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.16 release. There are 230 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 Feb 2025 08:25: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.12.16-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.12.y
and the diffstat can be found below.thanks,
greg k-h
Failures detected for Tegra ...
Test results for stable-v6.12:
10 builds: 10 pass, 0 fail
26 boots: 26 pass, 0 fail
116 tests: 115 pass, 1 failLinux version: 6.12.16-rc1-gcf505a9aecb7
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-a04Test failures: tegra186-p2771-0000: pm-system-suspend.sh
Jon
Jon Hunter
maintainerHi Greg,
Quoted 26 lines · Jon Hunter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.16 release. There are 230 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 Feb 2025 08:25: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.12.16-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.12.y
and the diffstat can be found below.thanks,
greg k-h
Failures detected for Tegra ...
Test results for stable-v6.12:
10 builds: 10 pass, 0 fail 26 boots: 26 pass, 0 fail 116 tests: 115 pass, 1 fail
Quoted 7 lines
Linux version: 6.12.16-rc1-gcf505a9aecb7
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-a04Test failures: tegra186-p2771-0000:
pm-system-suspend.sh
The following appear to have crept in again ...
Juri Lelli <[email protected]>
sched/deadline: Check bandwidth overflow earlier for hotplug
Juri Lelli <[email protected]>
sched/deadline: Correctly account for allocated bandwidth during
hotplug
Jon
Signature · 1 line
nvpublic
Greg Kroah-Hartman
maintainerQuoted 38 lines · Jon Hunter
Hi Greg,
Quoted 26 lines · Jon Hunter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.16 release. There are 230 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 Feb 2025 08:25: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.12.16-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.12.y
and the diffstat can be found below.thanks,
greg k-h
Failures detected for Tegra ...
Test results for stable-v6.12:
10 builds: 10 pass, 0 fail 26 boots: 26 pass, 0 fail 116 tests: 115 pass, 1 failQuoted 7 lines
Linux version: 6.12.16-rc1-gcf505a9aecb7
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-a04Test failures: tegra186-p2771-0000:
pm-system-suspend.sh
Quoted 7 lines
The following appear to have crept in again ...
Juri Lelli <[email protected]>
sched/deadline: Check bandwidth overflow earlier for hotplugJuri Lelli <[email protected]>
sched/deadline: Correctly account for allocated bandwidth during hotplug
Yes, but all of them are there this time. Are you saying none should be there? Does 6.14-rc work for you with these targets?
thanks,
greg k-h
Jon Hunter
maintainerQuoted 41 lines · Greg Kroah-Hartman
Quoted 40 lines · Jon Hunter
Hi Greg,
Quoted 26 lines · Jon Hunter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.16 release. There are 230 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 Feb 2025 08:25: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.12.16-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.12.y
and the diffstat can be found below.thanks,
greg k-h
Failures detected for Tegra ...
Test results for stable-v6.12:
10 builds: 10 pass, 0 fail 26 boots: 26 pass, 0 fail 116 tests: 115 pass, 1 failQuoted 7 lines
Linux version: 6.12.16-rc1-gcf505a9aecb7
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-a04Test failures: tegra186-p2771-0000:
pm-system-suspend.shThe following appear to have crept in again ...
Quoted 8 lines
Quoted 5 lines
Juri Lelli <[email protected]>
sched/deadline: Check bandwidth overflow earlier for hotplugJuri Lelli <[email protected]>
sched/deadline: Correctly account for allocated bandwidth during hotplugYes, but all of them are there this time. Are you saying none should be there? Does 6.14-rc work for you with these targets?
The 1st one definitely shouldn't. That one is still under debug for v6.14 [0]. I can try reverting only that one and seeing if it now passes with the 2nd.
Thanks
Jon
[0] https://lore.kernel.org/linux-tegra/[email protected]/
Signature · 1 line
nvpublic
Quoted 49 lines · Jon Hunter
Quoted 47 lines · Greg Kroah-Hartman
Quoted 45 lines · Jon Hunter
Hi Greg,
Quoted 26 lines · Jon Hunter
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.16 release. There are 230 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 Feb 2025 08:25: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.12.16-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.12.y and the diffstat can be found below.Quoted 3 lines
thanks,
greg k-h
Failures detected for Tegra ...
Test results for stable-v6.12:
10 builds: 10 pass, 0 fail
26 boots: 26 pass, 0 fail
116 tests: 115 pass, 1 failQuoted 7 lines
Linux version: 6.12.16-rc1-gcf505a9aecb7
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-a04Test failures: tegra186-p2771-0000:
pm-system-suspend.shThe following appear to have crept in again ...
Juri Lelli <[email protected]>
sched/deadline: Check bandwidth overflow earlier for hotplugJuri Lelli <[email protected]>
sched/deadline: Correctly account for allocated bandwidth during hotplug
Quoted 6 lines
Quoted 2 lines
Yes, but all of them are there this time. Are you saying none should be there? Does 6.14-rc work for you with these targets?
The 1st one definitely shouldn't. That one is still under debug for v6.14 [0]. I can try reverting only that one and seeing if it now passes with the 2nd.
Most certainly not - you need all three or none:
https://lore.kernel.org/stable/[email protected]/
Quoted 1 line
I was about to link to that.. please try 6.14-rc and see if it works for you.
Alternatively we should remove the whole series again because it's obvious that _something_ is still wrong somewhere. Maybe something specific to Tegra's topology?
-h
Jon Hunter
maintainerQuoted 56 lines · Holger Hoffstätte
Quoted 49 lines · Jon Hunter
Quoted 47 lines · Greg Kroah-Hartman
Quoted 45 lines · Jon Hunter
Hi Greg,
Quoted 26 lines · Jon Hunter
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.16 release. There are 230 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 Feb 2025 08:25: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.12.16-rc1.gz or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux- stable-rc.git linux-6.12.y and the diffstat can be found below.Quoted 3 lines
thanks,
greg k-h
Failures detected for Tegra ...
Test results for stable-v6.12:
10 builds: 10 pass, 0 fail
26 boots: 26 pass, 0 fail
116 tests: 115 pass, 1 failQuoted 7 lines
Linux version: 6.12.16-rc1-gcf505a9aecb7
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-a04Test failures: tegra186-p2771-0000:
pm-system-suspend.shThe following appear to have crept in again ...
Juri Lelli <[email protected]>
sched/deadline: Check bandwidth overflow earlier for hotplugJuri Lelli <[email protected]>
sched/deadline: Correctly account for allocated bandwidth during hotplugQuoted 6 lines
Quoted 2 lines
Yes, but all of them are there this time. Are you saying none should be there? Does 6.14-rc work for you with these targets?
The 1st one definitely shouldn't. That one is still under debug for v6.14 [0]. I can try reverting only that one and seeing if it now passes with the 2nd.
Quoted 6 lines
Most certainly not - you need all three or none:
https://lore.kernel.org/stable/905eb8ab-2635-e030-b671- [email protected]/I was about to link to that.. please try 6.14-rc and see if it works for you.
6.14-rc is still failing for this board. Like I said, and per the above thread, that issue is still being debugged.
Jon
Signature · 1 line
nvpublic
Greg Kroah-Hartman
maintainerQuoted 67 lines · Jon Hunter
Quoted 65 lines · Holger Hoffstätte
Quoted 54 lines · Jon Hunter
Quoted 52 lines · Greg Kroah-Hartman
Quoted 50 lines · Jon Hunter
Hi Greg,
Quoted 30 lines · Jon Hunter
Quoted 18 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.16 release. There are 230 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 Feb 2025 08:25: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.12.16-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-
stable-rc.git linux-6.12.y
and the diffstat can be found below.Quoted 3 lines
thanks,
greg k-h
Failures detected for Tegra ...
Test results for stable-v6.12:
10 builds: 10 pass, 0 fail
26 boots: 26 pass, 0 fail
116 tests: 115 pass, 1 failQuoted 7 lines
Linux version: 6.12.16-rc1-gcf505a9aecb7
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-a04Test failures: tegra186-p2771-0000:
pm-system-suspend.shThe following appear to have crept in again ...
Juri Lelli <[email protected]>
sched/deadline: Check bandwidth overflow earlier for hotplugJuri Lelli <[email protected]> sched/deadline: Correctly account for allocated bandwidth during hotplug
Quoted 6 lines
Quoted 2 lines
Yes, but all of them are there this time. Are you saying none should be there? Does 6.14-rc work for you with these targets?
The 1st one definitely shouldn't. That one is still under debug for v6.14 [0]. I can try reverting only that one and seeing if it now passes with the 2nd.
Most certainly not - you need all three or none:
https://lore.kernel.org/stable/905eb8ab-2635-e030-b671-
[email protected]/
Quoted 8 lines
Quoted 5 lines
I was about to link to that.. please try 6.14-rc and see if it works for you.
6.14-rc is still failing for this board. Like I said, and per the above thread, that issue is still being debugged.
Ok, I'm dropping them all from both 6.13 and 6.12 now and will push out -rc2 versions soon.
thanks,
greg k-h
Am 19.02.2025 um 09:25 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.12.16 release. There are 230 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.
Builds, boots and works on my 2-socket Ivy Bridge Xeon E5-2697 v2 server. No dmesg oddities or regressions found.
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]
The kernel, bpf tool, perf tool, and kselftest builds fine for v6.12.16-rc1 on x86 and arm64 Azure VM.
Kernel binary size for x86 build:
text data bss dec hex filename 27754094 17709070 6397952 51861116 317567c vmlinux
Kernel binary size for arm64 build:
text data bss dec hex filename 36379568 14992369 1052816 52424753 31ff031 vmlinux
Thanks,
Hardik
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.16 release. There are 230 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 Feb 2025 08:25: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.12.16-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.12.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.16 release. There are 230 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 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.16 release. There are 230 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 Feb 2025 08:25: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.12.16-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.12.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.12.16-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git commit: cf505a9aecb7b64f05ea37f7304aab81f6f5aef2
* git describe: v6.12.15-231-gcf505a9aecb7
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.12.y/build/v6.12.15-231-gcf505a9aecb7
## Test Regressions (compared to v6.12.13-419-gaa95ced31609)
## Metric Regressions (compared to v6.12.13-419-gaa95ced31609)
## Test Fixes (compared to v6.12.13-419-gaa95ced31609)
## Metric Fixes (compared to v6.12.13-419-gaa95ced31609)
## Test result summary
total: 61807, pass: 49873, fail: 1962, skip: 9939, xfail: 33
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 137 total, 137 passed, 0 failed
* arm64: 49 total, 49 passed, 0 failed
* i386: 17 total, 17 passed, 0 failed
* mips: 32 total, 32 passed, 0 failed
* parisc: 3 total, 3 passed, 0 failed
* powerpc: 38 total, 38 passed, 0 failed
* riscv: 22 total, 22 passed, 0 failed
* s390: 24 total, 20 passed, 4 failed
* sh: 6 total, 5 passed, 1 failed
* sparc: 3 total, 3 passed, 0 failed
* x86_64: 44 total, 44 passed, 0 failed
## Test suites summary
* boot
* commands
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-exec
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-kcmp
* kselftest-kvm
* kselftest-membarrier
* kselftest-memfd
* kselftest-mincore
* kselftest-mqueue
* kselftest-net
* kselftest-net-mptcp
* kselftest-openat2
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-rust
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-tc-testing
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user_events
* kselftest-vDSO
* kselftest-x86
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-build-clang
* log-parser-build-gcc
* log-parser-test
* ltp-capability
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-crypto
* ltp-cve
* 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-syscalls
* ltp-tracing
* perf
* rcutorture
--
Linaro LKFT
https://lkft.linaro.org
Hi Greg,
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.16 release. There are 230 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.
No problems seen on x86_64 and aarch64 with our testing.
Thanks,
Harshit
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.12.16 release. There are 230 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 Feb 2025 08:25: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.12.16-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.12.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah