All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Avoid soft lockup message when KVM is stopped by host
@ 2011-08-29 23:27 ` Eric B Munson
  0 siblings, 0 replies; 74+ messages in thread
From: Eric B Munson @ 2011-08-29 23:27 UTC (permalink / raw)
  To: kvm-ia64

Currently, when qemu stops a guest kernel that guest will issue a soft lockup
message when it resumes.  This set provides the ability for qemu to comminucate
to the guest that it has been stopped.  When the guest hits the watchdog on
resume it will check if it was suspended before issuing the warning.

Eric B Munson (4):
  Add flag to indicate that a vm was stopped by the host
  Add functions to check if the host has stopped the vm
  Add generic stubs for kvm stop check functions
  Add check for suspended vm in softlockup detector

 arch/x86/include/asm/pvclock-abi.h |    1 +
 arch/x86/include/asm/pvclock.h     |    2 ++
 arch/x86/kernel/kvmclock.c         |   14 ++++++++++++++
 include/asm-generic/pvclock.h      |   14 ++++++++++++++
 kernel/watchdog.c                  |   12 ++++++++++++
 5 files changed, 43 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-generic/pvclock.h

-- 
1.7.4.1


^ permalink raw reply	[flat|nested] 74+ messages in thread
* [PATCH 1/4] Add flag to indicate that a vm was stopped by the host
  2011-08-29 23:27 ` Eric B Munson
  (?)
@ 2011-08-29 23:27 ` Eric B Munson
  -1 siblings, 0 replies; 74+ messages in thread
From: Eric B Munson @ 2011-08-29 23:27 UTC (permalink / raw)
  To: kvm-ia64

This flag will be used to check if the vm was stopped by the host when a soft
lockup was detected.

Signed-off-by: Eric B Munson <emunson@mgebm.net>
---
 arch/x86/include/asm/pvclock-abi.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/pvclock-abi.h b/arch/x86/include/asm/pvclock-abi.h
index 35f2d19..6167fd7 100644
--- a/arch/x86/include/asm/pvclock-abi.h
+++ b/arch/x86/include/asm/pvclock-abi.h
@@ -40,5 +40,6 @@ struct pvclock_wall_clock {
 } __attribute__((__packed__));
 
 #define PVCLOCK_TSC_STABLE_BIT	(1 << 0)
+#define PVCLOCK_GUEST_STOPPED	(1 << 1)
 #endif /* __ASSEMBLY__ */
 #endif /* _ASM_X86_PVCLOCK_ABI_H */
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 74+ messages in thread
* [PATCH 2/4] Add functions to check if the host has stopped the vm
  2011-08-29 23:27 ` Eric B Munson
  (?)
@ 2011-08-29 23:27 ` Eric B Munson
  -1 siblings, 0 replies; 74+ messages in thread
From: Eric B Munson @ 2011-08-29 23:27 UTC (permalink / raw)
  To: kvm-ia64

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>
---
 arch/x86/include/asm/pvclock.h |    2 ++
 arch/x86/kernel/kvmclock.c     |   14 ++++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h
index a518c0a..dd59ad0 100644
--- a/arch/x86/include/asm/pvclock.h
+++ b/arch/x86/include/asm/pvclock.h
@@ -13,6 +13,8 @@ void pvclock_read_wallclock(struct pvclock_wall_clock *wall,
 			    struct timespec *ts);
 void pvclock_resume(void);
 
+bool kvm_check_and_clear_host_stopped(int cpu);
+
 /*
  * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
  * yielding a 64-bit result.
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index c1a0188..5f60d2b 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -113,6 +113,20 @@ static void kvm_get_preset_lpj(void)
 	preset_lpj = lpj;
 }
 
+bool kvm_check_and_clear_host_stopped(int cpu)
+{
+	bool ret = false;
+	struct pvclock_vcpu_time_info *src;
+
+	src = &per_cpu(hv_clock, cpu);
+	if ((src->flags & PVCLOCK_GUEST_STOPPED) != 0) {
+		src->flags = src->flags & (~PVCLOCK_GUEST_STOPPED);
+		ret = true;
+	}
+
+	return ret;
+}
+
 static struct clocksource kvm_clock = {
 	.name = "kvm-clock",
 	.read = kvm_clock_get_cycles,
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 74+ messages in thread
* [PATCH 3/4] Add generic stubs for kvm stop check functions
  2011-08-29 23:27 ` Eric B Munson
  (?)
