From: Marcelo Tosatti <mtosatti@redhat.com>
To: Eric B Munson <emunson@mgebm.net>
Cc: avi@redhat.com, mingo@redhat.com, hpa@zytor.com,
ryanh@linux.vnet.ibm.com, aliguori@us.ibm.com,
kvm@vger.kernel.org, linux-arch@vger.kernel.org, x86@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4 V13] Add functions to check if the host has stopped the vm
Date: Fri, 10 Feb 2012 14:05:36 -0200 [thread overview]
Message-ID: <20120210160536.GA23363@amt.cnet> (raw)
In-Reply-To: <1328713666-11424-3-git-send-email-emunson@mgebm.net>
On Wed, Feb 08, 2012 at 10:07:44AM -0500, Eric B Munson wrote:
> 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>
> Cc: mingo@redhat.com
> Cc: hpa@zytor.com
> Cc: ryanh@linux.vnet.ibm.com
> Cc: aliguori@us.ibm.com
> Cc: mtosatti@redhat.com
> Cc: kvm@vger.kernel.org
> Cc: linux-arch@vger.kernel.org
> Cc: x86@kernel.org
> Cc: linux-kernel@vger.kernel.org
> ---
> Changes from V11:
> Re-add the missing asm-generic stub for check_and_clear_guest_stopped()
> Changes from V6:
> Use __this_cpu_and when clearing the PVCLOCK_GUEST_STOPPED flag
> Changes from V5:
> Collapse generic stubs into this patch
> check_and_clear_guest_stopped() takes no args and uses __get_cpu_var()
> Include individual definitions in ia64, s390, and powerpc
>
> arch/ia64/include/asm/kvm_para.h | 5 +++++
> arch/powerpc/include/asm/kvm_para.h | 5 +++++
> arch/s390/include/asm/kvm_para.h | 5 +++++
> arch/x86/include/asm/kvm_para.h | 8 ++++++++
> arch/x86/kernel/kvmclock.c | 21 +++++++++++++++++++++
> include/asm-generic/kvm_para.h | 14 ++++++++++++++
> 6 files changed, 58 insertions(+), 0 deletions(-)
> create mode 100644 include/asm-generic/kvm_para.h
>
> diff --git a/arch/ia64/include/asm/kvm_para.h b/arch/ia64/include/asm/kvm_para.h
> index 1588aee..2019cb9 100644
> --- a/arch/ia64/include/asm/kvm_para.h
> +++ b/arch/ia64/include/asm/kvm_para.h
> @@ -26,6 +26,11 @@ static inline unsigned int kvm_arch_para_features(void)
> return 0;
> }
>
> +static inline bool kvm_check_and_clear_guest_paused(void)
> +{
> + return false;
> +}
> +
> #endif
>
> #endif
> diff --git a/arch/powerpc/include/asm/kvm_para.h b/arch/powerpc/include/asm/kvm_para.h
> index 50533f9..1f80293 100644
> --- a/arch/powerpc/include/asm/kvm_para.h
> +++ b/arch/powerpc/include/asm/kvm_para.h
> @@ -169,6 +169,11 @@ static inline unsigned int kvm_arch_para_features(void)
> return r;
> }
>
> +static inline bool kvm_check_and_clear_guest_paused(void)
> +{
> + return false;
> +}
> +
> #endif /* __KERNEL__ */
>
> #endif /* __POWERPC_KVM_PARA_H__ */
> diff --git a/arch/s390/include/asm/kvm_para.h b/arch/s390/include/asm/kvm_para.h
> index 6964db2..a988329 100644
> --- a/arch/s390/include/asm/kvm_para.h
> +++ b/arch/s390/include/asm/kvm_para.h
> @@ -149,6 +149,11 @@ static inline unsigned int kvm_arch_para_features(void)
> return 0;
> }
>
> +static inline bool kvm_check_and_clear_guest_paused(void)
> +{
> + return false;
> +}
> +
> #endif
>
> #endif /* __S390_KVM_PARA_H */
> diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h
> index 734c376..99c4bbe 100644
> --- a/arch/x86/include/asm/kvm_para.h
> +++ b/arch/x86/include/asm/kvm_para.h
> @@ -95,6 +95,14 @@ struct kvm_vcpu_pv_apf_data {
> extern void kvmclock_init(void);
> extern int kvm_register_clock(char *txt);
>
> +#ifdef CONFIG_KVM_CLOCK
> +bool kvm_check_and_clear_guest_paused(void);
> +#else
> +static inline bool kvm_check_and_clear_guest_paused(void)
> +{
> + return false;
> +}
> +#endif /* CONFIG_KVMCLOCK */
>
> /* 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..bdf6423 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(void)
> +{
> + 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 = &__get_cpu_var(hv_clock);
> + if ((src->flags & PVCLOCK_GUEST_STOPPED) != 0) {
> + __this_cpu_and(hv_clock.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,
> diff --git a/include/asm-generic/kvm_para.h b/include/asm-generic/kvm_para.h
> new file mode 100644
> index 0000000..05ef7e7
> --- /dev/null
> +++ b/include/asm-generic/kvm_para.h
> @@ -0,0 +1,14 @@
> +#ifndef _ASM_GENERIC_KVM_PARA_H
> +#define _ASM_GENERIC_KVM_PARA_H
> +
> +
> +/*
> + * This function is used by architectures that support kvm to avoid issuing
> + * false soft lockup messages.
> + */
> +static inline bool kvm_check_and_clear_guest_paused(void)
> +{
> + return false;
> +}
> +
> +#endif
How is the stub getting included for other architectures again?
next prev parent reply other threads:[~2012-02-10 16:15 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-08 15:07 [PATCH 0/4 V13] Avoid soft lockup message when KVM is stopped by host Eric B Munson
2012-02-08 15:07 ` [PATCH 1/4 V13] Add flag to indicate that a vm was stopped by the host Eric B Munson
2012-02-08 15:07 ` [PATCH 2/4 V13] Add functions to check if the host has stopped the vm Eric B Munson
2012-02-10 16:05 ` Marcelo Tosatti [this message]
2012-02-08 15:07 ` [PATCH 3/4 V13] Add ioctl for KVM_KVMCLOCK_CTRL Eric B Munson
2012-02-16 14:11 ` Avi Kivity
2012-02-08 15:07 ` [PATCH 4/4 V13] Add check for suspended vm in softlockup detector Eric B Munson
2012-02-14 15:29 ` [PATCH 0/4 V13] Avoid soft lockup message when KVM is stopped by host Eric B Munson
2012-02-14 15:38 ` Marcelo Tosatti
2012-02-14 15:50 ` Eric B Munson
2012-02-14 16:10 ` Marcelo Tosatti
2012-02-14 21:17 ` Eric B Munson
2012-03-05 16:39 ` Marcelo Tosatti
2012-03-05 17:10 ` Eric B Munson
2012-03-05 17:10 ` Eric B Munson
2012-03-10 19:53 ` Eric B Munson
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=20120210160536.GA23363@amt.cnet \
--to=mtosatti@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=emunson@mgebm.net \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=ryanh@linux.vnet.ibm.com \
--cc=x86@kernel.org \
/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 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.