Re: [patch] x86_64: fix sched_clock()

From: Andrew Morton
Date: Fri May 25 2007 - 04:56:18 EST


On Fri, 25 May 2007 10:45:47 +0200 Andi Kleen <andi@xxxxxxxxxxxxxx> wrote:

> On Fri, May 25, 2007 at 10:44:26AM +0200, Ingo Molnar wrote:
> >
> > * Andi Kleen <andi@xxxxxxxxxxxxxx> wrote:
> >
> > > > arch/i386/kernel/sched-clock.c (now built on x86_64 too with the
> > > > patch i sent) uses the tsc_disable global flag which is non-existent
> > > > on x86_64. So my tsc.h change adds that global flag, always-defined
> > > > to 0.
> > >
> > > My version of sched_clock.c doesn't have any reference to tsc_disable.
> >
> > must be an -mm fix. I used -mm as a basis of my work. Please apply my
> > patch.
>
> I would prefer to find out why the mm patch was added and then hopefully
> remove it. IMNSHO it should not be needed.
>

This? I sent it to you earlier this week:

From: Rusty Russell <rusty@xxxxxxxxxxxxxxx>

If you set tsc_disable (eg "notsc" on cmdline), sched-clock.c gives a
divide by zero on boot.

Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Cc: Andi Kleen <ak@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

arch/i386/kernel/sched-clock.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN arch/i386/kernel/sched-clock.c~fix-x86_64-mm-sched-clock-share arch/i386/kernel/sched-clock.c
--- a/arch/i386/kernel/sched-clock.c~fix-x86_64-mm-sched-clock-share
+++ a/arch/i386/kernel/sched-clock.c
@@ -115,7 +115,7 @@ unsigned long long printk_clock(void)
static void resync_sc_freq(struct sc_data *sc, unsigned int newfreq)
{
sc->sync_base = jiffies;
- if (!cpu_has_tsc) {
+ if (!cpu_has_tsc || tsc_disable) {
sc->unstable = 1;
return;
}
_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/