Thanks for the feedback. I will update the codes before committing the patches.
Best Regards, Hao Wu > -----Original Message----- > From: Tian, Feng > Sent: Tuesday, December 22, 2015 3:06 PM > To: Wu, Hao A; [email protected] > Cc: Wu, Hao A; Tian, Feng > Subject: RE: [edk2] [PATCH 0/4] Raise Tpl to TPL_NOTIFY when dealing SCSI > async I/O > > I think as you raise notify event from callback to notify you have to protect > critical data, mainly the transfer queue, by raising TPL to NOTIFY at > accessing > code as well. > > Others look good to me. > > Reviewed-by: Feng Tian <[email protected]> > > -----Original Message----- > From: edk2-devel [mailto:[email protected]] On Behalf Of > Hao Wu > Sent: Tuesday, December 22, 2015 00:15 > To: [email protected]; Tian, Feng > Cc: Wu, Hao A > Subject: [edk2] [PATCH 0/4] Raise Tpl to TPL_NOTIFY when dealing SCSI async > I/O > > When reading data from non-blockingly from a CD-ROM logic partition, the > procedure can be shown by the following call stack: > (The write process is similar) > > |-------------------| > | DiskIoDxe (logic) |<---Raise Tpl to TPL_CALLBACK > |-------------------| > | > | Sub-task 1 (UnderRun) succeeds > | > | |-----------------| |-----------------| |-----------------| > +--->| PartitionDxe |---->| DiskIoDxe (Phy) |---->| ScsiDiskDxe | > | |-----------------| |-----------------| |-----------------| > | > | Sub-task 2 (OverRun) fails > | > | |-----------------| |-----------------| |-----------------| > +--->| PartitionDxe |---->| DiskIoDxe (Phy) |---->| ScsiDiskDxe | > | |-----------------| |-----------------| |-----------------| > | ^ > | | > More subtasks... Wait indefinitely > | > |<---Restore Tpl > | > Completes > > In PartitionDxe, if the 'Lba' and 'BufferSize' parameters passed to function > PartitionReadBlocksEx() are invalid, the function will issue a blocking > ReadDisk call (in function ProbeMediaStatusEx()). > > In DiskIoDxe, blocking I/O request will wait for all the non-blocking I/O > requests to complete first before sending down the blocking request. > > If the Tpl of the async I/O callback in ScsiDiskDxe is TPL_CALLBACK and Sub- > task 1 (UnderRun) succeeds but Sub-task 2 (OverRun) fails with an invalid > parameter, DiskIoDxe will wait indefinitely for the event created by > ScsiDiskDxe of Sub-task 1 to signal. > > Therefore, the async I/O callback functions in ScsiDiskDxe, ScsiBusDxe and > UefiScsiLib need to raise Tpl to TPL_NOTIFY to avoid the above-mentioned > indefinite wait. Plus, the UFS PassThru driver also needs to raise Tpl to > TPL_NOTIFY when processing async SCSI task list. > > Hao Wu (4): > MdeModulePkg ScsiDiskDxe: Raise the Tpl of async IO callback to > TPL_NOTIFY > MdePkg UefiScsiLib: Raise the Tpl of async IO callback to TPL_NOTIFY > MdeModulePkg ScsiBusDxe: Raise the Tpl of async IO callback to > TPL_NOTIFY > MdeModulePkg UfsPassThruDxe: Raise to TPL_NOTIFY when dealing async > task > > MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c | 2 +- > MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 59 > ++++++++++++++++++---- > MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h | 8 ++- > MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c | 2 +- > .../Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 2 +- > MdePkg/Library/UefiScsiLib/UefiScsiLib.c | 8 +-- > 6 files changed, 62 insertions(+), 19 deletions(-) > > -- > 1.9.5.msysgit.0 > > _______________________________________________ > edk2-devel mailing list > [email protected] > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

