From: Boqun Feng <boqun.feng@gmail.com>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>,
josh@joshtriplett.org, Steven Rostedt <rostedt@goodmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
jiangshanlai@gmail.com, LKML <linux-kernel@vger.kernel.org>,
syzkaller <syzkaller@googlegroups.com>
Subject: Re: rcu: WARNING in rcu_seq_end
Date: Tue, 7 Mar 2017 22:27:40 +0800 [thread overview]
Message-ID: <20170307142740.uh2nnaw44albn3t2@tardis> (raw)
In-Reply-To: <CACT4Y+bW13N50TuzCr68VbYRQxmzW0xhi5p0cezit1GQHOWAfQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2097 bytes --]
On Tue, Mar 07, 2017 at 08:05:19AM +0100, Dmitry Vyukov wrote:
[...]
> >>
> >> What is that mutex? And what locks/unlocks provide synchronization? I
> >> see that one uses exp_mutex and another -- exp_wake_mutex.
> >
> > Both of them.
> >
> > ->exp_mutex is acquired by the task requesting the grace period, and
> > the counter's first increment is done by that task under that mutex.
> > This task then schedules a workqueue, which drives forward the grace
> > period. Upon grace-period completion, the workqueue handler does the
> > second increment (the one that your patch addressed). The workqueue
> > handler then acquires ->exp_wake_mutex and wakes the task that holds
> > ->exp_mutex (along with all other tasks waiting for this grace period),
> > and that task releases ->exp_mutex, which allows the next grace period to
> > start (and the first increment for that next grace period to be carried
> > out under that lock). The workqueue handler releases ->exp_wake_mutex
> > after finishing its wakeups.
>
>
> Then we need the following for the case when task requesting the grace
> period does not block, right?
>
Won't be necessary I think, as the smp_mb() in rcu_seq_end() and the
smp_mb__before_atomic() in sync_exp_work_done() already provide the
required ordering, no?
Regards,
Boqun
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index d80c2587bed8..aa7ba83f6a56 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -3534,7 +3534,7 @@ static void rcu_seq_start(unsigned long *sp)
> static void rcu_seq_end(unsigned long *sp)
> {
> smp_mb(); /* Ensure update-side operation before counter increment. */
> - WRITE_ONCE(*sp, *sp + 1);
> + smp_store_release(sp, *sp + 1);
> WARN_ON_ONCE(*sp & 0x1);
> }
>
> @@ -3554,7 +3554,7 @@ static unsigned long rcu_seq_snap(unsigned long *sp)
> */
> static bool rcu_seq_done(unsigned long *sp, unsigned long s)
> {
> - return ULONG_CMP_GE(READ_ONCE(*sp), s);
> + return ULONG_CMP_GE(smp_load_acquire(sp), s);
>
> }
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2017-03-07 14:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-04 16:01 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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170307142740.uh2nnaw44albn3t2@tardis \
--to=boqun.feng@gmail.com \
--cc=dvyukov@google.com \
--cc=jiangshanlai@gmail.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=rostedt@goodmis.org \
--cc=syzkaller@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®