]> www.infradead.org Git - users/jedix/linux-maple.git/commit
asm-generic: implement virt_xxx memory barriers
authorMichael S. Tsirkin <mst@redhat.com>
Sun, 27 Dec 2015 16:23:01 +0000 (18:23 +0200)
committerSomasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Thu, 31 Aug 2017 17:26:20 +0000 (10:26 -0700)
commitbc7b45bc1b0b9fc6573120fbbf426e1b62967b7b
tree6ccc5e98a5dea502a4b8a0dec3718c7c7832567d
parent7b60d5009fb288d4e5351481787b7a9bfdf70300
asm-generic: implement virt_xxx memory barriers

Orabug: 26668113

Guests running within virtual machines might be affected by SMP effects even if
the guest itself is compiled without SMP support.  This is an artifact of
interfacing with an SMP host while running an UP kernel.  Using mandatory
barriers for this use-case would be possible but is often suboptimal.

In particular, virtio uses a bunch of confusing ifdefs to work around
this, while xen just uses the mandatory barriers.

To better handle this case, low-level virt_mb() etc macros are made available.
These are implemented trivially using the low-level __smp_xxx macros,
the purpose of these wrappers is to annotate those specific cases.

These have the same effect as smp_mb() etc when SMP is enabled, but generate
identical code for SMP and non-SMP systems. For example, virtual machine guests
should use virt_mb() rather than smp_mb() when synchronizing against a
(possibly SMP) host.

Suggested-by: David Miller <davem@davemloft.net>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
(cherry picked from commit 6a65d26385bf487926a0616650927303058551e3)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
Documentation/memory-barriers.txt
include/asm-generic/barrier.h