Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

why isnt WdfWaitLockAcquire interruptible/alertable - going from Linux to Windows

18 views
Skip to first unread message

nickolais

unread,
Jun 10, 2011, 4:06:48 PM6/10/11
to
Hello everyone. I am porting my Linux device driver to Windows (KMDF
type for PCIe device) for a product my company has developed. In the
Linux driver, I use semaphores to protect data members that could be
accessed with concurrently running threads in both IOCTL calls and
read/write calls. When I attain the semaphore, my calls are
interruptible (I use down_interruptible()). I need the calls to be
interruptible b/c my code often follows this pattern:

acquire semaphore
manipulate shared data members
talk with hardware and wait for interrupt service routine to signal
hardware has fulfilled request
manipulate more shared data members
release semaphore

Interruptible waits are also nice in case the user tries to kill the
application while the driver is waiting to attain the semaphore. The
signal will interrupt the down_interruptible() call and the
application is allowed to close.

I have yet to find out why Windows drivers do not have such a feature
in WDF. For instance, in place of the semaphores in my Linux driver I
plan to use WdfWaitLocks. The WdfWaitLockAcquire() function docs
mention nothing about being alerted from its sleep if it cannot attain
the lock.

This leads me to 1 or 2 assumptions:
1) I am using the wrong synchronization type for my access. Possibly
I should be using a KMUTEX and KeWaitForSingleObject() if my locking
calls need to be alertable.
2) My design from my Linux driver to my Windows driver needs to change
dramatically such that my critical regions dont have a wait for
hardware to fulfill requests.

Any insights or thoughts would be greatly appreciated.
Nick

0 new messages