mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Bin Gao <bin.gao@intel.com>,
	x86@kernel.org
Subject: Re: [PATCH] x86, tsc: Add missing Baytrail frequency to the table
Date: Thu, 23 Jan 2014 17:35:28 +0200	[thread overview]
Message-ID: <20140123153528.GJ18029@intel.com> (raw)
In-Reply-To: <20140123150912.7ee822a0@alan.etchedpixels.co.uk>

On Thu, Jan 23, 2014 at 03:09:12PM +0000, One Thousand Gnomes wrote:
> On Thu, 23 Jan 2014 13:04:03 +0200
> Mika Westerberg <mika.westerberg@linux.intel.com> wrote:
> 
> > Baytrail is based on Silvermont core so MSR_FSB_FREQ[2:0] == 0 means that
> > the CPU reference clock runs at 83.3MHz. Without this we crash a bit later
> > with backtrace looking like:
> 
> Would it not be wise to also make the code robust against future failures
> of this kind and at least bitch rather than divide by 0 ?

Yes, it makes sense. I wasn't sure how to do that properly, though.

The following patch seems to work in that case.

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index a3acbac2ee72..1e54deb56b33 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -655,10 +655,11 @@ unsigned long native_calibrate_tsc(void)
 	local_irq_save(flags);
 	i = try_msr_calibrate_tsc(&fast_calibrate);
 	local_irq_restore(flags);
-	if (i >= 0) {
-		if (i == 0)
-			pr_warn("Fast TSC calibration using MSR failed\n");
+	if (i > 0) {
 		return fast_calibrate;
+	} else if (i == 0) {
+		pr_warn("Fast TSC calibration using MSR failed\n");
+		/* Continue with the normal calibration */
 	}
 
 	local_irq_save(flags);

  parent reply	other threads:[~2014-01-23 15:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-23 11:04 Mika Westerberg
2014-01-23 15:09 ` One Thousand Gnomes
2014-01-23 15:30   ` H. Peter Anvin
2014-01-23 15:35   ` Mika Westerberg [this message]
2014-01-24  8:46   ` [PATCH v2] " Mika Westerberg
     [not found]     ` <4460FA1017EA3844B646E90DA4E984057D5A4E9F@ORSMSX103.amr.corp.intel.com>
2014-01-25  9:09       ` Bin Gao
2014-01-27 10:20         ` Mika Westerberg
2014-01-28 12:04           ` Mika Westerberg
2014-01-29 21:47             ` Bin Gao
2014-02-04 13:28               ` Mika Westerberg
2014-02-06  5:44                 ` Ingo Molnar
2014-02-06 11:49                   ` [PATCH v3 1/2] x86, tsc: Fallback to normal calibration if fast MSR calibration fails Mika Westerberg
2014-02-06 11:49                     ` [PATCH v3 2/2] x86, tsc: Add missing Baytrail frequency to the table Mika Westerberg
2014-02-06 14:34                     ` [PATCH v3 1/2] x86, tsc: Fallback to normal calibration if fast MSR calibration fails Thomas Gleixner
2014-02-06 15:11                       ` Mika Westerberg
2014-02-09 14:20                         ` Ingo Molnar

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=20140123153528.GJ18029@intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=bin.gao@intel.com \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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

Powered by JetHome