Skip to contentSkip to conversation

ice: fix rmmod crash when ts2phc is running

PATCH In review Arkadiusz Kubalewski 3 participants 3 messages Sep 15, 2022 – Sep 23, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ice: fix rmmod crash when ts2phc is running

Reschedule a ptp kworker only if it isn't destroyed.

Previously, ptp kworker could be destroyed in ice_ptp_release function and then service task function call ice_misc_intr executed on time sync interrupt would try to schedule a ptp kworker, which results in a crash:

ice 0000:01:00.0: Removed PTP clock

BUG: kernel NULL pointer dereference, address: 0000000000000004
PGD 0 P4D 0
Oops: 0002 [#1] PREEMPT SMP PTI
CPU: 4 PID: 0 Comm: swapper/4 Kdump: loaded Tainted: G           OE      6.0.0-rc3 #73
Hardware name: Intel Corporation S1200SP/S1200SP, BIOS S1200SP.86B.03.01.0042.013020190050 01/30/2019
RIP: 0010:_raw_spin_lock_irqsave+0x20/0x50
Code: cc cc cc cc cc cc cc cc cc cc 0f 1f 44 00 00 41 54 53 48 89 fb 9c 41 5c fa bf 01 00 00 00 e8 87 ff 64 ff 31 c0 ba 01 00 00 00 <f0> 0f b1 13 75 0b 4c 89 e0 5b 41 5c c3 cc cc cc cc 89 c6 48 89 df
RSP: 0018:ffffa8d3001e0ee8 EFLAGS: 00010046
RAX: 0000000000000000 RBX: 0000000000000004 RCX: 0000000000000000
RDX: 0000000000000001 RSI: ffff9a4cb1fd0d88 RDI: 0000000000000001
RBP: 0000000000000000 R08: 000003ac0f15e9cf R09: 0000000000000000
R10: 0000000000000000 R11: ffffa8d3001e0ff8 R12: 0000000000000046
R13: 0000000000000004 R14: 0000000000000000 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff9a4fb3900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000004 CR3: 00000003d740a006 CR4: 00000000003706e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <IRQ>
 kthread_queue_work+0x22/0x70
 ice_misc_intr+0x23e/0x2c0 [ice]
 __handle_irq_event_percpu+0x43/0x180
 handle_irq_event+0x34/0x70
 handle_edge_irq+0x9f/0x240
 __common_interrupt+0x66/0x110
 common_interrupt+0xb3/0xd0
 </IRQ>
 <TASK>
 asm_common_interrupt+0x22/0x40
RIP: 0010:cpuidle_enter_state+0xd8/0x400
Code: 49 89 c5 0f 1f 44 00 00 31 ff e8 03 29 90 ff 45 84 ff 74 12 9c 58 f6 c4 02 0f 85 0c 03 00 00 31 ff e8 9c c2 96 ff fb 45 85 f6 <0f> 88 6e 01 00 00 49 63 d6 4c 2b 2c 24 48 8d 04 52 48 8d 04 82 49
RSP: 0018:ffffa8d30010fe80 EFLAGS: 00000206
RAX: ffff9a4fb3900000 RBX: ffff9a4fb393b800 RCX: 000000000000001f
RDX: 0000000000000004 RSI: ffffffffa5f7f754 RDI: ffffffffa5f5c798
RBP: 0000000000000006 R08: 000003ac0f15e6d3 R09: 0000000000000000
R10: 0000000000000400 R11: 000000000002e921 R12: ffffffffa66a1f20
R13: 000003ac0f15e6d3 R14: 0000000000000006 R15: 0000000000000000
 cpuidle_enter+0x29/0x40
 cpuidle_idle_call+0x138/0x1c0
 do_idle+0x79/0xe0
 cpu_startup_entry+0x19/0x20
 start_secondary+0x10d/0x130
 secondary_startup_64_no_verify+0xe5/0xeb
 </TASK>
Fixes 172db5f91d5f ("ice: add support for auxiliary input/output pins")

---
v2: add target tree prefix

 drivers/net/ethernet/intel/ice/ice_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_main.c +3 -1
index 4320151cb191..661a16fd9c45 100644
@@ -3105,7 +3105,9 @@ static irqreturn_t ice_misc_intr(int __always_unused irq, void *data)
 						     GLTSYN_STAT_EVENT1_M |
 						     GLTSYN_STAT_EVENT2_M);
 		ena_mask &= ~PFINT_OICR_TSYN_EVNT_M;
