Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758612AbYGVXeX (ORCPT ); Tue, 22 Jul 2008 19:34:23 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758143AbYGVXXl (ORCPT ); Tue, 22 Jul 2008 19:23:41 -0400 Received: from cantor.suse.de ([195.135.220.2]:53752 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756370AbYGVXXj (ORCPT ); Tue, 22 Jul 2008 19:23:39 -0400 Date: Tue, 22 Jul 2008 16:17:43 -0700 From: Greg KH To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , Chris Wedgwood , Michael Krufky , Chuck Ebbert , Domenico Andreoli , Willy Tarreau , Rodrigo Rubira Branco , Jake Edge , torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, akpm@osdl.org, Peter Zijlstra , Thomas Gleixner , Steven Rostedt Subject: [patch 46/47] hrtimer: prevent migration for raising softirq Message-ID: <20080722231743.GU8282@suse.de> References: <20080722230208.148102983@mini.kroah.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="hrtimer-prevent-migration-for-raising-softirq.patch" In-Reply-To: <20080722231342.GA8282@suse.de> User-Agent: Mutt/1.5.16 (2007-06-09) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1707 Lines: 55 2.6.25-stable review patch. If anyone has any objections, please let us know. ------------------ From: Steven Rostedt commit ee3ece830f6db9837f7ac67008f532a8c1e755f4 upstream. 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 Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- kernel/hrtimer.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -896,10 +896,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; } -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/