Message ID | 20230802101635.459108805@linutronix.de |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp359074vqx; Wed, 2 Aug 2023 03:39:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlH2jvOxk8A3CJEp8dp5DfyX0AaWmFwRZ23FsDrdgXJl765owfoKRwh7I3nFBzjBbAaecf/Q X-Received: by 2002:a17:907:2c48:b0:99b:f554:1f1c with SMTP id hf8-20020a1709072c4800b0099bf5541f1cmr4377607ejc.14.1690972791157; Wed, 02 Aug 2023 03:39:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690972791; cv=none; d=google.com; s=arc-20160816; b=tZ1zr/CPTOYBn+8jweriICLNIXmO0ES35nxYR0XukU1ft/jDXbUg5QPVPHKpERFNom blftNVxddRvtFff/hPY6eYmBlQGs16O38p+5gYSOliEzj65EpNj8auJucJjzLhUT7ygb tzdf28glLvW1X63kwoqM4OLe7su5e8UZfvw0Lg3TNtZIEzP47zxXn1W2loohp0fpWKQ2 cK+dNL17X8uIBkQtlYTPSDm2OAP2KOz7caHUgfJNes2u+IDtOVZuoksOvdtZj4imLN8V QJaBVqdlFze6ePZCZ6A3xS7yIgnZ6/njNA3aj04lN/p2VDf8aXPhc+pP0Z+XVpMwxphC Tm2w== 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=GXI1rxtTlDn076yBDU5q43lJu832PeBcBNlVRoAlR7A=; fh=O9JPtEgoXN20WvvffwC9vht4C9mlV4cjm0SKbEbqoG0=; b=FcPO51mIq1tXHsv5iPQBr5N0+DmxhPtl9q3sH1wZxeGyrx83S122Ai/XyA7+6cnXK3 sPDRo8855OIjro6owzLg8gYc7pTdXhsJqTaGkk4tZVgUKUjoCzJKTMj6z47F+1iXzM/J gC4aeaTkXnz7Ut2qnyPGGr7ejKsl0fB84BB8TTMTEvVrgUDGffaX136vNLAVQq8uPbAU thuLbEgUsE21sDcCchRuGpIy/kDqNbFV15vQhETr3jgjJPo3QgQx9LwleA4q7vBh5V+o mViZOxKgTzrOvv3nOaze9uU4ESn2N0ro1TrOFuMP65+ATq9/xEfwhCu03UCtspJbe0Wd o4rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=lkvb9WpT; dkim=neutral (no key) header.i=@linutronix.de; 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 la14-20020a170906ad8e00b0099364d9f0e5si11499480ejb.485.2023.08.02.03.39.27; Wed, 02 Aug 2023 03:39:51 -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=lkvb9WpT; dkim=neutral (no key) header.i=@linutronix.de; 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 S231894AbjHBKVD (ORCPT <rfc822;maxi.paulin@gmail.com> + 99 others); Wed, 2 Aug 2023 06:21:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231860AbjHBKVB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 2 Aug 2023 06:21:01 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CD2D2137 for <linux-kernel@vger.kernel.org>; Wed, 2 Aug 2023 03:21:00 -0700 (PDT) Message-ID: <20230802101635.459108805@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1690971658; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=GXI1rxtTlDn076yBDU5q43lJu832PeBcBNlVRoAlR7A=; b=lkvb9WpTp3m9eviLXL1u0dyNvIY/VHkDhRcFWa0onoLAD6TLQ64Vgewq59KzalceZbYqTV Vm+BmoSYUbFzmr6ot1Dh0zdBc144BSo7stXPxHJkRDBNz4+kxg7ItzC+LkK2vX9rS+ynDt sHV/cIzt8Z+RDW9P9G+tOtGOs+HWFp48UtQ9Vp8ua7KqCAkxOZ2OnvRCEMhG1bNYywUG6i JCnlMVKRFyumqY+t3KPPSr06QYIggFFBnYZjRLcYIIKLP9nMZCuLmBdsSJnrHGdKjj8P0j 38bBiN9a6M+wIpOH5ZNa6Hy5ECF/daZ0UUz27r4MLXTCwnKjk3dpkCTxifOHVg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1690971658; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=GXI1rxtTlDn076yBDU5q43lJu832PeBcBNlVRoAlR7A=; b=C/tX3hJTvJdglNVY3bXTpVGy9bEiNQrATUdzsnMgM46/ecyP9NQ/KaFHJEDSpybHR+ZgxO W+jBETQiHTwR98Cg== From: Thomas Gleixner <tglx@linutronix.de> To: LKML <linux-kernel@vger.kernel.org> Cc: x86@kernel.org, Tom Lendacky <thomas.lendacky@amd.com>, Andrew Cooper <andrew.cooper3@citrix.com>, Arjan van de Ven <arjan@linux.intel.com>, Huang Rui <ray.huang@amd.com>, Juergen Gross <jgross@suse.com>, Dimitri Sivanich <dimitri.sivanich@hpe.com>, Michael Kelley <mikelley@microsoft.com>, Wei Liu <wei.liu@kernel.org> Subject: [patch V3 00/40] x86/cpu: Rework the topology evaluation Date: Wed, 2 Aug 2023 12:20:57 +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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773113485387843279 X-GMAIL-MSGID: 1773113485387843279 |
Series |
x86/cpu: Rework the topology evaluation
|
|
Message
Thomas Gleixner
Aug. 2, 2023, 10:20 a.m. UTC
Hi! This is the follow up to V2: https://lore.kernel.org/lkml/20230728105650.565799744@linutronix.de which addresses the review feedback and some fallout reported on and off-list. 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. V2: - Decoded and fixed the fallout vs. XEN/PV reported by Juergen. Thanks to Juergen for the remote hand debugging sessions! That's addressed in the first two new patches in this series. Summary: XEN/PV booted by pure chance since the addition of SMT control 5 years ago. - Fixed the off by one in the AMD parser which was debugged by Michael - Addressed review comments from various people As discussed in: https://lore.kernel.org/lkml/BYAPR21MB16889FD224344B1B28BE22A1D705A@BYAPR21MB1688.namprd21.prod.outlook.com .... https://lore.kernel.org/lkml/87r0omjt8c.ffs@tglx this series unfortunately brings the Hyper-V BIOS inconsistency into effect, which results in a slight performance impact. The L3 association which "worked" so far by exploiting the inconsistency of the Linux topology code is not longer supportable as we really need to get the actual short comings of our topology management addressed in a consistent way. The series is based on V3 of the APIC cleanup series: https://lore.kernel.org/lkml/20230801103042.936020332@linutronix.de and also available on top of that from git: git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git topo-cpuid-v3 Thanks, tglx --- 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 | 32 +-- 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 | 25 +- 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/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 | 133 --------------- 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 | 51 +++++ b/arch/x86/kernel/cpu/topology_amd.c | 179 ++++++++++++++++++++ b/arch/x86/kernel/cpu/topology_common.c | 240 ++++++++++++++++++++++++++++ b/arch/x86/kernel/cpu/topology_ext.c | 136 +++++++++++++++ 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 | 6 61 files changed, 1077 insertions(+), 956 deletions(-)
Comments
On 02.08.23 12:20, Thomas Gleixner wrote: > Hi! > > This is the follow up to V2: > > https://lore.kernel.org/lkml/20230728105650.565799744@linutronix.de > > which addresses the review feedback and some fallout reported on and > off-list. > > 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. V2: > > - Decoded and fixed the fallout vs. XEN/PV reported by Juergen. Thanks to > Juergen for the remote hand debugging sessions! > > That's addressed in the first two new patches in this series. Summary: > XEN/PV booted by pure chance since the addition of SMT control 5 years > ago. > > - Fixed the off by one in the AMD parser which was debugged by Michael > > - Addressed review comments from various people > > As discussed in: > > https://lore.kernel.org/lkml/BYAPR21MB16889FD224344B1B28BE22A1D705A@BYAPR21MB1688.namprd21.prod.outlook.com > .... > https://lore.kernel.org/lkml/87r0omjt8c.ffs@tglx > > this series unfortunately brings the Hyper-V BIOS inconsistency into > effect, which results in a slight performance impact. The L3 association > which "worked" so far by exploiting the inconsistency of the Linux topology > code is not longer supportable as we really need to get the actual short > comings of our topology management addressed in a consistent way. > > The series is based on V3 of the APIC cleanup series: > > https://lore.kernel.org/lkml/20230801103042.936020332@linutronix.de > > and also available on top of that from git: > > git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git topo-cpuid-v3 > > Thanks, > > tglx For Xen PV (dom0 and unprivileged guest): Tested-by: Juergen Gross <jgross@suse.com> Juergen
On 8/2/2023 3:20 AM, Thomas Gleixner wrote: > The series is based on V3 of the APIC cleanup series: > > https://lore.kernel.org/lkml/20230801103042.936020332@linutronix.de > > and also available on top of that from git: > > git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git topo-cpuid-v3 > Tested-by: Sohil Mehta <sohil.mehta@intel.com>
From: Thomas Gleixner <tglx@linutronix.de> Sent: Wednesday, August 2, 2023 3:21 AM > > Hi! > > This is the follow up to V2: > > > https://lore.kernel.org/lkml/20230728105650.565799744@linutronix.de/ > > which addresses the review feedback and some fallout reported on and > off-list. > > 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. V2: > > - Decoded and fixed the fallout vs. XEN/PV reported by Juergen. Thanks to > Juergen for the remote hand debugging sessions! > > That's addressed in the first two new patches in this series. Summary: > XEN/PV booted by pure chance since the addition of SMT control 5 years > ago. > > - Fixed the off by one in the AMD parser which was debugged by Michael > > - Addressed review comments from various people > > As discussed in: > > > https://lore.kernel.org/lkml/BYAPR21MB16889FD224344B1B28BE22A1D705A@BYAPR21MB1688.namprd21.prod.outlook.com/ > .... > > https://lore.kernel.org/lkml/87r0omjt8c.ffs@tglx/ > > this series unfortunately brings the Hyper-V BIOS inconsistency into > effect, which results in a slight performance impact. The L3 association > which "worked" so far by exploiting the inconsistency of the Linux topology > code is not longer supportable as we really need to get the actual short > comings of our topology management addressed in a consistent way. > > The series is based on V3 of the APIC cleanup series: > > > https://lore.kernel.org/lkml/20230801103042.936020332@linutronix.de/ > > and also available on top of that from git: > > git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git topo-cpuid-v3 > > Thanks, > > tglx > --- > 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 | 32 +-- > 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 | 25 +- > 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/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 | 133 --------------- > 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 | 51 +++++ > b/arch/x86/kernel/cpu/topology_amd.c | 179 ++++++++++++++++++++ > b/arch/x86/kernel/cpu/topology_common.c | 240 ++++++++++++++++++++++++++++ > b/arch/x86/kernel/cpu/topology_ext.c | 136 +++++++++++++++ > 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 | 6 > 61 files changed, 1077 insertions(+), 956 deletions(-) > Tested a variety of Hyper-V guest sizes running on Intel and AMD processors of various generations. Tested guests configured with hyper-threading and with no hyper-threading, single NUMA node and multi-NUMA node, etc. Also tested a hyper-threaded VM with the 'nosmt' option. All topologies look good, modulo the identified Hyper-V issue with mis-matched APIC IDs that must be fixed by Hyper-V. Tested-by: Michael Kelley <mikelley@microsoft.com>