[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH 1/3] Fix DPC accounting
The DPC count is not zeroed when the event count is zeroed leading to some odd looking stats. Also the DPC count should really be incremented by the DPC itself to ensure serialization. While in the neighbourhood, the ring notify functions in transmitter and receiver look a little superfluous; they can easily be folded directly into the DPC if the receiver code triggers the transmmitter DPC in the case of a combined event channel. Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx> --- src/xenvif/receiver.c | 43 ++++++++++++++++++------------------------- src/xenvif/transmitter.c | 48 +++++++++++++++++++++++++----------------------- 2 files changed, 43 insertions(+), 48 deletions(-) diff --git a/src/xenvif/receiver.c b/src/xenvif/receiver.c index 62ca1c8..29877f2 100644 --- a/src/xenvif/receiver.c +++ b/src/xenvif/receiver.c @@ -1982,16 +1982,6 @@ ReceiverRingPoll( } static FORCEINLINE VOID -__ReceiverRingNotify( - IN PXENVIF_RECEIVER_RING Ring - ) -{ - __ReceiverRingAcquireLock(Ring); - ReceiverRingPoll(Ring); - __ReceiverRingReleaseLock(Ring); -} - -static FORCEINLINE VOID __ReceiverRingUnmask( IN PXENVIF_RECEIVER_RING Ring ) @@ -2023,8 +2013,6 @@ ReceiverRingDpc( ) { PXENVIF_RECEIVER_RING Ring = Context; - PXENVIF_RECEIVER Receiver; - PXENVIF_FRONTEND Frontend; UNREFERENCED_PARAMETER(Dpc); UNREFERENCED_PARAMETER(Argument1); @@ -2032,16 +2020,14 @@ ReceiverRingDpc( ASSERT(Ring != NULL); - Receiver = Ring->Receiver; - Frontend = Receiver->Frontend; + Ring->Dpcs++; - if (Ring->Enabled) { - __ReceiverRingNotify(Ring); - if (!FrontendIsSplit(Frontend)) - TransmitterNotify(FrontendGetTransmitter(Frontend), - Ring->Index); - } + __ReceiverRingAcquireLock(Ring); + + if (Ring->Enabled) + ReceiverRingPoll(Ring); + __ReceiverRingReleaseLock(Ring); __ReceiverRingUnmask(Ring); } @@ -2054,6 +2040,8 @@ ReceiverRingEvtchnCallback( ) { PXENVIF_RECEIVER_RING Ring = Argument; + PXENVIF_RECEIVER Receiver; + PXENVIF_FRONTEND Frontend; UNREFERENCED_PARAMETER(InterruptObject); @@ -2061,8 +2049,14 @@ ReceiverRingEvtchnCallback( Ring->Events++; - if (KeInsertQueueDpc(&Ring->Dpc, NULL, NULL)) - Ring->Dpcs++; + (VOID) KeInsertQueueDpc(&Ring->Dpc, NULL, NULL); + + Receiver = Ring->Receiver; + Frontend = Receiver->Frontend; + + if (!FrontendIsSplit(Frontend)) + TransmitterNotify(FrontendGetTransmitter(Frontend), + Ring->Index); return TRUE; } @@ -2529,8 +2523,7 @@ __ReceiverRingEnable( Ring->Enabled = TRUE; - if (KeInsertQueueDpc(&Ring->Dpc, NULL, NULL)) - Ring->Dpcs++; + (VOID) KeInsertQueueDpc(&Ring->Dpc, NULL, NULL); __ReceiverRingReleaseLock(Ring); @@ -2581,6 +2574,7 @@ __ReceiverRingDisconnect( Ring->Channel = NULL; Ring->Events = 0; + Ring->Dpcs = 0; ASSERT3U(Ring->ResponsesProcessed, ==, Ring->RequestsPushed); ASSERT3U(Ring->RequestsPushed, ==, Ring->RequestsPosted); @@ -2635,7 +2629,6 @@ __ReceiverRingTeardown( Receiver = Ring->Receiver; Frontend = Receiver->Frontend; - Ring->Dpcs = 0; RtlZeroMemory(&Ring->Dpc, sizeof (KDPC)); Ring->BackfillSize = 0; diff --git a/src/xenvif/transmitter.c b/src/xenvif/transmitter.c index f6766ce..fdb1334 100644 --- a/src/xenvif/transmitter.c +++ b/src/xenvif/transmitter.c @@ -2913,16 +2913,6 @@ TransmitterRingReleaseLock( } static FORCEINLINE VOID -__TransmitterRingNotify( - IN PXENVIF_TRANSMITTER_RING Ring - ) -{ - __TransmitterRingAcquireLock(Ring); - TransmitterRingPoll(Ring); - __TransmitterRingReleaseLock(Ring); -} - -static FORCEINLINE VOID __TransmitterRingUnmask( IN PXENVIF_TRANSMITTER_RING Ring ) @@ -2954,7 +2944,6 @@ TransmitterRingDpc( ) { PXENVIF_TRANSMITTER_RING Ring = Context; - PXENVIF_TRANSMITTER Transmitter; UNREFERENCED_PARAMETER(Dpc); UNREFERENCED_PARAMETER(Argument1); @@ -2962,11 +2951,14 @@ TransmitterRingDpc( ASSERT(Ring != NULL); - Transmitter = Ring->Transmitter; + Ring->Dpcs++; + + __TransmitterRingAcquireLock(Ring); if (Ring->Enabled) - __TransmitterRingNotify(Ring); + TransmitterRingPoll(Ring); + __TransmitterRingReleaseLock(Ring); __TransmitterRingUnmask(Ring); } @@ -2980,17 +2972,20 @@ TransmitterRingEvtchnCallback( { PXENVIF_TRANSMITTER_RING Ring = Argument; PXENVIF_TRANSMITTER Transmitter; + PXENVIF_FRONTEND Frontend; UNREFERENCED_PARAMETER(InterruptObject); ASSERT(Ring != NULL); Transmitter = Ring->Transmitter; + Frontend = Transmitter->Frontend; + + ASSERT(FrontendIsSplit(Frontend)); Ring->Events++; - if (KeInsertQueueDpc(&Ring->Dpc, NULL, NULL)) - Ring->Dpcs++; + (VOID) KeInsertQueueDpc(&Ring->Dpc, NULL, NULL); return TRUE; } @@ -3565,9 +3560,8 @@ __TransmitterRingEnable( ASSERT(!Ring->Enabled); Ring->Enabled = TRUE; - if (FrontendIsSplit(Frontend) && - KeInsertQueueDpc(&Ring->Dpc, NULL, NULL)) - Ring->Dpcs++; + if (FrontendIsSplit(Frontend)) + KeInsertQueueDpc(&Ring->Dpc, NULL, NULL); __TransmitterRingReleaseLock(Ring); @@ -3681,6 +3675,8 @@ __TransmitterRingDisconnect( Ring->Events = 0; } + Ring->Dpcs = 0; + ASSERT3U(Ring->ResponsesProcessed, ==, Ring->RequestsPushed); ASSERT3U(Ring->RequestsPushed, ==, Ring->RequestsPosted); @@ -3755,7 +3751,6 @@ __TransmitterRingTeardown( Transmitter = Ring->Transmitter; Frontend = Transmitter->Frontend; - Ring->Dpcs = 0; RtlZeroMemory(&Ring->Dpc, sizeof (KDPC)); ASSERT3U(Ring->PacketsCompleted, ==, Ring->PacketsSent); @@ -4568,16 +4563,18 @@ __TransmitterHashPacket( PIP_HEADER IpHeader; ULONG Value; - Value = 0; - StartVa = Packet->Header; Info = &Packet->Info; - if (Info->IpHeader.Length == 0) + if (Info->IpHeader.Length == 0) { + Value = KeGetCurrentProcessorNumberEx(NULL); goto done; + } IpHeader = (PIP_HEADER)(StartVa + Info->IpHeader.Offset); + Value = 0; + if (IpHeader->Version == 4) { PIPV4_HEADER Version4 = &IpHeader->Version4; @@ -4781,11 +4778,16 @@ TransmitterNotify( IN ULONG Index ) { + PXENVIF_FRONTEND Frontend; PXENVIF_TRANSMITTER_RING Ring; + Frontend = Transmitter->Frontend; + + ASSERT(!FrontendIsSplit(Frontend)); + Ring = Transmitter->Ring[Index]; - __TransmitterRingNotify(Ring); + (VOID) KeInsertQueueDpc(&Ring->Dpc, NULL, NULL); } VOID -- 2.1.1 _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |