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

[win-pv-devel] [PATCH 3/3] Make use of possible XENBUS_EVTCHN Unmask failure



Bump up to the latest version of XENBUS_EVTCHN and specify the option
to Unmask that allows it to fail. In this circumstance it is possible to
avoid dropping out of the DPC and thus avoid a context switch and re-queue.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 include/evtchn_interface.h | 42 +++++++++++++++++++++++++++++++++++-------
 src/xenvif.inf             |  6 +++---
 src/xenvif/controller.c    |  9 +++++----
 src/xenvif/poller.c        | 25 ++++++++++++++++---------
 4 files changed, 59 insertions(+), 23 deletions(-)

diff --git a/include/evtchn_interface.h b/include/evtchn_interface.h
index 310850b..068a697 100644
--- a/include/evtchn_interface.h
+++ b/include/evtchn_interface.h
@@ -128,18 +128,27 @@ typedef NTSTATUS
     IN  UCHAR                   Number
     );
 
+typedef VOID
+(*XENBUS_EVTCHN_UNMASK_V4)(
+    IN  PINTERFACE              Interface,
+    IN  PXENBUS_EVTCHN_CHANNEL  Channel,
+    IN  BOOLEAN                 InCallback
+    );
+
 /*! \typedef XENBUS_EVTCHN_UNMASK
     \brief Unmask an event channel
 
     \param Interface The interface header
     \param Channel The channel handle
     \param InCallback Set to TRUE if this method is invoked in context of the 
channel callback
+    \param Force Set to TRUE if the unmask must succeed, otherwise set to 
FALSE and the function will return FALSE if the unmask did not complete.
 */
-typedef VOID
+typedef BOOLEAN
 (*XENBUS_EVTCHN_UNMASK)(
     IN  PINTERFACE              Interface,
     IN  PXENBUS_EVTCHN_CHANNEL  Channel,
-    IN  BOOLEAN                 InCallback
+    IN  BOOLEAN                 InCallback,
+    IN  BOOLEAN                 Force
     );
 
 typedef VOID
