From patchwork Mon Aug 14 08:53:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 13596 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp2618434vqi; Mon, 14 Aug 2023 02:16:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE3XgOZFsR2J4hgPDZEiVqA0Ht/dX1t2wPtSmelD+w+Pua1a4QO+oOWnho3jrMAfR9fBEFr X-Received: by 2002:a17:90a:fa01:b0:26b:62f7:e2d4 with SMTP id cm1-20020a17090afa0100b0026b62f7e2d4mr649558pjb.24.1692004572151; Mon, 14 Aug 2023 02:16:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692004572; cv=none; d=google.com; s=arc-20160816; b=CpmL7E1jU1gnZ98z7ZbfGb/6tCamH4l5iBYrtBieHEfp0yUHE/5pBbJW1sODm6/asW hbyPny9QiB40rBbtrR/KHHBSqSP73h0FekogzJSQSrYJvS/scwG9PUookhBqIB4FsJkU pjvE8RoKKSlOudlIT5TfEb6QrKqHNmV4yTFkkqf8AiXrorSa8AlF9w2sLoTYsNjogtof G6KhtyMhifsV6o+T6WUfWqxRV9ytbTS5qZiQarpD9E88p2lzKDbNJx/RvA+0Y/9HmnjM /h+Zdfdk9tkaeLktwR7OziW5NlK/C6iV/8I59iVGWe9bvFoeisP5pK6XMc5oSizFnvOj MniQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:subject:cc:to:from:dkim-signature :dkim-signature:message-id; bh=RrWoeKrZ/NO0qApWBihUZhOqJGZfHQhd3kYlrDwyiJg=; fh=vwR6i3GoO+RKkFdkWQ4T8y7ucRLRVxqvKA6inZzIW/U=; b=ixY64jUnOXMhRpc92UpDCuaSRnvbkUqLdZe3hqOpLPcrfxgCCmPcNKYjH4Bx/6Uq1j kfFXp7jy1rmYGdnwD2S48w+aXi58jg84ei4h8kCDI340uLcXy2/kJryg4qGa79lvOJdk n/YM+YiP+UYKgQS9C+gwGMrPY6Eyzk5vwecHdtBF4FcBojCGZRttD/6HImX93C6A2Cw+ uLpUg4GuU8IRCzCKkfgp+dTlP56ZZR1B4rtyZJpAwVGSN1YtErDUxkJjXVJsf2SQQK95 euldjuw5PsrN29RuOQUAwmd5rp6+sbMarrxQODi8vnz8BkqCU7hIGc5jQfHINe3iJakl 92oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KxYI4Em3; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=8tMot9Xm; 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 v1-20020a170902b7c100b001bd949bcd75si7919641plz.575.2023.08.14.02.15.56; Mon, 14 Aug 2023 02:16:12 -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=KxYI4Em3; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=8tMot9Xm; 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 S234362AbjHNIxl (ORCPT + 99 others); Mon, 14 Aug 2023 04:53:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234326AbjHNIxh (ORCPT ); Mon, 14 Aug 2023 04:53:37 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94B1910B for ; Mon, 14 Aug 2023 01:53:36 -0700 (PDT) Message-ID: <20230814085006.593997112@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1692003214; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=RrWoeKrZ/NO0qApWBihUZhOqJGZfHQhd3kYlrDwyiJg=; b=KxYI4Em3Y21e8Tp6f2rNllwuZ8CouDtqRgQCNTUKY3U5FaHybqLrRwMFNfgcTz3XIR0uyq c6i8y0XJbeRvqmY1FexcDLED4bi7zL615EbafX35C7tmLpHnSVqanIMJlBqNO8HjbxJer6 N4gDu8+wsG1HzkzAdVtxNT+DWly0p3nrkLSKYh2zYA8wnxp2Sv6wcyXBUscKrOSo05dCrr 6GElT7iYVHKfAA5qrH8dYSXgZM6YLzuKCQ3r6jn8G24TyUwDsrOMqf8O+auHZg8oA4V67X 89j6ZK9T2Cru0Pu1+27gnULssrC2vhtR5iJJXSo9Jlz9sBWwea4bB1p4rdYMFw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1692003214; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=RrWoeKrZ/NO0qApWBihUZhOqJGZfHQhd3kYlrDwyiJg=; b=8tMot9Xm11qKar12ufXnk405cW/a8RUrPU3ALSMu095K/7LAbc1d88TL3yz6atUy7YrrW9 hj7cH+/K9OhbGPAA== 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 , Pu Wen , Qiuxu Zhuo Subject: [patch V4 00/41] x86/cpu: Rework the topology evaluation Date: Mon, 14 Aug 2023 10:53:33 +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 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: 1774195386037804261 X-GMAIL-MSGID: 1774195386037804261 Hi! This is the follow up to V3: https://lore.kernel.org/lkml/20230802101635.459108805@linutronix.de which addresses the review feedback. TLDR: This reworks the way how topology information is evaluated via CPUID in preparation for a larger topology management overhaul to address shortcomings of the current code vs. hybrid systems and systems which make use of the extended topology domains in leaf 0x1f. Aside of that it's an overdue spring cleaning to get rid of accumulated layers of duct tape and haywire. What changed vs. V3: - Added the Hygon fix from Pu Wen and adjusted the new code accordingly - Fixed the off by one in the AMD parser for real - Michael - Reworked the unknown domain type handling in the 0xb/01f parser - Rui - Made core ID package relative - Rui - Folded the missing u32 conversions - Qiuxu - Folded the fake_topology() fixup from the full topology series - Small cleanups and enhancements - Picked up Tested-by tags The series is based on the the APIC cleanup series in tip: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/apic and also available on top of that from git: git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git topo-cpuid-v4 Thanks, tglx Tested-by: Peter Zijlstra (Intel) Acked-by: Peter Zijlstra (Intel) --- arch/x86/kernel/cpu/topology.c | 168 ------------------- b/Documentation/arch/x86/topology.rst | 12 - b/arch/x86/events/amd/core.c | 2 b/arch/x86/events/amd/uncore.c | 2 b/arch/x86/events/intel/uncore.c | 2 b/arch/x86/hyperv/hv_vtl.c | 2 b/arch/x86/include/asm/apic.h | 38 +--- b/arch/x86/include/asm/cacheinfo.h | 3 b/arch/x86/include/asm/cpuid.h | 36 ++++ b/arch/x86/include/asm/mpspec.h | 2 b/arch/x86/include/asm/processor.h | 60 ++++-- b/arch/x86/include/asm/smp.h | 4 b/arch/x86/include/asm/topology.h | 51 +++++ b/arch/x86/include/asm/x86_init.h | 2 b/arch/x86/kernel/acpi/boot.c | 4 b/arch/x86/kernel/amd_nb.c | 8 b/arch/x86/kernel/apic/apic.c | 29 ++- b/arch/x86/kernel/apic/apic_common.c | 4 b/arch/x86/kernel/apic/apic_flat_64.c | 13 - b/arch/x86/kernel/apic/apic_noop.c | 9 - b/arch/x86/kernel/apic/apic_numachip.c | 21 -- b/arch/x86/kernel/apic/bigsmp_32.c | 10 - b/arch/x86/kernel/apic/ipi.c | 5 b/arch/x86/kernel/apic/local.h | 6 b/arch/x86/kernel/apic/probe_32.c | 10 - b/arch/x86/kernel/apic/x2apic_cluster.c | 1 b/arch/x86/kernel/apic/x2apic_phys.c | 10 - b/arch/x86/kernel/apic/x2apic_uv_x.c | 67 +------ b/arch/x86/kernel/cpu/Makefile | 5 b/arch/x86/kernel/cpu/amd.c | 156 ------------------ b/arch/x86/kernel/cpu/cacheinfo.c | 51 ++--- b/arch/x86/kernel/cpu/centaur.c | 4 b/arch/x86/kernel/cpu/common.c | 111 +----------- b/arch/x86/kernel/cpu/cpu.h | 14 + b/arch/x86/kernel/cpu/debugfs.c | 97 +++++++++++ b/arch/x86/kernel/cpu/hygon.c | 135 --------------- b/arch/x86/kernel/cpu/intel.c | 38 ---- b/arch/x86/kernel/cpu/mce/amd.c | 4 b/arch/x86/kernel/cpu/mce/apei.c | 4 b/arch/x86/kernel/cpu/mce/core.c | 4 b/arch/x86/kernel/cpu/mce/inject.c | 7 b/arch/x86/kernel/cpu/proc.c | 8 b/arch/x86/kernel/cpu/topology.h | 56 ++++++ b/arch/x86/kernel/cpu/topology_amd.c | 182 +++++++++++++++++++++ b/arch/x86/kernel/cpu/topology_common.c | 241 ++++++++++++++++++++++++++++ b/arch/x86/kernel/cpu/topology_ext.c | 132 +++++++++++++++ b/arch/x86/kernel/cpu/zhaoxin.c | 18 -- b/arch/x86/kernel/kvm.c | 6 b/arch/x86/kernel/sev.c | 2 b/arch/x86/kernel/smpboot.c | 97 ++++++----- b/arch/x86/kernel/vsmp_64.c | 13 - b/arch/x86/mm/amdtopology.c | 35 +--- b/arch/x86/mm/numa.c | 4 b/arch/x86/xen/apic.c | 14 - b/arch/x86/xen/smp_pv.c | 3 b/drivers/edac/amd64_edac.c | 4 b/drivers/edac/mce_amd.c | 4 b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 2 b/drivers/hwmon/fam15h_power.c | 7 b/drivers/scsi/lpfc/lpfc_init.c | 8 b/drivers/virt/acrn/hsm.c | 2 b/kernel/cpu.c | 16 + 62 files changed, 1095 insertions(+), 970 deletions(-)