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

[win-pv-devel] [PATCH] Remove watchdog affinitisation on Windows 2008



From: Ben Chalmers <Ben.Chalmers@xxxxxxxxxx>

Despite the presence of a compatability library, the
Windows 2008 calls to affinitise the watchdog thread
to a particular processor group are leading to lockups.

So detect if we are running on a version prior to
Windows 7 (or 2008 R2), and don't try to affinitise if
we are.

Signed-off-by: Ben.Chalmers@xxxxxxxxxx
---
 src/xenvif/receiver.c        | 24 ++++++++++++++----------
 src/xenvif/transmitter.c     | 24 ++++++++++++++----------
 vs2012/xenvif/xenvif.vcxproj |  2 +-
 vs2013/xenvif/xenvif.vcxproj |  4 ++--
 4 files changed, 31 insertions(+), 23 deletions(-)

diff --git a/src/xenvif/receiver.c b/src/xenvif/receiver.c
index 76c4e0c..07fa642 100644
--- a/src/xenvif/receiver.c
+++ b/src/xenvif/receiver.c
@@ -2282,16 +2282,20 @@ ReceiverRingWatchdog(
 
     Trace("====>\n");
 
-    //
-    // Affinitize this thread to the same CPU as the event channel
-    // and DPC.
-    //
-    status = KeGetProcessorNumberFromIndex(Ring->Index, &ProcNumber);
-    ASSERT(NT_SUCCESS(status));
-
-    Affinity.Group = ProcNumber.Group;
-    Affinity.Mask = (KAFFINITY)1 << ProcNumber.Number;
-    KeSetSystemGroupAffinityThread(&Affinity, NULL);
+    if (RtlIsNtDdiVersionAvailable(NTDDI_WIN7) ) {
+        //
+        // Affinitize this thread to the same CPU as the event channel
+        // and DPC.
+        //
+        // The following functions don't work before Windows 7
+        //
+        status = KeGetProcessorNumberFromIndex(Ring->Index, &ProcNumber);
+        ASSERT(NT_SUCCESS(status));
+
+        Affinity.Group = ProcNumber.Group;
+        Affinity.Mask = (KAFFINITY)1 << ProcNumber.Number;
+        KeSetSystemGroupAffinityThread(&Affinity, NULL);
+    }
 
     Timeout.QuadPart = TIME_RELATIVE(TIME_S(XENVIF_RECEIVER_WATCHDOG_PERIOD));
 
diff --git a/src/xenvif/transmitter.c b/src/xenvif/transmitter.c
index fae7b1b..b196e0a 100644
--- a/src/xenvif/transmitter.c
+++ b/src/xenvif/transmitter.c
@@ -3349,16 +3349,20 @@ TransmitterRingWatchdog(
 
     Trace("====>\n");
 
-    //
-    // Affinitize this thread to the same CPU as the event channel
-    // and DPC.
-    //
-    status = KeGetProcessorNumberFromIndex(Ring->Index, &ProcNumber);
-    ASSERT(NT_SUCCESS(status));
-
-    Affinity.Group = ProcNumber.Group;
-    Affinity.Mask = (KAFFINITY)1 << ProcNumber.Number;
-    KeSetSystemGroupAffinityThread(&Affinity, NULL);
+    if (RtlIsNtDdiVersionAvailable(NTDDI_WIN7) ) {
+        //
+        // Affinitize this thread to the same CPU as the event channel
+        // and DPC.
+        //
+        // The following functions don't work before Windows 7
+        //
+        status = KeGetProcessorNumberFromIndex(Ring->Index, &ProcNumber);
+        ASSERT(NT_SUCCESS(status));
+    
+        Affinity.Group = ProcNumber.Group;
+        Affinity.Mask = (KAFFINITY)1 << ProcNumber.Number;
+        KeSetSystemGroupAffinityThread(&Affinity, NULL);
+    }
 
     Timeout.QuadPart = 
TIME_RELATIVE(TIME_S(XENVIF_TRANSMITTER_WATCHDOG_PERIOD));
     PacketsQueued = 0;
diff --git a/vs2012/xenvif/xenvif.vcxproj b/vs2012/xenvif/xenvif.vcxproj
index 170ab53..2271bd7 100644
--- a/vs2012/xenvif/xenvif.vcxproj
+++ b/vs2012/xenvif/xenvif.vcxproj
@@ -34,7 +34,7 @@
     </ClCompile>
     <Link>
       <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
-      
<AdditionalDependencies>$(DDK_LIB_PATH)/libcntpr.lib;$(DDK_LIB_PATH)/aux_klib.lib;$(DDK_LIB_PATH)/ksecdd.lib;$(DDK_LIB_PATH)/procgrp.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      
<AdditionalDependencies>$(DDK_LIB_PATH)/Rtlver.lib;$(DDK_LIB_PATH)/libcntpr.lib;$(DDK_LIB_PATH)/aux_klib.lib;$(DDK_LIB_PATH)/ksecdd.lib;$(DDK_LIB_PATH)/procgrp.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <EnableCOMDATFolding>false</EnableCOMDATFolding>
     </Link>
     <Inf>
diff --git a/vs2013/xenvif/xenvif.vcxproj b/vs2013/xenvif/xenvif.vcxproj
index 9d1dba3..ed72de2 100644
--- a/vs2013/xenvif/xenvif.vcxproj
+++ b/vs2013/xenvif/xenvif.vcxproj
@@ -37,7 +37,7 @@
     </ResourceCompile>
     <Link>
       <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
-      
<AdditionalDependencies>$(DDK_LIB_PATH)/libcntpr.lib;$(DDK_LIB_PATH)/aux_klib.lib;$(DDK_LIB_PATH)/ksecdd.lib;$(DDK_LIB_PATH)/procgrp.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      
<AdditionalDependencies>$(DDK_LIB_PATH)/Rtlver.lib;$(DDK_LIB_PATH)/libcntpr.lib;$(DDK_LIB_PATH)/aux_klib.lib;$(DDK_LIB_PATH)/ksecdd.lib;$(DDK_LIB_PATH)/procgrp.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <EnableCOMDATFolding>false</EnableCOMDATFolding>
     </Link>
     <Inf>
@@ -96,4 +96,4 @@
     <None Include="..\package\package.vcxproj" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project>
\ No newline at end of file
+</Project>
-- 
2.7.0.windows.1


_______________________________________________
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®.