prefast warning 28167 and the release complete acquire pattern

What if any arcane annotation is the correct incantation to prevent prefast
errors for the following exceedingly common code pattern:

WdfSpinLockRelease(filterExt->Lock);

WdfRequestComplete(Request, Status);

WdfSpinLockAcquire(filterExt->Lock);
Thanks,

Mark Roddy

There is a reason this rule exists. What if you reenter on the same stack due to a resend from a completion routine and try to acquire the lock during dispatch? You will dedlock. How difficult is it to complete the request after releasing the lock?

d

sent from a phpne with no keynoard


From: Mark Roddy
Sent: April 28, 2010 7:56 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] prefast warning 28167 and the release complete acquire pattern

What if any arcane annotation is the correct incantation to prevent prefast errors for the following exceedingly common code pattern:

WdfSpinLockRelease(filterExt->Lock);

WdfRequestComplete(Request, Status);

WdfSpinLockAcquire(filterExt->Lock);

Thanks,

Mark Roddy
— 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

Actually no I won’t deadlock, that is the whole point of release, complete,
acquire. The deadlock occurs if one does not release before the completion
call. The acquire could of course spin waiting for the dispatch side, but so
what?

And the answer too your question is: difficult, and wrong.

The other answer is:
__drv_sameIRQL

__drv_requiresIRQL(DISPATCH_LEVEL)

Mark Roddy

On Wed, Apr 28, 2010 at 11:20 AM, Doron Holan wrote:

> There is a reason this rule exists. What if you reenter on the same stack
> due to a resend from a completion routine and try to acquire the lock during
> dispatch? You will dedlock. How difficult is it to complete the request
> after releasing the lock?
>
> d
>
> sent from a phpne with no keynoard
>
> ------------------------------
> From: Mark Roddy
> Sent: April 28, 2010 7:56 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] prefast warning 28167 and the release complete acquire
> pattern
>
> What if any arcane annotation is the correct incantation to prevent
> prefast errors for the following exceedingly common code pattern:
>
>
> WdfSpinLockRelease(filterExt->Lock);
>
> WdfRequestComplete(Request, Status);
>
> WdfSpinLockAcquire(filterExt->Lock);
> Thanks,
>
> Mark Roddy
> — 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
>

Sorry, misread your original post. Your pattern is correct, will ask around to see why PFD is complaining

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
Sent: Wednesday, April 28, 2010 8:49 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] prefast warning 28167 and the release complete acquire pattern

Actually no I won’t deadlock, that is the whole point of release, complete, acquire. The deadlock occurs if one does not release before the completion call. The acquire could of course spin waiting for the dispatch side, but so what?

And the answer too your question is: difficult, and wrong.

The other answer is:
__drv_sameIRQL

__drv_requiresIRQL(DISPATCH_LEVEL)

Mark Roddy

On Wed, Apr 28, 2010 at 11:20 AM, Doron Holan > wrote:
There is a reason this rule exists. What if you reenter on the same stack due to a resend from a completion routine and try to acquire the lock during dispatch? You will dedlock. How difficult is it to complete the request after releasing the lock?

d

sent from a phpne with no keynoard
________________________________
From: Mark Roddy >
Sent: April 28, 2010 7:56 AM
To: Windows System Software Devs Interest List >
Subject: [ntdev] prefast warning 28167 and the release complete acquire pattern
What if any arcane annotation is the correct incantation to prevent prefast errors for the following exceedingly common code pattern:

WdfSpinLockRelease(filterExt->Lock);

WdfRequestComplete(Request, Status);

WdfSpinLockAcquire(filterExt->Lock);
Thanks,

Mark Roddy
— 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