From: Marcelo Tosatti <mtosatti@redhat.com>
To: kvm@vger.kernel.org
Cc: dzickus@redhat.com, pbonzini@redhat.com, gleb@redhat.com,
linux-kernel@vger.kernel.org,
Marcelo Tosatti <mtosatti@redhat.com>
Subject: [patch 2/3] pvclock: detect watchdog reset at pvclock read
Date: Mon, 07 Oct 2013 22:05:17 -0300 [thread overview]
Message-ID: <20131008010552.779616517@amt.cnet> (raw)
In-Reply-To: <20131008010515.516032211@amt.cnet>
[-- Attachment #1: 02-kvmclock-touch-watchdog-on-kvmclock-read --]
[-- Type: text/plain, Size: 2262 bytes --]
Implement reset of kernel watchdogs at pvclock read time. This avoids
adding special code to every watchdog.
This is possible for watchdogs which measure time based on sched_clock() or
ktime_get() variants.
Suggested by Don Zickus.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Index: kvm/arch/x86/kernel/kvmclock.c
===================================================================
--- kvm.orig/arch/x86/kernel/kvmclock.c
+++ kvm/arch/x86/kernel/kvmclock.c
@@ -139,6 +139,7 @@ bool kvm_check_and_clear_guest_paused(vo
src = &hv_clock[cpu].pvti;
if ((src->flags & PVCLOCK_GUEST_STOPPED) != 0) {
src->flags &= ~PVCLOCK_GUEST_STOPPED;
+ pvclock_touch_watchdogs();
ret = true;
}
Index: kvm/arch/x86/kernel/pvclock.c
===================================================================
--- kvm.orig/arch/x86/kernel/pvclock.c
+++ kvm/arch/x86/kernel/pvclock.c
@@ -21,6 +21,7 @@
#include <linux/sched.h>
#include <linux/gfp.h>
#include <linux/bootmem.h>
+#include <linux/hung_task.h>
#include <asm/fixmap.h>
#include <asm/pvclock.h>
@@ -43,6 +44,14 @@ unsigned long pvclock_tsc_khz(struct pvc
return pv_tsc_khz;
}
+void pvclock_touch_watchdogs(void)
+{
+ touch_softlockup_watchdog_sync();
+ clocksource_touch_watchdog();
+ rcu_cpu_stall_reset();
+ reset_hung_task_detector();
+}
+
static atomic64_t last_value = ATOMIC64_INIT(0);
void pvclock_resume(void)
@@ -74,6 +83,11 @@ cycle_t pvclock_clocksource_read(struct
version = __pvclock_read_cycles(src, &ret, &flags);
} while ((src->version & 1) || version != src->version);
+ if (unlikely((flags & PVCLOCK_GUEST_STOPPED) != 0)) {
+ src->flags &= ~PVCLOCK_GUEST_STOPPED;
+ pvclock_touch_watchdogs();
+ }
+
if ((valid_flags & PVCLOCK_TSC_STABLE_BIT) &&
(flags & PVCLOCK_TSC_STABLE_BIT))
return ret;
Index: kvm/arch/x86/include/asm/pvclock.h
===================================================================
--- kvm.orig/arch/x86/include/asm/pvclock.h
+++ kvm/arch/x86/include/asm/pvclock.h
@@ -14,6 +14,8 @@ void pvclock_read_wallclock(struct pvclo
struct timespec *ts);
void pvclock_resume(void);
+void pvclock_touch_watchdogs(void);
+
/*
* Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
* yielding a 64-bit result.
next prev parent reply other threads:[~2013-10-08 1:06 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-08 1:05 [patch 0/3] generic kernel " Marcelo Tosatti
2013-10-08 1:05 ` [patch 1/3] hung_task: add method to reset detector Marcelo Tosatti
2013-10-08 13:35 ` Don Zickus
2013-10-08 1:05 ` Marcelo Tosatti [this message]
2013-10-08 9:58 ` [patch 2/3] pvclock: detect watchdog reset at pvclock read Paolo Bonzini
2013-10-09 1:22 ` Marcelo Tosatti
2013-10-09 8:39 ` Paolo Bonzini
2013-10-08 13:37 ` Don Zickus
2013-10-08 22:08 ` Marcelo Tosatti
2013-10-09 13:55 ` Don Zickus
2013-10-09 21:26 ` Marcelo Tosatti
2013-10-16 18:22 ` Don Zickus
2013-10-08 1:05 ` [patch 3/3] 01-hung-task-watchdog-reset 02-kvmclock-touch-watchdog-on-kvmclock-read series Marcelo Tosatti
2013-10-08 1:07 ` Marcelo Tosatti
2013-10-08 9:57 ` [patch 0/3] generic kernel watchdog reset at pvclock read Paolo Bonzini
2013-10-12 0:39 ` [patch 0/2] generic kernel watchdog reset at pvclock read (v2) Marcelo Tosatti
2013-10-12 0:39 ` [patch 1/2] pvclock: detect watchdog reset at pvclock read Marcelo Tosatti
2013-10-12 0:39 ` [patch 2/2] hung_task: add method to reset detector Marcelo Tosatti
2013-10-14 11:30 ` [patch 0/2] generic kernel watchdog reset at pvclock read (v2) Paolo Bonzini
2013-10-16 18:25 ` Don Zickus
2013-10-16 21:02 ` Marcelo Tosatti
2013-11-06 7:49 ` Gleb Natapov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131008010552.779616517@amt.cnet \
--to=mtosatti@redhat.com \
--cc=dzickus@redhat.com \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®