From 03dd464296cbcbc0fcf185d3fe54b00e0e50c385 Mon Sep 17 00:00:00 2001 From: Paul Durrant Date: Wed, 18 May 2016 16:23:51 +0100 Subject: [PATCH] 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 --- src/xenvif/transmitter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); } -- 2.39.5