[nvmewin] NVMe OFA Patch for Random bug fixes

Alex Chang Alex.Chang at pmcs.com
Tue Aug 19 09:09:41 PDT 2014


Thank you! Suman.
Alex

From: SUMAN PRAKASH B [mailto:suman.p at samsung.com]
Sent: Tuesday, August 19, 2014 7:24 AM
To: Alex Chang; nvmewin at lists.openfabrics.org
Subject: RE: [nvmewin] NVMe OFA Patch for Random bug fixes


Hi Alex,



Sure. I will re-base the Samsung patch once the PMC patch is added to the repository.



Thanks,

Suman



------- Original Message -------

Sender : Alex Chang<Alex.Chang at pmcs.com>

Date : Aug 18, 2014 20:32 (GMT+05:00)

Title : RE: [nvmewin] NVMe OFA Patch for Random bug fixes


<!--[if mso 9]-->
Hi Suman,
Thank you for fixing the issues. I had sent out PMC patch for the community to review/test last Friday. In order to avoid confusion, we only allow one pending patch at a time. After PMC patch is approved by the community, we will start to review/test your patch. Please note that you will need to re-base your changes on top of the most current sources in OFA NVMe Windows repository before sending out your patch. You will be notified when PMC patch had been added to the repository. Again, thank you so much for your effort.
Regards,
Alex


From: nvmewin-bounces at lists.openfabrics.org [mailto:nvmewin-bounces at lists.openfabrics.org] On Behalf Of SUMAN PRAKASH B
Sent: Saturday, August 16, 2014 5:05 AM
To: nvmewin at lists.openfabrics.org
Subject: Re: [nvmewin] NVMe OFA Patch for Random bug fixes


Content-Type: text/plain; charset=UTF-8

Content-Transfer-Encoding: 8bit

Date: %%SENT_DATE%%

Subject: Suspect Message Quarantined







WARNING: The virus scanner was unable to scan an attachment in an email message sent to you.  This attachment could possibly contain viruses or other malicious programs.  The attachment could not be scanned for the following reasons:



%%DESC%%



The full message and the attachment have been stored in the quarantine.



The identifier for this message is '%%QID%%'.



Access the quarantine at:

https://puremessage.pmc-sierra.bc.ca:28443/



For more information on PMC's Anti-Spam system:

http://pmc-intranet/wiki/index.php/Outlook:Anti-Spam_FAQ



IT Services

PureMessage Admin



Hi Everyone,



There was one more bug in nvmeSnti.c - SntiSetScsiSenseData().

In the statement -
SrbSetScsiData(pSrb, NULL, NULL, NULL, NULL, sizeof(SENSE_DATA));

The last parameter is supposed to be a pointer.

System is crashing with KiPageFault error in Windows 8.1.



Please find attached Patch1-v3 with this issue corrected. Kindly ignore Patch1-v2.



Thanks,
Suman



------- Original Message -------

Sender : SUMAN PRAKASH B<suman.p at samsung.com> Chief Engineer/SRI-Bangalore-SSD Solutions/Samsung Electronics

Date : Aug 16, 2014 16:51 (GMT+05:00)

Title : RE: [nvmewin] NVMe OFA Patch for Random bug fixes



Hi Alex,



Kindly excuse me for delay in responding to your mails. 15th August was Independence day in India and we were not allowed to come to office :)



Anyway, I compiled the code in checked build and after installing the driver on Windows 8.1, observed a BSOD.



The issue was in IO_StorPortNotification() routine.

For a particular SRB_FUNCTION_IO_CONTROL - IOCTL_SCSI_MINIPORT_IDENTIFY request, the pCdb was NULL. Hence BSOD was happening at
 StorPortDebugPrint(INFO,
                           "FYI: SRB status 0x%x scsi 0x%x for CDB 0x%x BTL %d %d %d\n",
                           pSrb->SrbStatus,
                           scsiStatus,

                           *pCdb,
                           SrbGetPathId((void*)pSrb),
                           SrbGetTargetId((void*)pSrb),
                           SrbGetLun((void*)pSrb));



This issue is not reproducible in release build. I did not find any other issues on Win8.1 right after installation. Please find attached the corrected code. Password is samsung123.

Please do let me know if this resolves the crash that you had seen.



Thanks,
Suman





------- Original Message -------

Sender : Alex Chang<Alex.Chang at pmcs.com>

Date : Aug 16, 2014 05:51 (GMT+05:00)

