[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/5] Improve transmitter disable.


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Martin Harvey <Martin.Harvey@xxxxxxxxxx>
  • Date: Wed, 28 Jul 2021 15:02:43 +0100
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Martin Harvey <Martin.Harvey@xxxxxxxxxx>, Martin Harvey <martin.harvey@xxxxxxxxxx>
  • Delivery-date: Wed, 28 Jul 2021 14:03:55 +0000
  • Ironport-hdrordr: A9a23:0H0dsawUQPTzPbgB2bh1KrPwIr1zdoMgy1knxilNoRw8SK2lfq eV7ZMmPH7P+U8ssR4b6LO90cW7Lk80lqQFhbX5X43SPjUO0VHAROoJgOffKlXbakvDH4VmtZ uIHZIRNDSJNykesfrH
  • Ironport-sdr: WvAllFXzd+B1MrjVG1zHRsbZa5H/rlXsanYJpXkWkJC1hck/m74YMAT71mJ6ivYqUp5Xxi6TTS +L99yY2rck5SWtrQiYozdD5/3B6FldrGxegRbrceFuFIzHR/qKcAnMFwC7s2GTh//6tlINyJZO p8s2mAdy0kDJ+GYq+hDhx7ViPIOdWu/lGhtFzADbmYEb+VeGUsi+qPMND1ZhCdr2tzIoosvoc5 f/1UFrMa8h/7rYg0i8WOtof8x5Kacegae1ywSUsyA/9aGqdBWpX18t5j3mnqmDVJ41bGok/RW3 Y8bv2p56K+5jBSgHTtQVz/7V
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

In some cases, the backend may stop processing Tx ring
requests in a timely manner. If this happens at the same time as ring
disable, then the Tx code could spin forever at dispatch IRQL.

This patch introduces a hard limit on how long the code will spin,
allowing a device disable or power transition to complete, albeit
at the cost of Tx requests being dropped or the ring being in
an indeterminate state. This has normally been seen at guest shutdown
where final ring state is of little consequence.

Signed-off-by: Martin Harvey <martin.harvey@xxxxxxxxxx>
---
 src/xenvif/transmitter.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/xenvif/transmitter.c b/src/xenvif/transmitter.c
index f6935a6..fddeb0c 100644
--- a/src/xenvif/transmitter.c
+++ b/src/xenvif/transmitter.c
@@ -3988,21 +3988,25 @@ __TransmitterRingDisable(
     ASSERT3U(Ring->RequestsPushed, ==, Ring->RequestsPosted);
     while (Ring->ResponsesProcessed != Ring->RequestsPushed) {
         Attempt++;
-        ASSERT(Attempt < 100);
+
+        KeStallExecutionProcessor(1000);    // 1ms
 
         // Try to move things along
         __TransmitterRingSend(Ring);
         (VOID) TransmitterRingPoll(Ring);
 
-        if (State != XenbusStateConnected)
-            __TransmitterRingFakeResponses(Ring);
+        if ((Attempt >= 100) || (State != XenbusStateConnected))
+            break;
 
         // We are waiting for a watch event at DISPATCH_LEVEL so
         // it is our responsibility to poll the store ring.
         XENBUS_STORE(Poll,
                      &Transmitter->StoreInterface);
-
-        KeStallExecutionProcessor(1000);    // 1ms
+    }
+    if (Ring->ResponsesProcessed != Ring->RequestsPushed)
+    {
+        __TransmitterRingFakeResponses(Ring);
+        (VOID) TransmitterRingPoll(Ring);
     }
 
     Ring->Enabled = FALSE;
-- 
2.25.0.windows.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.