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

RE: [PATCH 3/6] Delete stornvme's StartOverride


  • To: "paul@xxxxxxx" <paul@xxxxxxx>, "win-pv-devel@xxxxxxxxxxxxxxxxxxxx" <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Mon, 21 Jun 2021 15:32:46 +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=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z2Yntnwi4EYm2i3zVTFX4OrEvL1o+OdM95hrcQXPNPo=; b=Z0Qc4/vdTUQfsu/uLcxKi8o9d6Xq4fV6uDSLD0gOk1rf1C9vSfDfuZne5MhTYzHeup9ehe8StywsGxbzv3BhsL6bpMiIo47gpF3UAvZ51tAOXvGHYTCl+9bAFycVWs4YhLNGiPSSSiyEjOCihJgTcVJAYkNsQP6YOOxgLQbqbjzkkyluF084olkTw/wDbU+efS/A4/Vx7DvZ/j57G+iPGPWVjSS8tWMBGHWbLnrdLvfzaDa+GxPPFndum/eh16OfPBTp1EoSGVZZ2JUI2Q+y6ccoqvUB+iXIbEXdEq/627OBxm1GZ9oeEaISqQRwr0e31502N2j8PrghHw6nquVe+g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A/oY+eU+gTqo8tOaEFM++MFmAEfmuvTdJsABBePCrc89sigklYloLgwZDyEPlssTXOLZfFMOiqREgA13KtlskFRhibBPdhMLSs/jVoKCQOeYqUN6+TCAtgwsjzk12Jx31bG2sn7/1+kcFf5IdVBp69WVUDgWHRZHyQLJiwSpMErxNUrY4bzYYdJjaNvzwr3jAw/00aR9jX4eMZ0aWYEK1f+at8mPrf/H71/dIw92VCh4Rxo9KnZIuFjf/I/IdiHCMfIid2M9JHLmrUGULDfT6bX/nlCOlDSI3osjpRi4h/0uCULwqOoeu//cmKAayP0+gsw06J1HyvRmp/UxqkZB7Q==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Delivery-date: Mon, 21 Jun 2021 15:32:57 +0000
  • Ironport-hdrordr: A9a23:dD4Jq677a4lZN+gsgAPXwUOBI+orL9Y04lQ7vn2ZFiY6TiXIra +TdaoguSMc0AxhJU3I6urwRJVoJkmsu6KdgLNhcotKOTOGhILGFvAa0WKP+UyDJ8S6zJ8m6U 4CSdk+NDSTNykDsS+S2mDReLxMoKjlzEnrv5ak854Ed3AwV0gK1XYcNu/vKDwReOAwP+tfKH Pz3LsjmxOQPVAsKuirDHgMWObO4/fRkoj9XBIADxk7rCGTkDKB8tfBYlil9yZbdwkK7aYp8G DDnQC8zL6kqeuHxhjV0HKWx4hKmeHm1sBICKW3+4sow3TX+0SVjbZaKvm/VQMO0aaSAZER4Z /xSiIbToFOArXqDziISFXWqlHdOX0VmgDfIBej8AXeSIrCNWgH4oN69PNkWwqc5Ew6sN5m1q VXm2qfqppMFBvF2D/w/t7SSnhR5wGJSFcZ4KcuZkZkIMMjgX5q3Pgi1VIQFI1FEDPx6YghHu UrBMbA5OxOeVffa3zCpGFgzNGlQ3x2R369MwU/k93Q1yITkGFyzkMeysBalnAc9IglQ50B4+ jfKKxnmLxHU8dTZ6NgA+UKR9exFwX2MFjx2aKpUCLa/YQ8Sj7wQrLMkccIDdCRCes1JcEJ6e f8uXtjxBsPkmzVeL2z4KE=
  • Ironport-sdr: fd0Xh7ttAg5cxENGThKkw5uxf4DfYIGoEwaeaaMk4PoETah9DSlJ8GIy6jCxQdEhK/THPfJ8yy +EbVJU43CtGENPBiXg8oHBiyO+9RgjJMsT6BotaSRS/DQNzi+1MZUVDSb/jeGBo8gcHKQzPMnC 4QD2qK+q9JGr8ydIpb5RpAbiR2CYl+jByCiGXgaRKYonuCn0kDmdITugw5YCpyZeQXvtC80WJ1 dpbRuMfOBKqQqIDPiyITwnVTgM1AEhdWbS/uzfYUlxHzFUALdDkSzAe6ZY0YyQN2yCId2lThon QpE=
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>
  • Thread-index: AQHXY3UQ3XqodTsqBE2hji69PMRIKasegSAAgAAc+5A=
  • Thread-topic: [PATCH 3/6] Delete stornvme's StartOverride

