From patchwork Mon Nov 14 11:43:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19745 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097890wru; Mon, 14 Nov 2022 03:48:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf5dD3cC2pYk0afJCtz/xj7HoHHkSeJ5UGHWgNYZFaNDbFZxrh3B/95KSyk1hO/S/yeJB6Z2 X-Received: by 2002:a17:906:a106:b0:78d:b371:16d4 with SMTP id t6-20020a170906a10600b0078db37116d4mr9549762ejy.434.1668426508169; Mon, 14 Nov 2022 03:48:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426508; cv=none; d=google.com; s=arc-20160816; b=xMfC1Ic1jqaY0VOKdNQEuYGh89t/jZsIJ+FVtI4SwqtFoEGC7IePVcx1DAv179fHyb fpggS/sYUA+4wpFPXTDZk07iGaMwfBvoNi5N9sfNhRbe4ddQgMZskFgqZZaqBWtMhTG5 umScDtlwEhOBKKdJPVa3t1sjdPgu3iIpBL/heJ9xOmSrPXTFL4Jz/NCe2FdygHV2TzCv UdVDjzub1bSzH9uQZ6ulFv4T1MlcCzTNXnoO8EdzmGvcpzHkEcctKjarYV5IJNENjUps qsacVdmGt/V1755iqZm/1lOpRaso4480Vo8vKPtmW0M/kxR/i7XK3rNUWjBg0nQb8rnq 7R1g== 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=um6Qx0md4y5BIyJRbUHKwZSXi/6078NVJZag8FazAcs=; b=KtKQPjl3LSWMUV5VkqPY6gi0hMUBOe1SrmWUa3U/xe4EM8flBWzu33NPEe1tppD+Yq w/5MvJkYAMBgv41RUHtqEn8sMPGIo5NdxkvtrZ1cgYWGxG8oq4OCI9BZz1VbQtm6weaY GZOkgvzK1CkU16Ko6IU/H5Q2FzuZeIZs5XGjZPFk6Hzs/kr+YxWksOpAG0QJ2HY37YSv QaV+3ZAkwO1Q+kBovsXTj9tcNeH8YaQJR0Ul5xy2iF8NuypMyLMv1Xl6aRRUqEk4TU/C bcslmPE5x76cQyUouguYDD0wMGa4HetObERbL5jLwc6N4wSMkQcdFWtD1gmyfRhQWWdL Uo9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rFanZoEr; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pg2-20020a170907204200b007adadff675fsi7013275ejb.313.2022.11.14.03.48.04; Mon, 14 Nov 2022 03:48:28 -0800 (PST) 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=rFanZoEr; 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 S236702AbiKNLpd (ORCPT + 99 others); Mon, 14 Nov 2022 06:45:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236643AbiKNLo4 (ORCPT ); Mon, 14 Nov 2022 06:44:56 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B97E222A3 for ; Mon, 14 Nov 2022 03:44:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C941AB80E7E for ; Mon, 14 Nov 2022 11:44:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B630CC433D7; Mon, 14 Nov 2022 11:44:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426277; bh=yzR3ph3tC/ZTtl87MRZiAK+HvN3pbQqI4zL7+OyT63c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rFanZoErjcqgPwNAvJt7PwJs/ly5KORJkrpyeHltMdaoMimDBEyFT7yEHJ7rV4opP yg23KdpMK1C/eVt+Es0jX4d1NodxSIPh/VcYY7/XL5rxjOWAwY7r53gPogJNYd8oUA A4mYwfcd7xiJtCzdQCkDg/CKVCr/iwREjxWIo+osGihbofraaSDpaDMi5+m3E9qpnu 3f/aG5tXJwmOb5j0HJj7hNM18pcA62C/8754bpiN3YNkUfGIyJiHkToYnYoBMlTns/ lkvcOxO9IOBBJlvHIASy1xSTGF/K7rVvisBz/cE8g74RytEow0P7t0qt5vDuYSw5cP zRiSVadxg1McQ== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Huang Rui , "Rafael J. Wysocki" , Viresh Kumar , x86@kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 17/46] amd, lto: Mark amd pmu and pstate functions as __visible_on_lto Date: Mon, 14 Nov 2022 12:43:15 +0100 Message-Id: <20221114114344.18650-18-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749471993906720073?= X-GMAIL-MSGID: =?utf-8?q?1749471993906720073?= From: Andi Kleen Symbols referenced from assembler (either directly or e.f. from DEFINE_STATIC_KEY()) need to be global and visible in gcc LTO because they could end up in a different object file than the assembler. This can lead to linker errors without this patch. So mark amd_pmu_test_overflow_topbit() and all amd pstate functions as __visible_on_lto. Also the pstate ones have to be renamed so that they are unique. [ml] fix amd_pmu_test_overflow_topbit() too [js] use __visible_on_lto Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: Mark Rutland Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Thomas Gleixner Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: Huang Rui Cc: "Rafael J. Wysocki" Cc: Viresh Kumar Cc: x86@kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- arch/x86/events/amd/core.c | 2 +- drivers/cpufreq/amd-pstate.c | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c index 8b70237c33f7..9dfdfd85b493 100644 --- a/arch/x86/events/amd/core.c +++ b/arch/x86/events/amd/core.c @@ -643,7 +643,7 @@ static inline void amd_pmu_ack_global_status(u64 status) wrmsrl(MSR_AMD64_PERF_CNTR_GLOBAL_STATUS_CLR, status); } -static bool amd_pmu_test_overflow_topbit(int idx) +__visible_on_lto bool amd_pmu_test_overflow_topbit(int idx) { u64 counter; diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index ace7d50cf2ac..d0b67a60191d 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -66,7 +66,7 @@ MODULE_PARM_DESC(shared_mem, static struct cpufreq_driver amd_pstate_driver; -static inline int pstate_enable(bool enable) +__visible_on_lto int do_amd_pstate_enable(bool enable) { return wrmsrl_safe(MSR_AMD_CPPC_ENABLE, enable); } @@ -84,14 +84,14 @@ static int cppc_enable(bool enable) return ret; } -DEFINE_STATIC_CALL(amd_pstate_enable, pstate_enable); +DEFINE_STATIC_CALL(amd_pstate_enable, do_amd_pstate_enable); static inline int amd_pstate_enable(bool enable) { return static_call(amd_pstate_enable)(enable); } -static int pstate_init_perf(struct amd_cpudata *cpudata) +__visible_on_lto int do_amd_pstate_init_perf(struct amd_cpudata *cpudata) { u64 cap1; u32 highest_perf; @@ -142,15 +142,16 @@ static int cppc_init_perf(struct amd_cpudata *cpudata) return 0; } -DEFINE_STATIC_CALL(amd_pstate_init_perf, pstate_init_perf); +DEFINE_STATIC_CALL(amd_pstate_init_perf, do_amd_pstate_init_perf); static inline int amd_pstate_init_perf(struct amd_cpudata *cpudata) { return static_call(amd_pstate_init_perf)(cpudata); } -static void pstate_update_perf(struct amd_cpudata *cpudata, u32 min_perf, - u32 des_perf, u32 max_perf, bool fast_switch) +__visible_on_lto void do_amd_pstate_update_perf(struct amd_cpudata *cpudata, + u32 min_perf, u32 des_perf, u32 max_perf, + bool fast_switch) { if (fast_switch) wrmsrl(MSR_AMD_CPPC_REQ, READ_ONCE(cpudata->cppc_req_cached)); @@ -172,7 +173,7 @@ static void cppc_update_perf(struct amd_cpudata *cpudata, cppc_set_perf(cpudata->cpu, &perf_ctrls); } -DEFINE_STATIC_CALL(amd_pstate_update_perf, pstate_update_perf); +DEFINE_STATIC_CALL(amd_pstate_update_perf, do_amd_pstate_update_perf); static inline void amd_pstate_update_perf(struct amd_cpudata *cpudata, u32 min_perf, u32 des_perf,