Subject: Re: lockup and kernel panic in linux-next-202505{09,12} when compiled with clang

From: Bert Karwatzki <[email-masked]>
Date: Fri, 16 May 2025 20:19:59 +0200

I've added a debugging statement:

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 3bd5ee0995fe..853493eca4f5 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -4586,7 +4586,11 @@ static noinline void ieee80211_8023_xmit_clang_debug_helper(struct sk_buff *skb,
                                                            struct ieee80211_local *local,
                                                            struct ieee80211_tx_info *info)
 {
-       if (unlikely(skb->sk && sock_flag(skb->sk, SOCK_WIFI_STATUS))) {
+       if (unlikely(skb->sk && ((skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS) ||
+                               sock_flag(skb->sk, SOCK_WIFI_STATUS)))) {
+               if ((skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS) ^ sock_flag(skb->sk, SOCK_WIFI_STATUS))
+                       printk(KERN_INFO "%s: skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS = %u sock_flag(skb->sk,
SOCK_WIFI_STATUS) = %u\n",
+                                       __func__, (skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS), sock_flag(skb->sk,
SOCK_WIFI_STATUS));
                info->status_data = ieee80211_store_ack_skb(local, skb,
                                                            &info->flags, NULL);
                if (info->status_data)

This gives the following logoutput (and a lockup), indicating that sock_flag(skb->sk, SOCK_WIFI_STATUS) and
(skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS) are actually NOT equivalent (when compiled with clang and
PREEMPT_RT=y)

2025-05-16T20:09:58.818563+02:00 lisa kernel: [  T581] ieee80211_8023_xmit_clang_debug_helper: skb_shinfo(skb)->tx_flags
& SKBTX_WIFI_STATUS = 0 sock_flag(skb->sk, SOCK_WIFI_STATUS) = 1
2025-05-16T20:10:19.829599+02:00 lisa kernel: [    C2] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks:
2025-05-16T20:10:19.829607+02:00 lisa kernel: [    C2] rcu: 	4-...!: (1 GPs behind) idle=1ddc/1/0x4000000000000000
softirq=0/0 fqs=72 rcuc=21002 jiffies(starved)
2025-05-16T20:10:19.829609+02:00 lisa kernel: [    C2] rcu: 	14-...!: (1 GPs behind) idle=4cbc/1/0x4000000000000000
softirq=0/0 fqs=72 rcuc=21013 jiffies(starved)
2025-05-16T20:10:19.829611+02:00 lisa kernel: [    C2] rcu: 	Tasks blocked on level-0 rcu_node (CPUs 0-15): P581
2025-05-16T20:10:19.829613+02:00 lisa kernel: [    C2] rcu: 	(detected by 2, t=21002 jiffies, g=7525, q=973
ncpus=16)
2025-05-16T20:10:19.829615+02:00 lisa kernel: [    C2] Sending NMI from CPU 2 to CPUs 4:
2025-05-16T20:10:19.829616+02:00 lisa kernel: [    C4] NMI backtrace for cpu 4
2025-05-16T20:10:19.829618+02:00 lisa kernel: [    C4] CPU: 4 UID: 0 PID: 581 Comm: napi/phy0-0 Not tainted 6.15.0-rc6-
next-20250513-llvm-00011-gf9a7992d47e7 #978 PREEMPT_{RT,(full)} 
2025-05-16T20:10:19.829620+02:00 lisa kernel: [    C4] Hardware name: Micro-Star International Co., Ltd. Alpha 15
B5EEK/MS-158L, BIOS E158LAMS.10F 11/11/2024
2025-05-16T20:10:19.829622+02:00 lisa kernel: [    C4] RIP: 0010:rtlock_slowlock_locked+0xaed/0xc70
2025-05-16T20:10:19.829623+02:00 lisa kernel: [    C4] Code: 59 61 6a ff 49 c7 07 01 00 00 00 4d 89 7f 08 65 ff 0d b7 bd
c1 00 74 4f 4d 85 ed 0f 84 76 ff ff ff e8 77 28 71 ff 48 8b 43 18 <48> 83 e0 fe 49 39 c5 75 2a 41 83 7d 34 00 0f 84 54
ff ff ff 41 8b
2025-05-16T20:10:19.829625+02:00 lisa kernel: [    C4] RSP: 0018:ffffcc0dc1ef7b00 EFLAGS: 00000246

2025-05-16T20:10:19.829627+02:00 lisa kernel: [    C4] RAX: ffff89e9c52f8001 RBX: ffff89e9e17a2e10 RCX: ffff89e9c52f8001
2025-05-16T20:10:19.829629+02:00 lisa kernel: [    C4] RDX: ffffcc0dc1ef7b38 RSI: ffff89e9c52fd000 RDI: ffffcc0dc1ef7bf0
2025-05-16T20:10:19.829631+02:00 lisa kernel: [    C4] RBP: ffff89e9c52fd820 R08: ffffffffffffeb42 R09: 0000000000000002
2025-05-16T20:10:19.829632+02:00 lisa kernel: [    C4] R10: 00000000000000e4 R11: 00000000000005fe R12: ffffcc0dc1ef7b38
2025-05-16T20:10:19.829634+02:00 lisa kernel: [    C4] R13: ffff89e9c52f8000 R14: ffff89e9c52fd000 R15: ffffcc0dc1ef7bf0
2025-05-16T20:10:19.829636+02:00 lisa kernel: [    C4] FS:  0000000000000000(0000) GS:ffff89f8986c1000(0000)
knlGS:0000000000000000
2025-05-16T20:10:19.829637+02:00 lisa kernel: [    C4] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
2025-05-16T20:10:19.829638+02:00 lisa kernel: [    C4] CR2: 00007f9ea92e2000 CR3: 00000007e5a3a000 CR4: 0000000000750ef0
2025-05-16T20:10:19.829640+02:00 lisa kernel: [    C4] PKRU: 55555554
2025-05-16T20:10:19.829642+02:00 lisa kernel: [    C4] Call Trace:
2025-05-16T20:10:19.829643+02:00 lisa kernel: [    C4]  <TASK>
2025-05-16T20:10:19.829644+02:00 lisa kernel: [    C4]  ? rt_spin_unlock+0x12/0x40
2025-05-16T20:10:19.829646+02:00 lisa kernel: [    C4]  ? srso_alias_return_thunk+0x5/0xfbef5
2025-05-16T20:10:19.829648+02:00 lisa kernel: [    C4]  rt_spin_lock+0x81/0xa0
2025-05-16T20:10:19.829649+02:00 lisa kernel: [    C4]  mt76_rx_complete+0x49/0x2e0 [mt76]
2025-05-16T20:10:19.829651+02:00 lisa kernel: [    C4]  ? srso_alias_return_thunk+0x5/0xfbef5
2025-05-16T20:10:19.829653+02:00 lisa kernel: [    C4]  mt76_rx_poll_complete+0x4a4/0x4d0 [mt76]
2025-05-16T20:10:19.829654+02:00 lisa kernel: [    C4]  ? mt76_dma_rx_poll+0xf6/0x660 [mt76]
2025-05-16T20:10:19.829656+02:00 lisa kernel: [    C4]  mt76_dma_rx_poll+0x147/0x660 [mt76]
2025-05-16T20:10:19.829657+02:00 lisa kernel: [    C4]  ? mt792x_poll_rx+0x2a/0x120 [mt792x_lib]
2025-05-16T20:10:19.829658+02:00 lisa kernel: [    C4]  mt792x_poll_rx+0x71/0x120 [mt792x_lib]
2025-05-16T20:10:19.829660+02:00 lisa kernel: [    C4]  __napi_poll+0x2a/0x170
2025-05-16T20:10:19.829662+02:00 lisa kernel: [    C4]  ? napi_threaded_poll_loop+0x32/0x1b0
2025-05-16T20:10:19.829663+02:00 lisa kernel: [    C4]  napi_threaded_poll_loop+0xe4/0x1b0
2025-05-16T20:10:19.829678+02:00 lisa kernel: [    C4]  ? napi_threaded_poll_loop+0x32/0x1b0
2025-05-16T20:10:19.829679+02:00 lisa kernel: [    C4]  ? asm_sysvec_apic_timer_interrupt+0x1a/0x20
2025-05-16T20:10:19.829680+02:00 lisa kernel: [    C4]  napi_threaded_poll+0x57/0x80
2025-05-16T20:10:19.829682+02:00 lisa kernel: [    C4]  ? __pfx_napi_threaded_poll+0x10/0x10
2025-05-16T20:10:19.829683+02:00 lisa kernel: [    C4]  kthread+0x25c/0x280
2025-05-16T20:10:19.829685+02:00 lisa kernel: [    C4]  ? __pfx_kthread+0x10/0x10
2025-05-16T20:10:19.829696+02:00 lisa kernel: [    C4]  ret_from_fork+0xc4/0x1b0
2025-05-16T20:10:19.829698+02:00 lisa kernel: [    C4]  ? __pfx_kthread+0x10/0x10
2025-05-16T20:10:19.829699+02:00 lisa kernel: [    C4]  ret_from_fork_asm+0x1a/0x30
2025-05-16T20:10:19.829701+02:00 lisa kernel: [    C4]  </TASK>
2025-05-16T20:10:19.829702+02:00 lisa kernel: [    C2] Sending NMI from CPU 2 to CPUs 14:
2025-05-16T20:10:19.829704+02:00 lisa kernel: [   C14] NMI backtrace for cpu 14
2025-05-16T20:10:19.829705+02:00 lisa kernel: [   C14] CPU: 14 UID: 0 PID: 585 Comm: napi/phy0-0 Not tainted 6.15.0-rc6-
next-20250513-llvm-00011-gf9a7992d47e7 #978 PREEMPT_{RT,(full)} 
2025-05-16T20:10:19.829707+02:00 lisa kernel: [   C14] Hardware name: Micro-Star International Co., Ltd. Alpha 15
B5EEK/MS-158L, BIOS E158LAMS.10F 11/11/2024
2025-05-16T20:10:19.829708+02:00 lisa kernel: [   C14] RIP: 0010:queued_spin_lock_slowpath+0x134/0x1c0
2025-05-16T20:10:19.829710+02:00 lisa kernel: [   C14] Code: 03 c1 e6 04 83 e0 fc 49 c7 c0 f8 ff ff ff 49 8b 84 40 a0 fa
98 95 48 89 94 06 c0 21 06 96 83 7a 08 00 75 08 f3 90 83 7a 08 00 <74> f8 48 8b 32 48 85 f6 74 09 0f 0d 0e eb 0a 31 f6
eb 06 31 f6 eb
2025-05-16T20:10:19.829714+02:00 lisa kernel: [   C14] RSP: 0018:ffffcc0dc201f998 EFLAGS: 00000046
2025-05-16T20:10:19.829715+02:00 lisa kernel: [   C14] RAX: 0000000000000000 RBX: 0000000000000286 RCX: 00000000003c0000
2025-05-16T20:10:19.829717+02:00 lisa kernel: [   C14] RDX: ffff89f82e9a31c0 RSI: 0000000000000010 RDI: ffff89ea89ad79a8
2025-05-16T20:10:19.829718+02:00 lisa kernel: [   C14] RBP: ffff89ea05e8e000 R08: fffffffffffffff8 R09: 0000000000000001
2025-05-16T20:10:19.829720+02:00 lisa kernel: [   C14] R10: 0000000000000001 R11: ffffffff951f07f0 R12: ffff89ea89ad7990
2025-05-16T20:10:19.829722+02:00 lisa kernel: [   C14] R13: ffff89e9e17a2480 R14: ffff89ea89ad79a8 R15: ffff89ea89ad79a8
2025-05-16T20:10:19.829723+02:00 lisa kernel: [   C14] FS:  0000000000000000(0000) GS:ffff89f898941000(0000)
knlGS:0000000000000000
2025-05-16T20:10:19.829735+02:00 lisa kernel: [   C14] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
2025-05-16T20:10:19.829737+02:00 lisa kernel: [   C14] CR2: 00007f522c1f7000 CR3: 00000007e5a3a000 CR4: 0000000000750ef0
2025-05-16T20:10:19.829738+02:00 lisa kernel: [   C14] PKRU: 55555554
2025-05-16T20:10:19.829740+02:00 lisa kernel: [   C14] Call Trace:
2025-05-16T20:10:19.829741+02:00 lisa kernel: [   C14]  <TASK>
2025-05-16T20:10:19.829743+02:00 lisa kernel: [   C14]  _raw_spin_lock_irqsave+0x57/0x60
2025-05-16T20:10:19.829744+02:00 lisa kernel: [   C14]  rt_spin_lock+0x73/0xa0
2025-05-16T20:10:19.829745+02:00 lisa kernel: [   C14]  sock_queue_err_skb+0xdc/0x140
2025-05-16T20:10:19.829773+02:00 lisa kernel: [   C14]  skb_complete_wifi_ack+0xa9/0x120
2025-05-16T20:10:19.829775+02:00 lisa kernel: [   C14]  ieee80211_report_used_skb+0x541/0x6e0 [mac80211]
2025-05-16T20:10:19.829786+02:00 lisa kernel: [   C14]  ? srso_alias_return_thunk+0x5/0xfbef5
2025-05-16T20:10:19.829816+02:00 lisa kernel: [   C14]  ? __schedule+0x506/0x1280
2025-05-16T20:10:19.829822+02:00 lisa kernel: [   C14]  ? preempt_schedule_irq+0x42/0x80
2025-05-16T20:10:19.829823+02:00 lisa kernel: [   C14]  ieee80211_tx_status_ext+0x3b3/0x870 [mac80211]
2025-05-16T20:10:19.829824+02:00 lisa kernel: [   C14]  ? srso_alias_return_thunk+0x5/0xfbef5
2025-05-16T20:10:19.829826+02:00 lisa kernel: [   C14]  ? rt_spin_lock+0x3d/0xa0
2025-05-16T20:10:19.829828+02:00 lisa kernel: [   C14]  ? mt76_tx_status_unlock+0x38/0x230 [mt76]
2025-05-16T20:10:19.829829+02:00 lisa kernel: [   C14]  mt76_tx_status_unlock+0x1e0/0x230 [mt76]
2025-05-16T20:10:19.829830+02:00 lisa kernel: [   C14]  __mt76_tx_complete_skb+0x13b/0x2e0 [mt76]
2025-05-16T20:10:19.829832+02:00 lisa kernel: [   C14]  ? srso_alias_return_thunk+0x5/0xfbef5
2025-05-16T20:10:19.829833+02:00 lisa kernel: [   C14]  ? rt_spin_unlock+0x12/0x40
2025-05-16T20:10:19.829834+02:00 lisa kernel: [   C14]  ? srso_alias_return_thunk+0x5/0xfbef5
2025-05-16T20:10:19.829836+02:00 lisa kernel: [   C14]  mt76_connac2_txwi_free+0x127/0x150 [mt76_connac_lib]
2025-05-16T20:10:19.829838+02:00 lisa kernel: [   C14]  mt7921_mac_tx_free+0x112/0x260 [mt7921_common]
2025-05-16T20:10:19.829839+02:00 lisa kernel: [   C14]  mt7921_rx_check+0x33/0xe0 [mt7921_common]
2025-05-16T20:10:19.829841+02:00 lisa kernel: [   C14]  mt76_dma_rx_poll+0x322/0x660 [mt76]
2025-05-16T20:10:19.829842+02:00 lisa kernel: [   C14]  ? mt792x_poll_rx+0x2a/0x120 [mt792x_lib]
2025-05-16T20:10:19.829843+02:00 lisa kernel: [   C14]  mt792x_poll_rx+0x71/0x120 [mt792x_lib]
2025-05-16T20:10:19.829845+02:00 lisa kernel: [   C14]  __napi_poll+0x2a/0x170
2025-05-16T20:10:19.829846+02:00 lisa kernel: [   C14]  ? napi_threaded_poll_loop+0x32/0x1b0
2025-05-16T20:10:19.829848+02:00 lisa kernel: [   C14]  napi_threaded_poll_loop+0xe4/0x1b0
2025-05-16T20:10:19.829849+02:00 lisa kernel: [   C14]  ? napi_threaded_poll_loop+0x32/0x1b0
2025-05-16T20:10:19.829851+02:00 lisa kernel: [   C14]  ? ttwu_do_activate+0xa9/0x1a0
2025-05-16T20:10:19.829863+02:00 lisa kernel: [   C14]  ? srso_alias_return_thunk+0x5/0xfbef5
2025-05-16T20:10:19.829864+02:00 lisa kernel: [   C14]  napi_threaded_poll+0x57/0x80
2025-05-16T20:10:19.829866+02:00 lisa kernel: [   C14]  ? __pfx_napi_threaded_poll+0x10/0x10
2025-05-16T20:10:19.829867+02:00 lisa kernel: [   C14]  kthread+0x25c/0x280
2025-05-16T20:10:19.829868+02:00 lisa kernel: [   C14]  ? __pfx_kthread+0x10/0x10
2025-05-16T20:10:19.829871+02:00 lisa kernel: [   C14]  ret_from_fork+0xc4/0x1b0
2025-05-16T20:10:19.829873+02:00 lisa kernel: [   C14]  ? __pfx_kthread+0x10/0x10
2025-05-16T20:10:19.829874+02:00 lisa kernel: [   C14]  ret_from_fork_asm+0x1a/0x30
2025-05-16T20:10:19.829875+02:00 lisa kernel: [   C14]  </TASK>

Bert Karwatzki