* [PATCH] X86_64: hpet tsc calibration fix broken smi detection logic
@ 2007-07-14 8:41 Thomas Gleixner
2007-07-19 2:59 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2007-07-14 8:41 UTC (permalink / raw)
To: LKML; +Cc: Andrew Morton, Andi Kleen, Stable Team, Ingo Molnar
The current SMI detection logic in read_hpet_tsc() makes sure,
that when a SMI happens between the read of the HPET counter and
the read of the TSC, this wrong value is used for TSC calibration.
This is not the intention of the function. The comparison must ensure,
that we do _NOT_ use such a value.
Fix the check to use calibration values where delta of the two TSC reads
is smaller than a reasonable threshold.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
--- a/arch/x86_64/kernel/hpet.c
+++ b/arch/x86_64/kernel/hpet.c
@@ -190,7 +190,7 @@ int hpet_reenable(void)
*/
#define TICK_COUNT 100000000
-#define TICK_MIN 5000
+#define SMI_THRESHOLD 50000
#define MAX_TRIES 5
/*
@@ -205,7 +205,7 @@ static void __init read_hpet_tsc(int *hpet, int *tsc)
tsc1 = get_cycles_sync();
hpet1 = hpet_readl(HPET_COUNTER);
tsc2 = get_cycles_sync();
- if (tsc2 - tsc1 > TICK_MIN)
+ if ((tsc2 - tsc1) < SMI_TRESHOLD)
break;
}
*hpet = hpet1;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] X86_64: hpet tsc calibration fix broken smi detection logic
2007-07-14 8:41 [PATCH] X86_64: hpet tsc calibration fix broken smi detection logic Thomas Gleixner
@ 2007-07-19 2:59 ` Andrew Morton
2007-07-19 13:52 ` Andi Kleen
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2007-07-19 2:59 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: LKML, Andi Kleen, Stable Team, Ingo Molnar
On Sat, 14 Jul 2007 10:41:39 +0200 Thomas Gleixner <tglx@linutronix.de> wrote:
> The current SMI detection logic in read_hpet_tsc() makes sure,
> that when a SMI happens between the read of the HPET counter and
> the read of the TSC, this wrong value is used for TSC calibration.
>
> This is not the intention of the function. The comparison must ensure,
> that we do _NOT_ use such a value.
>
> Fix the check to use calibration values where delta of the two TSC reads
> is smaller than a reasonable threshold.
>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
>
> --- a/arch/x86_64/kernel/hpet.c
> +++ b/arch/x86_64/kernel/hpet.c
> @@ -190,7 +190,7 @@ int hpet_reenable(void)
> */
>
> #define TICK_COUNT 100000000
> -#define TICK_MIN 5000
> +#define SMI_THRESHOLD 50000
> #define MAX_TRIES 5
>
> /*
> @@ -205,7 +205,7 @@ static void __init read_hpet_tsc(int *hpet, int *tsc)
> tsc1 = get_cycles_sync();
> hpet1 = hpet_readl(HPET_COUNTER);
> tsc2 = get_cycles_sync();
> - if (tsc2 - tsc1 > TICK_MIN)
> + if ((tsc2 - tsc1) < SMI_TRESHOLD)
> break;
> }
> *hpet = hpet1;
>
So I queued this, and then another patch to revert it so that the
x86_64-clockevents conversion would apply. But I was unable to locate the
corresponding bug in the post-x86_64-clockevents tree. Did it get fixed by
other means in there?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] X86_64: hpet tsc calibration fix broken smi detection logic
2007-07-19 2:59 ` Andrew Morton
@ 2007-07-19 13:52 ` Andi Kleen
0 siblings, 0 replies; 3+ messages in thread
From: Andi Kleen @ 2007-07-19 13:52 UTC (permalink / raw)
To: Andrew Morton; +Cc: Thomas Gleixner, LKML, Stable Team, Ingo Molnar
Andrew Morton <akpm@linux-foundation.org> writes:
>
> So I queued this, and then another patch to revert it so that the
> x86_64-clockevents conversion would apply. But I was unable to locate the
> corresponding bug in the post-x86_64-clockevents tree. Did it get fixed by
> other means in there?
Yes, the code gets merged with i386 there
-Andi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-07-19 12:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-14 8:41 [PATCH] X86_64: hpet tsc calibration fix broken smi detection logic Thomas Gleixner
2007-07-19 2:59 ` Andrew Morton
2007-07-19 13:52 ` Andi Kleen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox