WdfQueue Problem

I have a bus driver which creates Pdo’s and WDFQueue objects for thos
PDO’s. Queue is set up for parallel dispatching.

I am seeing that in some cases my PDO gets stuck and just wouldn’t go
away no matter how many times I report it missing. It was a clear
symptom of either a reference to the device or some pending IRP in the
system.

Here is the dump of my WdfQueue:

!wdfkd.wdfqueue 0x7D38C4C0

Dumping WDFQUEUE 0x7d38c4c0

=========================

Parallel, Power-managed, PowerOff, Can accept, Can dispatch,
ExecutionLevelDispatch, SynchronizationScopeNone

Number of driver owned requests: 0

Number of waiting requests: 1

!WDFREQUEST 0x7d40f258 !IRP 0x82d9b008

EvtIoDefault: (0xf427cec0) bus!Device_EvtIoDefault

EvtIoRead: (0xf427cf10) bus!Device_EvtIoRead

EvtIoWrite: (0xf427cf40) bus!Device_EvtIoWrite

EvtIoDeviceControl: (0xf427cf70) bus!Device_EvtIoDeviceControl

EvtIoInternalDeviceControl: (0xf427d2b0)
bus!Device_EvtIoInternalDeviceControl

kd> !WDFREQUEST 0x7d40f258

!IRP 0x82d9b008

!WDFQUEUE 0x7d38c4c0

State: Pending, Allocated by WDF for incoming IRP

I am 100% sure that the WdfRequest that is pending here, was never
actually delivered to me. I print every request coming into my EvtIOXXX
routines. This seems to me like this is a request that was about to be
delivered (still belongs to framework) but now its stuck.

How do I cleanup this situation? In fact what’s the best way to Stop a
queue so that this wont happen in the first place. Even if this happens,
I would like to somehow get rid of this Request while still processing
the requests that have already been given to me by the framework.

Thanks

Pankaj

What is the current state of the PDO (!wdfkd.wdfdevice [wdfdevice] 0xfff) ?

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Thursday, January 10, 2008 3:55 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] WdfQueue Problem

I have a bus driver which creates Pdo’s and WDFQueue objects for thos PDO’s. Queue is set up for parallel dispatching.

I am seeing that in some cases my PDO gets stuck and just wouldn’t go away no matter how many times I report it missing. It was a clear symptom of either a reference to the device or some pending IRP in the system.

Here is the dump of my WdfQueue:

!wdfkd.wdfqueue 0x7D38C4C0

Dumping WDFQUEUE 0x7d38c4c0

Parallel, Power-managed, PowerOff, Can accept, Can dispatch, ExecutionLevelDispatch, SynchronizationScopeNone
Number of driver owned requests: 0
Number of waiting requests: 1
!WDFREQUEST 0x7d40f258 !IRP 0x82d9b008

EvtIoDefault: (0xf427cec0) bus!Device_EvtIoDefault
EvtIoRead: (0xf427cf10) bus!Device_EvtIoRead
EvtIoWrite: (0xf427cf40) bus!Device_EvtIoWrite
EvtIoDeviceControl: (0xf427cf70) bus!Device_EvtIoDeviceControl
EvtIoInternalDeviceControl: (0xf427d2b0) bus!Device_EvtIoInternalDeviceControl
kd> !WDFREQUEST 0x7d40f258
!IRP 0x82d9b008
!WDFQUEUE 0x7d38c4c0
State: Pending, Allocated by WDF for incoming IRP

I am 100% sure that the WdfRequest that is pending here, was never actually delivered to me. I print every request coming into my EvtIOXXX routines. This seems to me like this is a request that was about to be delivered (still belongs to framework) but now its stuck.

How do I cleanup this situation? In fact what’s the best way to Stop a queue so that this wont happen in the first place. Even if this happens, I would like to somehow get rid of this Request while still processing the requests that have already been given to me by the framework.

Thanks
Pankaj


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Doron,

I was hoping you’d respond :-). I forgot to paste that outout in last
email

Dumping WDFDEVICE 0x7d38ad48

=================================

WDM PDEVICE_OBJECTs: self 82e17828

Pnp state: 119 ( WdfDevStatePnpStarted )

Power state: 31f ( WdfDevStatePowerDx )

Power Pol state: 571 ( WdfDevStatePwrPolDx )

Parent WDFDEVICE 7d42bfe8

Parent states:

Pnp state: 119 ( WdfDevStatePnpStarted )

Power state: 307 ( WdfDevStatePowerD0 )

Power Pol state: 565 ( WdfDevStatePwrPolStarted )

Since then I have started calling the WdfIoQueuePurge call in the code.
Is that something you’d recommend?

-pankaj


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, January 10, 2008 4:06 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] WdfQueue Problem

What is the current state of the PDO (!wdfkd.wdfdevice [wdfdevice]
0xfff) ?

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Thursday, January 10, 2008 3:55 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] WdfQueue Problem

I have a bus driver which creates Pdo’s and WDFQueue objects for thos
PDO’s. Queue is set up for parallel dispatching.

I am seeing that in some cases my PDO gets stuck and just wouldn’t go
away no matter how many times I report it missing. It was a clear
symptom of either a reference to the device or some pending IRP in the
system.

Here is the dump of my WdfQueue:

!wdfkd.wdfqueue 0x7D38C4C0

Dumping WDFQUEUE 0x7d38c4c0

=========================

Parallel, Power-managed, PowerOff, Can accept, Can dispatch,
ExecutionLevelDispatch, SynchronizationScopeNone

Number of driver owned requests: 0

Number of waiting requests: 1

!WDFREQUEST 0x7d40f258 !IRP 0x82d9b008

EvtIoDefault: (0xf427cec0) bus!Device_EvtIoDefault

EvtIoRead: (0xf427cf10) bus!Device_EvtIoRead

EvtIoWrite: (0xf427cf40) bus!Device_EvtIoWrite

EvtIoDeviceControl: (0xf427cf70) bus!Device_EvtIoDeviceControl

EvtIoInternalDeviceControl: (0xf427d2b0)
bus!Device_EvtIoInternalDeviceControl

kd> !WDFREQUEST 0x7d40f258

!IRP 0x82d9b008

!WDFQUEUE 0x7d38c4c0

State: Pending, Allocated by WDF for incoming IRP

I am 100% sure that the WdfRequest that is pending here, was never
actually delivered to me. I print every request coming into my EvtIOXXX
routines. This seems to me like this is a request that was about to be
delivered (still belongs to framework) but now its stuck.

How do I cleanup this situation? In fact what’s the best way to Stop a
queue so that this wont happen in the first place. Even if this happens,
I would like to somehow get rid of this Request while still processing
the requests that have already been given to me by the framework.

Thanks

Pankaj


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

The PDO is not in any state where it has been removed or reported as missing (!wdfdevice on the parent FDO will give you the WDFCHILDLIST that was used to enumerate the PDO, !wdfchildlist [handle] will give you the current reported state as KMDF thinks it is) so the queue state is just fine (power managed, off). Since (assuming) the PDO is not the power policy owner, the queue will not present until the policy owner wakes up the stack. I don’t understand what the problem is in the current state.

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Thursday, January 10, 2008 4:20 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WdfQueue Problem

Doron,

I was hoping you’d respond :). I forgot to paste that outout in last email

Dumping WDFDEVICE 0x7d38ad48

WDM PDEVICE_OBJECTs: self 82e17828

Pnp state: 119 ( WdfDevStatePnpStarted )
Power state: 31f ( WdfDevStatePowerDx )
Power Pol state: 571 ( WdfDevStatePwrPolDx )

Parent WDFDEVICE 7d42bfe8
Parent states:
Pnp state: 119 ( WdfDevStatePnpStarted )
Power state: 307 ( WdfDevStatePowerD0 )
Power Pol state: 565 ( WdfDevStatePwrPolStarted )

Since then I have started calling the WdfIoQueuePurge call in the code. Is that something you’d recommend?

-pankaj


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, January 10, 2008 4:06 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] WdfQueue Problem

What is the current state of the PDO (!wdfkd.wdfdevice [wdfdevice] 0xfff) ?

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Thursday, January 10, 2008 3:55 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] WdfQueue Problem

I have a bus driver which creates Pdo’s and WDFQueue objects for thos PDO’s. Queue is set up for parallel dispatching.

I am seeing that in some cases my PDO gets stuck and just wouldn’t go away no matter how many times I report it missing. It was a clear symptom of either a reference to the device or some pending IRP in the system.

Here is the dump of my WdfQueue:

!wdfkd.wdfqueue 0x7D38C4C0

Dumping WDFQUEUE 0x7d38c4c0

