From patchwork Sat Mar 9 19:22:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 779186 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp853506wrt; Sat, 9 Mar 2024 11:31:43 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVrN84zlJJtz9r354mpg9wvPgu8OECX0j4DrlcrPv1AT56ZU/RoDWPbO1KKQRKDI304bMTFP3U0Zbh6A3M4y6HC X-Google-Smtp-Source: AGHT+IGSwty6p4Rzf6majUkaLKrZoORCRgxLWGC96apUezl0CS90rbExqB0U5TY85RSf5QS6M/L9 X-Received: by 2002:a0c:e2d0:0:b0:690:c678:fa00 with SMTP id t16-20020a0ce2d0000000b00690c678fa00mr1706357qvl.8.1710012703753; Sat, 09 Mar 2024 11:31:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1710012703; cv=none; d=google.com; s=arc-20160816; b=f+Cu12LKcNZ+mxroJiT7gKYqwnsNuPFfXZjxi+l0wd2fQgaTM+Fe1F9LKz78LBraN4 hytpOtLxXzINXZJxasC8Phj+jA2E0ddVToe8tqJEqQfBDX3YH7FGmYVy53d3NZhozh6/ 3BA+hDW4TGEjcnJn35uLiEzdZVMtpQN1QaYcxaT/XPmSlf/EB3SFQY0qU/nkQul7II4m Kmf1JNq5L/Fx6Uw0CyGF4JF1KYmCVhgPAVq8Mr23FFG5xDD7iQnvpbuzjNQFzNWf1mvI B34WQdncAX6qDH/kVM3gtrxe/ed2tIiHn+KAWpO4FB0NKvppDCvDmlFxBS6Q2Jft33TR 7Mjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=O8i9QPEOlWhmU7xWF5BCURrysJXNiI85mOLr+pl+Sq0=; fh=MRpuvAMiIDngljO/1ktWIu7Kho7sXmLGHrYdpgFbLRA=; b=TOxgtAOKkAHs0ygPjKFneHqJt0DdQRlKaOwoMoSh5m5+/0w/yHe1/zXSh7SehVegqD Xb1w0REbzNc6Da0TjOjjBKnAKTna8BI2vhj4ArgyqSeY1FHnaawl8tp7kneYBbBgpgK8 4RaMO3h8YwgDVaQt0t2mUFdXHLvPKRa3RzyO6gUpr6WTqFC3ymmMj7Rh/s+GEqArjh0D ulhHwhVsotxvogT208gYnl//9eGNwVwMKu0gHg2Bvt6RoMTLYnZlxLK8VHEGCA8aFPsf XqmGibBNKY08PqdolsPX6uEcDXcVDQRrvfWjYC4K9fxManvIm7ukwbWJDk4ohxnFggqr E4cQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y4zrCr6N; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id fo15-20020ad45f0f000000b0068f3624fa5fsi2142197qvb.302.2024.03.09.11.31.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Mar 2024 11:31:43 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y4zrCr6N; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-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_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- 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 SMPConfiguration *config) return g_strdup_printf( "(SMPConfiguration) {\n" " .has_cpus = %5s, cpus = %" PRId64 ",\n" + " .has_drawers = %5s, drawers = %" PRId64 ",\n" + " .has_books = %5s, books = %" PRId64 ",\n" " .has_sockets = %5s, sockets = %" PRId64 ",\n" " .has_dies = %5s, dies = %" PRId64 ",\n" " .has_clusters = %5s, clusters = %" PRId64 ",\n" @@ -392,6 +394,8 @@ static char *smp_config_to_string(const SMPConfiguration *config) " .has_maxcpus = %5s, maxcpus = %" 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 SMPConfiguration *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->sockets; } } @@ -429,6 +433,8 @@ static char *cpu_topology_to_string(const CpuTopology *topo, return g_strdup_printf( "(CpuTopology) {\n" " .cpus = %u,\n" + " .drawers = %u,\n" + " .books = %u,\n" " .sockets = %u,\n" " .dies = %u,\n" " .clusters = %u,\n" @@ -438,7 +444,8 @@ static char *cpu_topology_to_string(const CpuTopology *topo, " .threads_per_socket = %u,\n" " .cores_per_socket = %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 SMPConfiguration *config, if (is_valid) { if ((err == NULL) && (ms->smp.cpus == expect_topo->cpus) && + (ms->smp.drawers == expect_topo->drawers) && + (ms->smp.books == expect_topo->books) && (ms->smp.sockets == expect_topo->sockets) && (ms->smp.dies == expect_topo->dies) && (ms->smp.clusters == expect_topo->clusters) && @@ -564,6 +573,16 @@ static void unsupported_params_init(const MachineClass *mc, SMPTestData *data) data->expect_prefer_sockets.clusters = 1; data->expect_prefer_cores.clusters = 1; } + + if (!mc->smp_props.books_supported) { + data->expect_prefer_sockets.books = 1; + data->expect_prefer_cores.books = 1; + } + + if (!mc->smp_props.drawers_supported) { + data->expect_prefer_sockets.drawers = 1; + data->expect_prefer_cores.drawers = 1; + } } static void machine_base_class_init(ObjectClass *oc, void *data)