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

Re: [PATCH 1/5] Improve transmitter disable.


  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Paul Durrant <xadimgnik@xxxxxxxxx>
  • Date: Thu, 5 Aug 2021 19:16:25 +0100
  • Delivery-date: Thu, 05 Aug 2021 18:16:30 +0000
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

On 28/07/2021 15:02, Martin Harvey wrote:
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>

Acked-by: Paul Durrant <paul@xxxxxxx>

---
  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;





 


Rackspace

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