context_tracking: Have ct_state() use preempt_disable_notrace()
PATCH 1/1 context_tracking: Have ct_state() use preempt_disable_notrace()
From: "Steven Rostedt (Google)" <[email protected]>
One of my tests triggered:
------------[ cut here ]------------ WARNING: CPU: 0 PID: 1 at include/trace/events/preemptirq.h:51 trace_preempt_off+0x7c/0x80 Modules linked in: CPU: 0 PID: 1 Comm: init Not tainted 6.3.0-rc3-test-00011-ge11b521a7b69-dirty #31 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.0-debian-1.16.0-5 04/01/2014 RIP: 0010:trace_preempt_off+0x7c/0x80 Code: 74 0f 48 8b 78 08 48 89 f2 48 89 de e8 5d f9 ff ff 65 ff 0d 6e d6 ce 68 75 a2 0f 1f 44 00 00 eb 9b e8 28 ea f3 ff 84 c0 75 a5 <0f> 0b eb a1 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f RSP: 0000:ffffaf0880013f00 EFLAGS: 00010046 RAX: 0000000000000000 RBX: ffffffff97fafe59 RCX: 0000000000000001 RDX: 0000000000000000 RSI: ffffffff986f4b71 RDI: ffffffff986fa0dd RBP: ffffffff97fafe59 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000014 R14: 0000000000000000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff8adf7bc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f125de099c0 CR3: 000000010498a001 CR4: 0000000000170ef0 Call Trace: <TASK> irqentry_enter_from_user_mode+0x39/0x80 irqentry_enter+0x51/0x60 exc_page_fault+0x3d/0x200 asm_exc_page_fault+0x26/0x30 RIP: 0033:0x7f125de099c0 Code: Unable to access opcode bytes at 0x7f125de09996. RSP: 002b:00007ffd1fdbf220 EFLAGS: 00010202 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 </TASK> irq event stamp: 13182054 hardirqs last enabled at (13182053): [<ffffffff97002e3f>] ret_from_fork+0x1f/0x50 hardirqs last disabled at (13182054): [<ffffffff97faff01>] irqentry_enter+0x51/0x60 softirqs last enabled at (13181978): [<ffffffff97fc97d2>] __do_softirq+0x322/0x429 softirqs last disabled at (13181969): [<ffffffff971c2cce>] irq_exit_rcu+0xe/0x30 ---[ end trace 0000000000000000 ]--- ------------[ cut here ]------------
It appears that ct_state() can be called in noinst mode. Do not trace the disabling of preemption.
Signed-off-by Steven Rostedt (Google) <[email protected]>
--- include/linux/context_tracking_state.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/context_tracking_state.h +2 -2
@@ -130,9 +130,9 @@ static __always_inline int ct_state(void)if (!context_tracking_enabled ())return CONTEXT_DISABLED ; -preempt_disable (); +preempt_disable_notrace (); ret =__ct_state (); -preempt_enable (); +preempt_enable_notrace ();return ret; }
Signature · 1 line
2.39.1
Quoted 18 lines · Steven Rostedt
From: "Steven Rostedt (Google)" <[email protected]>
One of my tests triggered:
------------[ cut here ]------------ WARNING: CPU: 0 PID: 1 at include/trace/events/preemptirq.h:51 trace_preempt_off+0x7c/0x80 Modules linked in: CPU: 0 PID: 1 Comm: init Not tainted 6.3.0-rc3-test-00011-ge11b521a7b69-dirty #31 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.0-debian-1.16.0-5 04/01/2014 RIP: 0010:trace_preempt_off+0x7c/0x80 Code: 74 0f 48 8b 78 08 48 89 f2 48 89 de e8 5d f9 ff ff 65 ff 0d 6e d6 ce 68 75 a2 0f 1f 44 00 00 eb 9b e8 28 ea f3 ff 84 c0 75 a5 <0f> 0b eb a1 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f RSP: 0000:ffffaf0880013f00 EFLAGS: 00010046 RAX: 0000000000000000 RBX: ffffffff97fafe59 RCX: 0000000000000001 RDX: 0000000000000000 RSI: ffffffff986f4b71 RDI: ffffffff986fa0dd RBP: ffffffff97fafe59 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000014 R14: 0000000000000000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff8adf7bc00000(0000) knlGS:0000000000000000
Quoted 8 lines
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f125de099c0 CR3: 000000010498a001 CR4: 0000000000170ef0 Call Trace: <TASK> irqentry_enter_from_user_mode+0x39/0x80 irqentry_enter+0x51/0x60 exc_page_fault+0x3d/0x200 asm_exc_page_fault+0x26/0x30
I think this was just fixed in -tip today:
Signature · 1 line
Josh
Quoted 28 lines · On Tue, 21 Mar 2023 17:58:21 -0700 Josh Poimboeuf <[email protected]> wrote:
Quoted 18 lines · Steven Rostedt
From: "Steven Rostedt (Google)" <[email protected]>
One of my tests triggered:
------------[ cut here ]------------ WARNING: CPU: 0 PID: 1 at include/trace/events/preemptirq.h:51 trace_preempt_off+0x7c/0x80 Modules linked in: CPU: 0 PID: 1 Comm: init Not tainted 6.3.0-rc3-test-00011-ge11b521a7b69-dirty #31 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.0-debian-1.16.0-5 04/01/2014 RIP: 0010:trace_preempt_off+0x7c/0x80 Code: 74 0f 48 8b 78 08 48 89 f2 48 89 de e8 5d f9 ff ff 65 ff 0d 6e d6 ce 68 75 a2 0f 1f 44 00 00 eb 9b e8 28 ea f3 ff 84 c0 75 a5 <0f> 0b eb a1 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f RSP: 0000:ffffaf0880013f00 EFLAGS: 00010046 RAX: 0000000000000000 RBX: ffffffff97fafe59 RCX: 0000000000000001 RDX: 0000000000000000 RSI: ffffffff986f4b71 RDI: ffffffff986fa0dd RBP: ffffffff97fafe59 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000014 R14: 0000000000000000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff8adf7bc00000(0000) knlGS:0000000000000000Quoted 8 lines
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f125de099c0 CR3: 000000010498a001 CR4: 0000000000170ef0 Call Trace: <TASK> irqentry_enter_from_user_mode+0x39/0x80 irqentry_enter+0x51/0x60 exc_page_fault+0x3d/0x200 asm_exc_page_fault+0x26/0x30
Quoted 4 lines
I think this was just fixed in -tip today:
Thanks. Either way, I need a fix to let me pass my tests on my own code ;-)
-- Steve