From nobody Wed Feb 11 01:09:06 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710012703; cv=none; d=zohomail.com; s=zohoarc; b=Tt5FwYh57/lTALtTQsJrz7aVbDM9wKtrCQ+BjCCDzEvx1Zrfn5LDJC1ASSS8Zd1WM+NHaa9Rb1Nx0y6XJSLHQ4o597W0lfnsDjpbE2QsVbWDyc82b4+P+Otw73rW5eR/gwtfLJZ5o6Fb32sza6/5MWx63Q+aOURUcPp/JDjzVdw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710012703; h=Content-Type: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=O8i9QPEOlWhmU7xWF5BCURrysJXNiI85mOLr+pl+Sq0=; b=mn/bmyd3Yf5/JpwsRxFMvFp7/L9xohtr0IrBOMhB9iEZ0dAuYZhaLb7FG8kZv1me5W4OjURLBlsIFdEqL/7TGqOhmKsinXbwWv7ygEsKwb7IU2SjAu9pqCccs6crPNiKbfT7NyTdhlD2cj8CkJuW488Ycz2o+VIWrGmU6y9vgRo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1710012703986431.22488494366337; Sat, 9 Mar 2024 11:31:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rj2Lh-00012V-FM; Sat, 09 Mar 2024 14:27:13 -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 1rj2KR-0007Qj-5m for qemu-devel@nongnu.org; Sat, 09 Mar 2024 14:26:03 -0500 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rj2KP-0003OS-HI for qemu-devel@nongnu.org; Sat, 09 Mar 2024 14:25:54 -0500 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a4604c8bd61so45709166b.2 for ; Sat, 09 Mar 2024 11:25:52 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.237]) by smtp.gmail.com with ESMTPSA id lr1-20020a170906fb8100b00a442e2940fdsm1186112ejb.179.2024.03.09.11.25.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 09 Mar 2024 11:25:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710012351; x=1710617151; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=O8i9QPEOlWhmU7xWF5BCURrysJXNiI85mOLr+pl+Sq0=; b=y4zrCr6NEJnj7wLuGdTWAvRnxx1fixFoDxypupMViHonccW3SwDnTGeJdGvu3+mzPk Kzf5h7ottiBT01ztt/V8/cXhSXfxjZ/be5eoNh3MZRBTrwqpr0jGGJhwZjd57wlyQcMq 3n+XEHhxy9/3K/zLEP8PbS1X4El+1X/KEUzT2viklt02T0nlDXerB283M/aQhplOgsS3 bF69AaDWEvKc+QL3uX4eU5PKqlw33hbnxRG4lRV0MGmZWR4YtE5beW76cI6FhhVvIZq4 3zXoUPXQuJwhFPXGrNiLZNiqD2heIUzXML7VqInfDn5Z7BTpQEt9MZ9rzzRZgMer+wIj k9mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710012351; x=1710617151; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O8i9QPEOlWhmU7xWF5BCURrysJXNiI85mOLr+pl+Sq0=; b=PqIriR2bn7YFzUHJtgomHRyIh8cYHokhoAM8VtVLAfGRG2C1yvhxvSyAynUM1Ap5aZ XXjvuXPzUzOOEbubjvnS72zgEH1SdtvILOo9RMdu0ZLuZlcJuPzDIgbVCLnYWr05P0vk JQlm9skbfSfWTSZRmPK822y+w1rND+xl2J/IXvdTTkP1xpsv7aHfIy4e4+ahMDuhYcM2 FeCJU2M/MzwQNcMYd0HYWsOXS2kRjJkrrus60gKNI1yd50sZKX+29Eli/RDCZLaaOrQ5 kJ9n1loPOBLdQatRZlI05RfBZ+WDEQUhnmt+jZjWURM1cQgKahSWcxvnVRVaeaCYpC+3 x6zw== X-Gm-Message-State: AOJu0YwsJTtL6goT3yY7eTCNZRuMYxjWt2ilIWm56EQ3S+8dO7YSa2BO 4amYlWzyzMAx6hdPLfsVOciHnk3n6DpuTbLa+I8cuMSfqyYzxsX92oC/bIUc5QVP99F9VjRPgPX 9 X-Google-Smtp-Source: AGHT+IHPWCYsTTLJR3Y5I7K9wr+9PlPTMOFzDgbyILfwcOWY9+UAhabN+Yjbc55cmBThQVWEk8mPng== X-Received: by 2002:a17:906:390:b0:a45:9347:e3d6 with SMTP id b16-20020a170906039000b00a459347e3d6mr1362000eja.66.1710012351548; Sat, 09 Mar 2024 11:25:51 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Zhao Liu , Xiaoling Song , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang Subject: [PULL 36/43] tests/unit/test-smp-parse: Make test cases aware of the book/drawer Date: Sat, 9 Mar 2024 20:22:03 +0100 Message-ID: <20240309192213.23420-37-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240309192213.23420-1-philmd@linaro.org> References: <20240309192213.23420-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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: pass client-ip=2a00:1450:4864:20::635; envelope-from=philmd@linaro.org; helo=mail-ej1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @linaro.org) X-ZM-MESSAGEID: 1710012705394100006 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 Message-ID: <20240308160148.3130837-8-zhao1.liu@linux.intel.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 2eb9533bc5..f656bbb6da 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.41.0