From patchwork Tue Apr 6 06:39:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richael Zhuang X-Patchwork-Id: 90591 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 82F8AA0A02; Tue, 6 Apr 2021 08:39:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1300F406A2; Tue, 6 Apr 2021 08:39:49 +0200 (CEST) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150048.outbound.protection.outlook.com [40.107.15.48]) by mails.dpdk.org (Postfix) with ESMTP id DE7014068B; Tue, 6 Apr 2021 08:39:47 +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=gqWyfZOB9Qz8tlP59S5bGx1Yx1lrqmS0eagIOL+GPFLVrUe5fc0r+QtiBwOhHUD6wwpfcaKOzryym1/PuChZx3GxDIfKr8hqldLGIdtwPByOURlkqrDjpPF+Iym3qDUemJrQxmcw/FIk3qodYgeQZFepH9J3EHosb493PGD6XSI= Received: from DB6PR07CA0105.eurprd07.prod.outlook.com (2603:10a6:6:2c::19) by VI1PR08MB5293.eurprd08.prod.outlook.com (2603:10a6:803:df::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.26; Tue, 6 Apr 2021 06:39:45 +0000 Received: from DB5EUR03FT006.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:2c:cafe::e7) by DB6PR07CA0105.outlook.office365.com (2603:10a6:6:2c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.11 via Frontend Transport; Tue, 6 Apr 2021 06:39:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) 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 DB5EUR03FT006.mail.protection.outlook.com (10.152.20.106) 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 06:39:45 +0000 Received: ("Tessian outbound 82c2d58b350b:v90"); Tue, 06 Apr 2021 06:39:45 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 228c20e838eedc01 X-CR-MTA-TID: 64aa7808 Received: from 5bc240bf31bf.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 04C2069E-3D6F-415B-A4B4-281312304911.1; Tue, 06 Apr 2021 06:39:39 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5bc240bf31bf.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 06 Apr 2021 06:39:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FHxasHIqdj/c9mFOPCD/Lpwfo//Qdkkf5Po8SMQIvUbZKNyrB/Jp8PXWuMvspEZ7wBT2XYoSFam3d+sPszMDpuAMECZzf9MpOwoEV44aNL5i9bOyQz8nFYhkzFIj5GObXQL7+67wWVcbC/UE1Ft7a9F5SAujlNCZGSEM3cZ7aw4gRh3kAFzp8Sb1h6OLr5cdfLrL08RfaBurr9ZWpxNCZkQacPLC72MBUOlVrnoZI57u9yYLBQQpqTVVykTKaDN29x+wGHkMmiU6A+3FUYdIBcRm6mjwRba42kmkvmpShT/cj+zBrRJduwK8WePnsWZ4fSNJE788fcAgpunRLzeGMQ== 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=QUlYUMnZ+/z0VhJ8/ke/S1YNDRzGJxoywMpdt3TbUSDEmoNEoIKbWOUbBVlp4o/ONm4+Tdsuy5lPZoG3t1dSppD/mOtpzgUUdrRHAKITHRsSDx6FR72NWXjl7fPu5qcNHbgpEJpulZCyqsdw4ivCUhvqZ/4jaGmXjYYPCLQvQM1YLrklbg2IpudeaubHHp2YMCbhJ7zPP+BKhFiFOx9MDepOWaBUuZL5Xh5atlEaiTa5D5yFd3Os+W6th8IzAuQf55opcAlLSFuI1eQ9wUAI8OxG0i1QQEmyrLcKBN/fxRLK5/j9cegCJtNf13KfBj8sxT0oqm7LbGeuOPXZMgwQ8w== 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=gqWyfZOB9Qz8tlP59S5bGx1Yx1lrqmS0eagIOL+GPFLVrUe5fc0r+QtiBwOhHUD6wwpfcaKOzryym1/PuChZx3GxDIfKr8hqldLGIdtwPByOURlkqrDjpPF+Iym3qDUemJrQxmcw/FIk3qodYgeQZFepH9J3EHosb493PGD6XSI= Received: from AM5PR1001CA0062.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:15::39) by AM0PR08MB4274.eurprd08.prod.outlook.com (2603:10a6:208:148::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.26; Tue, 6 Apr 2021 06:39:37 +0000 Received: from AM5EUR03FT032.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:15:cafe::e) by AM5PR1001CA0062.outlook.office365.com (2603:10a6:206:15::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.26 via Frontend Transport; Tue, 6 Apr 2021 06:39:37 +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 AM5EUR03FT032.mail.protection.outlook.com (10.152.16.84) 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 06:39:37 +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 06:39:35 +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 06:39:33 +0000 From: Richael Zhuang To: CC: , , David Hunt , Pablo de Lara Date: Tue, 6 Apr 2021 14:39:31 +0800 Message-ID: <20210406063931.45795-1-richael.zhuang@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210406033321.36618-1-richael.zhuang@arm.com> References: <20210406033321.36618-1-richael.zhuang@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6aeac11a-7862-4416-8538-08d8f8c6c469 X-MS-TrafficTypeDiagnostic: AM0PR08MB4274:|VI1PR08MB5293: 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: speuDZCHvdi60W/Ms2GP1H3s3E6RXnzbHTcHo5bPs/6erpxH860xpsuKZumDQ2hu6RlnpwW5BKtWToOnq+1P8sAX4ptSCxSpIK5R2IzkB3hABg+680jBmIJX+c6CIdeLi/kRtMGT/tQOay6Jm1CkN3VfhEuDRYNm141aq0XqGoigzA3umkDxnmCtvyQvm8SUqs7+2d9Ck2AJ/IPZqabXQkUZrWXsPJsurnmvL+uPOHVxkiGkE8bhaQii8ao6IJqp4SLtSX3U5+JKAZvwa8tPaAVUzqLj9ibqUphiWUQ/F6eizEWtEcUVfUssNJw/UGDaLOCqYPGOSE6Ryexh1gF18DjeYD52SiVPoSCJN6vqqY3J6fm/vA4wNjXGGLGun3WItbbFmZ8dKWwMcLNVyqFekm6apWtvEdToIymotVHpfxn4Cz09JsDAnlfN/NsBSMGVSFZGveS3RZH+7gJUwD3zthdsYEQ44Z0w4gqNGjWLXfimCVekDn4SXgZdmf57J8VL9L6S/sUnjy7kuIO8VuXxyS0IMcP12mc0ZzF7jdQsttYZTeMU2HkftygNHyD0xhCFyL1yXsAZW89z//70XWWu5SMOCR3k6J4MmLgcw3Ikg3PotzhTq66EcPFW/JH7qYG/BgdeHa69Jco9eXEs5IY8TqYJNtSOYCLRGh64Y/o9l5zZ9W357c/HWVxI7lWdCW13 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)(39860400002)(136003)(376002)(396003)(346002)(46966006)(36840700001)(70586007)(8676002)(4326008)(86362001)(81166007)(36756003)(82740400003)(478600001)(82310400003)(36860700001)(47076005)(1076003)(2616005)(316002)(7696005)(6916009)(8936002)(186003)(356005)(70206006)(83380400001)(5660300002)(44832011)(426003)(336012)(54906003)(2906002)(26005)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4274 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 1da39f81-c07b-4794-5a26-08d8f8c6bf82 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +eWjqrIpkCCAuayjxOHyWFIE/eaG1oFdNOZRNkzEo/nWUwbAQJyi8buIHFkhFiAyczEOCvODmY7AFNWfVoShOyC5exZ5smPsJm3/8X9UiSkD5mNF3tCNVN3Ew253fOadcoJOZTtD6N4IgY2Co+ninqq5tyOMpTdVpChqGB8J2aQQgjrOtwwsue3WevCo5o23xhCDt6Zz3XTY9VM+qZNUVOb7MMH2nvIyMXzJqrpAiUB3xMw3oqKb60p0G+2RD54L3Zq2FCWiwGCq1xYh65o7Z4ckWxQiZhpzaziD/jTXRw5PtmN+pcg+cysONk8pQDz1xu209UfC2VUMPFyer6/X4LLQmpuxYiES8yEfAniD7dLYgmHOQ28rPIYf0EDEkofVWYz5zLtMe0ZAMXwQ8YMHSR1A4ZPHlneY0oC6w8ndlJm8aujdDQeRc6gliBmb0geDmT0j0o5fpnCa2TEWsqt+5jOHamFtMNqt0pwfyvhfksAqSHK1mrFbjB7XW6kC+Mh8jvs5vo4fEqbqjiT6k/PyyYDPxpXVLTTI7EcxH5vwK6pnAI3tvCFaRI2wEUK1dSnekSA+/fqkmvdyZKp9XkfxSRtA0BnXFsZYXEYQQe+mvEOq25ZB6UPXfGQKREFZ4r+gk13zGHfJulkEjcC42/o1yQ== 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)(396003)(376002)(136003)(39860400002)(346002)(46966006)(36840700001)(7696005)(2616005)(83380400001)(26005)(8936002)(82310400003)(450100002)(36756003)(36860700001)(478600001)(336012)(4326008)(1076003)(8676002)(86362001)(70206006)(44832011)(6916009)(2906002)(82740400003)(316002)(186003)(5660300002)(47076005)(81166007)(54906003)(107886003)(70586007)(426003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 06:39:45.5297 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6aeac11a-7862-4416-8538-08d8f8c6c469 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: DB5EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB5293 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(-) -- 2.20.1 IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please 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. 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 = strtoul(buf, NULL, TEST_POWER_CONVERT_TO_DECIMAL); - ret = (freqs[idx] == cur_freq ? 0 : -1); + + /* convert the frequency to nearest 100000 value + * Ex: if cur_freq=1396789 then freq_conv=1400000 + * Ex: if cur_freq=800030 then freq_conv=800000 + */ + unsigned int freq_conv = 0; + freq_conv = (cur_freq + TEST_FREQ_ROUNDING_DELTA) + / TEST_ROUND_FREQ_TO_N_100000; + freq_conv = freq_conv * TEST_ROUND_FREQ_TO_N_100000; + + ret = (freqs[idx] == freq_conv ? 0 : -1); fail_get_cur_freq: fclose(f);