Parallel, Power-managed, PowerOff, Can accept, Can dispatch, ExecutionLevelDispatch, SynchronizationScopeNone
Number of driver owned requests: 0
Number of waiting requests: 1
!WDFREQUEST 0x7d40f258 !IRP 0x82d9b008

EvtIoDefault: (0xf427cec0) bus!Device_EvtIoDefault
EvtIoRead: (0xf427cf10) bus!Device_EvtIoRead
EvtIoWrite: (0xf427cf40) bus!Device_EvtIoWrite
EvtIoDeviceControl: (0xf427cf70) bus!Device_EvtIoDeviceControl
EvtIoInternalDeviceControl: (0xf427d2b0) bus!Device_EvtIoInternalDeviceControl
kd> !WDFREQUEST 0x7d40f258
!IRP 0x82d9b008
!WDFQUEUE 0x7d38c4c0
State: Pending, Allocated by WDF for incoming IRP

I am 100% sure that the WdfRequest that is pending here, was never actually delivered to me. I print every request coming into my EvtIOXXX routines. This seems to me like this is a request that was about to be delivered (still belongs to framework) but now its stuck.

How do I cleanup this situation? In fact what’s the best way to Stop a queue so that this wont happen in the first place. Even if this happens, I would like to somehow get rid of this Request while still processing the requests that have already been given to me by the framework.

Thanks
Pankaj


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Doron,

I am 100% sure I reported PDO missing…infact I have a timer that
wakes up and based in a particular criteria cleans up certain PDOs. In
this case it reported it missing many many

times. I must say even I was surprised to see the PDO state but I
attributed it to somehow Queue being in that state.

An interesting piece of data is that, I started calling WdfIoQueuePurge
just before reporting the PDO missing and it seems to have somehow
solved the problem. I have tried it at least 50 times and I never got
into stuck PDO situation.

Another worrying aspect of this situation for me is that, in the
WDFQUEUE, why was there an IRP waiting to be delivered. The PDO in fact
was not processing anything else…in fact it was the only PDO that my
Bus driver had created and absolutely nothing was going on…(which
is in fact a problem for me…)

I in fact have been expecting more stuff to come down from the driver
that has the FDO for this PDO…But may be its stuck in the Queue

How can I debug this issue?

-pankaj


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, January 10, 2008 8:24 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WdfQueue Problem

The PDO is not in any state where it has been removed or reported as
missing (!wdfdevice on the parent FDO will give you the WDFCHILDLIST
that was used to enumerate the PDO, !wdfchildlist [handle] will give you
the current reported state as KMDF thinks it is) so the queue state is
just fine (power managed, off). Since (assuming) the PDO is not the
power policy owner, the queue will not present until the policy owner
wakes up the stack. I don’t understand what the problem is in the
current state.

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Thursday, January 10, 2008 4:20 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WdfQueue Problem

Doron,

I was hoping you’d respond :-). I forgot to paste that outout in last
email

Dumping WDFDEVICE 0x7d38ad48

=================================

WDM PDEVICE_OBJECTs: self 82e17828

Pnp state: 119 ( WdfDevStatePnpStarted )

Power state: 31f ( WdfDevStatePowerDx )

Power Pol state: 571 ( WdfDevStatePwrPolDx )

Parent WDFDEVICE 7d42bfe8

Parent states:

Pnp state: 119 ( WdfDevStatePnpStarted )

Power state: 307 ( WdfDevStatePowerD0 )

Power Pol state: 565 ( WdfDevStatePwrPolStarted )

Since then I have started calling the WdfIoQueuePurge call in the code.
Is that something you’d recommend?

-pankaj


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, January 10, 2008 4:06 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] WdfQueue Problem

What is the current state of the PDO (!wdfkd.wdfdevice [wdfdevice]
0xfff) ?

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Thursday, January 10, 2008 3:55 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] WdfQueue Problem

I have a bus driver which creates Pdo’s and WDFQueue objects for thos
PDO’s. Queue is set up for parallel dispatching.

I am seeing that in some cases my PDO gets stuck and just wouldn’t go
away no matter how many times I report it missing. It was a clear
symptom of either a reference to the device or some pending IRP in the
system.

Here is the dump of my WdfQueue:

!wdfkd.wdfqueue 0x7D38C4C0

Dumping WDFQUEUE 0x7d38c4c0

=========================

Parallel, Power-managed, PowerOff, Can accept, Can dispatch,
ExecutionLevelDispatch, SynchronizationScopeNone

Number of driver owned requests: 0

Number of waiting requests: 1