Title : RE: [nvmewin] NVMe OFA Patch for Random bug fixes


<!--[if mso 9]-->
Thanks, Judy.
Alex

From: Judy Brock-SSI [mailto:judy.brock at ssi.samsung.com]
Sent: Friday, August 15, 2014 5:51 PM
To: Alex Chang; Uma Parepalli; SUMAN PRAKASH B; nvmewin at lists.openfabrics.org
Subject: RE: [nvmewin] NVMe OFA Patch for Random bug fixes

Sure.
Thanks,
Judy

From: Alex Chang [mailto:Alex.Chang at pmcs.com]
Sent: Friday, August 15, 2014 5:50 PM
To: Judy Brock-SSI; Uma Parepalli; SUMAN PRAKASH B; nvmewin at lists.openfabrics.org<mailto:nvmewin at lists.openfabrics.org>
Subject: RE: [nvmewin] NVMe OFA Patch for Random bug fixes

Hi Judy,
I have my patch ready. Can I send it out first? And Suman can take his time to debug the issue?

Thanks,
Alex


From: Judy Brock-SSI [mailto:judy.brock at ssi.samsung.com]
Sent: Friday, August 15, 2014 5:13 PM
To: Uma Parepalli; Alex Chang; SUMAN PRAKASH B; nvmewin at lists.openfabrics.org<mailto:nvmewin at lists.openfabrics.org>
Subject: RE: [nvmewin] NVMe OFA Patch for Random bug fixes

Hi Uma,
I am not sure if there will be a patch by tomorrow. I relayed the exact message I got from Suman which was that he expects to have an update by EOD tomorrow. I believe it will depend on what he finds.
Thanks,
Judy

From: Uma Parepalli [mailto:Uma.Parepalli at skhms.com]
Sent: Friday, August 15, 2014 11:47 AM
To: Alex Chang; Judy Brock-SSI; SUMAN PRAKASH B; nvmewin at lists.openfabrics.org<mailto:nvmewin at lists.openfabrics.org>
Subject: RE: [nvmewin] NVMe OFA Patch for Random bug fixes

Thank you Alex and Judy.
Hi Judy,
             Does your email mean that there will be a patch by tomorrow 8/16 so that Alex can have it released on Monday 8/18?
             I would prefer to have the patch with the crash fix.
             Thank you,
Uma
Uma Parepalli
Cell: 408 805 9260
uma.parepalli at skhms.com<mailto:uma.parepalli at skhms.com>
SK Hynix Memory Solutions Inc.
3103 North 1st Street, San Jose, CA



From: nvmewin-bounces at lists.openfabrics.org<mailto:nvmewin-bounces at lists.openfabrics.org> [mailto:nvmewin-bounces at lists.openfabrics.org] On Behalf Of Alex Chang
Sent: Friday, August 15, 2014 11:02 AM
To: Judy Brock-SSI; SUMAN PRAKASH B; nvmewin at lists.openfabrics.org<mailto:nvmewin at lists.openfabrics.org>
Subject: Re: [nvmewin] NVMe OFA Patch for Random bug fixes

Thanks, Judy, for letting me know.
Regards,
Alex

From: Judy Brock-SSI [mailto:judy.brock at ssi.samsung.com]
Sent: Thursday, August 14, 2014 11:51 PM
To: Alex Chang; SUMAN PRAKASH B; nvmewin at lists.openfabrics.org<mailto:nvmewin at lists.openfabrics.org>
Subject: RE: [nvmewin] NVMe OFA Patch for Random bug fixes

Hi Alex,
Please go ahead with your patch on Monday. Suman will be out of the office tomorrow (the 15th).  However, he is planning on looking into the crash on the 16th and should have an update by EOD 16th.
Thanks,
Judy

From: nvmewin-bounces at lists.openfabrics.org<mailto:nvmewin-bounces at lists.openfabrics.org> [mailto:nvmewin-bounces at lists.openfabrics.org] On Behalf Of Alex Chang
Sent: Thursday, August 14, 2014 9:45 AM
To: SUMAN PRAKASH B; nvmewin at lists.openfabrics.org<mailto:nvmewin at lists.openfabrics.org>
Subject: Re: [nvmewin] NVMe OFA Patch for Random bug fixes

