Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1976696rwo; Thu, 3 Aug 2023 02:55:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlEevvPbn04uGLSwB24gjt9VwqUu560X5MGmpADUwy9LkRjz5YWmPnCJs7DD8E8l3BBIXv5L X-Received: by 2002:a17:902:a3ce:b0:1bc:16bc:9f66 with SMTP id q14-20020a170902a3ce00b001bc16bc9f66mr10079940plb.12.1691056539567; Thu, 03 Aug 2023 02:55:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691056539; cv=none; d=google.com; s=arc-20160816; b=rXAoPphmQ/8MNtPeRKef1TGnDand+10xPb+kbmg4g4Gp2Zv/6rhu52kSYMnsMxFE4E D8EmEqmBQQFqaQVcqcBHb13eNGeBuzB95BRUKvEZIQswDBcnguvwUFQ2Rvvar9zuAFlD EqnsfSKafj9FiRk7WC2qZGjQydqz5ELvOUb0RT/fSxWe5wISyjT2qq+FAYg9WGDqQQcd BIwchdsoo09n4ltxO+S+++zWO2xUQwnZkuIOP/9Fot9teNWQNf8BJXwpXbaxKQy7FBLn a/gba6coumxwFC96ub7hn3Fap7Qd60+ux7MPcO08xoLdyMato34gp88EVausO1ZWaj+U 1Q+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oDWgVFshetr//06JCWdIzwUJAY1xIzVvBvdnw57Lqo0=; fh=3/4MDyH/knLuYntRya8npu0ASABjtXXSBg4oxzp1prM=; b=b+FW+aPCmOE6BnDReTy87+k1Wk+/HyfIk3DsvfpB9c44rvsvBl85GMtPHEErzD4gj8 Wg5yRCY5lvxwSxPU/Y75qmUV//oNSrmhQuL0cUyPha6sdrvodya7FIJwSBZrvICCHBaT 4qNg/xh4cv5h9fJkC5QGvwTmIRcsl9J0yYcd6XPObIoPNuPQwwEzMhX346QsEJopfrl8 pvaaQ0+12uwZKSg+wkkKnxQN4+ArPQVXBwDZzT1NrR7UN/8XQ/LMwXaj3qvA5WFe5ITh aR4M11F3NfdvWCsvUh4stXAlt5E+aKTF3K+g9JESkG899Notw0Gv2w+mv0syhAMQ+Y7a Dvbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=H6tC89az; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i14-20020a17090332ce00b001b53dfb85c4si4534514plr.606.2023.08.03.02.55.26; Thu, 03 Aug 2023 02:55:39 -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=@kernel.org header.s=k20201202 header.b=H6tC89az; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234649AbjHCI36 (ORCPT + 99 others); Thu, 3 Aug 2023 04:29:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234395AbjHCI2u (ORCPT ); Thu, 3 Aug 2023 04:28:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 883D64C0D for ; Thu, 3 Aug 2023 01:26:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8126B61C4B for ; Thu, 3 Aug 2023 08:26:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F554C43391; Thu, 3 Aug 2023 08:26:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691051197; bh=ePyKU1YMopmwzc/Oe51J6v27McxWIDUV7ds7IsNZfvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H6tC89azknyzgPThJCu65qkNSwtEz1ekEYAX3ftbBQPgorFF3eBj11bLO8pX8H5Jf CGXvde0vej1G0RlhG0HGIxWKFthslelFSC7Zi4jowqvePOWcrRpFp7zEI3h+p4YdqN ptXZGP2rW/W4uK8dbwrpSU1g9wbWqjDapv0lrlBvjW57vsipb/IsmgSIhWc9Dja52y Rgp3zReGzWZRgIWjE+852ndbVuLRHRnTPuleNTwDPSNEV9XGQ71qUiPaG6hL/8hxm7 ymY0aWaVESezPTTOuY+dWkJucxZFAQqst0VG7bJ1ekjLNRYzEH8ZgiOKeplNs23xYE wOVHNhUJK73dg== From: Arnd Bergmann To: Borislav Petkov Cc: Thomas Gleixner , Ingo Molnar , Dave Hansen , linux-kernel@vger.kernel.org, x86@kernel.org, Arnd Bergmann Subject: [PATCH v3 6/7] x86: paravirt: shut up unused native_pv_lock_init() function warning Date: Thu, 3 Aug 2023 10:26:18 +0200 Message-Id: <20230803082619.1369127-7-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230803082619.1369127-1-arnd@kernel.org> References: <20230803082619.1369127-1-arnd@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, 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 From: Arnd Bergmann 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 --- v3: new patch to avoid adding another #ifdef to paravirt.c --- 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 b49778664d2be..6c8ff12140aea 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 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); } -- 2.39.2