@@ -250,7 +259,7 @@ struct _XENBUS_EVTCHN_INTERFACE_V4 {
     XENBUS_EVTCHN_RELEASE   EvtchnRelease;
     XENBUS_EVTCHN_OPEN      EvtchnOpen;
     XENBUS_EVTCHN_BIND      EvtchnBind;
-    XENBUS_EVTCHN_UNMASK    EvtchnUnmask;
+    XENBUS_EVTCHN_UNMASK_V4 EvtchnUnmaskVersion4;
     XENBUS_EVTCHN_SEND_V1   EvtchnSendVersion1;
     XENBUS_EVTCHN_TRIGGER   EvtchnTrigger;
     XENBUS_EVTCHN_GET_PORT  EvtchnGetPort;
@@ -267,7 +276,7 @@ struct _XENBUS_EVTCHN_INTERFACE_V5 {
     XENBUS_EVTCHN_RELEASE   EvtchnRelease;
     XENBUS_EVTCHN_OPEN      EvtchnOpen;
     XENBUS_EVTCHN_BIND      EvtchnBind;
-    XENBUS_EVTCHN_UNMASK    EvtchnUnmask;
+    XENBUS_EVTCHN_UNMASK_V4 EvtchnUnmaskVersion4;
     XENBUS_EVTCHN_SEND_V1   EvtchnSendVersion1;
     XENBUS_EVTCHN_TRIGGER   EvtchnTrigger;
     XENBUS_EVTCHN_WAIT_V5   EvtchnWaitVersion5;
@@ -285,7 +294,7 @@ struct _XENBUS_EVTCHN_INTERFACE_V6 {
     XENBUS_EVTCHN_RELEASE   EvtchnRelease;
     XENBUS_EVTCHN_OPEN      EvtchnOpen;
     XENBUS_EVTCHN_BIND      EvtchnBind;
-    XENBUS_EVTCHN_UNMASK    EvtchnUnmask;
+    XENBUS_EVTCHN_UNMASK_V4 EvtchnUnmaskVersion4;
     XENBUS_EVTCHN_SEND      EvtchnSend;
     XENBUS_EVTCHN_TRIGGER   EvtchnTrigger;
     XENBUS_EVTCHN_WAIT_V5   EvtchnWaitVersion5;
@@ -303,6 +312,25 @@ struct _XENBUS_EVTCHN_INTERFACE_V7 {
     XENBUS_EVTCHN_RELEASE   EvtchnRelease;
     XENBUS_EVTCHN_OPEN      EvtchnOpen;
     XENBUS_EVTCHN_BIND      EvtchnBind;
+    XENBUS_EVTCHN_UNMASK_V4 EvtchnUnmaskVersion4;
+    XENBUS_EVTCHN_SEND      EvtchnSend;
+    XENBUS_EVTCHN_TRIGGER   EvtchnTrigger;
+    XENBUS_EVTCHN_GET_COUNT EvtchnGetCount;
+    XENBUS_EVTCHN_WAIT      EvtchnWait;
+    XENBUS_EVTCHN_GET_PORT  EvtchnGetPort;
+    XENBUS_EVTCHN_CLOSE     EvtchnClose;
+};
+
+/*! \struct _XENBUS_EVTCHN_INTERFACE_V8
+    \brief EVTCHN interface version 8
+    \ingroup interfaces
+*/
+struct _XENBUS_EVTCHN_INTERFACE_V8 {
+    INTERFACE               Interface;
+    XENBUS_EVTCHN_ACQUIRE   EvtchnAcquire;
+    XENBUS_EVTCHN_RELEASE   EvtchnRelease;
+    XENBUS_EVTCHN_OPEN      EvtchnOpen;
+    XENBUS_EVTCHN_BIND      EvtchnBind;
     XENBUS_EVTCHN_UNMASK    EvtchnUnmask;
     XENBUS_EVTCHN_SEND      EvtchnSend;
     XENBUS_EVTCHN_TRIGGER   EvtchnTrigger;
@@ -312,7 +340,7 @@ struct _XENBUS_EVTCHN_INTERFACE_V7 {
     XENBUS_EVTCHN_CLOSE     EvtchnClose;
 };
 
-typedef struct _XENBUS_EVTCHN_INTERFACE_V7 XENBUS_EVTCHN_INTERFACE, 
*PXENBUS_EVTCHN_INTERFACE;
+typedef struct _XENBUS_EVTCHN_INTERFACE_V8 XENBUS_EVTCHN_INTERFACE, 
*PXENBUS_EVTCHN_INTERFACE;
 
 /*! \def XENBUS_EVTCHN
     \brief Macro at assist in method invocation
@@ -323,7 +351,7 @@ typedef struct _XENBUS_EVTCHN_INTERFACE_V7 
XENBUS_EVTCHN_INTERFACE, *PXENBUS_EVT
 #endif  // _WINDLL
 
 #define XENBUS_EVTCHN_INTERFACE_VERSION_MIN 4
-#define XENBUS_EVTCHN_INTERFACE_VERSION_MAX 7
+#define XENBUS_EVTCHN_INTERFACE_VERSION_MAX 8
 
 #endif  // _XENBUS_EVTCHN_INTERFACE_H
 
diff --git a/src/xenvif.inf b/src/xenvif.inf
index bc4e555..ef4e9bc 100644
--- a/src/xenvif.inf
+++ b/src/xenvif.inf
@@ -59,9 +59,9 @@ 
xenvif_coinst_@MAJOR_VERSION@_@MINOR_VERSION@_@MICRO_VERSION@_@BUILD_NUMBER@.dll
 ; DisplayName          Section         DeviceID
 ; -----------          -------         --------
 
-%XenVifName%           =XenVif_Inst,   
XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_VIF&REV_09000002
-%XenVifName%           =XenVif_Inst,   
XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_VIF&REV_09000002
-%XenVifName%           =XenVif_Inst,   
XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_VIF&REV_09000002
+%XenVifName%           =XenVif_Inst,   
XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_VIF&REV_09000003
+%XenVifName%           =XenVif_Inst,   
XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_VIF&REV_09000003
+%XenVifName%           =XenVif_Inst,   
XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_VIF&REV_09000003
 
 [XenVif_Inst] 
 CopyFiles=XenVif_Copyfiles
diff --git a/src/xenvif/controller.c b/src/xenvif/controller.c
index 629b6b7..004bccb 100644
--- a/src/xenvif/controller.c
+++ b/src/xenvif/controller.c
@@ -502,10 +502,11 @@ ControllerConnect(
     if (Controller->Channel == NULL)
         goto fail9;
 
-    XENBUS_EVTCHN(Unmask,
-                  &Controller->EvtchnInterface,
-                  Controller->Channel,
-                  FALSE);
+    (VOID) XENBUS_EVTCHN(Unmask,
+                         &Controller->EvtchnInterface,
+                         Controller->Channel,
+                         FALSE,
+                         TRUE);
 
     status = XENBUS_DEBUG(Register,
                           &Controller->DebugInterface,
diff --git a/src/xenvif/poller.c b/src/xenvif/poller.c
index 7b60022..3706cab 100644
--- a/src/xenvif/poller.c
+++ b/src/xenvif/poller.c
@@ -330,10 +330,11 @@ PollerChannelConnect(
                          ProcNumber.Group,
                          ProcNumber.Number);
 
-    XENBUS_EVTCHN(Unmask,
-                  &Poller->EvtchnInterface,
-                  Channel->Channel,
-                  FALSE);
+    (VOID) XENBUS_EVTCHN(Unmask,
+                         &Poller->EvtchnInterface,
+                         Channel->Channel,
+                         FALSE,
+                         TRUE);
 
 done:
     return STATUS_SUCCESS;
@@ -391,6 +392,7 @@ PollerChannelUnmask(
 {
     PXENVIF_POLLER_INSTANCE     Instance;
     PXENVIF_POLLER              Poller;
+    BOOLEAN                     Pending;
 
     Instance = Channel->Instance;
     Poller = Instance->Poller;
@@ -398,11 +400,16 @@ PollerChannelUnmask(
     if (Channel->Channel == NULL)
         return;
 
-    if (!PollerChannelTestPending(Channel))
-        XENBUS_EVTCHN(Unmask,
-                      &Poller->EvtchnInterface,
-                      Channel->Channel,
-                      FALSE);
+    if (PollerChannelTestPending(Channel))
+        return;
+
+    Pending = XENBUS_EVTCHN(Unmask,
+                            &Poller->EvtchnInterface,
+                            Channel->Channel,
+                            FALSE,
+                            FALSE);
+    if (Pending)
+        PollerChannelSetPending(Channel);
 }
 
 static VOID
-- 
2.5.3


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://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®.