In a DPC TIMER call a function(KeDelayExecutionThread) cause windows dump!!!

I’m working with a RAID project.In my RAID driver I write a DPC TIMER that every 2s print someting,and in the DPC I also call a function which call the KeDelayExecutionThread(100ms) to wait a interrupt from my firmware .After about 4 times DPC print,the windows dump!!!What the problem cause the dump?How can I fix this problem?THX!

>

I’m working with a RAID project.In my RAID driver I write a DPC TIMER that
every 2s print someting,and in the DPC I also call a function which call the
KeDelayExecutionThread(100ms) to wait a interrupt from my firmware .After
about 4 times DPC print,the windows dump!!!What the problem cause the
dump?How can I fix this problem?THX!

The crash is probably because KeDelayExecutionThread says IRQL <= APC_LEVEL, and you are calling it at DISPATCH_LEVEL (DISPATCH_LEVEL is higher than APC_LEVEL), although if you aren’t getting it every time then you probably don’t have IRQL checking enabled so you are probably accessing paged memory somewhere and that is triggering the crash.

Turn on the verifier and make sure you are running a checked build of your driver.

James

You can’t wait at all in your dpc. KeDelayExecutionThread is most definitely not allowed to be called in a dpc. I strongly suggest you step back and try to understand how windows (some this the second time you are struggling with what you can do in a dpc) works and what the rules are instead of blindly trying every function you think will do what you want.

In this case, you should queue a dpc when the interrupt fires instead of waiting for it

d

debt from my phone


From: xxxxx@gmail.com
Sent: 9/24/2012 4:53 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] In a DPC TIMER call a function(KeDelayExecutionThread) cause windows dump!!!

I’m working with a RAID project.In my RAID driver I write a DPC TIMER that every 2s print someting,and in the DPC I also call a function which call the KeDelayExecutionThread(100ms) to wait a interrupt from my firmware .After about 4 times DPC print,the windows dump!!!What the problem cause the dump?How can I fix this problem?THX!


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

THX,James and Doron.I had solved this problem,it’s not a IRQL or paged memory problem,but there is not allow to use KeDelayExecutionThread in a DPC TIMER,instead i use the StorPortStallExecution to wait for the interrupt for firmware and the windows won’t dump.

I’m a new comer to windows driver develop,my english is so pool that I can hardly understand the english articles.So I come here to ask for help,THX!

How long are you waiting for in the call to StorPortStallExecution?

d

debt from my phone


From: xxxxx@gmail.com
Sent: 9/26/2012 7:21 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] In a DPC TIMER call a function(KeDelayExecutionThread) cause windows dump!!!

THX,James and Doron.I had solved this problem,it’s not a IRQL or paged memory problem,but there is not allow to use KeDelayExecutionThread in a DPC TIMER,instead i use the StorPortStallExecution to wait for the interrupt for firmware and the windows won’t dump.

I’m a new comer to windows driver develop,my english is so pool that I can hardly understand the english articles.So I come here to ask for help,THX!


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

re Doron:
I set a max time as 3s,but after the interrupt come back ,the waiting is over.So I can’t tell you the correct time it wait.

YOU SHOULD NOT WAIT FOR 3 SECOND IN A DPC. This is a HUGE waste of the CPU.

Why do you think you need to wait in a DPC for an interrupt? Schedule a DPC only when you get an interrupt, and do your processing from that DPC.

re Alex:
The DPC TIMER is use to detect my firmware is alive or not every 2s.I’m waiting for the interrupt(change the status to success) from firmware to tell my driver that firmware is alive.Because the detecting cost a little time, can’t return at once,so I try to wait the interrupt in the DPC TIMER.I don’t know how to Schedule a DPC only when get the interrupt.Can you give a sample?THX!

Have your firmware issue an interrupt every 2s or anything, but DON’T WAIT for interrupt.

Huh?

You have your device interrupt (whenever it does). Your Interrupt Service Routine runs as a result. From your interrupt service routine, you schedule the DPC callback (WdfInterruptQueueDpcForIsr, assuming we’re talking about KMDF).

What am I missing?

Peter
OSR