Hi All:
In our IRP_MJ_INTERNAL_DEVICE_CONTROL Handler, we wrote as following:
NTSTATUS
Handler_for_IRP_MJ_INTERNAL_DEVICE_CONTROL(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
)
{
…
Deliver_The_Irp_To_Hardware_To_Process(Irp);
// This Irp will be returned in Interrupt routine.
IoMarkIrpPending(Irp);
return STATUS_PENDING;
}
BOOLEAN
InterruptServiceRoutine(
IN PKINTERRUPT Interrupt,
IN PVOID ServiceContext
)
{
dx = (PDeviceExtension)ServiceContext;
…
if (TRUE == Int_Occurred_for_Completed_Irp)
{
IoQueueWorkItem(dx->WorkItem, (PIO_WORKITEM_ROUTINE)IntWorkerRoutine, DelayedWorkQueue, (PVOID)dx);
}
…
}
VOID
IntWorkerRoutine(
IN PDEVICE_OBJECT DeviceObject,
IN PVOID Context
)
{
PIRP Irp;
…
Irp = Fetch_Completed_Irp();
IoCompleteRequest(Irp);
…
}
When the Irp is finished in IntWorkerRoutine, bugcheck is raised
*** Fatal System Error: 0x0000000a
(0x00000008,0x00000002,0x00000000,0x8042E326)
Is there something wrong with this achitecture?
And how can I complete the Irp in an Interrupt?
Thanks a lot!
Kamasamikon
The normal logic is to queue a DPC in the ISR. The DPC, which runs at
DISPATCH_LEVEL, usually, should then queue the worker thread queue item.
----- Original Message -----
From: “Kamasamikon”
To: “NT Developers Interest List”
Sent: Sunday, October 20, 2002 6:36 AM
Subject: [ntdev] Complete an Irp in Interrupt routine
> Hi All:
>
> In our IRP_MJ_INTERNAL_DEVICE_CONTROL Handler, we wrote as following:
>
> NTSTATUS
> Handler_for_IRP_MJ_INTERNAL_DEVICE_CONTROL(
> IN PDEVICE_OBJECT DeviceObject,
> IN PIRP Irp
> )
> {
> …
>
> Deliver_The_Irp_To_Hardware_To_Process(Irp);
> // This Irp will be returned in Interrupt routine.
>
> IoMarkIrpPending(Irp);
> return STATUS_PENDING;
> }
>
> BOOLEAN
> InterruptServiceRoutine(
> IN PKINTERRUPT Interrupt,
> IN PVOID ServiceContext
> )
> {
> dx = (PDeviceExtension)ServiceContext;
> …
> if (TRUE == Int_Occurred_for_Completed_Irp)
> {
> IoQueueWorkItem(dx->WorkItem, (PIO_WORKITEM_ROUTINE)IntWorkerRoutine,
DelayedWorkQueue, (PVOID)dx);
> }
> …
> }
>
> VOID
> IntWorkerRoutine(
> IN PDEVICE_OBJECT DeviceObject,
> IN PVOID Context
> )
> {
> PIRP Irp;
>
> …
>
> Irp = Fetch_Completed_Irp();
>
> IoCompleteRequest(Irp);
>
> …
> }
>
> When the Irp is finished in IntWorkerRoutine, bugcheck is raised
>
> *** Fatal System Error: 0x0000000a
> (0x00000008,0x00000002,0x00000000,0x8042E326)
>
> Is there something wrong with this achitecture?
> And how can I complete the Irp in an Interrupt?
>
> Thanks a lot!
>
> Kamasamikon
> b???m???>.??zf?-?%y??z?^??x"X???,??&
You cannot call IoQueueWorkItem from the ISR. You can only
KeInsertQueueDpc from the ISR, and IoQueueWorkItem from the DPC. The
second step is usually not necessary - just complete from the DPC.
Max
----- Original Message -----
From: “Kamasamikon”
To: “NT Developers Interest List”
Sent: Sunday, October 20, 2002 2:36 PM
Subject: [ntdev] Complete an Irp in Interrupt routine
> Hi All:
>
> In our IRP_MJ_INTERNAL_DEVICE_CONTROL Handler, we wrote as
following:
>
> NTSTATUS
> Handler_for_IRP_MJ_INTERNAL_DEVICE_CONTROL(
> IN PDEVICE_OBJECT DeviceObject,
> IN PIRP Irp
> )
> {
> …
>
> Deliver_The_Irp_To_Hardware_To_Process(Irp);
> // This Irp will be returned in Interrupt routine.
>
> IoMarkIrpPending(Irp);
> return STATUS_PENDING;
> }
>
> BOOLEAN
> InterruptServiceRoutine(
> IN PKINTERRUPT Interrupt,
> IN PVOID ServiceContext
> )
> {
> dx = (PDeviceExtension)ServiceContext;
> …
> if (TRUE == Int_Occurred_for_Completed_Irp)
> {
> IoQueueWorkItem(dx->WorkItem,
(PIO_WORKITEM_ROUTINE)IntWorkerRoutine, DelayedWorkQueue, (PVOID)dx);
> }
> …
> }
>
> VOID
> IntWorkerRoutine(
> IN PDEVICE_OBJECT DeviceObject,
> IN PVOID Context
> )
> {
> PIRP Irp;
>
> …
>
> Irp = Fetch_Completed_Irp();
>
> IoCompleteRequest(Irp);
>
> …
> }
>
> When the Irp is finished in IntWorkerRoutine, bugcheck is raised
>
> *** Fatal System Error: 0x0000000a
> (0x00000008,0x00000002,0x00000000,0x8042E326)
>
> Is there something wrong with this achitecture?
> And how can I complete the Irp in an Interrupt?
>
> Thanks a lot!
>
> Kamasamikon
>
bþxØyb²Û(²·(
Hi David and Max:
I have tried that in a dpc, but bugcheck is still there. Is there some limitation when call IoCompleteRequest?
Best Regards!
Kamasamikon
----- Original Message -----
From: “Maxim S. Shatskih”
To: “NT Developers Interest List”
Sent: Sunday, October 20, 2002 20:20
Subject: [ntdev] Re: Complete an Irp in Interrupt routine
You cannot call IoQueueWorkItem from the ISR. You can only
KeInsertQueueDpc from the ISR, and IoQueueWorkItem from the DPC. The
second step is usually not necessary - just complete from the DPC.
Max
----- Original Message -----
From: “Kamasamikon”
To: “NT Developers Interest List”
Sent: Sunday, October 20, 2002 2:36 PM
Subject: [ntdev] Complete an Irp in Interrupt routine
> Hi All:
>
> In our IRP_MJ_INTERNAL_DEVICE_CONTROL Handler, we wrote as
following:
>
> NTSTATUS
> Handler_for_IRP_MJ_INTERNAL_DEVICE_CONTROL(
> IN PDEVICE_OBJECT DeviceObject,
> IN PIRP Irp
> )
> {
> …
>
> Deliver_The_Irp_To_Hardware_To_Process(Irp);
> // This Irp will be returned in Interrupt routine.
>
> IoMarkIrpPending(Irp);
> return STATUS_PENDING;
> }
>
> BOOLEAN
> InterruptServiceRoutine(
> IN PKINTERRUPT Interrupt,
> IN PVOID ServiceContext
> )
> {
> dx = (PDeviceExtension)ServiceContext;
> …
> if (TRUE == Int_Occurred_for_Completed_Irp)
> {
> IoQueueWorkItem(dx->WorkItem,
(PIO_WORKITEM_ROUTINE)IntWorkerRoutine, DelayedWorkQueue, (PVOID)dx);
> }
> …
> }
>
> VOID
> IntWorkerRoutine(
> IN PDEVICE_OBJECT DeviceObject,
> IN PVOID Context
> )
> {
> PIRP Irp;
>
> …
>
> Irp = Fetch_Completed_Irp();
>
> IoCompleteRequest(Irp);
>
> …
> }
>
> When the Irp is finished in IntWorkerRoutine, bugcheck is raised
>
> *** Fatal System Error: 0x0000000a
> (0x00000008,0x00000002,0x00000000,0x8042E326)
>
> Is there something wrong with this achitecture?
> And how can I complete the Irp in an Interrupt?
>
> Thanks a lot!
>
> Kamasamikon
>
b?x?yb??(??(
—
You are currently subscribed to ntdev as: xxxxx@bhnec.nec.co.jp
To unsubscribe send a blank email to xxxxx@lists.osr.com
What is the bugcheck and the call stack in a DPC case?
Max
----- Original Message -----
From: “YuWenbin”
To: “NT Developers Interest List”
Sent: Monday, October 21, 2002 9:09 AM
Subject: [ntdev] Re: Complete an Irp in Interrupt routine
> Hi David and Max:
> I have tried that in a dpc, but bugcheck is still there. Is
there some limitation when call IoCompleteRequest?
>
> Best Regards!
> Kamasamikon
>
>
> ----- Original Message -----
> From: “Maxim S. Shatskih”
> To: “NT Developers Interest List”
> Sent: Sunday, October 20, 2002 20:20
> Subject: [ntdev] Re: Complete an Irp in Interrupt routine
>
>
> You cannot call IoQueueWorkItem from the ISR. You can only
> KeInsertQueueDpc from the ISR, and IoQueueWorkItem from the DPC. The
> second step is usually not necessary - just complete from the DPC.
>
> Max
>
> ----- Original Message -----
> From: “Kamasamikon”
> To: “NT Developers Interest List”
> Sent: Sunday, October 20, 2002 2:36 PM
> Subject: [ntdev] Complete an Irp in Interrupt routine
>
>
> > Hi All:
> >
> > In our IRP_MJ_INTERNAL_DEVICE_CONTROL Handler, we wrote as
> following:
> >
> > NTSTATUS
> > Handler_for_IRP_MJ_INTERNAL_DEVICE_CONTROL(
> > IN PDEVICE_OBJECT DeviceObject,
> > IN PIRP Irp
> > )
> > {
> > …
> >
> > Deliver_The_Irp_To_Hardware_To_Process(Irp);
> > // This Irp will be returned in Interrupt routine.
> >
> > IoMarkIrpPending(Irp);
> > return STATUS_PENDING;
> > }
> >
> > BOOLEAN
> > InterruptServiceRoutine(
> > IN PKINTERRUPT Interrupt,
> > IN PVOID ServiceContext
> > )
> > {
> > dx = (PDeviceExtension)ServiceContext;
> > …
> > if (TRUE == Int_Occurred_for_Completed_Irp)
> > {
> > IoQueueWorkItem(dx->WorkItem,
> (PIO_WORKITEM_ROUTINE)IntWorkerRoutine, DelayedWorkQueue,
(PVOID)dx);
> > }
> > …
> > }
> >
> > VOID
> > IntWorkerRoutine(
> > IN PDEVICE_OBJECT DeviceObject,
> > IN PVOID Context
> > )
> > {
> > PIRP Irp;
> >
> > …
> >
> > Irp = Fetch_Completed_Irp();
> >
> > IoCompleteRequest(Irp);
> >
> > …
> > }
> >
> > When the Irp is finished in IntWorkerRoutine, bugcheck is raised
> >
> > *** Fatal System Error: 0x0000000a
> >
(0x00000008,0x00000002,0x00000000,0x8042E326)
> >
> > Is there something wrong with this achitecture?
> > And how can I complete the Irp in an Interrupt?
> >
> > Thanks a lot!
> >
> > Kamasamikon
> >
>
b> þxØyb²Û(²·(
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@bhnec.nec.co.jp
> To unsubscribe send a blank email to %%email.unsub%%
> b<ç®·¶\¹»®&vÚµ×jÉÆ)¶Sçiû¢dº{nÇ?·zwnV’éS[.æz{zþØy²Û²·
you are posting the IRP to your controller and then marking it pending in your dispatch routine. This alone is bad (Unless there’s some synchronization there you haven’t mentioned) since you could eaisly take the interrurpt, post the work item and call IoCompleteRequest before the dispatching thread is allowed to mark the irp pending.
you must mark the IRP pending before you post it to your controller. Not sure if this is the problem causing your crash - there’s still the issue that you can’t post a worker item from an ISR (you should queue a DPC instead and have that queue the work item), but it’s a problem.
-p
-----Original Message-----
From: YuWenbin [mailto:xxxxx@bhnec.nec.co.jp]
Sent: Sunday, October 20, 2002 10:09 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Complete an Irp in Interrupt routine
Hi David and Max:
I have tried that in a dpc, but bugcheck is still there. Is there some limitation when call IoCompleteRequest?
Best Regards!
Kamasamikon
----- Original Message -----
From: “Maxim S. Shatskih”
To: “NT Developers Interest List”
Sent: Sunday, October 20, 2002 20:20
Subject: [ntdev] Re: Complete an Irp in Interrupt routine
You cannot call IoQueueWorkItem from the ISR. You can only KeInsertQueueDpc from the ISR, and IoQueueWorkItem from the DPC. The second step is usually not necessary - just complete from the DPC.
Max
----- Original Message -----
From: “Kamasamikon”
To: “NT Developers Interest List”
Sent: Sunday, October 20, 2002 2:36 PM
Subject: [ntdev] Complete an Irp in Interrupt routine
> Hi All:
>
> In our IRP_MJ_INTERNAL_DEVICE_CONTROL Handler, we wrote as
following:
>
> NTSTATUS
> Handler_for_IRP_MJ_INTERNAL_DEVICE_CONTROL(
> IN PDEVICE_OBJECT DeviceObject,
> IN PIRP Irp
> )
> {
> …
>
> Deliver_The_Irp_To_Hardware_To_Process(Irp);
> // This Irp will be returned in Interrupt routine.
>
> IoMarkIrpPending(Irp);
> return STATUS_PENDING;
> }
>
> BOOLEAN
> InterruptServiceRoutine(
> IN PKINTERRUPT Interrupt,
> IN PVOID ServiceContext
> )
> {
> dx = (PDeviceExtension)ServiceContext;
> …
> if (TRUE == Int_Occurred_for_Completed_Irp)
> {
> IoQueueWorkItem(dx->WorkItem,
(PIO_WORKITEM_ROUTINE)IntWorkerRoutine, DelayedWorkQueue, (PVOID)dx);
> }
> …
> }
>
> VOID
> IntWorkerRoutine(
> IN PDEVICE_OBJECT DeviceObject,
> IN PVOID Context
> )
> {
> PIRP Irp;
>
> …
>
> Irp = Fetch_Completed_Irp();
>
> IoCompleteRequest(Irp);
>
> …
> }
>
> When the Irp is finished in IntWorkerRoutine, bugcheck is raised
>
> *** Fatal System Error: 0x0000000a
> (0x00000008,0x00000002,0x00000000,0x8042E326)
>
> Is there something wrong with this achitecture?
> And how can I complete the Irp in an Interrupt?
>
> Thanks a lot!
>
> Kamasamikon
>
bþxØyb²Û(²·(
—
You are currently subscribed to ntdev as: xxxxx@bhnec.nec.co.jp To unsubscribe send a blank email to xxxxx@lists.osr.com b‹ç®·¶\¹»®&vÚµ×jʵê‰érº¡û¢dº{nlj·zwnV‘éŠ[•æz{zÿß²ŠË¢Ê