[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1181011737.25878.146.camel@localhost.localdomain>
Date: Tue, 05 Jun 2007 12:48:56 +1000
From: Rusty Russell <rusty@...tcorp.com.au>
To: Andi Kleen <ak@...e.de>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Matt Mackall <mpm@...enic.com>, linux-kernel@...r.kernel.org
Subject: Re: lguest rebroken in 2.6.22-rc3-mm1
On Mon, 2007-06-04 at 20:12 +0200, Andi Kleen wrote:
> > >
> > > Looks like this one got lost in rc3-mm1.
> >
> > Andi said that he fixed the zero-divide by other means?
>
> I determined it cannot happen in my source tree. When notsc
> is passed TSC CPUID is cleared and sched-clock works.
>
> I suspect what happens is that lguest forgets to clear the TSC cpuid
> bit when it disables TSC. Then the TSC frequency doesn't get computed
> and sched-clock can divide by zero.That's purely a lguest bug that needs
> to be fixed in lguest with a
> clear_bit(X86_FEATURE_TSC, &boot_cpu_data.x86_capability)
> somewhere
It's not quite that simple; lguest's paravirt_ops->cpuid sets TSC off,
and indeed X86_FEATURE_TSC isn't set in boot_cpu_data.x86_capability.
But TSC is a "required feature", so "cpu_has_tsc" is always true.
How about this patch:
===
Don't try to disable the TSC: it's a required feature under modern
configurations, so just mark the sched clock unstable which has the
same effect.
Signed-off-by: Rusty Russell <rusty@...tcorp.com.au>
---
drivers/lguest/lguest.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
===================================================================
--- a/drivers/lguest/lguest.c
+++ b/drivers/lguest/lguest.c
@@ -37,6 +37,7 @@
#include <asm/e820.h>
#include <asm/mce.h>
#include <asm/io.h>
+#include <asm/sched-clock.h>
/* Declarations for definitions in lguest_guest.S */
extern char lguest_noirq_start[], lguest_noirq_end[];
@@ -508,7 +509,8 @@ __init void lguest_init(void *boot)
/* Math is always hard! */
new_cpu_data.hard_math = 1;
- tsc_disable = 1;
+ /* Sched clock is unusable: you'll just hurt yourself if you try. */
+ __get_cpu_var(sc_data).unstable++;
#ifdef CONFIG_X86_MCE
mce_disabled = 1;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists