From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v6 05/11] pvqspinlock, x86: Allow unfair spinlock in a PV guest Date: Fri, 14 Mar 2014 09:48:09 +0100 Message-ID: <5322C249.6060502@redhat.com> References: <1394650498-30118-1-git-send-email-Waiman.Long@hp.com> <1394650498-30118-6-git-send-email-Waiman.Long@hp.com> <20140313151515.GC25546@laptop.programming.kicks-ass.net> <53220F7F.2040701@hp.com> <20140314083001.GN27965@twins.programming.kicks-ass.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20140314083001.GN27965@twins.programming.kicks-ass.net> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org To: Peter Zijlstra , Waiman Long Cc: Jeremy Fitzhardinge , Raghavendra K T , Gleb Natapov , virtualization@lists.linux-foundation.org, Andi Kleen , "H. Peter Anvin" , Michel Lespinasse , Thomas Gleixner , linux-arch@vger.kernel.org, kvm@vger.kernel.org, x86@kernel.org, Alok Kataria , Ingo Molnar , xen-devel@lists.xenproject.org, "Paul E. McKenney" , Rik van Riel , Arnd Bergmann , Konrad Rzeszutek Wilk , Scott J Norton , Steven Rostedt , Chris Wright , Boris Ostrovsky , Aswin Chandramouleeswaran , Oleg Nesterov List-Id: linux-arch.vger.kernel.org Il 14/03/2014 09:30, Peter Zijlstra ha scritto: > Take the situation of 3 (v)CPUs where cpu0 holds the lock but is > preempted. cpu1 queues, cpu2 queues. Then cpu1 gets preempted, after > which cpu0 gets back online. > > The simple test-and-set lock will now let cpu2 acquire. Your queue > however will just sit there spinning, waiting for cpu1 to come back from > holiday. > > I think you're way over engineering this. Just do the simple > test-and-set lock for virt && !paravirt (as I think Paolo Bonzini > suggested RHEL6 already does). Exactly. Paolo From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ee0-f45.google.com ([74.125.83.45]:65124 "EHLO mail-ee0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755803AbaCNIsQ (ORCPT ); Fri, 14 Mar 2014 04:48:16 -0400 Message-ID: <5322C249.6060502@redhat.com> Date: Fri, 14 Mar 2014 09:48:09 +0100 From: Paolo Bonzini MIME-Version: 1.0 Subject: Re: [PATCH v6 05/11] pvqspinlock, x86: Allow unfair spinlock in a PV guest References: <1394650498-30118-1-git-send-email-Waiman.Long@hp.com> <1394650498-30118-6-git-send-email-Waiman.Long@hp.com> <20140313151515.GC25546@laptop.programming.kicks-ass.net> <53220F7F.2040701@hp.com> <20140314083001.GN27965@twins.programming.kicks-ass.net> In-Reply-To: <20140314083001.GN27965@twins.programming.kicks-ass.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-arch-owner@vger.kernel.org List-ID: To: Peter Zijlstra , Waiman Long Cc: Jeremy Fitzhardinge , Raghavendra K T , kvm@vger.kernel.org, Boris Ostrovsky , virtualization@lists.linux-foundation.org, Andi Kleen , "H. Peter Anvin" , Michel Lespinasse , Thomas Gleixner , linux-arch@vger.kernel.org, Gleb Natapov , x86@kernel.org, Ingo Molnar , xen-devel@lists.xenproject.org, "Paul E. McKenney" , Rik van Riel , Arnd Bergmann , Konrad Rzeszutek Wilk , Scott J Norton , Steven Rostedt , Chris Wright , Oleg Nesterov , Alok Kataria , Aswin Chandramouleeswaran Message-ID: <20140314084809.bE1y5DCMukHbLNc_n_zm0zKzSL7ZurUYR_b67WUbOfs@z> Il 14/03/2014 09:30, Peter Zijlstra ha scritto: > Take the situation of 3 (v)CPUs where cpu0 holds the lock but is > preempted. cpu1 queues, cpu2 queues. Then cpu1 gets preempted, after > which cpu0 gets back online. > > The simple test-and-set lock will now let cpu2 acquire. Your queue > however will just sit there spinning, waiting for cpu1 to come back from > holiday. > > I think you're way over engineering this. Just do the simple > test-and-set lock for virt && !paravirt (as I think Paolo Bonzini > suggested RHEL6 already does). Exactly. Paolo