From: Andreas Gruenbacher <agruenba@redhat.com> To: Peter Zijlstra <peterz@infradead.org> Cc: Martin Brandenburg <martin@omnibond.com>, linux-cachefs@redhat.com, Mike Snitzer <snitzer@redhat.com>, linux-aio@kvack.org, David Airlie <airlied@linux.ie>, samba-technical <samba-technical@lists.samba.org>, Will Deacon <will.deacon@arm.com>, dri-devel@lists.freedesktop.org, David Howells <dhowells@redhat.com>, Chris Mason <clm@fb.com>, dm-devel@redhat.com, keyrings@vger.kernel.org, Ingo Molnar <mingo@redhat.com>, linux-afs@lists.infradead.org, Alasdair Kergon <agk@redhat.com>, Mike Marshall <hubcap@omnibond.com>, linux-cifs@vger.kernel.org, rds-devel@oss.oracle.com, linux-rdma@vger.kernel.org, James Morris <jmorris@namei.org>, cluster-devel <cluster-devel@redhat.com>, Antti Palosaari <crope@iki.fi>, Matthias Brugger <matthias.bgg@gmail.com>, Paul McKenney <paulmck@linux.vnet.ibm.com>, intel-gfx@lists.freedesktop.org, devel@lists.orangefs.org, "Serge E. Hallyn" <serge@ha> Subject: Re: [RFC][PATCH] wake_up_var() memory ordering Date: Tue, 25 Jun 2019 14:12:22 +0200 [thread overview] Message-ID: <CAHc6FU6zUCdQZ1AfN2KYcPYVKc5bwvc0bD7=-KZpFXws+F9QZQ@mail.gmail.com> (raw) In-Reply-To: <20190625103430.GW3402@hirez.programming.kicks-ass.net> On Tue, 25 Jun 2019 at 12:36, Peter Zijlstra <peterz@infradead.org> wrote: > On Tue, Jun 25, 2019 at 11:19:35AM +0200, Andreas Gruenbacher wrote: > > > diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c > > > index cf4c767005b1..666629ea5da7 100644 > > > --- a/fs/gfs2/glops.c > > > +++ b/fs/gfs2/glops.c > > > @@ -227,6 +227,7 @@ static void gfs2_clear_glop_pending(struct gfs2_inode *ip) > > > return; > > > > > > clear_bit_unlock(GIF_GLOP_PENDING, &ip->i_flags); > > > + smp_mb__after_atomic(); > > > wake_up_bit(&ip->i_flags, GIF_GLOP_PENDING); > > > > This should become clear_and_wake_up_bit as well, right? There are > > several more instances of the same pattern. > > Only if we do as David suggested and make clean_and_wake_up_bit() > provide the RELEASE barrier. (It's clear_and_wake_up_bit, not clean_and_wake_up_bit.) > That is, currently clear_and_wake_up_bit() is > > clear_bit() > smp_mb__after_atomic(); > wake_up_bit(); > > But the above is: > > clear_bit_unlock(); > smp_mb__after_atomic(); > wake_up_bit() > > the difference is that _unlock() uses RELEASE semantics, where > clear_bit() does not. > > The difference is illustrated with something like: > > cond = true; > clear_bit() > smp_mb__after_atomic(); > wake_up_bit(); > > In this case, a remote CPU can first observe the clear_bit() and then > the 'cond = true' store. When we use clear_bit_unlock() this is not > possible, because the RELEASE barrier ensures that everything before, > stays before. Now I'm confused because clear_and_wake_up_bit() in mainline does use clear_bit_unlock(), so it's the exact opposite of what you just said. Thanks, Andreas _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
WARNING: multiple messages have this Message-ID (diff)
From: Andreas Gruenbacher <agruenba@redhat.com> To: cluster-devel.redhat.com Subject: [Cluster-devel] [RFC][PATCH] wake_up_var() memory ordering Date: Tue, 25 Jun 2019 14:12:22 +0200 [thread overview] Message-ID: <CAHc6FU6zUCdQZ1AfN2KYcPYVKc5bwvc0bD7=-KZpFXws+F9QZQ@mail.gmail.com> (raw) In-Reply-To: <20190625103430.GW3402@hirez.programming.kicks-ass.net> On Tue, 25 Jun 2019 at 12:36, Peter Zijlstra <peterz@infradead.org> wrote: > On Tue, Jun 25, 2019 at 11:19:35AM +0200, Andreas Gruenbacher wrote: > > > diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c > > > index cf4c767005b1..666629ea5da7 100644 > > > --- a/fs/gfs2/glops.c > > > +++ b/fs/gfs2/glops.c > > > @@ -227,6 +227,7 @@ static void gfs2_clear_glop_pending(struct gfs2_inode *ip) > > > return; > > > > > > clear_bit_unlock(GIF_GLOP_PENDING, &ip->i_flags); > > > + smp_mb__after_atomic(); > > > wake_up_bit(&ip->i_flags, GIF_GLOP_PENDING); > > > > This should become clear_and_wake_up_bit as well, right? There are > > several more instances of the same pattern. > > Only if we do as David suggested and make clean_and_wake_up_bit() > provide the RELEASE barrier. (It's clear_and_wake_up_bit, not clean_and_wake_up_bit.) > That is, currently clear_and_wake_up_bit() is > > clear_bit() > smp_mb__after_atomic(); > wake_up_bit(); > > But the above is: > > clear_bit_unlock(); > smp_mb__after_atomic(); > wake_up_bit() > > the difference is that _unlock() uses RELEASE semantics, where > clear_bit() does not. > > The difference is illustrated with something like: > > cond = true; > clear_bit() > smp_mb__after_atomic(); > wake_up_bit(); > > In this case, a remote CPU can first observe the clear_bit() and then > the 'cond = true' store. When we use clear_bit_unlock() this is not > possible, because the RELEASE barrier ensures that everything before, > stays before. Now I'm confused because clear_and_wake_up_bit() in mainline does use clear_bit_unlock(), so it's the exact opposite of what you just said. Thanks, Andreas
next prev parent reply other threads:[~2019-06-25 12:12 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-06-24 16:50 [RFC][PATCH] wake_up_var() memory ordering Peter Zijlstra 2019-06-24 16:50 ` [Cluster-devel] " Peter Zijlstra 2019-06-25 7:51 ` David Howells 2019-06-25 7:51 ` [Cluster-devel] " David Howells [not found] ` <32379.1561449061-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org> 2019-06-25 8:11 ` Peter Zijlstra 2019-06-25 8:11 ` [Cluster-devel] " Peter Zijlstra 2019-06-25 9:19 ` Andreas Gruenbacher 2019-06-25 9:19 ` [Cluster-devel] " Andreas Gruenbacher [not found] ` <CAHc6FU7j5iW7WQoxN_OSfvK4zxv_MxTWJpiNsqFW8TEDMX1rjw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2019-06-25 10:34 ` Peter Zijlstra 2019-06-25 10:34 ` [Cluster-devel] " Peter Zijlstra 2019-06-25 12:12 ` Andreas Gruenbacher [this message] 2019-06-25 12:12 ` Andreas Gruenbacher [not found] ` <CAHc6FU6zUCdQZ1AfN2KYcPYVKc5bwvc0bD7=-KZpFXws+F9QZQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2019-06-25 13:27 ` Peter Zijlstra 2019-06-25 13:27 ` [Cluster-devel] " Peter Zijlstra
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='CAHc6FU6zUCdQZ1AfN2KYcPYVKc5bwvc0bD7=-KZpFXws+F9QZQ@mail.gmail.com' \ --to=agruenba@redhat.com \ --cc=agk@redhat.com \ --cc=airlied@linux.ie \ --cc=clm@fb.com \ --cc=cluster-devel@redhat.com \ --cc=crope@iki.fi \ --cc=devel@lists.orangefs.org \ --cc=dhowells@redhat.com \ --cc=dm-devel@redhat.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=hubcap@omnibond.com \ --cc=intel-gfx@lists.freedesktop.org \ --cc=jmorris@namei.org \ --cc=keyrings@vger.kernel.org \ --cc=linux-afs@lists.infradead.org \ --cc=linux-aio@kvack.org \ --cc=linux-cachefs@redhat.com \ --cc=linux-cifs@vger.kernel.org \ --cc=linux-rdma@vger.kernel.org \ --cc=martin@omnibond.com \ --cc=matthias.bgg@gmail.com \ --cc=mingo@redhat.com \ --cc=paulmck@linux.vnet.ibm.com \ --cc=peterz@infradead.org \ --cc=rds-devel@oss.oracle.com \ --cc=samba-technical@lists.samba.org \ --cc=serge@ha \ --cc=snitzer@redhat.com \ --cc=will.deacon@arm.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.