Re: [PATCH 2/10] lguest: Export symbols for lguest as a module

From: Rusty Russell
Date: Sat Feb 10 2007 - 06:40:34 EST


On Fri, 2007-02-09 at 14:58 +0100, Andi Kleen wrote:
> On Fri, Feb 09, 2007 at 11:06:06PM +1100, Rusty Russell wrote:
> > On Fri, 2007-02-09 at 10:32 +0100, Andi Kleen wrote:
> > > Are you sure this will work with varying TSC frequencies?
> >
> > I'm actually quite sure it doesn't (there's a FIXME in the lguest code).
> > Given the debate over how useful the TSC was, I originally didn't use
> > it, but (1) it's simple, and (2) when it doesn't change, it's pretty
> > accurate.
>
> But when it changes users become pretty unhappy

True. Simplest fix is below. There are several time issues on the TODO
list, and I will simply add this one.

Thanks!
Rusty.

lguest: Don't use the TSC in guest.

Andi complained that lguest guests don't deal with host TSC speed
changing. Close this can of worms by not using the TSC in the guest.
Later on we could do something clever when we overhaul this to deal
with stolen time (also on the TODO list).

Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>

===================================================================
--- a/arch/i386/kernel/tsc.c
+++ b/arch/i386/kernel/tsc.c
@@ -475,4 +475,3 @@ static int __init init_tsc_clocksource(v
}

module_init(init_tsc_clocksource);
-EXPORT_SYMBOL_GPL(tsc_khz);
===================================================================
--- a/arch/i386/lguest/hypercalls.c
+++ b/arch/i386/lguest/hypercalls.c
@@ -18,7 +18,6 @@
#include <linux/uaccess.h>
#include <linux/syscalls.h>
#include <linux/mm.h>
-#include <linux/clocksource.h>
#include <asm/lguest.h>
#include <asm/page.h>
#include <asm/pgtable.h>
@@ -179,8 +178,6 @@ int hypercall(struct lguest *lg, struct
/* We reserve the top pgd entry. */
put_user(4U*1024*1024, &lg->lguest_data->reserve_mem);
put_user(lg->guestid, &lg->lguest_data->guestid);
- put_user(clocksource_khz2mult(tsc_khz, 22),
- &lg->lguest_data->clock_mult);
return 0;
}
pending = do_hcall(lg, regs);
===================================================================
--- a/arch/i386/lguest/lguest.c
+++ b/arch/i386/lguest/lguest.c
@@ -25,7 +25,6 @@
#include <linux/screen_info.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
-#include <linux/clocksource.h>
#include <asm/paravirt.h>
#include <asm/lguest.h>
#include <asm/lguest_user.h>
@@ -138,29 +137,10 @@ static struct notifier_block paniced = {
.notifier_call = lguest_panic
};

-static cycle_t lguest_clock_read(void)
-{
- /* FIXME: This is just the native one. Account stolen time! */
- return paravirt_ops.read_tsc();
-}
-
-/* FIXME: Update iff tsc rate changes. */
-static struct clocksource lguest_clock = {
- .name = "lguest",
- .rating = 400,
- .read = lguest_clock_read,
- .mask = CLOCKSOURCE_MASK(64),
- .mult = 0, /* to be set */
- .shift = 22,
- .is_continuous = 1,
-};
-
static char *lguest_memory_setup(void)
{
/* We do these here because lockcheck barfs if before start_kernel */
atomic_notifier_chain_register(&panic_notifier_list, &paniced);
- lguest_clock.mult = lguest_data.clock_mult;
- clocksource_register(&lguest_clock);

e820.nr_map = 0;
add_memory_region(0, PFN_PHYS(boot->max_pfn), E820_RAM);
===================================================================
--- a/include/asm-i386/lguest.h
+++ b/include/asm-i386/lguest.h
@@ -74,8 +74,6 @@ struct lguest_data
unsigned long reserve_mem;
/* ID of this guest (used by network driver to set ethernet address) */
u16 guestid;
- /* Multiplier for TSC clock. */
- u32 clock_mult;

/* Fields initialized by the guest at boot: */
/* Instruction range to suppress interrupts even if enabled */


-
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/