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

Re: [PATCH 3/3] Remove StartOverride from all storage adapters


  • To: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>, "win-pv-devel@xxxxxxxxxxxxxxxxxxxx" <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Fri, 13 Feb 2026 13:49:48 +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=xIiBiG6Sxy8nGNrkrBfJSrazH2UIOiEaRQeRR/ki99Y=; b=QFKaKuCNinHMZUta57GWCMAkOU2036cBQlNKu2hVn0hdnOD276fdfZRKFM2sgRsnsq7CAtZi1JSKerSFmXjARJzgsBgNhRhZzZta+zMUCM58ict+KXKORPW4leiTqH0zrtCgjkBz5s59/L7/gSNyoLX815ubxjLkwa4AFYA5T0E8gsEtghsK9GRKjPB2Es699f/PAnODjuVXOuilcqe03PoHbbofwe+pQs9BIj7dB8Dlsh5ksaLKnh9yYd7a2BOgCFwQ6eOFencweSf+5OUJIv8SHF68cQ2HSt3SNEBY4IlxMrwQJGVaZpQFifpSA07YSm8zsHCf1JIRZxqY4yI5pg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=N/qW+5ozODQQ3eeedHxKJPTkYHawB4WgiXHH8kC+OpXb9JpZfdOP1+7WkLH2TNyQhBauIH8V3BcGBPjwRYyhC+n/CwpvHFKH4eO2Zf0e1HwpbRLs7w23ieBjDZwT9bs0BLPP+nRkLAlp4nknpIgIV1OvYBuWyTxVA8il6sdXK1WlaiTWllrtI5rb27dr0N+bAZNGVFHHdOPucGIaMcNP7yKXT0zEU3KlGyX6Cu/OO0dSzj1bu/7tBUXJVH5lFw7XLIs7PW8LO507ZX1e+EVmg7CtqVpNlT/ymNrtFnV2JAKP22Xsvzvof+J3KqSO3taiflnqAOM60QDmUxCb2Tsu1w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Delivery-date: Fri, 13 Feb 2026 13:49:55 +0000
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>
  • Msip_labels:
  • Thread-index: AQHcmz5ladZUiJgp/kKbH46Q7bTFlbV9a8wAgAM75M0=
  • Thread-topic: [PATCH 3/3] Remove StartOverride from all storage adapters

> > +
> > +    RemoveStartOverride("stornvme");
>
> I don't think RemoveStartOverride("stornvme") is still explicitly needed
> since it's already covered by the SCSIAdapter class even in native NVMe
> mode.

stornvme isnt explicitly required here - the setupapi enumeration will remove
StartOverride from stornvme if its the service responsible for the emulated NVMe
device - there is a problem if stornvme is not the service responsible for 
emulated
NVMe, and that driver is uninstalled, though this is a general issue with 
uninstalling
drivers on the boot storage device (e.g. uninstalling iaStorAC -> stornvme will 
not
remove stornvme's StartOverride and result in a 0x7B bugcheck. This will happen
even if Xen drivers are never installed on the VM, and could potentially happen 
on
baremetal)

Owen

________________________________________
From: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
Sent: 11 February 2026 12:22 PM
To: Owen Smith; win-pv-devel@xxxxxxxxxxxxxxxxxxxx
Subject: Re: [PATCH 3/3] Remove StartOverride from all storage adapters

