From nobody Thu Nov 14 06:56:42 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=1705588706; cv=none; d=zohomail.com; s=zohoarc; b=eOTSc1T4dA5jkgS/v6P6lzg4ITSkPXNy1KkRg1fxRDKKz79UgPssHUsK0xtk/jXlJc3XPhhOfgYft+KppqFjFJ3ONBYQKDvk9CV3/tqdBq5xoKdB5v+6miad+s5JjxoYK+ZLhuoNxALMvLczPluif6O2fjdJXV9zhuUyK6Wrjlg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705588706; 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=tCcsoHMW5imCo/W4UmfEHMIeM2pt8xF/8uDVCRoGASI=; b=BcohqU2EJOxcAvaCvftWancXFroK/IQqkxnLunJE9nrztUqKfz1pG3KBVSHovuyCB/6nxx784/8HOzRr+10+MH5w7bCNqDQ2EpiuGCRI4hPvwfMNtXHdMolbBOCE8lEga5bGtxPjq6VbiS5YxNXULFJ59KOi7LN7Lvf3c8znn40= 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 1705588706166152.32426215890223; Thu, 18 Jan 2024 06:38:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQTWx-0004zV-4j; Thu, 18 Jan 2024 09:38:10 -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 1rQTWf-0004ux-1T for qemu-devel@nongnu.org; Thu, 18 Jan 2024 09:37:50 -0500 Received: from mgamail.intel.com ([198.175.65.9]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQTWZ-0004T0-AI for qemu-devel@nongnu.org; Thu, 18 Jan 2024 09:37:47 -0500 Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2024 06:36:10 -0800 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa005.jf.intel.com with ESMTP; 18 Jan 2024 06:36:08 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705588663; x=1737124663; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=scLXbUoC+ZDyb0yjC19HMwOlFwwAZ+GFvAD3rT1YF14=; b=Od+vLzl2UKCeNtHv4Ai+hw6Hs5ztnDPS2anO0u6ckNtpfbP6nERpPaZt bqUo1g/0eko/ZNZvhIgnishR5FfONfLxqGQiwiyWlaTrz8Lm12ZCy8WHJ xRCyMXleyHoqPboAeMH2oqhK/LT+8+Sd+9NDXjOpOgK5iuPVAEpzAPyVt uieiTroAUjJOgpnyGGlzW27k/nnP3DbgegZS0ikVLHgJwnClWU1B3FHzZ eydDfOYhr0Le8IIM32ZbNuoBQkzQcWZis/dgfLTeQwCqb5y2BiOkkgqUO bcpK+4uHFFX5iJBMf6PaCuk1Det/k5wesY2PeDl2VWDjjFGG2m33vf5m7 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10956"; a="19057059" X-IronPort-AV: E=Sophos;i="6.05,203,1701158400"; d="scan'208";a="19057059" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,203,1701158400"; d="scan'208";a="329252" From: Zhao Liu To: Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang Cc: qemu-devel@nongnu.org, Xiaoling Song , Zhao Liu Subject: [PATCH 1/8] tests/unit/test-smp-parse.c: Use CPU number macros in invalid topology case Date: Thu, 18 Jan 2024 22:48:50 +0800 Message-Id: <20240118144857.2124034-2-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240118144857.2124034-1-zhao1.liu@linux.intel.com> References: <20240118144857.2124034-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.9; envelope-from=zhao1.liu@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.806, 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: 1705588708300100003 Content-Type: text/plain; charset="utf-8" From: Zhao Liu Use MAX_CPUS/MIN_CPUS micros in invalid topology case. This gives us the flexibility to change the maximum and minimum CPU limits. Signed-off-by: Zhao Liu Reviewed-by: Thomas Huth Tested-by: Xiaoling Song --- tests/unit/test-smp-parse.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index 24972666a74d..20c663a006b3 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -323,15 +323,21 @@ static const struct SMPTestData data_generic_invalid[= ] =3D { "sockets (2) * cores (4) * threads (2) " "=3D=3D maxcpus (16) < smp_cpus (18)", }, { - /* config: -smp 1 - * should tweak the supported min CPUs to 2 for testing */ - .config =3D SMP_CONFIG_GENERIC(T, 1, F, 0, F, 0, F, 0, F, 0), + /* + * config: -smp 1 + * The test machine should tweak the supported min CPUs to + * 2 (MIN_CPUS + 1) for testing. + */ + .config =3D SMP_CONFIG_GENERIC(T, MIN_CPUS, F, 0, F, 0, F, 0, F, 0= ), .expect_error =3D "Invalid SMP CPUs 1. The min CPUs supported " "by machine '" SMP_MACHINE_NAME "' is 2", }, { - /* config: -smp 512 - * should tweak the supported max CPUs to 511 for testing */ - .config =3D SMP_CONFIG_GENERIC(T, 512, F, 0, F, 0, F, 0, F, 0), + /* + * config: -smp 512 + * The test machine should tweak the supported max CPUs to + * 511 (MAX_CPUS - 1) for testing. + */ + .config =3D SMP_CONFIG_GENERIC(T, MAX_CPUS, F, 0, F, 0, F, 0, F, 0= ), .expect_error =3D "Invalid SMP CPUs 512. The max CPUs supported " "by machine '" SMP_MACHINE_NAME "' is 511", }, @@ -575,8 +581,8 @@ static void machine_generic_invalid_class_init(ObjectCl= ass *oc, void *data) MachineClass *mc =3D MACHINE_CLASS(oc); =20 /* Force invalid min CPUs and max CPUs */ - mc->min_cpus =3D 2; - mc->max_cpus =3D 511; + mc->min_cpus =3D MIN_CPUS + 1; + mc->max_cpus =3D MAX_CPUS - 1; } =20 static void machine_with_dies_class_init(ObjectClass *oc, void *data) --=20 2.34.1 From nobody Thu Nov 14 06:56:42 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=1705588768; cv=none; d=zohomail.com; s=zohoarc; b=RLZsL7VG7CLEWFU7F8eJQQ+H/xpbDQd02eg9GtDa5V8+MFowAmAqUmdHxGABihR69MCs3enes9hWjcrBC07cuBaV3HmxjJRrTI+iBewV2zf75ibcewJoQLSax4s6zUk5NVVWUP/5OlXg2om2MDly1u+s5/+Dyv2POrs5G64llNw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705588768; 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=QlLZbw9vz4TOb6CkcQnFsMUoCsYtel3zSNjw24VK1Is=; b=dqLet/GWlk5NYlWeXcKH68S3R0bFZ2AVM+JGRPj1s2liwc+DADrOGVJAKAXlH6W8detbo2J9lEAdEAXA30i4KzdSW3zDWdTlwH8ULdMJJg6hUp3eeO8SRqctm9CR6AswJ9ov/mFHzuAvvRZTk/8KdtYXZHe9gPUpNHG4uC6MzuQ= 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 1705588768056140.14207986521376; Thu, 18 Jan 2024 06:39:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQTX0-00052t-EW; Thu, 18 Jan 2024 09:38:10 -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 1rQTWi-0004xx-R8 for qemu-devel@nongnu.org; Thu, 18 Jan 2024 09:37:58 -0500 Received: from mgamail.intel.com ([198.175.65.9]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQTWc-0004TI-VI for qemu-devel@nongnu.org; Thu, 18 Jan 2024 09:37:49 -0500 Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2024 06:36:12 -0800 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa005.jf.intel.com with ESMTP; 18 Jan 2024 06:36:10 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705588667; x=1737124667; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=raK/CZUO9BGxPhxaK6FT5X9pHU+bYuQa1Xhf/KvW4Sk=; b=h/yOhP5D5Hxl7z6Zb2/vJQbfnCuQHIlL41qxDMgRVR5/kyIXYk5/yKvv N3/jRfZo9YE9BLxH08YLrS+k3CKbXy9aHxGKsZlkNa9lwjVHQQOWXtyMe T+p1fcKfVJbPtD96S2Czaoda4dNKABAQ8NJGnUHlwcT+0kjjVN2wvCFQx 3PT2b/g/8nQBQMobHNN5CmovfeI0viEsXCjwp6xKYhJbp9SCpquKL3GkD YoeAF2xLrT12T35Zjvtb1cSQfyZ5qF6IRh1UFkjqPH+P5L9dtfa4S8DRG Dsl6ryxvEYZgPVJCFMqYSF43dcUNScAXsluwDsNh502shPcztMRiD9wQH w==; X-IronPort-AV: E=McAfee;i="6600,9927,10956"; a="19057100" X-IronPort-AV: E=Sophos;i="6.05,203,1701158400"; d="scan'208";a="19057100" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,203,1701158400"; d="scan'208";a="329281" From: Zhao Liu To: Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang Cc: qemu-devel@nongnu.org, Xiaoling Song , Zhao Liu Subject: [PATCH 2/8] tests/unit/test-smp-parse.c: Bump max_cpus to 4096 Date: Thu, 18 Jan 2024 22:48:51 +0800 Message-Id: <20240118144857.2124034-3-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240118144857.2124034-1-zhao1.liu@linux.intel.com> References: <20240118144857.2124034-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.9; envelope-from=zhao1.liu@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.806, 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: 1705588768541100003 Content-Type: text/plain; charset="utf-8" From: Zhao Liu PC mahine is trying to support up to 4096 vCPUs [1], so it's necessary to bump max_cpus in test-smp-parse to 4096 to cover the topological needs of future machines. [1]: https://lore.kernel.org/qemu-devel/20231208122611.32311-1-anisinha@red= hat.com/ Signed-off-by: Zhao Liu Tested-by: Xiaoling Song --- tests/unit/test-smp-parse.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index 20c663a006b3..55ba13bf7d15 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -20,8 +20,8 @@ #define T true #define F false =20 -#define MIN_CPUS 1 /* set the min CPUs supported by the machine as 1 */ -#define MAX_CPUS 512 /* set the max CPUs supported by the machine as 512 */ +#define MIN_CPUS 1 /* set the min CPUs supported by the machine as 1 */ +#define MAX_CPUS 4096 /* set the max CPUs supported by the machine as 4096= */ =20 #define SMP_MACHINE_NAME "TEST-SMP" =20 @@ -333,13 +333,13 @@ static const struct SMPTestData data_generic_invalid[= ] =3D { "by machine '" SMP_MACHINE_NAME "' is 2", }, { /* - * config: -smp 512 + * config: -smp 4096 * The test machine should tweak the supported max CPUs to - * 511 (MAX_CPUS - 1) for testing. + * 4095 (MAX_CPUS - 1) for testing. */ - .config =3D SMP_CONFIG_GENERIC(T, MAX_CPUS, F, 0, F, 0, F, 0, F, 0= ), - .expect_error =3D "Invalid SMP CPUs 512. The max CPUs supported " - "by machine '" SMP_MACHINE_NAME "' is 511", + .config =3D SMP_CONFIG_GENERIC(T, 4096, F, 0, F, 0, F, 0, F, 0), + .expect_error =3D "Invalid SMP CPUs 4096. The max CPUs supported " + "by machine '" SMP_MACHINE_NAME "' is 4095", }, }; =20 --=20 2.34.1 From nobody Thu Nov 14 06:56:42 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=1705588771; cv=none; d=zohomail.com; s=zohoarc; b=edBZJhT/jERX9zLTVjELaOHeifWOqxmx0XoPkHPU3bhL5L/OmCn8ST9l6IFe66fP5wNZXoM7mltRckmQARfUziGxIuNObKf/xhuAwLzngckwestJIkkLZzXBMEmUdwH64VZ2HL4BkimOV6nFz+r1UNEh8S+Lh9ftJn7AY5kBk90= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705588771; 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=fwJ9F/x+GEAHfRN5/U+065YJ2pQIzvrHw6Nn+Nowi5Q=; b=g0d0T62SnOefrgg1ufJKs4eoRK8FTFphezFWSbh9CIsQxzp4HSoqKyUvFuMI4zcLXnkjFPp8yvmJafVSy763a2tbniufHtN4kSxbUTZcvtBCVX0j7zfkHGM/hS1+yxmdc1ftqjUc2he2dcDBSz/U2pTgM2QnJR7e8Oa5qAAMLuc= 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 1705588771154642.2365963170863; Thu, 18 Jan 2024 06:39:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQTWs-0004z7-3Y; Thu, 18 Jan 2024 09:38:02 -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 1rQTWi-0004xy-SF for qemu-devel@nongnu.org; Thu, 18 Jan 2024 09:37:58 -0500 Received: from mgamail.intel.com ([198.175.65.9]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQTWe-0004Sm-4I for qemu-devel@nongnu.org; Thu, 18 Jan 2024 09:37:51 -0500 Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2024 06:36:15 -0800 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa005.jf.intel.com with ESMTP; 18 Jan 2024 06:36:12 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705588668; x=1737124668; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1SWHqFeXzNGnco53f5tEtcR6EUCJeAlBwzP8tS2mFJo=; b=fEb1BFh61P3IFd21l2VkHinrIJnnRKhxLUQTvMCRLIajazOwHtUHnfcc rDYI4hTk/U5idfk2w9oGUz0ZmFGAz2oC+4eQj3uriGuAwnlB7CTo9RL5k P5XTPYDXqX3ryadOdOeU2Z9s7LCt7MeeIi2iIuxGqvQjx1lnDQaGGahtE /au5bs3okGZiGKhummgX62zyyOe/e2dx/IF4MBsRLY5eMBa4AiDobEfFw lCkii7zDTAQX7WHQlamUh96eyiKKdCAHb2/pcxyKZbl5KYgeyVQzqXBAo Cf9xuAcufHVaKrk4hUPip7E3ti8y7MS923E/kB6fsg4gnLqXkfHOljdaX Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10956"; a="19057150" X-IronPort-AV: E=Sophos;i="6.05,203,1701158400"; d="scan'208";a="19057150" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,203,1701158400"; d="scan'208";a="329305" From: Zhao Liu To: Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang Cc: qemu-devel@nongnu.org, Xiaoling Song , Zhao Liu Subject: [PATCH 3/8] tests/unit/test-smp-parse.c: Make test cases aware of the book/drawer Date: Thu, 18 Jan 2024 22:48:52 +0800 Message-Id: <20240118144857.2124034-4-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240118144857.2124034-1-zhao1.liu@linux.intel.com> References: <20240118144857.2124034-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.9; envelope-from=zhao1.liu@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.806, 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: 1705588772785100001 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 Reviewed-by: Thomas Huth Tested-by: Xiaoling Song --- 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 55ba13bf7d15..a8eb3bbb35ed 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 From nobody Thu Nov 14 06:56:42 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=1705588701; cv=none; d=zohomail.com; s=zohoarc; b=nso807kmZRAOlW1QGLH+pi5EXx1F8bA3C3B47Kn7xjlJ3R9AoEIy0N+5V29FSeNF5Jq6lPJt+7/TlHb4OJZGbrvJcxhNcBlkux1X19aR43tVaidkZB2lNXgc7bkCM+2OckCvepHfk0es2HLy99mNA9Kqh5aBEONpBYy/ZRMowS8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705588701; 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=p6zBX5GQCqzot2Krg2+LIWkcfLMnKr8rX98EUEu6M24=; b=Js1H63hIWtP5gy2YV+13gEsF8CN56h6w9GAGK4MyRJRv3hv7S2sWal0z0IQOJ4fDNfhO1HcgkjX53kpq9UeHEs4VoKVktA7BzC+l8lVyv3xi3vc/4HsXUDbksGMaCfUJh7jcmTWuWBArgi024oTiz5FILi4B/ESZd0Oz8Vq9jb4= 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 1705588701334150.0795874158266; Thu, 18 Jan 2024 06:38:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQTX0-00054h-UQ; Thu, 18 Jan 2024 09:38:10 -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 1rQTWn-0004yD-4T for qemu-devel@nongnu.org; Thu, 18 Jan 2024 09:37:58 -0500 Received: from mgamail.intel.com ([198.175.65.9]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQTWf-0004T0-Hf for qemu-devel@nongnu.org; Thu, 18 Jan 2024 09:37:52 -0500 Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2024 06:36:17 -0800 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa005.jf.intel.com with ESMTP; 18 Jan 2024 06:36:15 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705588669; x=1737124669; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QfOinMTK+1ht/wbdQeHTf0b3RVG46r8xv44ktE/vwyY=; b=W3J5p3/0PT/HWCsq3Sf7sODGzdoodPxtM/I3H6wmT5a8e7E0xIzEq39S 0kHErwihIBIsArPgb379pK/Tfl4cEnUPaYV/9fRnmWnr0w+ullXK7bl1Y qauh+uubvWWTs9+Ic7vzTKlm+RB7QPwelgC5HwHj4RnkLa2qcwwvBBpEQ i3k8MQcvHiW9GF+S/RK1/CF6na8SRntUYzAeA1UzwUunyGUE7bthlBhjp DdPhn2INkUtgfWs5foDuOmdxqq1AGXhKSzMSh4Oh8YqX2TUM/B6InjZHG O9pvAJV3EX2skLvSWb5LeVerqNzk+e61vVKVUwyLrbt44iY34O7CY+D/P w==; X-IronPort-AV: E=McAfee;i="6600,9927,10956"; a="19057182" X-IronPort-AV: E=Sophos;i="6.05,203,1701158400"; d="scan'208";a="19057182" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,203,1701158400"; d="scan'208";a="329334" From: Zhao Liu To: Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang Cc: qemu-devel@nongnu.org, Xiaoling Song , Zhao Liu Subject: [PATCH 4/8] tests/unit/test-smp-parse.c: Test "books" parameter in -smp Date: Thu, 18 Jan 2024 22:48:53 +0800 Message-Id: <20240118144857.2124034-5-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240118144857.2124034-1-zhao1.liu@linux.intel.com> References: <20240118144857.2124034-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.9; envelope-from=zhao1.liu@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.806, 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: 1705588702301100001 Content-Type: text/plain; charset="utf-8" From: Zhao Liu Although book was introduced to -smp along with drawer by s390 machine, as a general topology level in QEMU that may be reused by other arches in the future, it is desirable to cover this parameter's parsing in a separate case. Signed-off-by: Zhao Liu Reviewed-by: Thomas Huth Tested-by: Xiaoling Song --- tests/unit/test-smp-parse.c | 105 ++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index a8eb3bbb35ed..31f3f713e851 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -75,6 +75,22 @@ .has_maxcpus =3D hf, .maxcpus =3D f, \ } =20 +/* + * Currently a 5-level topology hierarchy is supported on s390 ccw machines + * -drawers/books/sockets/cores/threads + */ +#define SMP_CONFIG_WITH_BOOKS_DRAWERS(ha, a, hb, b, hc, c, hd, \ + d, he, e, hf, f, hg, g) \ + { \ + .has_cpus =3D ha, .cpus =3D a, \ + .has_drawers =3D hb, .drawers =3D b, \ + .has_books =3D hc, .books =3D c, \ + .has_sockets =3D hd, .sockets =3D d, \ + .has_cores =3D he, .cores =3D e, \ + .has_threads =3D hf, .threads =3D f, \ + .has_maxcpus =3D hg, .maxcpus =3D g, \ + } + /** * @config - the given SMP configuration * @expect_prefer_sockets - the expected parsing result for the @@ -308,6 +324,11 @@ static const struct SMPTestData data_generic_invalid[]= =3D { /* config: -smp 2,clusters=3D2 */ .config =3D SMP_CONFIG_WITH_CLUSTERS(T, 2, F, 0, T, 2, F, 0, F, 0,= F, 0), .expect_error =3D "clusters not supported by this machine's CPU to= pology", + }, { + /* config: -smp 2,books=3D2 */ + .config =3D SMP_CONFIG_WITH_BOOKS_DRAWERS(T, 2, F, 0, T, 2, F, + 0, F, 0, F, 0, F, 0), + .expect_error =3D "books not supported by this machine's CPU topol= ogy", }, { /* config: -smp 8,sockets=3D2,cores=3D4,threads=3D2,maxcpus=3D8 */ .config =3D SMP_CONFIG_GENERIC(T, 8, T, 2, T, 4, T, 2, T, 8), @@ -379,6 +400,26 @@ static const struct SMPTestData data_with_clusters_inv= alid[] =3D { }, }; =20 +static const struct SMPTestData data_with_books_invalid[] =3D { + { + /* config: -smp 16,books=3D2,sockets=3D2,cores=3D4,threads=3D2,max= cpus=3D16 */ + .config =3D SMP_CONFIG_WITH_BOOKS_DRAWERS(T, 16, F, 1, T, 2, T, + 2, T, 4, T, 2, T, 16), + .expect_error =3D "Invalid CPU topology: " + "product of the hierarchy must match maxcpus: " + "books (2) * sockets (2) * cores (4) * threads (2)= " + "!=3D maxcpus (16)", + }, { + /* config: -smp 34,books=3D2,sockets=3D2,cores=3D4,threads=3D2,max= cpus=3D32 */ + .config =3D SMP_CONFIG_WITH_BOOKS_DRAWERS(T, 34, F, 1, T, 2, T, + 2, T, 4, T, 2, T, 32), + .expect_error =3D "Invalid CPU topology: " + "maxcpus must be equal to or greater than smp: " + "books (2) * sockets (2) * cores (4) * threads (2)= " + "=3D=3D maxcpus (32) < smp_cpus (34)", + }, +}; + static char *smp_config_to_string(const SMPConfiguration *config) { return g_strdup_printf( @@ -618,6 +659,13 @@ static void machine_with_clusters_class_init(ObjectCla= ss *oc, void *data) mc->smp_props.clusters_supported =3D true; } =20 +static void machine_with_books_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + + mc->smp_props.books_supported =3D true; +} + static void test_generic_valid(const void *opaque) { const char *machine_type =3D opaque; @@ -761,6 +809,56 @@ static void test_with_clusters(const void *opaque) object_unref(obj); } =20 +static void test_with_books(const void *opaque) +{ + const char *machine_type =3D opaque; + Object *obj =3D object_new(machine_type); + MachineState *ms =3D MACHINE(obj); + MachineClass *mc =3D MACHINE_GET_CLASS(obj); + SMPTestData data =3D {}; + unsigned int num_books =3D 2; + int i; + + for (i =3D 0; i < ARRAY_SIZE(data_generic_valid); i++) { + data =3D data_generic_valid[i]; + unsupported_params_init(mc, &data); + + /* when books parameter is omitted, it will be set as 1 */ + data.expect_prefer_sockets.books =3D 1; + data.expect_prefer_cores.books =3D 1; + + smp_parse_test(ms, &data, true); + + /* when books parameter is specified */ + data.config.has_books =3D true; + data.config.books =3D num_books; + if (data.config.has_cpus) { + data.config.cpus *=3D num_books; + } + if (data.config.has_maxcpus) { + data.config.maxcpus *=3D num_books; + } + + data.expect_prefer_sockets.books =3D num_books; + data.expect_prefer_sockets.cpus *=3D num_books; + data.expect_prefer_sockets.max_cpus *=3D num_books; + data.expect_prefer_cores.books =3D num_books; + data.expect_prefer_cores.cpus *=3D num_books; + data.expect_prefer_cores.max_cpus *=3D num_books; + + smp_parse_test(ms, &data, true); + } + + for (i =3D 0; i < ARRAY_SIZE(data_with_books_invalid); i++) { + data =3D data_with_books_invalid[i]; + unsupported_params_init(mc, &data); + + smp_parse_test(ms, &data, false); + } + + object_unref(obj); +} + /* Type info of the tested machine */ static const TypeInfo smp_machine_types[] =3D { { @@ -785,6 +883,10 @@ static const TypeInfo smp_machine_types[] =3D { .name =3D MACHINE_TYPE_NAME("smp-with-clusters"), .parent =3D TYPE_MACHINE, .class_init =3D machine_with_clusters_class_init, + }, { + .name =3D MACHINE_TYPE_NAME("smp-with-books"), + .parent =3D TYPE_MACHINE, + .class_init =3D machine_with_books_class_init, } }; =20 @@ -808,6 +910,9 @@ int main(int argc, char *argv[]) g_test_add_data_func("/test-smp-parse/with_clusters", MACHINE_TYPE_NAME("smp-with-clusters"), test_with_clusters); + g_test_add_data_func("/test-smp-parse/with_books", + MACHINE_TYPE_NAME("smp-with-books"), + test_with_books); =20 g_test_run(); =20 --=20 2.34.1 From nobody Thu Nov 14 06:56:42 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=1705588767; cv=none; d=zohomail.com; s=zohoarc; b=SsYuAFAL+Fg2uJjWkPssIObXvEMIr8gI30J4chqTw9i+VjZn+us8nK9Uq9tlannHK9W9QpW/Zk8XCiMpHIQjqHh9IkzmYFVQNIVbjQBgu0HiSAqmcWL9GNJ8/iBcB7X7LNsLHTJuLy1gY+H9rV4abAkjN9WmEjdRT1uwPDqMCD8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705588767; 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=m3O8hWGUNEdQY2icFDRmUY6R4rB06sx29N5CVfE66JU=; b=gRy/QB7uzDSSW6Yqxzu0HA2Gc3wRXJzSX/bLDF/RVn2xzpmYeSalxQU71AsOCLwYyWdOX9gopJr47/yxZRRwDIsoXOQJkNPcOcRbWbM6qhlQ4D8oHcxpbAzhp5lH7I5vNiJNlW2lPh8Kpr2CTjAimEdr6MuEjnezN/3F9Ckdjo0= 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 1705588767098676.2747532501199; Thu, 18 Jan 2024 06:39:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQTX0-0004zX-BH; Thu, 18 Jan 2024 09:38:10 -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 1rQTWp-0004yl-Dn for qemu-devel@nongnu.org; Thu, 18 Jan 2024 09:38:00 -0500 Received: from mgamail.intel.com ([198.175.65.9]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQTWn-0004TI-2y for qemu-devel@nongnu.org; Thu, 18 Jan 2024 09:37:59 -0500 Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2024 06:36:19 -0800 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa005.jf.intel.com with ESMTP; 18 Jan 2024 06:36:17 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705588677; x=1737124677; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RDgYqj/XVdmu2RMnb6OR9L7CyP8Rr87nWaRWTDOGDU8=; b=XMbyJee3HsSWxrc5GWJvG9pzSATX/0QgrmsgprAVmDFMoELNYS9vnem2 vbbXm2jteZE3O+AJHYHJOSBhm/l9a+WEF17Rl+JkVtUJzXQq80VqOTSn2 +MdGWhK2oShsBOQYvrfwgtJXWBgBiR15HCvSu6+ukHT6g9Pm50Qz+5DvI o3kYA3WthBNIYeA+NNbbLNlwRR/z9XRt0M87p48ikDeZ+IwE1o0bGBh3F ZbX5OfKmvgxUGzZGUBXD+FR0PvaUpC7IRzMFGGIbH/QyfUMz9m3nQ2nfR /KxeOWb3SBImMKgp1FFX8FdAo3OyDHwlr0GmIzFRmjVE2tZBoC98TGWGV w==; X-IronPort-AV: E=McAfee;i="6600,9927,10956"; a="19057223" X-IronPort-AV: E=Sophos;i="6.05,203,1701158400"; d="scan'208";a="19057223" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,203,1701158400"; d="scan'208";a="329370" From: Zhao Liu To: Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang Cc: qemu-devel@nongnu.org, Xiaoling Song , Zhao Liu Subject: [PATCH 5/8] tests/unit/test-smp-parse.c: Test "drawers" parameter in -smp Date: Thu, 18 Jan 2024 22:48:54 +0800 Message-Id: <20240118144857.2124034-6-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240118144857.2124034-1-zhao1.liu@linux.intel.com> References: <20240118144857.2124034-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.9; envelope-from=zhao1.liu@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.806, 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: 1705588768561100004 Content-Type: text/plain; charset="utf-8" From: Zhao Liu Although drawer was introduced to -smp along with book by s390 machine, as a general topology level in QEMU that may be reused by other arches in the future, it is desirable to cover this parameter's parsing in a separate case. Signed-off-by: Zhao Liu Reviewed-by: Thomas Huth Tested-by: Xiaoling Song --- tests/unit/test-smp-parse.c | 89 +++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index 31f3f713e851..d59e220360d5 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -329,6 +329,11 @@ static const struct SMPTestData data_generic_invalid[]= =3D { .config =3D SMP_CONFIG_WITH_BOOKS_DRAWERS(T, 2, F, 0, T, 2, F, 0, F, 0, F, 0, F, 0), .expect_error =3D "books not supported by this machine's CPU topol= ogy", + }, { + /* config: -smp 2,drawers=3D2 */ + .config =3D SMP_CONFIG_WITH_BOOKS_DRAWERS(T, 2, T, 2, F, 0, F, + 0, F, 0, F, 0, F, 0), + .expect_error =3D "drawers not supported by this machine's CPU top= ology", }, { /* config: -smp 8,sockets=3D2,cores=3D4,threads=3D2,maxcpus=3D8 */ .config =3D SMP_CONFIG_GENERIC(T, 8, T, 2, T, 4, T, 2, T, 8), @@ -420,6 +425,26 @@ static const struct SMPTestData data_with_books_invali= d[] =3D { }, }; =20 +static const struct SMPTestData data_with_drawers_invalid[] =3D { + { + /* config: -smp 16,drawers=3D2,sockets=3D2,cores=3D4,threads=3D2,m= axcpus=3D16 */ + .config =3D SMP_CONFIG_WITH_BOOKS_DRAWERS(T, 16, T, 2, F, 1, T, + 2, T, 4, T, 2, T, 16), + .expect_error =3D "Invalid CPU topology: " + "product of the hierarchy must match maxcpus: " + "drawers (2) * sockets (2) * cores (4) * threads (= 2) " + "!=3D maxcpus (16)", + }, { + /* config: -smp 34,drawers=3D2,sockets=3D2,cores=3D4,threads=3D2,m= axcpus=3D32 */ + .config =3D SMP_CONFIG_WITH_BOOKS_DRAWERS(T, 34, T, 2, F, 1, T, + 2, T, 4, T, 2, T, 32), + .expect_error =3D "Invalid CPU topology: " + "maxcpus must be equal to or greater than smp: " + "drawers (2) * sockets (2) * cores (4) * threads (= 2) " + "=3D=3D maxcpus (32) < smp_cpus (34)", + }, +}; + static char *smp_config_to_string(const SMPConfiguration *config) { return g_strdup_printf( @@ -666,6 +691,13 @@ static void machine_with_books_class_init(ObjectClass = *oc, void *data) mc->smp_props.books_supported =3D true; } =20 +static void machine_with_drawers_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + + mc->smp_props.drawers_supported =3D true; +} + static void test_generic_valid(const void *opaque) { const char *machine_type =3D opaque; @@ -859,6 +891,56 @@ static void test_with_books(const void *opaque) object_unref(obj); } =20 +static void test_with_drawers(const void *opaque) +{ + const char *machine_type =3D opaque; + Object *obj =3D object_new(machine_type); + MachineState *ms =3D MACHINE(obj); + MachineClass *mc =3D MACHINE_GET_CLASS(obj); + SMPTestData data =3D {}; + unsigned int num_drawers =3D 2; + int i; + + for (i =3D 0; i < ARRAY_SIZE(data_generic_valid); i++) { + data =3D data_generic_valid[i]; + unsupported_params_init(mc, &data); + + /* when drawers parameter is omitted, it will be set as 1 */ + data.expect_prefer_sockets.drawers =3D 1; + data.expect_prefer_cores.drawers =3D 1; + + smp_parse_test(ms, &data, true); + + /* when drawers parameter is specified */ + data.config.has_drawers =3D true; + data.config.drawers =3D num_drawers; + if (data.config.has_cpus) { + data.config.cpus *=3D num_drawers; + } + if (data.config.has_maxcpus) { + data.config.maxcpus *=3D num_drawers; + } + + data.expect_prefer_sockets.drawers =3D num_drawers; + data.expect_prefer_sockets.cpus *=3D num_drawers; + data.expect_prefer_sockets.max_cpus *=3D num_drawers; + data.expect_prefer_cores.drawers =3D num_drawers; + data.expect_prefer_cores.cpus *=3D num_drawers; + data.expect_prefer_cores.max_cpus *=3D num_drawers; + + smp_parse_test(ms, &data, true); + } + + for (i =3D 0; i < ARRAY_SIZE(data_with_drawers_invalid); i++) { + data =3D data_with_drawers_invalid[i]; + unsupported_params_init(mc, &data); + + smp_parse_test(ms, &data, false); + } + + object_unref(obj); +} + /* Type info of the tested machine */ static const TypeInfo smp_machine_types[] =3D { { @@ -887,6 +969,10 @@ static const TypeInfo smp_machine_types[] =3D { .name =3D MACHINE_TYPE_NAME("smp-with-books"), .parent =3D TYPE_MACHINE, .class_init =3D machine_with_books_class_init, + }, { + .name =3D MACHINE_TYPE_NAME("smp-with-drawers"), + .parent =3D TYPE_MACHINE, + .class_init =3D machine_with_drawers_class_init, } }; =20 @@ -913,6 +999,9 @@ int main(int argc, char *argv[]) g_test_add_data_func("/test-smp-parse/with_books", MACHINE_TYPE_NAME("smp-with-books"), test_with_books); + g_test_add_data_func("/test-smp-parse/with_drawers", + MACHINE_TYPE_NAME("smp-with-drawers"), + test_with_drawers); =20 g_test_run(); =20 --=20 2.34.1 From nobody Thu Nov 14 06:56:42 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=1705588738; cv=none; d=zohomail.com; s=zohoarc; b=g3uoPXhuiiJTtrIKz6x/ICRhCLmE3rd+HA60HD3N1OYAptv8KWbwBFtbuCsO+DkQuu332QJJcVW5ACmpbwOjw0auacFPdwVzqOPSRb1Y718++gVfqjoakU0KJpX1cA0jnH9zpm/DfbmL8yKCB+XWaDahexruzKJciJcOHZrSv2I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705588738; 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=acmuyqBBVXInsZ9Je5EpL3wv50I/2zVNeCcWSI8Ux80=; b=n2DxfuaZYquY973xbAawYEm3Y1XmVS1tck4KhyPrsAt1vS0wxpBhRarhsckpkyXd9Uxg7dHruMgxEaFOBMuRqswQ0RvAVaVuw+5iu+x4JQWMHyrRO9JbUESm1xhVQ/8ywzTcJkMWJybglLsZtn5JzQo6ZdTzi3Mwgk6CxX7nEME= 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 1705588738743974.4141113269749; Thu, 18 Jan 2024 06:38:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQTX4-000572-R5; Thu, 18 Jan 2024 09:38:14 -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 1rQTWq-0004zI-Qt for qemu-devel@nongnu.org; Thu, 18 Jan 2024 09:38:02 -0500 Received: from mgamail.intel.com ([198.175.65.9]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQTWn-0004Sm-2x for qemu-devel@nongnu.org; Thu, 18 Jan 2024 09:38:00 -0500 Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2024 06:36:21 -0800 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa005.jf.intel.com with ESMTP; 18 Jan 2024 06:36:19 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705588677; x=1737124677; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=a/xabLPMBsdO48zQjvhZ0Bv6j9AKZrtM0IobJMO/WNE=; b=bLZ6WCCjNeFUsQM0izVQY/6bdzJiGUAS+l4psualWev7lXx5inCLLef/ UM4vzhbXrmh1ndIhP1F2iZKKA9Lu7NnylYS3aCunZfPb0LAmKp9lQ8041 Rf27Qfhh+QUYfskQDaWYUS8eK3oFFPl+QWN6CFRve5uYhg/Bulnp0bcWG PY5gRs/RkmLT/jMzRDGJi7Hk2HqviHv8OY2qdFKi1PcrI5hrXDXLLfo8t 2k3bl5w1rqL8EwG+LoE2U18EAECHMrvUo5qzsPEkyn4lwVXPf6XelxPX0 iymFYwNSyEJQGfFGbyrUXOqVXxof6jQVefepCdLQvcBq828JCmdwXAuYj A==; X-IronPort-AV: E=McAfee;i="6600,9927,10956"; a="19057277" X-IronPort-AV: E=Sophos;i="6.05,203,1701158400"; d="scan'208";a="19057277" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,203,1701158400"; d="scan'208";a="329390" From: Zhao Liu To: Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang Cc: qemu-devel@nongnu.org, Xiaoling Song , Zhao Liu Subject: [PATCH 6/8] tests/unit/test-smp-parse.c: Test "drawers" and "books" combination case Date: Thu, 18 Jan 2024 22:48:55 +0800 Message-Id: <20240118144857.2124034-7-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240118144857.2124034-1-zhao1.liu@linux.intel.com> References: <20240118144857.2124034-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.9; envelope-from=zhao1.liu@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.806, 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: 1705588740438100003 Content-Type: text/plain; charset="utf-8" From: Zhao Liu Since s390 machine supports both "drawers" and "books" in -smp, add the "drawers" and "books" combination test case to match the actual topology usage scenario. Signed-off-by: Zhao Liu Tested-by: Xiaoling Song --- tests/unit/test-smp-parse.c | 103 ++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index d59e220360d5..a1ef297248cd 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -445,6 +445,33 @@ static const struct SMPTestData data_with_drawers_inva= lid[] =3D { }, }; =20 +static const struct SMPTestData data_with_drawers_books_invalid[] =3D { + { + /* + * config: -smp 200,drawers=3D2,books=3D2,sockets=3D2,cores=3D4,\ + * threads=3D2,maxcpus=3D200 + */ + .config =3D SMP_CONFIG_WITH_BOOKS_DRAWERS(T, 200, T, 3, T, 5, T, + 2, T, 4, T, 2, T, 200), + .expect_error =3D "Invalid CPU topology: " + "product of the hierarchy must match maxcpus: " + "drawers (3) * books (5) * sockets (2) * " + "cores (4) * threads (2) !=3D maxcpus (200)", + }, { + /* + * config: -smp 242,drawers=3D2,books=3D2,sockets=3D2,cores=3D4,\ + * threads=3D2,maxcpus=3D240 + */ + .config =3D SMP_CONFIG_WITH_BOOKS_DRAWERS(T, 242, T, 3, T, 5, T, + 2, T, 4, T, 2, T, 240), + .expect_error =3D "Invalid CPU topology: " + "maxcpus must be equal to or greater than smp: " + "drawers (3) * books (5) * sockets (2) * " + "cores (4) * threads (2) " + "=3D=3D maxcpus (240) < smp_cpus (242)", + }, +}; + static char *smp_config_to_string(const SMPConfiguration *config) { return g_strdup_printf( @@ -698,6 +725,14 @@ static void machine_with_drawers_class_init(ObjectClas= s *oc, void *data) mc->smp_props.drawers_supported =3D true; } =20 +static void machine_with_drawers_books_class_init(ObjectClass *oc, void *d= ata) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + + mc->smp_props.drawers_supported =3D true; + mc->smp_props.books_supported =3D true; +} + static void test_generic_valid(const void *opaque) { const char *machine_type =3D opaque; @@ -941,6 +976,67 @@ static void test_with_drawers(const void *opaque) object_unref(obj); } =20 +static void test_with_drawers_books(const void *opaque) +{ + const char *machine_type =3D opaque; + Object *obj =3D object_new(machine_type); + MachineState *ms =3D MACHINE(obj); + MachineClass *mc =3D MACHINE_GET_CLASS(obj); + SMPTestData data =3D {}; + unsigned int num_drawers =3D 5, num_books =3D 3; + int i; + + for (i =3D 0; i < ARRAY_SIZE(data_generic_valid); i++) { + data =3D data_generic_valid[i]; + unsupported_params_init(mc, &data); + + /* + * when drawers and books parameters are omitted, they will + * be both set as 1. + */ + data.expect_prefer_sockets.drawers =3D 1; + data.expect_prefer_sockets.books =3D 1; + data.expect_prefer_cores.drawers =3D 1; + data.expect_prefer_cores.books =3D 1; + + smp_parse_test(ms, &data, true); + + /* when drawers and books parameters are both specified */ + data.config.has_drawers =3D true; + data.config.drawers =3D num_drawers; + data.config.has_books =3D true; + data.config.books =3D num_books; + + if (data.config.has_cpus) { + data.config.cpus *=3D num_drawers * num_books; + } + if (data.config.has_maxcpus) { + data.config.maxcpus *=3D num_drawers * num_books; + } + + data.expect_prefer_sockets.drawers =3D num_drawers; + data.expect_prefer_sockets.books =3D num_books; + data.expect_prefer_sockets.cpus *=3D num_drawers * num_books; + data.expect_prefer_sockets.max_cpus *=3D num_drawers * num_books; + + data.expect_prefer_cores.drawers =3D num_drawers; + data.expect_prefer_cores.books =3D num_books; + data.expect_prefer_cores.cpus *=3D num_drawers * num_books; + data.expect_prefer_cores.max_cpus *=3D num_drawers * num_books; + + smp_parse_test(ms, &data, true); + } + + for (i =3D 0; i < ARRAY_SIZE(data_with_drawers_books_invalid); i++) { + data =3D data_with_drawers_books_invalid[i]; + unsupported_params_init(mc, &data); + + smp_parse_test(ms, &data, false); + } + + object_unref(obj); +} + /* Type info of the tested machine */ static const TypeInfo smp_machine_types[] =3D { { @@ -973,6 +1069,10 @@ static const TypeInfo smp_machine_types[] =3D { .name =3D MACHINE_TYPE_NAME("smp-with-drawers"), .parent =3D TYPE_MACHINE, .class_init =3D machine_with_drawers_class_init, + }, { + .name =3D MACHINE_TYPE_NAME("smp-with-drawers-books"), + .parent =3D TYPE_MACHINE, + .class_init =3D machine_with_drawers_books_class_init, } }; =20 @@ -1002,6 +1102,9 @@ int main(int argc, char *argv[]) g_test_add_data_func("/test-smp-parse/with_drawers", MACHINE_TYPE_NAME("smp-with-drawers"), test_with_drawers); + g_test_add_data_func("/test-smp-parse/with_drawers_books", + MACHINE_TYPE_NAME("smp-with-drawers-books"), + test_with_drawers_books); =20 g_test_run(); =20 --=20 2.34.1 From nobody Thu Nov 14 06:56:42 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=1705588756; cv=none; d=zohomail.com; s=zohoarc; b=ansisXNp+YtLZigAmrES0cQ3nEHZp28OG0TU3LFAuUvTm/Hyr5XqSo6N2/cmb/5NEiXXPPLYP78IMh/GXRNSDrLjHetizqQcDzXBnH2hDicrepPwU7vgiX5Sq2+0sOXtpi63o6ih4/vN52FqeEdXPWTPqEoa+7edJA2zxJ2XVk4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705588756; 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=43sKxGdw6H3WdcVi0uiYLWdLV8xCFTTLZDPiHfEihrk=; b=XBEV2HAqeKt8tIKRmwAynnI3WgqVmFbPiX9Gli4bnVp8oCF3BtmUGJcT7ljuDkiY1bBeiJL6T72Tmd62N+hw0dmYfUURF4ZNQkELt7IP7bVoJio9H/g6WjsrUHZd4OsUZg6VSw3pGqdEd1iQuxQtPc14h+UAAB2lyJ21H3/SveY= 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 1705588756466148.24768344057134; Thu, 18 Jan 2024 06:39:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQTX1-000558-Ey; Thu, 18 Jan 2024 09:38:11 -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 1rQTWu-00050Q-SA for qemu-devel@nongnu.org; Thu, 18 Jan 2024 09:38:07 -0500 Received: from mgamail.intel.com ([198.175.65.9]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQTWo-0004T0-3Z for qemu-devel@nongnu.org; Thu, 18 Jan 2024 09:38:03 -0500 Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2024 06:36:23 -0800 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa005.jf.intel.com with ESMTP; 18 Jan 2024 06:36:22 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705588678; x=1737124678; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=v8gztxmwWpVKZMQIrDxcR5RTygr41UByzroyGNYPL3c=; b=nGB2ltW30t0RvWWyjoydnOND7DPQGyg+SLHL0bzxjh/2UjrJjifNzNtP Q5cTKi24vqyI1KujaRX4RL/LQqXS7mDCt0Cod752LeLldOXjE3oPYCnKn 0RAiEqpdTPIj0Z+PGLE4RgQixjRKfc7egrsrkIV/KR+ZZVXoGkLSQGNyz pxEItb8R/1zHmfyqsofxVyzH3Xh9vydhUvhBAovHjdcHP4uaYqBfYdxDa RS16jVyDEzEfY8BS14xh5YAY5vKT0oGH7WTlqIgHmya9BUoLmTLe65+Ky xmSWeghflJINHxl34ix0tGpr00OKCZxmmy1TrBLag+2mBj0+dDM7hPB+t A==; X-IronPort-AV: E=McAfee;i="6600,9927,10956"; a="19057303" X-IronPort-AV: E=Sophos;i="6.05,203,1701158400"; d="scan'208";a="19057303" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,203,1701158400"; d="scan'208";a="329410" From: Zhao Liu To: Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang Cc: qemu-devel@nongnu.org, Xiaoling Song , Zhao Liu Subject: [PATCH 7/8] tests/unit/test-smp-parse.c: Test the full 7-levels topology hierarchy Date: Thu, 18 Jan 2024 22:48:56 +0800 Message-Id: <20240118144857.2124034-8-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240118144857.2124034-1-zhao1.liu@linux.intel.com> References: <20240118144857.2124034-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.9; envelope-from=zhao1.liu@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.806, 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: 1705588758499100003 Content-Type: text/plain; charset="utf-8" From: Zhao Liu Currently, -smp supports up to 7-levels topology hierarchy: -drawers/books/sockets/dies/clusters/cores/threads. Though no machine supports all these 7 levels yet, these 7 levels have the strict containment relationship and together form the generic CPU topology representation of QEMU. Also, note that the maxcpus is calculated by multiplying all 7 levels: maxcpus =3D drawers * books * sockets * dies * clusters * cores * threads. To cover this code path, it is necessary to test the full topology case (with all 7 levels). This also helps to avoid introducing new issues by further expanding the CPU topology in the future. Signed-off-by: Zhao Liu Acked-by: Thomas Huth Tested-by: Xiaoling Song --- tests/unit/test-smp-parse.c | 143 ++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index a1ef297248cd..1d1f10b4faf0 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -91,6 +91,24 @@ .has_maxcpus =3D hg, .maxcpus =3D g, \ } =20 +/* + * Currently QEMU supports up to a 7-level topology hierarchy, which is the + * QEMU's unified abstract representation of CPU topology. + * -drawers/books/sockets/dies/clusters/cores/threads + */ +#define SMP_CONFIG_WITH_FULL_TOPO(a, b, c, d, e, f, g, h, i) \ + { \ + .has_cpus =3D true, .cpus =3D a, \ + .has_drawers =3D true, .drawers =3D b, \ + .has_books =3D true, .books =3D c, \ + .has_sockets =3D true, .sockets =3D d, \ + .has_dies =3D true, .dies =3D e, \ + .has_clusters =3D true, .clusters =3D f, \ + .has_cores =3D true, .cores =3D g, \ + .has_threads =3D true, .threads =3D h, \ + .has_maxcpus =3D true, .maxcpus =3D i, \ + } + /** * @config - the given SMP configuration * @expect_prefer_sockets - the expected parsing result for the @@ -472,6 +490,40 @@ static const struct SMPTestData data_with_drawers_book= s_invalid[] =3D { }, }; =20 +static const struct SMPTestData data_full_topo_invalid[] =3D { + { + /* + * config: -smp 200,drawers=3D3,books=3D5,sockets=3D2,dies=3D4,\ + * clusters=3D2,cores=3D7,threads=3D2,maxcpus=3D200 + */ + .config =3D SMP_CONFIG_WITH_FULL_TOPO(200, 3, 5, 2, 4, 2, 7, 2, 20= 0), + .expect_error =3D "Invalid CPU topology: " + "product of the hierarchy must match maxcpus: " + "drawers (3) * books (5) * sockets (2) * dies (4) = * " + "clusters (2) * cores (7) * threads (2) " + "!=3D maxcpus (200)", + }, { + /* + * config: -smp 3361,drawers=3D3,books=3D5,sockets=3D2,dies=3D4,\ + * clusters=3D2,cores=3D7,threads=3D2,maxcpus=3D3360 + */ + .config =3D SMP_CONFIG_WITH_FULL_TOPO(3361, 3, 5, 2, 4, 2, 7, 2, 3= 360), + .expect_error =3D "Invalid CPU topology: " + "maxcpus must be equal to or greater than smp: " + "drawers (3) * books (5) * sockets (2) * dies (4) = * " + "clusters (2) * cores (7) * threads (2) " + "=3D=3D maxcpus (3360) < smp_cpus (3361)", + }, { + /* + * config: -smp 1,drawers=3D3,books=3D5,sockets=3D2,dies=3D4,\ + * clusters=3D2,cores=3D7,threads=3D3,maxcpus=3D5040 + */ + .config =3D SMP_CONFIG_WITH_FULL_TOPO(3361, 3, 5, 2, 4, 2, 7, 3, 5= 040), + .expect_error =3D "Invalid SMP CPUs 5040. The max CPUs supported " + "by machine '" SMP_MACHINE_NAME "' is 4096", + }, +}; + static char *smp_config_to_string(const SMPConfiguration *config) { return g_strdup_printf( @@ -733,6 +785,16 @@ static void machine_with_drawers_books_class_init(Obje= ctClass *oc, void *data) mc->smp_props.books_supported =3D true; } =20 +static void machine_full_topo_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + + mc->smp_props.drawers_supported =3D true; + mc->smp_props.books_supported =3D true; + mc->smp_props.dies_supported =3D true; + mc->smp_props.clusters_supported =3D true; +} + static void test_generic_valid(const void *opaque) { const char *machine_type =3D opaque; @@ -1037,6 +1099,80 @@ static void test_with_drawers_books(const void *opaq= ue) object_unref(obj); } =20 +static void test_full_topo(const void *opaque) +{ + const char *machine_type =3D opaque; + Object *obj =3D object_new(machine_type); + MachineState *ms =3D MACHINE(obj); + MachineClass *mc =3D MACHINE_GET_CLASS(obj); + SMPTestData data =3D {}; + unsigned int drawers =3D 5, books =3D 3, dies =3D 2, clusters =3D 7, m= ultiplier; + int i; + + multiplier =3D drawers * books * dies * clusters; + for (i =3D 0; i < ARRAY_SIZE(data_generic_valid); i++) { + data =3D data_generic_valid[i]; + unsupported_params_init(mc, &data); + + /* + * when drawers, books, dies and clusters parameters are omitted, + * they will be set as 1. + */ + data.expect_prefer_sockets.drawers =3D 1; + data.expect_prefer_sockets.books =3D 1; + data.expect_prefer_sockets.dies =3D 1; + data.expect_prefer_sockets.clusters =3D 1; + data.expect_prefer_cores.drawers =3D 1; + data.expect_prefer_cores.books =3D 1; + data.expect_prefer_cores.dies =3D 1; + data.expect_prefer_cores.clusters =3D 1; + + smp_parse_test(ms, &data, true); + + /* when drawers, books, dies and clusters parameters are specified= . */ + data.config.has_drawers =3D true; + data.config.drawers =3D drawers; + data.config.has_books =3D true; + data.config.books =3D books; + data.config.has_dies =3D true; + data.config.dies =3D dies; + data.config.has_clusters =3D true; + data.config.clusters =3D clusters; + + if (data.config.has_cpus) { + data.config.cpus *=3D multiplier; + } + if (data.config.has_maxcpus) { + data.config.maxcpus *=3D multiplier; + } + + data.expect_prefer_sockets.drawers =3D drawers; + data.expect_prefer_sockets.books =3D books; + data.expect_prefer_sockets.dies =3D dies; + data.expect_prefer_sockets.clusters =3D clusters; + data.expect_prefer_sockets.cpus *=3D multiplier; + data.expect_prefer_sockets.max_cpus *=3D multiplier; + + data.expect_prefer_cores.drawers =3D drawers; + data.expect_prefer_cores.books =3D books; + data.expect_prefer_cores.dies =3D dies; + data.expect_prefer_cores.clusters =3D clusters; + data.expect_prefer_cores.cpus *=3D multiplier; + data.expect_prefer_cores.max_cpus *=3D multiplier; + + smp_parse_test(ms, &data, true); + } + + for (i =3D 0; i < ARRAY_SIZE(data_full_topo_invalid); i++) { + data =3D data_full_topo_invalid[i]; + unsupported_params_init(mc, &data); + + smp_parse_test(ms, &data, false); + } + + object_unref(obj); +} + /* Type info of the tested machine */ static const TypeInfo smp_machine_types[] =3D { { @@ -1073,6 +1209,10 @@ static const TypeInfo smp_machine_types[] =3D { .name =3D MACHINE_TYPE_NAME("smp-with-drawers-books"), .parent =3D TYPE_MACHINE, .class_init =3D machine_with_drawers_books_class_init, + }, { + .name =3D MACHINE_TYPE_NAME("smp-full-topo"), + .parent =3D TYPE_MACHINE, + .class_init =3D machine_full_topo_class_init, } }; =20 @@ -1105,6 +1245,9 @@ int main(int argc, char *argv[]) g_test_add_data_func("/test-smp-parse/with_drawers_books", MACHINE_TYPE_NAME("smp-with-drawers-books"), test_with_drawers_books); + g_test_add_data_func("/test-smp-parse/full", + MACHINE_TYPE_NAME("smp-full-topo"), + test_full_topo); =20 g_test_run(); =20 --=20 2.34.1 From nobody Thu Nov 14 06:56:42 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=1705588742; cv=none; d=zohomail.com; s=zohoarc; b=YhRqwipnG3NB4uFSS7UqmHwc1LUt4JfS7NuRXuBJv0ovAPrdwWg0p/4HiDyVK6ACVfFYHgSIQ+xaKDYqZVx9k9SB+hJxEcPh+2V7YG48wjKJh2o7A2IaUpllsbqKVXVs0hHwgY/2oCJZe3SJCQT03RNOajLb8YgtkimbWs8a9aw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705588742; 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=fExvlV01C/i9bdMnQ/sh624LzQeol8fhS1uxJvzdZIw=; b=IYGW9rp03tOxRfn9ehukikP24HLgRfAe+tVf9W/LuDFHrN5nQBHuu1BcE9NgU9uGqHjN7FX/gN2WxFtvaH3yy45PIoytP76PNQD9xOJ1RPvcvO+PLTYuBRiJ8nwafRhu/Dm0O5CTtGzmeoVJCmb0nw8XoRAnZWR51PI7JAjmQoQ= 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 170558874266848.25600677029422; Thu, 18 Jan 2024 06:39:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQTX2-00055j-8B; Thu, 18 Jan 2024 09:38:12 -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 1rQTWt-0004zb-73 for qemu-devel@nongnu.org; Thu, 18 Jan 2024 09:38:05 -0500 Received: from mgamail.intel.com ([198.175.65.9]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQTWr-0004TI-5q for qemu-devel@nongnu.org; Thu, 18 Jan 2024 09:38:02 -0500 Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2024 06:36:25 -0800 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa005.jf.intel.com with ESMTP; 18 Jan 2024 06:36:24 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705588681; x=1737124681; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=puRksK45xSTrVV4ALj1HMgknReXjDrc3DoIKDgHTG+E=; b=F/3O2kxGozAjsdEibvTo/O+gxT12MwaD7xZ71OpB1dWcCUPpzpc7WQtT 6jaclthHuuhjy0p9y2pBDi4SS/xdvQuEltZ0hmQHkFFAu9EQtMLa7BY/4 f6h8JvgnDqrl9isSdhyma/sJI+mxh2iQqNMM5xLlmE3LY4zPRxWNn1Uaa vJ5ifcdWV6mjgAUT8mm+Ol5ZLl7s7zt8eypCGPVgiD9XYQiaRcoTDLzFR 4LOZ2OlZ2GGZzVL50V2qXjmzaNv6CNZF69XMqRgQGoBOhcCqkrjKedhcc qf4Jd9WxH+hQG7LW3Eo8KiwoMDuczQVRa60zCOtUlyX40EbU1XFBOOT/4 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10956"; a="19057338" X-IronPort-AV: E=Sophos;i="6.05,203,1701158400"; d="scan'208";a="19057338" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,203,1701158400"; d="scan'208";a="329428" From: Zhao Liu To: Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang Cc: qemu-devel@nongnu.org, Xiaoling Song , Zhao Liu Subject: [PATCH 8/8] tests/unit/test-smp-parse.c: Test smp_props.has_clusters Date: Thu, 18 Jan 2024 22:48:57 +0800 Message-Id: <20240118144857.2124034-9-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240118144857.2124034-1-zhao1.liu@linux.intel.com> References: <20240118144857.2124034-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.9; envelope-from=zhao1.liu@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.806, 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: 1705588744431100003 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 Acked-by: Thomas Huth Tested-by: Xiaoling Song --- 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 1d1f10b4faf0..bc55af96f30d 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