From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751585AbdIEOI1 (ORCPT ); Tue, 5 Sep 2017 10:08:27 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:59643 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750858AbdIEOIZ (ORCPT ); Tue, 5 Sep 2017 10:08:25 -0400 Date: Tue, 5 Sep 2017 16:08:13 +0200 From: Peter Zijlstra To: Waiman Long Cc: Juergen Gross , linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, x86@kernel.org, virtualization@lists.linux-foundation.org, jeremy@goop.org, chrisw@sous-sol.org, akataria@vmware.com, rusty@rustcorp.com.au, boris.ostrovsky@oracle.com, hpa@zytor.com, tglx@linutronix.de, mingo@redhat.com Subject: Re: [PATCH 3/4] paravirt: add virt_spin_lock pvops function Message-ID: <20170905140813.e455trgmcq3ahzry@hirez.programming.kicks-ass.net> References: <20170905132444.7163-1-jgross@suse.com> <20170905132444.7163-4-jgross@suse.com> <3eee978b-e570-5675-7840-c448375b02fc@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3eee978b-e570-5675-7840-c448375b02fc@redhat.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 05, 2017 at 10:02:57AM -0400, Waiman Long wrote: > On 09/05/2017 09:24 AM, Juergen Gross wrote: > > +static inline bool native_virt_spin_lock(struct qspinlock *lock) > > +{ > > + if (!static_cpu_has(X86_FEATURE_HYPERVISOR)) > > + return false; > > + > > I think you can take the above if statement out as you has done test in > native_pv_lock_init(). So the test will also be false here. That does mean we'll run a test-and-set spinlock until paravirt patching happens though. I prefer to not do that. One important point.. we must not be holding any locks when we switch over between the two locks. Back then I spend some time making sure that didn't happen with the X86 feature flag muck.