From: Paul Durrant Date: Wed, 18 May 2016 15:23:51 +0000 (+0100) Subject: Avoid transmitting on the wrong CPU X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=03dd4642;p=people%2Fpauldu%2Fxenvif.git Avoid transmitting on the wrong CPU 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 --- diff --git a/src/xenvif/transmitter.c b/src/xenvif/transmitter.c index 19636b3..95c3479 100644 --- a/src/xenvif/transmitter.c +++ b/src/xenvif/transmitter.c @@ -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); }