mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RT] Race condition on bug output.
@ 2005-12-07  3:34 Steven Rostedt
  2005-12-07  8:33 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2005-12-07  3:34 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: LKML, Thomas Gleixner, john stultz

Hi Ingo,

I found a race condition in my kernel which can also be found in yours.
When I trigger the printk in check_periodic_interval, interrupts are
turned on in release_console_sem.  Unfortunately, this can have an
interrupt go off there (since they are turned back on there) and the
write_lock system_time_lock will be taken again, thus producing a
deadlock.

I'm not sure if this is the best solution, but this was the easiest.

Maybe the CONFIG_PARANOID_GENERIC_TIME should be added in the warnings
in init/main.c too?

Since interrupts are kept off in the ktimer (hrtimer, whatever) in
printk, this does not affect those patches.  This is a PREEMPT_RT only
problem.

-- Steve

Index: linux-2.6.14-rt22/kernel/printk.c
===================================================================
--- linux-2.6.14-rt22.orig/kernel/printk.c	2005-12-06 21:44:53.000000000 -0500
+++ linux-2.6.14-rt22/kernel/printk.c	2005-12-06 21:52:11.000000000 -0500
@@ -757,7 +757,8 @@
 		 * on PREEMPT_RT, call console drivers with
 		 * interrupts enabled (unless we are debugging):
 		 */
-#if defined(CONFIG_PREEMPT_RT) && !defined(CONFIG_PRINTK_IGNORE_LOGLEVEL) && !defined(CONFIG_PPC)
+#if defined(CONFIG_PREEMPT_RT) && !defined(CONFIG_PRINTK_IGNORE_LOGLEVEL) && !defined(CONFIG_PPC) \
+    && !defined(CONFIG_PARANOID_GENERIC_TIME)
 		spin_unlock_irq(&logbuf_lock);
 #else
 		spin_unlock(&logbuf_lock);



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

* Re: [RT] Race condition on bug output.
  2005-12-07  3:34 [RT] Race condition on bug output Steven Rostedt
@ 2005-12-07  8:33 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2005-12-07  8:33 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: LKML, Thomas Gleixner, john stultz


* Steven Rostedt <rostedt@goodmis.org> wrote:

> Hi Ingo,
> 
> I found a race condition in my kernel which can also be found in 
> yours. When I trigger the printk in check_periodic_interval, 
> interrupts are turned on in release_console_sem.  Unfortunately, this 
> can have an interrupt go off there (since they are turned back on 
> there) and the write_lock system_time_lock will be taken again, thus 
> producing a deadlock.
> 
> I'm not sure if this is the best solution, but this was the easiest.
> 
> Maybe the CONFIG_PARANOID_GENERIC_TIME should be added in the warnings 
> in init/main.c too?
> 
> Since interrupts are kept off in the ktimer (hrtimer, whatever) in 
> printk, this does not affect those patches.  This is a PREEMPT_RT only 
> problem.

thanks, applied.

	Ingo

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

end of thread, other threads:[~2005-12-07  8:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-07  3:34 [RT] Race condition on bug output Steven Rostedt
2005-12-07  8:33 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®