From: Thomas Gleixner <tglx@linutronix.de>
To: Andres Salomon <dilinger@debian.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@osdl.org>
Subject: [PATCH] highres: Do not run the TIMER_SOFTIRQ after switching to highres mode
Date: Sun, 04 Mar 2007 14:09:54 +0100 [thread overview]
Message-ID: <1173013794.24738.130.camel@localhost.localdomain> (raw)
In-Reply-To: <45EAAA21.4040803@debian.org>
> > The question is, how the tick timer gets enqueued in the softirq queue.
> > Can you isolate the codepath, where this happens ?
The TIMER_SOFTIRQ runs the hrtimers during bootup until a usable
clocksource and clock event sources are registered. The switch to high
resolution mode happens inside of the TIMER_SOFTIRQ, but runs the
softirq afterwards. That way the tick emulation timer, which was set up
in the switch to highres might be executed in the softirq context, which
is a BUG. The rbtree has not to be touched by the softirq after the
highres switch.
This BUG was observed by Andres Salomon, who provided the information to
debug it.
Return early from the softirq, when the switch was sucessful.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 476cb0c..b2dd223 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -540,19 +540,19 @@ static inline int hrtimer_enqueue_reprog
/*
* Switch to high resolution mode
*/
-static void hrtimer_switch_to_hres(void)
+static int hrtimer_switch_to_hres(void)
{
struct hrtimer_cpu_base *base = &__get_cpu_var(hrtimer_bases);
unsigned long flags;
if (base->hres_active)
- return;
+ return 1;
local_irq_save(flags);
if (tick_init_highres()) {
local_irq_restore(flags);
- return;
+ return 0;
}
base->hres_active = 1;
base->clock_base[CLOCK_REALTIME].resolution = KTIME_HIGH_RES;
@@ -565,13 +565,14 @@ static void hrtimer_switch_to_hres(void)
local_irq_restore(flags);
printk(KERN_INFO "Switched to high resolution mode on CPU %d\n",
smp_processor_id());
+ return 1;
}
#else
static inline int hrtimer_hres_active(void) { return 0; }
static inline int hrtimer_is_hres_enabled(void) { return 0; }
-static inline void hrtimer_switch_to_hres(void) { }
+static inline int hrtimer_switch_to_hres(void) { return 0; }
static inline void hrtimer_force_reprogram(struct hrtimer_cpu_base *base) { }
static inline int hrtimer_enqueue_reprogram(struct hrtimer *timer,
struct hrtimer_clock_base *base)
@@ -1173,7 +1174,8 @@ void hrtimer_run_queues(void)
* deadlock vs. xtime_lock.
*/
if (tick_check_oneshot_change(!hrtimer_is_hres_enabled()))
- hrtimer_switch_to_hres();
+ if (hrtimer_switch_to_hres())
+ return;
hrtimer_get_softirq_time(cpu_base);
next prev parent reply other threads:[~2007-03-04 13:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-03 2:52 [PATCH] dynticks: don't unlock spinlock twice Andres Salomon
2007-03-03 9:02 ` Thomas Gleixner
2007-03-04 11:14 ` Andres Salomon
2007-03-04 13:09 ` Thomas Gleixner [this message]
2007-03-04 13:12 ` [PATCH] highres: Do not run the TIMER_SOFTIRQ after switching to highres mode Andres Salomon
2007-03-04 13:23 ` Thomas Gleixner
2007-03-05 7:25 ` Ingo Molnar
2007-03-05 7:50 ` Andres Salomon
2007-03-05 7:52 ` Ingo Molnar
2007-03-05 1:50 [5/6] 2.6.21-rc2: known regressions Adrian Bunk
2007-03-05 23:43 ` Thomas Gleixner
2007-03-05 23:45 ` Linus Torvalds
2007-03-06 0:38 ` Linus Torvalds
2007-03-06 1:02 ` Thomas Gleixner
2007-03-06 1:31 ` Linus Torvalds
2007-03-06 2:18 ` Linus Torvalds
2007-03-06 10:33 ` Michael S. Tsirkin
2007-03-06 10:37 ` Ingo Molnar
2007-03-06 10:46 ` Michael S. Tsirkin
2007-03-06 11:32 ` Ingo Molnar
2007-03-06 16:44 ` Linus Torvalds
2007-03-06 17:29 ` [PATCH] highres: do not run the TIMER_SOFTIRQ after switching to highres mode Thomas Gleixner
2007-03-06 17:41 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1173013794.24738.130.camel@localhost.localdomain \
--to=tglx@linutronix.de \
--cc=akpm@osdl.org \
--cc=dilinger@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®