From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH v11 14/16] pvqspinlock: Add qspinlock para-virtualization support Date: Tue, 17 Jun 2014 16:59:15 -0400 Message-ID: <20140617205915.GC29634@laptop.dumpdata.com> References: <1401464642-33890-1-git-send-email-Waiman.Long@hp.com> <1401464642-33890-15-git-send-email-Waiman.Long@hp.com> <20140612081731.GM3213@twins.programming.kicks-ass.net> <539A1229.1050309@hp.com> <20140615131654.GJ11371@laptop.programming.kicks-ass.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20140615131654.GJ11371@laptop.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 Cc: Waiman Long , linux-arch@vger.kernel.org, Rik van Riel , Raghavendra K T , Gleb Natapov , kvm@vger.kernel.org, Oleg Nesterov , Scott J Norton , x86@kernel.org, Paolo Bonzini , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Ingo Molnar , Chegu Vinod , David Vrabel , "H. Peter Anvin" , xen-devel@lists.xenproject.org, Thomas Gleixner , "Paul E. McKenney" , Linus Torvalds , Boris Ostrovsky List-Id: virtualization@lists.linuxfoundation.org On Sun, Jun 15, 2014 at 03:16:54PM +0200, Peter Zijlstra wrote: > On Thu, Jun 12, 2014 at 04:48:41PM -0400, Waiman Long wrote: > > I don't have a good understanding of the kernel alternatives mechanism. > > I didn't either; I do now, cost me a whole day reading up on > alternative/paravirt code patching. > > See the patches I just send out; I got the 'native' case with paravirt > enabled to be one NOP worse than the native case without paravirt -- for > queue_spin_unlock. > > The lock slowpath is several nops and some pointless movs more expensive. You could use the asm goto which would optimize the fast path to be the 'native' case. That way you wouldn't have the the nops and movs in the path. (And asm goto also uses the alternative_asm macros).