mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shaohua Li <shaohua.li@intel.com>
To: cpufreq@lists.linux.org.uk, lkml <linux-kernel@vger.kernel.org>
Subject: [BUG] cpu_khz isn't reliable at boot time
Date: Tue, 11 Jul 2006 13:17:36 +0800	[thread overview]
Message-ID: <1152595057.21189.150.camel@sli10-desk.sh.intel.com> (raw)

In mobile system, BIOS usually sets CPU to low speed. In modern CPU, TSC
is constant speed regardless of CPU speed. Linux uses TSC to calculate
cpu_khz, which is the full speed frequence of CPU instead of low speed
in some systems. This might invoke some potential issues. One is NMI
watchdog, which runs less frequently in cpu low speed mode.

Below workaround from Len addressed the NMI issue, any idea?

diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index d43b498..b157186 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -150,7 +150,12 @@ #ifdef CONFIG_SMP
 		if (!cpu_isset(cpu, cpu_callin_map))
 			continue;
 #endif
-		if (nmi_count(cpu) - prev_nmi_count[cpu] <= 5) {
+		/*
+		 * Fail if there were NO watchdog interrupts recorded.
+		 * We don't know the exact number to expect because
+		 * cpu_khz is variable.
+		 */
+		if ((nmi_count(cpu) - prev_nmi_count[cpu]) == 0) {
 			endflag = 1;
 			printk("CPU#%d: NMI appears to be stuck (%d->%d)!\n",
 				cpu,
@@ -357,6 +362,11 @@ static void clear_msr_range(unsigned int
 		wrmsr(base+i, 0, 0);
 }
 
+/*
+ * n.b.
+ * cpu_khz may not reflect the current or future khz of the processor
+ * depending on what speed the system booted at and if cpufreq is running
+ */
 static void write_watchdog_counter(const char *descr)
 {
 	u64 count = (u64)cpu_khz * 1000;

                 reply	other threads:[~2006-07-11  5:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1152595057.21189.150.camel@sli10-desk.sh.intel.com \
    --to=shaohua.li@intel.com \
    --cc=cpufreq@lists.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /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®