From patchwork Mon Jan 3 08:46:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yanan Wang X-Patchwork-Id: 12702461 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D1166C433F5 for ; Mon, 3 Jan 2022 08:49:48 +0000 (UTC) Received: from localhost ([::1]:33284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4J2J-0007pS-N6 for qemu-devel@archiver.kernel.org; Mon, 03 Jan 2022 03:49:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4IzW-0004Iz-Au; Mon, 03 Jan 2022 03:46:54 -0500 Received: from szxga02-in.huawei.com ([45.249.212.188]:3064) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4IzS-0006Rg-2j; Mon, 03 Jan 2022 03:46:54 -0500 Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4JS8V62BPvzbj23; Mon, 3 Jan 2022 16:46:06 +0800 (CST) Received: from DESKTOP-TMVL5KK.china.huawei.com (10.174.187.128) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 3 Jan 2022 16:46:38 +0800 To: , CC: Peter Maydell , Andrew Jones , "Michael S . Tsirkin" , Igor Mammedov , Shannon Zhao , Ani Sinha , Eric Auger , , Yanan Wang Subject: [PATCH v6 0/7] ARM virt: Support CPU cluster topology Date: Mon, 3 Jan 2022 16:46:29 +0800 Message-ID: <20220103084636.2496-1-wangyanan55@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.174.187.128] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500023.china.huawei.com (7.185.36.83) X-CFilter-Loop: Reflected Received-SPF: pass client-ip=45.249.212.188; envelope-from=wangyanan55@huawei.com; helo=szxga02-in.huawei.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: Yanan Wang X-Patchwork-Original-From: Yanan Wang via From: Yanan Wang This v6 series enables the support for CPU cluster topology on ARM virt machines. The generic infrastructure for CPU cluster parameter now is in upstream. Background and descriptions: The new Cluster-Aware Scheduling support has landed in Linux 5.16, which has been proved to benefit the scheduling performance (e.g. load balance and wake_affine strategy) for both x86_64 and AArch64. We can see the PR [1] or the actual patch series [2] for reference. So since Linux 5.16 we have four-level arch-neutral CPU topology definition like below and a new scheduler level for clusters. struct cpu_topology { int thread_id; int core_id; int cluster_id; int package_id; int llc_id; cpumask_t thread_sibling; cpumask_t core_sibling; cpumask_t cluster_sibling; cpumask_t llc_sibling; } A cluster generally means a group of CPU cores which share L2 cache or other mid-level resources, and it is the shared resources that is used to improve scheduler's behavior. From the point of view of the size range, it's between CPU die and CPU core. For example, on some ARM64 Kunpeng servers, we have 6 clusters in each NUMA node, and 4 CPU cores in each cluster. The 4 CPU cores share a separate L2 cache and a L3 cache tag, which brings cache affinity advantage. [1] https://lore.kernel.org/lkml/163572864855.3357115.17938524897008353101.tglx@xen13/ [2] https://lkml.org/lkml/2021/9/24/178 In virtualization, on the Hosts which have physical clusters, if we can design a vCPU topology with cluster level for guest kernel and have a dedicated vCPU pinning. A Cluster-Aware Guest kernel can also make use of the cache affinity of CPU clusters to gain similar scheduling performance. This series only enables clusters support in the vCPU topology on ARM virt machines. We can also enable it for other machine types in the future if needed. The patches in this series do: - Enable CPU cluster support on ARM virt machines, so that users can specify a 4-level CPU hierarchy sockets/clusters/cores/threads. And the 4-level topology will be described to guest kernel through ACPI PPTT and DT cpu-map. Changelog: v5->v6: - drop the generic part which is in upstream now - rebased on latest master - v5: https://patchew.org/QEMU/20211228092221.21068-1-wangyanan55@huawei.com/ Yanan Wang (7): hw/arm/virt: Support CPU cluster on ARM virt machine hw/arm/virt: Support cluster level in DT cpu-map hw/acpi/aml-build: Improve scalability of PPTT generation hw/arm/virt-acpi-build: Make an ARM specific PPTT generator tests/acpi/bios-tables-test: Allow changes to virt/PPTT file hw/arm/virt-acpi-build: Support cluster level in PPTT generation tests/acpi/bios-table-test: Update expected virt/PPTT file hw/acpi/aml-build.c | 66 ++------------------------ hw/arm/virt-acpi-build.c | 92 +++++++++++++++++++++++++++++++++++- hw/arm/virt.c | 16 ++++--- include/hw/acpi/aml-build.h | 5 +- qemu-options.hx | 10 ++++ tests/data/acpi/virt/PPTT | Bin 76 -> 96 bytes 6 files changed, 115 insertions(+), 74 deletions(-) --- 2.27.0