All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Ingo Molnar <mingo@elte.hu>,
	"Maciej W. Rozycki" <macro@linux-mips.org>,
	Yinghai Lu <yhlu.kernel@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] lapic calibration results fix
Date: Sun, 13 Jul 2008 20:23:37 +0400	[thread overview]
Message-ID: <20080713162337.GC7459@asus> (raw)
In-Reply-To: <20080713113734.GB7459@asus>

[Cyrill Gorcunov - Sun, Jul 13, 2008 at 03:37:34PM +0400]
| Ingo, Maciej,
| 
| it seems I found a bit strange code snippet in apic_32.c:setup_boot_APIC_clock.
| We set local_apic_timer_verify_ok = 1 before checking the results. I think
| the following patch make sense. Please take a look on.
| 
| ---
| We set lapic flag that clocksource calibration is
| fine too early. Fix it.
| 
| Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
| ---
| 
| Index: linux-2.6.git/arch/x86/kernel/apic_32.c
| ===================================================================
| --- linux-2.6.git.orig/arch/x86/kernel/apic_32.c	2008-07-13 15:25:20.000000000 +0400
| +++ linux-2.6.git/arch/x86/kernel/apic_32.c	2008-07-13 15:31:03.000000000 +0400
| @@ -489,8 +489,6 @@ void __init setup_boot_APIC_clock(void)
|  		    calibration_result / (1000000 / HZ),
|  		    calibration_result % (1000000 / HZ));
|  
| -	local_apic_timer_verify_ok = 1;
| -
|  	/*
|  	 * Do a sanity check on the APIC calibration result
|  	 */
| @@ -504,6 +502,8 @@ void __init setup_boot_APIC_clock(void)
|  		return;
|  	}
|  
| +	local_apic_timer_verify_ok = 1;
| +
|  	/* We trust the pm timer based calibration */
|  	if (!pm_referenced) {
|  		apic_printk(APIC_VERBOSE, "... verify APIC timer\n");

Letme clarify a bit situation why I propose this path (it's not that
clear from its description).

While calibrating apic timer we use different 'flags' signaling if it
was success/fail. On 64bit platform lapic_timer_setup() does check
for CLOCK_EVT_FEAT_DUMMY bit which is set by default and cleared on
successfully calibrated timer. So 64bit is fine now. On 32bit we
use a different approach - local_apic_timer_verify_ok flag _BUT_
as I see it being set too early _before_ calibration result is checked
so we could have the following - kernel reports user that APIC timer
is too slow and disabled but local_apic_timer_verify_ok remains set
to 1 instead of 0.

		- Cyrill -

      reply	other threads:[~2008-07-13 16:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-13 11:37 [RFC] lapic calibration results fix Cyrill Gorcunov
2008-07-13 16:23 ` Cyrill Gorcunov [this message]

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=20080713162337.GC7459@asus \
    --to=gorcunov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=macro@linux-mips.org \
    --cc=mingo@elte.hu \
    --cc=yhlu.kernel@gmail.com \
    /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.