aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lguest
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2007-07-20 08:15:01 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-20 12:05:16 -0400
commit9d1ca6f13cfedfd127f3be7e447bd6d922806a65 (patch)
treefb920888bce49f2bfa8c5a239e2c8c55dd9df7bd /drivers/lguest
parent876be9d89e9c8a007577e6372e331042edf4020b (diff)
lguest: override sched_clock
Guests currently use the default scheduler clock: this means they always use jiffies even if TSC is actually available. It doesn't make any noticeable difference here, but it's a better thing to do. Also remove commented-out asm/sched-clock.h from -mm tree. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/lguest')
-rw-r--r--drivers/lguest/lguest.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/lguest/lguest.c b/drivers/lguest/lguest.c
index b9a58b78c990..434fea1e82f7 100644
--- a/drivers/lguest/lguest.c
+++ b/drivers/lguest/lguest.c
@@ -39,7 +39,6 @@
39#include <asm/e820.h> 39#include <asm/e820.h>
40#include <asm/mce.h> 40#include <asm/mce.h>
41#include <asm/io.h> 41#include <asm/io.h>
42//#include <asm/sched-clock.h>
43 42
44/* Declarations for definitions in lguest_guest.S */ 43/* Declarations for definitions in lguest_guest.S */
45extern char lguest_noirq_start[], lguest_noirq_end[]; 44extern char lguest_noirq_start[], lguest_noirq_end[];
@@ -57,6 +56,7 @@ struct lguest_data lguest_data = {
57 .blocked_interrupts = { 1 }, /* Block timer interrupts */ 56 .blocked_interrupts = { 1 }, /* Block timer interrupts */
58}; 57};
59struct lguest_device_desc *lguest_devices; 58struct lguest_device_desc *lguest_devices;
59static cycle_t clock_base;
60 60
61static enum paravirt_lazy_mode lazy_mode; 61static enum paravirt_lazy_mode lazy_mode;
62static void lguest_lazy_mode(enum paravirt_lazy_mode mode) 62static void lguest_lazy_mode(enum paravirt_lazy_mode mode)
@@ -363,6 +363,11 @@ static struct clocksource lguest_clock = {
363 .read = lguest_clock_read, 363 .read = lguest_clock_read,
364}; 364};
365 365
366static unsigned long long lguest_sched_clock(void)
367{
368 return cyc2ns(&lguest_clock, lguest_clock_read() - clock_base);
369}
370
366/* We also need a "struct clock_event_device": Linux asks us to set it to go 371/* We also need a "struct clock_event_device": Linux asks us to set it to go
367 * off some time in the future. Actually, James Morris figured all this out, I 372 * off some time in the future. Actually, James Morris figured all this out, I
368 * just applied the patch. */ 373 * just applied the patch. */
@@ -439,6 +444,7 @@ static void lguest_time_init(void)
439 lguest_clock.mult = (((u64)NSEC_PER_SEC<<8)/ACTHZ) << 8; 444 lguest_clock.mult = (((u64)NSEC_PER_SEC<<8)/ACTHZ) << 8;
440 lguest_clock.mask = CLOCKSOURCE_MASK(32); 445 lguest_clock.mask = CLOCKSOURCE_MASK(32);
441 } 446 }
447 clock_base = lguest_clock_read();
442 clocksource_register(&lguest_clock); 448 clocksource_register(&lguest_clock);
443 449
444 /* We can't set cpumask in the initializer: damn C limitations! */ 450 /* We can't set cpumask in the initializer: damn C limitations! */
@@ -584,6 +590,7 @@ __init void lguest_init(void *boot)
584 paravirt_ops.time_init = lguest_time_init; 590 paravirt_ops.time_init = lguest_time_init;
585 paravirt_ops.set_lazy_mode = lguest_lazy_mode; 591 paravirt_ops.set_lazy_mode = lguest_lazy_mode;
586 paravirt_ops.wbinvd = lguest_wbinvd; 592 paravirt_ops.wbinvd = lguest_wbinvd;
593 paravirt_ops.sched_clock = lguest_sched_clock;
587 594
588 hcall(LHCALL_LGUEST_INIT, __pa(&lguest_data), 0, 0); 595 hcall(LHCALL_LGUEST_INIT, __pa(&lguest_data), 0, 0);
589 596