diff options
author | Glauber de Oliveira Costa <gcosta@redhat.com> | 2008-01-07 08:05:28 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-01-30 06:50:08 -0500 |
commit | ad8d8f3bc61ec712dd141e1029ae68c47fadc4a7 (patch) | |
tree | 70bd69e85ef7f159a62f4cd8aa2799d8d542b92c /drivers/lguest/interrupts_and_traps.c | |
parent | 73044f05a4ac65f2df42753e9566444b9d2a660f (diff) |
lguest: per-vcpu lguest timers
Here, I introduce per-vcpu timers. With this, we can have
local expiries, needed for accounting time in smp guests
Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest/interrupts_and_traps.c')
-rw-r--r-- | drivers/lguest/interrupts_and_traps.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/lguest/interrupts_and_traps.c b/drivers/lguest/interrupts_and_traps.c index 2b66f79c208b..22c692aae51c 100644 --- a/drivers/lguest/interrupts_and_traps.c +++ b/drivers/lguest/interrupts_and_traps.c | |||
@@ -470,13 +470,13 @@ void copy_traps(const struct lguest *lg, struct desc_struct *idt, | |||
470 | * infrastructure to set a callback at that time. | 470 | * infrastructure to set a callback at that time. |
471 | * | 471 | * |
472 | * 0 means "turn off the clock". */ | 472 | * 0 means "turn off the clock". */ |
473 | void guest_set_clockevent(struct lguest *lg, unsigned long delta) | 473 | void guest_set_clockevent(struct lg_cpu *cpu, unsigned long delta) |
474 | { | 474 | { |
475 | ktime_t expires; | 475 | ktime_t expires; |
476 | 476 | ||
477 | if (unlikely(delta == 0)) { | 477 | if (unlikely(delta == 0)) { |
478 | /* Clock event device is shutting down. */ | 478 | /* Clock event device is shutting down. */ |
479 | hrtimer_cancel(&lg->hrt); | 479 | hrtimer_cancel(&cpu->hrt); |
480 | return; | 480 | return; |
481 | } | 481 | } |
482 | 482 | ||
@@ -484,25 +484,25 @@ void guest_set_clockevent(struct lguest *lg, unsigned long delta) | |||
484 | * all the time between now and the timer interrupt it asked for. This | 484 | * all the time between now and the timer interrupt it asked for. This |
485 | * is almost always the right thing to do. */ | 485 | * is almost always the right thing to do. */ |
486 | expires = ktime_add_ns(ktime_get_real(), delta); | 486 | expires = ktime_add_ns(ktime_get_real(), delta); |
487 | hrtimer_start(&lg->hrt, expires, HRTIMER_MODE_ABS); | 487 | hrtimer_start(&cpu->hrt, expires, HRTIMER_MODE_ABS); |
488 | } | 488 | } |
489 | 489 | ||
490 | /* This is the function called when the Guest's timer expires. */ | 490 | /* This is the function called when the Guest's timer expires. */ |
491 | static enum hrtimer_restart clockdev_fn(struct hrtimer *timer) | 491 | static enum hrtimer_restart clockdev_fn(struct hrtimer *timer) |
492 | { | 492 | { |
493 | struct lguest *lg = container_of(timer, struct lguest, hrt); | 493 | struct lg_cpu *cpu = container_of(timer, struct lg_cpu, hrt); |
494 | 494 | ||
495 | /* Remember the first interrupt is the timer interrupt. */ | 495 | /* Remember the first interrupt is the timer interrupt. */ |
496 | set_bit(0, lg->irqs_pending); | 496 | set_bit(0, cpu->lg->irqs_pending); |
497 | /* If the Guest is actually stopped, we need to wake it up. */ | 497 | /* If the Guest is actually stopped, we need to wake it up. */ |
498 | if (lg->halted) | 498 | if (cpu->lg->halted) |
499 | wake_up_process(lg->tsk); | 499 | wake_up_process(cpu->lg->tsk); |
500 | return HRTIMER_NORESTART; | 500 | return HRTIMER_NORESTART; |
501 | } | 501 | } |
502 | 502 | ||
503 | /* This sets up the timer for this Guest. */ | 503 | /* This sets up the timer for this Guest. */ |
504 | void init_clockdev(struct lguest *lg) | 504 | void init_clockdev(struct lg_cpu *cpu) |
505 | { | 505 | { |
506 | hrtimer_init(&lg->hrt, CLOCK_REALTIME, HRTIMER_MODE_ABS); | 506 | hrtimer_init(&cpu->hrt, CLOCK_REALTIME, HRTIMER_MODE_ABS); |
507 | lg->hrt.function = clockdev_fn; | 507 | cpu->hrt.function = clockdev_fn; |
508 | } | 508 | } |