From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 18E1745B67; Fri, 18 Oct 2024 05:35:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A3DEB4027C; Fri, 18 Oct 2024 05:35:10 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2055.outbound.protection.outlook.com [40.107.244.55]) by mails.dpdk.org (Postfix) with ESMTP id 6554D40265 for ; Fri, 18 Oct 2024 05:35:08 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kLS37k4GM6GtxpgMfC0sOb/eKShAzKDb3S/6Vc+q1uc6ln55sB/rcTeD732Y8EprwIEzLMy+k9DdS6h6tqYKcuQ9V0MIOPyBTB4Ul6voEspOzQcmVPN1uZuYcYsV8zfctEZkhWEV4bQZt7wbHGdbp+/hZME3j5AdkV51QjRp8XBvVnvN4gEN/zhU90KbydZ/5Qf468byJBT9QLfDi73jNNrba2VLe9wiE7ddlC9JPvPvPjk7Z0mNbeYpMuwEMPm+iV8c2H+Bjprta05UffMXtyzuPdCq44UhO6OTQUt1rLBk6rIAHK+wLQ46ByyMLkpSNh5WEgU61Vem6Flo43HgjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=M1XRvbiQrriS+UZ1MLE1uNj6Xa3HwDoMzdKkse7kvpc=; b=r0ffENSCOSsH1x38fgez2wwkfmRxxmwOx3zyl+ki5nZM4b0sgIUWrBjMjizp3n+CoFyuxV2aytApedFGAJpAIah5JuP68Wu8UQ+OAdpxD0wQ5KguCkZZEw7Wyf5iolPH2dEqkzLTVRlfN3PJHKD7aps4nglJoikC+mNTLAH4jvG7iOv0soMKKJB4+jjnhrTGbOZQmoA9UVPCP7Y/nSBuSNx7klKZlmjr4gji46UmIMlLF40J9284rJZZu1o0FsHil2EUqaJtT2R28+uOh4vltdZ6Z5lkv0m90dCj5SpeUXnBoHvP2MYgk/x7R56sP5Xxe3psQpOTQ7BCqrBMHN4VMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=M1XRvbiQrriS+UZ1MLE1uNj6Xa3HwDoMzdKkse7kvpc=; b=WHo/8dTupS9ypbizdLOO4XczNOeZZhfOUhgkkA5OIcakKptimbKdJUB6FOjHHvE+sCh62ppL3mfi/bSqtBp6vXxbKcy5BQXEsvUnJShxajTX37hWgZnJNofSBrFUO8p0TZ4AX6L9ztISYfiS77tnX8xXs8KYpGjUdK8rZ88bm5U= Received: from PH0P220CA0024.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:d3::29) by SN7PR12MB7451.namprd12.prod.outlook.com (2603:10b6:806:29b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17; Fri, 18 Oct 2024 03:35:04 +0000 Received: from CY4PEPF0000EE3C.namprd03.prod.outlook.com (2603:10b6:510:d3:cafe::7b) by PH0P220CA0024.outlook.office365.com (2603:10b6:510:d3::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.24 via Frontend Transport; Fri, 18 Oct 2024 03:35:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000EE3C.mail.protection.outlook.com (10.167.242.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Fri, 18 Oct 2024 03:35:04 +0000 Received: from jfw9ny3-os.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 17 Oct 2024 22:34:53 -0500 From: Sivaprasad Tummala To: , , , , , , , CC: , Huisong Li Subject: [PATCH v2 2/2] test/power: fix power library with --lcores Date: Fri, 18 Oct 2024 03:34:35 +0000 Message-ID: <20241018033435.1305782-2-sivaprasad.tummala@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241018033435.1305782-1-sivaprasad.tummala@amd.com> References: <20241017110247.1051770-1-sivaprasad.tummala@amd.com> <20241018033435.1305782-1-sivaprasad.tummala@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE3C:EE_|SN7PR12MB7451:EE_ X-MS-Office365-Filtering-Correlation-Id: 0176fc30-3658-4d69-ed8d-08dcef25dae6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?jnQ6GctSXbxLnJ8L1cl7OEDhMn5qDL+paFZ7YH0ujbUi5D38NcrIP0DNdomt?= =?us-ascii?Q?YTogzOLrhl7039E2Gm5xbvnXsKfM7IaV17e/B+BOw+U8QiI0qKPbsDwhE4Aj?= =?us-ascii?Q?SvHLly0hxdAFW2q0TfuElFiWZKNctM9BunqUOmpT8SGqsjaYdJBEGsYW+gXU?= =?us-ascii?Q?stJcpKs2p98I3Uuv19f9OMmiQzkOAmcyesUlUoSuvODTOFK1P3amX8htA638?= =?us-ascii?Q?ifhTJznyN8ac3zEJ++l4gjSjzGjYlTYA2xPIJOgVJeQx4q29vemaN8RSlzRi?= =?us-ascii?Q?SU0a6RVuXeLblb5/MhYaTZ08WPnKZQxdeiC9qWHIivfrWjfrxUpBwY+2hBVa?= =?us-ascii?Q?tgq/51jRWKGUF2U7oz1Wf6VTfRFOEjY3CQ9VikhxIjH6V3vX2fI1rKprXPwE?= =?us-ascii?Q?1kgFWu3i48nbVt6pD/QIHq+HIi1QiXYpauXIJqv0iN6VHuF3E5Yw9FHKZGIJ?= =?us-ascii?Q?Wn5WkPSKxU2a/yi3/Yz7AFsrhI/WYmg5GNYL5nI0qBLzt7/K+l+KYJ4F3GGe?= =?us-ascii?Q?XTFEF5hCeF1rGTO/neLy0tFWoTyblIDFygyui76sm2c+SjEi/x74gm6bbLir?= =?us-ascii?Q?IUnNor0ml/0TU3QNzXXccc+nOilhDqxSnMuNK7LkOLwpOfWlXh9G9+FycHNy?= =?us-ascii?Q?ZTwMTdrlrd+VxtK9GWygKuzK36zV/qFotRc2j7y8KPvAb1HqE5BI73lE1+aD?= =?us-ascii?Q?aNBG9/lgmmCgXgFSMjjUi1lvdAS+PbqPBKjxczSO6PtBNOB2nNw1F7E4uxHg?= =?us-ascii?Q?NWoiZ5Dci9rXMb4Ww1EgnQi0dKZ3/3P0lcWsRSOmLLWbFcDNQ5cAQz369dET?= =?us-ascii?Q?jwNjgff6yeyekQsk5GiWdaQfkdj78pcE+ipeZvo8YQKqqxMQWDbAP9E7g4NQ?= =?us-ascii?Q?/d0mjhmoyInKFCavHdsh813dhiQR1sDvF0mUXsj2Mo5uBc9jmrhTfIfdT64r?= =?us-ascii?Q?MoH7OxM4qbR/ar6zmV3MSZKS+J2z77EDCrCcsCTyE6/Jtzy/qgx6W55gma2y?= =?us-ascii?Q?/atzRAzFlCuByaBWWv7h/tofYKzvgDijN+XniXtzVsn0s1t5IzBR289a3Veo?= =?us-ascii?Q?WO1zorFmzAZo6pm6yzz13o+v+Y3VhA06cVZwiunoTb6sBQrWdPVH2QTGQisL?= =?us-ascii?Q?ex5ndqGKaotBC5OUYD783UKo1fo9pIc2yaNcjnwZnS2iO/sIAqow47QxQmn7?= =?us-ascii?Q?Cco73YkJLqFlyhXK2r1+R6vokztRncNoAzSwWpb4pElTljvsdAjv1ec7IGJ9?= =?us-ascii?Q?GhYMhqSCwUjt1l74Eu3t96x6XxEQRvDGddEVvfM6GVBCpxxL2/3yaHkbVtfH?= =?us-ascii?Q?0YokhoRjUl7c/itK+bthmjxQXDEuGTskKU2UGN8lspIFeZNwsIJXHIWiafra?= =?us-ascii?Q?bXaAkm7AVJOlPu3jCyjyndp47K135pDrrxBb2FsnOm3Gh2hZlA=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700013)(376014)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2024 03:35:04.3444 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0176fc30-3658-4d69-ed8d-08dcef25dae6 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EE3C.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7451 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org When user request to use lcores mapped to different physical cores using --lcores eal option, power application accesses incorrect cpu sysfs attribute for checking current frequency The patch fixes the cpu_id based on the lcore and cpu mappings. Signed-off-by: Sivaprasad Tummala Acked-by: Huisong Li --- app/test/test_power_cpufreq.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/app/test/test_power_cpufreq.c b/app/test/test_power_cpufreq.c index 619b2811c6..63d13614df 100644 --- a/app/test/test_power_cpufreq.c +++ b/app/test/test_power_cpufreq.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "test.h" @@ -46,9 +47,10 @@ test_power_caps(void) static uint32_t total_freq_num; static uint32_t freqs[TEST_POWER_FREQS_NUM_MAX]; +static uint32_t cpu_id; static int -check_cur_freq(unsigned int lcore_id, uint32_t idx, bool turbo) +check_cur_freq(__rte_unused unsigned int lcore_id, uint32_t idx, bool turbo) { #define TEST_POWER_CONVERT_TO_DECIMAL 10 #define MAX_LOOP 100 @@ -62,13 +64,13 @@ check_cur_freq(unsigned int lcore_id, uint32_t idx, bool turbo) int i; if (snprintf(fullpath, sizeof(fullpath), - TEST_POWER_SYSFILE_CPUINFO_FREQ, lcore_id) < 0) { + TEST_POWER_SYSFILE_CPUINFO_FREQ, cpu_id) < 0) { return 0; } f = fopen(fullpath, "r"); if (f == NULL) { if (snprintf(fullpath, sizeof(fullpath), - TEST_POWER_SYSFILE_SCALING_FREQ, lcore_id) < 0) { + TEST_POWER_SYSFILE_SCALING_FREQ, cpu_id) < 0) { return 0; } f = fopen(fullpath, "r"); @@ -497,6 +499,20 @@ test_power_cpufreq(void) { int ret = -1; enum power_management_env env; + rte_cpuset_t lcore_cpus; + + lcore_cpus = rte_lcore_cpuset(TEST_POWER_LCORE_ID); + if (CPU_COUNT(&lcore_cpus) != 1) { + printf("Power management doesn't support " + "lcore %u mapping to %u cpus\n", + TEST_POWER_LCORE_ID, + CPU_COUNT(&lcore_cpus)); + return TEST_SKIPPED; + } + for (cpu_id = 0; cpu_id < CPU_SETSIZE; cpu_id++) { + if (CPU_ISSET(cpu_id, &lcore_cpus)) + break; + } /* Test initialisation of a valid lcore */ ret = rte_power_init(TEST_POWER_LCORE_ID); -- 2.34.1