!WDFREQUEST 0x7d40f258 !IRP 0x82d9b008

EvtIoDefault: (0xf427cec0) bus!Device_EvtIoDefault

EvtIoRead: (0xf427cf10) bus!Device_EvtIoRead

EvtIoWrite: (0xf427cf40) bus!Device_EvtIoWrite

EvtIoDeviceControl: (0xf427cf70) bus!Device_EvtIoDeviceControl

EvtIoInternalDeviceControl: (0xf427d2b0)
bus!Device_EvtIoInternalDeviceControl

kd> !WDFREQUEST 0x7d40f258

!IRP 0x82d9b008

!WDFQUEUE 0x7d38c4c0

State: Pending, Allocated by WDF for incoming IRP

I am 100% sure that the WdfRequest that is pending here, was never
actually delivered to me. I print every request coming into my EvtIOXXX
routines. This seems to me like this is a request that was about to be
delivered (still belongs to framework) but now its stuck.

How do I cleanup this situation? In fact what’s the best way to Stop a
queue so that this wont happen in the first place. Even if this happens,
I would like to somehow get rid of this Request while still processing
the requests that have already been given to me by the framework.

Thanks

Pankaj


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Doron,

I ran a simple test of creating the PDO, then the driver loads above me
and starts sending down some requests. I handle all of them…and after
a few everything stops…

I have been stuck here for a while (and that’s when I encountered the
Queue issue). At this point I dumped the Queue and saw the following :

Dumping WDFQUEUE 0x7d3ec5b8

=========================

Parallel, Power-managed, PowerOff, Can accept, Can dispatch,
ExecutionLevelDispatch, SynchronizationScopeNone

Number of driver owned requests: 0

Number of waiting requests: 0

I am perplexed as to why my Queue is in PowerOff state…??? There are
no waiting requests…but I’m not getting any more requests because of
queue going into PowerOff.

When does KMDF put a queue in PowerOff?? How can I power it back On?

-pankaj


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, January 10, 2008 8:24 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WdfQueue Problem

The PDO is not in any state where it has been removed or reported as
missing (!wdfdevice on the parent FDO will give you the WDFCHILDLIST
that was used to enumerate the PDO, !wdfchildlist [handle] will give you
the current reported state as KMDF thinks it is) so the queue state is
just fine (power managed, off). Since (assuming) the PDO is not the
power policy owner, the queue will not present until the policy owner
wakes up the stack. I don’t understand what the problem is in the
current state.

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Thursday, January 10, 2008 4:20 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WdfQueue Problem

Doron,

I was hoping you’d respond :-). I forgot to paste that outout in last
email

Dumping WDFDEVICE 0x7d38ad48

=================================

WDM PDEVICE_OBJECTs: self 82e17828

Pnp state: 119 ( WdfDevStatePnpStarted )

Power state: 31f ( WdfDevStatePowerDx )

Power Pol state: 571 ( WdfDevStatePwrPolDx )

Parent WDFDEVICE 7d42bfe8

Parent states:

Pnp state: 119 ( WdfDevStatePnpStarted )

Power state: 307 ( WdfDevStatePowerD0 )

Power Pol state: 565 ( WdfDevStatePwrPolStarted )

Since then I have started calling the WdfIoQueuePurge call in the code.
Is that something you’d recommend?

-pankaj


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, January 10, 2008 4:06 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] WdfQueue Problem

What is the current state of the PDO (!wdfkd.wdfdevice [wdfdevice]
0xfff) ?

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Thursday, January 10, 2008 3:55 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] WdfQueue Problem

I have a bus driver which creates Pdo’s and WDFQueue objects for thos
PDO’s. Queue is set up for parallel dispatching.

I am seeing that in some cases my PDO gets stuck and just wouldn’t go
away no matter how many times I report it missing. It was a clear
symptom of either a reference to the device or some pending IRP in the
system.

Here is the dump of my WdfQueue:

!wdfkd.wdfqueue 0x7D38C4C0

Dumping WDFQUEUE 0x7d38c4c0

=========================

Parallel, Power-managed, PowerOff, Can accept, Can dispatch,
ExecutionLevelDispatch, SynchronizationScopeNone

Number of driver owned requests: 0

Number of waiting requests: 1

!WDFREQUEST 0x7d40f258 !IRP 0x82d9b008

EvtIoDefault: (0xf427cec0) bus!Device_EvtIoDefault

