[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH] Avoid making hypercalls in the SyncWorker DPC



The code has to run with interrupts disabled on all CPUs apart from 0 to
corale them across a suspend/resume. Making hypercalls from within that
code is thus incompatible with re-populating the hypercall table on resume
since it transpites then Xen writes each byte in the page to 0xcc (int 3)
before actually setting up the hypercall thunks. The only hypercall that the
code was actually making was a SCHEDOP_yield and this is trivially replaced
by an _mm_pause intrinsic which calls through to SCHEDOP_yield in the
VMEXIT handler.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/xenbus/sync.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/xenbus/sync.c b/src/xenbus/sync.c
index 41ecbf9..78b5bef 100644
--- a/src/xenbus/sync.c
+++ b/src/xenbus/sync.c
@@ -151,7 +151,7 @@ SyncWorker(
             break;
 
         if (SyncContext.DisableInterrupts[Cpu] == InterruptsDisabled) {
-            SchedYield();
+            _mm_pause();
             KeMemoryBarrier();
 
             continue;
@@ -171,7 +171,7 @@ SyncWorker(
             Attempts = 0;
             while (SyncContext.Sequence == Sequence &&
                    SyncContext.CompletionCount < CpuCount) {
-                SchedYield();
+                _mm_pause();
                 KeMemoryBarrier();
 
                 if (++Attempts > 1000) {
@@ -213,7 +213,7 @@ SyncWorker(
 
             while (SyncContext.Sequence == Sequence &&
                    SyncContext.CompletionCount < CpuCount) {
-                SchedYield();
+                _mm_pause();
                 KeMemoryBarrier();
             }
 
@@ -268,7 +268,7 @@ SyncCapture(
     InterlockedIncrement(&SyncContext.CompletionCount);
 
     while (SyncContext.CompletionCount < CpuCount) {
-        SchedYield();
+        _mm_pause();
         KeMemoryBarrier();
     }
 
@@ -305,7 +305,7 @@ again:
 
     Attempts = 0;
     while (SyncContext.CompletionCount < CpuCount) {
-        SchedYield();
+        _mm_pause();
         KeMemoryBarrier();
 
         if (++Attempts > 1000) {
@@ -366,7 +366,7 @@ SyncEnableInterrupts(
     InterlockedIncrement(&SyncContext.CompletionCount);
 
     while (SyncContext.CompletionCount < CpuCount) {
-        SchedYield();
+        _mm_pause();
         KeMemoryBarrier();
     }
 
@@ -400,7 +400,7 @@ SyncRelease(
     InterlockedIncrement(&SyncContext.CompletionCount);
 
     while (SyncContext.CompletionCount < CpuCount) {
-        SchedYield();
+        _mm_pause();
         KeMemoryBarrier();
     }
 
-- 
2.1.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.