If wait is set to FALSE and the event is in non-pagable space, is this possible? If not, why not?
it’s not possible (for one reason) because scheduling an event requires
synchronizing with any other threads trying to access the event and one
cannot do that at > DISPATCH_LEVEL.
if you need to set the event and you’re above dispatch level you should
schedule a DPC and set the event in the DPC.
-p
-----Original Message-----
From: Doug [mailto:xxxxx@hotmail.com]
Sent: Friday, September 06, 2002 12:47 PM
To: NT Developers Interest List
Subject: [ntdev] Setting event at IRQL>DISPATCH_LEVEL
If wait is set to FALSE and the event is in non-pagable space, is this
possible? If not, why not?
You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to %%email.unsub%%
Beause setting event may lead thread context switch or move thread from
waiting queue to ready queue, which leads so many other things that just
cannot be done at DIRQ level.
Bi
-----Original Message-----
From: Doug [mailto:xxxxx@hotmail.com]
Sent: Friday, September 06, 2002 12:47 PM
To: NT Developers Interest List
Subject: [ntdev] Setting event at IRQL>DISPATCH_LEVEL
If wait is set to FALSE and the event is in non-pagable space, is this
possible? If not, why not?
You are currently subscribed to ntdev as: xxxxx@appstream.com
To unsubscribe send a blank email to %%email.unsub%%
>>it’s not possible (for one reason) because scheduling an event requires
>synchronizing with any other threads trying to access the event and one
>cannot do that at > DISPATCH_LEVEL.
Why? (Just trying to understand)
RE: [ntdev] Setting event at IRQL>DISPATCH_LEVELBut it appears the same thing happens at DISPATCH_LEVEL, but I can set an event at DISPATCH_LEVEL. What makes >DISPATCH_LEVEL bad but DISPATCH_LEVEL ok?
“Bi Chen” wrote in message news:xxxxx@ntdev…
Beause setting event may lead thread context switch or move thread from waiting queue to ready queue, which leads so many other things that just cannot be done at DIRQ level.
Bi
One of the reasons can be the what SYNCH_LEVEL means for kernel. For UP
kernels,
SYNCH_LEVEL is in fact DISPATCH_LEVEL, which is less than DIRQL. For SMP
kernels , SYNCH_LEVEL is IPI-1, which is higher than any DIRQL.
KeSetEvent acquires the dispatcher database lock at SYNC for SMP, but at
DISPATCH
for UP. It’s invalid to pass a lower Irql than current to KeRaiseIrql(),
and this would happen
for UP kernels. Hopwever im not sure that the limitation of calling at only
at DISPATCH or lower for KeSetEvent with Wait == FALSE is a fundamental
limitation, or one which results from current design.
But more clarifications from MS engineers would be welcome in this area.
But even at dispatch level, it is invalid to call KeSetEvent() with Wait
parameter set to
TRUE. This would force the call to return with the dispatcher locks held, at
synch IRQL.
A KeWaitForSingle() … is required imediately after, which can result
waiting for a non zero interval, which is invalid.
----- Original Message -----
From: “Doug”
Newsgroups: ntdev
To: “NT Developers Interest List”
Sent: Monday, September 09, 2002 4:35 PM
Subject: [ntdev] Re: Setting event at IRQL>DISPATCH_LEVEL
>>it’s not possible (for one reason) because scheduling an event requires
>>synchronizing with any other threads trying to access the event and one
>>cannot do that at > DISPATCH_LEVEL.
Why? (Just trying to understand)
—
You are currently subscribed to ntdev as: xxxxx@rdsor.ro
To unsubscribe send a blank email to %%email.unsub%%
thread A is attempting to test the event at passive level. It acquires
the lock and then is preempted by an interrupt. The interrupt routine
attempts to set the event which also require aquisition of the lock.
the ISR cannot get the lock until thread A yields it, but thread A won’t
run any more until the ISR returns. Deadlock.
-p
-----Original Message-----
From: Doug [mailto:xxxxx@hotmail.com]
Sent: Monday, September 09, 2002 6:36 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Setting event at IRQL>DISPATCH_LEVEL
>it’s not possible (for one reason) because scheduling an event
>requires synchronizing with any other threads trying to access the
>event and one cannot do that at > DISPATCH_LEVEL.
Why? (Just trying to understand)
You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to %%email.unsub%%
Microsoft NT OS Thread scheduler is running at DISPATCH_LEVEL as I said.
Theoretically a thread scheduler can running at any priority level, but it
will severely limit what the OSes can do in general and it usually is
undoable in a general purpose OS.
For example, one realtime extension to NT OS is when designated IRQ asserts,
it maskes off all the IRQs and schedule special threads within the extension
thread scheduler. It only yields to the OS when the extension has nothing to
do.
Bi
-----Original Message-----
From: Doug [mailto:xxxxx@hotmail.com]
Sent: Monday, September 09, 2002 6:37 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Setting event at IRQL>DISPATCH_LEVEL
But it appears the same thing happens at DISPATCH_LEVEL, but I can set an
event at DISPATCH_LEVEL. What makes >DISPATCH_LEVEL bad but DISPATCH_LEVEL
ok?
“Bi Chen” < xxxxx@AppStream.com mailto:xxxxx > wrote in
message news:xxxxx@ntdev news:xxxxx …
Beause setting event may lead thread context switch or move thread from
waiting queue to ready queue, which leads so many other things that just
cannot be done at DIRQ level.
Bi
—
You are currently subscribed to ntdev as: xxxxx@appstream.com
To unsubscribe send a blank email to %%email.unsub%%</news:xxxxx></mailto:xxxxx>
Ahhh… I did not know the event was spinlock protected. I would have thought it was some InterlockedExchange mechanism.
Thanks.
“Peter Wieland” wrote in message news:xxxxx@ntdev…
thread A is attempting to test the event at passive level. It acquires
the lock and then is preempted by an interrupt. The interrupt routine
attempts to set the event which also require aquisition of the lock.
the ISR cannot get the lock until thread A yields it, but thread A won’t
run any more until the ISR returns. Deadlock.
-p
RE: [ntdev] Setting event at IRQL>DISPATCH_LEVEL>DISPATCH_LEVEL is ISR, it could interrupt the dispatcher itself. Calling the dispatcher from the ISR will lead to deadlock on KiDispatcherLock on SMP machine, and to havoc on UP one.
Max
“Doug” wrote in message news:LYRIS-542-73938-2002.09.09-09.39.30–maxim#xxxxx@lists.osr.com…
But it appears the same thing happens at DISPATCH_LEVEL, but I can set an event at DISPATCH_LEVEL. What makes >DISPATCH_LEVEL bad but DISPATCH_LEVEL ok?
“Bi Chen” wrote in message news:xxxxx@ntdev…
Beause setting event may lead thread context switch or move thread from waiting queue to ready queue, which leads so many other things that just cannot be done at DIRQ level.
Bi
—
You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to %%email.unsub%%