Invalid Queue State in UMDF

Hello All,

I have a virtual device developed using UMDF. In my UMDF driver, I have a default parallel queue and a manual queue. When I get the request in DeviceIOControl, I forward one particular request to manual queue. A thread is started waiting for an event to occur and retrieves the request from manual when event occurs and completes it. This scenario is working fine when I have one instance of virtual device running.

When there are two instances of virtual devices running, the second instance always show that there are no requests in the queue. When I queried for the queue state in the thread, the first instance show 0xb (WdfIoQueueDriverNoRequests | WdfIoQueueDispatchRequests | WdfIoQueueAcceptRequests). The thread in second instance of device show 0xf (WdfIoQueueDriverNoRequests | WdfIoQueueDispatchRequests | WdfIoQueueAcceptRequests | WdfIoQueueNoRequests).

I’m unable to debug where I’m going wrong. Is there a better way to detect the problem.

If I query for the queue state immediately after forwarding to manual, the queue state is 0xb in both instances. Its in the thread routine of second instance, the value is 0xf.

Thanks and Regards,
Madhukar

Do you have the WDF verifier enabled for your driver?

Have you checked the WDF log right after the second driver instance forwards from the parallel queue to the manual one?

I assume you don’t have any place in your code where you’re doing something silly like storing the queue pointers in a global variable, or in a driver object context?

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Thursday, March 5, 2015 3:56 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Invalid Queue State in UMDF

Hello All,

I have a virtual device developed using UMDF. In my UMDF driver, I have a default parallel queue and a manual queue. When I get the request in DeviceIOControl, I forward one particular request to manual queue. A thread is started waiting for an event to occur and retrieves the request from manual when event occurs and completes it. This scenario is working fine when I have one instance of virtual device running.

When there are two instances of virtual devices running, the second instance always show that there are no requests in the queue. When I queried for the queue state in the thread, the first instance show 0xb (WdfIoQueueDriverNoRequests | WdfIoQueueDispatchRequests | WdfIoQueueAcceptRequests). The thread in second instance of device show 0xf (WdfIoQueueDriverNoRequests | WdfIoQueueDispatchRequests | WdfIoQueueAcceptRequests | WdfIoQueueNoRequests).

I’m unable to debug where I’m going wrong. Is there a better way to detect the problem.

If I query for the queue state immediately after forwarding to manual, the queue state is 0xb in both instances. Its in the thread routine of second instance, the value is 0xf.

Thanks and Regards,
Madhukar


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

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

I double checked the queue pointers and they are only present in device context. I did not try using WDF verifier. I will try enabling it.

How can I set or view WDF log. Where is it present?

Regards,
Madhukar

xxxxx@hotmail.com wrote:

I have a virtual device developed using UMDF. In my UMDF driver, I have a default parallel queue and a manual queue. When I get the request in DeviceIOControl, I forward one particular request to manual queue. A thread is started waiting for an event to occur and retrieves the request from manual when event occurs and completes it. This scenario is working fine when I have one instance of virtual device running.

Do you start one thread per request, as opposed to launching a single
long-term thread that waits for something else to do?

When there are two instances of virtual devices running, the second instance always show that there are no requests in the queue. When I queried for the queue state in the thread, the first instance show 0xb (WdfIoQueueDriverNoRequests | WdfIoQueueDispatchRequests | WdfIoQueueAcceptRequests). The thread in second instance of device show 0xf (WdfIoQueueDriverNoRequests | WdfIoQueueDispatchRequests | WdfIoQueueAcceptRequests | WdfIoQueueNoRequests).

Have you tried adding trace debug messages to dump the queue handle when
you add something to the queue, to line up with what you expect in the
thread?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

At the WinDbg command prompt:

!WDFLOGDUMP

Peter
OSR
@OSRDrivers

The device was virtual smart card reader. The device unit number was same for both the instances which was root cause of the problem. When we had assigned a unique number to each instance, it worked.

Thank you all for your suggestions.

Regards,
Madhukar