From patchwork Mon Nov 14 11:43:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19743 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097829wru; Mon, 14 Nov 2022 03:48:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Xh9UWz+r4k8yP5UK474/qECoRrVYI60Z6aCT5QdGSLw808zWachAjzoylGdm4Qr2ttbV9 X-Received: by 2002:a50:baab:0:b0:461:e2ab:912d with SMTP id x40-20020a50baab000000b00461e2ab912dmr11126741ede.93.1668426499615; Mon, 14 Nov 2022 03:48:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426499; cv=none; d=google.com; s=arc-20160816; b=LDVhkxgveFpA1S8+PXiGkEoKycG3ZD35r7wJ3lUCyC6DJAruKTWKa6FVFjRmJL8O/Q o44LBdzp4MyKai9ohPEiYz/0zd76E3Q/wGoVkwMJTUmwDdU7Oeku4EfsHWzgBCnsDsGC BL4kbrb54UrvVhSgaZghFN1/3n+lXn9Ca1IsjbW38g7DigcrQAQFHbHp26m68LKgQvqc jvAgv1QOl3tA0N5bfPj6stt8hkbTGw2/2blgbGVJf34AgJamEQxo0Z/8UcsWnexoWhDg zBTiaM6571RTUz/ImiGlqJyk85rXOEtZRkO0Xe9PRsLbVFFrvbuDxAHgDBv6y+gVdvsy oRVg== 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=vS5VEAYciYx9mTihRI7luLtHs8g4ANdcrOvk0xhwAeY=; b=ymPwhglscOLerFH92hI3u8HpG8f88bDS8B7njIP5Qc5KA2Al79cSggytYZG8S89BTr q8u7C69Y2XaM93h96vM5o4+Civ8gk84lKXHjQSzHE9Nqq6YQ3Vf7VQy+AX0Sl+oE5THb BUF+vUi+mf4Er2ZnJQ30I44x98iMN9tJE/baysAPoBvtOGMry/5V4Zn9qF9H6YQffrgU oEiYb1wHRbtDhyXx1ZON4mbk7hzVE9RUgkMUMWjBtFhGZyXvyrFGvvhdpU3H6HpdkdsT Pm5sIL75jzHQRD+On6/bOJHgR1piy2njDxd6oUzUMWKtJZHzRzXT6EOwnxIxWes4DiSX SqqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="cDe/BWVa"; 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 g10-20020a056402090a00b00461b2c3c4acsi8048766edz.515.2022.11.14.03.47.56; Mon, 14 Nov 2022 03:48:19 -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="cDe/BWVa"; 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 S236564AbiKNLpa (ORCPT + 99 others); Mon, 14 Nov 2022 06:45:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236690AbiKNLot (ORCPT ); Mon, 14 Nov 2022 06:44:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 156E422508 for ; Mon, 14 Nov 2022 03:44:35 -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 897A4B80E73 for ; Mon, 14 Nov 2022 11:44:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16C86C433C1; Mon, 14 Nov 2022 11:44:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426273; bh=ApTSBGC/5zyM3eDvn776xtW4dxkstz2N0HPAS1gCaY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cDe/BWVa7LVUh1wr2YKoKMSQ+DOJlndaHrRFQwyP+4dg9OY5/w6swCuGR3SnvFnFi BYfRYHeK0ukY7PG2tQPtB1s9+EfesgR5S3X9dHy+MTPim1IlxDX0GrSaNFjszroBsM TrLvirzkUBIDy00BvaiFBVSsBdqwYsHhG+x17OwNte7Bb9NTv2dYhU4VLk9oJQwh+N aAZMwV7jrT0HcL+9YZIANQ9pqCm3KzAJJ391EqaSh4Mh0IhTQR8YnAPoXkUzTUs0TW biGP4UaRDZWyvnfkK7Bq6fRa8iPc/MpDnqxBESFp3e7EYS458CvD48vTVoBZHELnde 3Mswaewh+4pPg== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Martin Liska , Jiri Slaby Subject: [PATCH 16/46] x86, lto: Mark gdt_page and native_sched_clock() as __visible Date: Mon, 14 Nov 2022 12:43:14 +0100 Message-Id: <20221114114344.18650-17-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?1749471985496950759?= X-GMAIL-MSGID: =?utf-8?q?1749471985496950759?= 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 gdt_page and native_sched_clock() as __visible. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: Cc: "H. Peter Anvin" Cc: Martin Liska Signed-off-by: Jiri Slaby --- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/tsc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 3e508f239098..5417a8fd7a45 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -201,7 +201,7 @@ static const struct cpu_dev default_cpu = { static const struct cpu_dev *this_cpu = &default_cpu; -DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = { +__visible DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = { #ifdef CONFIG_X86_64 /* * We need valid kernel segments for data and code in long mode too diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index cafacb2e58cc..df1589482662 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -215,7 +215,7 @@ static void __init cyc2ns_init_secondary_cpus(void) /* * Scheduler clock - returns current time in nanosec units. */ -u64 native_sched_clock(void) +__visible u64 native_sched_clock(void) { if (static_branch_likely(&__use_tsc)) { u64 tsc_now = rdtsc();