Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1299520
| From | "Michael S. Tsirkin" <mst@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 32/34] xen/io: use __smp_xxx barriers |
| Date | 2015-12-30 23:00 +0100 |
| Message-ID | <qLwWM-3Ft-43@gated-at.bofh.it> (permalink) |
| References | <qLoZb-79S-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
include/xen/interface/io/ring.h uses
full memory barriers to communicate with the other side.
For guests compiled with CONFIG_SMP, smp_wmb and smp_mb
would be sufficient, so mb() and wmb() here are only needed if
a non-SMP guest runs on an SMP host.
Switch to __smp_XXX barriers which serve this exact purpose.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/xen/interface/io/ring.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/xen/interface/io/ring.h b/include/xen/interface/io/ring.h
index 7dc685b..46dfc65 100644
--- a/include/xen/interface/io/ring.h
+++ b/include/xen/interface/io/ring.h
@@ -208,12 +208,12 @@ struct __name##_back_ring { \
#define RING_PUSH_REQUESTS(_r) do { \
- wmb(); /* back sees requests /before/ updated producer index */ \
+ __smp_wmb(); /* back sees requests /before/ updated producer index */ \
(_r)->sring->req_prod = (_r)->req_prod_pvt; \
} while (0)
#define RING_PUSH_RESPONSES(_r) do { \
- wmb(); /* front sees responses /before/ updated producer index */ \
+ __smp_wmb(); /* front sees responses /before/ updated producer index */ \
(_r)->sring->rsp_prod = (_r)->rsp_prod_pvt; \
} while (0)
@@ -250,9 +250,9 @@ struct __name##_back_ring { \
#define RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(_r, _notify) do { \
RING_IDX __old = (_r)->sring->req_prod; \
RING_IDX __new = (_r)->req_prod_pvt; \
- wmb(); /* back sees requests /before/ updated producer index */ \
+ __smp_wmb(); /* back sees requests /before/ updated producer index */ \
(_r)->sring->req_prod = __new; \
- mb(); /* back sees new requests /before/ we check req_event */ \
+ __smp_mb(); /* back sees new requests /before/ we check req_event */ \
(_notify) = ((RING_IDX)(__new - (_r)->sring->req_event) < \
(RING_IDX)(__new - __old)); \
} while (0)
@@ -260,9 +260,9 @@ struct __name##_back_ring { \
#define RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(_r, _notify) do { \
RING_IDX __old = (_r)->sring->rsp_prod; \
RING_IDX __new = (_r)->rsp_prod_pvt; \
- wmb(); /* front sees responses /before/ updated producer index */ \
+ __smp_wmb(); /* front sees responses /before/ updated producer index */ \
(_r)->sring->rsp_prod = __new; \
- mb(); /* front sees new responses /before/ we check rsp_event */ \
+ __smp_mb(); /* front sees new responses /before/ we check rsp_event */ \
(_notify) = ((RING_IDX)(__new - (_r)->sring->rsp_event) < \
(RING_IDX)(__new - __old)); \
} while (0)
@@ -271,7 +271,7 @@ struct __name##_back_ring { \
(_work_to_do) = RING_HAS_UNCONSUMED_REQUESTS(_r); \
if (_work_to_do) break; \
(_r)->sring->req_event = (_r)->req_cons + 1; \
- mb(); \
+ __smp_mb(); \
(_work_to_do) = RING_HAS_UNCONSUMED_REQUESTS(_r); \
} while (0)
@@ -279,7 +279,7 @@ struct __name##_back_ring { \
(_work_to_do) = RING_HAS_UNCONSUMED_RESPONSES(_r); \
if (_work_to_do) break; \
(_r)->sring->rsp_event = (_r)->rsp_cons + 1; \
- mb(); \
+ __smp_mb(); \
(_work_to_do) = RING_HAS_UNCONSUMED_RESPONSES(_r); \
} while (0)
--
MST
--
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 | Next — Previous in thread | Find similar | Unroll thread
[PATCH 00/34] arch: barrier cleanup + __smp_xxx barriers for virt "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-30 20:40 +0100
Re: [PATCH 00/34] arch: barrier cleanup + __smp_xxx barriers for virt David Miller <davem@davemloft.net> - 2015-12-30 21:50 +0100
Re: [PATCH 00/34] arch: barrier cleanup + __smp_xxx barriers for virt "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-30 22:40 +0100
Re: [PATCH 00/34] arch: barrier cleanup + __smp_xxx barriers for virt David Miller <davem@davemloft.net> - 2015-12-30 23:00 +0100
[PATCH 17/34] arm64: define __smp_xxx "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-30 22:50 +0100
[PATCH 18/34] arm: define __smp_xxx "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-30 22:50 +0100
Re: [PATCH 00/34] arch: barrier cleanup + __smp_xxx barriers for virt "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-30 22:50 +0100
Re: [PATCH 00/34] arch: barrier cleanup + __smp_xxx barriers for virt Arnd Bergmann <arnd@arndb.de> - 2015-12-30 23:50 +0100
[PATCH 20/34] ia64: define __smp_xxx "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-30 23:00 +0100
[PATCH 28/34] x86: define __smp_xxX "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-30 23:00 +0100
[PATCH 26/34] tile: define __smp_xxx "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-30 23:00 +0100
[PATCH 31/34] xenbus: use __smp_xxx barriers "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-30 23:00 +0100
[PATCH 23/34] s390: define __smp_xxx "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-30 23:00 +0100
[PATCH 21/34] metag: define __smp_xxx "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-30 23:00 +0100
[PATCH 22/34] mips: define __smp_xxx "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-30 23:00 +0100
[PATCH 24/34] sh: define __smp_xxx, fix smp_store_mb for !SMP "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-30 23:00 +0100
[PATCH 27/34] xtensa: define __smp_xxx "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-30 23:00 +0100
[PATCH 25/34] sparc: define __smp_xxx "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-30 23:00 +0100
[PATCH 19/34] blackfin: define __smp_xxx "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-30 23:00 +0100
[PATCH 32/34] xen/io: use __smp_xxx barriers "Michael S. Tsirkin" <mst@redhat.com> - 2015-12-30 23:00 +0100
csiph-web