create/close dispatch issue

hi, all,

Now i modify the bus sample driver.
As we know, that bus sample driver, use Enum.exe to create a PDO on the bus FDO.
And each time Enum.exe is called, the dispatch routine of Bus_CreateClose() is called, in this routine, use a PAGED_CODE (),
which means that Bus_CreateClose() should run on PASSIVE_LEVEL.

But my modified bus driver have another routine:
DriverObject->MajorFunction[IRP_MJ_SCSI] = ScsiProcess;
In this routine, I will use usb bulk transfer, as we know, that bulk transfer run in DISPATCH LEVEL.
And also, the bulk transfer have a completion routine, i read some book, it seems that completion routine also run on DISPATCH_LEVEL.

Now my code face a bug I could not fix:
When I run Enum.exe to create a PDO.
Then Bus_CreateClose() is invoked, for the create case.
And after the PDO is created, the ScsiProcess, and the bulk transfer and its completion routine is called.
then Bus_CreateClose() is invoked, for the close case.

I have the question:

  1. Does the phenomenon i described means that, IRP_MJ_SCSI irp could interrupt the IRP_MJ_CREATE,IRP_MJ_CLOSE irp?
  2. Why the Bus_CreateClose() for the close case will lead to the PAGED_CODE () failed, when there is bulk transfer in ScsiProcess?
  3. Does my ScsiProcess code run to much time?

I don’t think IRP_MJ_SCSI is guaranteed to be called on DISPATCH_LEVEL.

Mark Roddy

2011/6/16 workingmailing :
> I have the question:
> 1. Does the phenomenon i described means that, IRP_MJ_SCSI irp could
> interrupt the IRP_MJ_CREATE,IRP_MJ_CLOSE irp?

Sure. Or run concurrently on another processor.

> 2. Why the Bus_CreateClose()? for the close case will lead to the PAGED_CODE
> () failed, when there is bulk transfer in ScsiProcess?

Probably because you have a bug in your code?

> 3. Does my ScsiProcess code run to much time?
>
I have no idea, does it?