All of lore.kernel.org
 help / color / mirror / Atom feed
* semantics of reader/writer semaphores in rt patch
@ 2014-10-23 19:27 Chris Friesen
  2014-10-25 22:19 ` Thomas Gleixner
  0 siblings, 1 reply; 6+ messages in thread
From: Chris Friesen @ 2014-10-23 19:27 UTC (permalink / raw)
  To: rt-users

I recently noticed that when CONFIG_PREEMPT_RT_FULL is enabled we the 
semantics change.  From "include/linux/rwsem_rt.h":

  * Note that the semantics are different from the usual
  * Linux rw-sems, in PREEMPT_RT mode we do not allow
  * multiple readers to hold the lock at once, we only allow
  * a read-lock owner to read-lock recursively. This is
  * better for latency, makes the implementation inherently
  * fair and makes it simpler as well.

How is this valid?  It seems to me that there are any number of code 
paths that could depend on having multiple threads of execution be able 
to hold the reader lock simultaneously.  Something as simple as:

thread A:
take rw_semaphore X for reading
take lock Y, modify data, release lock Y
wake up thread B
wait on conditional protected by lock Y
free rw_semaphore X

thread B:
take rw_semaphore X for reading
wait on conditional protected by lock Y
send message to wake up thread A
free rw_semaphore X


In the regular kernel this would work, in the RT kernel it would deadlock.

Does the RT kernel just disallow this sort of algorithm?

Chris

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

end of thread, other threads:[~2014-10-27 15:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-23 19:27 semantics of reader/writer semaphores in rt patch Chris Friesen
2014-10-25 22:19 ` Thomas Gleixner
2014-10-25 22:21   ` Thomas Gleixner
2014-10-26  7:42     ` Peter Zijlstra
2014-10-26  8:47       ` Peter Zijlstra
2014-10-27 15:02   ` Chris Friesen

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.