From nobody Wed Nov 13 07:13:07 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 --- 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