From patchwork Thu Aug 3 15:59:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 130748 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp1288900vqx; Thu, 3 Aug 2023 10:10:17 -0700 (PDT) X-Google-Smtp-Source: APBJJlHL4dclfcx9y6opncWKJrySwJYcOFB7rKn3dSK1cV01TrlcPzCYs6FQ2p+++oXbl3nk6WoD X-Received: by 2002:a17:903:41ce:b0:1bb:c87d:7573 with SMTP id u14-20020a17090341ce00b001bbc87d7573mr20310759ple.46.1691082616417; Thu, 03 Aug 2023 10:10:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691082616; cv=none; d=google.com; s=arc-20160816; b=QNdoyBUS8Ph9QyBgD/z/8jVzjX0zb0fTEdbzbhk9tP7YPsQGD23slIfqT5BFFKpZY7 5BPvap07qlr+I+O/mkmwxEhll1IWvVpYbDB8upf5gcmpoyjqmiSGUWBj6iBWshymVeAi 0l8YafEhdr9Wwk4xwKAMhdkq8RM56ARsvGgfIdIebuMcR/comDGxTEadb46IazE6VeMT 2Q6V2nKLYnfSxHK1wNPIYIQWUNcEA/NXO8xDQUyZvEEdC8+0cx6jWB1gmHu1JUeGFlfu FzzG5yDgVGfUSuWEa6Gdu1PmoeB1xLXZujgRpMoYcOwOh6zUyXYrtvQeygMFsmjH1NOH R+zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=DrlPeRGlA78HVKqkwZR0N0VALee/DtTGcxI3yIftmuI=; fh=GmswEOGbKr3VXwADkGMdbYvANKaeXXy9MxNXblyNAM0=; b=c5CSmAFBuYW0fGz3b6akEqpQ/ERCAIegn/99ul3yB1DD/4K8NHnG2a3y+P3dusq20E bE5+LXmB5lWI28Qul1KmmdH2lfhw6yGxpD26Hggoz/WKxqtzxLBqra2tKf98vjqhoBMj mub+Usu9DTMsAI61ithTCT/E2hFlPMYB41+6SM3lLRh4VoYBUT+rxEiXe5ryZAvHkBNm Y7MhK+7KFJ+zMPdeDvMstTrwPS+mKVQs/Szi+qRTTQJ3zfRhZ8RdW/ZQEVR9b6tcJBC/ qm6T82Lme4FManrU/9dN7rFVVe1+J4uhNcD33xuiSjlqG16pcdcX9zgC0943Q1Tl9TVd 6FnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=3ElgBHqM; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f1-20020a170902ce8100b001bb0fea7441si182443plg.634.2023.08.03.10.10.00; Thu, 03 Aug 2023 10:10:16 -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=@linutronix.de header.s=2020 header.b=3ElgBHqM; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237293AbjHCP71 (ORCPT + 99 others); Thu, 3 Aug 2023 11:59:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236327AbjHCP7R (ORCPT ); Thu, 3 Aug 2023 11:59:17 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67C273A85; Thu, 3 Aug 2023 08:59:16 -0700 (PDT) Date: Thu, 03 Aug 2023 15:59:13 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1691078354; h=from:from:sender:sender:reply-to: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=DrlPeRGlA78HVKqkwZR0N0VALee/DtTGcxI3yIftmuI=; b=3ElgBHqMFZtFY2LJWs73JmxIL+X1Zc9R1VJwFEiseXHFg6iMlfQ8qh62F6C3yIU8Xz+oSa r1yrWd2JZDwH6HOl1F/6OUq69tcgJ5DHlYJ1jQRYOVi3nJ6HztsWPWBQ6VwSAXloWqUT9S Q4HcrRnj5RmI2T503pzPqmSU1O2ZRa5uUIzBaxofL0R/153AXvzfhojd2I80vnW3Jr0sb3 T1fYYsVf6xL4j9KNlR2cztC8YB9JJuiOIAufHfyCVyQa752/eGwqQX9BtepWftSILiDiBo lBnDM1O8TixqLPrP1nzjV3Ko+fzofsaB4QQBySp4Kfpel72qhxzfSOH+3U1V5g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1691078354; h=from:from:sender:sender:reply-to: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=DrlPeRGlA78HVKqkwZR0N0VALee/DtTGcxI3yIftmuI=; b=Fk+KuPz8OHVUI/acCaaSTMLThlV/LK/Xp+8G0wlwjyrq+ZEBbS1SMuTj03H5EUXLjrbXMm 1QGr6RFp3Clsc7AQ== From: "tip-bot2 for Arnd Bergmann" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cleanups] x86/paravirt: Silence unused native_pv_lock_init() function warning Cc: Arnd Bergmann , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230803082619.1369127-7-arnd@kernel.org> References: <20230803082619.1369127-7-arnd@kernel.org> MIME-Version: 1.0 Message-ID: <169107835342.28540.9038195913134250351.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773228645662911097 X-GMAIL-MSGID: 1773228645662911097 The following commit has been merged into the x86/cleanups branch of tip: Commit-ID: ce0a1b608bfc709cf366f020b520310a3b3272c3 Gitweb: https://git.kernel.org/tip/ce0a1b608bfc709cf366f020b520310a3b3272c3 Author: Arnd Bergmann AuthorDate: Thu, 03 Aug 2023 10:26:18 +02:00 Committer: Borislav Petkov (AMD) CommitterDate: Thu, 03 Aug 2023 16:50:19 +02:00 x86/paravirt: Silence unused native_pv_lock_init() function warning The native_pv_lock_init() function is only used in SMP configurations and declared in asm/qspinlock.h which is not used in UP kernels, but the function is still defined for both, which causes a warning: arch/x86/kernel/paravirt.c:76:13: error: no previous prototype for 'native_pv_lock_init' [-Werror=missing-prototypes] Move the declaration to asm/paravirt.h so it is visible even with CONFIG_SMP but short-circuit the definition to turn it into an empty function. Signed-off-by: Arnd Bergmann Signed-off-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/20230803082619.1369127-7-arnd@kernel.org --- arch/x86/include/asm/paravirt.h | 7 +++++++ arch/x86/include/asm/qspinlock.h | 7 +------ arch/x86/kernel/paravirt.c | 3 ++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index b497786..6c8ff12 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__ */ @@ -778,6 +779,12 @@ extern void default_banner(void); #endif /* __ASSEMBLY__ */ #else /* CONFIG_PARAVIRT */ # define default_banner x86_init_noop + +#ifndef __ASSEMBLY__ +static inline void native_pv_lock_init(void) +{ +} +#endif #endif /* !CONFIG_PARAVIRT */ #ifndef __ASSEMBLY__ diff --git a/arch/x86/include/asm/qspinlock.h b/arch/x86/include/asm/qspinlock.h index d87451d..cde8357 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 ac10b46..32e94a3 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); }