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 2BDDD456A1; Wed, 24 Jul 2024 15:04:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D298F4339C; Wed, 24 Jul 2024 15:04:01 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2069.outbound.protection.outlook.com [40.107.220.69]) by mails.dpdk.org (Postfix) with ESMTP id 6009A40E3E for ; Wed, 24 Jul 2024 15:03:59 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FG3kcCAk7HSY4qiz8mLjZyPgby3OmFx2NzOpoNqASY8tVVF7ghTKXYkjX1Bio0u6z82oTNuhBYUR1VB7acgQLTma5j+D1+EnVU+/mKmFYherS8WGEdS+DRPvQpiiq7ZBzcE7t8zJgFRCHCVKfKHG98ZJ3rl7i12gVW0MYZJh8rC6QgmvXOEqs2y7aU66yZCCEjhADMKyn6CA+GYMIWuk6xl8cWK5ycR/lNqKd1WYso877jHgOMNW5dz+AnV/AIuHhwkKWES5q5oYmsjnI0ut7ebAZkRS8Wx7v3kqnR9ZZwNlRNwpQJ5SYmr3CIk64+IsbgcjyRz62F9Uw53lKcP9Eg== 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=xOK6O5NboOvcAbHmib5HYpmAT2ZhZMeA+jYBbaZdhE4=; b=ouJPbn3T+/Dl7E+sb3S24Ygi5ccLEZAn7vmumKxofSCzI3nlfJKfiRcHzwRU5m+LqY6Nj7u56gfw9266V9ir0g8VX6LrGVlx5XSnxvb/88xF9SlgaYLlR3a/qHJ7Mu34tFQJ3csS0HqZIMBvzg3TmjDJQhUZFGROrioU9a2yL/VNfT9QZWsm3JehcQ2YMX5IDu0g6ZRMSPpC+i65R8cL8wdvAByL3PmAZ1Kq2dtTznMFXoNV9826WXsq14MXO3wy6zkT0hsVOl7bcRNe2rII4H5+HFs9M6smkEC5nPZ/gGUdona7VNkp0wU1oblRxsEiciVdHRZ21VpMf0gHoAPMSw== 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=xOK6O5NboOvcAbHmib5HYpmAT2ZhZMeA+jYBbaZdhE4=; b=0EKQzRpbx4wK6R6PHDs/0I8x2UitZPXuMf8zNQySGdFdIdKNRdX0ou0pARbBcADTcIOLMXnq6FrNQJmROW3e0h0naKfOHY+J466nXiwA963MTWNFRptwEV22NSU6omfca6Ova9tL4EUm+LVUsUqF+SaelCGKirEocWE5eUFZaAw= Received: from SN7PR04CA0087.namprd04.prod.outlook.com (2603:10b6:806:121::32) by SA1PR12MB6969.namprd12.prod.outlook.com (2603:10b6:806:24c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Wed, 24 Jul 2024 13:03:56 +0000 Received: from SN1PEPF00036F42.namprd05.prod.outlook.com (2603:10b6:806:121:cafe::3b) by SN7PR04CA0087.outlook.office365.com (2603:10b6:806:121::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20 via Frontend Transport; Wed, 24 Jul 2024 13:03:56 +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 SN1PEPF00036F42.mail.protection.outlook.com (10.167.248.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7784.11 via Frontend Transport; Wed, 24 Jul 2024 13:03:56 +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; Wed, 24 Jul 2024 08:03:53 -0500 From: Sivaprasad Tummala To: , , , , CC: Subject: [RFC PATCH 2/2] test/power: fix power library with --lcores Date: Wed, 24 Jul 2024 13:03:36 +0000 Message-ID: <20240724130336.1076462-2-sivaprasad.tummala@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240724130336.1076462-1-sivaprasad.tummala@amd.com> References: <20240724130336.1076462-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: SN1PEPF00036F42:EE_|SA1PR12MB6969:EE_ X-MS-Office365-Filtering-Correlation-Id: fca906a2-6bd7-4d14-7f64-08dcabe113a7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?bJ4kdPAdhIXntdeuhROSZVifDq5pxQpSGDdOlKzwYuVugTmxUl1LjwFyhY7R?= =?us-ascii?Q?brzohz2tM8mnR57iK94IhulvLMKnCyJLSWZmuXFDN9m9zOFlA0wbddlui5eO?= =?us-ascii?Q?5DBQxCbI9VxhLYMgT92wzK9Tpb2CfiLUXuo8XqsY+gzqOB0GHQwUHlcx8wXl?= =?us-ascii?Q?0WibVY8+qba14gEfX9QQWovIi7Lmg5dyEvA4WzZk82sRBIRssBjWb4Awib6D?= =?us-ascii?Q?14aS6CG2V84j6hJdB0kYJPze8HBbGkieYMBrEmXNMhJFn4qBmrHdGwhl2rxm?= =?us-ascii?Q?rNq+RJXQMja5Ek+Rvv6umtt2sSBLOWutJQEaNNRhAcy0Wv1pqs0taQ+Yg7xo?= =?us-ascii?Q?ygYjUPOMGb0miMiN2M72aXE3dB6lSmobdFoO5xEKYvVvG0nuI2CLWpirJK6f?= =?us-ascii?Q?UUIsxMuoNBP+AcT8L82aF78TDfx4dlOntaFd1HTmd8snni7SszAM3bHgZGsE?= =?us-ascii?Q?Lho6IGVbN6ZYmVZjDDD0bQjSh5IYJ/MUiOOj6kSo+9eym7EHAvo/HpPh4c59?= =?us-ascii?Q?VhbwQ4vBCmv+vsILDgDtmRHh2PvceBDPxL3LAWich2AklEtnO9nEjvv+BDc1?= =?us-ascii?Q?+r2jaDc7wkp5nv2fHaig+hkF/sSFxHtjFh26HOddWQnFv75KUe0S7Efp+rcg?= =?us-ascii?Q?lDdTaRQ45+6uFmHxbeeUMiYnVXz9MrkUNH4TSLqJThma2yURqkf4mTvtU6Pf?= =?us-ascii?Q?45/K10Oqfin3hxAMGgjw+4s6uE/Ts0HcH4Nsgq7qxAvgSdzd6psvVBeuBXVq?= =?us-ascii?Q?V65xeA435zgQkLiLWztg1a320auyQoQkzCpyQirp5KfMR9wiy2OjktIfatsh?= =?us-ascii?Q?MDFG8oc/qKlxe/58gkm3Ea4WUMSUCdPKcRQNIdSms8Mq7JSEHU4XcYy1wVSR?= =?us-ascii?Q?fanlEm67fAXsQiMDweh3TRnL9oEj4ObgMOLFTtJWZHEWc6Qqu6J8lxxMW5Sb?= =?us-ascii?Q?d2t/Iov2h/RLYOcOTeXaaYbTPx8e/I8WxUnTnp/+EqfQvp+ikyn38+3O45t/?= =?us-ascii?Q?oV3lAIuSy51q9yIX5puLpbacAuYVbc/jRLnDKSuLrdCLQMJewg/nafQwne6n?= =?us-ascii?Q?rj3vEsyNcvOroUD1s9rWMKnmF3wlMkzXQpI0rGKwRKbzQswYbI6BD/C5yhVc?= =?us-ascii?Q?sGjwLTlyrIfejh+nIiH2kXm2WFVi/zvw1sGvIP0q9YV+4GXrHBajrJDGGiz9?= =?us-ascii?Q?/35VxP0PcqRcAAeuypxgzybPFtsKpLma7iLn0U+qqXf7bB1q461M/vACOfyr?= =?us-ascii?Q?WMQHfI9W0mlovxwdVztaexbypGQtCAfVSZe0CrumM8gOLPqgod4Xw6muWZE3?= =?us-ascii?Q?pc2G9saGGHW26xIuWHNBnmDGHztZuJls1BEBTGIqbbR5bKwTwaBPLd8euDxU?= =?us-ascii?Q?63MebNr+mjUfx3zvkQvUr6XD3/eTeinA3R0UMhA80S37w31zGdXkO2c3LH9E?= =?us-ascii?Q?xF8Ey3Uq4oKnsNSyHjb7JnWnoZBlWkyN?= 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)(82310400026)(376014)(1800799024)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2024 13:03:56.4409 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fca906a2-6bd7-4d14-7f64-08dcabe113a7 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: SN1PEPF00036F42.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6969 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 --- 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