Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp111279rwo; Tue, 1 Aug 2023 13:53:54 -0700 (PDT) X-Google-Smtp-Source: APBJJlHIOEUthfNKyZLjwZEQfeRVyvRUOcRY7gM3VQN8wV3j6VyYueHFY8HKwOmeF8o6owOiSBoa X-Received: by 2002:a17:906:3ca1:b0:99b:5a73:4d09 with SMTP id b1-20020a1709063ca100b0099b5a734d09mr2856244ejh.43.1690923234308; Tue, 01 Aug 2023 13:53:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690923234; cv=none; d=google.com; s=arc-20160816; b=TGfEp2KihINN4dOfDeQJYYQbLaWfRYNL1+3FC5EDHFnR3R59ib7tJNh1wRj+lvOoBL SoMRQdyzqhT5Hw0iQmLnvjMQnyszdbODlo80ei9SWI2FkNPEkLfaUaTC33TVYx5k7yDJ iivdGu2nOwFb4dlWUhUuc6Lli66EO0YzKnMXoEHz8j9CmVTAVwFJBXQNV6BDLOnB40Zw kjZ0akkVSpptOKcn+ohOkweVRBIlD4TB2FQESBbX6y2Yi3BAPUj1RKGND7+/FuhZFwMZ /PxIQsM7OEY0a2GkV9UhVvQDm3hReIj1Xp+c43WP4GKo1SCK+gxSZys872VKfiIQp5QB GNVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature :dkim-signature; bh=UYatibP40K4I2B9IENly3nEtY126fQ2AXlmH0dKm10Q=; fh=taQH2NodN5F7a/yRJbAbvoFDcYX2fcA5WfyKUG39xwk=; b=e5oonwXr4yKtB6jyd9nDGtOKM3XvDgPmiJT+qbzF+zoa3n/ThJIQGTYeRtXGp5Zel0 QSqiZWaG3EJeaIRLTXX0bLsLSuqimFTWRKB2WunDni4NKUhtsFhmamKaE5eAVsVXySWJ vJWlg9A2Q/fQ1Ydz7t0OUkqTScO8Dj9f+OkdcwOcIUhjhLx8GAC5zXz5LdfAManvtjhR FcFuja/ridZV8qPBR+HIm0bRViz2AqOkUeyLTVcMFomnqKoUgN85mE0DOizpQT9/Cosb 5MYXoofPkQd8FWzA/V7rZ/qNJIBamxq6+jlSNjqQsmVoBBpKIDr6bdDtJ7L5Wu5LGqq1 IUQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=Xp+GIn40; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b="CnMDC/jy"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qq26-20020a17090720da00b00988c64dd2e7si9324098ejb.850.2023.08.01.13.53.29; Tue, 01 Aug 2023 13:53:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=Xp+GIn40; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b="CnMDC/jy"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230474AbjHAU1A (ORCPT + 99 others); Tue, 1 Aug 2023 16:27:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229724AbjHAU06 (ORCPT ); Tue, 1 Aug 2023 16:26:58 -0400 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C92F1268C for ; Tue, 1 Aug 2023 13:26:57 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 434025C018C; Tue, 1 Aug 2023 16:26:57 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute6.internal (MEProxy); Tue, 01 Aug 2023 16:26:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1690921617; x=1691008017; bh=UY atibP40K4I2B9IENly3nEtY126fQ2AXlmH0dKm10Q=; b=Xp+GIn40oDnDFpaLvp 19QuHjcHwLGtp5p67HqAy7vMqhoXIEaMxFfdmaT9COFVz7o7w+of5HY4KJMqQ8C0 GgNN0gRsE8JcklZs2bcHESNAtbbQwZmG/O7imHnjD4jLJcwGzv9Lv1ZyzBpGxN3H XEpAqpU4fJCus4/VjpdgcqPqTadBw0a24TuyEO5xBtOCybbMyJ32sbIv0xl3ZP1S vzjHrRIGQf8QyM0VOJIrVVFxYDkTp4rF0ckjI9K15ZszJjl29o800j2cSukjgBRJ w5B/3/oRzpHGVonB90uo1Fyamx56nUtUGk3BQyR47JzJFPPBTPaP+Mjps+5XaRSm tuCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1690921617; x=1691008017; bh=UYatibP40K4I2 B9IENly3nEtY126fQ2AXlmH0dKm10Q=; b=CnMDC/jyzCnOa2st6mA269KKtKXZg 2CcVSp2xQfGMwa47YVu5FByTSknAhHUCR9ptD2x32E1BOYWvHSS4t8xzx7rhtRhX P+pqrPclo7vgmRwKTuwQx/kYlTdkHofn/OuG4vlpnSmLgC3yInjoymHVVwTcjWuO v/ycPMGjuU0YStChJh0iA06JGvC6osn9HJY1mGqyoPKoeOIp7ZQi6/tipo0ZU56h E5Gtfy+IOcbhGa3tcW3z1pp/FS5hSvnQdl7xQnqvr+JkhKOvyojGAmdl21lqVsTD geqGtF+KEA8vlqgMddgIr7Rwmv+rhNzqpzNjE6vVly1ndq6Osjm8g8tyQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrjeeigddugeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepffehueegteeihfegtefhjefgtdeugfegjeelheejueethfefgeeghfektdek teffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 908BBB60089; Tue, 1 Aug 2023 16:26:56 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-592-ga9d4a09b4b-fm-defalarms-20230725.001-ga9d4a09b Mime-Version: 1.0 Message-Id: <21188533-a56b-484b-8cb7-053f38a4155c@app.fastmail.com> In-Reply-To: <20230801192217.GHZMlbaVMBavu909lb@fat_crate.local> References: <20230725134837.1534228-1-arnd@kernel.org> <20230725134837.1534228-4-arnd@kernel.org> <20230801192217.GHZMlbaVMBavu909lb@fat_crate.local> Date: Tue, 01 Aug 2023 22:26:36 +0200 From: "Arnd Bergmann" To: "Borislav Petkov" , "Arnd Bergmann" Cc: linux-kernel@vger.kernel.org, x86@kernel.org, "Thomas Gleixner" , "Ingo Molnar" , "Dave Hansen" , "H. Peter Anvin" Subject: Re: [PATCH 3/5] [RESEND] x86: qspinlock-paravirt: fix mising-prototype warnings Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 1, 2023, at 21:22, Borislav Petkov wrote: > On Tue, Jul 25, 2023 at 03:48:35PM +0200, Arnd Bergmann wrote: >> diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c >> index 89842bb7ec9cc..64a6bba70d183 100644 >> --- a/arch/x86/kernel/paravirt.c >> +++ b/arch/x86/kernel/paravirt.c >> @@ -73,11 +73,13 @@ DEFINE_PARAVIRT_ASM(pv_native_read_cr2, "mov %cr2, %rax", .noinstr.text); >> >> DEFINE_STATIC_KEY_TRUE(virt_spin_lock_key); >> >> +#ifdef CONFIG_SMP >> void __init native_pv_lock_init(void) >> { >> if (!boot_cpu_has(X86_FEATURE_HYPERVISOR)) >> static_branch_disable(&virt_spin_lock_key); >> } >> +#endif > > Can you add an empty UP stub instead? > > We all have a great aversion against ifdeffery... There is already a stub for !CONFIG_PARAVIRT in asm/qspinlock.h, but the problem is that this header does not get included anywhere in UP configurations. The variant below would avoid adding more #ifdefs, by moving the declaration into asm/paravirt.h to ensure that it's declared even if there is no caller. Does this look better to you? Arnd diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index b49778664d2be..fc3a377bb9b79 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h @@ -739,6 +739,7 @@ static __always_inline unsigned long arch_local_irq_save(void) ".popsection") extern void default_banner(void); +void native_pv_lock_init(void) __init; #else /* __ASSEMBLY__ */ @@ -776,8 +777,13 @@ extern void default_banner(void); #endif /* __ASSEMBLY__ */ #else /* CONFIG_PARAVIRT */ # define default_banner x86_init_noop + +static inline void native_pv_lock_init(void) +{ +} #endif /* !CONFIG_PARAVIRT */ #ifndef __ASSEMBLY__ diff --git a/arch/x86/include/asm/qspinlock.h b/arch/x86/include/asm/qspinlock.h index d87451df480bd..cde8357bb226d 100644 --- a/arch/x86/include/asm/qspinlock.h +++ b/arch/x86/include/asm/qspinlock.h @@ -74,8 +74,6 @@ static inline bool vcpu_is_preempted(long cpu) */ DECLARE_STATIC_KEY_TRUE(virt_spin_lock_key); -void native_pv_lock_init(void) __init; - /* * Shortcut for the queued_spin_lock_slowpath() function that allows * virt to hijack it. @@ -103,10 +101,7 @@ static inline bool virt_spin_lock(struct qspinlock *lock) return true; } -#else -static inline void native_pv_lock_init(void) -{ -} + #endif /* CONFIG_PARAVIRT */ #include diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index 89842bb7ec9cc..066fc19d2568e 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c @@ -75,7 +75,8 @@ DEFINE_STATIC_KEY_TRUE(virt_spin_lock_key); void __init native_pv_lock_init(void) { - if (!boot_cpu_has(X86_FEATURE_HYPERVISOR)) + if (IS_ENABLED(CONFIG_PARAVIRT_SPINLOCKS) && + !boot_cpu_has(X86_FEATURE_HYPERVISOR)) static_branch_disable(&virt_spin_lock_key); }