[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1323116344-17911-3-git-send-email-emunson@mgebm.net>
Date: Mon, 5 Dec 2011 15:19:01 -0500
From: Eric B Munson <emunson@...bm.net>
To: avi@...hat.com
Cc: Eric B Munson <emunson@...bm.net>, mingo@...hat.com, hpa@...or.com,
arnd@...db.de, ryanh@...ux.vnet.ibm.com, aliguori@...ibm.com,
mtosatti@...hat.com, jeremy.fitzhardinge@...rix.com,
levinsasha928@...il.com, Jan Kiszka <jan.kiszka@...mens.com>,
kvm@...r.kernel.org, linux-arch@...r.kernel.org, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 2/5 V5] 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@...bm.net>
Cc: mingo@...hat.com
Cc: hpa@...or.com
Cc: arnd@...db.de
Cc: ryanh@...ux.vnet.ibm.com
Cc: aliguori@...ibm.com
Cc: mtosatti@...hat.com
Cc: jeremy.fitzhardinge@...rix.com
Cc: levinsasha928@...il.com
Cc: Jan Kiszka <jan.kiszka@...mens.com>
Cc: kvm@...r.kernel.org
Cc: linux-arch@...r.kernel.org
Cc: x86@...nel.org
Cc: linux-kernel@...r.kernel.org
---
arch/x86/include/asm/kvm_para.h | 1 +
arch/x86/kernel/kvmclock.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h
index 734c376..e9d63a6 100644
--- a/arch/x86/include/asm/kvm_para.h
+++ b/arch/x86/include/asm/kvm_para.h
@@ -95,6 +95,7 @@ struct kvm_vcpu_pv_apf_data {
extern void kvmclock_init(void);
extern int kvm_register_clock(char *txt);
+bool kvm_check_and_clear_guest_paused(int cpu);
/* This instruction is vmcall. On non-VT architectures, it will generate a
* trap that we will then rewrite to the appropriate instruction.
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index 44842d7..f0c0599 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -22,6 +22,7 @@
#include <asm/msr.h>
#include <asm/apic.h>
#include <linux/percpu.h>
+#include <linux/hardirq.h>
#include <asm/x86_init.h>
#include <asm/reboot.h>
@@ -114,6 +115,26 @@ static void kvm_get_preset_lpj(void)
preset_lpj = lpj;
}
+bool kvm_check_and_clear_guest_paused(int cpu)
+{
+ bool ret = false;
+ struct pvclock_vcpu_time_info *src;
+
+ /*
+ * per_cpu() is safe here because this function is only called from
+ * timer functions where preemption is already disabled.
+ */
+ WARN_ON(!in_atomic());
+ src = &per_cpu(hv_clock, cpu);
+ if ((src->flags & PVCLOCK_GUEST_STOPPED) != 0) {
+ src->flags = src->flags & (~PVCLOCK_GUEST_STOPPED);
+ ret = true;
+ }
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(kvm_check_and_clear_guest_paused);
+
static struct clocksource kvm_clock = {
.name = "kvm-clock",
.read = kvm_clock_get_cycles,
--
1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists