On Thu, Oct 27, 2022 at 11:37:46AM +0206, John Ogness wrote: > Hi Paul, > > I am running some tests using srcunmisafe.2022.10.21a and I am hitting > the WARN_ONCE in srcu_check_nmi_safety(): > > [ 1.836703][ T1] rcu: Hierarchical SRCU implementation. > [ 1.836707][ T1] rcu: Max phase no-delay instances is 1000. > [ 1.836844][ T15] ------------[ cut here ]------------ > [ 1.836846][ T15] CPU 0 old state 1 new state 2 > [ 1.836885][ T15] WARNING: CPU: 0 PID: 15 at kernel/rcu/srcutree.c:652 srcu_check_nmi_safety+0x79/0x90 > [ 1.836897][ T15] Modules linked in: > [ 1.836903][ T15] CPU: 0 PID: 15 Comm: pr/bkl Not tainted 6.1.0-rc1+ #9 > [ 1.836909][ T15] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014 > [ 1.836912][ T15] RIP: 0010:srcu_check_nmi_safety+0x79/0x90 > [ 1.836919][ T15] Code: d3 80 3d 9f 76 d3 01 00 75 e5 55 8b b0 c8 01 00 00 44 89 c1 48 c7 c7 d0 1f 87 82 c6 05 850 > [ 1.836923][ T15] RSP: 0000:ffffc90000083e98 EFLAGS: 00010282 > [ 1.836929][ T15] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 > [ 1.836933][ T15] RDX: 0000000000000001 RSI: 0000000000000000 RDI: 00000000ffffffff > [ 1.836936][ T15] RBP: ffffc90000083e98 R08: 0000000000000000 R09: 0000000000000001 > [ 1.836940][ T15] R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000 > [ 1.836943][ T15] R13: ffffc90000013d70 R14: ffff888004073900 R15: 0000000000000000 > [ 1.836946][ T15] FS: 0000000000000000(0000) GS:ffff888019600000(0000) knlGS:0000000000000000 > [ 1.836951][ T15] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > [ 1.836954][ T15] CR2: ffff888003c01000 CR3: 0000000002c22001 CR4: 0000000000370ef0 > [ 1.836962][ T15] Call Trace: > [ 1.836964][ T15] <TASK> > [ 1.836970][ T15] console_bkl_kthread_func+0x27a/0x590 > [ 1.836981][ T15] ? _raw_spin_unlock_irqrestore+0x3c/0x60 > [ 1.836998][ T15] ? console_fill_outbuf+0x210/0x210 > [ 1.837003][ T15] kthread+0x108/0x130 > [ 1.837012][ T15] ? kthread_complete_and_exit+0x20/0x20 > [ 1.837025][ T15] ret_from_fork+0x1f/0x30 > [ 1.837059][ T15] </TASK> > [ 1.837062][ T15] irq event stamp: 71 > [ 1.837065][ T15] hardirqs last enabled at (73): [<ffffffff81106f99>] vprintk_store+0x1b9/0x5e0 > [ 1.837070][ T15] hardirqs last disabled at (74): [<ffffffff811071fb>] vprintk_store+0x41b/0x5e0 > [ 1.837075][ T15] softirqs last enabled at (0): [<ffffffff8107ce22>] copy_process+0x952/0x1dd0 > [ 1.837081][ T15] softirqs last disabled at (0): [<0000000000000000>] 0x0 > [ 1.837085][ T15] ---[ end trace 0000000000000000 ]--- > [ 1.945054][ T12] Callback from call_rcu_tasks_rude() invoked. > > My code is calling srcu_read_lock_nmisafe() from task context, in a > dedicated kthread. I am using DEFINE_STATIC_SRCU() to define/initialize > the srcu struct. > > What does the warning imply? The warning is claiming that this srcu_struct was passed to srcu_read_lock() at some point and is now being passed to srcu_read_lock_nmisafe(). In other words, you have an srcu_read_lock() or srcu_read_unlock() somewhere that needs to instead be srcu_read_lock_nmisafe() or srcu_read_unlock_nmisafe(). Thanx, Paul