From patchwork Thu Jan 20 12:35:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 533554 Delivered-To: patch@linaro.org Received: by 2002:a5d:4010:0:0:0:0:0 with SMTP id n16csp4493597wrp; Thu, 20 Jan 2022 08:21:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJzOxGiAT8qTeSV7rkAMefBY9uKKR00GY6kkRCd84EF5hNaBoubOqba7/mytThkZ0fYOj1l9 X-Received: by 2002:a05:6214:762:: with SMTP id f2mr20227120qvz.0.1642695692815; Thu, 20 Jan 2022 08:21:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642695692; cv=none; d=google.com; s=arc-20160816; b=Hbca8Nk8s6XIcIFW04VIrdW41kp2KQqQKXW4Vrcg0dJ2BMq67fNXB4XdEbzx2ck6+/ O1q1XviZZy1/KdicuaI0I/MsDprwdhmwR/FE8II6yq2Xk9qVMQR7rNpXK2iRMklwViAt 6JLly+g9R0MRtXUuDWfCp20/DCSm3Dt4bTQNDvmUzowR9YImxLQ/u1EdGIgTTEnRnF/C xOs9t+KkV9+4DoreOaqbFR2/qjTE8lnjB/CkCF4EsA4XJNDfHj5SLVVeVfANW899T0YD uMKpzcBEFaahFMUY5DCd2pE7mRCmzcUI5/EUFk9sCqfCQGIGW1TSjUDC038BHF+qpr8d QGkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=a8FVRNOZ9o8qruWDr+i0LLRC1Db87DIJZkRZ+SFtA/4=; b=c4PT22ZnrKo2D1Em/GD2liWjx09Is8GbwmHb7gKVCZWW+7DAfo8recoLCt2/YFFgT+ d0Tb+yMbi42Jp+s8wZ8WZ1q7wZNab2hV20b/ik7E/KB6L88yH9cg2j3JlvbXbagimo/+ UYNY5qn7V+4oJB+N6nZeOvvYlbehGTXkrjIiqBj33r6dayOuwKOsH5howRQzra1WqrtL pT7QCUYt7paLp9LbeXrR/wtrmQ1pIyvkAF2yqmYmuogplpTks/jDlcZuLapFEFB4EFGR bCa/L7crRH8MI6Er7MCGze7Oy/iG6o8WNOCPlyfm327nA9uy78Wb1LZJYNSMmJ/GAqLQ FmPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kafEIF6G; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ke9si1105474qvb.417.2022.01.20.08.21.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jan 2022 08:21:32 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kafEIF6G; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39760 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nAaBo-0000T1-79 for patch@linaro.org; Thu, 20 Jan 2022 11:21:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nAWgJ-00046T-1M for qemu-devel@nongnu.org; Thu, 20 Jan 2022 07:36:47 -0500 Received: from [2a00:1450:4864:20::331] (port=43642 helo=mail-wm1-x331.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nAWgA-00038B-VL for qemu-devel@nongnu.org; Thu, 20 Jan 2022 07:36:41 -0500 Received: by mail-wm1-x331.google.com with SMTP id e9-20020a05600c4e4900b0034d23cae3f0so13398144wmq.2 for ; Thu, 20 Jan 2022 04:36:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=a8FVRNOZ9o8qruWDr+i0LLRC1Db87DIJZkRZ+SFtA/4=; b=kafEIF6Gu2QblYdqu4L4O3+S15smUd0O05ZrhYojM8DDBft8S8NJAx1OHeXukCKizc T0EcdTYzMpSw7gLVHWNvmjuR4Z2MJSdrv70AcClajsFplLCOOwN1RRCdAVacRm/Nhfbx nUkpKJ+1+s8hmjz2rU3pxfUDghPdmZ7Co8u/ARtoj76hMJM6VzzvA2CNraDUVUfkCNln Y/LC/n/3jnPMP0+h14OU35URFpZO22cjPkmSF0+CRh6XK2JghfgSrvYSaaY9+VxKhmLu itBSSNPz9uSCnxvHa5qDlvdlWi3ByyN3ZV+egFVZmgy+Hw6vdgVTnweZZOpjOYM3SwaX y+yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a8FVRNOZ9o8qruWDr+i0LLRC1Db87DIJZkRZ+SFtA/4=; b=OoOq5OLa8EAMu+xEZon/Nkc5H/jY+MctOkD0fPeF4MUzIdSVxeFNp9YEr8VgYG7Ziw NoW85yjqdXpC6Zq+QiMk3PLnGYi9LYPp5irMHlRKcsMyU9lirOYgY/VKIaNtogICP/ea rhXNXGvoGL+xTHk0QZaYy6qRqAZfzBQLLDYDq6uFUnYSi0KxJ4IW7YGKyd2wXy8Wafg5 x4mxY3r5B60WAZJfugOc7VJD0csctXbh1E8sRaaimYvYYQicgZOosepCfpdaheHr5R0I 984xE9TBVMVqAgZ+oIqZHGROhEtulWGGzBiBJKk52LvBEwv2rwP9AGLrOdX2KPgm2iDb vRUA== X-Gm-Message-State: AOAM533AbMTi64n9m8V2uObig98NsdaLUdY9Nb8hIFCqcPIJZuA3krj/ X/RAdW3ZIlWOgITWgjZW7cP5PKavyMbiCg== X-Received: by 2002:adf:e2cc:: with SMTP id d12mr33055494wrj.107.1642682197418; Thu, 20 Jan 2022 04:36:37 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t8sm7993324wmq.43.2022.01.20.04.36.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 04:36:37 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/38] hw/arm/virt: Support CPU cluster on ARM virt machine Date: Thu, 20 Jan 2022 12:35:57 +0000 Message-Id: <20220120123630.267975-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220120123630.267975-1-peter.maydell@linaro.org> References: <20220120123630.267975-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::331 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Yanan Wang ARM64 machines like Kunpeng Family Server Chips have a level of hardware topology in which a group of CPU cores share L3 cache tag or L2 cache. For example, Kunpeng 920 typically has 6 or 8 clusters in each NUMA node (also represent range of CPU die), and each cluster has 4 CPU cores. All clusters share L3 cache data, but CPU cores in each cluster share a local L3 tag. Running a guest kernel with Cluster-Aware Scheduling on the Hosts which have physical clusters, if we can design a vCPU topology with cluster level for guest kernel and then have a dedicated vCPU pinning, the guest will gain scheduling performance improvement from cache affinity of CPU cluster. So let's enable the support for this new parameter on ARM virt machines. After this patch, we can define a 4-level CPU hierarchy like: cpus=*,maxcpus=*,sockets=*,clusters=*, cores=*,threads=*. Signed-off-by: Yanan Wang Reviewed-by: Andrew Jones Message-id: 20220107083232.16256-2-wangyanan55@huawei.com Signed-off-by: Peter Maydell --- hw/arm/virt.c | 1 + qemu-options.hx | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 84c2444fff6..688d8736909 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2718,6 +2718,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) hc->unplug_request = virt_machine_device_unplug_request_cb; hc->unplug = virt_machine_device_unplug_cb; mc->nvdimm_supported = true; + mc->smp_props.clusters_supported = true; mc->auto_enable_numa_with_memhp = true; mc->auto_enable_numa_with_memdev = true; mc->default_ram_id = "mach-virt.ram"; diff --git a/qemu-options.hx b/qemu-options.hx index ec90505d84e..ba3ae6a42aa 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -277,6 +277,16 @@ SRST -smp 16,sockets=2,dies=2,cores=2,threads=2,maxcpus=16 + The following sub-option defines a CPU topology hierarchy (2 sockets + totally on the machine, 2 clusters per socket, 2 cores per cluster, + 2 threads per core) for ARM virt machines which support sockets/clusters + /cores/threads. Some members of the option can be omitted but their values + will be automatically computed: + + :: + + -smp 16,sockets=2,clusters=2,cores=2,threads=2,maxcpus=16 + Historically preference was given to the coarsest topology parameters when computing missing values (ie sockets preferred over cores, which were preferred over threads), however, this behaviour is considered