On 11/02/2026 11:08, Owen Smith wrote:
> Its possible to install non-Microsoft NVMe drivers on the emulated
> NVMe device. During upgrades, the VM requires a reboot using the emulated
> devices, but if the driver assigned for the emulated device has a 
> StartOverride
> setting, then its likely not started which results in a 0x7B bugcheck.
>
> Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
> ---
>   src/monitor/monitor.c                        | 67 +++++++++++++++++---
>   vs2019/xenbus_monitor/xenbus_monitor.vcxproj |  2 +-
>   vs2022/xenbus_monitor/xenbus_monitor.vcxproj |  2 +-
>   3 files changed, 59 insertions(+), 12 deletions(-)
>
> diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
> index 700f196..eb1be91 100644
> --- a/src/monitor/monitor.c
> +++ b/src/monitor/monitor.c
> @@ -42,6 +42,8 @@
>   #include <assert.h>
>   #include <TraceLoggingProvider.h>
>   #include <winmeta.h>
> +#include <setupapi.h>
> +#include <devguid.h>
>
>   #include <version.h>
>
> @@ -1328,7 +1330,7 @@ fail1:
>       return FALSE;
>   }
>
> -static BOOL
> +static VOID
>   RemoveStartOverride(
>       _In_ PTSTR          DriverName
>       )
> @@ -1336,17 +1338,61 @@ RemoveStartOverride(
>       TCHAR               KeyName[MAX_PATH];
>       HRESULT             Error;
>
> +    LogInfo("%s", DriverName);
> +
>       Error = StringCbPrintf(KeyName,
>                              MAX_PATH,
>                              SERVICES_KEY "\\%s\\StartOverride",

As this is new code, could you wrap this in _T please?

>                              DriverName);
>       assert(SUCCEEDED(Error));
>
> -    Error = RegDeleteKey(HKEY_LOCAL_MACHINE, KeyName);
> -    if (Error != ERROR_SUCCESS)
> +    (VOID) RegDeleteKey(HKEY_LOCAL_MACHINE, KeyName);
> +}
> +
> +static VOID
> +RemoveStartOverrideForClass(
> +    _In_ const GUID*    Guid
> +    )
> +{
> +    HRESULT             Error;
> +    HDEVINFO            hDevInfo;
> +    DWORD               Index;
> +    SP_DEVINFO_DATA     devInfoData;

Nit: DevInfo and DevInfoData would better fit the naming convention

> +
> +    hDevInfo = SetupDiGetClassDevs(Guid,
> +                                   NULL,
> +                                   NULL,
> +                                   0);
> +    if (hDevInfo == INVALID_HANDLE_VALUE)
>           goto fail1;
>
> -    return TRUE;
> +    memset(&devInfoData, 0, sizeof(devInfoData));
> +    devInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
> +
> +    for (Index = 0;
> +         SetupDiEnumDeviceInfo(hDevInfo, Index, &devInfoData);
> +         ++Index) {
> +        TCHAR           Buffer[MAX_PATH];
> +        memset(Buffer, 0, sizeof(Buffer));
> +
> +        if (SetupDiGetDeviceRegistryProperty(hDevInfo,
> +                                             &devInfoData,
> +                                             SPDRP_SERVICE,
> +                                             NULL,
> +                                             (PBYTE)Buffer,
> +                                             sizeof(Buffer),
> +                                             NULL)) {
> +            Buffer[MAX_PATH - 1] = _T('\0');
> +            RemoveStartOverride(Buffer);
> +        }
> +
> +        memset(&devInfoData, 0, sizeof(devInfoData));
> +        devInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
> +    }
> +
> +    SetupDiDestroyDeviceInfoList(hDevInfo);
> +
> +    return;
>
>   fail1:
>       Error = GetLastError();
> @@ -1357,8 +1403,6 @@ fail1:
>           LogError("fail1 (%s)", Message);
>           LocalFree(Message);
>       }
> -
> -    return FALSE;
>   }
>
>   VOID WINAPI
> @@ -1381,7 +1425,8 @@ MonitorMain(
>
>       LogInfo("====>");
>
> -    (VOID) RemoveStartOverride("stornvme");
> +    RemoveStartOverride("stornvme");
> +    RemoveStartOverrideForClass(&GUID_DEVCLASS_SCSIADAPTER);
>
>       Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
>                            PARAMETERS_KEY(__MODULE__),
> @@ -1525,10 +1570,12 @@ done:
>       CloseHandle(Context->RequestEvent);
>       CloseHandle(Context->StopEvent);
>
> -    ReportStatus(SERVICE_STOPPED, NO_ERROR, 0);
> -
>       RegCloseKey(Context->ParametersKey);
> -    (VOID) RemoveStartOverride("stornvme");
> +
> +    RemoveStartOverride("stornvme");

I don't think RemoveStartOverride("stornvme") is still explicitly needed
since it's already covered by the SCSIAdapter class even in native NVMe
mode.

> +    RemoveStartOverrideForClass(&GUID_DEVCLASS_SCSIADAPTER);
> +
> +    ReportStatus(SERVICE_STOPPED, NO_ERROR, 0);
>
>       LogInfo("<====");
>
> diff --git a/vs2019/xenbus_monitor/xenbus_monitor.vcxproj 
> b/vs2019/xenbus_monitor/xenbus_monitor.vcxproj
> index 3b44e29..df1fd58 100644
> --- a/vs2019/xenbus_monitor/xenbus_monitor.vcxproj
> +++ b/vs2019/xenbus_monitor/xenbus_monitor.vcxproj
> @@ -34,7 +34,7 @@
>         <RuntimeLibrary 
> Condition="'$(UseDebugLibraries)'=='false'">MultiThreaded</RuntimeLibrary>
>       </ClCompile>
>       <Link>
> -      
> <AdditionalDependencies>powrprof.lib;wtsapi32.lib;cfgmgr32.lib;%(AdditionalDependencies)</AdditionalDependencies>
> +      
> <AdditionalDependencies>powrprof.lib;wtsapi32.lib;cfgmgr32.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
>         <CETCompat>true</CETCompat>
>         <GenerateMapFile>true</GenerateMapFile>
>         <MapExports>true</MapExports>
> diff --git a/vs2022/xenbus_monitor/xenbus_monitor.vcxproj 
> b/vs2022/xenbus_monitor/xenbus_monitor.vcxproj
> index 484fa1c..196a744 100644
> --- a/vs2022/xenbus_monitor/xenbus_monitor.vcxproj
> +++ b/vs2022/xenbus_monitor/xenbus_monitor.vcxproj
> @@ -34,7 +34,7 @@
>         <RuntimeLibrary 
> Condition="'$(UseDebugLibraries)'=='false'">MultiThreaded</RuntimeLibrary>
>       </ClCompile>
>       <Link>
> -      
> <AdditionalDependencies>powrprof.lib;wtsapi32.lib;cfgmgr32.lib;%(AdditionalDependencies)</AdditionalDependencies>
> +      
> <AdditionalDependencies>powrprof.lib;wtsapi32.lib;cfgmgr32.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
>         <CETCompat>true</CETCompat>
>         <GenerateMapFile>true</GenerateMapFile>
>         <MapExports>true</MapExports>



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