-		kthread_queue_work(pf->ptp.kworker, &pf->ptp.extts_work);
+		if (pf->ptp.kworker)
+			kthread_queue_work(pf->ptp.kworker,
+					   &pf->ptp.extts_work);
 	}
 
 #define ICE_AUX_CRIT_ERR (PFINT_OICR_PE_CRITERR_M | PFINT_OICR_HMC_ERR_M | PFINT_OICR_PE_PUSH_M)
Signature · 6 lines
2.34.3

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
#1 lore raw
Quoted 71 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Arkadiusz Kubalewski
Sent: Thursday, September 15, 2022 4:23 PM
To: [email protected]
Subject: [Intel-wired-lan] [PATCH net] ice: fix rmmod crash when ts2phc is running

Reschedule a ptp kworker only if it isn't destroyed.

Previously, ptp kworker could be destroyed in ice_ptp_release function and then service task function call ice_misc_intr executed on time sync interrupt would try to schedule a ptp kworker, which results in a
crash:

ice 0000:01:00.0: Removed PTP clock

BUG: kernel NULL pointer dereference, address: 0000000000000004 PGD 0
P4D 0
Oops: 0002 [#1] PREEMPT SMP PTI
CPU: 4 PID: 0 Comm: swapper/4 Kdump: loaded Tainted: G           OE      6.0.0-
rc3 #73
Hardware name: Intel Corporation S1200SP/S1200SP, BIOS
S1200SP.86B.03.01.0042.013020190050 01/30/2019
RIP: 0010:_raw_spin_lock_irqsave+0x20/0x50
Code: cc cc cc cc cc cc cc cc cc cc 0f 1f 44 00 00 41 54 53 48 89 fb 9c 41 5c fa bf 01
00 00 00 e8 87 ff 64 ff 31 c0 ba 01 00 00 00 <f0> 0f b1 13 75 0b 4c 89 e0 5b 41 5c
c3 cc cc cc cc 89 c6 48 89 df
RSP: 0018:ffffa8d3001e0ee8 EFLAGS: 00010046
RAX: 0000000000000000 RBX: 0000000000000004 RCX: 0000000000000000
RDX: 0000000000000001 RSI: ffff9a4cb1fd0d88 RDI: 0000000000000001
RBP: 0000000000000000 R08: 000003ac0f15e9cf R09: 0000000000000000
R10: 0000000000000000 R11: ffffa8d3001e0ff8 R12: 0000000000000046
R13: 0000000000000004 R14: 0000000000000000 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff9a4fb3900000(0000)
knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000004 CR3: 00000003d740a006 CR4: 00000000003706e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call
Trace:
 <IRQ>
 kthread_queue_work+0x22/0x70
 ice_misc_intr+0x23e/0x2c0 [ice]
 __handle_irq_event_percpu+0x43/0x180
 handle_irq_event+0x34/0x70
 handle_edge_irq+0x9f/0x240
 __common_interrupt+0x66/0x110
 common_interrupt+0xb3/0xd0
 </IRQ>
 <TASK>
 asm_common_interrupt+0x22/0x40
RIP: 0010:cpuidle_enter_state+0xd8/0x400
Code: 49 89 c5 0f 1f 44 00 00 31 ff e8 03 29 90 ff 45 84 ff 74 12 9c 58 f6 c4 02 0f

85 0c 03 00 00 31 ff e8 9c c2 96 ff fb 45 85 f6 <0f> 88 6e 01 00 00 49 63 d6 4c 2b 2c 24 48 8d 04 52 48 8d 04 82 49
RSP: 0018:ffffa8d30010fe80 EFLAGS: 00000206
RAX: ffff9a4fb3900000 RBX: ffff9a4fb393b800 RCX: 000000000000001f
RDX: 0000000000000004 RSI: ffffffffa5f7f754 RDI: ffffffffa5f5c798
RBP: 0000000000000006 R08: 000003ac0f15e6d3 R09: 0000000000000000
R10: 0000000000000400 R11: 000000000002e921 R12: ffffffffa66a1f20
R13: 000003ac0f15e6d3 R14: 0000000000000006 R15: 0000000000000000

 cpuidle_enter+0x29/0x40
 cpuidle_idle_call+0x138/0x1c0
 do_idle+0x79/0xe0
 cpu_startup_entry+0x19/0x20
 start_secondary+0x10d/0x130
 secondary_startup_64_no_verify+0xe5/0xeb
 </TASK>
Quoted 7 lines
Fixes 172db5f91d5f ("ice: add support for auxiliary input/output pins")

---
v2: add target tree prefix

 drivers/net/ethernet/intel/ice/ice_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

We are still observing a kernel crash on the first execution, but able to remove and reload the ice driver from the system unlike earlier where we were not even able to access the system.
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#2 lore raw
Quoted 80 lines

From: Intel-wired-lan <[email protected]> On Behalf Of G, GurucharanX
Sent: Wednesday, September 21, 2022 6:12 AM

Quoted 69 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Arkadiusz Kubalewski
Sent: Thursday, September 15, 2022 4:23 PM
To: [email protected]
Subject: [Intel-wired-lan] [PATCH net] ice: fix rmmod crash when ts2phc is running

Reschedule a ptp kworker only if it isn't destroyed.

Previously, ptp kworker could be destroyed in ice_ptp_release function and then service task function call ice_misc_intr executed on time sync interrupt would try to schedule a ptp kworker, which results in a
crash:

ice 0000:01:00.0: Removed PTP clock

BUG: kernel NULL pointer dereference, address: 0000000000000004 PGD 0
P4D 0
Oops: 0002 [#1] PREEMPT SMP PTI
CPU: 4 PID: 0 Comm: swapper/4 Kdump: loaded Tainted: G           OE      6.0.0-
rc3 #73
Hardware name: Intel Corporation S1200SP/S1200SP, BIOS
S1200SP.86B.03.01.0042.013020190050 01/30/2019
RIP: 0010:_raw_spin_lock_irqsave+0x20/0x50
Code: cc cc cc cc cc cc cc cc cc cc 0f 1f 44 00 00 41 54 53 48 89 fb 9c 41 5c fa bf 01
00 00 00 e8 87 ff 64 ff 31 c0 ba 01 00 00 00 <f0> 0f b1 13 75 0b 4c 89 e0 5b 41 5c
c3 cc cc cc cc 89 c6 48 89 df
RSP: 0018:ffffa8d3001e0ee8 EFLAGS: 00010046
RAX: 0000000000000000 RBX: 0000000000000004 RCX: 0000000000000000
RDX: 0000000000000001 RSI: ffff9a4cb1fd0d88 RDI: 0000000000000001
RBP: 0000000000000000 R08: 000003ac0f15e9cf R09: 0000000000000000
R10: 0000000000000000 R11: ffffa8d3001e0ff8 R12: 0000000000000046
R13: 0000000000000004 R14: 0000000000000000 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff9a4fb3900000(0000)
knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000004 CR3: 00000003d740a006 CR4: 00000000003706e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call
Trace:
 <IRQ>
 kthread_queue_work+0x22/0x70
 ice_misc_intr+0x23e/0x2c0 [ice]
 __handle_irq_event_percpu+0x43/0x180
 handle_irq_event+0x34/0x70
 handle_edge_irq+0x9f/0x240
 __common_interrupt+0x66/0x110
 common_interrupt+0xb3/0xd0
 </IRQ>
 <TASK>
 asm_common_interrupt+0x22/0x40
RIP: 0010:cpuidle_enter_state+0xd8/0x400
Code: 49 89 c5 0f 1f 44 00 00 31 ff e8 03 29 90 ff 45 84 ff 74 12 9c 58 f6 c4 02 0f

85 0c 03 00 00 31 ff e8 9c c2 96 ff fb 45 85 f6 <0f> 88 6e 01 00 00 49 63 d6 4c 2b 2c 24 48 8d 04 52 48 8d 04 82 49
RSP: 0018:ffffa8d30010fe80 EFLAGS: 00000206
RAX: ffff9a4fb3900000 RBX: ffff9a4fb393b800 RCX: 000000000000001f
RDX: 0000000000000004 RSI: ffffffffa5f7f754 RDI: ffffffffa5f5c798
RBP: 0000000000000006 R08: 000003ac0f15e6d3 R09: 0000000000000000
R10: 0000000000000400 R11: 000000000002e921 R12: ffffffffa66a1f20
R13: 000003ac0f15e6d3 R14: 0000000000000006 R15: 0000000000000000

 cpuidle_enter+0x29/0x40
 cpuidle_idle_call+0x138/0x1c0
 do_idle+0x79/0xe0
 cpu_startup_entry+0x19/0x20
 start_secondary+0x10d/0x130
 secondary_startup_64_no_verify+0xe5/0xeb
 </TASK>
Quoted 7 lines
Fixes 172db5f91d5f ("ice: add support for auxiliary input/output pins")

---
v2: add target tree prefix

 drivers/net/ethernet/intel/ice/ice_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 1 line

We are still observing a kernel crash on the first execution, but able to remove and reload the ice driver from the system unlike earlier where we were not even able to access the system.

Much thanks for testing that - we would investigate what is causing this again.

BR,
M^2

Quoted 5 lines

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan