All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hrtimer: prevent migration for raising softirq
@ 2008-07-03 18:31 Steven Rostedt
  2008-07-03 22:53 ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2008-07-03 18:31 UTC (permalink / raw)
  To: LKML; +Cc: Thomas Gleixner, Linus Torvalds, akpm, Peter Zijlstra, stable


Due to a possible deadlock, the waking of the softirq was pushed outside
of the hrtimer base locks. See commit 0c96c5979a522c3323c30a078a70120e29b5bdbc

Unfortunately this allows the task to migrate after setting up the softirq
and raising it. Since softirqs run a queue that is per-cpu we may raise the
softirq on the wrong CPU and this will keep the queued softirq task from
running.

To solve this issue, this patch disables preemption around the releasing
of the hrtimer lock and raising of the softirq.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>

---
 kernel/hrtimer.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Index: linus.git/kernel/hrtimer.c
===================================================================
--- linus.git.orig/kernel/hrtimer.c	2008-05-09 15:11:45.000000000 -0400
+++ linus.git/kernel/hrtimer.c	2008-07-03 14:07:30.000000000 -0400
@@ -1003,10 +1003,18 @@ hrtimer_start(struct hrtimer *timer, kti
 	 */
 	raise = timer->state == HRTIMER_STATE_PENDING;

+	/*
+	 * We use preempt_disable to prevent this task from migrating after
+	 * setting up the softirq and raising it. Otherwise, if me migrate
+	 * we will raise the softirq on the wrong CPU.
+	 */
+	preempt_disable();
+
 	unlock_hrtimer_base(timer, &flags);

 	if (raise)
 		hrtimer_raise_softirq();
+	preempt_enable();

 	return ret;
 }


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

* Re: [PATCH] hrtimer: prevent migration for raising softirq
  2008-07-03 18:31 [PATCH] hrtimer: prevent migration for raising softirq Steven Rostedt
@ 2008-07-03 22:53 ` Andrew Morton
  2008-07-04  1:56   ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2008-07-03 22:53 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel, tglx, torvalds, akpm, peterz, stable

On Thu, 3 Jul 2008 14:31:26 -0400 (EDT)
Steven Rostedt <rostedt@goodmis.org> wrote:

> Due to a possible deadlock, the waking of the softirq was pushed outside
> of the hrtimer base locks. See commit 0c96c5979a522c3323c30a078a70120e29b5bdbc

Please quote at least the patch title rather than raw hashes.

afaict that patch isn't in 2.6.25 yet you copied stable@kernel.org. 
Please clarify.

> 
> Unfortunately this allows the task to migrate after setting up the softirq
> and raising it. Since softirqs run a queue that is per-cpu we may raise the
> softirq on the wrong CPU and this will keep the queued softirq task from
> running.
> 
> To solve this issue, this patch disables preemption around the releasing
> of the hrtimer lock and raising of the softirq.
> 

This seems to be 2.6.26 material and is inapplicable to 2.6.25?

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

* Re: [PATCH] hrtimer: prevent migration for raising softirq
  2008-07-03 22:53 ` Andrew Morton
@ 2008-07-04  1:56   ` Steven Rostedt
  2008-07-04  2:03     ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2008-07-04  1:56 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, tglx, torvalds, akpm, peterz, stable



On Thu, 3 Jul 2008, Andrew Morton wrote:

>
> On Thu, 3 Jul 2008 14:31:26 -0400 (EDT)
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > Due to a possible deadlock, the waking of the softirq was pushed outside
> > of the hrtimer base locks. See commit 0c96c5979a522c3323c30a078a70120e29b5bdbc
>
> Please quote at least the patch title rather than raw hashes.

Sorry, will do next time. I'm getting to use to git.

>
> afaict that patch isn't in 2.6.25 yet you copied stable@kernel.org.
> Please clarify.

The reason I did so is because that commit has a Cc: stable@kernel.org.
I figured that if that patch is in queue for stable this one should be in
right afterwards.

>
> >
> > Unfortunately this allows the task to migrate after setting up the softirq
> > and raising it. Since softirqs run a queue that is per-cpu we may raise the
> > softirq on the wrong CPU and this will keep the queued softirq task from
> > running.
> >
> > To solve this issue, this patch disables preemption around the releasing
> > of the hrtimer lock and raising of the softirq.
> >
>
> This seems to be 2.6.26 material and is inapplicable to 2.6.25?
>

[/me goes to look at the 2.6.25.4 he has sitting around]

The above mentioned commit (Title: hrtimer: raise softirq unlocked to
avoid circular lock dependency) is, in fact, in 2.6.25.4.

-- Steve


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

* Re: [PATCH] hrtimer: prevent migration for raising softirq
  2008-07-04  1:56   ` Steven Rostedt
@ 2008-07-04  2:03     ` Andrew Morton
  2008-07-04  2:20       ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2008-07-04  2:03 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel, tglx, torvalds, akpm, peterz, stable

On Thu, 3 Jul 2008 21:56:00 -0400 (EDT) Steven Rostedt <rostedt@goodmis.org> wrote:

> 
> 
> On Thu, 3 Jul 2008, Andrew Morton wrote:
> 
> >
> > On Thu, 3 Jul 2008 14:31:26 -0400 (EDT)
> > Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> > > Due to a possible deadlock, the waking of the softirq was pushed outside
> > > of the hrtimer base locks. See commit 0c96c5979a522c3323c30a078a70120e29b5bdbc
> >
> > Please quote at least the patch title rather than raw hashes.
> 
> Sorry, will do next time. I'm getting to use to git.
> 
> >
> > afaict that patch isn't in 2.6.25 yet you copied stable@kernel.org.
> > Please clarify.
> 
> The reason I did so is because that commit has a Cc: stable@kernel.org.
> I figured that if that patch is in queue for stable this one should be in
> right afterwards.
> 
> >
> > >
> > > Unfortunately this allows the task to migrate after setting up the softirq
> > > and raising it. Since softirqs run a queue that is per-cpu we may raise the
> > > softirq on the wrong CPU and this will keep the queued softirq task from
> > > running.
> > >
> > > To solve this issue, this patch disables preemption around the releasing
> > > of the hrtimer lock and raising of the softirq.
> > >
> >
> > This seems to be 2.6.26 material and is inapplicable to 2.6.25?
> >
> 
> [/me goes to look at the 2.6.25.4 he has sitting around]
> 
> The above mentioned commit (Title: hrtimer: raise softirq unlocked to
> avoid circular lock dependency) is, in fact, in 2.6.25.4.
> 

Ah, OK, I'm a dope.

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

* Re: [PATCH] hrtimer: prevent migration for raising softirq
  2008-07-04  2:03     ` Andrew Morton
@ 2008-07-04  2:20       ` Steven Rostedt
  0 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2008-07-04  2:20 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, tglx, torvalds, akpm, peterz, stable


On Thu, 3 Jul 2008, Andrew Morton wrote:
> >
> > [/me goes to look at the 2.6.25.4 he has sitting around]
> >
> > The above mentioned commit (Title: hrtimer: raise softirq unlocked to
> > avoid circular lock dependency) is, in fact, in 2.6.25.4.
> >
>
> Ah, OK, I'm a dope.
>

No, you're not. Overworked, perhaps, but definitely not a dope ;-)

-- Steve


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

end of thread, other threads:[~2008-07-04  2:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-03 18:31 [PATCH] hrtimer: prevent migration for raising softirq Steven Rostedt
2008-07-03 22:53 ` Andrew Morton
2008-07-04  1:56   ` Steven Rostedt
2008-07-04  2:03     ` Andrew Morton
2008-07-04  2:20       ` Steven Rostedt

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.