]> xenbits.xensource.com Git - pvdrivers/win/xenbus.git/commitdiff
Simplify EVTCHN Unmask
authorPaul Durrant <paul.durrant@citrix.com>
Mon, 26 Jan 2015 16:10:31 +0000 (16:10 +0000)
committerPaul Durrant <paul.durrant@citrix.com>
Tue, 27 Jan 2015 16:12:55 +0000 (16:12 +0000)
Just use the hypercall if the event channel is pending. It's a lot safer
than trying to avoid it.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/xenbus/evtchn.c

index 453f9d606360541783368970a5f0ed85bb5fc3e9..e33a68effe6b9aff85ad3eadf56c268719ede60b 100644 (file)
@@ -493,9 +493,7 @@ EvtchnUnmask(
 {
     PXENBUS_EVTCHN_CONTEXT      Context = Interface->Context;
     KIRQL                       Irql = PASSIVE_LEVEL;
-    BOOLEAN                     Pending;
     ULONG                       LocalPort;
-    ULONG                       Cpu;
 
     ASSERT3U(Channel->Magic, ==, XENBUS_EVTCHN_CHANNEL_MAGIC);
 
@@ -504,59 +502,21 @@ EvtchnUnmask(
 
     ASSERT3U(KeGetCurrentIrql(), >=, DISPATCH_LEVEL);
 
-    Pending = FALSE;
-
     if (!Channel->Active)
         goto done;
 
     LocalPort = Channel->LocalPort;
 
-    Pending = XENBUS_EVTCHN_ABI(PortUnmask,
-                                &Context->EvtchnAbi,
-                                LocalPort);
-
-    if (!Pending)
-        goto done;
-
-    //
-    // If we are in context of the upcall then use a hypercall
-    // to schedule the pending event.
-    //
-    if (InUpcall) {
-        (VOID) EventChannelUnmask(LocalPort);
-
-        Pending = FALSE;
-        goto done;
-    }
-
-    //
-    // If we are not unmasking on the same CPU to which the
-    // event channel is bound, then we need to use a hypercall
-    // to schedule the upcall on the correct CPU.
-    //
-    Cpu = KeGetCurrentProcessorNumber();
-
-    if (Channel->Cpu != Cpu) {
-        (VOID) EventChannelUnmask(LocalPort);
-
-        Pending = FALSE;
-        goto done;
-    }
-
-    if (Channel->Mask)
-        XENBUS_EVTCHN_ABI(PortMask,
+    if (XENBUS_EVTCHN_ABI(PortUnmask,
                           &Context->EvtchnAbi,
-                          LocalPort);
-
-    XENBUS_EVTCHN_ABI(PortAck,
-                      &Context->EvtchnAbi,
-                      LocalPort);
+                          LocalPort))
+        (VOID) EventChannelUnmask(LocalPort);
 
 done:
     if (!InUpcall)
         KeReleaseSpinLock(&Channel->Lock, Irql);
 
-    return Pending;
+    return FALSE;
 }
 
 static NTSTATUS