linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* rcu: WARNING in rcu_seq_end
@ 2017-03-04 16:01 Dmitry Vyukov
  2017-03-04 20:40 ` Paul E. McKenney
  0 siblings, 1 reply; 21+ messages in thread
From: Dmitry Vyukov @ 2017-03-04 16:01 UTC (permalink / raw)
  To: Paul McKenney, josh, Steven Rostedt, Mathieu Desnoyers,
	jiangshanlai, LKML
  Cc: syzkaller

Hello,

Paul, you wanted bugs in rcu.

I've got this WARNING while running syzkaller fuzzer on
86292b33d4b79ee03e2f43ea0381ef85f077c760:

------------[ cut here ]------------
WARNING: CPU: 0 PID: 4832 at kernel/rcu/tree.c:3533
rcu_seq_end+0x110/0x140 kernel/rcu/tree.c:3533
Kernel panic - not syncing: panic_on_warn set ...
CPU: 0 PID: 4832 Comm: kworker/0:3 Not tainted 4.10.0+ #276
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Workqueue: events wait_rcu_exp_gp
Call Trace:
 __dump_stack lib/dump_stack.c:15 [inline]
 dump_stack+0x2ee/0x3ef lib/dump_stack.c:51
 panic+0x1fb/0x412 kernel/panic.c:179
 __warn+0x1c4/0x1e0 kernel/panic.c:540
 warn_slowpath_null+0x2c/0x40 kernel/panic.c:583
 rcu_seq_end+0x110/0x140 kernel/rcu/tree.c:3533
 rcu_exp_gp_seq_end kernel/rcu/tree_exp.h:36 [inline]
 rcu_exp_wait_wake+0x8a9/0x1330 kernel/rcu/tree_exp.h:517
 rcu_exp_sel_wait_wake kernel/rcu/tree_exp.h:559 [inline]
 wait_rcu_exp_gp+0x83/0xc0 kernel/rcu/tree_exp.h:570
 process_one_work+0xc06/0x1c20 kernel/workqueue.c:2096
 worker_thread+0x223/0x19c0 kernel/workqueue.c:2230
 kthread+0x326/0x3f0 kernel/kthread.c:227
 ret_from_fork+0x31/0x40 arch/x86/entry/entry_64.S:430
Dumping ftrace buffer:
   (ftrace buffer empty)
Kernel Offset: disabled
Rebooting in 86400 seconds..


Not reproducible. But looking at the code, shouldn't it be:

 static void rcu_seq_end(unsigned long *sp)
 {
        smp_mb(); /* Ensure update-side operation before counter increment. */
+       WARN_ON_ONCE(!(*sp & 0x1));
        WRITE_ONCE(*sp, *sp + 1);
-       WARN_ON_ONCE(*sp & 0x1);
 }

?

Otherwise wait_event in _synchronize_rcu_expedited can return as soon
as WRITE_ONCE(*sp, *sp + 1) finishes. As far as I understand this
consequently can allow start of next grace periods. Which in turn can
make the warning fire. Am I missing something?

I don't see any other bad consequences of this. The rest of
rcu_exp_wait_wake can proceed when _synchronize_rcu_expedited has
returned and destroyed work on stack and next period has started and
ended, but it seems OK.

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2017-03-08  3:14 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-04 16:01 rcu: WARNING in rcu_seq_end Dmitry Vyukov
2017-03-04 20:40 ` Paul E. McKenney
2017-03-05 10:50   ` Dmitry Vyukov
2017-03-05 18:47     ` Paul E. McKenney
2017-03-06  9:24       ` Dmitry Vyukov
2017-03-06 10:07         ` Paul E. McKenney
2017-03-06 10:11           ` Dmitry Vyukov
2017-03-06 23:08             ` Paul E. McKenney
2017-03-07  7:05               ` Dmitry Vyukov
2017-03-07 14:27                 ` Boqun Feng
2017-03-07 14:43                   ` Dmitry Vyukov
2017-03-07 15:27                     ` Paul E. McKenney
2017-03-07 18:37                       ` Dmitry Vyukov
2017-03-07 19:09                         ` Paul E. McKenney
2017-03-07 23:05                       ` Boqun Feng
2017-03-07 23:31                         ` Paul E. McKenney
2017-03-08  1:39                           ` Boqun Feng
2017-03-08  2:26                             ` Paul E. McKenney
2017-03-08  2:44                               ` Boqun Feng
2017-03-08  3:08                                 ` Paul E. McKenney
2017-03-07 15:16                 ` Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).