From: David Howells <dhowells@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@lists.samba.org,
Will Deacon <will.deacon@arm.com>,
dri-devel@lists.freedesktop.org, 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,
Andreas Gruenbacher <agruenba@redhat.com>,
linux-rdma@vger.kernel.org, James Morris <jmorris@namei.org>,
cluster-devel@redhat.com,
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@hallyn.com>,
Santosh Shilimkar <santosh.s>
Subject: Re: [RFC][PATCH] wake_up_var() memory ordering
Date: Tue, 25 Jun 2019 08:51:01 +0100 [thread overview]
Message-ID: <32379.1561449061@warthog.procyon.org.uk> (raw)
In-Reply-To: <20190624165012.GH3436@hirez.programming.kicks-ass.net>
Peter Zijlstra <peterz@infradead.org> wrote:
> I tried using wake_up_var() today and accidentally noticed that it
> didn't imply an smp_mb() and specifically requires it through
> wake_up_bit() / waitqueue_active().
Thinking about it again, I'm not sure why you need to add the barrier when
wake_up() (which this is a wrapper around) is required to impose a barrier at
the front if there's anything to wake up (ie. the wait queue isn't empty).
If this is insufficient, does it make sense just to have wake_up*() functions
do an unconditional release or full barrier right at the front, rather than it
being conditional on something being woken up?
> @@ -619,9 +614,7 @@ static int dvb_usb_fe_sleep(struct dvb_frontend *fe)
> err:
> if (!adap->suspend_resume_active) {
> adap->active_fe = -1;
I'm wondering if there's a missing barrier here. Should the clear_bit() on
the next line be clear_bit_unlock() or clear_bit_release()?
> - clear_bit(ADAP_SLEEP, &adap->state_bits);
> - smp_mb__after_atomic();
> - wake_up_bit(&adap->state_bits, ADAP_SLEEP);
> + clear_and_wake_up_bit(ADAP_SLEEP, &adap->state_bits);
> }
>
> dev_dbg(&d->udev->dev, "%s: ret=%d\n", __func__, ret);
> diff --git a/fs/afs/fs_probe.c b/fs/afs/fs_probe.c
> index cfe62b154f68..377ee07d5f76 100644
> --- a/fs/afs/fs_probe.c
> +++ b/fs/afs/fs_probe.c
> @@ -18,6 +18,7 @@ static bool afs_fs_probe_done(struct afs_server *server)
>
> wake_up_var(&server->probe_outstanding);
> clear_bit_unlock(AFS_SERVER_FL_PROBING, &server->flags);
> + smp_mb__after_atomic();
> wake_up_bit(&server->flags, AFS_SERVER_FL_PROBING);
> return true;
> }
Looking at this and the dvb one, does it make sense to stick the release
semantics of clear_bit_unlock() into clear_and_wake_up_bit()?
Also, should clear_bit_unlock() be renamed to clear_bit_release() (and
similarly test_and_set_bit_lock() -> test_and_set_bit_acquire()) if we seem to
be trying to standardise on that terminology.
David
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-06-25 7:51 UTC|newest]
Thread overview: 7+ 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-25 7:51 ` David Howells [this message]
[not found] ` <32379.1561449061-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2019-06-25 8:11 ` Peter Zijlstra
2019-06-25 9:19 ` Andreas Gruenbacher
[not found] ` <CAHc6FU7j5iW7WQoxN_OSfvK4zxv_MxTWJpiNsqFW8TEDMX1rjw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-06-25 10:34 ` Peter Zijlstra
2019-06-25 12:12 ` Andreas Gruenbacher
[not found] ` <CAHc6FU6zUCdQZ1AfN2KYcPYVKc5bwvc0bD7=-KZpFXws+F9QZQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-06-25 13:27 ` 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=32379.1561449061@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=agk@redhat.com \
--cc=agruenba@redhat.com \
--cc=airlied@linux.ie \
--cc=clm@fb.com \
--cc=cluster-devel@redhat.com \
--cc=devel@lists.orangefs.org \
--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@hallyn.com \
--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: 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