Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1243322

Re: [PATCH v2] kvm: fix waitqueue_active without memory barrier in virt/kvm/async_pf.c

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2] kvm: fix waitqueue_active without memory barrier in virt/kvm/async_pf.c
Date 2015-10-09 15:00 +0200
Message-ID <qhFrc-2zB-15@gated-at.bofh.it> (permalink)
References <qhEYa-21U-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Oct 09, 2015 at 12:21:55PM +0000, Kosuke Tatsukawa wrote:

> +	 * Memory barrier is required here to make sure change to
> +	 * vcpu->async_pf.done is visible from other CPUs.  This memory
> +	 * barrier pairs with prepare_to_wait's set_current_state()

That is not how memory barriers work; they don't 'make visible'. They
simply ensure order between operations.

  X = Y = 0

	CPU0			CPU1

	[S] X=1			[S] Y=1
	 MB			 MB
	[L] y=Y			[L] x=X

  assert(x || y)

The issue of the memory barrier does not mean the store is visible, it
merely means that the load _must_ happen after the store (in the above
scenario).

This gives a guarantee that not both x and y can be 0. Because either
being 0, means the other has not yet executed and must therefore observe
your store.

Nothing more, nothing less.

So your comment is misleading at best.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] kvm: fix waitqueue_active without memory barrier in  virt/kvm/async_pf.c Kosuke Tatsukawa <tatsu@ab.jp.nec.com> - 2015-10-09 14:30 +0200
  Re: [PATCH v2] kvm: fix waitqueue_active without memory barrier in  virt/kvm/async_pf.c Peter Zijlstra <peterz@infradead.org> - 2015-10-09 15:00 +0200
    Re: [PATCH v2] kvm: fix waitqueue_active without memory barrier in  virt/kvm/async_pf.c Paolo Bonzini <pbonzini@redhat.com> - 2015-10-09 16:00 +0200

csiph-web