driver not unloaded on surprise removal

Hello all,
I am investigating an defect in my SDIO driver where the device is ejected but still appears in the Device Manager until the computer is rebooted. This happens infrequently on a user system and I have not been able to capture meaningful debug data. So, looking for suggestion on where to look for the problem. I know that a request on a queue that hasn’t been completed can cause this symptom. Is there any other way?

All my queues are power-managed. Is it possible that a new request arrives from the application after a queue has transitioned to STOPPED state but before the device leaves D0? Will this cause the request to be put on the queue but not be completed because the queue’s callbacks no longer run? If this can happen, what is the right way to clean this up?

There is also an instance of a request being requeued using a WdfRequestRequeue in a WorkItem in my driver. Is it possible to requeue a request onto a queue that has been stopped? If so, would this also cause the queue to not allow the driver to unload?

Any other ideas will be appreciated.
Thanks
Rachel

Kmdf itself has no races here, the key is registering for the right callbacks to handle these scenarios. If the device is still in device manager ui after physical removal, you are hung/stuck somewhere in the surprise remove irp processing path. In kmdf terms, that means the power down path + releasehw().

In terms of callbacks, have you registered an EvtIoStop callback on your power managed queue? Are you acknowledging or completing all active requests ?

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Michelson Rachel-CRK007
Sent: Wednesday, October 17, 2012 9:04 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] driver not unloaded on surprise removal

Hello all,
I am investigating an defect in my SDIO driver where the device is ejected but still appears in the Device Manager until the computer is rebooted. This happens infrequently on a user system and I have not been able to capture meaningful debug data. So, looking for suggestion on where to look for the problem. I know that a request on a queue that hasn’t been completed can cause this symptom. Is there any other way?

All my queues are power-managed. Is it possible that a new request arrives from the application after a queue has transitioned to STOPPED state but before the device leaves D0? Will this cause the request to be put on the queue but not be completed because the queue’s callbacks no longer run? If this can happen, what is the right way to clean this up?

There is also an instance of a request being requeued using a WdfRequestRequeue in a WorkItem in my driver. Is it possible to requeue a request onto a queue that has been stopped? If so, would this also cause the queue to not allow the driver to unload?

Any other ideas will be appreciated.
Thanks
Rachel


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 app holding an open handle can also be the cause.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

“Michelson Rachel-CRK007” wrote in message news:xxxxx@ntdev…
Hello all,
I am investigating an defect in my SDIO driver where the device is ejected but still appears in the Device Manager until the computer is rebooted. This happens infrequently on a user system and I have not been able to capture meaningful debug data. So, looking for suggestion on where to look for the problem. I know that a request on a queue that hasn’t been completed can cause this symptom. Is there any other way?

All my queues are power-managed. Is it possible that a new request arrives from the application after a queue has transitioned to STOPPED state but before the device leaves D0? Will this cause the request to be put on the queue but not be completed because the queue’s callbacks no longer run? If this can happen, what is the right way to clean this up?

There is also an instance of a request being requeued using a WdfRequestRequeue in a WorkItem in my driver. Is it possible to requeue a request onto a queue that has been stopped? If so, would this also cause the queue to not allow the driver to unload?

Any other ideas will be appreciated.
Thanks
Rachel