summaryrefslogtreecommitdiffstats
path: root/drivers/lguest/lguest_user.c
diff options
context:
space:
mode:
authorGlauber de Oliveira Costa <gcosta@redhat.com>2008-01-07 14:05:28 +0100
committerRusty Russell <rusty@rustcorp.com.au>2008-01-30 12:50:08 +0100
commitad8d8f3bc61ec712dd141e1029ae68c47fadc4a7 (patch)
tree70bd69e85ef7f159a62f4cd8aa2799d8d542b92c /drivers/lguest/lguest_user.c
parentlguest: make hypercalls use the vcpu struct (diff)
downloadlinux-ad8d8f3bc61ec712dd141e1029ae68c47fadc4a7.tar.xz
linux-ad8d8f3bc61ec712dd141e1029ae68c47fadc4a7.zip
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/lguest_user.c')
-rw-r--r--drivers/lguest/lguest_user.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index 2562082a3ea3..f231b9be0b64 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -104,6 +104,7 @@ static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip)
cpu->id = id;
cpu->lg = container_of((cpu - id), struct lguest, cpus[0]);
cpu->lg->nr_cpus++;
+ init_clockdev(cpu);
return 0;
}
@@ -180,9 +181,6 @@ static int initialize(struct file *file, const unsigned long __user *input)
* address. */
lguest_arch_setup_regs(lg, args[3]);
- /* The timer for lguest's clock needs initialization. */
- init_clockdev(lg);
-
/* We keep a pointer to the Launcher task (ie. current task) for when
* other Guests want to wake this one (inter-Guest I/O). */
lg->tsk = current;
@@ -273,6 +271,7 @@ static ssize_t write(struct file *file, const char __user *in,
static int close(struct inode *inode, struct file *file)
{
struct lguest *lg = file->private_data;
+ unsigned int i;
/* If we never successfully initialized, there's nothing to clean up */
if (!lg)
@@ -281,8 +280,9 @@ static int close(struct inode *inode, struct file *file)
/* We need the big lock, to protect from inter-guest I/O and other
* Launchers initializing guests. */
mutex_lock(&lguest_lock);
- /* Cancels the hrtimer set via LHCALL_SET_CLOCKEVENT. */
- hrtimer_cancel(&lg->hrt);
+ for (i = 0; i < lg->nr_cpus; i++)
+ /* Cancels the hrtimer set via LHCALL_SET_CLOCKEVENT. */
+ hrtimer_cancel(&lg->cpus[i].hrt);
/* Free up the shadow page tables for the Guest. */
free_guest_pagetable(lg);
/* Now all the memory cleanups are done, it's safe to release the