From: Rusty Russell <rusty@rustcorp.com.au>
To: Andi Kleen <ak@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Matt Mackall <mpm@selenic.com>,
linux-kernel@vger.kernel.org
Subject: Re: lguest rebroken in 2.6.22-rc3-mm1
Date: Tue, 05 Jun 2007 12:48:56 +1000 [thread overview]
Message-ID: <1181011737.25878.146.camel@localhost.localdomain> (raw)
In-Reply-To: <200706042012.15915.ak@suse.de>
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@rustcorp.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;
next prev parent reply other threads:[~2007-06-05 2:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-22 22:38 lguest broken in 2.6.22-rc1-mm1 Matt Mackall
2007-05-22 23:27 ` Rusty Russell
2007-06-04 17:19 ` lguest rebroken in 2.6.22-rc3-mm1 Matt Mackall
2007-06-04 17:28 ` Andrew Morton
2007-06-04 17:46 ` Matt Mackall
2007-06-04 18:12 ` Andi Kleen
2007-06-05 2:48 ` Rusty Russell [this message]
2007-06-05 10:01 ` Andi Kleen
2007-06-05 13:11 ` [PATCH] lguest-fix-divide-error-implement-sched_clock Rusty Russell
2007-06-05 14:24 ` Andi Kleen
2007-06-05 16:07 ` Andrew Morton
2007-06-05 16:16 ` H. Peter Anvin
2007-06-05 16:37 ` Andi Kleen
2007-06-05 17:02 ` H. Peter Anvin
2007-06-05 18:43 ` H. Peter Anvin
2007-06-05 18:51 ` Andi Kleen
2007-06-05 21:15 ` H. Peter Anvin
2007-06-05 21:31 ` Andi Kleen
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=1181011737.25878.146.camel@localhost.localdomain \
--to=rusty@rustcorp.com.au \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®