Anton touched on this, but the buffers in the user mode application
could be paged out and the act of bringing in those pages could take
longer than your max time requirements. If you are using buffered io in
your IOCTLs, the allocation for the double buffer could also fail. At
what point do you accept the limitations of the OS, especially an OS
that is not real time?
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mark McDougall
Sent: Sunday, August 05, 2007 10:20 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Yielding to guarantee full quantum execution?
xxxxx@hotmail.com wrote:
I would logically break my operation into pre-processing, processing
and post-processing, and define my goal as insuring atomicity of
operation throughout the processing stage - after all, as you said it
yourself, if power goes off before processing begins or after it has
been already done, there is no problem whatsoever.
My pre-processing stage would involve building MDLs for all user-mode
buffers that I have to access during processing stage, and locking
them in RAM - if this part gets aborted, there is no problem
whatsoever. After all buffers that I need have been locked in RAM and
are safely accessible at elevated IRQL, I would raise IRQL to DPC
level, and, at this point, I would consider the actual operation
having
commenced. Once our current IRQL==DISPATCH_LEVEL operation cannot be
interrupted by context switches, which increases the probability that
operation will get completed successfully before the machine is off.
When it is over, I would unlock memory - again, if this part gets
aborted, there is no problem whatsoever.
Certainly, you cannot spend too long at elevated IRQL. As you say, you
have to calculate the right number of accesses. Therefore, just make
sure that it falls within MSFT-defined limit of 100 microseconds -
otherwise, your driver has no chance to get certified…
I suspect you are correct, and in an ideal world, I would probably have
the luxury of following your advice and starting over.
In this case, however, the original driver was written by the customer.
We
actually had nothing at all to do with the software at the start (we
weren’t even privvy to the requirements) - we did the firmware - but as
the job is winding up several “outstanding” tasks have been assigned to
us
as their original software resources are busy elsewhere.
One of those tasks involves profiling the (existing) driver performance
to
ascertain how much processing we can be “guaranteed” to do in 25ms after
power has failed. This processing is done continuously - not just after
power fail - so it can’t be too greedy with resources. When power fails,
any incomplete atomic operation is completed, otherwise the thread
hangs.
As for certification, that’s not an issue - it’s a closed platform.
Regards,
–
Mark McDougall, Engineer
Virtual Logic Pty Ltd, http:
21-25 King St, Rockdale, 2216
Ph: +612-9599-3255 Fax: +612-9599-3266
—
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</http:>