EvtIoRead: (0xf427cf10) bus!Device_EvtIoRead

EvtIoWrite: (0xf427cf40) bus!Device_EvtIoWrite

EvtIoDeviceControl: (0xf427cf70) bus!Device_EvtIoDeviceControl

EvtIoInternalDeviceControl: (0xf427d2b0)
bus!Device_EvtIoInternalDeviceControl

kd> !WDFREQUEST 0x7d40f258

!IRP 0x82d9b008

!WDFQUEUE 0x7d38c4c0

State: Pending, Allocated by WDF for incoming IRP

I am 100% sure that the WdfRequest that is pending here, was never
actually delivered to me. I print every request coming into my EvtIOXXX
routines. This seems to me like this is a request that was about to be
delivered (still belongs to framework) but now its stuck.

How do I cleanup this situation? In fact what’s the best way to Stop a
queue so that this wont happen in the first place. Even if this happens,
I would like to somehow get rid of this Request while still processing
the requests that have already been given to me by the framework.

Thanks

Pankaj


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

The queue is put into a powered off state when the device receives a Dx power irp. What is the output of !wdfdevice for the PDO? If you need to process i/o in any power state, you need to create a queue which is not power managed.

Marking the pdo as missing is not tied to the queue state. The processing of the subsequent pnp surprise remove/remove might be tied to the queue state (waiting for it to empty), but that is much later in the lifetime of the PDO. Based on the output of your previous !wdfdevice, it has not yet seen the pnp surprise remove.

Are you using static or dynamic (e.g. WDFCHILDLIST) enumeration for the PDO? In the case where you think the stuck request in the queue is blocking the PDO’s surprise removal, what is the output of the !wdfchildlist for the list that enumerated your PDO (there is a hidden WDFCHILDLIST for static enumeration which !wdfdevice [your FDO] 0xFFFF give you the handle value of).

Also, what is the output of !devstack ? That will tell us what pnp thinks. Perhaps the fdo is blocking the pnp surprise remove irp b/c it is waiting for this stuck request. Do you control the FDO as well?

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Friday, January 11, 2008 10:17 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WdfQueue Problem

Doron,
I ran a simple test of creating the PDO, then the driver loads above me and starts sending down some requests. I handle all of them…and after a few everything stops…
I have been stuck here for a while (and that’s when I encountered the Queue issue). At this point I dumped the Queue and saw the following :

Dumping WDFQUEUE 0x7d3ec5b8
=========================
Parallel, Power-managed, PowerOff, Can accept, Can dispatch, ExecutionLevelDispatch, SynchronizationScopeNone
Number of driver owned requests: 0
Number of waiting requests: 0

I am perplexed as to why my Queue is in PowerOff state…??? There are no waiting requests…but I’m not getting any more requests because of queue going into PowerOff.
When does KMDF put a queue in PowerOff?? How can I power it back On?

-pankaj


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, January 10, 2008 8:24 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WdfQueue Problem

The PDO is not in any state where it has been removed or reported as missing (!wdfdevice on the parent FDO will give you the WDFCHILDLIST that was used to enumerate the PDO, !wdfchildlist [handle] will give you the current reported state as KMDF thinks it is) so the queue state is just fine (power managed, off). Since (assuming) the PDO is not the power policy owner, the queue will not present until the policy owner wakes up the stack. I don’t understand what the problem is in the current state.

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Thursday, January 10, 2008 4:20 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WdfQueue Problem

Doron,

I was hoping you’d respond :). I forgot to paste that outout in last email

Dumping WDFDEVICE 0x7d38ad48
=================================

WDM PDEVICE_OBJECTs: self 82e17828

Pnp state: 119 ( WdfDevStatePnpStarted )
Power state: 31f ( WdfDevStatePowerDx )
Power Pol state: 571 ( WdfDevStatePwrPolDx )

Parent WDFDEVICE 7d42bfe8
Parent states:
Pnp state: 119 ( WdfDevStatePnpStarted )
Power state: 307 ( WdfDevStatePowerD0 )
Power Pol state: 565 ( WdfDevStatePwrPolStarted )

Since then I have started calling the WdfIoQueuePurge call in the code. Is that something you’d recommend?

-pankaj


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, January 10, 2008 4:06 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] WdfQueue Problem

What is the current state of the PDO (!wdfkd.wdfdevice [wdfdevice] 0xfff) ?

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Thursday, January 10, 2008 3:55 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] WdfQueue Problem

I have a bus driver which creates Pdo’s and WDFQueue objects for thos PDO’s. Queue is set up for parallel dispatching.

I am seeing that in some cases my PDO gets stuck and just wouldn’t go away no matter how many times I report it missing. It was a clear symptom of either a reference to the device or some pending IRP in the system.

Here is the dump of my WdfQueue:

!wdfkd.wdfqueue 0x7D38C4C0

Dumping WDFQUEUE 0x7d38c4c0
=========================
Parallel, Power-managed, PowerOff, Can accept, Can dispatch, ExecutionLevelDispatch, SynchronizationScopeNone
Number of driver owned requests: 0
Number of waiting requests: 1
!WDFREQUEST 0x7d40f258 !IRP 0x82d9b008

EvtIoDefault: (0xf427cec0) bus!Device_EvtIoDefault
EvtIoRead: (0xf427cf10) bus!Device_EvtIoRead
EvtIoWrite: (0xf427cf40) bus!Device_EvtIoWrite
EvtIoDeviceControl: (0xf427cf70) bus!Device_EvtIoDeviceControl
EvtIoInternalDeviceControl: (0xf427d2b0) bus!Device_EvtIoInternalDeviceControl
kd> !WDFREQUEST 0x7d40f258
!IRP 0x82d9b008
!WDFQUEUE 0x7d38c4c0
State: Pending, Allocated by WDF for incoming IRP

I am 100% sure that the WdfRequest that is pending here, was never actually delivered to me. I print every request coming into my EvtIOXXX routines. This seems to me like this is a request that was about to be delivered (still belongs to framework) but now its stuck.

How do I cleanup this situation? In fact what’s the best way to Stop a queue so that this wont happen in the first place. Even if this happens, I would like to somehow get rid of this Request while still processing the requests that have already been given to me by the framework.

Thanks
Pankaj


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Doron,

Before I read your response I had already made the one single change of
setting the queue to not be power managed and voila everything started
working.

I don’t control the FDO and I am using dynamic enumeration. I will get
more output and post it here soon.

-pankaj


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Friday, January 11, 2008 11:37 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WdfQueue Problem

The queue is put into a powered off state when the device receives a Dx
power irp. What is the output of !wdfdevice for the PDO? If you need
to process i/o in any power state, you need to create a queue which is
not power managed.

Marking the pdo as missing is not tied to the queue state. The
processing of the subsequent pnp surprise remove/remove might be tied to
the queue state (waiting for it to empty), but that is much later in the
lifetime of the PDO. Based on the output of your previous !wdfdevice,
it has not yet seen the pnp surprise remove.

Are you using static or dynamic (e.g. WDFCHILDLIST) enumeration for the
PDO? In the case where you think the stuck request in the queue is
blocking the PDO’s surprise removal, what is the output of the
!wdfchildlist for the list that enumerated your PDO (there is a hidden
WDFCHILDLIST for static enumeration which !wdfdevice [your FDO] 0xFFFF
give you the handle value of).

Also, what is the output of !devstack ? That
will tell us what pnp thinks. Perhaps the fdo is blocking the pnp
surprise remove irp b/c it is waiting for this stuck request. Do you
control the FDO as well?

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Friday, January 11, 2008 10:17 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WdfQueue Problem

Doron,

I ran a simple test of creating the PDO, then the driver loads above me
and starts sending down some requests. I handle all of them…and after
a few everything stops…

I have been stuck here for a while (and that’s when I encountered the
Queue issue). At this point I dumped the Queue and saw the following :

Dumping WDFQUEUE 0x7d3ec5b8

=========================

Parallel, Power-managed, PowerOff, Can accept, Can dispatch,
ExecutionLevelDispatch, SynchronizationScopeNone

Number of driver owned requests: 0

Number of waiting requests: 0

I am perplexed as to why my Queue is in PowerOff state…??? There are
no waiting requests…but I’m not getting any more requests because of
queue going into PowerOff.

When does KMDF put a queue in PowerOff?? How can I power it back On?

-pankaj



From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, January 10, 2008 8:24 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WdfQueue Problem

The PDO is not in any state where it has been removed or reported as
missing (!wdfdevice on the parent FDO will give you the WDFCHILDLIST
that was used to enumerate the PDO, !wdfchildlist [handle] will give you
the current reported state as KMDF thinks it is) so the queue state is
just fine (power managed, off). Since (assuming) the PDO is not the
power policy owner, the queue will not present until the policy owner
wakes up the stack. I don’t understand what the problem is in the
current state.

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Thursday, January 10, 2008 4:20 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WdfQueue Problem

Doron,

I was hoping you’d respond :-). I forgot to paste that outout in last
email

Dumping WDFDEVICE 0x7d38ad48

=================================

WDM PDEVICE_OBJECTs: self 82e17828

Pnp state: 119 ( WdfDevStatePnpStarted )

Power state: 31f ( WdfDevStatePowerDx )

Power Pol state: 571 ( WdfDevStatePwrPolDx )

Parent WDFDEVICE 7d42bfe8

Parent states:

Pnp state: 119 ( WdfDevStatePnpStarted )

Power state: 307 ( WdfDevStatePowerD0 )

Power Pol state: 565 ( WdfDevStatePwrPolStarted )

Since then I have started calling the WdfIoQueuePurge call in the code.
Is that something you’d recommend?

-pankaj



From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, January 10, 2008 4:06 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] WdfQueue Problem

What is the current state of the PDO (!wdfkd.wdfdevice [wdfdevice]
0xfff) ?

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Thursday, January 10, 2008 3:55 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] WdfQueue Problem

I have a bus driver which creates Pdo’s and WDFQueue objects for thos
PDO’s. Queue is set up for parallel dispatching.

I am seeing that in some cases my PDO gets stuck and just wouldn’t go
away no matter how many times I report it missing. It was a clear
symptom of either a reference to the device or some pending IRP in the
system.

Here is the dump of my WdfQueue:

!wdfkd.wdfqueue 0x7D38C4C0

Dumping WDFQUEUE 0x7d38c4c0

=========================

Parallel, Power-managed, PowerOff, Can accept, Can dispatch,
ExecutionLevelDispatch, SynchronizationScopeNone

Number of driver owned requests: 0

Number of waiting requests: 1

!WDFREQUEST 0x7d40f258 !IRP 0x82d9b008

EvtIoDefault: (0xf427cec0) bus!Device_EvtIoDefault

EvtIoRead: (0xf427cf10) bus!Device_EvtIoRead

EvtIoWrite: (0xf427cf40) bus!Device_EvtIoWrite

EvtIoDeviceControl: (0xf427cf70) bus!Device_EvtIoDeviceControl

EvtIoInternalDeviceControl: (0xf427d2b0)
bus!Device_EvtIoInternalDeviceControl

kd> !WDFREQUEST 0x7d40f258

!IRP 0x82d9b008

!WDFQUEUE 0x7d38c4c0

State: Pending, Allocated by WDF for incoming IRP

I am 100% sure that the WdfRequest that is pending here, was never
actually delivered to me. I print every request coming into my EvtIOXXX
routines. This seems to me like this is a request that was about to be
delivered (still belongs to framework) but now its stuck.

How do I cleanup this situation? In fact what’s the best way to Stop a
queue so that this wont happen in the first place. Even if this happens,
I would like to somehow get rid of this Request while still processing
the requests that have already been given to me by the framework.

Thanks

Pankaj


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

If making the queue non power managed made things work, than I would think that the FDO was blocked on the IO (and not cancelling it, just waiting for it to complete) when processing the pnp surprise remove and by making the queue not power managed it allowed the io to be processed and completed as the FDO expected

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Friday, January 11, 2008 3:47 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WdfQueue Problem

Doron,

Before I read your response I had already made the one single change of setting the queue to not be power managed and voila everything started working.
I don’t control the FDO and I am using dynamic enumeration. I will get more output and post it here soon.

-pankaj


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Friday, January 11, 2008 11:37 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WdfQueue Problem

The queue is put into a powered off state when the device receives a Dx power irp. What is the output of !wdfdevice for the PDO? If you need to process i/o in any power state, you need to create a queue which is not power managed.

Marking the pdo as missing is not tied to the queue state. The processing of the subsequent pnp surprise remove/remove might be tied to the queue state (waiting for it to empty), but that is much later in the lifetime of the PDO. Based on the output of your previous !wdfdevice, it has not yet seen the pnp surprise remove.

Are you using static or dynamic (e.g. WDFCHILDLIST) enumeration for the PDO? In the case where you think the stuck request in the queue is blocking the PDO’s surprise removal, what is the output of the !wdfchildlist for the list that enumerated your PDO (there is a hidden WDFCHILDLIST for static enumeration which !wdfdevice [your FDO] 0xFFFF give you the handle value of).

