[nvmewin] StorPortInitializePerfOpts Issue

Mike Berhan mikeb at bustrace.com
Tue Sep 2 15:56:28 PDT 2014


The NVMe OFA BugZilla database does not appear to be used.  Should bug
submissions simply be posted to the reflector?

 

While capturing NVMe<->Storport traffic, I found a spec compliance issue in
the NVMeInitialize() routine where it enables optimization of storport DPCs.
The code in question is:

 

PERF_CONFIGURATION_DATA perfData = {0};

 

Status = StorPortInitializePerfOpts(pAE, TRUE, &perfData);

ASSERT(STOR_STATUS_SUCCESS == Status);

if (STOR_STATUS_SUCCESS == Status) {

    /* Allow optimization of storport DPCs */

    if (perfData.Flags & STOR_PERF_DPC_REDIRECTION) {

        perfData.Flags = STOR_PERF_DPC_REDIRECTION;

    }

    Status = StorPortInitializePerfOpts(pAE, FALSE, &perfData);

    ASSERT(STOR_STATUS_SUCCESS == Status);

}

 

The problem is that the Version and Size fields, of the
PERF_CONFIGURATION_DATA structure, are not set for the query or the setting
of the performance optimizations.  You might expect the initial query to
fail, since the fields are not set, but it succeeds.  Here is the return
data from the query:

 

Local var @ 0xffffd001c58d3f38 Type _PERF_CONFIGURATION_DATA

   +0x000 Version          : 0

   +0x004 Size             : 0

   +0x008 Flags            : 3

   +0x00c ConcurrentChannels : 0

   +0x010 FirstRedirectionMessageNumber : 0

   +0x014 LastRedirectionMessageNumber : 0

   +0x018 DeviceNode       : 0

   +0x01c Reserved         : 0

   +0x020 MessageTargets   : (null)

 

So the STOR_PERF_DPC_REDIRECTION flag was set even though the Version/Size
fields were not set.  I'm assuming this is for legacy compatibility.  The
main concern is that the WDK specifically states that
STOR_PERF_DPC_REDIRECTION is only valid when Version is >=2.  Here is how
Microsoft's AHCI driver handles the same DPC optimization for reference.
I've highlighted the lines in question that are missing from the NVMe
driver.

 


PERF_CONFIGURATION_DATA     perfConfigData = {0};

 

//

// Query perf optimization information

//

perfConfigData.Version = STOR_PERF_VERSION;

perfConfigData.Size = sizeof(PERF_CONFIGURATION_DATA);

 

status = StorPortInitializePerfOpts(AdapterExtension, TRUE,
&perfConfigData);

 

//

// Turn on DPC Redirection if it's supported.

//

if ((status == STOR_STATUS_SUCCESS) &&

    ((perfConfigData.Flags & STOR_PERF_DPC_REDIRECTION) != 0)) {

 

    AhciZeroMemory((PCHAR)&perfConfigData, sizeof(PERF_CONFIGURATION_DATA));

    perfConfigData.Version = STOR_PERF_VERSION;

    perfConfigData.Size = sizeof(PERF_CONFIGURATION_DATA);

 

    perfConfigData.Flags = STOR_PERF_DPC_REDIRECTION;

 

    status = StorPortInitializePerfOpts(AdapterExtension, FALSE,
&perfConfigData);

 

    NT_ASSERT(status == STOR_STATUS_SUCCESS);

}

 

Mike Berhan

busTRACE Technologies

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/nvmewin/attachments/20140902/fde3797e/attachment.html>


More information about the nvmewin mailing list