5.15.153-rc1 review
Subsystems (3)
Sasha Levin
maintainerPATCH 289/317 octeontx2-af: Use matching wake_up API variant in CGX command interface
In reply to Sasha LevinFrom: Linu Cherian <[email protected]>
[ Upstream commit e642921dfeed1e15e73f78f2c3b6746f72b6deb2 ]
Use wake_up API instead of wake_up_interruptible, since wait_event_timeout API is used for waiting on command completion.
--- drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/cgx.c +1 -1
@@ -1205,7 +1205,7 @@ static irqreturn_t cgx_fwi_event_handler(int irq, void *data)/* Release thread waiting for completion */ lmac->cmd_pend = false; -wake_up_interruptible (&lmac->wq_cmd_cmplt); +wake_up (&lmac->wq_cmd_cmplt);break ;case CGX_EVT_ASYNC :if (cgx_event_is_linkevent (event))
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 290/317 s390/vtime: fix average steal time calculation
In reply to Sasha LevinFrom: Mete Durlu <[email protected]>
[ Upstream commit 367c50f78451d3bd7ad70bc5c89f9ba6dec46ca9 ]
Current average steal timer calculation produces volatile and inflated values. The only user of this value is KVM so far and it uses that to decide whether or not to yield the vCPU which is seeing steal time. KVM compares average steal timer to a threshold and if the threshold is past then it does not allow CPU polling and yields it to host, else it keeps the CPU by polling.
Since KVM's steal time threshold is very low by default (%10) it most likely is not effected much by the bloated average steal timer values because the operating region is pretty small. However there might be new users in the future who might rely on this number. Fix average steal timer calculation by changing the formula from:
avg_steal_timer = avg_steal_timer / 2 + steal_timer;
to the following:
avg_steal_timer = (avg_steal_timer + steal_timer) / 2;
This ensures that avg_steal_timer is actually a naive average of steal timer values. It now closely follows steal timer values but of course in a smoother manner.
--- arch/s390/kernel/vtime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/kernel/vtime.c +2 -2
@@ -211,13 +211,13 @@ void vtime_flush(struct task_struct *tsk)virt_timer_expire (); steal = S390_lowcore.steal_timer; - avg_steal = S390_lowcore.avg_steal_timer /2 ; + avg_steal = S390_lowcore.avg_steal_timer;if ((s64 ) steal >0 ) { S390_lowcore.steal_timer =0 ;account_steal_time (cputime_to_nsecs (steal)); avg_steal += steal; } - S390_lowcore.avg_steal_timer = avg_steal; + S390_lowcore.avg_steal_timer = avg_steal /2 ; }static u64 vtime_delta (void )
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 291/317 soc: fsl: dpio: fix kcalloc() argument order
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 72ebb41b88f9d7c10c5e159e0507074af0a22fe2 ]
A previous bugfix added a call to kcalloc(), which starting in gcc-14 causes a harmless warning about the argument order:
drivers/soc/fsl/dpio/dpio-service.c: In function 'dpaa2_io_service_enqueue_multiple_desc_fq':drivers/soc/fsl/dpio/dpio-service.c:526:29: error: 'kcalloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
526 | ed = kcalloc(sizeof(struct qbman_eq_desc), 32, GFP_KERNEL);
| ^~~~~~drivers/soc/fsl/dpio/dpio-service.c:526:29: note: earlier argument should specify number of elements, later size of each element
Since the two are only multiplied, the order does not change the behavior, so just fix it now to shut up the compiler warning.
Dmity independently came up with the same fix.
--- drivers/soc/fsl/dpio/dpio-service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/fsl/dpio/dpio-service.c +1 -1
@@ -485,7 +485,7 @@ int dpaa2_io_service_enqueue_multiple_desc_fq(struct dpaa2_io *d,struct qbman_eq_desc *ed;int i, ret; - ed =kcalloc (sizeof (struct qbman_eq_desc ),32 ,GFP_KERNEL ); + ed =kcalloc (32 ,sizeof (struct qbman_eq_desc ),GFP_KERNEL );if (!ed)return -ENOMEM ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 292/317 hsr: Fix uninit-value access in hsr_get_node()
In reply to Sasha LevinFrom: Shigeru Yoshida <[email protected]>
[ Upstream commit ddbec99f58571301679addbc022256970ca3eac6 ]
KMSAN reported the following uninit-value access issue [1]:
=====================================================
BUG: KMSAN: uninit-value in hsr_get_node+0xa2e/0xa40 net/hsr/hsr_framereg.c:246 hsr_get_node+0xa2e/0xa40 net/hsr/hsr_framereg.c:246 fill_frame_info net/hsr/hsr_forward.c:577 [inline] hsr_forward_skb+0xe12/0x30e0 net/hsr/hsr_forward.c:615 hsr_dev_xmit+0x1a1/0x270 net/hsr/hsr_device.c:223 __netdev_start_xmit include/linux/netdevice.h:4940 [inline] netdev_start_xmit include/linux/netdevice.h:4954 [inline] xmit_one net/core/dev.c:3548 [inline] dev_hard_start_xmit+0x247/0xa10 net/core/dev.c:3564 __dev_queue_xmit+0x33b8/0x5130 net/core/dev.c:4349 dev_queue_xmit include/linux/netdevice.h:3134 [inline] packet_xmit+0x9c/0x6b0 net/packet/af_packet.c:276 packet_snd net/packet/af_packet.c:3087 [inline] packet_sendmsg+0x8b1d/0x9f30 net/packet/af_packet.c:3119 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] __sys_sendto+0x735/0xa10 net/socket.c:2191 __do_sys_sendto net/socket.c:2203 [inline] __se_sys_sendto net/socket.c:2199 [inline] __x64_sys_sendto+0x125/0x1c0 net/socket.c:2199 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x6d/0x140 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b
Uninit was created at:
slab_post_alloc_hook+0x129/0xa70 mm/slab.h:768 slab_alloc_node mm/slub.c:3478 [inline] kmem_cache_alloc_node+0x5e9/0xb10 mm/slub.c:3523 kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:560 __alloc_skb+0x318/0x740 net/core/skbuff.c:651 alloc_skb include/linux/skbuff.h:1286 [inline] alloc_skb_with_frags+0xc8/0xbd0 net/core/skbuff.c:6334 sock_alloc_send_pskb+0xa80/0xbf0 net/core/sock.c:2787 packet_alloc_skb net/packet/af_packet.c:2936 [inline] packet_snd net/packet/af_packet.c:3030 [inline] packet_sendmsg+0x70e8/0x9f30 net/packet/af_packet.c:3119 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] __sys_sendto+0x735/0xa10 net/socket.c:2191 __do_sys_sendto net/socket.c:2203 [inline] __se_sys_sendto net/socket.c:2199 [inline] __x64_sys_sendto+0x125/0x1c0 net/socket.c:2199 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x6d/0x140 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b CPU: 1 PID: 5033 Comm: syz-executor334 Not tainted 6.7.0-syzkaller-00562-g9f8413c4a66f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 =====================================================
If the packet type ID field in the Ethernet header is either ETH_P_PRP or ETH_P_HSR, but it is not followed by an HSR tag, hsr_get_skb_sequence_nr() reads an invalid value as a sequence number. This causes the above issue.
This patch fixes the issue by returning NULL if the Ethernet header is not followed by an HSR tag.
--- net/hsr/hsr_framereg.c | 4 ++++ 1 file changed, 4 insertions(+)
net/hsr/hsr_framereg.c +4 -0
@@ -237,6 +237,10 @@ struct hsr_node *hsr_get_node(struct hsr_port *port, struct list_head *node_db,*/ if (ethhdr->h_proto ==htons (ETH_P_PRP ) || ethhdr->h_proto ==htons (ETH_P_HSR )) { +/* Check if skb contains hsr_ethhdr */ +if (skb->mac_len <sizeof (struct hsr_ethhdr )) +return NULL ; +/* Use the existing sequence_nr from the tag as starting point * for filtering duplicate frames. */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 293/317 net: mtk_eth_soc: move MAC_MCR setting to mac_finish()
In reply to Sasha LevinFrom: "Russell King (Oracle)" <[email protected]>
[ Upstream commit 0e37ad71b2ff772009595002da2860999e98e14e ]
Move the setting of the MTK_MAC_MCR register from the end of mac_config into the phylink mac_finish() method, to keep it as the very last write that is done during configuration.
Stable-dep-of: f1b85ef15a99 ("net: mediatek: mtk_eth_soc: clear MAC_MCR_FORCE_LINK only when MAC is up")
--- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 33 ++++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +22 -11
@@ -223,8 +223,8 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode, struct mtk_mac *mac = container_of(config, struct mtk_mac, phylink_config);struct mtk_eth *eth = mac->hw; -u32 mcr_cur, mcr_new, sid, i;int val, ge_mode, err =0 ; +u32 sid, i;/* MT76x8 has no hardware settings between for the MAC */ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) &&
@@ -359,6 +359,25 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode,return ; } +return ; + +err_phy: +dev_err (eth->dev,"%s: GMAC%d mode %s not supported!\n" , __func__, + mac->id,phy_modes (state->interface)); +return ; + +init_err: +dev_err (eth->dev,"%s: GMAC%d mode %s err: %d!\n" , __func__, + mac->id,phy_modes (state->interface), err); +} + +static int mtk_mac_finish (struct phylink_config *config,unsigned int mode, +phy_interface_t interface) +{ + struct mtk_mac *mac = container_of(config, struct mtk_mac, + phylink_config); +u32 mcr_cur, mcr_new; +/* Setup gmac */ mcr_cur =mtk_r32 (mac->hw,MTK_MAC_MCR (mac->id)); mcr_new = mcr_cur;
@@ -370,16 +389,7 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode,if (mcr_new != mcr_cur)mtk_w32 (mac->hw, mcr_new,MTK_MAC_MCR (mac->id)); -return ; - -err_phy: -dev_err (eth->dev,"%s: GMAC%d mode %s not supported!\n" , __func__, - mac->id,phy_modes (state->interface)); -return ; - -init_err: -dev_err (eth->dev,"%s: GMAC%d mode %s err: %d!\n" , __func__, - mac->id,phy_modes (state->interface), err); +return 0 ; } static void mtk_mac_pcs_get_state(struct phylink_config *config,
@@ -562,6 +572,7 @@ static const struct phylink_mac_ops mtk_phylink_ops = { .mac_pcs_get_state = mtk_mac_pcs_get_state, .mac_an_restart = mtk_mac_an_restart, .mac_config = mtk_mac_config, + .mac_finish = mtk_mac_finish, .mac_link_down = mtk_mac_link_down, .mac_link_up = mtk_mac_link_up, };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 294/317 net: mediatek: mtk_eth_soc: clear MAC_MCR_FORCE_LINK only when MAC is up
In reply to Sasha LevinFrom: Daniel Golle <[email protected]>
[ Upstream commit f1b85ef15a99f06ed48871ce933d591127d2dcc0 ]
Clearing bit MAC_MCR_FORCE_LINK which forces the link down too early can result in MAC ending up in a broken/blocked state.
Fix this by handling this bit in the .mac_link_up and .mac_link_down calls instead of in .mac_finish.
--- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +3 -4
@@ -382,8 +382,7 @@ static int mtk_mac_finish(struct phylink_config *config, unsigned int mode, mcr_cur =mtk_r32 (mac->hw,MTK_MAC_MCR (mac->id)); mcr_new = mcr_cur; mcr_new |=MAC_MCR_IPG_CFG |MAC_MCR_FORCE_MODE | -MAC_MCR_BACKOFF_EN |MAC_MCR_BACKPR_EN |MAC_MCR_FORCE_LINK | -MAC_MCR_RX_FIFO_CLR_DIS ; +MAC_MCR_BACKOFF_EN |MAC_MCR_BACKPR_EN |MAC_MCR_RX_FIFO_CLR_DIS ;/* Only update control register when needed! */ if (mcr_new != mcr_cur)
@@ -439,7 +438,7 @@ static void mtk_mac_link_down(struct phylink_config *config, unsigned int mode, phylink_config);u32 mcr =mtk_r32 (mac->hw,MTK_MAC_MCR (mac->id)); - mcr &= ~(MAC_MCR_TX_EN |MAC_MCR_RX_EN ); + mcr &= ~(MAC_MCR_TX_EN |MAC_MCR_RX_EN |MAC_MCR_FORCE_LINK );mtk_w32 (mac->hw, mcr,MTK_MAC_MCR (mac->id)); }
@@ -477,7 +476,7 @@ static void mtk_mac_link_up(struct phylink_config *config,if (rx_pause) mcr |=MAC_MCR_FORCE_RX_FC ; - mcr |=MAC_MCR_TX_EN |MAC_MCR_RX_EN ; + mcr |=MAC_MCR_TX_EN |MAC_MCR_RX_EN |MAC_MCR_FORCE_LINK ;mtk_w32 (mac->hw, mcr,MTK_MAC_MCR (mac->id)); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 295/317 net: ethernet: mtk_eth_soc: fix PPE hanging issue
In reply to Sasha LevinFrom: Daniel Golle <[email protected]>
[ Upstream commit ea80e3ed09ab2c2b75724faf5484721753e92c31 ]
A patch to resolve an issue was found in MediaTek's GPL-licensed SDK:
In the mtk_ppe_stop() function, the PPE scan mode is not disabled before disabling the PPE. This can potentially lead to a hang during the process of disabling the PPE.
Without this patch, the PPE may experience a hang during the reboot test.
--- drivers/net/ethernet/mediatek/mtk_ppe.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/net/ethernet/mediatek/mtk_ppe.c +11 -7
@@ -425,7 +425,7 @@ int mtk_ppe_start(struct mtk_ppe *ppe) MTK_PPE_KEEPALIVE_DISABLE) |FIELD_PREP (MTK_PPE_TB_CFG_HASH_MODE ,1 ) |FIELD_PREP (MTK_PPE_TB_CFG_SCAN_MODE , -MTK_PPE_SCAN_MODE_KEEPALIVE_AGE ) | +MTK_PPE_SCAN_MODE_CHECK_AGE ) |FIELD_PREP (MTK_PPE_TB_CFG_ENTRY_NUM ,MTK_PPE_ENTRIES_SHIFT );ppe_w32 (ppe,MTK_PPE_TB_CFG , val);
@@ -493,17 +493,21 @@ int mtk_ppe_stop(struct mtk_ppe *ppe)mtk_ppe_cache_enable (ppe, false); -/* disable offload engine */ -ppe_clear (ppe,MTK_PPE_GLO_CFG ,MTK_PPE_GLO_CFG_EN ); -ppe_w32 (ppe,MTK_PPE_FLOW_CFG ,0 ); -/* disable aging */ val =MTK_PPE_TB_CFG_AGE_NON_L4 |MTK_PPE_TB_CFG_AGE_UNBIND |MTK_PPE_TB_CFG_AGE_TCP |MTK_PPE_TB_CFG_AGE_UDP | -MTK_PPE_TB_CFG_AGE_TCP_FIN ; +MTK_PPE_TB_CFG_AGE_TCP_FIN | +MTK_PPE_TB_CFG_SCAN_MODE ;ppe_clear (ppe,MTK_PPE_TB_CFG , val); -return mtk_ppe_wait_busy (ppe); +if (mtk_ppe_wait_busy (ppe)) +return -ETIMEDOUT ; + +/* disable offload engine */ +ppe_clear (ppe,MTK_PPE_GLO_CFG ,MTK_PPE_GLO_CFG_EN ); +ppe_w32 (ppe,MTK_PPE_FLOW_CFG ,0 ); + +return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 296/317 packet: annotate data-races around ignore_outgoing
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit 6ebfad33161afacb3e1e59ed1c2feefef70f9f97 ]
ignore_outgoing is read locklessly from dev_queue_xmit_nit() and packet_getsockopt()
Add appropriate READ_ONCE()/WRITE_ONCE() annotations.
syzbot reported:
BUG: KCSAN: data-race in dev_queue_xmit_nit / packet_setsockopt
write to 0xffff888107804542 of 1 bytes by task 22618 on cpu 0:
packet_setsockopt+0xd83/0xfd0 net/packet/af_packet.c:4003 do_sock_setsockopt net/socket.c:2311 [inline] __sys_setsockopt+0x1d8/0x250 net/socket.c:2334 __do_sys_setsockopt net/socket.c:2343 [inline] __se_sys_setsockopt net/socket.c:2340 [inline] __x64_sys_setsockopt+0x66/0x80 net/socket.c:2340 do_syscall_64+0xd3/0x1d0 entry_SYSCALL_64_after_hwframe+0x6d/0x75
read to 0xffff888107804542 of 1 bytes by task 27 on cpu 1:
dev_queue_xmit_nit+0x82/0x620 net/core/dev.c:2248 xmit_one net/core/dev.c:3527 [inline] dev_hard_start_xmit+0xcc/0x3f0 net/core/dev.c:3547 __dev_queue_xmit+0xf24/0x1dd0 net/core/dev.c:4335 dev_queue_xmit include/linux/netdevice.h:3091 [inline] batadv_send_skb_packet+0x264/0x300 net/batman-adv/send.c:108 batadv_send_broadcast_skb+0x24/0x30 net/batman-adv/send.c:127 batadv_iv_ogm_send_to_if net/batman-adv/bat_iv_ogm.c:392 [inline] batadv_iv_ogm_emit net/batman-adv/bat_iv_ogm.c:420 [inline] batadv_iv_send_outstanding_bat_ogm_packet+0x3f0/0x4b0 net/batman-adv/bat_iv_ogm.c:1700 process_one_work kernel/workqueue.c:3254 [inline] process_scheduled_works+0x465/0x990 kernel/workqueue.c:3335 worker_thread+0x526/0x730 kernel/workqueue.c:3416 kthread+0x1d1/0x210 kernel/kthread.c:388 ret_from_fork+0x4b/0x60 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243
value changed: 0x00 -> 0x01
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 27 Comm: kworker/u8:1 Tainted: G W 6.8.0-syzkaller-08073-g480e035fc4c7 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024 Workqueue: bat_events batadv_iv_send_outstanding_bat_ogm_packet
--- net/core/dev.c | 2 +- net/packet/af_packet.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
net/core/dev.c +1 -1
@@ -2291,7 +2291,7 @@ void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)rcu_read_lock (); again:list_for_each_entry_rcu (ptype, ptype_list, list) { -if (ptype->ignore_outgoing) +if (READ_ONCE (ptype->ignore_outgoing))continue ;/* Never send packets back to the socket
net/packet/af_packet.c +2 -2
@@ -3951,7 +3951,7 @@ packet_setsockopt(struct socket *sock, int level, int optname, sockptr_t optval,if (val <0 || val >1 )return -EINVAL ; - po->prot_hook.ignore_outgoing = !!val; +WRITE_ONCE (po->prot_hook.ignore_outgoing, !!val);return 0 ; }case PACKET_TX_HAS_OFF :
@@ -4080,7 +4080,7 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, 0);break ;case PACKET_IGNORE_OUTGOING : - val = po->prot_hook.ignore_outgoing; + val =READ_ONCE (po->prot_hook.ignore_outgoing);break ;case PACKET_ROLLOVER_STATS :if (!po->rollover)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 297/317 net: veth: do not manipulate GRO when using XDP
In reply to Sasha LevinFrom: Ignat Korchagin <[email protected]>
[ Upstream commit d7db7775ea2e31502d46427f5efd385afc4ff1eb ]
Commit d3256efd8e8b ("veth: allow enabling NAPI even without XDP") tried to fix the fact that GRO was not possible without XDP, because veth did not use NAPI without XDP. However, it also introduced the behaviour that GRO is always enabled, when XDP is enabled.
While it might be desired for most cases, it is confusing for the user at best as the GRO flag suddenly changes, when an XDP program is attached. It also introduces some complexities in state management as was partially addressed in commit fe9f801355f0 ("net: veth: clear GRO when clearing XDP even when down").
But the biggest problem is that it is not possible to disable GRO at all, when an XDP program is attached, which might be needed for some use cases.
Fix this by not touching the GRO flag on XDP enable/disable as the code already supports switching to NAPI if either GRO or XDP is requested.
--- drivers/net/veth.c | 18 ------------------ 1 file changed, 18 deletions(-)
drivers/net/veth.c +0 -18
@@ -1388,8 +1388,6 @@ static netdev_features_t veth_fix_features(struct net_device *dev,if (peer_priv->_xdp_prog) features &= ~NETIF_F_GSO_SOFTWARE ; } -if (priv->_xdp_prog) - features |=NETIF_F_GRO ;return features; }
@@ -1481,14 +1479,6 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog, }if (!old_prog) { -if (!veth_gro_requested (dev)) { -/* user-space did not require GRO, but adding -* XDP is supposed to get GRO working -*/ - dev->features |=NETIF_F_GRO ; -netdev_features_change (dev); - } - peer->hw_features &= ~NETIF_F_GSO_SOFTWARE ; peer->max_mtu = max_mtu; }
@@ -1499,14 +1489,6 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog,if (dev->flags &IFF_UP )veth_disable_xdp (dev); -/* if user-space did not require GRO, since adding XDP -* enabled it, clear it now -*/ -if (!veth_gro_requested (dev)) { - dev->features &= ~NETIF_F_GRO ; -netdev_features_change (dev); - } -if (peer) { peer->hw_features |=NETIF_F_GSO_SOFTWARE ; peer->max_mtu =ETH_MAX_MTU ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 298/317 net: dsa: mt7530: prevent possible incorrect XTAL frequency selection
In reply to Sasha LevinFrom: Arınç ÜNAL <[email protected]>
[ Upstream commit f490c492e946d8ffbe65ad4efc66de3c5ede30a4 ]
On MT7530, the HT_XTAL_FSEL field of the HWTRAP register stores a 2-bit value that represents the frequency of the crystal oscillator connected to the switch IC. The field is populated by the state of the ESW_P4_LED_0 and ESW_P4_LED_0 pins, which is done right after reset is deasserted.
ESW_P4_LED_0 ESW_P3_LED_0 Frequency
-----------------------------------------
0 0 Reserved 0 1 20MHz 1 0 40MHz 1 1 25MHz
On MT7531, the XTAL25 bit of the STRAP register stores this. The LAN0LED0 pin is used to populate the bit. 25MHz when the pin is high, 40MHz when it's low.
These pins are also used with LEDs, therefore, their state can be set to something other than the bootstrapping configuration. For example, a link may be established on port 3 before the DSA subdriver takes control of the switch which would set ESW_P3_LED_0 to high.
Currently on mt7530_setup() and mt7531_setup(), 1000 - 1100 usec delay is described between reset assertion and deassertion. Some switch ICs in real life conditions cannot always have these pins set back to the bootstrapping configuration before reset deassertion in this amount of delay. This causes wrong crystal frequency to be selected which puts the switch in a nonfunctional state after reset deassertion.
The tests below are conducted on an MT7530 with a 40MHz crystal oscillator by Justin Swartz.
With a cable from an active peer connected to port 3 before reset, an incorrect crystal frequency (0b11 = 25MHz) is selected:
[1] [3] [5]
: : :
_____________________________ __________________
ESW_P4_LED_0 |_______|
_____________________________ESW_P3_LED_0 |__________________________
: : : :
: : [4]...:
: :
[2]................:[1] Reset is asserted.
[2] Period of 1000 - 1100 usec.
[3] Reset is deasserted.
[4] Period of 315 usec. HWTRAP register is populated with incorrect XTAL frequency.
[5] Signals reflect the bootstrapped configuration.
Increase the delay between reset_control_assert() and reset_control_deassert(), and gpiod_set_value_cansleep(priv->reset, 0) and gpiod_set_value_cansleep(priv->reset, 1) to 5000 - 5100 usec. This amount ensures a higher possibility that the switch IC will have these pins back to the bootstrapping configuration before reset deassertion.
With a cable from an active peer connected to port 3 before reset, the correct crystal frequency (0b10 = 40MHz) is selected:
[1] [2-1] [3] [5]
: : : :
_____________________________ __________________
ESW_P4_LED_0 |_______|
___________________ _______ESW_P3_LED_0 |_________| |__________________
: : : : :
: [2-2]...: [4]...:
[2]................:[1] Reset is asserted.
[2] Period of 5000 - 5100 usec.
[2-1] ESW_P3_LED_0 goes low.
[2-2] Remaining period of 5000 - 5100 usec.
[3] Reset is deasserted.
[4] Period of 310 usec. HWTRAP register is populated with bootstrapped XTAL frequency.
[5] Signals reflect the bootstrapped configuration.
ESW_P3_LED_0 low period before reset deassertion:
5000 usec
- 5100 usec
TEST RESET HOLD
# (usec)
---------------------
1 5410
2 5440
3 4375
4 5490
5 5475
6 4335
7 4370
8 5435
9 4205
10 4335
11 3750
12 3170
13 4395
14 4375
15 3515
16 4335
17 4220
18 4175
19 4175
20 4350 Min 3170
Max 5490
Median 4342.500
Avg 4466.500
Revert commit 2920dd92b980 ("net: dsa: mt7530: disable LEDs before reset"). Changing the state of pins via reset assertion is simpler and more efficient than doing so by setting the LED controller off.
--- drivers/net/dsa/mt7530.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/dsa/mt7530.c +4 -4
@@ -2154,11 +2154,11 @@ mt7530_setup(struct dsa_switch *ds)*/ if (priv->mcm) {reset_control_assert (priv->rstc); -usleep_range (1000 ,1100 ); +usleep_range (5000 ,5100 );reset_control_deassert (priv->rstc); }else {gpiod_set_value_cansleep (priv->reset,0 ); -usleep_range (1000 ,1100 ); +usleep_range (5000 ,5100 );gpiod_set_value_cansleep (priv->reset,1 ); }
@@ -2368,11 +2368,11 @@ mt7531_setup(struct dsa_switch *ds)*/ if (priv->mcm) {reset_control_assert (priv->rstc); -usleep_range (1000 ,1100 ); +usleep_range (5000 ,5100 );reset_control_deassert (priv->rstc); }else {gpiod_set_value_cansleep (priv->reset,0 ); -usleep_range (1000 ,1100 ); +usleep_range (5000 ,5100 );gpiod_set_value_cansleep (priv->reset,1 ); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 299/317 vdpa/mlx5: Allow CVQ size changes
In reply to Sasha LevinFrom: Jonah Palmer <[email protected]>
[ Upstream commit 749a4016839270163efc36ecddddd01de491a16b ]
The MLX driver was not updating its control virtqueue size at set_vq_num and instead always initialized to MLX5_CVQ_MAX_ENT (16) at setup_cvq_vring.
Qemu would try to set the size to 64 by default, however, because the CVQ size always was initialized to 16, an error would be thrown when sending >16 control messages (as used-ring entry 17 is initialized to 0). For example, starting a guest with x-svq=on and then executing the following command would produce the error below:
# for i in {1..20}; do ifconfig eth0 hw ether XX:xx:XX:xx:XX:XX; doneqemu-system-x86_64: Insufficient written data (0)
[ 435.331223] virtio_net virtio0: Failed to set mac address by vq command. SIOCSIFHWADDR: Invalid argument
Message-Id: <[email protected]>
--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +9 -4
@@ -173,8 +173,6 @@ static void teardown_driver(struct mlx5_vdpa_net *ndev);static bool mlx5_vdpa_debug; -#define MLX5_CVQ_MAX_ENT 16 -#define MLX5_LOG_VIO_FLAG (_feature) \ do { \ if (features & BIT_ULL(_feature)) \
@@ -1685,9 +1683,16 @@ static void mlx5_vdpa_set_vq_num(struct vdpa_device *vdev, u16 idx, u32 num)struct mlx5_vdpa_net *ndev =to_mlx5_vdpa_ndev (mvdev);struct mlx5_vdpa_virtqueue *mvq; -if (!is_index_valid (mvdev, idx) ||is_ctrl_vq_idx (mvdev, idx)) +if (!is_index_valid (mvdev, idx))return ; +if (is_ctrl_vq_idx (mvdev, idx)) { +struct mlx5_control_vq *cvq = &mvdev->cvq; + + cvq->vring.vring.num = num; +return ; + } + mvq = &ndev->vqs[idx]; mvq->num_ent = num; }
@@ -2182,7 +2187,7 @@ static int setup_cvq_vring(struct mlx5_vdpa_dev *mvdev)u16 idx = cvq->vring.last_avail_idx; err =vringh_init_iotlb (&cvq->vring, mvdev->actual_features, -MLX5_CVQ_MAX_ENT , false, + cvq->vring.vring.num, false, (struct vring_desc *)(uintptr_t )cvq->desc_addr, (struct vring_avail *)(uintptr_t )cvq->driver_addr, (struct vring_used *)(uintptr_t )cvq->device_addr);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 300/317 wireguard: receive: annotate data-race around receiving_counter.counter
In reply to Sasha LevinFrom: Nikita Zhandarovich <[email protected]>
[ Upstream commit bba045dc4d996d03dce6fe45726e78a1a1f6d4c3 ]
Syzkaller with KCSAN identified a data-race issue when accessing keypair->receiving_counter.counter. Use READ_ONCE() and WRITE_ONCE() annotations to mark the data race as intentional.
BUG: KCSAN: data-race in wg_packet_decrypt_worker / wg_packet_rx_poll
write to 0xffff888107765888 of 8 bytes by interrupt on cpu 0:
counter_validate drivers/net/wireguard/receive.c:321 [inline]
wg_packet_rx_poll+0x3ac/0xf00 drivers/net/wireguard/receive.c:461
__napi_poll+0x60/0x3b0 net/core/dev.c:6536
napi_poll net/core/dev.c:6605 [inline]
net_rx_action+0x32b/0x750 net/core/dev.c:6738
__do_softirq+0xc4/0x279 kernel/softirq.c:553
do_softirq+0x5e/0x90 kernel/softirq.c:454
__local_bh_enable_ip+0x64/0x70 kernel/softirq.c:381
__raw_spin_unlock_bh include/linux/spinlock_api_smp.h:167 [inline]
_raw_spin_unlock_bh+0x36/0x40 kernel/locking/spinlock.c:210
spin_unlock_bh include/linux/spinlock.h:396 [inline]
ptr_ring_consume_bh include/linux/ptr_ring.h:367 [inline]
wg_packet_decrypt_worker+0x6c5/0x700 drivers/net/wireguard/receive.c:499
process_one_work kernel/workqueue.c:2633 [inline]
...
read to 0xffff888107765888 of 8 bytes by task 3196 on cpu 1:
decrypt_packet drivers/net/wireguard/receive.c:252 [inline]
wg_packet_decrypt_worker+0x220/0x700 drivers/net/wireguard/receive.c:501
process_one_work kernel/workqueue.c:2633 [inline]
process_scheduled_works+0x5b8/0xa30 kernel/workqueue.c:2706
worker_thread+0x525/0x730 kernel/workqueue.c:2787
...--- drivers/net/wireguard/receive.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireguard/receive.c +3 -3
@@ -258,7 +258,7 @@ static bool decrypt_packet(struct sk_buff *skb, struct noise_keypair *keypair)if (unlikely (!READ_ONCE (keypair->receiving.is_valid) ||wg_birthdate_has_expired (keypair->receiving.birthdate,REJECT_AFTER_TIME ) || - keypair->receiving_counter.counter >=REJECT_AFTER_MESSAGES )) { +READ_ONCE (keypair->receiving_counter.counter) >=REJECT_AFTER_MESSAGES )) {WRITE_ONCE (keypair->receiving.is_valid, false);return false; }
@@ -325,7 +325,7 @@ static bool counter_validate(struct noise_replay_counter *counter, u64 their_coufor (i =1 ; i <= top; ++i) counter->backtrack[(i + index_current) & ((COUNTER_BITS_TOTAL /BITS_PER_LONG ) -1 )] =0 ; - counter->counter = their_counter; +WRITE_ONCE (counter->counter, their_counter); } index &= (COUNTER_BITS_TOTAL /BITS_PER_LONG ) -1 ;
@@ -470,7 +470,7 @@ int wg_packet_rx_poll(struct napi_struct *napi, int budget)net_dbg_ratelimited ("%s: Packet has invalid nonce %llu (max %llu)\n" , peer->device->dev->name,PACKET_CB (skb)->nonce, - keypair->receiving_counter.counter); +READ_ONCE (keypair->receiving_counter.counter)); goto next; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 301/317 rds: introduce acquire/release ordering in acquire/release_in_xmit()
In reply to Sasha LevinFrom: Yewon Choi <[email protected]>
[ Upstream commit 1422f28826d2a0c11e5240b3e951c9e214d8656e ]
acquire/release_in_xmit() work as bit lock in rds_send_xmit(), so they are expected to ensure acquire/release memory ordering semantics. However, test_and_set_bit/clear_bit() don't imply such semantics, on top of this, following smp_mb__after_atomic() does not guarantee release ordering (memory barrier actually should be placed before clear_bit()).
Instead, we use clear_bit_unlock/test_and_set_bit_lock() here.
--- net/rds/send.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
net/rds/send.c +2 -3
@@ -103,13 +103,12 @@ EXPORT_SYMBOL_GPL(rds_send_path_reset);static int acquire_in_xmit (struct rds_conn_path *cp) { -return test_and_set_bit (RDS_IN_XMIT , &cp->cp_flags) ==0 ; +return test_and_set_bit_lock (RDS_IN_XMIT , &cp->cp_flags) ==0 ; }static void release_in_xmit (struct rds_conn_path *cp) { -clear_bit (RDS_IN_XMIT , &cp->cp_flags); -smp_mb__after_atomic (); +clear_bit_unlock (RDS_IN_XMIT , &cp->cp_flags);/* * We don't use wait_on_bit()/wake_up_bit() because our waking is in a * hot path and finding waiters is very rare. We don't want to walk
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 302/317 hsr: Handle failures in module init
In reply to Sasha LevinFrom: Felix Maurer <[email protected]>
[ Upstream commit 3cf28cd492308e5f63ed00b29ea03ca016264376 ]
A failure during registration of the netdev notifier was not handled at all. A failure during netlink initialization did not unregister the netdev notifier.
Handle failures of netdev notifier registration and netlink initialization. Both functions should only return negative values on failure and thereby lead to the hsr module not being loaded.
--- net/hsr/hsr_main.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
net/hsr/hsr_main.c +11 -4
@@ -148,14 +148,21 @@ static struct notifier_block hsr_nb = {static int __init hsr_init (void ) { -int res; +int err;BUILD_BUG_ON (sizeof (struct hsr_tag ) !=HSR_HLEN ); -register_netdevice_notifier (&hsr_nb); - res =hsr_netlink_init (); + err =register_netdevice_notifier (&hsr_nb); +if (err) +return err; + + err =hsr_netlink_init (); +if (err) { +unregister_netdevice_notifier (&hsr_nb); +return err; + } -return res; +return 0 ; } static void __exit hsr_exit(void)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 303/317 net: phy: fix phy_read_poll_timeout argument type in genphy_loopback
In reply to Sasha LevinFrom: Nikita Kiryushin <[email protected]>
[ Upstream commit 32fa4366cc4da1c97b725a0066adf43c6b298f37 ]
read_poll_timeout inside phy_read_poll_timeout can set val negative in some cases (for example, __mdiobus_read inside phy_read can return -EOPNOTSUPP).
Supposedly, commit 4ec732951702 ("net: phylib: fix phy_read*_poll_timeout()") should fix problems with wrong-signed vals, but I do not see how as val is sent to phy_read as is and __val = phy_read (not val) is checked for sign.
Change val type for signed to allow better error handling as done in other phy_read_poll_timeout callers. This will not fix any error handling by itself, but allows, for example, to modify cond with appropriate sign check or check resulting val separately.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/phy/phy_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/phy_device.c +2 -2
@@ -2645,8 +2645,8 @@ EXPORT_SYMBOL(genphy_resume);int genphy_loopback (struct phy_device *phydev,bool enable) {if (enable) { -u16 val, ctl =BMCR_LOOPBACK ; -int ret; +u16 ctl =BMCR_LOOPBACK ; +int ret, val;if (phydev->speed ==SPEED_1000 ) ctl |=BMCR_SPEED1000 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 304/317 net/bnx2x: Prevent access to a freed page in page_pool
In reply to Sasha LevinFrom: Thinh Tran <[email protected]>
[ Upstream commit d27e2da94a42655861ca4baea30c8cd65546f25d ]
Fix race condition leading to system crash during EEH error handling
During EEH error recovery, the bnx2x driver's transmit timeout logic could cause a race condition when handling reset tasks. The bnx2x_tx_timeout() schedules reset tasks via bnx2x_sp_rtnl_task(), which ultimately leads to bnx2x_nic_unload(). In bnx2x_nic_unload() SGEs are freed using bnx2x_free_rx_sge_range(). However, this could overlap with the EEH driver's attempt to reset the device using bnx2x_io_slot_reset(), which also tries to free SGEs. This race condition can result in system crashes due to accessing freed memory locations in bnx2x_free_rx_sge()
799 static inline void bnx2x_free_rx_sge(struct bnx2x *bp,
800 struct bnx2x_fastpath *fp, u16 index)
801 {
802 struct sw_rx_page *sw_buf = &fp->rx_page_ring[index];
803 struct page *page = sw_buf->page;
....
where sw_buf was set to NULL after the call to dma_unmap_page() by the preceding thread.
EEH: Beginning: 'slot_reset'
PCI 0011:01:00.0#10000: EEH: Invoking bnx2x->slot_reset()
bnx2x: [bnx2x_io_slot_reset:14228(eth1)]IO slot reset initializing...
bnx2x 0011:01:00.0: enabling device (0140 -> 0142)
bnx2x: [bnx2x_io_slot_reset:14244(eth1)]IO slot reset --> driver unload
Kernel attempted to read user page (0) - exploit attempt? (uid: 0)
BUG: Kernel NULL pointer dereference on read at 0x00000000
Faulting instruction address: 0xc0080000025065fc
Oops: Kernel access of bad area, sig: 11 [#1]
.....
Call Trace:
[c000000003c67a20] [c00800000250658c] bnx2x_io_slot_reset+0x204/0x610 [bnx2x] (unreliable)
[c000000003c67af0] [c0000000000518a8] eeh_report_reset+0xb8/0xf0
[c000000003c67b60] [c000000000052130] eeh_pe_report+0x180/0x550
[c000000003c67c70] [c00000000005318c] eeh_handle_normal_event+0x84c/0xa60
[c000000003c67d50] [c000000000053a84] eeh_event_handler+0xf4/0x170
[c000000003c67da0] [c000000000194c58] kthread+0x1c8/0x1d0
[c000000003c67e10] [c00000000000cf64] ret_from_kernel_thread+0x5c/0x64To solve this issue, we need to verify page pool allocations before freeing.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +3 -3
@@ -1002,9 +1002,6 @@ static inline void bnx2x_set_fw_mac_addr(__le16 *fw_hi, __le16 *fw_mid,static inline void bnx2x_free_rx_mem_pool (struct bnx2x *bp,struct bnx2x_alloc_pool *pool) { -if (!pool->page) -return ; -put_page (pool->page); pool->page =NULL ;
@@ -1015,6 +1012,9 @@ static inline void bnx2x_free_rx_sge_range(struct bnx2x *bp, {int i; +if (!fp->page_pool.page) +return ; +if (fp->mode ==TPA_MODE_DISABLED )return ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 305/317 octeontx2-af: Use separate handlers for interrupts
In reply to Sasha LevinFrom: Subbaraya Sundeep <[email protected]>
[ Upstream commit 50e60de381c342008c0956fd762e1c26408f372c ]
For PF to AF interrupt vector and VF to AF vector same interrupt handler is registered which is causing race condition. When two interrupts are raised to two CPUs at same time then two cores serve same event corrupting the data.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +14 -3
@@ -2435,10 +2435,9 @@ static void rvu_queue_work(struct mbox_wq_info *mw, int first, } } -static irqreturn_t rvu_mbox_intr_handler (int irq,void *rvu_irq) +static irqreturn_t rvu_mbox_pf_intr_handler (int irq,void *rvu_irq) {struct rvu *rvu = (struct rvu *)rvu_irq; -int vfs = rvu->vfs;u64 intr; intr =rvu_read64 (rvu,BLKADDR_RVUM ,RVU_AF_PFAF_MBOX_INT );
@@ -2452,6 +2451,18 @@ static irqreturn_t rvu_mbox_intr_handler(int irq, void *rvu_irq)rvu_queue_work (&rvu->afpf_wq_info,0 , rvu->hw->total_pfs, intr); +return IRQ_HANDLED ; +} + +static irqreturn_t rvu_mbox_intr_handler (int irq,void *rvu_irq) +{ +struct rvu *rvu = (struct rvu *)rvu_irq; +int vfs = rvu->vfs; +u64 intr; + +/* Sync with mbox memory region */ +rmb (); +/* Handle VF interrupts */ if (vfs >64 ) { intr =rvupf_read64 (rvu,RVU_PF_VFPF_MBOX_INTX (1 ));
@@ -2779,7 +2790,7 @@ static int rvu_register_interrupts(struct rvu *rvu)/* Register mailbox interrupt handler */ sprintf (&rvu->irq_name[RVU_AF_INT_VEC_MBOX *NAME_SIZE ],"RVUAF Mbox" ); ret =request_irq (pci_irq_vector (rvu->pdev,RVU_AF_INT_VEC_MBOX ), - rvu_mbox_intr_handler,0 , + rvu_mbox_pf_intr_handler,0 , &rvu->irq_name[RVU_AF_INT_VEC_MBOX *NAME_SIZE ], rvu);if (ret) { dev_err(rvu->dev,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 306/317 netfilter: nft_set_pipapo: release elements in clone only from destroy path
In reply to Sasha LevinFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit b0e256f3dd2ba6532f37c5c22e07cb07a36031ee ]
Clone already always provides a current view of the lookup table, use it to destroy the set, otherwise it is possible to destroy elements twice.
This fix requires:
212ed75dc5fb ("netfilter: nf_tables: integrate pipapo into commit protocol")
which came after:
9827a0e6e23b ("netfilter: nft_set_pipapo: release elements in clone from abort path").
--- net/netfilter/nft_set_pipapo.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
net/netfilter/nft_set_pipapo.c +1 -4
@@ -2240,8 +2240,6 @@ static void nft_pipapo_destroy(const struct nft_ctx *ctx,if (m) {rcu_barrier (); -nft_set_pipapo_match_destroy (ctx, set, m); -for_each_possible_cpu (cpu)pipapo_free_scratch (m, cpu);free_percpu (m->scratch);
@@ -2253,8 +2251,7 @@ static void nft_pipapo_destroy(const struct nft_ctx *ctx,if (priv->clone) { m = priv->clone; -if (priv->dirty) -nft_set_pipapo_match_destroy (ctx, set, m); +nft_set_pipapo_match_destroy (ctx, set, m);for_each_possible_cpu (cpu)pipapo_free_scratch (priv->clone, cpu);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 307/317 netfilter: nf_tables: do not compare internal table flags on updates
In reply to Sasha LevinFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 4a0e7f2decbf9bd72461226f1f5f7dcc4b08f139 ]
Restore skipping transaction if table update does not modify flags.
--- net/netfilter/nf_tables_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +1 -1
@@ -1152,7 +1152,7 @@ static int nf_tables_updtable(struct nft_ctx *ctx)if (flags & ~NFT_TABLE_F_MASK )return -EOPNOTSUPP ; -if (flags == ctx->table->flags) +if (flags == (ctx->table->flags &NFT_TABLE_F_MASK ))return 0 ; if ((nft_table_has_owner(ctx->table) &&
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 308/317 rcu: add a helper to report consolidated flavor QS
In reply to Sasha LevinFrom: Yan Zhai <[email protected]>
[ Upstream commit 1a77557d48cff187a169c2aec01c0dd78a5e7e50 ]
When under heavy load, network processing can run CPU-bound for many tens of seconds. Even in preemptible kernels (non-RT kernel), this can block RCU Tasks grace periods, which can cause trace-event removal to take more than a minute, which is unacceptably long.
This commit therefore creates a new helper function that passes through both RCU and RCU-Tasks quiescent states every 100 milliseconds. This hard-coded value suffices for current workloads.
Stable-dep-of: d6dbbb11247c ("net: report RCU QS on threaded NAPI repolling")
--- include/linux/rcupdate.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
include/linux/rcupdate.h +31 -0
@@ -230,6 +230,37 @@ do { \cond_resched (); \ }while (0 ) +/** +* rcu_softirq_qs_periodic - Report RCU and RCU-Tasks quiescent states +* @old_ts: jiffies at start of processing. +* +* This helper is for long-running softirq handlers, such as NAPI threads in +* networking. The caller should initialize the variable passed in as @old_ts +* at the beginning of the softirq handler. When invoked frequently, this macro +* will invoke rcu_softirq_qs() every 100 milliseconds thereafter, which will +* provide both RCU and RCU-Tasks quiescent states. Note that this macro +* modifies its old_ts argument. +* +* Because regions of code that have disabled softirq act as RCU read-side +* critical sections, this macro should be invoked with softirq (and +* preemption) enabled. +* +* The macro is not needed when CONFIG_PREEMPT_RT is defined. RT kernels would +* have more chance to invoke schedule() calls and provide necessary quiescent +* states. As a contrast, calling cond_resched() only won't achieve the same +* effect because cond_resched() does not provide RCU-Tasks quiescent states. + */ +#define rcu_softirq_qs_periodic (old_ts) \ +do { \ + if (!IS_ENABLED(CONFIG_PREEMPT_RT) && \ + time_after(jiffies, (old_ts) + HZ / 10)) { \ + preempt_disable(); \ + rcu_softirq_qs(); \ + preempt_enable(); \ + (old_ts) = jiffies; \ + } \ +} while (0) +/* * Infrastructure to implement the synchronize_() primitives in * TREE_RCU and rcu_barrier_() primitives in TINY_RCU.
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 309/317 net: report RCU QS on threaded NAPI repolling
In reply to Sasha LevinFrom: Yan Zhai <[email protected]>
[ Upstream commit d6dbbb11247c71203785a2c9da474c36f4b19eae ]
NAPI threads can keep polling packets under load. Currently it is only calling cond_resched() before repolling, but it is not sufficient to clear out the holdout of RCU tasks, which prevent BPF tracing programs from detaching for long period. This can be reproduced easily with following set up:
ip netns add test1
ip netns add test2
ip -n test1 link add veth1 type veth peer name veth2 netns test2
ip -n test1 link set veth1 up
ip -n test1 link set lo up
ip -n test2 link set veth2 up
ip -n test2 link set lo up
ip -n test1 addr add 192.168.1.2/31 dev veth1
ip -n test1 addr add 1.1.1.1/32 dev lo
ip -n test2 addr add 192.168.1.3/31 dev veth2
ip -n test2 addr add 2.2.2.2/31 dev lo
ip -n test1 route add default via 192.168.1.3
ip -n test2 route add default via 192.168.1.2
for i in seq 10 210; do
for j in seq 10 210; do
ip netns exec test2 iptables -I INPUT -s 3.3.$i.$j -p udp --dport 5201
done
done
ip netns exec test2 ethtool -K veth2 gro on
ip netns exec test2 bash -c 'echo 1 > /sys/class/net/veth2/threaded' ip netns exec test1 ethtool -K veth1 tso off
Then run an iperf3 client/server and a bpftrace script can trigger it:
ip netns exec test2 iperf3 -s -B 2.2.2.2 >/dev/null&
ip netns exec test1 iperf3 -c 2.2.2.2 -B 1.1.1.1 -u -l 1500 -b 3g -t 100 >/dev/null& bpftrace -e 'kfunc:__napi_poll{@=count();} interval:s:1{exit();}'
Report RCU quiescent states periodically will resolve the issue.
--- net/core/dev.c | 3 +++ 1 file changed, 3 insertions(+)
net/core/dev.c +3 -0
@@ -7143,6 +7143,8 @@ static int napi_threaded_poll(void *data)void *have;while (!napi_thread_wait (napi)) { +unsigned long last_qs = jiffies; +for (;;) {bool repoll = false;
@@ -7157,6 +7159,7 @@ static int napi_threaded_poll(void *data)if (!repoll)break ; +rcu_softirq_qs_periodic (last_qs);cond_resched (); } }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 310/317 bpf: report RCU QS in cpumap kthread
In reply to Sasha LevinFrom: Yan Zhai <[email protected]>
[ Upstream commit 00bf63122459e87193ee7f1bc6161c83a525569f ]
When there are heavy load, cpumap kernel threads can be busy polling packets from redirect queues and block out RCU tasks from reaching quiescent states. It is insufficient to just call cond_resched() in such context. Periodically raise a consolidated RCU QS before cond_resched fixes the problem.
--- kernel/bpf/cpumap.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/bpf/cpumap.c +3 -0
@@ -305,6 +305,7 @@ static int cpu_map_bpf_prog_run(struct bpf_cpu_map_entry *rcpu, void **frames,static int cpu_map_kthread_run (void *data) {struct bpf_cpu_map_entry *rcpu = data; +unsigned long last_qs = jiffies;complete (&rcpu->kthread_running);set_current_state (TASK_INTERRUPTIBLE );
@@ -330,10 +331,12 @@ static int cpu_map_kthread_run(void *data)if (__ptr_ring_empty (rcpu->queue)) {schedule (); sched =1 ; + last_qs = jiffies; }else {__set_current_state (TASK_RUNNING ); } }else { +rcu_softirq_qs_periodic (last_qs); sched =cond_resched (); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 311/317 net: dsa: mt7530: fix handling of LLDP frames
In reply to Sasha LevinFrom: Arınç ÜNAL <[email protected]>
[ Upstream commit 8332cf6fd7c7087dbc2067115b33979c9851bbc4 ]
LLDP frames are link-local frames, therefore they must be trapped to the CPU port. Currently, the MT753X switches treat LLDP frames as regular multicast frames, therefore flooding them to user ports. To fix this, set LLDP frames to be trapped to the CPU port(s).
Stable-dep-of: e8bf353577f3 ("net: dsa: mt7530: fix link-local frames that ingress vlan filtering ports")
--- drivers/net/dsa/mt7530.c | 4 ++++ drivers/net/dsa/mt7530.h | 5 +++++ 2 files changed, 9 insertions(+)
drivers/net/dsa/mt7530.c +4 -0
@@ -999,6 +999,10 @@ mt753x_trap_frames(struct mt7530_priv *priv)/* Trap BPDUs to the CPU port(s) */ mt7530_rmw (priv,MT753X_BPC ,MT753X_BPDU_PORT_FW_MASK ,MT753X_BPDU_CPU_ONLY ); + +/* Trap LLDP frames with :0E MAC DA to the CPU port(s) */ +mt7530_rmw (priv,MT753X_RGAC2 ,MT753X_R0E_PORT_FW_MASK , +MT753X_R0E_PORT_FW (MT753X_BPDU_CPU_ONLY )); } static int
drivers/net/dsa/mt7530.h +5 -0
@@ -66,6 +66,11 @@ enum mt753x_id {#define MT753X_BPC 0x24#define MT753X_BPDU_PORT_FW_MASK GENMASK(2, 0) +/* Register for :03 and :0E MAC DA frame control */ +#define MT753X_RGAC2 0x2c +#define MT753X_R0E_PORT_FW_MASK GENMASK(18, 16) +#define MT753X_R0E_PORT_FW (x) FIELD_PREP(MT753X_R0E_PORT_FW_MASK, x) +enum mt753x_bpdu_port_fw {MT753X_BPDU_FOLLOW_MFC ,MT753X_BPDU_CPU_EXCLUDE =4 ,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 312/317 net: dsa: mt7530: fix handling of 802.1X PAE frames
In reply to Sasha LevinFrom: Arınç ÜNAL <[email protected]>
[ Upstream commit e94b590abfff2cdbf0bdaa7d9904364c8d480af5 ]
802.1X PAE frames are link-local frames, therefore they must be trapped to the CPU port. Currently, the MT753X switches treat 802.1X PAE frames as regular multicast frames, therefore flooding them to user ports. To fix this, set 802.1X PAE frames to be trapped to the CPU port(s).
Stable-dep-of: e8bf353577f3 ("net: dsa: mt7530: fix link-local frames that ingress vlan filtering ports")
--- drivers/net/dsa/mt7530.c | 4 ++++ drivers/net/dsa/mt7530.h | 2 ++ 2 files changed, 6 insertions(+)
drivers/net/dsa/mt7530.c +4 -0
@@ -1000,6 +1000,10 @@ mt753x_trap_frames(struct mt7530_priv *priv)mt7530_rmw (priv,MT753X_BPC ,MT753X_BPDU_PORT_FW_MASK ,MT753X_BPDU_CPU_ONLY ); +/* Trap 802.1X PAE frames to the CPU port(s) */ +mt7530_rmw (priv,MT753X_BPC ,MT753X_PAE_PORT_FW_MASK , +MT753X_PAE_PORT_FW (MT753X_BPDU_CPU_ONLY )); +/* Trap LLDP frames with :0E MAC DA to the CPU port(s) */ mt7530_rmw (priv,MT753X_RGAC2 ,MT753X_R0E_PORT_FW_MASK ,MT753X_R0E_PORT_FW (MT753X_BPDU_CPU_ONLY ));
drivers/net/dsa/mt7530.h +2 -0
@@ -65,6 +65,8 @@ enum mt753x_id {/* Registers for BPDU and PAE frame control*/ #define MT753X_BPC 0x24#define MT753X_BPDU_PORT_FW_MASK GENMASK(2, 0) +#define MT753X_PAE_PORT_FW_MASK GENMASK(18, 16) +#define MT753X_PAE_PORT_FW (x) FIELD_PREP(MT753X_PAE_PORT_FW_MASK, x)/* Register for :03 and :0E MAC DA frame control */ #define MT753X_RGAC2 0x2c
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 313/317 net: dsa: mt7530: fix link-local frames that ingress vlan filtering ports
In reply to Sasha LevinFrom: Arınç ÜNAL <[email protected]>
[ Upstream commit e8bf353577f382c7066c661fed41b2adc0fc7c40 ]
Whether VLAN-aware or not, on every VID VLAN table entry that has the CPU port as a member of it, frames are set to egress the CPU port with the VLAN tag stacked. This is so that VLAN tags can be appended after hardware special tag (called DSA tag in the context of Linux drivers).
For user ports on a VLAN-unaware bridge, frame ingressing the user port egresses CPU port with only the special tag.
For user ports on a VLAN-aware bridge, frame ingressing the user port egresses CPU port with the special tag and the VLAN tag.
This causes issues with link-local frames, specifically BPDUs, because the software expects to receive them VLAN-untagged.
There are two options to make link-local frames egress untagged. Setting CONSISTENT or UNTAGGED on the EG_TAG bits on the relevant register. CONSISTENT means frames egress exactly as they ingress. That means egressing with the VLAN tag they had at ingress or egressing untagged if they ingressed untagged. Although link-local frames are not supposed to be transmitted VLAN-tagged, if they are done so, when egressing through a CPU port, the special tag field will be broken.
BPDU egresses CPU port with VLAN tag egressing stacked, received on software:
00:01:25.104821 AF Unknown (382365846), length 106:
| STAG | | VLAN |
0x0000: 0000 6c27 614d 4143 0001 0000 8100 0001 ..l'aMAC........
0x0010: 0026 4242 0300 0000 0000 0000 6c27 614d .&BB........l'aM
0x0020: 4143 0000 0000 0000 6c27 614d 4143 0000 AC......l'aMAC..
0x0030: 0000 1400 0200 0f00 0000 0000 0000 0000 ................BPDU egresses CPU port with VLAN tag egressing untagged, received on software:
00:23:56.628708 AF Unknown (25215488), length 64:
| STAG |
0x0000: 0000 6c27 614d 4143 0001 0000 0026 4242 ..l'aMAC.....&BB
0x0010: 0300 0000 0000 0000 6c27 614d 4143 0000 ........l'aMAC..
0x0020: 0000 0000 6c27 614d 4143 0000 0000 1400 ....l'aMAC......
0x0030: 0200 0f00 0000 0000 0000 0000 ............BPDU egresses CPU port with VLAN tag egressing tagged, received on software:
00:01:34.311963 AF Unknown (25215488), length 64:
| Mess |
0x0000: 0000 6c27 614d 4143 0001 0001 0026 4242 ..l'aMAC.....&BB
0x0010: 0300 0000 0000 0000 6c27 614d 4143 0000 ........l'aMAC..
0x0020: 0000 0000 6c27 614d 4143 0000 0000 1400 ....l'aMAC......
0x0030: 0200 0f00 0000 0000 0000 0000 ............To prevent confusing the software, force the frame to egress UNTAGGED instead of CONSISTENT. This way, frames can't possibly be received TAGGED by software which would have the special tag field broken.
VLAN Tag Egress Procedure
For all frames, one of these options set the earliest in this order will apply to the frame:
- EG_TAG in certain registers for certain frames. This will apply to frame with matching MAC DA or EtherType.
- EG_TAG in the address table.
This will apply to frame at its incoming port.
- EG_TAG in the PVC register.
This will apply to frame at its incoming port.
- EG_CON and [EG_TAG per port] in the VLAN table. This will apply to frame at its outgoing port.
- EG_TAG in the PCR register.
This will apply to frame at its outgoing port.
EG_TAG in certain registers for certain frames:
PPPoE Discovery_ARP/RARP: PPP_EG_TAG and ARP_EG_TAG in the APC register.
IGMP_MLD: IGMP_EG_TAG and MLD_EG_TAG in the IMC register. BPDU and PAE: BPDU_EG_TAG and PAE_EG_TAG in the BPC register. REV_01 and REV_02: R01_EG_TAG and R02_EG_TAG in the RGAC1 register. REV_03 and REV_0E: R03_EG_TAG and R0E_EG_TAG in the RGAC2 register. REV_10 and REV_20: R10_EG_TAG and R20_EG_TAG in the RGAC3 register. REV_21 and REV_UN: R21_EG_TAG and RUN_EG_TAG in the RGAC4 register.
With this change, it can be observed that a bridge interface with stp_state and vlan_filtering enabled will properly block ports now.
--- drivers/net/dsa/mt7530.c | 23 +++++++++++++++-------- drivers/net/dsa/mt7530.h | 9 ++++++++- 2 files changed, 23 insertions(+), 9 deletions(-)
drivers/net/dsa/mt7530.c +15 -8
@@ -996,16 +996,23 @@ static void mt7530_setup_port5(struct dsa_switch *ds, phy_interface_t interface)static void mt753x_trap_frames (struct mt7530_priv *priv) { -/* Trap BPDUs to the CPU port(s) */ -mt7530_rmw (priv,MT753X_BPC ,MT753X_BPDU_PORT_FW_MASK , +/* Trap 802.1X PAE frames and BPDUs to the CPU port(s) and egress them +* VLAN-untagged. +*/ +mt7530_rmw (priv,MT753X_BPC ,MT753X_PAE_EG_TAG_MASK | +MT753X_PAE_PORT_FW_MASK |MT753X_BPDU_EG_TAG_MASK | +MT753X_BPDU_PORT_FW_MASK , +MT753X_PAE_EG_TAG (MT7530_VLAN_EG_UNTAGGED ) | +MT753X_PAE_PORT_FW (MT753X_BPDU_CPU_ONLY ) | +MT753X_BPDU_EG_TAG (MT7530_VLAN_EG_UNTAGGED ) |MT753X_BPDU_CPU_ONLY ); -/* Trap 802.1X PAE frames to the CPU port(s) */ -mt7530_rmw (priv,MT753X_BPC ,MT753X_PAE_PORT_FW_MASK , -MT753X_PAE_PORT_FW (MT753X_BPDU_CPU_ONLY )); - -/* Trap LLDP frames with :0E MAC DA to the CPU port(s) */ -mt7530_rmw (priv,MT753X_RGAC2 ,MT753X_R0E_PORT_FW_MASK , +/* Trap LLDP frames with :0E MAC DA to the CPU port(s) and egress them +* VLAN-untagged. +*/ +mt7530_rmw (priv,MT753X_RGAC2 ,MT753X_R0E_EG_TAG_MASK | +MT753X_R0E_PORT_FW_MASK , +MT753X_R0E_EG_TAG (MT7530_VLAN_EG_UNTAGGED ) |MT753X_R0E_PORT_FW (MT753X_BPDU_CPU_ONLY )); }
drivers/net/dsa/mt7530.h +8 -1
@@ -64,12 +64,18 @@ enum mt753x_id {/* Registers for BPDU and PAE frame control*/ #define MT753X_BPC 0x24 -#define MT753X_BPDU_PORT_FW_MASK GENMASK(2, 0) +#define MT753X_PAE_EG_TAG_MASK GENMASK(24, 22) +#define MT753X_PAE_EG_TAG (x) FIELD_PREP(MT753X_PAE_EG_TAG_MASK, x)#define MT753X_PAE_PORT_FW_MASK GENMASK(18, 16)#define MT753X_PAE_PORT_FW (x) FIELD_PREP(MT753X_PAE_PORT_FW_MASK, x) +#define MT753X_BPDU_EG_TAG_MASK GENMASK(8, 6) +#define MT753X_BPDU_EG_TAG (x) FIELD_PREP(MT753X_BPDU_EG_TAG_MASK, x) +#define MT753X_BPDU_PORT_FW_MASK GENMASK(2, 0)/* Register for :03 and :0E MAC DA frame control */ #define MT753X_RGAC2 0x2c +#define MT753X_R0E_EG_TAG_MASK GENMASK(24, 22) +#define MT753X_R0E_EG_TAG (x) FIELD_PREP(MT753X_R0E_EG_TAG_MASK, x)#define MT753X_R0E_PORT_FW_MASK GENMASK(18, 16)#define MT753X_R0E_PORT_FW (x) FIELD_PREP(MT753X_R0E_PORT_FW_MASK, x)
@@ -252,6 +258,7 @@ enum mt7530_port_mode {enum mt7530_vlan_port_eg_tag {MT7530_VLAN_EG_DISABLED =0 ,MT7530_VLAN_EG_CONSISTENT =1 , +MT7530_VLAN_EG_UNTAGGED =4 , };enum mt7530_vlan_port_attr {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 314/317 net: dsa: mt7530: fix handling of all link-local frames
In reply to Sasha LevinFrom: Arınç ÜNAL <[email protected]>
[ Upstream commit 69ddba9d170bdaee1dc0eb4ced38d7e4bb7b92af ]
Currently, the MT753X switches treat frames with :01-0D and :0F MAC DAs as regular multicast frames, therefore flooding them to user ports.
On page 205, section "8.6.3 Frame filtering" of the active standard, IEEE Std 802.1Q™-2022, it is stated that frames with 01:80:C2:00:00:00-0F as MAC DA must only be propagated to C-VLAN and MAC Bridge components. That means VLAN-aware and VLAN-unaware bridges. On the switch designs with CPU ports, these frames are supposed to be processed by the CPU (software). So we make the switch only forward them to the CPU port. And if received from a CPU port, forward to a single port. The software is responsible of making the switch conform to the latter by setting a single port as destination port on the special tag.
This switch intellectual property cannot conform to this part of the standard fully. Whilst the REV_UN frame tag covers the remaining :04-0D and :0F MAC DAs, it also includes :22-FF which the scope of propagation is not supposed to be restricted for these MAC DAs.
Set frames with :01-03 MAC DAs to be trapped to the CPU port(s). Add a comment for the remaining MAC DAs.
Note that the ingress port must have a PVID assigned to it for the switch to forward untagged frames. A PVID is set by default on VLAN-aware and VLAN-unaware ports. However, when the network interface that pertains to the ingress port is attached to a vlan_filtering enabled bridge, the user can remove the PVID assignment from it which would prevent the link-local frames from being trapped to the CPU port. I am yet to see a way to forward link-local frames while preventing other untagged frames from being forwarded too.
--- drivers/net/dsa/mt7530.c | 37 +++++++++++++++++++++++++++++++++---- drivers/net/dsa/mt7530.h | 13 +++++++++++++ 2 files changed, 46 insertions(+), 4 deletions(-)
drivers/net/dsa/mt7530.c +33 -4
@@ -993,6 +993,21 @@ static void mt7530_setup_port5(struct dsa_switch *ds, phy_interface_t interface)mutex_unlock (&priv->reg_mutex); } +/* On page 205, section "8.6.3 Frame filtering" of the active standard, IEEE Std +* 802.1Q™-2022, it is stated that frames with 01:80:C2:00:00:00-0F as MAC DA +* must only be propagated to C-VLAN and MAC Bridge components. That means +* VLAN-aware and VLAN-unaware bridges. On the switch designs with CPU ports, +* these frames are supposed to be processed by the CPU (software). So we make +* the switch only forward them to the CPU port. And if received from a CPU +* port, forward to a single port. The software is responsible of making the +* switch conform to the latter by setting a single port as destination port on +* the special tag. +* +* This switch intellectual property cannot conform to this part of the standard +* fully. Whilst the REV_UN frame tag covers the remaining :04-0D and :0F MAC +* DAs, it also includes :22-FF which the scope of propagation is not supposed +* to be restricted for these MAC DAs. +*/ static void mt753x_trap_frames (struct mt7530_priv *priv) {
@@ -1007,13 +1022,27 @@ mt753x_trap_frames(struct mt7530_priv *priv)MT753X_BPDU_EG_TAG (MT7530_VLAN_EG_UNTAGGED ) | MT753X_BPDU_CPU_ONLY); -/* Trap LLDP frames with :0E MAC DA to the CPU port(s) and egress them -* VLAN-untagged. +/* Trap frames with :01 and :02 MAC DAs to the CPU port(s) and egress +* them VLAN-untagged. +*/ +mt7530_rmw (priv,MT753X_RGAC1 ,MT753X_R02_EG_TAG_MASK | +MT753X_R02_PORT_FW_MASK |MT753X_R01_EG_TAG_MASK | +MT753X_R01_PORT_FW_MASK , +MT753X_R02_EG_TAG (MT7530_VLAN_EG_UNTAGGED ) | +MT753X_R02_PORT_FW (MT753X_BPDU_CPU_ONLY ) | +MT753X_R01_EG_TAG (MT7530_VLAN_EG_UNTAGGED ) | +MT753X_BPDU_CPU_ONLY ); + +/* Trap frames with :03 and :0E MAC DAs to the CPU port(s) and egress +* them VLAN-untagged. */ mt7530_rmw (priv,MT753X_RGAC2 ,MT753X_R0E_EG_TAG_MASK | -MT753X_R0E_PORT_FW_MASK , +MT753X_R0E_PORT_FW_MASK |MT753X_R03_EG_TAG_MASK | +MT753X_R03_PORT_FW_MASK ,MT753X_R0E_EG_TAG (MT7530_VLAN_EG_UNTAGGED ) | -MT753X_R0E_PORT_FW (MT753X_BPDU_CPU_ONLY )); +MT753X_R0E_PORT_FW (MT753X_BPDU_CPU_ONLY ) | +MT753X_R03_EG_TAG (MT7530_VLAN_EG_UNTAGGED ) | +MT753X_BPDU_CPU_ONLY ); } static int
drivers/net/dsa/mt7530.h +13 -0
@@ -72,12 +72,25 @@ enum mt753x_id {#define MT753X_BPDU_EG_TAG (x) FIELD_PREP(MT753X_BPDU_EG_TAG_MASK, x)#define MT753X_BPDU_PORT_FW_MASK GENMASK(2, 0) +/* Register for :01 and :02 MAC DA frame control */ +#define MT753X_RGAC1 0x28 +#define MT753X_R02_EG_TAG_MASK GENMASK(24, 22) +#define MT753X_R02_EG_TAG (x) FIELD_PREP(MT753X_R02_EG_TAG_MASK, x) +#define MT753X_R02_PORT_FW_MASK GENMASK(18, 16) +#define MT753X_R02_PORT_FW (x) FIELD_PREP(MT753X_R02_PORT_FW_MASK, x) +#define MT753X_R01_EG_TAG_MASK GENMASK(8, 6) +#define MT753X_R01_EG_TAG (x) FIELD_PREP(MT753X_R01_EG_TAG_MASK, x) +#define MT753X_R01_PORT_FW_MASK GENMASK(2, 0) +/* Register for :03 and :0E MAC DA frame control */ #define MT753X_RGAC2 0x2c#define MT753X_R0E_EG_TAG_MASK GENMASK(24, 22)#define MT753X_R0E_EG_TAG (x) FIELD_PREP(MT753X_R0E_EG_TAG_MASK, x)#define MT753X_R0E_PORT_FW_MASK GENMASK(18, 16)#define MT753X_R0E_PORT_FW (x) FIELD_PREP(MT753X_R0E_PORT_FW_MASK, x) +#define MT753X_R03_EG_TAG_MASK GENMASK(8, 6) +#define MT753X_R03_EG_TAG (x) FIELD_PREP(MT753X_R03_EG_TAG_MASK, x) +#define MT753X_R03_PORT_FW_MASK GENMASK(2, 0)enum mt753x_bpdu_port_fw {MT753X_BPDU_FOLLOW_MFC ,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 315/317 spi: spi-mt65xx: Fix NULL pointer access in interrupt handler
In reply to Sasha LevinFrom: Fei Shao <[email protected]>
[ Upstream commit a20ad45008a7c82f1184dc6dee280096009ece55 ]
The TX buffer in spi_transfer can be a NULL pointer, so the interrupt handler may end up writing to the invalid memory and cause crashes.
Add a check to trans->tx_buf before using it.
--- drivers/spi/spi-mt65xx.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/spi/spi-mt65xx.c +12 -10
@@ -659,17 +659,19 @@ static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id) mdata->xfer_len =min (MTK_SPI_MAX_FIFO_SIZE , len);mtk_spi_setup_packet (master); - cnt = mdata->xfer_len /4 ; -iowrite32_rep (mdata->base +SPI_TX_DATA_REG , - trans->tx_buf + mdata->num_xfered, cnt); +if (trans->tx_buf) { + cnt = mdata->xfer_len /4 ; +iowrite32_rep (mdata->base +SPI_TX_DATA_REG , + trans->tx_buf + mdata->num_xfered, cnt); - remainder = mdata->xfer_len %4 ; -if (remainder >0 ) { - reg_val =0 ; -memcpy (®_val, - trans->tx_buf + (cnt *4 ) + mdata->num_xfered, - remainder); -writel (reg_val, mdata->base +SPI_TX_DATA_REG ); + remainder = mdata->xfer_len %4 ; +if (remainder >0 ) { + reg_val =0 ; +memcpy (®_val, + trans->tx_buf + (cnt *4 ) + mdata->num_xfered, + remainder); +writel (reg_val, mdata->base +SPI_TX_DATA_REG ); + } }mtk_spi_enable_transfer (master);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 316/317 regmap: Add missing map->bus check
In reply to Sasha LevinFrom: Marek Vasut <[email protected]>
[ Upstream commit 5c422f0b970d287efa864b8390a02face404db5d ]
The map->bus can be NULL here, add the missing NULL pointer check.
--- drivers/base/regmap/regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/regmap.c +1 -1
@@ -1836,7 +1836,7 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg, map->format.reg_bytes + map->format.pad_bytes + val_len); - else if (map->bus->gather_write) + else if (map->bus && map->bus->gather_write) ret = map->bus->gather_write(map->bus_context, map->work_buf, map->format.reg_bytes + map->format.pad_bytes,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 317/317 Linux 5.15.153-rc1
In reply to Sasha Levin--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
@@ -1,8 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 5 PATCHLEVEL = 15 -SUBLEVEL = 152 -EXTRAVERSION = +SUBLEVEL = 153 +EXTRAVERSION = -rc1 NAME = Trick or Treat # *DOCUMENTATION*
Signature · 1 line
2.43.0
Hi Sasha,
Quoted 9 lines · Sasha Levin
This is the start of the stable review cycle for the 5.15.153 release. There are 317 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 Tue Mar 26 11:34:43 PM UTC 2024. Anything received after that time might be too late.
We have a build failure in 5.15.153:
libbpf.c:74:12: error: 'map_set_def_max_entries' used but never defined [-Werror]
74 | static int map_set_def_max_entries(struct bpf_map *map);
| ^~~~~~~~~~~~~~~~~~~~~~~cc1: all warnings being treated as errors
this function is not defined in 5.15.153
$ git grep "map_set_def_max_entries" tools/lib/bpf/libbpf.c:static int map_set_def_max_entries(struct bpf_map *map); tools/lib/bpf/libbpf.c: err = map_set_def_max_entries(map->inner_map);
This is introduced by PATCH: "[PATCH 5.15 067/317] libbpf: Apply map_set_def_max_entries() for inner_maps on creation" in this series
This missing function is defined in commit: a4fbfdd7a160 ("libbpf: Fix BPF_MAP_TYPE_PERF_EVENT_ARRAY auto-pinning") and pulling this in needs some conflict resolution.
So I think for now the best idea is to drop this patch[067/317]
Thanks,
Harshit
Quoted 9 lines
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.15.y&id2=v5.15.152or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.Thanks,
Sasha
Quoted 10 lines · Sasha Levin
This is the start of the stable review cycle for the 5.15.153 release. There are 317 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 Tue Mar 26 11:34:43 PM UTC 2024. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.15.y&id2=v5.15.152or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.Thanks,
Sasha
The regression detected while building allmodconfig builds with gcc-12 and clang-17 failed on all the architectures.
Quoted 3 lines
Anastasia Belova (1):
cpufreq: brcmstb-avs-cpufreq: add check for cpufreq_cpu_get's return
value
Build error:
------------drivers/cpufreq/brcmstb-avs-cpufreq.c: In function 'brcm_avs_cpufreq_get':drivers/cpufreq/brcmstb-avs-cpufreq.c:486:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
486 | struct private_data *priv = policy->driver_data;
| ^~~~~~cc1: all warnings being treated as errors
Steps to reproduce:
# tuxmake --runtime podman --target-arch arm64 --toolchain gcc-12 --kconfig allmodconfig
Links:
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.15.y/build/v5.15.152-317-g6f6f22f11928/testrun/23155933/suite/build/test/gcc-12-allmodconfig/log
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.15.y/build/v5.15.152-317-g6f6f22f11928/testrun/23155933/suite/build/test/gcc-12-allmodconfig/details/
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.15.y/build/v5.15.152-317-g6f6f22f11928/testrun/23155933/suite/build/test/gcc-12-allmodconfig/history/
- https://storage.tuxsuite.com/public/linaro/lkft/builds/2eAPAG6nyiRjJbnJJ0JGiVy4otR/
--
Linaro LKFT
https://lkft.linaro.org
Quoted 10 lines · Sasha Levin
This is the start of the stable review cycle for the 5.15.153 release. There are 317 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 Tue Mar 26 11:34:43 PM UTC 2024. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.15.y&id2=v5.15.152or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.Thanks,
Sasha
As I have already reported on 5.10 regarding powerpc ppc6xx_defconfig build regressions noticed on 5.15.
Quoted 2 lines
Thomas Zimmermann (1):
arch/powerpc: Remove <linux/fb.h> from backlight code
Build error:
------------drivers/macintosh/via-pmu-backlight.c:22:20: error:
'FB_BACKLIGHT_LEVELS' undeclared here (not in a function)
22 | static u8 bl_curve[FB_BACKLIGHT_LEVELS];
| ^~~~~~~~~~~~~~~~~~~In file included from include/linux/kernel.h:16,
from arch/powerpc/include/asm/page.h:11,
from arch/powerpc/include/asm/thread_info.h:13, from include/linux/thread_info.h:60,
from arch/powerpc/include/asm/ptrace.h:323,
from drivers/macintosh/via-pmu-backlight.c:11:drivers/macintosh/via-pmu-backlight.c: In function 'pmu_backlight_curve_lookup':include/linux/minmax.h:36:9: error: first argument to '__builtin_choose_expr' not a constant
36 | __builtin_choose_expr(__safe_cmp(x, y), \
| ^~~~~~~~~~~~~~~~~~~~~Steps to reproduce:
# tuxmake --runtime podman --target-arch powerpc --toolchain gcc-12 --kconfig ppc6xx_defconfig
Links:
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.15.y/build/v5.15.152-317-g6f6f22f11928/testrun/23147157/suite/build/test/gcc-12-ppc6xx_defconfig/log
- https://storage.tuxsuite.com/public/linaro/lkft/builds/2e9uOwIbkt3JA6me39nPospWfFL/
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.15.y/build/v5.15.152-317-g6f6f22f11928/testrun/23147157/suite/build/test/gcc-12-ppc6xx_defconfig/details/
--
Linaro LKFT
https://lkft.linaro.org