Re: [PATCH v7 6/6] rcu/segcblist: Add additional comments to explain smp_mb()

2020-10-21 Thread Frederic Weisbecker
On Wed, Oct 21, 2020 at 11:57:04AM -0700, Joel Fernandes wrote: > On Mon, Oct 19, 2020 at 5:37 AM Frederic Weisbecker > wrote: > > Now, reading the documentation of rcu_barrier() (thanks to you!): > > > > Pseudo-code using rcu_barrier() is as follows: > > > >1. Prevent any new RCU callbac

Re: [PATCH v7 6/6] rcu/segcblist: Add additional comments to explain smp_mb()

2020-10-21 Thread Joel Fernandes
On Mon, Oct 19, 2020 at 5:37 AM Frederic Weisbecker wrote: > [..] > > > > > > I'm very likely missing something obvious somewhere. > > > > > > CPU 0CPU 1 > > > rcu_barrier() > > > call_rcu()/rcu_segcblist_enqueue() > > > ---

Re: [PATCH v7 6/6] rcu/segcblist: Add additional comments to explain smp_mb()

2020-10-19 Thread Frederic Weisbecker
On Sat, Oct 17, 2020 at 08:35:56PM -0400, j...@joelfernandes.org wrote: > On Sat, Oct 17, 2020 at 03:29:54PM +0200, Frederic Weisbecker wrote: > > > C rcubarrier+ctrldep > > > > > > (* > > > * Result: Never > > > * > > > * This litmus test shows that rcu_barrier (P1) prematurely > > > * return

Re: [PATCH v7 6/6] rcu/segcblist: Add additional comments to explain smp_mb()

2020-10-18 Thread Alan Stern
On Sun, Oct 18, 2020 at 01:45:31PM -0700, Joel Fernandes wrote: > Hi, > Thanks Alan for your replies. You're welcome. > > > C rcubarrier+ctrldep > > > > > > (* > > > * Result: Never > > > * > > > * This litmus test shows that rcu_barrier (P1) prematurely > > > * returning by reading len 0 can

Re: [PATCH v7 6/6] rcu/segcblist: Add additional comments to explain smp_mb()

2020-10-18 Thread Joel Fernandes
Hi, Thanks Alan for your replies. On Sat, Oct 17, 2020 at 1:24 PM Alan Stern wrote: > > [I sent this reply earlier, but since it hasn't shown up in the mailing > list archives, I may have forgotten to include the proper CC's. At the > risk of repeating myself, here it is again.] Np, I did get y

Re: [PATCH v7 6/6] rcu/segcblist: Add additional comments to explain smp_mb()

2020-10-18 Thread Joel Fernandes
On Sat, Oct 17, 2020 at 7:31 AM Alan Stern wrote: > > On Fri, Oct 16, 2020 at 09:27:53PM -0400, j...@joelfernandes.org wrote: > > Adding Alan as well as its memory barrier discussion ;-) > > I don't know the internals of how RCU works, so I'll just speak to the > litmus test itself, ignoring issue

Re: [PATCH v7 6/6] rcu/segcblist: Add additional comments to explain smp_mb()

2020-10-17 Thread joel
On Sat, Oct 17, 2020 at 03:29:54PM +0200, Frederic Weisbecker wrote: > On Fri, Oct 16, 2020 at 11:19:41PM -0400, j...@joelfernandes.org wrote: > > On Fri, Oct 16, 2020 at 09:27:53PM -0400, j...@joelfernandes.org wrote: > > [..] > > > > > + * > > > > > + * Memory barrier is needed after adding to le

Re: [PATCH v7 6/6] rcu/segcblist: Add additional comments to explain smp_mb()

2020-10-17 Thread Alan Stern
[I sent this reply earlier, but since it hasn't shown up in the mailing list archives, I may have forgotten to include the proper CC's. At the risk of repeating myself, here it is again.] On Fri, Oct 16, 2020 at 11:19:41PM -0400, j...@joelfernandes.org wrote: > So I made a litmus test to show t

Re: [PATCH v7 6/6] rcu/segcblist: Add additional comments to explain smp_mb()

2020-10-17 Thread Alan Stern
On Fri, Oct 16, 2020 at 09:27:53PM -0400, j...@joelfernandes.org wrote: > Adding Alan as well as its memory barrier discussion ;-) I don't know the internals of how RCU works, so I'll just speak to the litmus test itself, ignoring issues of whether the litmus test is appropriate or expresses wha

Re: [PATCH v7 6/6] rcu/segcblist: Add additional comments to explain smp_mb()

2020-10-17 Thread Frederic Weisbecker
On Fri, Oct 16, 2020 at 11:19:41PM -0400, j...@joelfernandes.org wrote: > On Fri, Oct 16, 2020 at 09:27:53PM -0400, j...@joelfernandes.org wrote: > [..] > > > > + * > > > > + * Memory barrier is needed after adding to length for the case > > > > + * where length transitions from 0 -> 1. This is bec

Re: [PATCH v7 6/6] rcu/segcblist: Add additional comments to explain smp_mb()

2020-10-16 Thread joel
Adding Alan as well as its memory barrier discussion ;-) On Thu, Oct 15, 2020 at 03:35:11PM +0200, Frederic Weisbecker wrote: > On Wed, Oct 14, 2020 at 08:23:01PM -0400, Joel Fernandes (Google) wrote: > > Memory barriers are needed when updating the full length of the > > segcblist, however it is

Re: [PATCH v7 6/6] rcu/segcblist: Add additional comments to explain smp_mb()

2020-10-16 Thread joel
On Fri, Oct 16, 2020 at 09:27:53PM -0400, j...@joelfernandes.org wrote: [..] > > > + * > > > + * Memory barrier is needed after adding to length for the case > > > + * where length transitions from 0 -> 1. This is because rcu_barrier() > > > + * should never miss an update to the length. So the upd

Re: [PATCH v7 6/6] rcu/segcblist: Add additional comments to explain smp_mb()

2020-10-15 Thread Frederic Weisbecker
On Wed, Oct 14, 2020 at 08:23:01PM -0400, Joel Fernandes (Google) wrote: > Memory barriers are needed when updating the full length of the > segcblist, however it is not fully clearly why one is needed before and > after. This patch therefore adds additional comments to the function > header to exp

[PATCH v7 6/6] rcu/segcblist: Add additional comments to explain smp_mb()

2020-10-14 Thread Joel Fernandes (Google)
Memory barriers are needed when updating the full length of the segcblist, however it is not fully clearly why one is needed before and after. This patch therefore adds additional comments to the function header to explain it. Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/rcu_segcblist.c