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

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


  • To: Owen Smith <owen.smith@xxxxxxxxxx>, "paul@xxxxxxx" <paul@xxxxxxx>, "win-pv-devel@xxxxxxxxxxxxxxxxxxxx" <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Mon, 28 Jun 2021 13:50:49 +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=kFedcVuSjbZm2pbYTLEujIageI9RZcw9/zyWH8m4If4=; b=OI/aaSwsdPCzaV+ZzQFOIO2ArcMh/pVAhH8a6RGUJ1BeFNSGrPFqBhcKQ6OhoQL9x4DVtxrpU2q5vw8dIn91lLf9DCDVKqszki3gh2ZYKrTm6Zf7w+VQxIMxxbSXz55r3sRxPxcK/NidI2DvjVEl1xuLojp6tmwl4QbCvy2kMj5MGiBZjBw5DpQWI7Ptmeio1NBqkKHqcmJ7lgFo8O+AZ3Rl+HTPFVpaGqvBiJyGTnt1zjXdyod9Kywqji1YOKn8eg+cntIhA684O0z3aD2vElniWO0pI1mWCee2KP8Exci7L86HuGqN+NP45MV5bR8vPVOHyl0yQt/BPZrLTF9MOg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZEFY9l5uFTUExz1xiRDQIieiAV7tpEvuUmhN9s6gZO6qc9YMx4WD+xyP0cV7ByTAeyoQ4pB3/bLSKecQFWY2ItHzWFmdrhoHgUC6UKYIjHWffexBBMxDnlnDLdUs3Ehp2xKwTnSciW8iK9axRijSMAlNbTbviMpdUh3brH4YAG2iFQ7uaYQOZkeUj0YvvpBWRkev2YP/fJDV1+q2w+JnfkPpEcY/sbcj7984tmRuOghuTPrlIp7YDHsJgk8R8Rdmvvsuav6pNbpTuvhieoT9rWlDPdapqisceW9xhbyEKUsvuNQ0FnCu+l/mdmGsTYNXgpYNhG89/ra80MyO4XyIxw==
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Delivery-date: Mon, 28 Jun 2021 13:50:56 +0000
  • Ironport-hdrordr: A9a23:LF87L6lx3SJ8PtQZsCp7TYs6divpDfOnimdD5ihNYBxZY6Wkfp +V8sjzhCWatN9OYh0dcIi7SdS9qADnhOJICO4qTPmftWjdySSVxeRZjLcKrAeQYhEWmtQtt5 uINpIOcuEYbmIKzPoSgjPIa+rIqePvmMvD6IeurEuFDzsaEJ2Ihz0JUTpzeXcGIDWucKBJcq Z0kfA3wAZIF05nC/iTNz0gZazuttfLnJXpbVotHBg88jSDijuu9frTDwWY9g12aUIO/Z4StU z+1yDp7KSqtP+2jjXG0XXI0phQkNz9jvNeGc23jNQPIDmEsHfqWG0hYczBgNkGmpDq1L8Yqq iKn/7mBbU015rlRBDxnfIq4Xi47N9h0Q679bbSuwqdnSWwfkNFNyMGv/MCTvKR0TtQgPhslK 1MxG6XrJxREFfJmzn8/cHBU1VwmlOzumdKq59Ys5Vza/pXVFZql/1VwKqVKuZ2IAvqrIQ8VO V+BsDV4/hbNVuccnDCp2FqhNihRG46EBuKSlUL/pX96UkboFlpi08DgMAPlHYJ85wwD5FC+u TfK6xt0LVDVNUfY65xDPoIBcG3FmvOSxTRN3/6GyWrKEjGAQOFl3fT2sRA2AiHQu178HICou W2bLoDjx9AR6vHM7z64HRkyGG8fFmA
  • Ironport-sdr: oCbqR+SwqC05GdcZevzjCVNeKnNyOiE2nl2iHhAtgCEvktJ9DxqlJckeVaivcho2caIgkqkewT ppggForYtWd5h7k7zbkKlqI0EUZgctazdTmuNyJmGvfLkUtR5XOmiLmpch92XONf9vs6BzlFk3 Kp99BhYTWh/Q3P9weCgMDM+gb2hlYzJUT8eiimqB8KrhsjUQmFketZFQyxSQKAfgmJfTwN5JNV 2dFxxtNnQVyX+BW0i+K9LyA1/ved6ERUEIWr3E+Hhlx4bXcKFweIsKR8U+2Lb3aW/tl3y92z3j sHs=
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>
  • Thread-index: AQHXY3UQ3XqodTsqBE2hji69PMRIKasegSAAgAAc+5CACuNdUA==
  • Thread-topic: [PATCH 3/6] Delete stornvme's StartOverride


-----Original Message-----
From: win-pv-devel <win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx> On Behalf Of 
Owen Smith
Sent: Monday, June 21, 2021 4:33 PM
To: paul@xxxxxxx; 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.

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


After some investigation, the IoRegisterBootDriverReinitialization callback 
occurs too early and StorNvme adds the value later. It should only be required 
to ensure this value is removed before the VM is shutdown or rebooted, so its 
possible that removing the StartOverride in the unload/power down code would be 
appropriate.

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