From nobody Tue Nov 26 06:40:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1709718118; cv=none; d=zohomail.com; s=zohoarc; b=S1AuiVvKaA9Q/2LYCiVWvg3xVhRDW7NLeE8NQA56la1cstKPOzsJTIdGdjbzrpjddVOuCJ/wu1A8OayME8B4fj2eiAX+p7dJ2H8B+EViYRPkkWYK5UTrW5x2UKthKkUwx6i9W80SDQ9lDjoF+yY9Kd51PPUkMA04Q/9MELbtqvw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709718118; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=81w26MIDFs/9G5X5bRx4Vqwq+xTuBgQjeWOXJDILFPk=; b=HOrwNJ4Ja51dZByQ9fb+xexWz2j5SniZXYdLASqluEYWaocDvwDNP+yTkz+VzixoQENuI8JpgcKgj4XefKbeJY9GXQTDVLMlr5Q9ssf+2DTBhzMbC1ccoKdoax5ckg4Gor4Zp2EClggskMZhdmQ3Yk6+8O3jO5KxZaoLiI8UEGo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1709718118746855.9484586782967; Wed, 6 Mar 2024 01:41:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhnm3-0007yQ-8z; Wed, 06 Mar 2024 04:41:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhnm2-0007x7-E8 for qemu-devel@nongnu.org; Wed, 06 Mar 2024 04:41:18 -0500 Received: from mgamail.intel.com ([198.175.65.11]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhnm0-0002K2-Hc for qemu-devel@nongnu.org; Wed, 06 Mar 2024 04:41:18 -0500 Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2024 01:41:06 -0800 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa002.fm.intel.com with ESMTP; 06 Mar 2024 01:41:03 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709718076; x=1741254076; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9CNNd6/FqGn+vADBzcQTmk8SQKEglbZAI6+rVVgSS7Q=; b=hSvmgKdqcKMfdF5h4ZtCnBMn88TGye5DK3jzA0X+PljNRVNDLqLYLOLn gLueLEDrUJ5tnKwAvW0qwHUeqFhgBrf+8FGUv9ppvCMXuCSxWmOZuvsje 1TOW0+HARleM48kfWDnqxhFGk1OtVIoIAKiiMiahOek/AyFvhMEvC8IOt u+txbMPh7Ykuknc32iUB4R/3cQaTklZBdf03rWXwfg/eS9DJhTH5xaSPY zAeBvBthFd0gcFEbPiVVAbzbHwQM8eq95Wvz9ek2+U1BpOwlQrpWt/7wP 2A34UerHtLpbodzOkWTqrEgMgylags8NCOt5IQuYHBOcK3wC9TGzAHpGv w==; X-IronPort-AV: E=McAfee;i="6600,9927,11004"; a="14897952" X-IronPort-AV: E=Sophos;i="6.06,207,1705392000"; d="scan'208";a="14897952" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,207,1705392000"; d="scan'208";a="32854199" From: Zhao Liu To: Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Thomas Huth , Igor Mammedov , Prasad Pandit , qemu-devel@nongnu.org Cc: Xiaoling Song , Zhao Liu Subject: [PATCH 13/14] tests/unit/test-smp-parse: Test smp_props.has_clusters Date: Wed, 6 Mar 2024 17:54:06 +0800 Message-Id: <20240306095407.3058909-14-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240306095407.3058909-1-zhao1.liu@linux.intel.com> References: <20240306095407.3058909-1-zhao1.liu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=198.175.65.11; envelope-from=zhao1.liu@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.568, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1709718120808100007 Content-Type: text/plain; charset="utf-8" From: Zhao Liu The smp_props.has_clusters in MachineClass is not a user configured field, and it indicates if user specifies "clusters" in -smp. After -smp parsing, other module could aware if the cluster level is configured by user. This is used when the machine has only 1 cluster since there's only 1 cluster by default. Add the check to cover this field. Signed-off-by: Zhao Liu Tested-by: Xiaoling Song Acked-by: Thomas Huth --- tests/unit/test-smp-parse.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index 75581691713c..d39cfdc19bfe 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -573,7 +573,8 @@ static unsigned int cpu_topology_get_cores_per_socket(c= onst CpuTopology *topo) =20 static char *cpu_topology_to_string(const CpuTopology *topo, unsigned int threads_per_socket, - unsigned int cores_per_socket) + unsigned int cores_per_socket, + bool has_clusters) { return g_strdup_printf( "(CpuTopology) {\n" @@ -588,17 +589,20 @@ static char *cpu_topology_to_string(const CpuTopology= *topo, " .max_cpus =3D %u,\n" " .threads_per_socket =3D %u,\n" " .cores_per_socket =3D %u,\n" + " .has_clusters =3D %s,\n" "}", topo->cpus, topo->drawers, topo->books, topo->sockets, topo->dies, topo->clusters, topo->cores, topo->threads, topo->max_cpus, - threads_per_socket, cores_per_socket); + threads_per_socket, cores_per_socket, + has_clusters ? "true" : "false"); } =20 static void check_parse(MachineState *ms, const SMPConfiguration *config, const CpuTopology *expect_topo, const char *expect= _err, bool is_valid) { + MachineClass *mc =3D MACHINE_GET_CLASS(ms); g_autofree char *config_str =3D smp_config_to_string(config); g_autofree char *expect_topo_str =3D NULL, *output_topo_str =3D NULL; unsigned int expect_threads_per_socket, expect_cores_per_socket; @@ -611,15 +615,18 @@ static void check_parse(MachineState *ms, const SMPCo= nfiguration *config, cpu_topology_get_cores_per_socket(expect_topo); expect_topo_str =3D cpu_topology_to_string(expect_topo, expect_threads_per_socket, - expect_cores_per_socket); + expect_cores_per_socket, + config->has_clusters); =20 /* call the generic parser */ machine_parse_smp_config(ms, config, &err); =20 ms_threads_per_socket =3D machine_topo_get_threads_per_socket(ms); ms_cores_per_socket =3D machine_topo_get_cores_per_socket(ms); - output_topo_str =3D cpu_topology_to_string(&ms->smp, ms_threads_per_so= cket, - ms_cores_per_socket); + output_topo_str =3D cpu_topology_to_string(&ms->smp, + ms_threads_per_socket, + ms_cores_per_socket, + mc->smp_props.has_clusters); =20 /* when the configuration is supposed to be valid */ if (is_valid) { @@ -634,7 +641,8 @@ static void check_parse(MachineState *ms, const SMPConf= iguration *config, (ms->smp.threads =3D=3D expect_topo->threads) && (ms->smp.max_cpus =3D=3D expect_topo->max_cpus) && (ms_threads_per_socket =3D=3D expect_threads_per_socket) && - (ms_cores_per_socket =3D=3D expect_cores_per_socket)) { + (ms_cores_per_socket =3D=3D expect_cores_per_socket) && + (mc->smp_props.has_clusters =3D=3D config->has_clusters)) { return; } =20 --=20 2.34.1