@ 2011-08-29 23:27 ` Eric B Munson
  -1 siblings, 0 replies; 74+ messages in thread
From: Eric B Munson @ 2011-08-29 23:27 UTC (permalink / raw)
  To: kvm-ia64

This function is called from the watchdog code when a soft lockup is detected.
If this is an arch that does not support pvclock, this function is used.

Signed-off-by: Eric B Munson <emunson@mgebm.net>
---
 include/asm-generic/pvclock.h |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-generic/pvclock.h

diff --git a/include/asm-generic/pvclock.h b/include/asm-generic/pvclock.h
new file mode 100644
index 0000000..ff046b6
--- /dev/null
+++ b/include/asm-generic/pvclock.h
@@ -0,0 +1,14 @@
+#ifndef _ASM_GENERIC_PVCLOCK_H
+#define _ASM_GENERIC_PVCLOCK_H
+
+
+/*
+ * These functions are used by architectures that support kvm to avoid issuing
+ * false soft lockup messages.
+ */
+static inline bool kvm_check_and_clear_host_stopped(int cpu)
+{
+	return false;
+}
+
+#endif
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 74+ messages in thread
* [PATCH 4/4] Add check for suspended vm in softlockup detector
  2011-08-29 23:27 ` Eric B Munson
  (?)
