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 66E6EA0A02; Tue, 6 Apr 2021 05:33:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 24784406A2; Tue, 6 Apr 2021 05:33:42 +0200 (CEST) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10077.outbound.protection.outlook.com [40.107.1.77]) by mails.dpdk.org (Postfix) with ESMTP id 5AE084068B; Tue, 6 Apr 2021 05:33:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xSSy8xkRln3RuOjsH0hLx3aA4jsZTBFRKZSNJ8xaE5A=; b=lAKW2gnRuMik5ldxd9mpu2eUTYBiWU76/2oOambTF89GdG1KpmMP5h6qTDB+SkGt1jw5iu7Hix3de4iKwU72Fdtm/735e3uFNlWs+yNimL9x+Qw6WOV2N2265EjCQSr9NCDgTuTvCmw+lNcqjXQHF/C3TXHVvJkfdyiBeeCyuGM= Received: from AM5PR0402CA0002.eurprd04.prod.outlook.com (2603:10a6:203:90::12) by AM0PR08MB4115.eurprd08.prod.outlook.com (2603:10a6:208:12e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27; Tue, 6 Apr 2021 03:33:40 +0000 Received: from AM5EUR03FT014.eop-EUR03.prod.protection.outlook.com (2603:10a6:203:90:cafe::74) by AM5PR0402CA0002.outlook.office365.com (2603:10a6:203:90::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27 via Frontend Transport; Tue, 6 Apr 2021 03:33:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=timeout (key query timeout) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT014.mail.protection.outlook.com (10.152.16.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.29 via Frontend Transport; Tue, 6 Apr 2021 03:33:38 +0000 Received: ("Tessian outbound 700fd1fc53d5:v90"); Tue, 06 Apr 2021 03:33:38 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 27b04337da7d281b X-CR-MTA-TID: 64aa7808 Received: from fa939379b1ce.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 08CE261D-B0FF-48DB-9852-AB86524B69BF.1; Tue, 06 Apr 2021 03:33:31 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id fa939379b1ce.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 06 Apr 2021 03:33:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UKJCnWgzZWndJ+x91vpV7sVJ8EP0oXx4Hq6ovt381WU0Qjhh9fwuv2pX9KOtEjtT92gPhUZkcq8yaTP+yCl65YB8eXNc6hX/HNEgKVRN+uKycsMIAFpfOVupufE0dFJyZ9Kp+n3JwpyNd5Y7FaY1EPrmjmtT9Rmh7FUAGQowKGuzeXNZGJqA8DhRfNimrqDmwaM8K1+jpSVdhDlTWmijOlZ2G3yk6yrEEpWZuwBpwmhjjK1l0tn37iD/4aHHixnuhTeRCmDCtD11xDYtOtb9UixQ2M+hHQbQDhTK5/+gqecbj4XDxCxQWGoDx47Eey7aI2/TWD5VOlb6IX0grkyv1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xSSy8xkRln3RuOjsH0hLx3aA4jsZTBFRKZSNJ8xaE5A=; b=eFmdQgIcn5TC7y9gxlL7+mLVubLuqA4Slv7X0m9lshlw+2NMKxdVZPBEJnuaLWv4VXhXuZNFupv4wyOxOHrcu6UGg9J8fjifrZxj/U8nLSDNa7OdNs4RhhnfwuB/2E0Pvw9gjy1ji8Au1zqureR1U1iC0xRb0IEHz/jJ7g3i9hRA/A4HAm3L0RJ9zneF2ofXROeZKL9N6p+bcXPDb9pfU/AxTPxDkspIB/2UKdArP4+lE5nRXD99GbwXDhSoBh0y3I7evXpcPATbN/ojT4kLEhEFg5qTSkEAH8Y+4o/5dlnG/ZV4XA6XPOm704L5bfOgTFEmVE6s87wq5tzzbtjGkw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=dpdk.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xSSy8xkRln3RuOjsH0hLx3aA4jsZTBFRKZSNJ8xaE5A=; b=lAKW2gnRuMik5ldxd9mpu2eUTYBiWU76/2oOambTF89GdG1KpmMP5h6qTDB+SkGt1jw5iu7Hix3de4iKwU72Fdtm/735e3uFNlWs+yNimL9x+Qw6WOV2N2265EjCQSr9NCDgTuTvCmw+lNcqjXQHF/C3TXHVvJkfdyiBeeCyuGM= Received: from AM3PR07CA0096.eurprd07.prod.outlook.com (2603:10a6:207:6::30) by DB7PR08MB3705.eurprd08.prod.outlook.com (2603:10a6:10:78::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27; Tue, 6 Apr 2021 03:33:30 +0000 Received: from VE1EUR03FT056.eop-EUR03.prod.protection.outlook.com (2603:10a6:207:6:cafe::f4) by AM3PR07CA0096.outlook.office365.com (2603:10a6:207:6::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.8 via Frontend Transport; Tue, 6 Apr 2021 03:33:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT056.mail.protection.outlook.com (10.152.19.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3999.29 via Frontend Transport; Tue, 6 Apr 2021 03:33:29 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 6 Apr 2021 03:33:28 +0000 Received: from wls-arm-cavium06.shanghai.arm.com (10.169.206.120) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Tue, 6 Apr 2021 03:33:26 +0000 From: Richael Zhuang To: CC: , , David Hunt , Pablo de Lara Date: Tue, 6 Apr 2021 11:33:20 +0800 Message-ID: <20210406033321.36618-1-richael.zhuang@arm.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 949944f1-77b7-419a-9988-08d8f8acc4ac X-MS-TrafficTypeDiagnostic: DB7PR08MB3705:|AM0PR08MB4115: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8273;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: A4aZ5Vseodojco6r45fItabfTooV8Pr0bKO6yjc+tQe6EAGHaKS/JE8/YW0g1pjK95DVtO9cM3rSr/Xu+myv8DilUj5xcYyiz6qAwdQODgZjcBeaM1DkV9JjgL+bm8m+P6sdvsWCXhnRDLbiJeLGdcDFu4GtVXtPV/k9gkf+OwOnZ11IlgMLKTIdEsMRrtRF1O+Tp2a1qdFG1GKbmCSbo8vjSUVvsiogMnZbkymEZWy+DrzZJ6w4f07Jq+owMoTr1lqw16eJiFHjOoMqMU6CPnuCAqmBibjSJ8oEanNwZfeBoQ1UyM/wP87xdokBlWnLM60PHVz4YKCoLPJPoxZZa8Si4vL4/WoY1JSE5UoCOhGgEUxbk3uMmxOAT6kgpw/V5GhAj2yGd9hzo5TeDln9/bGICNcH2vOanAKljIfGAcOP5BsYXiPbhaV7SojtSAA85/a2pJssds0yUsAMo1W94C2A2aa/FsMgBJOds8ajIzXuw0HA/+JTk+97LjY7zJ85lKyvtGc01w6ykcQFeazR94kWMUNW7m71qyxg3SPvj5ifwLuY5pd0IZW/UPdPrTQTnceZjUhhdxVtRnaz5qRM0oRrZiADd8IBln7UNm2stFdR5AAW0xPHABjxhwy7A48XjLVBGJy09PQsDpv4qHK4EgaXChk9qHg1POQBZzF5WuYzPV4OSRPQPxWA6zH+1Mvm X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(396003)(136003)(346002)(376002)(39860400002)(46966006)(36840700001)(36860700001)(44832011)(82740400003)(86362001)(8676002)(356005)(8936002)(7696005)(316002)(426003)(478600001)(1076003)(83380400001)(5660300002)(336012)(70206006)(54906003)(2616005)(82310400003)(2906002)(81166007)(36756003)(47076005)(186003)(6916009)(4326008)(70586007)(26005)(6666004)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3705 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT014.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 9f368adf-5d52-40f2-cb10-08d8f8acbf30 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: q+Krzei+APcQH+2WLwICo4xqUGjxOW5PcSaYySPOxpFAnyi9CtQynZ6od8mCEFUO6BRCTM84wkCDxFCYK0nXxS9SE8LkkSkjsan2/r5WIRwg6bEnjVk0nyal/3MwnCEmHoOYi7wb4RDFMB9QjgzEZBbR6NW87WTPUUBMpAt0IT8Uz5zlG8/oEOYZV1+mhQS8xB0dvS9G2d8SnYHPup8jcAYRsoLl+TDorIB026VEDDn55vNVf2Df/xb9FlU6QdvdIeaIy/lrjB2IgdQ+SN22JM4TzSeHjLwVRCABFwxquJ+pF0amHhnhebzN/whyZz/KtQbTbFdBs23o/XqfHmhMayXOVdjq/x6qX87GDPJqKZrFA+WkdGGeUNNfXYxb+QbMUjqRKZathKDMgHk52LVXNwCHDBSN0yQulbnFExgmfNcHvL+XMnbP5sDGRlT5d8LnyrqUuaSg02FtXgWGYPHgoxao93l1bULOp+ZQVUqX+NREb3X6OLNFGR6V8l066Ho8tjBc+xXQ/P+LSvAVgcdEeXXQaeGCt5IB604jXLbkanivTAAEeMy0Zzmc9s1eVamnyck7cXuuYrlIJ73/svI6sP14HNUroJlnfMg7Doek3pEgmlZjt6Es2zd3Cmbh3mhFgW+QiZBkzsW3sKB/Q5es9A== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(376002)(136003)(39860400002)(346002)(396003)(36840700001)(46966006)(186003)(107886003)(7696005)(36860700001)(82740400003)(26005)(86362001)(426003)(8936002)(6666004)(8676002)(316002)(2906002)(336012)(478600001)(6916009)(450100002)(83380400001)(44832011)(2616005)(36756003)(54906003)(1076003)(70586007)(5660300002)(70206006)(81166007)(47076005)(82310400003)(4326008); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 03:33:38.9834 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 949944f1-77b7-419a-9988-08d8f8acc4ac X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT014.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4115 Subject: [dpdk-dev] [PATCH v1 1/1] test/power: fix several bugs in cpufreq autotest 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 Sender: "dev" 1. Sleep for 1s before checking the newly updated value from "/sys/devices/system/cpu/cpu%u/cpufreq/cpuinfo_cur_freq", because for some systems it may not be effective immediately. 2. The value in "/sys/.../cpuinfo_cur_freq" may not be exactly the same as what we set. For example, we write "2400000" to "/sys/.../cpufreq/scaling_setspeed" to set the frequency, then the value in "/sys/.../cpuinfo_cur_freq" may be "2401222". So need to round the value. Fixes: ed7c51a6a680 ("app/test: vm power management") Cc: alan.carew@intel.com Cc: stable@dpdk.org Signed-off-by: Richael Zhuang --- app/test/test_power_cpufreq.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/app/test/test_power_cpufreq.c b/app/test/test_power_cpufreq.c index 731c6b4dc..c4f4541ac 100644 --- a/app/test/test_power_cpufreq.c +++ b/app/test/test_power_cpufreq.c @@ -34,6 +34,10 @@ test_power_caps(void) #define TEST_POWER_LCORE_INVALID ((unsigned)RTE_MAX_LCORE) #define TEST_POWER_FREQS_NUM_MAX ((unsigned)RTE_MAX_LCORE_FREQS) +/* macros used for rounding frequency to nearest 100000 */ +#define TEST_FREQ_ROUNDING_DELTA 50000 +#define TEST_ROUND_FREQ_TO_N_100000 100000 + #define TEST_POWER_SYSFILE_CUR_FREQ \ "/sys/devices/system/cpu/cpu%u/cpufreq/cpuinfo_cur_freq" @@ -43,6 +47,9 @@ static uint32_t freqs[TEST_POWER_FREQS_NUM_MAX]; static int check_cur_freq(unsigned lcore_id, uint32_t idx) { + /* wait for the value to be updated */ + sleep(1); + #define TEST_POWER_CONVERT_TO_DECIMAL 10 FILE *f; char fullpath[PATH_MAX]; @@ -62,7 +69,17 @@ check_cur_freq(unsigned lcore_id, uint32_t idx) goto fail_get_cur_freq; } cur_freq =3D strtoul(buf, NULL, TEST_POWER_CONVERT_TO_DECIMAL); - ret =3D (freqs[idx] =3D=3D cur_freq ? 0 : -1); + + /* convert the frequency to nearest 100000 value + * Ex: if cur_freq=3D1396789 then freq_conv=3D1400000 + * Ex: if cur_freq=3D800030 then freq_conv=3D800000 + */ + unsigned int freq_conv =3D 0; + freq_conv =3D (cur_freq + TEST_FREQ_ROUNDING_DELTA) + / TEST_ROUND_FREQ_TO_N_100000; + freq_conv =3D freq_conv * TEST_ROUND_FREQ_TO_N_100000; + + ret =3D (freqs[idx] =3D=3D freq_conv ? 0 : -1); fail_get_cur_freq: fclose(f); -- 2.20.1 IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.