Hi,

I am bit new to device driver programming. I would like to know how to
prevent context switching between threads.

Here is the scenario:

Thread A is running at PASSIVE LEVEL, driver gets into some funny state and
hence I want to panic the system so that I can get a memory dump to diaognise
the problem. So before crashing, I copy required data in a temporary buffer.
When I am about to panic the system, another thread B gets scheduled,
pre-empts the already running thread A, does context switching, runs for a
short burst and modifies data from my main buffer. Once thread B finishes,
thread A resumes the operation and panics the system. When I analyze memory
dump, I notice that contents in temp buffer and main buffer differ as thread
B modifies main buffer.

I want to know how do I prevent this context switching between threads A and
B? As soon as I get into funny state, I want to copy the data in temporary
buffer and crash the system.

Thanks.

Re: How to prevent context switching? by Maxim

Maxim
Mon Apr 25 22:19:36 CDT 2005

Raise to DISPATCH_LEVEL, this prevents context switching on this CPU.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"Nikhil" <Nikhil@discussions.microsoft.com> wrote in message
news:6F6C56F3-21F0-422B-ADEF-FC892729DFD9@microsoft.com...
>
> Hi,
>
> I am bit new to device driver programming. I would like to know how to
> prevent context switching between threads.
>
> Here is the scenario:
>
> Thread A is running at PASSIVE LEVEL, driver gets into some funny state and
> hence I want to panic the system so that I can get a memory dump to diaognise
> the problem. So before crashing, I copy required data in a temporary buffer.
> When I am about to panic the system, another thread B gets scheduled,
> pre-empts the already running thread A, does context switching, runs for a
> short burst and modifies data from my main buffer. Once thread B finishes,
> thread A resumes the operation and panics the system. When I analyze memory
> dump, I notice that contents in temp buffer and main buffer differ as thread
> B modifies main buffer.
>
> I want to know how do I prevent this context switching between threads A and
> B? As soon as I get into funny state, I want to copy the data in temporary
> buffer and crash the system.
>
> Thanks.



Re: How to prevent context switching? by Nikhil

Nikhil
Tue Apr 26 16:34:03 CDT 2005

Thank You, that helped.

"Maxim S. Shatskih" wrote:

> Raise to DISPATCH_LEVEL, this prevents context switching on this CPU.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>
> "Nikhil" <Nikhil@discussions.microsoft.com> wrote in message
> news:6F6C56F3-21F0-422B-ADEF-FC892729DFD9@microsoft.com...
> >
> > Hi,
> >
> > I am bit new to device driver programming. I would like to know how to
> > prevent context switching between threads.
> >
> > Here is the scenario:
> >
> > Thread A is running at PASSIVE LEVEL, driver gets into some funny state and
> > hence I want to panic the system so that I can get a memory dump to diaognise
> > the problem. So before crashing, I copy required data in a temporary buffer.
> > When I am about to panic the system, another thread B gets scheduled,
> > pre-empts the already running thread A, does context switching, runs for a
> > short burst and modifies data from my main buffer. Once thread B finishes,
> > thread A resumes the operation and panics the system. When I analyze memory
> > dump, I notice that contents in temp buffer and main buffer differ as thread
> > B modifies main buffer.
> >
> > I want to know how do I prevent this context switching between threads A and
> > B? As soon as I get into funny state, I want to copy the data in temporary
> > buffer and crash the system.
> >
> > Thanks.
>
>
>