|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] Revert to KeMemoryBarrier() as poll loop barriers
312f9fa760bf ("ring: Weaken and delete unnecessary barriers") attempted
to replace barriers in BlkifRingPoll with their xen_mb/rmb/wmb
equivalents. Part of this involved replacing the full barrier at the end
of each poll loop with a "release barrier" consisting of xen_rmb +
xen_wmb.
This is fine on x86 since each store has release ordering. However, this
is incorrect in the Linux memory model, as rmb/wmb (and their smp_
equivalents) did not guarantee relative ordering of loads and subsequent
stores, unlike a release operation. Therefore, without specializing for
each architecture, a release barrier in this model would require a full
memory barrier (i.e. mb()).
Inconveniently, WDK doesn't provide a release barrier nor a release
store. I couldn't measure a performance difference from 312f9fa760bf in
my limited testing, so revert the change.
Fixes: 312f9fa760bf ("ring: Weaken and delete unnecessary barriers")
Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
src/xenvbd/ring.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/xenvbd/ring.c b/src/xenvbd/ring.c
index 10ca6ee..d05dfc3 100644
--- a/src/xenvbd/ring.c
+++ b/src/xenvbd/ring.c
@@ -1228,7 +1228,7 @@ BlkifRingPoll(
RING_IDX rsp_prod;
RING_IDX rsp_cons;
- xen_mb();
+ KeMemoryBarrier();
rsp_prod = BlkifRing->Shared->rsp_prod;
rsp_cons = BlkifRing->Front.rsp_cons;
@@ -1236,7 +1236,7 @@ BlkifRingPoll(
if (rsp_cons == rsp_prod || Retry)
break;
- xen_rmb();
+ KeMemoryBarrier();
while (rsp_cons != rsp_prod && !Retry) {
blkif_response_t *rsp;
@@ -1260,8 +1260,7 @@ BlkifRingPoll(
Retry = TRUE;
}
- xen_rmb();
- xen_wmb();
+ KeMemoryBarrier();
BlkifRing->Front.rsp_cons = rsp_cons;
BlkifRing->Shared->rsp_event = rsp_cons + 1;
--
2.54.0.windows.1
--
Ngoc Tu Dinh | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |