]> xenbits.xensource.com Git - people/pauldu/xenvif.git/commitdiff
Avoid transmitting on the wrong CPU
authorPaul Durrant <paul.durrant@citrix.com>
Wed, 18 May 2016 15:23:51 +0000 (16:23 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Mon, 18 Jul 2016 12:43:33 +0000 (13:43 +0100)
The transmit and receive rings have DPCs and event channels affinitized
to a particular CPU. Thus, when XENNET queues a new packet at the
transmit side, make sure the packet is prepared and posted from the
CPU to which the DPC and event channel are bound to avoid lock contention.

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

index 19636b31859f05678a1a1fd5b6fd6658faea7032..95c34799626782dbc81f9aab48e5f89ed1069895 100644 (file)
@@ -4007,7 +4007,9 @@ __TransmitterRingQueuePacket(
     // grab it then that's ok because whichever thread is holding it will have to call
     // __TransmitterRingReleaseLock() and will therefore drain the atomic packet list.
 
-    if (__TransmitterRingTryAcquireLock(Ring))
+    if (Ring->Index != KeGetCurrentProcessorNumberEx(NULL))
+        KeInsertQueueDpc(&Ring->Dpc, NULL, NULL);
+    else if (__TransmitterRingTryAcquireLock(Ring))
         __TransmitterRingReleaseLock(Ring);
 }