Hi Suman,
Thank you so much for your effort.
I did a quick test on Windows 8.1 and it crashes the system right after installation. Have you seen that?
By the way, I thought PMC is the next to send patch out. Anyway, Could you please look into the crash? If it can be fixed by the end of tomorrow, we will start reviewing/testing your patch. Otherwise, I will send out PMC patch on Monday.
Regards,
Alex



From: nvmewin-bounces at lists.openfabrics.org<mailto:nvmewin-bounces at lists.openfabrics.org> [mailto:nvmewin-bounces at lists.openfabrics.org] On Behalf Of SUMAN PRAKASH B
Sent: Thursday, August 14, 2014 1:41 AM
To: nvmewin at lists.openfabrics.org<mailto:nvmewin at lists.openfabrics.org>
Subject: [nvmewin] NVMe OFA Patch for Random bug fixes


Content-Type: text/plain; charset=UTF-8

Content-Transfer-Encoding: 8bit

Date: %%SENT_DATE%%

Subject: Suspect Message Quarantined







WARNING: The virus scanner was unable to scan an attachment in an email message sent to you.  This attachment could possibly contain viruses or other malicious programs.  The attachment could not be scanned for the following reasons:



%%DESC%%



The full message and the attachment have been stored in the quarantine.



The identifier for this message is '%%QID%%'.



Access the quarantine at:

https://puremessage.pmc-sierra.bc.ca:28443/



For more information on PMC's Anti-Spam system:

http://pmc-intranet/wiki/index.php/Outlook:Anti-Spam_FAQ



IT Services

PureMessage Admin



Hi Everyone,



We have a patch for the following random bug fixes -

a. Invalid return value for NVMeAdapterControl.
b. Handling StartIo deadlock when MultipleCoresToSingleQueueFlag is set.
c. Support for STORAGE_REQUEST_BLOCK in DriverEntry.
d. Handling return value for NVMeCompleteCmd.
e. Handling return value for NVMeWaitForCtrlRDY.
f. Fixing the NVMeResetAdapter issues to check if CC.EN is set to 1 before setting to 0.
g. Memory corruption constructing inquiry response data in SntiTranslateStandardInquiryPage.
h. Eliminate NVMeWaitOnReady and use only NVMeWaitForCtrlRDY.
i. Fix the RecoveryDpcRoutine to avoid redundant setting of CC.EN bit to 0.
j. Write Buffer implementation correction.
k. Enabling Eject option in the taskbar.



Please send feedback by August 21st.  The password is samsung123



Change details -

1) Invalid return value for NVMeAdapterControl
NVMeAdapterControl miniport routine -  sometimes returns illegal value. WDK specifies that the driver must always return ScsiAdapterControlSuccess. However, depending on execution, the driver may currently return ScsiAdapterControlUnsuccessful for ScsiStopAdapter and ScsiRestartAdapter control types.
As per msdn – http://msdn.microsoft.com/en-us/library/windows/hardware/ff557365(v=vs.85).aspx
Affected Files/Functions:
        nvmeStd.c / NVMeAdapterControl()



2) Handling StartIo deadlock when MultipleCoresToSingleQueueFlag is set
Affected Files/Functions:
        Set the AcquireLock parameter to FALSE in the processio () in the below functions.
        nvmeSnti.c / SntiTranslateTemperatureResponse ()
        nvmeSnti.c / SntiTranslateStartStopUnitResponse ()
        nvmeStd.c / NVMeHandleSmartThresholds ()



3) Support for STORAGE_REQUEST_BLOCK in DriverEntry
Set the SrbTypeFlags in DriverEntry() function to support STORAGE_REQUEST_BLOCK.

Affected Files/Functions:
        nvmeStd.c / DriverEntry ():



4) Handlings return value for NVMeCompleteCmd.
NVMeCompleteCmd should have a return value that can be checked to see if it was successful or not. Right now, wherever it’s called from the code forges ahead regardless of whether it succeeded or failed:
VOID NVMeCompleteCmd{
. . .
if ((pCmdEntry->Pending == FALSE) || (pCmdEntry->Context == NULL)) {
/* Something bad happened so reset the adapter and hope for the best */
                  NVMeResetController(pAE, NULL);
                                    return;
}
As shown above, one of the routines which NVMeCompleteCmd calls is NVMeResetController. Since NVMeCompleteCmd has no return value, this fatal error return is never detected in any of the places that the function is called from (quite a few) - the logic just proceeds on as if everything is fine. In some cases NVMeCompleteCmd can be called over and over (if it is called from DetectPendingCmds or IoCompletionDpcRoutine for example) which may in turn cause repeated calls to NVMeResetController.
Affected Files/Functions:
        nvmeIo.c / ProcessIo ()
        nvmeIo.c / NVMeCompleteCmd ()
        nvmeIo.h / NVMeCompleteCmd ()
        nvmeStd.c / IoCompletionDpcRoutine ()



5) Handling return value for NVMeWaitForCtrlRDY
NVMeWaitForCtrlRDY should have a return value of type BOOLEAN that can be checked to see if it was successful or not.