@ 2011-08-29 23:27 ` Eric B Munson
  -1 siblings, 0 replies; 74+ messages in thread
From: Eric B Munson @ 2011-08-29 23:27 UTC (permalink / raw)
  To: kvm-ia64

A suspended VM can cause spurious soft lockup warnings.  To avoid these, the
watchdog now checks if the kernel knows it was stopped by the host and skips
the warning if so.

Signed-off-by: Eric B Munson <emunson@mgebm.net>
---
 kernel/watchdog.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 36491cd..4cbb69f 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -25,6 +25,7 @@
 #include <linux/sysctl.h>
 
 #include <asm/irq_regs.h>
+#include <asm/pvclock.h>
 #include <linux/perf_event.h>
 
 int watchdog_enabled = 1;
@@ -292,6 +293,17 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
 	 */
 	duration = is_softlockup(touch_ts);
 	if (unlikely(duration)) {
+		/*
+		 * If a virtual machine is stopped by the host it can look to
+		 * the watchdog like a soft lockup, check to see if the host
+		 * stopped the vm before we issue the warning
+		 */
+		if (kvm_check_and_clear_host_stopped(get_cpu())) {
+			put_cpu();
+			return HRTIMER_RESTART;
+		}
+		put_cpu();
+
 		/* only warn once */
 		if (__this_cpu_read(soft_watchdog_warn) = true)
 			return HRTIMER_RESTART;
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 74+ messages in thread

end of thread, other threads:[~2011-09-21 17:46 UTC | newest]

Thread overview: 74+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-29 23:27 [PATCH 0/4] Avoid soft lockup message when KVM is stopped by host Eric B Munson
2011-08-29 23:27 ` Eric B Munson
2011-08-29 23:27 ` Eric B Munson
2011-08-30 12:26 ` Marcelo Tosatti
2011-08-30 12:26   ` Marcelo Tosatti
2011-08-30 12:26   ` Marcelo Tosatti
2011-08-30 14:12 ` Ryan Harper
2011-08-30 14:12   ` Ryan Harper
2011-08-30 14:12   ` Ryan Harper
2011-08-30 14:35 ` Marcelo Tosatti
2011-08-30 14:35   ` Marcelo Tosatti
2011-08-30 14:35   ` Marcelo Tosatti
2011-08-30 14:43 ` Ryan Harper
2011-08-30 14:43   ` Ryan Harper
2011-08-30 14:43   ` Ryan Harper
2011-08-30 16:37 ` Eric B Munson
2011-08-30 16:37   ` Eric B Munson
2011-08-30 16:37   ` Eric B Munson
2011-08-30 18:30 ` Marcelo Tosatti
2011-08-30 18:30   ` Marcelo Tosatti
2011-08-30 18:30   ` Marcelo Tosatti
2011-08-30 18:36 ` Marcelo Tosatti
2011-08-30 18:36   ` Marcelo Tosatti
2011-08-30 18:36   ` Marcelo Tosatti
2011-08-30 23:50 ` emunson
2011-08-30 23:50   ` emunson
2011-08-30 23:50   ` emunson
2011-08-30 23:50   ` emunson
2011-09-01 19:24 ` [PATCH 0/4] Avoid soft lockup message when KVM is stopped by Anthony Liguori
2011-09-01 19:24   ` [PATCH 0/4] Avoid soft lockup message when KVM is stopped by host Anthony Liguori
2011-09-01 19:24   ` [PATCH 0/4] Avoid soft lockup message when KVM is stopped by Anthony Liguori
2011-09-01 20:27 ` [PATCH 0/4] Avoid soft lockup message when KVM is stopped by host emunson
2011-09-01 20:27   ` emunson
2011-09-01 20:27   ` emunson
2011-09-01 20:27   ` emunson
2011-09-09 13:29 ` Marcelo Tosatti
2011-09-09 13:29   ` Marcelo Tosatti
2011-09-09 13:29   ` Marcelo Tosatti
2011-09-13 20:49 ` Eric B Munson
2011-09-13 20:49   ` Eric B Munson
2011-09-13 20:49   ` Eric B Munson
2011-09-15 13:26 ` Marcelo Tosatti
2011-09-15 13:26   ` Marcelo Tosatti
2011-09-15 13:26   ` Marcelo Tosatti
2011-09-20 19:00 ` Eric B Munson
2011-09-20 19:00   ` Eric B Munson
2011-09-20 19:00   ` Eric B Munson
2011-09-20 19:55 ` Marcelo Tosatti
2011-09-20 19:55   ` Marcelo Tosatti
2011-09-20 19:55   ` Marcelo Tosatti
2011-09-20 20:03 ` Jamie Lokier
2011-09-20 20:03   ` Jamie Lokier
2011-09-20 20:03   ` Jamie Lokier
2011-09-21 14:11 ` [PATCH 0/4] Avoid soft lockup message when KVM is stopped by Dave Hansen
2011-09-21 14:11   ` [PATCH 0/4] Avoid soft lockup message when KVM is stopped by host Dave Hansen
2011-09-21 14:11   ` [PATCH 0/4] Avoid soft lockup message when KVM is stopped by Dave Hansen
2011-09-21 17:43 ` [PATCH 0/4] Avoid soft lockup message when KVM is stopped by host Marcelo Tosatti
2011-09-21 17:43   ` Marcelo Tosatti
2011-09-21 17:43   ` Marcelo Tosatti
2011-09-21 17:46 ` Marcelo Tosatti
2011-09-21 17:46   ` Marcelo Tosatti
2011-09-21 17:46   ` Marcelo Tosatti
  -- strict thread matches above, loose matches on Subject: below --
2011-08-29 23:27 [PATCH 1/4] Add flag to indicate that a vm was stopped by the host Eric B Munson
2011-08-29 23:27 ` Eric B Munson
2011-08-29 23:27 ` Eric B Munson
2011-08-29 23:27 [PATCH 2/4] Add functions to check if the host has stopped the vm Eric B Munson
2011-08-29 23:27 ` Eric B Munson
2011-08-29 23:27 ` Eric B Munson
2011-08-29 23:27 [PATCH 3/4] Add generic stubs for kvm stop check functions Eric B Munson
2011-08-29 23:27 ` Eric B Munson
2011-08-29 23:27 ` Eric B Munson
2011-08-29 23:27 [PATCH 4/4] Add check for suspended vm in softlockup detector Eric B Munson
2011-08-29 23:27 ` Eric B Munson
2011-08-29 23:27 ` Eric B Munson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.