From patchwork Wed Aug 2 10:21:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 129790 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp397462vqx; Wed, 2 Aug 2023 04:55:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlFaA3FxQVjPBNQLqzD1XYSbcRDL/3B6PjsF12XrzunZf23xxu7TkX4SqsvN+x72Jtzm5A44 X-Received: by 2002:aa7:d1d1:0:b0:520:f5dd:3335 with SMTP id g17-20020aa7d1d1000000b00520f5dd3335mr4439436edp.41.1690977314536; Wed, 02 Aug 2023 04:55:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690977314; cv=none; d=google.com; s=arc-20160816; b=JL3XtggNQ8sgKrsfGKxdttvzDlHKI0F0MePRPf/RxRX6jubpzlWLjABLx9XsFSzb/i aIfZaoDlS0sMnFneqXp5QCCAIOFnFEo2NwZTdUUjnv7BlmzFcvcpUD0C+jznHRKkdePd +ckLwo6K2oB5yvVe9VKpDXDldnL66vKWjSDNs2pyK7HR8MRD0q9ij0ipDzEDYamq45pn sYeOEBlDCDRjB0ckNYwyoo75aAWRkCTj+zYke7o8Me/Yn7T8VC2ALndz+epbTL2RR1Bm m2oQTcY5iigMVvI4toTap/bpQdl4i0eWbgPe5QzdYQISDnurVkDUK2Y9mHiBa6HOoGWN sKEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=2RANHxmSCQq3gd8prDSNXS5TE/ZWoRk9LvjezfySwEw=; fh=O9JPtEgoXN20WvvffwC9vht4C9mlV4cjm0SKbEbqoG0=; b=KrCZaSV61Y6szt86u/hiRist4dkP+vZtgEgWFXPaYjGkVO7FU4PaHcrzxnYRREibUd i4KJEpHj1Ee6YHJs3awNFnjezEKn+kLhxSmUbdM/QnG0U12sh4CjM1/GnTLcbeFCSdhp AMXo1op5JhK6t/Rps4QE+nzf29zNad1hrKTByBb4d7aYZoQpsOkXd853ee16n4J7SwZy LbAiXYdPUHcMk0aAlCKBGrQ2Gcw0+0zh1+HBrqrJFTP4FLf8MQ965EV/37+YcEiXqcFN O3r7IeffEI8smEH6kuP8mqOLsXKPi/9n9gDym0WCrh68yrVhF7sHJTl0aDxYc7UxTUFU csew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=g7HOQDFN; dkim=neutral (no key) header.i=@linutronix.de header.b=+EzvJ0bf; 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 b10-20020aa7df8a000000b005228264a70asi1510075edy.43.2023.08.02.04.54.50; Wed, 02 Aug 2023 04:55:14 -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=g7HOQDFN; dkim=neutral (no key) header.i=@linutronix.de header.b=+EzvJ0bf; 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 S232779AbjHBKWN (ORCPT + 99 others); Wed, 2 Aug 2023 06:22:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233834AbjHBKVt (ORCPT ); Wed, 2 Aug 2023 06:21:49 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AC732D71 for ; Wed, 2 Aug 2023 03:21:17 -0700 (PDT) Message-ID: <20230802101933.339179807@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1690971675; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=2RANHxmSCQq3gd8prDSNXS5TE/ZWoRk9LvjezfySwEw=; b=g7HOQDFNQt9uVSg3NUYy4wrHHlDJXps4lztAMLeB0Knh5vfM+Dk2mK/YE/LN+XB9UOy5Do oQDIxrxwl5kYvOybYD2Fp+fjR09T60uuzy82wSsRgapbaHSytGeNJE4vWl8YASLoVUtXWd 7KhTubo+bVa/NQ4Pf5XH06xUHQErQ9BcShLzs9nyuChyhW9nJprme7ryeIz9ZpP/etH19r k9vLrNYjTyatIrlpXq4nNzi2qRm81YKLZR1vUwv1vMIvD76jBYIRzmSfdwYaw5Q0cvCU+o wGdcHZilnQ/GHNPGbOTS/PTT5AKzfSa7dpu0+FHbkGdRSeyjHonsu9SuvQl83w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1690971675; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=2RANHxmSCQq3gd8prDSNXS5TE/ZWoRk9LvjezfySwEw=; b=+EzvJ0bfOjrvrad2Ul5NKUd5SDErYnJKiVskoAMRV2SqsVBX78qy3vzxT7hez/EBc2Qref shMpCcF2sRm21xBg== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Tom Lendacky , Andrew Cooper , Arjan van de Ven , Huang Rui , Juergen Gross , Dimitri Sivanich , Michael Kelley , Wei Liu Subject: [patch V3 11/40] x86/cpu: Move logical package and die IDs into topology info References: <20230802101635.459108805@linutronix.de> MIME-Version: 1.0 Date: Wed, 2 Aug 2023 12:21:15 +0200 (CEST) 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,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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773118228424915104 X-GMAIL-MSGID: 1773118228424915104 Yet another topology related data pair. Rename logical_proc_id to logical_pkg_id so it fits the common naming conventions. No functional change. Signed-off-by: Thomas Gleixner --- Documentation/arch/x86/topology.rst | 2 +- arch/x86/events/intel/uncore.c | 2 +- arch/x86/include/asm/processor.h | 8 ++++---- arch/x86/include/asm/topology.h | 4 ++-- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/smpboot.c | 8 ++++---- 6 files changed, 13 insertions(+), 13 deletions(-) --- a/Documentation/arch/x86/topology.rst +++ b/Documentation/arch/x86/topology.rst @@ -67,7 +67,7 @@ AMD nomenclature for package is 'Node'. Modern systems use this value for the socket. There may be multiple packages within a socket. This value may differ from topo.die_id. - - cpuinfo_x86.logical_proc_id: + - cpuinfo_x86.topo.logical_pkg_id: The logical ID of the package. As we do not trust BIOSes to enumerate the packages in a consistent way, we introduced the concept of logical package --- a/arch/x86/events/intel/uncore.c +++ b/arch/x86/events/intel/uncore.c @@ -74,7 +74,7 @@ int uncore_device_to_die(struct pci_dev struct cpuinfo_x86 *c = &cpu_data(cpu); if (c->initialized && cpu_to_node(cpu) == node) - return c->logical_die_id; + return c->topo.logical_die_id; } return -1; --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -94,6 +94,10 @@ struct cpuinfo_topology { // Core ID relative to the package u32 core_id; + + // Logical ID mappings + u32 logical_pkg_id; + u32 logical_die_id; }; struct cpuinfo_x86 { @@ -144,10 +148,6 @@ struct cpuinfo_x86 { u16 x86_clflush_size; /* number of cores as seen by the OS: */ u16 booted_cores; - /* Logical processor id: */ - u16 logical_proc_id; - /* Core id: */ - u16 logical_die_id; /* Index into per_cpu list: */ u16 cpu_index; /* Is SMT active on this core? */ --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h @@ -105,9 +105,9 @@ static inline void setup_node_to_cpumask extern const struct cpumask *cpu_coregroup_mask(int cpu); extern const struct cpumask *cpu_clustergroup_mask(int cpu); -#define topology_logical_package_id(cpu) (cpu_data(cpu).logical_proc_id) +#define topology_logical_package_id(cpu) (cpu_data(cpu).topo.logical_pkg_id) #define topology_physical_package_id(cpu) (cpu_data(cpu).topo.pkg_id) -#define topology_logical_die_id(cpu) (cpu_data(cpu).logical_die_id) +#define topology_logical_die_id(cpu) (cpu_data(cpu).topo.logical_die_id) #define topology_die_id(cpu) (cpu_data(cpu).topo.die_id) #define topology_core_id(cpu) (cpu_data(cpu).topo.core_id) #define topology_ppin(cpu) (cpu_data(cpu).ppin) --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1770,7 +1770,7 @@ static void validate_apic_and_package_id BUG_ON(topology_update_package_map(c->topo.pkg_id, cpu)); BUG_ON(topology_update_die_map(c->topo.die_id, cpu)); #else - c->logical_proc_id = 0; + c->topo.logical_pkg_id = 0; #endif } --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -348,7 +348,7 @@ int topology_phys_to_logical_pkg(unsigne struct cpuinfo_x86 *c = &cpu_data(cpu); if (c->initialized && c->topo.pkg_id == phys_pkg) - return c->logical_proc_id; + return c->topo.logical_pkg_id; } return -1; } @@ -370,7 +370,7 @@ static int topology_phys_to_logical_die( if (c->initialized && c->topo.die_id == die_id && c->topo.pkg_id == proc_id) - return c->logical_die_id; + return c->topo.logical_die_id; } return -1; } @@ -395,7 +395,7 @@ int topology_update_package_map(unsigned cpu, pkg, new); } found: - cpu_data(cpu).logical_proc_id = new; + cpu_data(cpu).topo.logical_pkg_id = new; return 0; } /** @@ -418,7 +418,7 @@ int topology_update_die_map(unsigned int cpu, die, new); } found: - cpu_data(cpu).logical_die_id = new; + cpu_data(cpu).topo.logical_die_id = new; return 0; }