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 D211B45B5D; Thu, 17 Oct 2024 13:03:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8243540652; Thu, 17 Oct 2024 13:03:12 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2065.outbound.protection.outlook.com [40.107.93.65]) by mails.dpdk.org (Postfix) with ESMTP id 34F1540279 for ; Thu, 17 Oct 2024 13:03:10 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WizenAD04Q/K3KpkiSEEJTQolA0k47PRyIMaVRCOSY0wUeKT7QTPRfJkFh1p2j8whXLUadndfz5Xpx60A5DdyWlTENHk3cK95iCidoCeTTgWq4xVIU1bZDbuL4WVgOqAyp9aYTNYN5+S/OQdZe35lUz4u4zteBv0QgcXpMqRJLc4hG80QVfI6z27BkgtQWAh4amPaM6jYUuxGS1k3lV7dEvvLbsjqUrKwBDVamZfCU4XOJTKSZicEoYGqBd4Bf1qAvr169F8NnfHkqf7BFQzVDCWE4crW6oebJv2PlCNjX7wA/Fy7yPpS/O/FIxgR6P52cszZLB4qhTqFvup1SxrGg== 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=Qrrd/UuAUUGI5UtttnZFN8OvbgKuy//xhJVqpLl1TNggxzbmeIwoIvkT+tjSRrDuDKMRVhPxMfF3fBKukufbaOVB8gb1g2tCk1Pv52T9GrDkdm4XNEqsbNjknlvHatIbT7Jbfe1lO5To7HOl3woyNR6ufzHhFj72gvXjQP5ne7FO9/wv4+SnB3RwHP2JU5u2F/gSADvSnRRFviCyJjEu6wG4Qj56UGF89ByO5DQc3zFBEcolgqhmpKNVVdi3bokyxDZcOTJiOdlYCIH+O7y8QkQVtzhmi6SgGJq1YWrLW4GU7IshjriDlNSaYCF8HRzBmKOOOUedHefPJQlCUccdng== 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=mtjNOLmsby/wgnIPTAy67RHAlfr15Hlq/8fjP6l7z2AdR23XKtNKK2SWvbdBVu1PwxiQRaPVJyyCqMeh9BBtvmEfrbU4z20SX6fxCiVUBK/8of0RTf+lpSYeiyt4UtQpJDTJeC+5TgcO/R6+33wWWM39UDardoRVZnVgPCEY1l0= Received: from BN8PR04CA0057.namprd04.prod.outlook.com (2603:10b6:408:d4::31) by SA3PR12MB7998.namprd12.prod.outlook.com (2603:10b6:806:320::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Thu, 17 Oct 2024 11:03:07 +0000 Received: from BL02EPF00021F69.namprd02.prod.outlook.com (2603:10b6:408:d4:cafe::58) by BN8PR04CA0057.outlook.office365.com (2603:10b6:408:d4::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.20 via Frontend Transport; Thu, 17 Oct 2024 11:03:06 +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 BL02EPF00021F69.mail.protection.outlook.com (10.167.249.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8069.17 via Frontend Transport; Thu, 17 Oct 2024 11:03:06 +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 06:03:04 -0500 From: Sivaprasad Tummala To: , , , , , , , CC: Subject: [PATCH v1 2/2] test/power: fix power library with --lcores Date: Thu, 17 Oct 2024 11:02:47 +0000 Message-ID: <20241017110247.1051770-2-sivaprasad.tummala@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241017110247.1051770-1-sivaprasad.tummala@amd.com> References: <20240724130336.1076462-1-sivaprasad.tummala@amd.com> <20241017110247.1051770-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: BL02EPF00021F69:EE_|SA3PR12MB7998:EE_ X-MS-Office365-Filtering-Correlation-Id: bb589959-c7eb-4d29-46ff-08dcee9b479a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?FlaRcPvTXz9qFQ96ZKjaDstYYrdpiNv3ZPcmzrCDUG8DWBcQDEdEaBVxUbPe?= =?us-ascii?Q?5ZOTT2RWf2sA2mtRMcsWJeR3mtrm8pKNA/Q1ogHfh7qVA9ZZXPOhLpj1sZ6P?= =?us-ascii?Q?lbzZHTHHnOKXQymweHuH3MSmK1jh1zTA79TNlxAh2TCeJ4PXxUKvk4LG87Nw?= =?us-ascii?Q?dvO4IVyZqpAd5c3t8QqjA54qMfOujacUpmluB5sSHgayUbb+8gI+zy1dKyv8?= =?us-ascii?Q?+hhkCHmcO9SsbOfpizmVxCBgxnxMdjqRPpy5vdRvw1Uoc6AStNUWsOmC9U57?= =?us-ascii?Q?tjgwfZqAmdlnO9WpMqc01FT20wrYqWsVDp0gerUh3Q8tOiBG0FxaIbo35hzx?= =?us-ascii?Q?yVJDJov4/g6BaDBV10/74JvvfXkrSviP0n0Hf1Qla0nxvdkuS4muQvJcptOG?= =?us-ascii?Q?McWEve8aVyJBWixAQhqB80zONSMgUv3RU7Ohy+hIwYGAXcZU1ujqIISriaBI?= =?us-ascii?Q?7wHV2k230d3MHzamMhhlSzcngEPFo7rG3aiXx6CZCZzPXMd1UzynXkiLLwLs?= =?us-ascii?Q?EgzRMUevesMmq3ezw6/KYAi6TG9L5LuGpf7VFLx2pMeIWfxhxcvAXPwASHqF?= =?us-ascii?Q?alQzq8x6YqNeMEOlYAaBvbvyWx5eQn9i7d5HTd8Qv2HfB7zOWHNTKfBea9Ud?= =?us-ascii?Q?Fn7TljPq2fIV0nP97BIP7oLJt9icRsdVYGfpwBk+skq8tERQdiL0MTBzlfCj?= =?us-ascii?Q?sDdDU8oVl9f1Ju7jt3DdV0rjVyyfzz2rnAZ43iokdLnXsPTbQwjF2mxH/8w3?= =?us-ascii?Q?dZcjWqAlTGutxzfU4rtnxrsceFK+WlVrpvhWZyh1IU846ckkNOYwGK9Qi8q6?= =?us-ascii?Q?IoTaH5wtKHG6tDH2n/2XYgoCZatSXi5Qkwdlspe0XCykmEm1N2hfsX9xVfom?= =?us-ascii?Q?gsXHgz900IeHnOC7G8BYuPKe4w8tfcAmMEPLyCmI6zjsbBANXEI75ktCo61F?= =?us-ascii?Q?t+NNXZM9kWi1rP1wJW1NYnk5iHpTWY1jCdAyX/MpINCbMuHH2i2YziuWsXqZ?= =?us-ascii?Q?s14oigaUH5SQPyUbWeJwfw2QhIWQc028eJFqwcN46KK+T3t8CBHGcoTW5oQs?= =?us-ascii?Q?0LONSWblVm1gV0yHJIbMJ1jiGOO8lUZ61AIYfxzrghhjL/Pr8qG3/EPo4nUE?= =?us-ascii?Q?xOC9llotDKE6C+42WKoMD6UaP1bL6N0yRRhgNLxxmVZtit/R2zR8jZDwXlA2?= =?us-ascii?Q?+GuePOz0uCfV3sB5zjH8Kv9DLUEA5EzPXhdhVOLXXfg7newVZZoaudz9owd2?= =?us-ascii?Q?MtLDqxDFjl5Y9QG/tHnBBCVpn7zJKiHNNANFs0KaoEz0dy50sWctXt8Ifdnw?= =?us-ascii?Q?4ZjSXwd/7tMLYZqt4X+1/m5X7+zAerI73w5E4uKEzHJOtDMsrbtvRViGwDbp?= =?us-ascii?Q?Q9YyJO2U0SfztYoBJfL6pyOEqgR2k8wtcymZWLnYSMlLpyV+ew=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)(82310400026)(36860700013)(376014)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2024 11:03:06.7777 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bb589959-c7eb-4d29-46ff-08dcee9b479a 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: BL02EPF00021F69.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7998 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