From mboxrd@z Thu Jan 1 00:00:00 1970 From: Waiman Long Subject: [PATCH v6 07/11] pvqspinlock, x86: Allow unfair queue spinlock in a XEN guest Date: Wed, 12 Mar 2014 14:54:54 -0400 Message-ID: <1394650498-30118-8-git-send-email-Waiman.Long__28811.7831376896$1394650629$gmane$org@hp.com> References: <1394650498-30118-1-git-send-email-Waiman.Long@hp.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WNoJw-00086S-0l for xen-devel@lists.xenproject.org; Wed, 12 Mar 2014 18:56:04 +0000 In-Reply-To: <1394650498-30118-1-git-send-email-Waiman.Long@hp.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Arnd Bergmann , Peter Zijlstra Cc: Jeremy Fitzhardinge , Raghavendra K T , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, Andi Kleen , Michel Lespinasse , Alok Kataria , linux-arch@vger.kernel.org, Gleb Natapov , x86@kernel.org, xen-devel@lists.xenproject.org, "Paul E. McKenney" , Scott J Norton , Rusty Russell , Steven Rostedt , Chris Wright , Oleg Nesterov , Boris Ostrovsky , Aswin Chandramouleeswaran , Chegu Vinod , Waiman Long , linux-kernel@vger.kernel.org, David Vrabel , Andrew Morton , Linu List-Id: xen-devel@lists.xenproject.org This patch adds a XEN init function to activate the unfair queue spinlock in a XEN guest when the PARAVIRT_UNFAIR_LOCKS kernel config option is selected. Signed-off-by: Waiman Long --- arch/x86/xen/setup.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 0982233..66bb6f5 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -625,3 +625,22 @@ void __init xen_arch_setup(void) numa_off = 1; #endif } + +#ifdef CONFIG_PARAVIRT_UNFAIR_LOCKS +/* + * Enable unfair lock if running in a Xen guest + */ +static __init int xen_unfair_locks_init_jump(void) +{ + /* + * Disable unfair lock if not running in a PV domain + */ + if (!xen_pv_domain()) + return 0; + + static_key_slow_inc(¶virt_unfairlocks_enabled); + + return 0; +} +early_initcall(xen_unfair_locks_init_jump); +#endif -- 1.7.1