All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC]why xnlock_put and xnlock_clear_irqon release xnlock directly?
@ 2020-07-09 15:25 alex_luca
  2020-07-10  9:05 ` Philippe Gerum
  0 siblings, 1 reply; 3+ messages in thread
From: alex_luca @ 2020-07-09 15:25 UTC (permalink / raw)
  To: xenomai; +Cc: Alex_luca

From: Alex_luca@163.com

hello,list
I have some doubts on *struct nklock* operations. 

Both *xnlock_get* and *xnlock_get_irqsave* is allowed to be called
nested;they will check that if the nklock has been acquired. If so
they won't actually do the "get", but return a value of 2.

But the *xnlock_put*, which corresponding to *xnlock_get* never
checks and will actually release the lock. This is diffrent from
*xnlock_put_irqrestore*.

What puzzles me is the following:
{
    ......
    xnlock_get_irqsave(nklock, s)
    ......
        xnlock_get(nklock)
        ......
        xnlock_put(nklock)
        ......
    xnlock_put_irqrestore(nklock, s)
}

First, *xnlock_get_irqsave* get the nklock, and *xnlock_get* will skip;
Then *xnlock_put* is called, and it released the nklock; after a
while *xnlock_put_irqrestore* is called on the same cpu, it also seems
to release the nklock.

Will this above happen in xenomai?  But I have never seen this happen.
Or *xnlock_get* was guaranteed never been called nesting?

Thank you.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-13 23:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-09 15:25 [RFC]why xnlock_put and xnlock_clear_irqon release xnlock directly? alex_luca
2020-07-10  9:05 ` Philippe Gerum
2020-07-13 23:58   ` caver Lio

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.