From 2fbc0ae542ba0c99e86bf61414237ae11abf4484 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 16 Dec 2025 11:26:59 +0100 Subject: [PATCH] 6.12-stable patches added patches: loongarch-add-machine_kexec_mask_interrupts-implementation.patch net-dst-introduce-dst-dev_rcu.patch net-lan743x-allocate-rings-outside-zone_dma.patch tcp_metrics-use-dst_dev_net_rcu.patch --- ...kexec_mask_interrupts-implementation.patch | 53 +++++++++ .../net-dst-introduce-dst-dev_rcu.patch | 107 ++++++++++++++++++ ...743x-allocate-rings-outside-zone_dma.patch | 36 ++++++ queue-6.12/series | 4 + .../tcp_metrics-use-dst_dev_net_rcu.patch | 55 +++++++++ 5 files changed, 255 insertions(+) create mode 100644 queue-6.12/loongarch-add-machine_kexec_mask_interrupts-implementation.patch create mode 100644 queue-6.12/net-dst-introduce-dst-dev_rcu.patch create mode 100644 queue-6.12/net-lan743x-allocate-rings-outside-zone_dma.patch create mode 100644 queue-6.12/tcp_metrics-use-dst_dev_net_rcu.patch diff --git a/queue-6.12/loongarch-add-machine_kexec_mask_interrupts-implementation.patch b/queue-6.12/loongarch-add-machine_kexec_mask_interrupts-implementation.patch new file mode 100644 index 0000000000..507c10a58e --- /dev/null +++ b/queue-6.12/loongarch-add-machine_kexec_mask_interrupts-implementation.patch @@ -0,0 +1,53 @@ +From chenhuacai@loongson.cn Tue Dec 16 11:19:39 2025 +From: Huacai Chen +Date: Sat, 13 Dec 2025 17:49:50 +0800 +Subject: [PATCH 6.12] LoongArch: Add machine_kexec_mask_interrupts() implementation +To: Greg Kroah-Hartman , Sasha Levin , Huacai Chen +Cc: Xuerui Wang , stable@vger.kernel.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, Huacai Chen , Tianyang Zhang +Message-ID: <20251213094950.1068951-1-chenhuacai@loongson.cn> + +From: Huacai Chen + +Commit 863a320dc6fd7c855f47da4b ("LoongArch: Mask all interrupts during +kexec/kdump") is backported to LTS branches, but they lack a generic +machine_kexec_mask_interrupts() implementation, so add an arch-specific +one. + +Signed-off-by: Tianyang Zhang +Signed-off-by: Huacai Chen +Signed-off-by: Greg Kroah-Hartman +--- + arch/loongarch/kernel/machine_kexec.c | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +--- a/arch/loongarch/kernel/machine_kexec.c ++++ b/arch/loongarch/kernel/machine_kexec.c +@@ -136,6 +136,28 @@ void kexec_reboot(void) + BUG(); + } + ++static void machine_kexec_mask_interrupts(void) ++{ ++ unsigned int i; ++ struct irq_desc *desc; ++ ++ for_each_irq_desc(i, desc) { ++ struct irq_chip *chip; ++ ++ chip = irq_desc_get_chip(desc); ++ if (!chip) ++ continue; ++ ++ if (chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data)) ++ chip->irq_eoi(&desc->irq_data); ++ ++ if (chip->irq_mask) ++ chip->irq_mask(&desc->irq_data); ++ ++ if (chip->irq_disable && !irqd_irq_disabled(&desc->irq_data)) ++ chip->irq_disable(&desc->irq_data); ++ } ++} + + #ifdef CONFIG_SMP + static void kexec_shutdown_secondary(void *regs) diff --git a/queue-6.12/net-dst-introduce-dst-dev_rcu.patch b/queue-6.12/net-dst-introduce-dst-dev_rcu.patch new file mode 100644 index 0000000000..0295e5ff7b --- /dev/null +++ b/queue-6.12/net-dst-introduce-dst-dev_rcu.patch @@ -0,0 +1,107 @@ +From stable+bounces-201116-greg=kroah.com@vger.kernel.org Mon Dec 15 22:56:13 2025 +From: Gyokhan Kochmarla +Date: Mon, 15 Dec 2025 21:51:18 +0000 +Subject: net: dst: introduce dst->dev_rcu +To: +Cc: , , , , , , , , +Message-ID: <20251215215119.63681-2-gyokhan@amazon.de> + +From: Eric Dumazet + +[ Upstream commit caedcc5b6df1b2e2b5f39079e3369c1d4d5c5f50 ] + +Followup of commit 88fe14253e1818 ("net: dst: add four helpers +to annotate data-races around dst->dev"). + +We want to gradually add explicit RCU protection to dst->dev, +including lockdep support. + +Add an union to alias dst->dev_rcu and dst->dev. + +Add dst_dev_net_rcu() helper. + +Fixes: 4a6ce2b6f2ec ("net: introduce a new function dst_dev_put()") +Cc: stable@vger.kernel.org +Signed-off-by: Eric Dumazet +Reviewed-by: David Ahern +Link: https://patch.msgid.link/20250828195823.3958522-2-edumazet@google.com +Signed-off-by: Jakub Kicinski +Stable-dep-of: 50c127a69cd62 ("Replace three dst_dev() with a lockdep enabled helper.") +Signed-off-by: Gyokhan Kochmarla +Signed-off-by: Greg Kroah-Hartman +--- + include/net/dst.h | 16 +++++++++++----- + net/core/dst.c | 2 +- + net/ipv4/route.c | 4 ++-- + 3 files changed, 14 insertions(+), 8 deletions(-) + +--- a/include/net/dst.h ++++ b/include/net/dst.h +@@ -24,7 +24,10 @@ + struct sk_buff; + + struct dst_entry { +- struct net_device *dev; ++ union { ++ struct net_device *dev; ++ struct net_device __rcu *dev_rcu; ++ }; + struct dst_ops *ops; + unsigned long _metrics; + unsigned long expires; +@@ -568,9 +571,12 @@ static inline struct net_device *dst_dev + + static inline struct net_device *dst_dev_rcu(const struct dst_entry *dst) + { +- /* In the future, use rcu_dereference(dst->dev) */ +- WARN_ON_ONCE(!rcu_read_lock_held()); +- return READ_ONCE(dst->dev); ++ return rcu_dereference(dst->dev_rcu); ++} ++ ++static inline struct net *dst_dev_net_rcu(const struct dst_entry *dst) ++{ ++ return dev_net_rcu(dst_dev_rcu(dst)); + } + + static inline struct net_device *skb_dst_dev(const struct sk_buff *skb) +@@ -590,7 +596,7 @@ static inline struct net *skb_dst_dev_ne + + static inline struct net *skb_dst_dev_net_rcu(const struct sk_buff *skb) + { +- return dev_net_rcu(skb_dst_dev(skb)); ++ return dev_net_rcu(skb_dst_dev_rcu(skb)); + } + + struct dst_entry *dst_blackhole_check(struct dst_entry *dst, u32 cookie); +--- a/net/core/dst.c ++++ b/net/core/dst.c +@@ -150,7 +150,7 @@ void dst_dev_put(struct dst_entry *dst) + dst->ops->ifdown(dst, dev); + WRITE_ONCE(dst->input, dst_discard); + WRITE_ONCE(dst->output, dst_discard_out); +- WRITE_ONCE(dst->dev, blackhole_netdev); ++ rcu_assign_pointer(dst->dev_rcu, blackhole_netdev); + netdev_ref_replace(dev, blackhole_netdev, &dst->dev_tracker, + GFP_ATOMIC); + } +--- a/net/ipv4/route.c ++++ b/net/ipv4/route.c +@@ -1030,7 +1030,7 @@ static void __ip_rt_update_pmtu(struct r + return; + + rcu_read_lock(); +- net = dev_net_rcu(dst_dev(dst)); ++ net = dst_dev_net_rcu(dst); + if (mtu < net->ipv4.ip_rt_min_pmtu) { + lock = true; + mtu = min(old_mtu, net->ipv4.ip_rt_min_pmtu); +@@ -1328,7 +1328,7 @@ static unsigned int ipv4_default_advmss( + struct net *net; + + rcu_read_lock(); +- net = dev_net_rcu(dst_dev(dst)); ++ net = dst_dev_net_rcu(dst); + advmss = max_t(unsigned int, ipv4_mtu(dst) - header_size, + net->ipv4.ip_rt_min_advmss); + rcu_read_unlock(); diff --git a/queue-6.12/net-lan743x-allocate-rings-outside-zone_dma.patch b/queue-6.12/net-lan743x-allocate-rings-outside-zone_dma.patch new file mode 100644 index 0000000000..a9b8542ae0 --- /dev/null +++ b/queue-6.12/net-lan743x-allocate-rings-outside-zone_dma.patch @@ -0,0 +1,36 @@ +From 8a8f3f4991761a70834fe6719d09e9fd338a766e Mon Sep 17 00:00:00 2001 +From: Thangaraj Samynathan +Date: Tue, 15 Apr 2025 10:15:09 +0530 +Subject: net: lan743x: Allocate rings outside ZONE_DMA + +From: Thangaraj Samynathan + +commit 8a8f3f4991761a70834fe6719d09e9fd338a766e upstream. + +The driver allocates ring elements using GFP_DMA flags. There is +no dependency from LAN743x hardware on memory allocation should be +in DMA_ZONE. Hence modifying the flags to use only GFP_ATOMIC. This +is consistent with other callers of lan743x_rx_init_ring_element(). + +Reported-by: Zhang, Liyin(CN) +Signed-off-by: Thangaraj Samynathan +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/20250415044509.6695-1-thangaraj.s@microchip.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/microchip/lan743x_main.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/net/ethernet/microchip/lan743x_main.c ++++ b/drivers/net/ethernet/microchip/lan743x_main.c +@@ -2494,8 +2494,7 @@ static int lan743x_rx_process_buffer(str + + /* save existing skb, allocate new skb and map to dma */ + skb = buffer_info->skb; +- if (lan743x_rx_init_ring_element(rx, rx->last_head, +- GFP_ATOMIC | GFP_DMA)) { ++ if (lan743x_rx_init_ring_element(rx, rx->last_head, GFP_ATOMIC)) { + /* failed to allocate next skb. + * Memory is very low. + * Drop this packet and reuse buffer. diff --git a/queue-6.12/series b/queue-6.12/series index 31521f090c..ed0902f777 100644 --- a/queue-6.12/series +++ b/queue-6.12/series @@ -343,3 +343,7 @@ efi-cper-align-arm-cper-type-with-uefi-2.9a-2.10-spe.patch scsi-imm-fix-use-after-free-bug-caused-by-unfinished.patch irqchip-mchp-eic-fix-error-code-in-mchp_eic_domain_a.patch ocfs2-fix-memory-leak-in-ocfs2_merge_rec_left.patch +loongarch-add-machine_kexec_mask_interrupts-implementation.patch +net-lan743x-allocate-rings-outside-zone_dma.patch +net-dst-introduce-dst-dev_rcu.patch +tcp_metrics-use-dst_dev_net_rcu.patch diff --git a/queue-6.12/tcp_metrics-use-dst_dev_net_rcu.patch b/queue-6.12/tcp_metrics-use-dst_dev_net_rcu.patch new file mode 100644 index 0000000000..f9eb309315 --- /dev/null +++ b/queue-6.12/tcp_metrics-use-dst_dev_net_rcu.patch @@ -0,0 +1,55 @@ +From stable+bounces-201117-greg=kroah.com@vger.kernel.org Mon Dec 15 22:53:23 2025 +From: Gyokhan Kochmarla +Date: Mon, 15 Dec 2025 21:51:19 +0000 +Subject: tcp_metrics: use dst_dev_net_rcu() +To: +Cc: , , , , , , , , +Message-ID: <20251215215119.63681-3-gyokhan@amazon.de> + +From: Eric Dumazet + +[ Upstream commit 50c127a69cd6285300931853b352a1918cfa180f ] + +Replace three dst_dev() with a lockdep enabled helper. + +Fixes: 4a6ce2b6f2ec ("net: introduce a new function dst_dev_put()") +Cc: stable@vger.kernel.org +Signed-off-by: Eric Dumazet +Reviewed-by: David Ahern +Link: https://patch.msgid.link/20250828195823.3958522-7-edumazet@google.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Gyokhan Kochmarla +Signed-off-by: Greg Kroah-Hartman +--- + net/ipv4/tcp_metrics.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/net/ipv4/tcp_metrics.c ++++ b/net/ipv4/tcp_metrics.c +@@ -170,7 +170,7 @@ static struct tcp_metrics_block *tcpm_ne + struct net *net; + + spin_lock_bh(&tcp_metrics_lock); +- net = dev_net_rcu(dst_dev(dst)); ++ net = dst_dev_net_rcu(dst); + + /* While waiting for the spin-lock the cache might have been populated + * with this entry and so we have to check again. +@@ -273,7 +273,7 @@ static struct tcp_metrics_block *__tcp_g + return NULL; + } + +- net = dev_net_rcu(dst_dev(dst)); ++ net = dst_dev_net_rcu(dst); + hash ^= net_hash_mix(net); + hash = hash_32(hash, tcp_metrics_hash_log); + +@@ -318,7 +318,7 @@ static struct tcp_metrics_block *tcp_get + else + return NULL; + +- net = dev_net_rcu(dst_dev(dst)); ++ net = dst_dev_net_rcu(dst); + hash ^= net_hash_mix(net); + hash = hash_32(hash, tcp_metrics_hash_log); + -- 2.47.3