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

[PATCH xenbus 02/11] Remove 'Sequence' from SYNC_CONTEXT



From: Paul Durrant <pdurrant@xxxxxxxxxx>

It is not actually needed because enable/disable interrupt operations will
always wait indefinitely.

Signed-off-by: Paul Durrant <pdurrant@xxxxxxxxxx>
---
 src/xenbus/sync.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/src/xenbus/sync.c b/src/xenbus/sync.c
index 615eca84c460..c2ef681501d1 100644
--- a/src/xenbus/sync.c
+++ b/src/xenbus/sync.c
@@ -89,7 +89,6 @@ typedef struct  _SYNC_CONTEXT {
     PVOID               Argument;
     SYNC_CALLBACK       Early;
     SYNC_CALLBACK       Late;
-    ULONG               Sequence;
     LONG                ProcessorCount;
     LONG                CompletionCount;
     SYNC_PROCESSOR      Processor[1];
@@ -160,8 +159,6 @@ SyncWorker(
     InterlockedIncrement(&Context->CompletionCount);
 
     for (;;) {
-        ULONG   Sequence;
-
         if (Processor->Exit) {
             if (Context->Late != NULL)
                 Context->Late(Context->Argument, Index);
@@ -176,8 +173,6 @@ SyncWorker(
             continue;
         }
 
-        Sequence = Context->Sequence;
-
         if (Processor->DisableInterrupts) {
             ULONG       Attempts;
             NTSTATUS    status;
@@ -188,8 +183,7 @@ SyncWorker(
             InterlockedIncrement(&Context->CompletionCount);
 
             Attempts = 0;
-            while (Context->Sequence == Sequence &&
-                   Context->CompletionCount < Context->ProcessorCount) {
+            while (Context->CompletionCount < Context->ProcessorCount) {
                 _mm_pause();
                 KeMemoryBarrier();
 
@@ -233,8 +227,7 @@ SyncWorker(
 
             InterlockedIncrement(&Context->CompletionCount);
 
-            while (Context->Sequence == Sequence &&
-                   Context->CompletionCount < Context->ProcessorCount) {
+            while (Context->CompletionCount < Context->ProcessorCount) {
                 _mm_pause();
                 KeMemoryBarrier();
             }
@@ -279,8 +272,8 @@ SyncCapture(
     Context->Early = Early;
     Context->Late = Late;
 
-    Context->Sequence++;
     Context->CompletionCount = 0;
+    KeMemoryBarrier();
 
     Context->ProcessorCount = 
KeQueryActiveProcessorCountEx(ALL_PROCESSOR_GROUPS);
 
@@ -328,8 +321,8 @@ SyncDisableInterrupts(
 
     ASSERT(SyncOwner >= 0);
 
-    Context->Sequence++;
     Context->CompletionCount = 0;
+    KeMemoryBarrier();
 
     for (Index = 0; Index < Context->ProcessorCount; Index++) {
         PSYNC_PROCESSOR Processor = &Context->Processor[Index];
@@ -402,8 +395,8 @@ SyncEnableInterrupts(
     Irql = KeGetCurrentIrql();
     ASSERT3U(Irql, ==, HIGH_LEVEL);
 
-    Context->Sequence++;
     Context->CompletionCount = 0;
+    KeMemoryBarrier();
 
     for (Index = 0; Index < Context->ProcessorCount; Index++) {
         PSYNC_PROCESSOR Processor = &Context->Processor[Index];
@@ -443,8 +436,8 @@ SyncRelease(
     if (Context->Late != NULL)
         Context->Late(Context->Argument, SyncOwner);
 
-    Context->Sequence++;
     Context->CompletionCount = 0;
+    KeMemoryBarrier();
 
     for (Index = 0; Index < Context->ProcessorCount; Index++) {
         PSYNC_PROCESSOR Processor = &Context->Processor[Index];
-- 
2.17.1




 


Rackspace

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