Affected Files/Functions:
        nvmeStd.c / NVMeInitialize ()



6) Fixing the NVMeResetAdapter issues to check if CC.EN is set to 1 before setting to 0.
The routine NVMeResetAdapter() sets CC.EN to 0 without ever checking to make sure that CSTS.RDY is set to ‘1’ first. This check has to be included in this routine. Since it is not, there are many paths in the driver where there is no prior check for this condition:
a) NVMeInitAdminQueues -> NVMeEnableAdapter -> NVMeResetAdapter
b) NVMeNormalShutdown -> NVMeResetAdapter
c) NVMeAdapterControlPowerDown -> NVMeResetAdapter
d) NVMeSynchronizeReset -> NVMeResetAdapter

Affected Files/Functions:
        nvmeInit.c / NVMeResetAdapter ()



7) Memory corruption constructing inquiry response data in SntiTranslateStandardInquiryPage
Memory corruption constructing inquiry response data -  In SntiTranslateStandardInquiryPage(), the following line of code is touching a field way past the end of STANDARD_INQUIRY_LENGTH (36 bytes):
pStdInquiry->Reserved3[0]        = RESERVED_FIELD;

Affected Files/Functions:
        nvmeSnti.c / SntiTranslateStandardInquiryPage ()



8) Eliminate NVMeWaitOnReady and use only NVMeWaitForCtrlRDY.
There is redundancy in the new routine NVMeWaitForCtrlRDY() and the old routine NVMeWaitOnReady(). We don’t need both – we can get rid of the old routine.

Affected Files/Functions:
        nvmeInit.c / NVMeResetAdapter ()



9) Fix the RecoveryDpcRoutine to avoid redundant setting of CC.EN bit to 0.
The code does not need to set CC.EN to ‘0’ and then wait for CSTS.RDY to become 0 because right after it does so, it calls NVMeResetAdapter which does the exact same thing.

Affected Files/Functions:
        nvmeStd.c / RecoveryDpcRoutine ()



10) Write Buffer implementation correction.
a. Calculation of dword10 for DOWNLOAD_SAVE_ACTIVATE and DOWNLOAD_SAVE_DEFER_ACTIVATE is modified.
b. Set the SRB Status value for NVMe command failure condition in SntiCompletionCallbackRoutine.
c. Prepare the Firmware Activate Command and issue the command in case of DOWNLOAD_SAVE_ACTIVATE mode in SntiTranslateWriteBufferResponse.
d. Handled the scenario of SNTI_SEQUENCE_IN_PROGRESS for Write Data Buffer command.

Affected Files/Functions:
        nvmeSnti.c / SntiCompletionCallbackRoutine
        nvmeSnti.c / SntiTranslateWriteBufferResponse



11) Enabling Eject option in the taskbar:
Affected Files/Functions:
        nvmeStd.c / DriverEntry (): Set the FeatureSupport flag to STOR_FEATURE_FULL_PNP_DEVICE_CAPABILITIES.

        nvmeStd.c / NVMeBuildIo (): Use the PSTOR_DEVICE_CAPABILITIES_EX structure for PNPAction StorQueryCapabilities. Set the Removable flag to TRUE.



Unit tests:
Win7/8/8.1, Server 2008R2/2012/2012R2



Thanks,

Suman





















[cid:image001.gif at 01CFBB8D.43107A90]

[Image removed by sender.]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/nvmewin/attachments/20140819/3e6866ab/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ~WRD000.jpg
Type: image/jpeg
Size: 823 bytes
Desc: ~WRD000.jpg
URL: <http://lists.openfabrics.org/pipermail/nvmewin/attachments/20140819/3e6866ab/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 13168 bytes
Desc: image001.gif
URL: <http://lists.openfabrics.org/pipermail/nvmewin/attachments/20140819/3e6866ab/attachment.gif>


More information about the nvmewin mailing list