public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RT] timer: Run irq_work() even if there are no active timers
@ 2014-01-24 19:51 Steven Rostedt
  2014-01-24 20:09 ` [PATCH RT v2] timer: Raise softirq if there's irq_work Steven Rostedt
  0 siblings, 1 reply; 7+ messages in thread
From: Steven Rostedt @ 2014-01-24 19:51 UTC (permalink / raw)
  To: LKML, linux-rt-users
  Cc: Thomas Gleixner, Sebastian Andrzej Siewior, Clark Williams,
	Luis Claudio R. Goncalves, John Kacur, Mike Galbraith,
	Joakim Hernberg, Joe Korty, Muli Baron

After trying hard to figure out why my i7 box was locking up with the
new active_timers code, that does not run the timer softirq if there
are no active timers, I took an extra look at the softirq handler and
noticed that it doesn't just run timer softirqs, it also runs irq work.

This was the bug that was locking up the system. It wasn't missing a
timer, it was missing irq work. By always doing the irq work callbacks,
the system boots fine.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

diff --git a/kernel/timer.c b/kernel/timer.c
index 46467be..7c5026e 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1464,8 +1464,12 @@ void run_local_timers(void)
 		raise_softirq(TIMER_SOFTIRQ);
 		return;
 	}
-	if (!base->active_timers)
+	if (!base->active_timers) {
+#if defined(CONFIG_IRQ_WORK) && defined(CONFIG_PREEMPT_RT_FULL)
+		irq_work_run();
+#endif
 		goto out;
+	}
 
 	/* Check whether the next pending timer has expired */
 	if (time_before_eq(base->next_timer, jiffies))

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

* [PATCH RT v2] timer: Raise softirq if there's irq_work
  2014-01-24 19:51 [PATCH RT] timer: Run irq_work() even if there are no active timers Steven Rostedt
@ 2014-01-24 20:09 ` Steven Rostedt
  2014-01-24 20:20   ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 7+ messages in thread
From: Steven Rostedt @ 2014-01-24 20:09 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: LKML, linux-rt-users, Thomas Gleixner, Sebastian Andrzej Siewior,
	Clark Williams, Luis Claudio R. Goncalves, John Kacur,
	Mike Galbraith, Joakim Hernberg, Joe Korty, Muli Baron

[ Talking with Sebastian on IRC, it seems that doing the irq_work_run()
  from the interrupt in -rt is a bad thing. Here we simply raise the
  softirq if there's irq work to do. This too boots on my i7 ]

After trying hard to figure out why my i7 box was locking up with the
new active_timers code, that does not run the timer softirq if there
are no active timers, I took an extra look at the softirq handler and
noticed that it doesn't just run timer softirqs, it also runs irq work.

This was the bug that was locking up the system. It wasn't missing a
timer, it was missing irq work. By always doing the irq work callbacks,
the system boots fine.

No need to check for defined(CONFIG_IRQ_WORK). When that's not set the
"irq_work_needs_cpu()" is a static inline that returns false.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

diff --git a/kernel/timer.c b/kernel/timer.c
index 46467be..c01a0d2 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1464,8 +1464,13 @@ void run_local_timers(void)
 		raise_softirq(TIMER_SOFTIRQ);
 		return;
 	}
-	if (!base->active_timers)
-		goto out;
+	if (!base->active_timers) {
+#ifdef CONFIG_PREEMPT_RT_FULL
+		/* On RT, irq work runs from softirq */
+		if (!irq_work_needs_cpu())
+#endif
+			goto out;
+	}
 
 	/* Check whether the next pending timer has expired */
 	if (time_before_eq(base->next_timer, jiffies))

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

* Re: [PATCH RT v2] timer: Raise softirq if there's irq_work
  2014-01-24 20:09 ` [PATCH RT v2] timer: Raise softirq if there's irq_work Steven Rostedt
@ 2014-01-24 20:20   ` Sebastian Andrzej Siewior
  2014-01-24 20:35     ` Steven Rostedt
  0 siblings, 1 reply; 7+ messages in thread
From: Sebastian Andrzej Siewior @ 2014-01-24 20:20 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: LKML, linux-rt-users, Thomas Gleixner, Clark Williams,
	Luis Claudio R. Goncalves, John Kacur, Mike Galbraith,
	Joakim Hernberg, Joe Korty, Muli Baron

* Steven Rostedt | 2014-01-24 15:09:33 [-0500]:

>[ Talking with Sebastian on IRC, it seems that doing the irq_work_run()
>  from the interrupt in -rt is a bad thing. Here we simply raise the
>  softirq if there's irq work to do. This too boots on my i7 ]

It is okay in general because most of the users should not run in bare
interrupt context. The only exception here is the nohz_full_kick_work
thing.

>After trying hard to figure out why my i7 box was locking up with the
>new active_timers code, that does not run the timer softirq if there
>are no active timers, I took an extra look at the softirq handler and
>noticed that it doesn't just run timer softirqs, it also runs irq work.
>
>This was the bug that was locking up the system. It wasn't missing a
>timer, it was missing irq work. By always doing the irq work callbacks,
>the system boots fine.
>
>No need to check for defined(CONFIG_IRQ_WORK). When that's not set the
>"irq_work_needs_cpu()" is a static inline that returns false.
>
>Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

Thank you Steven, this makes sense.

Sebastian

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

* Re: [PATCH RT v2] timer: Raise softirq if there's irq_work
  2014-01-24 20:20   ` Sebastian Andrzej Siewior
@ 2014-01-24 20:35     ` Steven Rostedt
  2014-01-24 20:42       ` Sebastian Andrzej Siewior
  2014-01-25  0:19       ` Paul E. McKenney
  0 siblings, 2 replies; 7+ messages in thread
From: Steven Rostedt @ 2014-01-24 20:35 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: LKML, linux-rt-users, Thomas Gleixner, Clark Williams,
	Luis Claudio R. Goncalves, John Kacur, Mike Galbraith,
	Joakim Hernberg, Joe Korty, Muli Baron, Paul E. McKenney

On Fri, 24 Jan 2014 21:20:39 +0100
Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:

> * Steven Rostedt | 2014-01-24 15:09:33 [-0500]:
> 
> >[ Talking with Sebastian on IRC, it seems that doing the irq_work_run()
> >  from the interrupt in -rt is a bad thing. Here we simply raise the
> >  softirq if there's irq work to do. This too boots on my i7 ]
> 
> It is okay in general because most of the users should not run in bare
> interrupt context. The only exception here is the nohz_full_kick_work
> thing.
> 

I know we discussed this on IRC, but I wanted to publicly state that
the missing irq work callback was the RCU's rsp_wakeup() function.

-- Steve

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

* Re: [PATCH RT v2] timer: Raise softirq if there's irq_work
  2014-01-24 20:35     ` Steven Rostedt
@ 2014-01-24 20:42       ` Sebastian Andrzej Siewior
  2014-01-25  0:19       ` Paul E. McKenney
  1 sibling, 0 replies; 7+ messages in thread
From: Sebastian Andrzej Siewior @ 2014-01-24 20:42 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: LKML, linux-rt-users, Thomas Gleixner, Clark Williams,
	Luis Claudio R. Goncalves, John Kacur, Mike Galbraith,
	Joakim Hernberg, Joe Korty, Muli Baron, Paul E. McKenney

On 01/24/2014 09:35 PM, Steven Rostedt wrote:
> 
> I know we discussed this on IRC, but I wanted to publicly state that
> the missing irq work callback was the RCU's rsp_wakeup() function.

Let me add that part to that commit message since I can't find it.

> 
> -- Steve

Sebastian

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

* Re: [PATCH RT v2] timer: Raise softirq if there's irq_work
  2014-01-24 20:35     ` Steven Rostedt
  2014-01-24 20:42       ` Sebastian Andrzej Siewior
@ 2014-01-25  0:19       ` Paul E. McKenney
  2014-01-25  2:16         ` Steven Rostedt
  1 sibling, 1 reply; 7+ messages in thread
From: Paul E. McKenney @ 2014-01-25  0:19 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Sebastian Andrzej Siewior, LKML, linux-rt-users, Thomas Gleixner,
	Clark Williams, Luis Claudio R. Goncalves, John Kacur,
	Mike Galbraith, Joakim Hernberg, Joe Korty, Muli Baron

On Fri, Jan 24, 2014 at 03:35:42PM -0500, Steven Rostedt wrote:
> On Fri, 24 Jan 2014 21:20:39 +0100
> Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
> 
> > * Steven Rostedt | 2014-01-24 15:09:33 [-0500]:
> > 
> > >[ Talking with Sebastian on IRC, it seems that doing the irq_work_run()
> > >  from the interrupt in -rt is a bad thing. Here we simply raise the
> > >  softirq if there's irq work to do. This too boots on my i7 ]
> > 
> > It is okay in general because most of the users should not run in bare
> > interrupt context. The only exception here is the nohz_full_kick_work
> > thing.
> 
> I know we discussed this on IRC, but I wanted to publicly state that
> the missing irq work callback was the RCU's rsp_wakeup() function.

Failing to invoke rsp_wakeup() when it was needed could potentially
stop RCU grace periods from happening, so having rsp_wakeup() happen
when it is needed is pretty important...

But I would guess that you knew that already.  ;-)

							Thanx, Paul

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

* Re: [PATCH RT v2] timer: Raise softirq if there's irq_work
  2014-01-25  0:19       ` Paul E. McKenney
@ 2014-01-25  2:16         ` Steven Rostedt
  0 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2014-01-25  2:16 UTC (permalink / raw)
  To: paulmck
  Cc: Sebastian Andrzej Siewior, LKML, linux-rt-users, Thomas Gleixner,
	Clark Williams, Luis Claudio R. Goncalves, John Kacur,
	Mike Galbraith, Joakim Hernberg, Joe Korty, Muli Baron

On Fri, 24 Jan 2014 16:19:36 -0800
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com> wrote:
 
> Failing to invoke rsp_wakeup() when it was needed could potentially
> stop RCU grace periods from happening, so having rsp_wakeup() happen
> when it is needed is pretty important...
> 
> But I would guess that you knew that already.  ;-)

Yep, I did. But it's always nice to hear confirmation, which is why I
Cc'd you ;-)

-- Steve

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

end of thread, other threads:[~2014-01-25  2:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-24 19:51 [PATCH RT] timer: Run irq_work() even if there are no active timers Steven Rostedt
2014-01-24 20:09 ` [PATCH RT v2] timer: Raise softirq if there's irq_work Steven Rostedt
2014-01-24 20:20   ` Sebastian Andrzej Siewior
2014-01-24 20:35     ` Steven Rostedt
2014-01-24 20:42       ` Sebastian Andrzej Siewior
2014-01-25  0:19       ` Paul E. McKenney
2014-01-25  2:16         ` Steven Rostedt

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