All of lore.kernel.org
 help / color / mirror / Atom feed
From: john stultz <johnstul@us.ibm.com>
To: Karol Kozimor <sziwan@hell.org.pl>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: Re: [2.6.0-mm2] PM timer still has problems
Date: Mon, 05 Jan 2004 14:11:56 -0800	[thread overview]
Message-ID: <1073340716.15645.96.camel@cog.beaverton.ibm.com> (raw)
In-Reply-To: <20031230204831.GA17344@hell.org.pl>

On Tue, 2003-12-30 at 12:48, Karol Kozimor wrote:
> Hi,
> Booting with clock=pmtmr causes weird problems here (the system 
> complains that clock override failed and the bogomips loop produces bogus
> values). Below is the dmesg output as well as /proc/cpuinfo.
> I have CONFIG_X86_LOCAL_APIC=y and CONFIG_X86_PM_TIMER=y.
> 
> I don't really know whether this box (ASUS L3800C, more data at
> http://bugme.osdl.org/show_bug.cgi?id=1185) has a PM timer or not, but even
> if it doesn't, the code should account for that gracefully.
> I'll be happy to provide any additional info.

If the override boot option failed, its most likely your system doesn't
have an ACPI PM time source.  Instead it seems your system is having
trouble using the PIT as a time source (which seems not all that
uncommon unfortunately). 

I guess we can just re-call select_timer() without an override if the
override fails, that way you'll fall back to the default time source on
your system. Try the (compile tested) patch below and see if that helps.

Thanks for the feedback! 
-john


diff -Nru a/arch/i386/kernel/timers/timer.c b/arch/i386/kernel/timers/timer.c
--- a/arch/i386/kernel/timers/timer.c	Mon Jan  5 14:09:26 2004
+++ b/arch/i386/kernel/timers/timer.c	Mon Jan  5 14:09:26 2004
@@ -43,21 +43,40 @@
 	cur_timer = &timer_pit;
 }
 
-/* iterates through the list of timers, returning the first 
- * one that initializes successfully.
+/* helper function to iterates through the list of timers, 
+ * returning the first one that initializes successfully.
  */
-struct timer_opts* select_timer(void)
+static struct timer_opts* pick_timer(char* override)
 {
 	int i = 0;
 	
 	/* find most preferred working timer */
 	while (timers[i]) {
 		if (timers[i]->init)
-			if (timers[i]->init(clock_override) == 0)
+			if (timers[i]->init(override) == 0)
 				return timers[i];
 		++i;
 	}
-		
-	panic("select_timer: Cannot find a suitable timer\n");
 	return NULL;
+}
+ 
+struct timer_opts* select_timer(void)
+{
+	struct timer_opts* ret;
+
+	/* pick the best time source*/
+	ret = pick_timer(clock_override);
+
+	/* if we didn't find anything, try without the override */
+	if (!ret && clock_override) {
+		printk("Warning: 'clock=%s' override failed.\n", clock_override);
+		ret = pick_timer(NULL);
+	}
+
+	/* if we still didn't find anything, we're ruined */
+	/* note that this won't happen, as the PIT always succeeds*/
+	if (!ret)
+		panic("select_timer: Cannot find a suitable timer\n");
+
+	return ret;
 }
diff -Nru a/arch/i386/kernel/timers/timer_pit.c b/arch/i386/kernel/timers/timer_pit.c
--- a/arch/i386/kernel/timers/timer_pit.c	Mon Jan  5 14:09:26 2004
+++ b/arch/i386/kernel/timers/timer_pit.c	Mon Jan  5 14:09:26 2004
@@ -24,7 +24,7 @@
 {
  	/* check clock override */
  	if (override[0] && strncmp(override,"pit",3))
- 		printk(KERN_ERR "Warning: clock= override failed. Defaulting to PIT\n");
+ 		return -ENODEV;
  
 	count_p = LATCH;
 	return 0;



  parent reply	other threads:[~2004-01-05 22:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-30 20:48 [2.6.0-mm2] PM timer still has problems Karol Kozimor
2003-12-31  4:02 ` Andrew Morton
2004-01-04  0:44   ` Karol Kozimor
2004-01-05  6:17     ` Dmitry Torokhov
2004-01-05 12:18       ` Karol Kozimor
2004-01-06  8:31       ` john stultz
2004-01-07  6:30         ` Dmitry Torokhov
2004-01-07 17:01           ` john stultz
2004-03-29 15:44       ` Karol Kozimor
2004-01-05 22:11 ` john stultz [this message]
2004-01-05 22:17   ` Karol Kozimor
2004-01-05 22:32     ` john stultz
2004-01-05 22:54       ` Karol Kozimor
2004-01-05 23:18       ` Karol Kozimor
2004-01-05 23:30         ` john stultz
2004-01-06  4:32   ` Dmitry Torokhov
2004-01-17  1:54     ` Karol Kozimor
2004-01-24  0:55     ` Karol Kozimor

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=1073340716.15645.96.camel@cog.beaverton.ibm.com \
    --to=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sziwan@hell.org.pl \
    /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 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.