From patchwork Tue Apr 6 07:45:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richael Zhuang X-Patchwork-Id: 90594 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 6D7C6A0A02; Tue, 6 Apr 2021 09:45:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EAF12140F3F; Tue, 6 Apr 2021 09:45:35 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20082.outbound.protection.outlook.com [40.107.2.82]) by mails.dpdk.org (Postfix) with ESMTP id 3AE75406A2; Tue, 6 Apr 2021 09:45:34 +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=hV3LVlZ6QkdCqhy6f6gbB93GndpZIvMpeOs9uPKY42clQpjIieDkCF0cwKVyVr0xJRATD6LVu9nrt2TOI3qLE2r40wnTbXWn3SsDgoTeIRQE0/p/ppHsIVL91NN4bw+rg035waP+k4zDiLelhBmbIvRhR0ucesbTqYTe8EJuOws= Received: from AM5PR0601CA0025.eurprd06.prod.outlook.com (2603:10a6:203:68::11) by AS8PR08MB6630.eurprd08.prod.outlook.com (2603:10a6:20b:337::24) 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 07:45:31 +0000 Received: from AM5EUR03FT005.eop-EUR03.prod.protection.outlook.com (2603:10a6:203:68:cafe::b7) by AM5PR0601CA0025.outlook.office365.com (2603:10a6:203:68::11) 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 07:45:31 +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 AM5EUR03FT005.mail.protection.outlook.com (10.152.16.146) 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 07:45:28 +0000 Received: ("Tessian outbound 700fd1fc53d5:v90"); Tue, 06 Apr 2021 07:45:28 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a4eaa60eb645401e X-CR-MTA-TID: 64aa7808 Received: from 9936ed7c001a.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 74576ED7-35E8-406C-829C-9A4E9496790D.1; Tue, 06 Apr 2021 07:45:22 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9936ed7c001a.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 06 Apr 2021 07:45:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GOyRkhx1sFEUsb10D1SrabJWDtCbmDYFfQsA4OLlhTfznnGAD/9Zjbl9HQOlSgvundE8Quf+6mOMl3ER2StqxnguoL4XzyXdINlCJx4U4AsOv0IMX3FqbE/ilKrBLrmatDma0J50RBk65ko5iv18nlWZ31S8oWawoawbIOA1UESrSX5Ryvqa3QgfUiBezH9D29lgw1ySXTwI7WBKIJ9TS/v3JEyUynBaegBTHNS2usrSdHOKQ8VMlBdFPsWkh85HQUyCU6Gb/lpcKS1HpBHMram9TxDlfWL2a42DFFFFuj7VA1r7b8z7d9MDJA7k++dAc1Ig6NsIdZkt0A/15u8DUA== 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=EFQ5GBgrMNeeehu2oPnxUhJXw8Kuu+42ussJDquxZcA9E+Hq9XfrF7epJUnsAEuq0FLj/d4SDtOTi4/TRDQ3FmvFUxal1Vd+sM9ODSLb7g0An81XWYs406F7cjNuV/va1r+8ScVFcydliNyT9Ng1GCQ8UvfRM7MIPU1enHSX+a7OxtizoLSV0rDGE+3VXLh+kAiEz4gR/7IB/GSwAU/NdlFywOBir29CMvk/tPk4BBvrI9+jTq0sQ1qHMK+p79PovskTlzp0oMUsVDjdoE5FpFLSY2QsUhfxDX9oVaVyExStL5XV2pBV5Y4XJRRsmOfqAGbBqTpYWZ3g5tG0lFwPhQ== 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=hV3LVlZ6QkdCqhy6f6gbB93GndpZIvMpeOs9uPKY42clQpjIieDkCF0cwKVyVr0xJRATD6LVu9nrt2TOI3qLE2r40wnTbXWn3SsDgoTeIRQE0/p/ppHsIVL91NN4bw+rg035waP+k4zDiLelhBmbIvRhR0ucesbTqYTe8EJuOws= Received: from AM5PR0301CA0025.eurprd03.prod.outlook.com (2603:10a6:206:14::38) by VI1PR08MB4063.eurprd08.prod.outlook.com (2603:10a6:803:e8::30) 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 07:45:20 +0000 Received: from VE1EUR03FT036.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:14:cafe::79) by AM5PR0301CA0025.outlook.office365.com (2603:10a6:206:14::38) 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 07:45:20 +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 VE1EUR03FT036.mail.protection.outlook.com (10.152.19.204) 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 07:45:19 +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 07:45:16 +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 07:45:14 +0000 From: Richael Zhuang To: CC: , , David Hunt , Pablo de Lara Date: Tue, 6 Apr 2021 15:45:10 +0800 Message-ID: <20210406074510.49589-1-richael.zhuang@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210406063931.45795-1-richael.zhuang@arm.com> References: <20210406063931.45795-1-richael.zhuang@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6bca7b8e-24a4-46fe-3bde-08d8f8cff2ee X-MS-TrafficTypeDiagnostic: VI1PR08MB4063:|AS8PR08MB6630: 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: sO1gYnj30mEz6vCiKnGs08bZJJ5Mg7BV95Lip70vCyV56xC6QlLXNPEfyBtmYGEBfevhsONSGwyU+LzpVvU/WY1Q6pJdRkOYQ7+WYJd5kHLqAyNnh5uaKLAsx3uXDg6qTm/nndha+ia/Y3VOal1iCP2BZAeBUboTCRbyRCqWkfxA0q6CzExhgFGL2eWhJfLxbbllfQcArvD0thj+J9kX5qgSmPPF/3XWLm5yeXGVQi2XU1Tw7hfJC8uHPQWNX2GRNyHVL5wrnK2tFkezRLqjDC/HgL3+fBRnRZYWi+i/z/FuAeofM3nP9IA80KuQ8NrJX95vvgE8WtkE26fcXnLDNQ6d6aHJh27GK01M3geOoIqkMeORmitI7EzovgWlY6AxMsJjYZQbQtZjSBhJ+xQYLRKXVeWOP1ytYIe0224sJVDuNlkstsuBWznYJm6zPpbTsXM8rc8rXp32aVNYsrh3SFHlTUk81esycFfEeL4fx9rtibrN+geO8F2NPnvgTocgEPJPuCgicCDCGHGZs4uclkaAmrX7Ha/h/B9t5xWzBPTYV0CtdLPs6w0F3PN6surGQHrY6g96XYPlVtdDqeqd5XmnEBMxxG20zeXoMumLywi8ik4I2TC7aCXRWBwWWmTXwnQVULmyAc41KA4Zo7n2h0WiQXztJEgcPppn5CGip1v04Tkc8Tt8bxRGyraDOCEE 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)(376002)(39860400002)(396003)(346002)(136003)(36840700001)(46966006)(83380400001)(2906002)(316002)(70206006)(36756003)(47076005)(8936002)(44832011)(2616005)(426003)(4326008)(336012)(8676002)(26005)(7696005)(82310400003)(5660300002)(478600001)(54906003)(82740400003)(186003)(36860700001)(356005)(81166007)(86362001)(6666004)(1076003)(6916009)(70586007)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4063 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT005.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: a3853b11-36b8-4a6c-e26a-08d8f8cfed6a X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: //f1rkJ1c6anDvgD4dRe0i7jUSc9REempj2RJUz/aq8ukV/v95cqwQyz2iAvrsD1Z6oR/D1ITRTHv9fJrkL78zQA5y4fxM/g89Bje9zmyQH+4G5qN3PoOC5z5TYP0WWUna5IC2yHVcv26Zs58yK/UnIP/mD0sSEHEeUh1no8+iF2SJXppmh6fxPbSQtXrXSO5MU1XN/40fGPx73U27WkAwPXmP+74crxrRCSFezs2X72oJdIWkbTbBLsvOIFDhv3fMTo7Jw7YWCk8nrhaNh42i/xr79RNFTaS4MnDH3agN1R9zbWsLZ0FLOz5W+LD28Mza9xz7CnbHrts+Y2Rht+itYS4+S4wLjCYxlQ/qzPlUOlV7XuNn6DVFi82CSMz0kMR4pU3Jm8s7OIQjz1HJqp12xvE4UF9UH59L8ySwEPkpcN4Wq6Vlt+hFh/f7fjYrKcqGjLnBpLP9xC50mELD5FGfNky2QE8FUtfeKYQA4YFYT43Gu9wIJFzAEj7lktALtoOuq/iD10OReJkE1Mhsqp6CxaTIe4oLTDdPfn+MHq5j6DNOjEtBW8FUWsekU+hh/49OcNr4BR5XBh8KYljN2iZ2ATAE3DiviwSQgbdL7xjF/atVP5+9wI3ioQYeSCcj3UzZzovSHu3WWWrjuoQrlCag== 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)(81166007)(36860700001)(82310400003)(2616005)(82740400003)(186003)(316002)(336012)(54906003)(6666004)(47076005)(450100002)(36756003)(83380400001)(2906002)(7696005)(5660300002)(44832011)(70586007)(6916009)(8936002)(4326008)(86362001)(426003)(1076003)(107886003)(26005)(8676002)(478600001)(70206006); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 07:45:28.9693 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6bca7b8e-24a4-46fe-3bde-08d8f8cff2ee 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: AM5EUR03FT005.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6630 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);