Linux virtualization list
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: mst@redhat.com, jasowang@redhat.com
Cc: peterz@infradead.org, linux-kernel@lists.infradead.org,
	stern@rowland.harvard.edu, paulmck@kernel.org,
	virtualization@lists.linux-foundation.org
Subject: read_barrier_depends() usage in vhost.c
Date: Thu, 17 Oct 2019 00:33:40 +0100	[thread overview]
Message-ID: <20191016233340.djrr7o7dwueqccac@willie-the-truck> (raw)

Hi all,

In an attempt to remove the remaining traces of [smp_]read_barrier_depends()
following my previous patches to strengthen READ_ONCE() for Alpha [1], I
ended up trying to decipher the read_barrier_depends() usage in the vhost
driver:

--->8

// drivers/vhost/vhost.c
static int get_indirect(struct vhost_virtqueue *vq,
			struct iovec iov[], unsigned int iov_size,
			unsigned int *out_num, unsigned int *in_num,
			struct vhost_log *log, unsigned int *log_num,
			struct vring_desc *indirect)
{
	[...]

	/* We will use the result as an address to read from, so most
	 * architectures only need a compiler barrier here. */
	read_barrier_depends();

--->8

Unfortunately, although the barrier is commented (hurrah!), it's not
particularly enlightening about the accesses making up the dependency
chain, and I don't understand the supposed need for a compiler barrier
either (read_barrier_depends() doesn't generally provide this).

Does anybody know which accesses are being ordered here? Usually you'd need
a READ_ONCE()/rcu_dereference() beginning the chain, but I haven't managed
to find one...

Thanks,

Will

[1] c2bc66082e10 ("locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()")

             reply	other threads:[~2019-10-16 23:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16 23:33 Will Deacon [this message]
2019-10-16 23:36 ` read_barrier_depends() usage in vhost.c Will Deacon
2019-10-17  2:17 ` Jason Wang
2019-10-18 20:58   ` Will Deacon
2019-10-21  5:48     ` Jason Wang
2019-10-30 16:13       ` Will Deacon
     [not found] <20191016233602.i2afxb5mb465laq6@willie-the-truck>
2019-12-18  9:19 ` Herbert Xu
     [not found] <20191218091906.cmzgqnwyekak5dzv@gondor.apana.org.au>
2019-12-20  3:40 ` Jason Wang

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=20191016233340.djrr7o7dwueqccac@willie-the-truck \
    --to=will@kernel.org \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@lists.infradead.org \
    --cc=mst@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=stern@rowland.harvard.edu \
    --cc=virtualization@lists.linux-foundation.org \
    /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