From patchwork Tue Apr 6 08:30:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richael Zhuang X-Patchwork-Id: 90595 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 EE352A0A02; Tue, 6 Apr 2021 10:30:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A5EFC140F81; Tue, 6 Apr 2021 10:30:26 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2053.outbound.protection.outlook.com [40.107.20.53]) by mails.dpdk.org (Postfix) with ESMTP id 92EE3406A2; Tue, 6 Apr 2021 10:30:25 +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=P/pwxXR/a69WoRihRetJFEvzTQpLLrbKZqLZb+ihfO3ixjngn0EnettIBT/y8/KzfntrCgkmHkczZlidDvfSBaecjQ6ANNhKndSOT4nWzrU8E4dVPz0wmATsNbaJJ3I87qqC0cePJYvVCEb3qIFVAOtOp1gFhQK1PEqs2Yso11o= Received: from AM6PR04CA0051.eurprd04.prod.outlook.com (2603:10a6:20b:f0::28) by PR3PR08MB5740.eurprd08.prod.outlook.com (2603:10a6:102:87::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28; Tue, 6 Apr 2021 08:30:24 +0000 Received: from AM5EUR03FT011.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:f0:cafe::7b) by AM6PR04CA0051.outlook.office365.com (2603:10a6:20b:f0::28) 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 08:30:23 +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 AM5EUR03FT011.mail.protection.outlook.com (10.152.16.152) 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 08:30:23 +0000 Received: ("Tessian outbound b610e7b4d771:v90"); Tue, 06 Apr 2021 08:30:23 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 39bd5c6694d29c68 X-CR-MTA-TID: 64aa7808 Received: from 947a25a2a7ea.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 007760BF-45EA-43A4-BE55-DEB75E106345.1; Tue, 06 Apr 2021 08:30:14 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 947a25a2a7ea.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 06 Apr 2021 08:30:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E3LtCjAtoT/Do9dhoZYDEWC0/n+zczjGhTvC2qtPcm48fgvBRwBkVbMrj+Yh+5tsdp+G9NWXS7Hl5zfMbDFc8jo9H+BDwftOaSFZn4MFhDj73Hqd6UBjlbAjsF1XMw8/SxlGTn8h6mluUhI3nqlZIn6dpLvfqHZderh6rGMfLf9Qf8i3z6LTU59hNsjWpI7zDDDQ0PYQVRiCEfjdY8ownsgRX0t2iA9qPmihG7MoqCz+n3kPoc2h49MzWLFfqwUjyTYU/U2/rv69PQWKxDaCV3Of8AZ0fOuvXlf+7BWPahSjzS7vOUQWceewJ4DnaeyEUehyAgfajQ0KsbUCs9hLCg== 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=RGRw2oQ4DRQBL58kaGWOGjShMX4xsgiQD1A9T9CCmwLlVUzslxLl6q8U3CeuFQroUps5wPuRs4VvB9AaO3xY1sZfmXZONlXOqseZg5EEP8fFBISRc6xIBkxqhx307t5o8mwHl7O8nb1g3On1L/gKSw2s6qDIHMT72S54me1SYM8QHAE1M5ALVzfihwiR8Nlww3M4Ocmmvy+xOGDW5mEet2HfIp+1YKFv/GNNkI38EuffGrja9l2ap270gLIUwa36furxpprrqVO7MqwAmVor10npGzZCKIdQ3skpo7/7X9BUi8xKuLPiC5QklBosrkA0goY6lCOoNk/yn6XlrwRkug== 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=P/pwxXR/a69WoRihRetJFEvzTQpLLrbKZqLZb+ihfO3ixjngn0EnettIBT/y8/KzfntrCgkmHkczZlidDvfSBaecjQ6ANNhKndSOT4nWzrU8E4dVPz0wmATsNbaJJ3I87qqC0cePJYvVCEb3qIFVAOtOp1gFhQK1PEqs2Yso11o= Received: from DB3PR06CA0021.eurprd06.prod.outlook.com (2603:10a6:8:1::34) by AS8PR08MB6887.eurprd08.prod.outlook.com (2603:10a6:20b:38e::7) 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 08:30:13 +0000 Received: from DB5EUR03FT056.eop-EUR03.prod.protection.outlook.com (2603:10a6:8:1:cafe::13) by DB3PR06CA0021.outlook.office365.com (2603:10a6:8:1::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Tue, 6 Apr 2021 08:30:13 +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 DB5EUR03FT056.mail.protection.outlook.com (10.152.21.124) 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 08:30:12 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) 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 08:30:10 +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 08:30:08 +0000 From: Richael Zhuang To: CC: , , David Hunt , Pablo de Lara Date: Tue, 6 Apr 2021 16:30:05 +0800 Message-ID: <20210406083006.45702-1-richael.zhuang@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210406074510.49589-1-richael.zhuang@arm.com> References: <20210406074510.49589-1-richael.zhuang@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 72d220ee-97dd-40d1-99cb-08d8f8d63931 X-MS-TrafficTypeDiagnostic: AS8PR08MB6887:|PR3PR08MB5740: 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: sgSAE47L3ucwoYTQycNIOU7QrJ9k/uFiBFXg1tSSubExDOiMI1lSQqnP2nWNWUlvUDi57/sioLgkO5hM7fjpjFR2s/wm1WdJ2byQpmiS2bkZa3eVi71o/HM/CrsBSuF04uGDuc+mJt3V6vZ5cxYo/sbao+5hya8N14M96RmgS09koVG6apgBUVOooFsNQRzr+gG1DgC3DmL45Aj/irfRFErsch73a5WQEw1wYYWIz/2C2wqIasEZMhHI2JG17HSEWbzMhb2J4GqkXapWdLwndU/0q4ktDT5GZ7yZjuYXeytchhMHq3ZJqJbCgZ66WJnk9CmJ2dzLn/IOib0pabW5+YJM6ql+0JuG6691lWOToo+638nzn+Xe+X2z7i5le+w7aL7HyQ9UAeJCIKNPmeCjq1Q0tWGWEw2eRy286nmVOnacpJvEGtdaJ7SH99eWA+4kWNajlvopHP9lWXDTKGwqKtlKa4KO417PXDdXh93Ogd4agXs51WLqEc893HDFxPc+WmrX1RDEOtN/wbzElKFUIvsSKm0TW28mzurQhTVIPMhej7mgh/o+mh22sHI7B0It4ObtllvffpurWlvALAL7qPIjlIwserCUVSNDq3X1Nbd9M1pReTpTVmkojaTnjeo5n11w8jhVARxE41WJO7WPPqTDAYckGwKzSNQ3k7vA/VrqXbzD0rvEdnmxoJQ4ahd2 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)(376002)(136003)(346002)(396003)(46966006)(36840700001)(426003)(70206006)(478600001)(54906003)(44832011)(26005)(186003)(316002)(86362001)(82740400003)(8936002)(36756003)(6916009)(4326008)(6666004)(70586007)(83380400001)(5660300002)(8676002)(47076005)(2616005)(81166007)(7696005)(356005)(1076003)(2906002)(336012)(82310400003)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6887 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT011.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: b8fd8de6-7948-4aa6-fe25-08d8f8d632ab X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kLzjds+Wyw/m2EoPEfowhIfk3iJNaXpBewLYqUrbncs2gqB+oy8fPN7c0oEOJd7d1D8CG8SSmydEXaGO+PK7ykwUoJX/LfnQ5Dh3IeHl7hwqPB2FkHPNZQ668l/0+WOcv1c5agxIR46PrJOoHO1b8xduzbY2iZ1Pbt2DsxrBHj8KMr0uWmzdmQCHlggg1f+0SHZLM4SOGpUgbIdp5352QH3ET4A8inRp7Ley+WYnxKWkwjV9nhuYJzJBroV/3l7yhGFhI/kW/1/QUrrbBGeQc5/g5D0MNgwbEAkQLiex/uS086dBe5TL/TpH6Ynl8on8SEh0tECXz64X2oKFG3bmjLd34qR/QPWwOdBK1kbbD9u3/025Ao8mMBW69rpGvUSq6mU2ZEoekBArk3Z6mp7zIMW/ZhTKBUPozn4mTx4U3RcPKSPRCJFNBhRXt7hDFHtyp9vmheu272Yp8ymlRm5WndNtyOF8mpE1ScqjSkMVd1B/cFZeEvPCkfBFtP/ACwyGk6oNjLc6uG8TMN24k57H37QZFMX+WTZ9M40TsV5XGpznYQj2rKWyx4c5K/FjhoEMTZVdSkevMB0pFGUWDDduJLrsxkmYyOVEHMQqir0gUnvLAFFb+F1LFBMuc7eXD7O8smpHnORq6aJPhk5T0T1gOA== 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)(39860400002)(376002)(346002)(136003)(396003)(36840700001)(46966006)(36756003)(82310400003)(54906003)(450100002)(6916009)(6666004)(8676002)(2906002)(5660300002)(70206006)(70586007)(4326008)(7696005)(316002)(86362001)(83380400001)(47076005)(426003)(26005)(2616005)(186003)(44832011)(336012)(478600001)(82740400003)(36860700001)(1076003)(81166007)(107886003)(8936002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 08:30:23.8358 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 72d220ee-97dd-40d1-99cb-08d8f8d63931 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: AM5EUR03FT011.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5740 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);