kernel spinlock/executive question

Hi all!
Can someone tell me how to atomically drop a spinlock and then contend
for executive lock in exclusive mode. I need this cuz I hold the
spinlock while searching through a linked list and once match is found
I would like to grab the executive resource of the matched node.
Dropping spinlock and then grabbing executive can cause someother
thread to destroy the node.

thanks a bunch!
naja


Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

Is there any reason to be spinlock specific? Why dont you use Mutex in place
of the spinlock?

Raja

<< Hi all!
Can someone tell me how to atomically drop a spinlock and then contend
for executive lock in exclusive mode. I need this cuz I hold the
spinlock while searching through a linked list and once match is found
I would like to grab the executive resource of the matched node.
Dropping spinlock and then grabbing executive can cause someother
thread to destroy the node.

thanks a bunch!
naja >>

Whoops… in place of both the spinlock and eresource. Assign mutexs to the
nodes with higher level than the mutex for the list. Since you are using
spinlock to protect the list you are not taking advantage of eresource here.

Is there any reason to be spinlock specific? Why dont you use Mutex in
place
of the spinlock?

Raja

<< Hi all!
Can someone tell me how to atomically drop a spinlock and then contend
for executive lock in exclusive mode. I need this cuz I hold the
spinlock while searching through a linked list and once match is found
I would like to grab the executive resource of the matched node.
Dropping spinlock and then grabbing executive can cause someother
thread to destroy the node.

thanks a bunch!
naja >>


You are currently subscribed to ntfsd as: xxxxx@hotmail.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

True. Note that you are talking normal lock order, not the “level” that
seems to be in place for NT kernel mutexes. That has no meaning.

If you use primitives, the third parameter to KeSetEvent is actually
exactly for the atomic set/wait transition. If TRUE, it will return with
the dispatcher held, and you can KeWaitForSingleObject on the next
event.

-----Original Message-----
From: Raja [mailto:xxxxx@hotmail.com]
Sent: Thursday, September 21, 2000 7:42 PM
To: File Systems Developers
Subject: [ntfsd] Re: kernel spinlock/executive question

Whoops… in place of both the spinlock and eresource. Assign mutexs to
the
nodes with higher level than the mutex for the list. Since you are using
spinlock to protect the list you are not taking advantage of eresource
here.

Is there any reason to be spinlock specific? Why dont you use Mutex in
place
of the spinlock?

Raja

<< Hi all!
Can someone tell me how to atomically drop a spinlock and then
contend
for executive lock in exclusive mode. I need this cuz I hold the
spinlock while searching through a linked list and once match is
found
I would like to grab the executive resource of the matched node.
Dropping spinlock and then grabbing executive can cause someother
thread to destroy the node.

thanks a bunch!
naja >>


You are currently subscribed to ntfsd as: xxxxx@hotmail.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)


You are currently subscribed to ntfsd as: xxxxx@exchange.microsoft.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

Thanks for the replies. I wasn’t clear about my question. I am not
holding multiple locks here. I want to drop a spinlock and acquire
executive resource atomically. After dropping spinlock; I see the
thread can be swapped out. Having dispatcher locked like you mentioned
can help me on this I think. But I don’t know whether there are APIs
exported.

thanks
naja

— Daniel Lovinger wrote:
> True. Note that you are talking normal lock order, not the “level”
> that
> seems to be in place for NT kernel mutexes. That has no meaning.
>
> If you use primitives, the third parameter to KeSetEvent is actually
> exactly for the atomic set/wait transition. If TRUE, it will return
> with
> the dispatcher held, and you can KeWaitForSingleObject on the next
> event.
>
> -----Original Message-----
> From: Raja [mailto:xxxxx@hotmail.com]
> Sent: Thursday, September 21, 2000 7:42 PM
> To: File Systems Developers
> Subject: [ntfsd] Re: kernel spinlock/executive question
>
>
> Whoops… in place of both the spinlock and eresource. Assign mutexs
> to
> the
> nodes with higher level than the mutex for the list. Since you are
> using
> spinlock to protect the list you are not taking advantage of
> eresource
> here.
>
> > Is there any reason to be spinlock specific? Why dont you use Mutex
> in
> place
> > of the spinlock?
> >
> > Raja
> >
> > << Hi all!
> > Can someone tell me how to atomically drop a spinlock and then
> contend
> > for executive lock in exclusive mode. I need this cuz I hold the
> > spinlock while searching through a linked list and once match is
> found
> > I would like to grab the executive resource of the matched node.
> > Dropping spinlock and then grabbing executive can cause someother
> > thread to destroy the node.
> >
> > thanks a bunch!
> > naja >>
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@hotmail.com
> > To unsubscribe send a blank email to
> $subst(‘Email.Unsub’)
> >
> >
>
> —
> You are currently subscribed to ntfsd as:
> xxxxx@exchange.microsoft.com
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@yahoo.com
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

> spinlock while searching through a linked list and once match is found

I would like to grab the executive resource of the matched node.
Dropping spinlock and then grabbing executive can cause someother

Detach it from the list instead of grabbing the executive lock - this will
ensure that no other code will be able to see it.
Put it on the list back instead of releasing the executive lock.

Max