[nvmewin] Samsung Patch for Bus Reset Enhancements

Alex Chang Alex.Chang at pmcs.com
Tue Oct 21 13:20:29 PDT 2014


Hi Suman,

(1) There is a call of StorPortResume(pAE) in Line2434 of nvmestd.c, which is redundant because, when NextDriverState is NVMeStartComplete, in the end of NVMeRunning, StorPortResume had been called already.

(2) To comply with our agreed coding style and make the logic easier, may I suggest changing Line#184 of nvmestat.c to:

if (pAE->ntldrDump == FALSE) {
    if (pAE->polledMode == FALSE) {
        NVMeRunning(pAE);
    } else {
        /* 
         * we poll if we're launching the reinit state machine from HwStorResetBus
         * or HwStorAdapterControl->ScsiRestartAdapter path
         */
        NVMeRunning(pAE);
        /* TO val is based on CAP register plus a few, 5, seconds to init post RDY */
        passiveTimeout = pAE->uSecCrtlTimeout + (STORPORT_TIMER_CB_us * MICRO_TO_SEC);
        ...
        return (pAE->DriverState.NextDriverState == NVMeStartComplete) ? TRUE : FALSE;
   }
} else {
    PRES_MAPPING_TBL pRMT = &pAE->ResMapTbl;
    .....
}

Thank you!
Alex

From: SUMAN PRAKASH B [mailto:suman.p at samsung.com] 
Sent: Wednesday, October 15, 2014 6:00 AM
To: nvmewin at lists.openfabrics.org
Cc: Alex Chang; cgps at samsung.com
Subject: Samsung Patch for Bus Reset Enhancements

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 Bus Reset Enhancements.
Please find attached the source code. The password is samsung123
 
Please find the change description below - 
 
1. There are multiple paths in the driver that reset the controller and execute the initialization state machine.  Our patch is not concerned with the majority of those paths. Aside from a few additional isolated modifications, our patch focuses on the two paths that are supposed to be synchronous -i.e. they should not return to caller until all work is completed -  but which currently are not so. They are:
a) NVMeResetBus (and)
b) NVMeAdapterControl-> ScsiRestartAdapter
We have introduced a new routine NVMeReInitializeController(), which will be invoked from NVMeReseBus() and NVMeAdapterControl() - ScsiRestartAdapter. This routine will reset and initialize the controller and then complete the requests. It will not return until the initialization state machine is complete.
We disallow processing of any SRB in NVMeStartIo() when NextDriverState != NVMeStateComplete. In this way we direct the PowerUp operations to be executed in NVMeAdapterControl() - ScsiRestartAdapter only. When resuming from hibernation for example, NVMeStartio() will not process the POWER SRB. Instead, the Power Up operations will be invoked in NVMeAdapterControl()->ScsiRestartAdapter.
 
Additionally , Miniport drivers should disregard requests to reset the bus when ntldrDump is set to TRUE in NvmeResetBus(). But current implementation processes this request.

2. When pAE->ntldrDump is TRUE, in the NVMeMapCore2Queue() routine, the pPGT value is NULL. Hence a BSOD occurs when executing ULONG coreNum = (ULONG)(pPN->Number + pPGT->BaseProcessor). We fixed the problem by moving access to pPGT when ntldrDump is FALSE.
 
3. In ProcessIo(), when IoStatus is set to NOT_SUBMITTED, the SRB is not completed. Due to this, a BSOD was occuring when executing WHCK test "DP WLK - Hot-Add - Device test". We  fixed the problem by changing the code to complete SRB when IoStatus is NOT_SUBMITTED.
 
4. We changed the use of StorPortBusy()/StorPortReady() to StorPortPause()/StorPortResume(), since StorPortBusy() will not prevent new IOS from coming in once the current ones in the driver have been completed.
 
 
Tested the following on Win7 and Windows 2012R2.
- WHCK
- Install/Uninstall, Enable/Disable, FS Format
- Hibernation/Resume, Sleep/Resume
- IOmeter
 
Thanks,
Suman
 





More information about the nvmewin mailing list