From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id ED1D9A0096 for ; Sat, 16 Mar 2019 15:43:04 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 019E411A4; Sat, 16 Mar 2019 15:43:04 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 34EE3DE0 for ; Sat, 16 Mar 2019 15:43:02 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP; 16 Mar 2019 07:43:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,486,1544515200"; d="scan'208";a="127542614" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga006.jf.intel.com with ESMTP; 16 Mar 2019 07:43:00 -0700 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sat, 16 Mar 2019 07:43:00 -0700 Received: from fmsmsx117.amr.corp.intel.com ([169.254.3.142]) by fmsmsx116.amr.corp.intel.com ([169.254.2.7]) with mapi id 14.03.0415.000; Sat, 16 Mar 2019 07:42:59 -0700 From: "Wiles, Keith" To: Pavan Nikhilesh Bhagavatula CC: Jerin Jacob Kollanukkaran , "stephen@networkplumber.org" , "thomas@monjalon.net" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 2/2] eal: roundup tsc frequency when estimating it Thread-Index: AQHU28bQlfixTMrl5EytlEBwO8MI46YOyuMA Date: Sat, 16 Mar 2019 14:42:58 +0000 Message-ID: <86480C64-4ECD-4F4D-968E-5716D02D7D83@intel.com> References: <20181129083138.23029-1-pbhagavatula@caviumnetworks.com> <20190316070302.32432-1-pbhagavatula@marvell.com> <20190316070302.32432-2-pbhagavatula@marvell.com> In-Reply-To: <20190316070302.32432-2-pbhagavatula@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.251.15.51] Content-Type: text/plain; charset="UTF-8" Content-ID: <72207A42BDE96D45B3DFAD439E9DC77E@intel.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 2/2] eal: roundup tsc frequency when estimating it X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Message-ID: <20190316144258.V-JfEipFehdU8vKiFaW73dkNEeW7BYLuWMWgWdDslrE@z> > On Mar 16, 2019, at 2:03 AM, Pavan Nikhilesh Bhagavatula wrote: >=20 > From: Pavan Nikhilesh >=20 > When estimating tsc frequency using sleep/gettime round it up to the > nearest multiple of 10Mhz for more accuracy. >=20 > Signed-off-by: Pavan Nikhilesh > --- > Useful in case of ARM64 if we enable RTE_ARM_EAL_RDTSC_USE_PMU, > get_tsc_freq_arch() will return 0 as there is no instruction to determine > the clk of PMU and eal falls back to sleep(1). >=20 > lib/librte_eal/common/eal_common_timer.c | 4 ++-- > lib/librte_eal/linuxapp/eal/eal_timer.c | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) >=20 > diff --git a/lib/librte_eal/common/eal_common_timer.c b/lib/librte_eal/co= mmon/eal_common_timer.c > index dcf26bfea..1358bbed0 100644 > --- a/lib/librte_eal/common/eal_common_timer.c > +++ b/lib/librte_eal/common/eal_common_timer.c > @@ -69,7 +69,7 @@ estimate_tsc_freq(void) > /* assume that the sleep(1) will sleep for 1 second */ > uint64_t start =3D rte_rdtsc(); > sleep(1); > - return rte_rdtsc() - start; > + return RTE_ALIGN_MUL_NEAR(rte_rdtsc() - start, 1E7); > } >=20 > void > @@ -83,7 +83,7 @@ set_tsc_freq(void) > if (!freq) > freq =3D estimate_tsc_freq(); >=20 > - RTE_LOG(DEBUG, EAL, "TSC frequency is ~%" PRIu64 " KHz\n", freq / 1000)= ; > + RTE_LOG(INFO, EAL, "TSC frequency is ~%" PRIu64 " Hz\n", freq); > eal_tsc_resolution_hz =3D freq; > } >=20 > diff --git a/lib/librte_eal/linuxapp/eal/eal_timer.c b/lib/librte_eal/lin= uxapp/eal/eal_timer.c > index bc8f05199..864d6ef29 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_timer.c > +++ b/lib/librte_eal/linuxapp/eal/eal_timer.c > @@ -248,7 +248,7 @@ get_tsc_freq(void) >=20 > double secs =3D (double)ns/NS_PER_SEC; > tsc_hz =3D (uint64_t)((end - start)/secs); > - return tsc_hz; > + return RTE_ALIGN_MUL_NEAR(tsc_hz, 1E7); Maybe I missed an email about this, but why would I want the TSC hz rounded= here? I do not mind the macro just the fact that we are changing TSC hz va= lue. If the TSC value is wrong then we need to fix the value, but I do not = see it being wrong here. > } > #endif > return 0; > -- > 2.21.0 >=20 Regards, Keith