Hello,
Is there any problem with this code:
{
KIRQL irql1, irql2;
…
KeAcquireSpinLock( &gSomeLock1, &irql1 );
…
KeAcquireSpinLock( &gSomeLock2, &irql2 );
…
KeReleaseSpinLock( &gSomeLock2, irql2 );
…
KeReleaseSpinLock( &gSomeLock1, irql1 );
…
}
My computer freezes. It must be something with my driver I think. The problem is that I cannot trace this because of the freeze. I keep the debug info in a log file but only the stuff thats == PASSIVE_LEVEL.
Have no idea how to trace it.
Thank you,
Andrei CIUBOTARU
Make sure you maintain the same order for acquring locks at all places
in your driver.
Thanks,
Pawan
On Mon, 14 Feb 2005 01:48:13 -0800 (PST), Ciubotaru Ovidiu Andrei
wrote:
> Hello,
>
> Is there any problem with this code:
>
> {
> KIRQL irql1, irql2;
>
> …
>
> KeAcquireSpinLock( &gSomeLock1, &irql1 );
>
> …
>
> KeAcquireSpinLock( &gSomeLock2, &irql2 );
>
> …
>
> KeReleaseSpinLock( &gSomeLock2, irql2 );
>
> …
>
> KeReleaseSpinLock( &gSomeLock1, irql1 );
>
> …
> }
>
> My computer freezes. It must be something with my driver I think. The problem is that I cannot trace this because of the freeze. I keep the debug info in a log file but only the stuff thats == PASSIVE_LEVEL.
> Have no idea how to trace it.
>
> Thank you,
> Andrei CIUBOTARU
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@gmail.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
Ciubotaru Ovidiu Andrei wrote:
Hello,
Is there any problem with this code:
{
KIRQL irql1, irql2;
…
KeAcquireSpinLock( &gSomeLock1, &irql1 );
…
KeAcquireSpinLock( &gSomeLock2, &irql2 );
…
KeReleaseSpinLock( &gSomeLock2, irql2 );
…
KeReleaseSpinLock( &gSomeLock1, irql1 );
…
}
You should also check if you acquire a spin lock recursively. (I.e. you
acquire the lock in a function and you call the function while holding
the same lock in another).
My computer freezes. It must be something with my driver I think. The problem is that I cannot trace this because of the freeze. I keep the debug info in a log file but only the stuff thats == PASSIVE_LEVEL.
Have no idea how to trace it.
Check out the *KdPrint *macro.
Thank you,
Andrei CIUBOTARU
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@bitdefender.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
–
Ignorance more frequently begets confidence than does knowledge.
— Charles Darwin
–
This message was scanned for spam and viruses by BitDefender.
For more information please visit http://linux.bitdefender.com/
Debug the deadlock with a debugger. One of the nice things about a spinlock
deadlock is that the offending threads are present in memory with a stack
that pretty much indicts their lock acquisition order screw-up.
=====================
Mark Roddy
Windows .NET/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pawan Khatri
Sent: Monday, February 14, 2005 4:53 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Spin Lock
Make sure you maintain the same order for acquring locks at
all places in your driver.
Thanks,
Pawan
On Mon, 14 Feb 2005 01:48:13 -0800 (PST), Ciubotaru Ovidiu
Andrei wrote:
> > Hello,
> >
> > Is there any problem with this code:
> >
> > {
> > KIRQL irql1, irql2;
> >
> > …
> >
> > KeAcquireSpinLock( &gSomeLock1, &irql1 );
> >
> > …
> >
> > KeAcquireSpinLock( &gSomeLock2, &irql2 );
> >
> > …
> >
> > KeReleaseSpinLock( &gSomeLock2, irql2 );
> >
> > …
> >
> > KeReleaseSpinLock( &gSomeLock1, irql1 );
> >
> > …
> > }
> >
> > My computer freezes. It must be something with my driver I
> think. The problem is that I cannot trace this because of the
> freeze. I keep the debug info in a log file but only the
> stuff thats == PASSIVE_LEVEL.
> > Have no idea how to trace it.
> >
> > Thank you,
> > Andrei CIUBOTARU
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@gmail.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@hollistech.com To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
You can run your driver with Verifer, and it will crash the system if it
detects a deadlock. It will also point to the offending threads that caused
the deadlock.
-g
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
Sent: Monday, February 14, 2005 5:27 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Spin Lock
Debug the deadlock with a debugger. One of the nice things about a spinlock
deadlock is that the offending threads are present in memory with a stack
that pretty much indicts their lock acquisition order screw-up.
=====================
Mark Roddy
Windows .NET/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032 www.hollistech.com
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pawan Khatri
Sent: Monday, February 14, 2005 4:53 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Spin Lock
Make sure you maintain the same order for acquring locks at all places
in your driver.
Thanks,
Pawan
On Mon, 14 Feb 2005 01:48:13 -0800 (PST), Ciubotaru Ovidiu Andrei
wrote:
> > Hello,
> >
> > Is there any problem with this code:
> >
> > {
> > KIRQL irql1, irql2;
> >
> > …
> >
> > KeAcquireSpinLock( &gSomeLock1, &irql1 );
> >
> > …
> >
> > KeAcquireSpinLock( &gSomeLock2, &irql2 );
> >
> > …
> >
> > KeReleaseSpinLock( &gSomeLock2, irql2 );
> >
> > …
> >
> > KeReleaseSpinLock( &gSomeLock1, irql1 );
> >
> > …
> > }
> >
> > My computer freezes. It must be something with my driver I
> think. The problem is that I cannot trace this because of the freeze.
> I keep the debug info in a log file but only the stuff thats ==
> PASSIVE_LEVEL.
> > Have no idea how to trace it.
> >
> > Thank you,
> > Andrei CIUBOTARU
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@gmail.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@hollistech.com To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@cisco.com To unsubscribe
send a blank email to xxxxx@lists.osr.com
There is nothing wrong with the code, but I have a couple of suggestions
-
if you suspect a deadlock, enable deadlock detection with driver
verifier against your driver
-
if you know that you are already holding another spinlock or you are
already at DISPATCH_LEVEL, you can use
KeAcquireSpinLockAtDpcLevel/KeReleaseSpinLockAtDpcLevel. These 2
functions are bit more performant than their normal acquire/release
spinlock siblings because there is no IRQL check or raise.
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ciubotaru Ovidiu
Andrei
Sent: Monday, February 14, 2005 1:36 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Spin Lock
Hello,
Is there any problem with this code:
{
KIRQL irql1, irql2;
…
KeAcquireSpinLock( &gSomeLock1, &irql1 );
…
KeAcquireSpinLock( &gSomeLock2, &irql2 );
…
KeReleaseSpinLock( &gSomeLock2, irql2 );
…
KeReleaseSpinLock( &gSomeLock1, irql1 );
…
}
My computer freezes. It must be something with my driver I think. The
problem is that I cannot trace this because of the freeze. I keep the
debug info in a log file but only the stuff thats == PASSIVE_LEVEL.
Have no idea how to trace it.
Thank you,
Andrei CIUBOTARU
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com