All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] [BUG] Lock stealing is borken
@ 2008-08-19 16:42 Jan Kiszka
  2008-08-19 19:12 ` Philippe Gerum
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Kiszka @ 2008-08-19 16:42 UTC (permalink / raw)
  To: xenomai-core

Hi,

bad news, everyone :(. According to the result of some lengthy debug
session with a customer and several ad-hoc lttng instrumentations, we
have a fatal bug in the nucleus' implementation of the lock stealing
algorithm. Consider this scenario:

1. Thread A acquires Mutex X successfully, ie. it leaves the (in this
   case) rt_mutex_acquire service, and its XNWAKEN flag is therefore
   cleared.

2. Thread A blocks on some further Mutex Y (in our case it was a
   semaphore, but that doesn't matter).

3. Thread B signals the availability of Mutex Y to Thread A, thus it
   also set XNWAKEN in Thread A. But Thread A is not yet scheduled on
   its CPU.

4. Thread C tries to acquire Mutex X, finds it assigned to Thread A, but
   also notices that the XNWAKEN flag of Thread A is set. Thus it steals
   the mutex although Thread A already entered the critical section -
   and hell breaks loose...

Looks like the XNWAKEN flag is misplaced in the owner's thread flags.
Can we safely move it into the synch object?

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux


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

end of thread, other threads:[~2008-08-28 19:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-19 16:42 [Xenomai-core] [BUG] Lock stealing is borken Jan Kiszka
2008-08-19 19:12 ` Philippe Gerum
2008-08-19 19:28   ` Jan Kiszka
2008-08-19 19:50     ` Philippe Gerum
2008-08-19 19:56       ` Jan Kiszka
2008-08-19 20:12         ` Philippe Gerum
2008-08-19 20:35           ` Jan Kiszka
2008-08-20  9:00             ` Philippe Gerum
2008-08-20  9:14               ` Jan Kiszka
2008-08-28 19:26                 ` Philippe Gerum

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.