From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Virtualization <virtualization@lists.linux-foundation.org>,
"H. Peter Anvin" <hpa@zytor.com>,
Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>,
Dave Jiang <dave.jiang@intel.com>, KVM <kvm@vger.kernel.org>,
x86@kernel.org, Ingo Molnar <mingo@redhat.com>,
Avi Kivity <avi@redhat.com>, Rik van Riel <riel@redhat.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>,
Xen <xen-devel@lists.xensource.com>,
Sasha Levin <levinsasha928@gmail.com>,
Sedat Dilek <sedat.dilek@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Yinghai Lu <yinghai@kernel.org>,
Greg Kroah-Hartman <gregkh@suse.de>,
LKML <linux-kernel@vger.kernel.org>,
Dave Hansen <dave@linux.vnet.ibm.com>,
Suzuki Poulose <suzuki@linux.vnet.ibm.com>
Subject: Re: [PATCH RFC V3 4/4] kvm : pv-ticketlocks support for linux guests running on KVM hypervisor
Date: Mon, 5 Dec 2011 22:27:41 -0500 [thread overview]
Message-ID: <20111206032741.GF6647@phenom.dumpdata.com> (raw)
In-Reply-To: <20111130090038.23386.4505.sendpatchset@oc5400248562.ibm.com>
On Wed, Nov 30, 2011 at 02:30:38PM +0530, Raghavendra K T wrote:
> This patch extends Linux guests running on KVM hypervisor to support
> pv-ticketlocks.
> During smp_boot_cpus paravirtualied KVM guest detects if the hypervisor has
> required feature (KVM_FEATURE_KICK_VCPU) to support pv-ticketlocks. If so,
> support for pv-ticketlocks is registered via pv_lock_ops.
>
> Signed-off-by: Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>
> Signed-off-by: Suzuki Poulose <suzuki@in.ibm.com>
> Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
> ---
> diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h
> index 8b1d65d..7e419ad 100644
> --- a/arch/x86/include/asm/kvm_para.h
> +++ b/arch/x86/include/asm/kvm_para.h
> @@ -195,10 +195,21 @@ void kvm_async_pf_task_wait(u32 token);
> void kvm_async_pf_task_wake(u32 token);
> u32 kvm_read_and_reset_pf_reason(void);
> extern void kvm_disable_steal_time(void);
> -#else
> -#define kvm_guest_init() do { } while (0)
> +
> +#ifdef CONFIG_PARAVIRT_SPINLOCKS
> +void __init kvm_spinlock_init(void);
> +#else /* CONFIG_PARAVIRT_SPINLOCKS */
> +static void kvm_spinlock_init(void)
> +{
> +}
> +#endif /* CONFIG_PARAVIRT_SPINLOCKS */
> +
> +#else /* CONFIG_KVM_GUEST */
> +#define kvm_guest_init() do {} while (0)
> #define kvm_async_pf_task_wait(T) do {} while(0)
> #define kvm_async_pf_task_wake(T) do {} while(0)
> +#define kvm_spinlock_init() do {} while (0)
> +
> static inline u32 kvm_read_and_reset_pf_reason(void)
> {
> return 0;
> diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
> index a9c2116..dffeea3 100644
> --- a/arch/x86/kernel/kvm.c
> +++ b/arch/x86/kernel/kvm.c
> @@ -33,6 +33,7 @@
> #include <linux/sched.h>
> #include <linux/slab.h>
> #include <linux/kprobes.h>
> +#include <linux/debugfs.h>
> #include <asm/timer.h>
> #include <asm/cpu.h>
> #include <asm/traps.h>
> @@ -545,6 +546,7 @@ static void __init kvm_smp_prepare_boot_cpu(void)
> #endif
> kvm_guest_cpu_init();
> native_smp_prepare_boot_cpu();
> + kvm_spinlock_init();
> }
>
> static void __cpuinit kvm_guest_cpu_online(void *dummy)
> @@ -627,3 +629,248 @@ static __init int activate_jump_labels(void)
> return 0;
> }
> arch_initcall(activate_jump_labels);
> +
> +#ifdef CONFIG_PARAVIRT_SPINLOCKS
> +
> +enum kvm_contention_stat {
> + TAKEN_SLOW,
> + TAKEN_SLOW_PICKUP,
> + RELEASED_SLOW,
> + RELEASED_SLOW_KICKED,
> + NR_CONTENTION_STATS
> +};
> +
> +#ifdef CONFIG_KVM_DEBUG_FS
> +
> +static struct kvm_spinlock_stats
> +{
> + u32 contention_stats[NR_CONTENTION_STATS];
> +
> +#define HISTO_BUCKETS 30
> + u32 histo_spin_blocked[HISTO_BUCKETS+1];
> +
> + u64 time_blocked;
> +} spinlock_stats;
> +
> +static u8 zero_stats;
> +
> +static inline void check_zero(void)
> +{
> + u8 ret;
> + u8 old = ACCESS_ONCE(zero_stats);
> + if (unlikely(old)) {
> + ret = cmpxchg(&zero_stats, old, 0);
> + /* This ensures only one fellow resets the stat */
> + if (ret == old)
> + memset(&spinlock_stats, 0, sizeof(spinlock_stats));
> + }
> +}
> +
> +static inline void add_stats(enum kvm_contention_stat var, int val)
You probably want 'int val' to be 'u32 val' as that is the type
in contention_stats.
WARNING: multiple messages have this Message-ID (diff)
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>, KVM <kvm@vger.kernel.org>,
Sedat Dilek <sedat.dilek@gmail.com>,
Ingo Molnar <mingo@redhat.com>,
Virtualization <virtualization@lists.linux-foundation.org>,
Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Dave Jiang <dave.jiang@intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Gleb Natapov <gleb@redhat.com>, Yinghai Lu <yinghai@kernel.org>,
Marcelo Tosatti <mtosatti@redhat.com>,
Xen <xen-devel@lists.xensource.com>, Avi Kivity <avi@redhat.com>,
Rik van Riel <riel@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>,
Peter Zijlstra <peterz@infradead.org>,
Sasha Levin <levinsasha928@gmail.com>,
Suzuki Poulose <suzuki@linux.vnet.ibm.com>,
Dave Hansen <dave@linux.vnet.ibm.com>
Subject: Re: [PATCH RFC V3 4/4] kvm : pv-ticketlocks support for linux guests running on KVM hypervisor
Date: Mon, 5 Dec 2011 22:27:41 -0500 [thread overview]
Message-ID: <20111206032741.GF6647@phenom.dumpdata.com> (raw)
In-Reply-To: <20111130090038.23386.4505.sendpatchset@oc5400248562.ibm.com>
On Wed, Nov 30, 2011 at 02:30:38PM +0530, Raghavendra K T wrote:
> This patch extends Linux guests running on KVM hypervisor to support
> pv-ticketlocks.
> During smp_boot_cpus paravirtualied KVM guest detects if the hypervisor has
> required feature (KVM_FEATURE_KICK_VCPU) to support pv-ticketlocks. If so,
> support for pv-ticketlocks is registered via pv_lock_ops.
>
> Signed-off-by: Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>
> Signed-off-by: Suzuki Poulose <suzuki@in.ibm.com>
> Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
> ---
> diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h
> index 8b1d65d..7e419ad 100644
> --- a/arch/x86/include/asm/kvm_para.h
> +++ b/arch/x86/include/asm/kvm_para.h
> @@ -195,10 +195,21 @@ void kvm_async_pf_task_wait(u32 token);
> void kvm_async_pf_task_wake(u32 token);
> u32 kvm_read_and_reset_pf_reason(void);
> extern void kvm_disable_steal_time(void);
> -#else
> -#define kvm_guest_init() do { } while (0)
> +
> +#ifdef CONFIG_PARAVIRT_SPINLOCKS
> +void __init kvm_spinlock_init(void);
> +#else /* CONFIG_PARAVIRT_SPINLOCKS */
> +static void kvm_spinlock_init(void)
> +{
> +}
> +#endif /* CONFIG_PARAVIRT_SPINLOCKS */
> +
> +#else /* CONFIG_KVM_GUEST */
> +#define kvm_guest_init() do {} while (0)
> #define kvm_async_pf_task_wait(T) do {} while(0)
> #define kvm_async_pf_task_wake(T) do {} while(0)
> +#define kvm_spinlock_init() do {} while (0)
> +
> static inline u32 kvm_read_and_reset_pf_reason(void)
> {
> return 0;
> diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
> index a9c2116..dffeea3 100644
> --- a/arch/x86/kernel/kvm.c
> +++ b/arch/x86/kernel/kvm.c
> @@ -33,6 +33,7 @@
> #include <linux/sched.h>
> #include <linux/slab.h>
> #include <linux/kprobes.h>
> +#include <linux/debugfs.h>
> #include <asm/timer.h>
> #include <asm/cpu.h>
> #include <asm/traps.h>
> @@ -545,6 +546,7 @@ static void __init kvm_smp_prepare_boot_cpu(void)
> #endif
> kvm_guest_cpu_init();
> native_smp_prepare_boot_cpu();
> + kvm_spinlock_init();
> }
>
> static void __cpuinit kvm_guest_cpu_online(void *dummy)
> @@ -627,3 +629,248 @@ static __init int activate_jump_labels(void)
> return 0;
> }
> arch_initcall(activate_jump_labels);
> +
> +#ifdef CONFIG_PARAVIRT_SPINLOCKS
> +
> +enum kvm_contention_stat {
> + TAKEN_SLOW,
> + TAKEN_SLOW_PICKUP,
> + RELEASED_SLOW,
> + RELEASED_SLOW_KICKED,
> + NR_CONTENTION_STATS
> +};
> +
> +#ifdef CONFIG_KVM_DEBUG_FS
> +
> +static struct kvm_spinlock_stats
> +{
> + u32 contention_stats[NR_CONTENTION_STATS];
> +
> +#define HISTO_BUCKETS 30
> + u32 histo_spin_blocked[HISTO_BUCKETS+1];
> +
> + u64 time_blocked;
> +} spinlock_stats;
> +
> +static u8 zero_stats;
> +
> +static inline void check_zero(void)
> +{
> + u8 ret;
> + u8 old = ACCESS_ONCE(zero_stats);
> + if (unlikely(old)) {
> + ret = cmpxchg(&zero_stats, old, 0);
> + /* This ensures only one fellow resets the stat */
> + if (ret == old)
> + memset(&spinlock_stats, 0, sizeof(spinlock_stats));
> + }
> +}
> +
> +static inline void add_stats(enum kvm_contention_stat var, int val)
You probably want 'int val' to be 'u32 val' as that is the type
in contention_stats.
next prev parent reply other threads:[~2011-12-06 3:27 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-30 8:59 [PATCH RFC V3 0/4] kvm : Paravirt-spinlock support for KVM guests Raghavendra K T
2011-11-30 8:59 ` [PATCH RFC V3 1/4] debugfs: Add support to print u32 array in debugfs Raghavendra K T
2011-12-06 0:13 ` [Xen-devel] " Konrad Rzeszutek Wilk
2011-12-06 0:13 ` Konrad Rzeszutek Wilk
2011-12-06 0:13 ` Konrad Rzeszutek Wilk
2011-12-06 0:13 ` Konrad Rzeszutek Wilk
2011-11-30 8:59 ` Raghavendra K T
2011-11-30 8:59 ` [PATCH RFC V3 2/4] kvm hypervisor : Add a hypercall to KVM hypervisor to support pv-ticketlocks Raghavendra K T
2011-12-01 11:11 ` Avi Kivity
2011-12-01 11:11 ` Avi Kivity
2011-12-01 19:50 ` Raghavendra K T
2011-12-01 19:50 ` Raghavendra K T
2011-12-01 19:50 ` Raghavendra K T
2011-12-01 19:50 ` Raghavendra K T
2011-12-02 12:29 ` Raghavendra K T
2011-12-02 12:29 ` Raghavendra K T
2011-12-02 12:29 ` Raghavendra K T
2011-12-04 18:06 ` Raghavendra K T
2011-12-04 18:06 ` Raghavendra K T
2011-12-04 18:06 ` Raghavendra K T
2011-12-06 16:49 ` [Xen-devel] " Konrad Rzeszutek Wilk
2011-12-06 16:49 ` Konrad Rzeszutek Wilk
2011-12-06 16:49 ` Konrad Rzeszutek Wilk
2011-12-07 10:53 ` Avi Kivity
2011-12-07 10:53 ` Avi Kivity
2011-12-08 17:35 ` Raghavendra K T
2011-12-08 17:35 ` Raghavendra K T
2011-12-07 10:48 ` Marcelo Tosatti
2011-12-07 10:48 ` Marcelo Tosatti
2011-12-07 11:54 ` Raghavendra K T
2011-12-07 11:54 ` Raghavendra K T
2011-12-07 11:54 ` Raghavendra K T
2011-12-07 12:33 ` Marcelo Tosatti
2011-12-07 12:33 ` Marcelo Tosatti
2011-12-07 12:33 ` Marcelo Tosatti
2011-12-07 12:47 ` Avi Kivity
2011-12-07 12:47 ` Avi Kivity
2011-12-07 13:39 ` Marcelo Tosatti
2011-12-07 13:39 ` Marcelo Tosatti
2011-12-07 14:52 ` Avi Kivity
2011-12-07 14:52 ` Avi Kivity
2011-12-07 16:46 ` Raghavendra K T
2011-12-07 16:46 ` Raghavendra K T
2011-12-07 16:46 ` Raghavendra K T
2011-12-08 9:40 ` Avi Kivity
2011-12-08 9:40 ` Avi Kivity
2011-12-08 9:40 ` Avi Kivity
2011-12-09 10:59 ` Raghavendra K T
2011-12-09 10:59 ` Raghavendra K T
2011-12-09 10:59 ` Raghavendra K T
2011-12-09 10:59 ` Raghavendra K T
2011-12-07 16:46 ` Raghavendra K T
2011-12-07 16:31 ` Raghavendra K T
2011-12-07 16:31 ` Raghavendra K T
2011-12-07 16:31 ` Raghavendra K T
2011-11-30 8:59 ` Raghavendra K T
2011-11-30 9:00 ` [PATCH RFC V3 3/4] kvm guest : Added configuration support to enable debug information for KVM Guests Raghavendra K T
2011-11-30 9:00 ` Raghavendra K T
2011-11-30 9:00 ` [PATCH RFC V3 4/4] kvm : pv-ticketlocks support for linux guests running on KVM hypervisor Raghavendra K T
2011-11-30 9:00 ` Raghavendra K T
2011-12-06 3:27 ` Konrad Rzeszutek Wilk [this message]
2011-12-06 3:27 ` Konrad Rzeszutek Wilk
2011-12-06 6:54 ` Raghavendra K T
2011-12-06 6:54 ` Raghavendra K T
2011-12-06 6:54 ` Raghavendra K T
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=20111206032741.GF6647@phenom.dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=avi@redhat.com \
--cc=dave.jiang@intel.com \
--cc=dave@linux.vnet.ibm.com \
--cc=gregkh@suse.de \
--cc=hpa@zytor.com \
--cc=jeremy.fitzhardinge@citrix.com \
--cc=kvm@vger.kernel.org \
--cc=levinsasha928@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=raghavendra.kt@linux.vnet.ibm.com \
--cc=riel@redhat.com \
--cc=sedat.dilek@gmail.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=suzuki@linux.vnet.ibm.com \
--cc=tglx@linutronix.de \
--cc=vatsa@linux.vnet.ibm.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xensource.com \
--cc=yinghai@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.