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

Re: [PATCH RESEND] xenfilt: Complete enumeration for empty BusRelations


  • To: Jiaqing Zhao <Zhao.Jiaqing@xxxxxxx>, "win-pv-devel@xxxxxxxxxxxxxxxxxxxx" <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Tue, 24 Nov 2026 14:28:44 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=56CJmfDbDhMhoeofvLsW2jmF5SniWt8BA7RPM1Zc29I=; b=ootzTHs74UHabXJ54Bm0yGzOagKqJyMsL/PLEBc1APWFu4JAXdSiChbxo/UhtOLaVMC2lm1Qol4mRdRM3JauQOCd6D0GsvyLoHFBX6VeBvSNSkRMKdntVSJ073BfdltOxHM3ZaXvG897twoL973uR1eif+dZJKvV2hHVGVMNvh2Mj+co3zt+4epRVXlKqYOAwH9qtpjZi6ar7G+nL+IHYOLnFsNT6Qcf+S1IL3cKlaaLiYuPU4LnBZ+61WxWlWeRrlG0H2WuOmBKZEwftH8eT85ma8SNZJti/heo6iOahMfVyHIzwrs4HUhEGF+JxSG9u8HVir+C6HAk4Hwn4PjFEA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wZpHmEKPF+0PCTKt6BFsDi8cSR0mfOmAX+Fq00hRi7aSVOCeJmmbvW4Qo9HS/hrY8RBNWvAOeznTuLxcx7i0WY02j6xBEDwZgA/dCVBQAuduVUwnIM+B81Xz5HQ1Rtjm9fJQDApaVKODyYzZeZM9flz9VusSRF0M+CB24XHAfiDf6epZs2vmU3ZaVCp7iEiMT9WDztr5Y6/w9L4zbim/o/9LTEx9U8pwsKVcQFCaMhyPO/QZUKunqxGwePB0K9II7Jk3a8vBwC6Isw1gIsThbjEguYqnkkdN94r8i+2i7CPPFPEDmgbUMx5Re5pUzeVcFiq2LZy1pdvpHtDa8c76lA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
  • Delivery-date: Tue, 24 Nov 2026 14:28:51 +0000
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>
  • Msip_labels:
  • Thread-index: AQHde/sTyt589Yzb3UmFiSLhmFD2c7c9SCDt
  • Thread-topic: [PATCH RESEND] xenfilt: Complete enumeration for empty BusRelations

Reviewed-by: Owen Smith <owen.smith@xxxxxxxxxx>

________________________________________
From: Jiaqing Zhao <Zhao.Jiaqing@xxxxxxx>
Sent: 24 November 2026 10:03 AM
To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
Cc: Jiaqing Zhao; Owen Smith; Tu Dinh
Subject: [PATCH RESEND] xenfilt: Complete enumeration for empty BusRelations

A successful BusRelations query may return no PDOs if no device is
present on that bus. Skipping FdoEnumerate() in that case leaves the
XenFilt FDO marked as not enumerated, so the filter state never moves
from XENFILT_FILTER_ENABLED to PENDING. On an HVM guest with a PV disk
and a CD-ROM on secondary IDE channel (leaving the primary channel
empty), this blocks XenVbd and the guest fails to boot.

Always call FdoEnumerate() so that tracked PDOs are reconciled and the
FDO is marked enumerated even when the bus is empty.

Signed-off-by: Jiaqing Zhao <Zhao.Jiaqing@xxxxxxx>
---
Cc: Owen Smith <owen.smith@xxxxxxxxxx>
Cc: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
 src/xenfilt/fdo.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/src/xenfilt/fdo.c b/src/xenfilt/fdo.c
index 04427bf..c8d98c6 100644
--- a/src/xenfilt/fdo.c
+++ b/src/xenfilt/fdo.c
@@ -409,17 +409,20 @@ FdoEnumerate(
     NTSTATUS                status;

     Count = Relations->Count;
-    ASSERT(Count != 0);
+    PhysicalDeviceObject = NULL;
+    if (Count != 0) {
+        PhysicalDeviceObject = __FdoAllocate(sizeof (PDEVICE_OBJECT) * Count);

-    PhysicalDeviceObject = __FdoAllocate(sizeof (PDEVICE_OBJECT) * Count);
-
-    status = STATUS_NO_MEMORY;
-    if (PhysicalDeviceObject == NULL)
-        goto fail1;
+        status = STATUS_NO_MEMORY;
+        if (PhysicalDeviceObject == NULL)
+            goto fail1;

-    RtlCopyMemory(PhysicalDeviceObject,
-                  Relations->Objects,
-                  sizeof (PDEVICE_OBJECT) * Count);
+        RtlCopyMemory(PhysicalDeviceObject,
+                      Relations->Objects,
+                      sizeof (PDEVICE_OBJECT) * Count);
+    } else {
+        Info("%s: Enumerated empty BusRelations\n", __FdoGetName(Fdo));
+    }

     // Remove any PDOs that do not appear in the device list
     ListEntry = Fdo->List.Flink;
@@ -498,7 +501,8 @@ FdoEnumerate(

     __FdoSetEnumerated(Fdo);

-    __FdoFree(PhysicalDeviceObject);
+    if (PhysicalDeviceObject != NULL)
+        __FdoFree(PhysicalDeviceObject);
     return;

 fail1:
@@ -942,10 +946,10 @@ FdoQueryDeviceRelations(

     Relations = (PDEVICE_RELATIONS)Irp->IoStatus.Information;

-    if (Relations->Count != 0)
-        FdoEnumerate(Fdo, Relations);
+    FdoEnumerate(Fdo, Relations);

     ExFreePool(Relations);
+    Irp->IoStatus.Information = 0;

     State = DriverGetFilterState();
     Count = 0;
--
2.53.0




 


Rackspace

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