]> git.proxmox.com Git - mirror_edk2.git/commit - MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
MdeModulePkg ScsiDiskDxe: Raise the Tpl of async IO callback to TPL_NOTIFY
authorHao Wu <hao.a.wu@intel.com>
Tue, 22 Dec 2015 13:57:42 +0000 (13:57 +0000)
committerhwu1225 <hwu1225@Edk2>
Tue, 22 Dec 2015 13:57:42 +0000 (13:57 +0000)
commita717086c5f973821b9b49646a4ec725f6b898bdb
tree288bf2bf9d13d949eb6349736dce2a2a2c2c50c3
parentd7617bad96979cb1a5ecfbb56a05b97838bbbbb7
MdeModulePkg ScsiDiskDxe: Raise the Tpl of async IO callback to TPL_NOTIFY

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.

Hence, this commit will raise the Tpl of async IO callback in ScsiDiskDxe
to TPL_NOTIFY so that the indefinite wait in DiskIoDxe can be avoided.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19452 6f19259b-4bc3-4df7-8a09-765794883524
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h