diff options
author | Eric B Munson <emunson@mgebm.net> | 2012-03-10 14:37:26 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-04-08 05:48:59 -0400 |
commit | 3b5d56b9317fa7b5407dff1aa7b115bf6cdbd494 (patch) | |
tree | d733bab15dcf193c3364d14fc2d973aa20a28fe3 /arch/x86/kernel/kvmclock.c | |
parent | eae3ee7d8a7c59cf63441dedf28674889f5fc477 (diff) |
kvmclock: Add functions to check if the host has stopped the vm
When a host stops or suspends a VM it will set a flag to show this. The
watchdog will use these functions to determine if a softlockup is real, or the
result of a suspended VM.
Signed-off-by: Eric B Munson <emunson@mgebm.net>
asm-generic changes Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kernel/kvmclock.c')
-rw-r--r-- | arch/x86/kernel/kvmclock.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index f8492da65bfc..4ba090ca689d 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <asm/msr.h> | 22 | #include <asm/msr.h> |
23 | #include <asm/apic.h> | 23 | #include <asm/apic.h> |
24 | #include <linux/percpu.h> | 24 | #include <linux/percpu.h> |
25 | #include <linux/hardirq.h> | ||
25 | 26 | ||
26 | #include <asm/x86_init.h> | 27 | #include <asm/x86_init.h> |
27 | #include <asm/reboot.h> | 28 | #include <asm/reboot.h> |
@@ -114,6 +115,26 @@ static void kvm_get_preset_lpj(void) | |||
114 | preset_lpj = lpj; | 115 | preset_lpj = lpj; |
115 | } | 116 | } |
116 | 117 | ||
118 | bool kvm_check_and_clear_guest_paused(void) | ||
119 | { | ||
120 | bool ret = false; | ||
121 | struct pvclock_vcpu_time_info *src; | ||
122 | |||
123 | /* | ||
124 | * per_cpu() is safe here because this function is only called from | ||
125 | * timer functions where preemption is already disabled. | ||
126 | */ | ||
127 | WARN_ON(!in_atomic()); | ||
128 | src = &__get_cpu_var(hv_clock); | ||
129 | if ((src->flags & PVCLOCK_GUEST_STOPPED) != 0) { | ||
130 | __this_cpu_and(hv_clock.flags, ~PVCLOCK_GUEST_STOPPED); | ||
131 | ret = true; | ||
132 | } | ||
133 | |||
134 | return ret; | ||
135 | } | ||
136 | EXPORT_SYMBOL_GPL(kvm_check_and_clear_guest_paused); | ||
137 | |||
117 | static struct clocksource kvm_clock = { | 138 | static struct clocksource kvm_clock = { |
118 | .name = "kvm-clock", | 139 | .name = "kvm-clock", |
119 | .read = kvm_clock_get_cycles, | 140 | .read = kvm_clock_get_cycles, |