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

[PATCH v2 04/10] frontend: Initialize the granter before the ring


  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
  • Date: Wed, 28 Oct 2026 18:18:34 +0100
  • 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: Wed, 28 Oct 2026 17:19:00 +0000
  • Feedback-id: default:8631fc262581453bbf619ec5b2062170:Sweego
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

This is preparation for deferred grant revocation, as this requires the
granter to outlive the ring.

Assisted-by: LLM
Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
 src/xenvbd/frontend.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/xenvbd/frontend.c b/src/xenvbd/frontend.c
index 06c7295..8bf4f96 100644
--- a/src/xenvbd/frontend.c
+++ b/src/xenvbd/frontend.c
@@ -1907,11 +1907,11 @@ FrontendCreate(
     if (!NT_SUCCESS(status))
         goto fail3;
 
-    status = RingCreate(Frontend, &Frontend->Ring);
+    status = GranterCreate(Frontend, &Frontend->Granter);
     if (!NT_SUCCESS(status))
         goto fail4;
 
-    status = GranterCreate(Frontend, &Frontend->Granter);
+    status = RingCreate(Frontend, &Frontend->Ring);
     if (!NT_SUCCESS(status))
         goto fail5;
 
@@ -1928,12 +1928,12 @@ FrontendCreate(
 
 fail6:
     Error("fail6\n");
-    GranterDestroy(Frontend->Granter);
-    Frontend->Granter = NULL;
-fail5:
-    Error("fail5\n");
     RingDestroy(Frontend->Ring);
     Frontend->Ring = NULL;
+fail5:
+    Error("fail5\n");
+    GranterDestroy(Frontend->Granter);
+    Frontend->Granter = NULL;
 fail4:
     Error("fail4\n");
     RtlZeroMemory(Frontend->TargetPath, sizeof(Frontend->TargetPath));
@@ -1970,12 +1970,12 @@ FrontendDestroy(
     ThreadJoin(Frontend->BackendThread);
     Frontend->BackendThread = NULL;
 
-    GranterDestroy(Frontend->Granter);
-    Frontend->Granter = NULL;
-
     RingDestroy(Frontend->Ring);
     Frontend->Ring = NULL;
 
+    GranterDestroy(Frontend->Granter);
+    Frontend->Granter = NULL;
+
     RtlZeroMemory(&Frontend->StateLock, sizeof(KSPIN_LOCK));
 
     RtlZeroMemory(Frontend->TargetPath, sizeof(Frontend->TargetPath));
-- 
2.56.0.windows.4



--
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®.