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 1A386A0C3F for ; Sat, 12 Jun 2021 01:14:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 022414003F; Sat, 12 Jun 2021 01:14:14 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2085.outbound.protection.outlook.com [40.107.93.85]) by mails.dpdk.org (Postfix) with ESMTP id C36CF4014F for ; Sat, 12 Jun 2021 01:14:12 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fcLyERjHC1Cwd6eco3ehPWEX2cFn9vH1JVtEtI73+JqBd5furyDHT3/CzEZtExa815fb6/ripquju0M1xazbMFKFCjqXny/qbaLSqYxsAmdeJIhDYrekt2b65BBhEp8n0DnqkK5GGyrwlP/21NbceytypTrMcNydl/U3GxKUDUXd4erlcMlmO1e7nYrVFzHtNUaFiFf9MrKWg24Tyj9WTkcZckQkrGfMcEu5G27HHdXwtpYWwm3YCEwIOxOrkoNkDnD6+LvMgZHgcmjzrPgja2vuN5zY0t6SuduqjA6OW0V/5t+UsbrfZVR+/mCcfRpupKdxSuNv/b2wkXQLVpVdRg== 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=bBcyWKZhGHTE6/TOmtS0FXDpIJPlsD6anvipcEfxuTI=; b=X18c5LpWT/BRju/UkBMnK6tK4ngtJu/62uIu1C6XfpQwvAQR5SabREGzdMMzXr+F20VLCNAGHzCXGIAVsrrm9TSkeRJD/0UPSZ07SNeJ5/7SD8uDNz1aLkqoVHo1vT35Hh3S33sJY/F2e/Aq9FDDqIsw5IMt7YiInF6N2k6AEe9To4s1wSGP8aypQm2zLND7e+a4+cmac16pibDHgVNXpFRvmGtNeWtPoO2ebJlDzxdHkjyC5Jk4L4XfmLTRMW5iGTGHjQXEI8vbPwMukxxkYwikL28My6BtV994O1x5tVmw8MyhZv99qTZFKUbTIHPLMrrBMoxqv21o8Y+VfRIF8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=huawei.com smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bBcyWKZhGHTE6/TOmtS0FXDpIJPlsD6anvipcEfxuTI=; b=jnaD2dFIFFfaCa1nLQHMPWX6qxsSxN/QLlXDu4PYYVOcZIKXHgh+7UHCydg/JtMZtKmRyuMYnN7Mg03DqyS/vh2Sd6/wnc88KyoF9FAvHPTevVK8/nsPXw4kTMSG5gpfTCM0XsS0ZGj72d3fY0cAcVF6wmeDDMtsqrdzHC6FNO2oSuL+ftLvabEfbgLBvVOiL2yzv9MPGTBkH9BWMJcHL+UGqynz7/o/xecNdeYSa+N/bvvberdMnEu+uLybwf51RqODV78N3WbsERqqfpm0WYAMXaSQjLOEnZrLjRSKRIvKlMy2lTlsm8kmKXsT5MDMlzlVSYCfCuqf0k+GwbkSiA== Received: from BN9PR03CA0629.namprd03.prod.outlook.com (2603:10b6:408:106::34) by CO6PR12MB5394.namprd12.prod.outlook.com (2603:10b6:5:35f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.22; Fri, 11 Jun 2021 23:14:11 +0000 Received: from BN8NAM11FT013.eop-nam11.prod.protection.outlook.com (2603:10b6:408:106:cafe::5) by BN9PR03CA0629.outlook.office365.com (2603:10b6:408:106::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Fri, 11 Jun 2021 23:14:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT013.mail.protection.outlook.com (10.13.176.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4219.21 via Frontend Transport; Fri, 11 Jun 2021 23:14:10 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 11 Jun 2021 23:14:06 +0000 From: Xueming Li To: Chengchang Tang CC: Luca Boccassi , Min Hu , dpdk stable Date: Sat, 12 Jun 2021 07:03:14 +0800 Message-ID: <20210611230433.8208-100-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210611230433.8208-1-xuemingl@nvidia.com> References: <20210510160258.30982-229-xuemingl@nvidia.com> <20210611230433.8208-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c8b2bbc-2358-4de8-e948-08d92d2e9ef8 X-MS-TrafficTypeDiagnostic: CO6PR12MB5394: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5ZUCz7mtzKNZwvGmINjoCLW10RtDancuU6s0G2Ney0pV+zGrnaCdKsnrn22VhkRogBiEnJXNLPf+55NQsRBt160po+d4TEUJScBTc9pVscqgCTU4BAYHXBTwJBRHBVpZ56bJiTzlNldeNd8khxM5MjYaI8JxF1qDKz/+nmTVUi2fNvd1w2/Sp5iHtSCc5AQoYrwW2mh/BZLIHt/tnMtfkUZwxcTsm5g94XMkleQZUbav8GlRdV7v/gwWXqEsiotAHCU/LxrOy9MoNyQHzCWTZ+dKsXFfl0wiHBq44efv8X5yrdtC28ahOkH4hKuoZerIgRg3SDSFaRKWRnj9qZES0pvV1mjI7D1fc0Cw9sVbQwrsRvSfDRrAw/ZsMzYVLgW/TAJAy4W8Tt5C1Qsobk6AUHoe5MAWfwgUr5P2f8AJByL74y3px4mSr2NjkvcPn1DARs8vgT3Q51l8Rcsc/7IuMJpCCrZ36fJ68bw2PO7/quda0RDG8Qja590oF7b90eukeSzPVinVpWxpRcPWEqM5rNYDHTwUP1FyBXtx5JyUB9chjcbe3Hf8CPBrkp9Y+b5YijaZIjAreTMieDHLtxHkzynNDnkvmUzPoisQtp4vs0w1Ab9D+jh/pHJU6xsG4wgNuFE8dHxyZBKD8YvSlrNY+ljtwCrsI6i2weKrCWhJeX/eab53FHQ1Z0mloNof2fILrgSusllUJJdxEtRLbLzEIWfBZU7MT+Rj8s8/SNMXmPwMAeDgMGpP+0KzfUttXNBfpCmqEmjXGDhXzWhVjGldnf8VRpCibwUYDzuN3KnUm9oFbrQo5X7XF6rN+N0sERz6 X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(376002)(346002)(396003)(39860400002)(136003)(36840700001)(46966006)(316002)(70206006)(86362001)(47076005)(36906005)(82740400003)(54906003)(8676002)(8936002)(83380400001)(70586007)(36756003)(966005)(7636003)(55016002)(186003)(16526019)(6666004)(53546011)(82310400003)(7696005)(478600001)(36860700001)(356005)(2616005)(4326008)(1076003)(26005)(6286002)(5660300002)(6916009)(2906002)(336012)(426003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2021 23:14:10.6695 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4c8b2bbc-2358-4de8-e948-08d92d2e9ef8 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT013.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5394 Subject: [dpdk-stable] patch 'examples/timer: fix time interval' has been queued to stable release 20.11.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/14/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/3ce8842e183a1c2c9d077b5b510038bed49d6b87 Thanks. Xueming Li --- >From 3ce8842e183a1c2c9d077b5b510038bed49d6b87 Mon Sep 17 00:00:00 2001 From: Chengchang Tang Date: Thu, 6 May 2021 17:29:36 +0800 Subject: [PATCH] examples/timer: fix time interval Cc: Luca Boccassi [ upstream commit 80aa15c4dff24e7a3b549f8dca37c16ae7220920 ] Timer sample example assumes that the frequency of the timer is about 2Ghz to control the period of calling rte_timer_manage(). But this assumption is easy to fail. For example. the frequency of tsc on ARM64 is much less than 2Ghz. This patch uses the frequency of the current timer to calculate the correct time interval to ensure consistent result on all platforms. In addition, the rte_rdtsc() is replaced with the more recommended rte_get_timer_cycles function in this patch. Fixes: af75078fece3 ("first public release") Signed-off-by: Chengchang Tang Signed-off-by: Min Hu (Connor) --- examples/timer/main.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/timer/main.c b/examples/timer/main.c index d67301e3c4..d270ce49dc 100644 --- a/examples/timer/main.c +++ b/examples/timer/main.c @@ -18,8 +18,7 @@ #include #include -#define TIMER_RESOLUTION_CYCLES 20000000ULL /* around 10ms at 2 Ghz */ - +static uint64_t timer_resolution_cycles; static struct rte_timer timer0; static struct rte_timer timer1; @@ -66,15 +65,14 @@ lcore_mainloop(__rte_unused void *arg) while (1) { /* - * Call the timer handler on each core: as we don't - * need a very precise timer, so only call - * rte_timer_manage() every ~10ms (at 2Ghz). In a real - * application, this will enhance performances as - * reading the HPET timer is not efficient. + * Call the timer handler on each core: as we don't need a + * very precise timer, so only call rte_timer_manage() + * every ~10ms. In a real application, this will enhance + * performances as reading the HPET timer is not efficient. */ - cur_tsc = rte_rdtsc(); + cur_tsc = rte_get_timer_cycles(); diff_tsc = cur_tsc - prev_tsc; - if (diff_tsc > TIMER_RESOLUTION_CYCLES) { + if (diff_tsc > timer_resolution_cycles) { rte_timer_manage(); prev_tsc = cur_tsc; } @@ -100,8 +98,10 @@ main(int argc, char **argv) rte_timer_init(&timer0); rte_timer_init(&timer1); - /* load timer0, every second, on main lcore, reloaded automatically */ hz = rte_get_timer_hz(); + timer_resolution_cycles = hz * 10 / 1000; /* around 10ms */ + + /* load timer0, every second, on main lcore, reloaded automatically */ lcore_id = rte_lcore_id(); rte_timer_reset(&timer0, hz, PERIODICAL, lcore_id, timer0_cb, NULL); -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-06-12 06:53:59.196702800 +0800 +++ 0100-examples-timer-fix-time-interval.patch 2021-06-12 06:53:56.450000000 +0800 @@ -1 +1 @@ -From 80aa15c4dff24e7a3b549f8dca37c16ae7220920 Mon Sep 17 00:00:00 2001 +From 3ce8842e183a1c2c9d077b5b510038bed49d6b87 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Luca Boccassi + +[ upstream commit 80aa15c4dff24e7a3b549f8dca37c16ae7220920 ] @@ -18 +20,0 @@ -Cc: stable@dpdk.org