Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1528758ybt; Thu, 9 Jul 2020 09:07:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTQUkguOUk223rA8Bjffx5DkkChNj47tMVeeFUDfxuVkVAd8LeLd0dgtuzXWd/DtyZozET X-Received: by 2002:a17:906:840a:: with SMTP id n10mr54978575ejx.453.1594310822280; Thu, 09 Jul 2020 09:07:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594310822; cv=none; d=google.com; s=arc-20160816; b=k51G7zDSBBIQAdT2sJmUfvED2w8rriZuTIxenukb0HkiGw8pmJlOhgMfdLLazlCgfj Oggq+BMpmdHRpDj8z4AwUrZdmgHggu3O73IDNUs8gDilVkT8DB9BjZqvWV1/ehf0QsSu UNmMDAwawjEBbEHLsxmHwUvtUV2HaIIQSRDM9tQs7lUvvxsSYvltKVlasRrf4LpKVHYF ipwoGsqrt812PKQ48ljU85HLjIRV0L+7KD/Z/ClNmrdcgiDpICh0dDLNQTZxhcJhqDWu 64VhJ36F2oraTvD238+4VHgJ8jVtHHhyamjNMelW7IsQzZ+8WusWC+JlivwnOZS8sC0a jOuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature; bh=5OfLVV9ee+e3aH9dIq9Uyj1RNa4dEfM45FxDPLW9s5s=; b=ew1C4Ir3sA96qQ8STwyYy8eUCQls3WdgimRRdVDgpELp73C4O4vnyjYeyac+lLe6Y9 AtQaA074t+7YmZ7mrOiEz4uob7PGO7g6K130BktMY/nSnmL31NrI7GxKFRuDUF8edoaR sfB9PWBJecnYOEDUnY45ziEQC8TpxfzzJcqvmUDrP9v8H42MGGHRlo/BZJiIyeEiAEB6 4nBUUqgQSTFsiX9CCC/Soh28ArhTEjAgE4eLbq8Vjf94uR5mQejDWCYFf00FIAMwoc1d pexXvQyftS2GYmWIdoe068p/nggHg+OhZ9y9xBYQqFqVChmu7NHHV7/VjxUNlXKgoT7z YQ4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="NlA/VgQJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bf17si2132947edb.78.2020.07.09.09.06.38; Thu, 09 Jul 2020 09:07:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="NlA/VgQJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727083AbgGIQGV (ORCPT + 99 others); Thu, 9 Jul 2020 12:06:21 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:49884 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726357AbgGIQGV (ORCPT ); Thu, 9 Jul 2020 12:06:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594310779; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5OfLVV9ee+e3aH9dIq9Uyj1RNa4dEfM45FxDPLW9s5s=; b=NlA/VgQJqA0Q24ZO3iOfXFf/3fA9Mma4nXewT+RKFTNODn/sNrOctwkhaxSDp8J4mUd/65 jyne8uQIbz3Y4f5g1Yk8UCiRie+psAcIq677Vhs3mbEl9ObV1EGivWcwe89mvII9lFyHF8 724AV0cBSegsZorUHgSPju1Ag3kqlF4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-378-3cdqq7fgOK-wggAAqi1Q3w-1; Thu, 09 Jul 2020 12:06:17 -0400 X-MC-Unique: 3cdqq7fgOK-wggAAqi1Q3w-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 83A94100AA21; Thu, 9 Jul 2020 16:06:15 +0000 (UTC) Received: from llong.remote.csb (ovpn-120-122.rdu2.redhat.com [10.10.120.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB60179CE7; Thu, 9 Jul 2020 16:06:13 +0000 (UTC) Subject: Re: [PATCH v3 5/6] powerpc/pseries: implement paravirt qspinlocks for SPLPAR To: Michael Ellerman , Nicholas Piggin , linuxppc-dev@lists.ozlabs.org Cc: Will Deacon , Peter Zijlstra , Boqun Feng , Ingo Molnar , Anton Blanchard , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, kvm-ppc@vger.kernel.org, linux-arch@vger.kernel.org References: <20200706043540.1563616-1-npiggin@gmail.com> <20200706043540.1563616-6-npiggin@gmail.com> <874kqhvu1v.fsf@mpe.ellerman.id.au> From: Waiman Long Organization: Red Hat Message-ID: <8265d782-4e50-a9b2-a908-0cb588ffa09c@redhat.com> Date: Thu, 9 Jul 2020 12:06:13 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <874kqhvu1v.fsf@mpe.ellerman.id.au> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/9/20 6:53 AM, Michael Ellerman wrote: > Nicholas Piggin writes: > >> Signed-off-by: Nicholas Piggin >> --- >> arch/powerpc/include/asm/paravirt.h | 28 ++++++++ >> arch/powerpc/include/asm/qspinlock.h | 66 +++++++++++++++++++ >> arch/powerpc/include/asm/qspinlock_paravirt.h | 7 ++ >> arch/powerpc/platforms/pseries/Kconfig | 5 ++ >> arch/powerpc/platforms/pseries/setup.c | 6 +- >> include/asm-generic/qspinlock.h | 2 + > Another ack? > I am OK with adding the #ifdef around queued_spin_lock(). Acked-by: Waiman Long >> diff --git a/arch/powerpc/include/asm/paravirt.h b/arch/powerpc/include/asm/paravirt.h >> index 7a8546660a63..f2d51f929cf5 100644 >> --- a/arch/powerpc/include/asm/paravirt.h >> +++ b/arch/powerpc/include/asm/paravirt.h >> @@ -45,6 +55,19 @@ static inline void yield_to_preempted(int cpu, u32 yield_count) >> { >> ___bad_yield_to_preempted(); /* This would be a bug */ >> } >> + >> +extern void ___bad_yield_to_any(void); >> +static inline void yield_to_any(void) >> +{ >> + ___bad_yield_to_any(); /* This would be a bug */ >> +} > Why do we do that rather than just not defining yield_to_any() at all > and letting the build fail on that? > > There's a condition somewhere that we know will false at compile time > and drop the call before linking? > >> diff --git a/arch/powerpc/include/asm/qspinlock_paravirt.h b/arch/powerpc/include/asm/qspinlock_paravirt.h >> new file mode 100644 >> index 000000000000..750d1b5e0202 >> --- /dev/null >> +++ b/arch/powerpc/include/asm/qspinlock_paravirt.h >> @@ -0,0 +1,7 @@ >> +/* SPDX-License-Identifier: GPL-2.0-or-later */ >> +#ifndef __ASM_QSPINLOCK_PARAVIRT_H >> +#define __ASM_QSPINLOCK_PARAVIRT_H > _ASM_POWERPC_QSPINLOCK_PARAVIRT_H please. > >> + >> +EXPORT_SYMBOL(__pv_queued_spin_unlock); > Why's that in a header? Should that (eventually) go with the generic implementation? The PV qspinlock implementation is not that generic at the moment. Even though native qspinlock is used by a number of archs, PV qspinlock is only currently used in x86. This is certainly an area that needs improvement. >> diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig >> index 24c18362e5ea..756e727b383f 100644 >> --- a/arch/powerpc/platforms/pseries/Kconfig >> +++ b/arch/powerpc/platforms/pseries/Kconfig >> @@ -25,9 +25,14 @@ config PPC_PSERIES >> select SWIOTLB >> default y >> >> +config PARAVIRT_SPINLOCKS >> + bool >> + default n > default n is the default. > >> diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c >> index 2db8469e475f..747a203d9453 100644 >> --- a/arch/powerpc/platforms/pseries/setup.c >> +++ b/arch/powerpc/platforms/pseries/setup.c >> @@ -771,8 +771,12 @@ static void __init pSeries_setup_arch(void) >> if (firmware_has_feature(FW_FEATURE_LPAR)) { >> vpa_init(boot_cpuid); >> >> - if (lppaca_shared_proc(get_lppaca())) >> + if (lppaca_shared_proc(get_lppaca())) { >> static_branch_enable(&shared_processor); >> +#ifdef CONFIG_PARAVIRT_SPINLOCKS >> + pv_spinlocks_init(); >> +#endif >> + } > We could avoid the ifdef with this I think? > > diff --git a/arch/powerpc/include/asm/spinlock.h b/arch/powerpc/include/asm/spinlock.h > index 434615f1d761..6ec72282888d 100644 > --- a/arch/powerpc/include/asm/spinlock.h > +++ b/arch/powerpc/include/asm/spinlock.h > @@ -10,5 +10,9 @@ > #include > #endif > > +#ifndef CONFIG_PARAVIRT_SPINLOCKS > +static inline void pv_spinlocks_init(void) { } > +#endif > + > #endif /* __KERNEL__ */ > #endif /* __ASM_SPINLOCK_H */ > > > cheers > We don't really need to do a pv_spinlocks_init() if pv_kick() isn't supported. Cheers, Longman