Also, what is the output of !devstack ? That will tell us what pnp thinks. Perhaps the fdo is blocking the pnp surprise remove irp b/c it is waiting for this stuck request. Do you control the FDO as well?

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Friday, January 11, 2008 10:17 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WdfQueue Problem

Doron,
I ran a simple test of creating the PDO, then the driver loads above me and starts sending down some requests. I handle all of them…and after a few everything stops…
I have been stuck here for a while (and that’s when I encountered the Queue issue). At this point I dumped the Queue and saw the following :

Dumping WDFQUEUE 0x7d3ec5b8
=========================
Parallel, Power-managed, PowerOff, Can accept, Can dispatch, ExecutionLevelDispatch, SynchronizationScopeNone
Number of driver owned requests: 0
Number of waiting requests: 0

I am perplexed as to why my Queue is in PowerOff state…??? There are no waiting requests…but I’m not getting any more requests because of queue going into PowerOff.
When does KMDF put a queue in PowerOff?? How can I power it back On?

-pankaj


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, January 10, 2008 8:24 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WdfQueue Problem

The PDO is not in any state where it has been removed or reported as missing (!wdfdevice on the parent FDO will give you the WDFCHILDLIST that was used to enumerate the PDO, !wdfchildlist [handle] will give you the current reported state as KMDF thinks it is) so the queue state is just fine (power managed, off). Since (assuming) the PDO is not the power policy owner, the queue will not present until the policy owner wakes up the stack. I don’t understand what the problem is in the current state.

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Thursday, January 10, 2008 4:20 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WdfQueue Problem

Doron,

I was hoping you’d respond :). I forgot to paste that outout in last email

Dumping WDFDEVICE 0x7d38ad48
=================================

WDM PDEVICE_OBJECTs: self 82e17828

Pnp state: 119 ( WdfDevStatePnpStarted )
Power state: 31f ( WdfDevStatePowerDx )
Power Pol state: 571 ( WdfDevStatePwrPolDx )

Parent WDFDEVICE 7d42bfe8
Parent states:
Pnp state: 119 ( WdfDevStatePnpStarted )
Power state: 307 ( WdfDevStatePowerD0 )
Power Pol state: 565 ( WdfDevStatePwrPolStarted )

Since then I have started calling the WdfIoQueuePurge call in the code. Is that something you’d recommend?

-pankaj


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, January 10, 2008 4:06 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] WdfQueue Problem

What is the current state of the PDO (!wdfkd.wdfdevice [wdfdevice] 0xfff) ?

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Thursday, January 10, 2008 3:55 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] WdfQueue Problem

I have a bus driver which creates Pdo’s and WDFQueue objects for thos PDO’s. Queue is set up for parallel dispatching.

I am seeing that in some cases my PDO gets stuck and just wouldn’t go away no matter how many times I report it missing. It was a clear symptom of either a reference to the device or some pending IRP in the system.

Here is the dump of my WdfQueue:

!wdfkd.wdfqueue 0x7D38C4C0

Dumping WDFQUEUE 0x7d38c4c0
=========================
Parallel, Power-managed, PowerOff, Can accept, Can dispatch, ExecutionLevelDispatch, SynchronizationScopeNone
Number of driver owned requests: 0
Number of waiting requests: 1
!WDFREQUEST 0x7d40f258 !IRP 0x82d9b008

EvtIoDefault: (0xf427cec0) bus!Device_EvtIoDefault
EvtIoRead: (0xf427cf10) bus!Device_EvtIoRead
EvtIoWrite: (0xf427cf40) bus!Device_EvtIoWrite
EvtIoDeviceControl: (0xf427cf70) bus!Device_EvtIoDeviceControl
EvtIoInternalDeviceControl: (0xf427d2b0) bus!Device_EvtIoInternalDeviceControl
kd> !WDFREQUEST 0x7d40f258
!IRP 0x82d9b008
!WDFQUEUE 0x7d38c4c0
State: Pending, Allocated by WDF for incoming IRP

I am 100% sure that the WdfRequest that is pending here, was never actually delivered to me. I print every request coming into my EvtIOXXX routines. This seems to me like this is a request that was about to be delivered (still belongs to framework) but now its stuck.

How do I cleanup this situation? In fact what’s the best way to Stop a queue so that this wont happen in the first place. Even if this happens, I would like to somehow get rid of this Request while still processing the requests that have already been given to me by the framework.

Thanks
Pankaj


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer