]> xenbits.xensource.com Git - people/pauldu/xenvif.git/commitdiff
Remove watchdog affinitisation on Windows 2008
authorBen Chalmers <Ben.Chalmers@citrix.com>
Wed, 28 Sep 2016 15:05:34 +0000 (16:05 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Wed, 28 Sep 2016 15:07:01 +0000 (16:07 +0100)
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 <ben.chalmers@citrix.com>
src/xenvif/receiver.c
src/xenvif/transmitter.c
vs2012/xenvif/xenvif.vcxproj
vs2013/xenvif/xenvif.vcxproj

index 76c4e0c5060ee9431dc0295a71c58bdd66766cb4..07fa642451c83ac7a5557833390a3175dd522d48 100644 (file)
@@ -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));
 
index fae7b1b12dbcf9b63d7e3d2eeffeca164d47352c..1fbe766ae5188e7a5668f083dd8f5839dd3d22ea 100644 (file)
@@ -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));
+    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);
+        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;
index 170ab53120d70b0fbf9e94a30ddb188d7ae93f0b..2271bd7e904793eec719682cea279e5442e59302 100644 (file)
@@ -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>
index 9d1dba3641944f0676fbeac9684e147edd63d347..ed72de22e46d8ccf298c1ca35c6f3d7aeed4b2bd 100644 (file)
@@ -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>