From nobody Tue Nov 26 06:59:25 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=1709718130; cv=none; d=zohomail.com; s=zohoarc; b=c++Q3H99qyn366k30IA4WOeTn4GO32QwWdnajc8JU/QiPkLaUAWdrFvJR5MSTXviEAPhI0+3TPdk3cHrlVBNJfg1aMJ2f1REyZqJUI43ksiEC+JAKnez3themDboRAnde3DbXVqn2f/KhsjEogJ7D0YJDm6jrFtYkgdVLjAgcxg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709718130; 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=lt7oKSiiuxn2KgExI1UlL2mwVUNq2P1L5Zp2eG6j8zg=; b=iiIIuPT2MLn9y6TyumkIkPE/MkhgsTkPcFzLfvI+Acm+pfS/zJifyCiBkp1BAekfFzoAinYfAEqJezmD++dkzta14To7QkCvrHEyA00WsQoybM0/saIA8dUsHezH6ToHOgv+q9TGZNSqGGCndQ829KGzT/9g94ylVSe31vAy6FA= 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 1709718130496628.0696441087224; Wed, 6 Mar 2024 01:42:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhnlf-0007XT-9r; Wed, 06 Mar 2024 04:40:55 -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 1rhnld-0007XF-HL for qemu-devel@nongnu.org; Wed, 06 Mar 2024 04:40:54 -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 1rhnlb-0002K2-SV for qemu-devel@nongnu.org; Wed, 06 Mar 2024 04:40:53 -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:40:50 -0800 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa002.fm.intel.com with ESMTP; 06 Mar 2024 01:40:48 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709718052; x=1741254052; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3yBYX2nAWb+HDAcrhm+cAUvXQKvQu/GD/FeL85SWXFA=; b=mM0eyEXMJiQMEfiFJyypkGcieEI/xhfZGQE+lmtgMAAWv3dHwCkj8fWS cxdTMSAmesbyrVYDaJi+yWCMH9i1cHZ8cidflOlBkULp5jEd15dXjIO87 yNwB4MgrOzk8EAyu7aduHHHuNAzHmv9fr9xmGRH7GbkQ8nH0Xw5qgNcUS WNtURN8EPVivpikqpFYaHM+QtA5LBV9fy8TWlR4QP2QR7Pqgw62mhY8eJ Ys3yNEBp5fgHRmmKhxQzjtmfAnIEaDuQE2TZf1Gb+fgohU/VIin6O2Jzq n1ue0hX7O75E8EYfYGz6ecTbYeXGrJ2/TdgxhhQ9Hto8O7gAAMTV5/9/0 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11004"; a="14897891" X-IronPort-AV: E=Sophos;i="6.06,207,1705392000"; d="scan'208";a="14897891" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,207,1705392000"; d="scan'208";a="32854159" 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 08/14] tests/unit/test-smp-parse: Make test cases aware of the book/drawer Date: Wed, 6 Mar 2024 17:54:01 +0800 Message-Id: <20240306095407.3058909-9-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: 1709718130839100001 Content-Type: text/plain; charset="utf-8" From: Zhao Liu Currently, -smp supports 2 more new levels: book and drawer. It is necessary to consider the effects of book and drawer in the test cases to ensure that the calculations are correct. This is also the preparation to add new book and drawer test cases. Signed-off-by: Zhao Liu Tested-by: Xiaoling Song Reviewed-by: Thomas Huth --- tests/unit/test-smp-parse.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index 2eb9533bc505..f656bbb6da27 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -384,6 +384,8 @@ static char *smp_config_to_string(const SMPConfiguratio= n *config) return g_strdup_printf( "(SMPConfiguration) {\n" " .has_cpus =3D %5s, cpus =3D %" PRId64 ",\n" + " .has_drawers =3D %5s, drawers =3D %" PRId64 ",\n" + " .has_books =3D %5s, books =3D %" PRId64 ",\n" " .has_sockets =3D %5s, sockets =3D %" PRId64 ",\n" " .has_dies =3D %5s, dies =3D %" PRId64 ",\n" " .has_clusters =3D %5s, clusters =3D %" PRId64 ",\n" @@ -392,6 +394,8 @@ static char *smp_config_to_string(const SMPConfiguratio= n *config) " .has_maxcpus =3D %5s, maxcpus =3D %" PRId64 ",\n" "}", config->has_cpus ? "true" : "false", config->cpus, + config->has_drawers ? "true" : "false", config->drawers, + config->has_books ? "true" : "false", config->books, config->has_sockets ? "true" : "false", config->sockets, config->has_dies ? "true" : "false", config->dies, config->has_clusters ? "true" : "false", config->clusters, @@ -404,10 +408,10 @@ static char *smp_config_to_string(const SMPConfigurat= ion *config) static unsigned int cpu_topology_get_threads_per_socket(const CpuTopology = *topo) { /* Check the divisor to avoid invalid topology examples causing SIGFPE= . */ - if (!topo->sockets) { + if (!topo->drawers || !topo->books || !topo->sockets) { return 0; } else { - return topo->max_cpus / topo->sockets; + return topo->max_cpus / topo->drawers / topo->books / topo->socket= s; } } =20 @@ -429,6 +433,8 @@ static char *cpu_topology_to_string(const CpuTopology *= topo, return g_strdup_printf( "(CpuTopology) {\n" " .cpus =3D %u,\n" + " .drawers =3D %u,\n" + " .books =3D %u,\n" " .sockets =3D %u,\n" " .dies =3D %u,\n" " .clusters =3D %u,\n" @@ -438,7 +444,8 @@ static char *cpu_topology_to_string(const CpuTopology *= topo, " .threads_per_socket =3D %u,\n" " .cores_per_socket =3D %u,\n" "}", - topo->cpus, topo->sockets, topo->dies, topo->clusters, + 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); } @@ -473,6 +480,8 @@ static void check_parse(MachineState *ms, const SMPConf= iguration *config, if (is_valid) { if ((err =3D=3D NULL) && (ms->smp.cpus =3D=3D expect_topo->cpus) && + (ms->smp.drawers =3D=3D expect_topo->drawers) && + (ms->smp.books =3D=3D expect_topo->books) && (ms->smp.sockets =3D=3D expect_topo->sockets) && (ms->smp.dies =3D=3D expect_topo->dies) && (ms->smp.clusters =3D=3D expect_topo->clusters) && @@ -564,6 +573,16 @@ static void unsupported_params_init(const MachineClass= *mc, SMPTestData *data) data->expect_prefer_sockets.clusters =3D 1; data->expect_prefer_cores.clusters =3D 1; } + + if (!mc->smp_props.books_supported) { + data->expect_prefer_sockets.books =3D 1; + data->expect_prefer_cores.books =3D 1; + } + + if (!mc->smp_props.drawers_supported) { + data->expect_prefer_sockets.drawers =3D 1; + data->expect_prefer_cores.drawers =3D 1; + } } =20 static void machine_base_class_init(ObjectClass *oc, void *data) --=20 2.34.1