-----Original Message-----
From: win-pv-devel <win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx> On Behalf Of 
Paul Durrant
Sent: Monday, June 21, 2021 2:48 PM
To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
Subject: Re: [PATCH 3/6] Delete stornvme's StartOverride

[CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open attachments 
unless you have verified the sender and know the content is safe.

On 17/06/2021 13:33, Owen Smith wrote:
> Using an emulated NVMe device for installation will not be able to 
> revert to emulated NVMe device once xenvbd has been used to boot. This 
> is due to stornvme creating a StartOverride value that overrides 
> stornvme's StartType to manual (from boot) when stornvme is not loaded 
> during boot. This occurs when xenbus has unplugged the emulated NVMe 
> controller at boot. Disabling the unplug is not sufficient to have 
> stornvme load at boot, which results in a 0x7B bugcheck.

Ick!

> 
> Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
> ---
>   src/monitor/monitor.c | 60 +++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 60 insertions(+)
> 
> diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c

Not sure the monitor is the best place to do this; it seems a little too 
critical for that. Could we use this ancient interface instead?

https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/nf-ntddk-ioregisterbootdriverreinitialization

   Paul


This looks doable, calling IoRegisterBootDriverReinitialization from XenVbd's 
DriverEntry and clearing the StartOverride from the reinitialize routine

Owen


> index 9adfb79..c858249 100644
> --- a/src/monitor/monitor.c
> +++ b/src/monitor/monitor.c
> @@ -1172,6 +1172,64 @@ fail1:
>       return FALSE;
>   }
>   
> +static BOOL
> +DeleteStartOverride(
> +    _In_    LPTSTR      DriverName
> +    )
> +{
> +    TCHAR               ServiceKeyName[MAX_PATH];
> +    HKEY                Key;
> +    HRESULT             Error;
> +
> +    Error = StringCbPrintf(ServiceKeyName,
> +                            MAX_PATH,
> +                            SERVICES_KEY "\\%s",
> +                            DriverName);
> +    if (!SUCCEEDED(Error))
> +        goto fail1;
> +
> +    Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
> +                         ServiceKeyName,
> +                         0,
> +                         KEY_ALL_ACCESS,
> +                         &Key);
> +    if (Error != ERROR_SUCCESS) {
> +        SetLastError(Error);
> +        goto fail2;
> +    }
> +
> +    Error = RegDeleteTree(Key,
> +                          "StartOverride");
> +    if (Error != ERROR_SUCCESS) {
> +        SetLastError(Error);
> +        goto fail3;
> +    }
> +
> +    RegCloseKey(Key);
> +
> +    return TRUE;
> +
> +fail3:
> +    Log("fail3");
> +
> +    RegCloseKey(Key);
> +
> +fail2:
> +    Log("fail2");
> +
> +fail1:
> +    Error = GetLastError();
> +
> +    {
> +        PTCHAR  Message;
> +        Message = GetErrorMessage(Error);
> +        Log("fail1 (%s)", Message);
> +        LocalFree(Message);
> +    }
> +
> +    return FALSE;
> +}
> +
>   VOID WINAPI
>   MonitorMain(
>       _In_    DWORD       argc,
> @@ -1251,6 +1309,7 @@ MonitorMain(
>       if (!Success)
>           goto fail9;
>   
> +    (VOID) DeleteStartOverride("stornvme");
>       SetEvent(Context->RequestEvent);
>   
>       ReportStatus(SERVICE_RUNNING, NO_ERROR, 0); @@ -1285,6 +1344,7 
> @@ MonitorMain(
>       }
>   
>   done:
> +    (VOID) DeleteStartOverride("stornvme");
>       (VOID) RegDeleteTree(Context->RequestKey, NULL);
>   
>       free(Context->Question);
> 



 


Rackspace

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