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

[PATCH 3/3] Avoid requeuing QueueDpc during ring swizzles


  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
  • Date: Sat, 11 Jul 2026 13:52:35 +0200
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
  • Cc: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
  • Delivery-date: Sat, 11 Jul 2026 11:52:49 +0000
  • Feedback-id: default:8631fc262581453bbf619ec5b2062170:Sweego
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

If a ring is paused by xennet, __ReceiverRingSwizzle immediately queues
another QueueDpc. In low-resource conditions where NDIS is unable to
process traffic, this will cause an infinite cascade of DPCs and lock up
the system.

Stop doing that in __ReceiverRingSwizzle. Instead, requeue QueueDpc from
ReceiverReturnPacket after incrementing Receiver->Returned to reevaluate
the paused status. This ensures that incoming traffic storms can be
safely handled.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
 src/xenvif/receiver.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/xenvif/receiver.c b/src/xenvif/receiver.c
index 29bd325..95a4f5c 100644
--- a/src/xenvif/receiver.c
+++ b/src/xenvif/receiver.c
@@ -1560,11 +1560,12 @@ __ReceiverRingSwizzle(
             Pause = FALSE;
     }
 
+    // If there will be no more returns then we can't pause either
+    if (Pause && Receiver->Loaned == Receiver->Returned)
+        Pause = FALSE;
+
     if (Pause) {
         Ring->Paused = TRUE;
-
-        if (KeInsertQueueDpc(&Ring->QueueDpc, NULL, NULL))
-            Ring->QueueDpcs++;
     } else {
         BOOLEAN Paused = Ring->Paused;
 
@@ -3796,6 +3797,9 @@ ReceiverReturnPacket(
 
     ASSERT3S(Loaned - Returned, >=, 0);
 
+    if (KeInsertQueueDpc(&Ring->QueueDpc, NULL, NULL))
+        Ring->QueueDpcs++;
+
     KeSetEvent(&Receiver->Event, 0, FALSE);
 }
 
-- 
2.54.0.windows.1



--
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

 


Rackspace

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