From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0056.outbound.protection.outlook.com [104.47.36.56]) by dpdk.org (Postfix) with ESMTP id 0B5361B1C2 for ; Wed, 11 Oct 2017 20:57:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=RzfmQ6aLaCuuUuycOQnzsY1CFgknZjk6RpzY00WcetY=; b=C2LC2UwMDYDPCWQOqJqi4qYmpzbH4v0R4+6Gxa1+rMBuNy+2vCD8FggMDigNctn6sNwsBN4qXaKKqtxBPqLUE1S3tXMo60QAfY5i8Nc8rh9AB88c9EMcx1+9X9WszovWGMVtdCcQkp4TRJ+AVz+TmdPHRKaXR5uRsg5c/j9+SFY= Received: from jerin (14.140.2.178) by SN2PR07MB2525.namprd07.prod.outlook.com (10.167.14.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Wed, 11 Oct 2017 18:57:42 +0000 Date: Thu, 12 Oct 2017 00:27:20 +0530 From: Jerin Jacob To: Thomas Monjalon Cc: Gowrishankar , dev@dpdk.org, Chao Zhu , Bruce Richardson , Konstantin Ananyev , viktorin@rehivetech.com, jianbo.liu@linaro.org Message-ID: <20171011185719.GA19065@jerin> References: <05e205ba2a617012e7dbea4b384a2a2280b36b63.1506058385.git.gowrishankar.m@linux.vnet.ibm.com> <3939224.L4DEiYxvN2@xps> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3939224.L4DEiYxvN2@xps> User-Agent: Mutt/1.9.1 (2017-09-22) X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: BMXPR01CA0016.INDPRD01.PROD.OUTLOOK.COM (10.174.214.154) To SN2PR07MB2525.namprd07.prod.outlook.com (10.167.14.153) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 17674eb3-6201-4b6e-7162-08d510d9f655 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:SN2PR07MB2525; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2525; 3:6tncNIFBKf1q+W46n4ZM/sibyOrkvQ7W2m/fpdPY3bXR3M8T9ccGii4pHOi6qCnhFZXhMMsNBt8nLZNCUySqToi6h7NS8DXdtBGxH+oI7edO/P7Ex+rOFy3DP0ObqNaNiZ7vMshq/KK09VOak18OGVeH8k2KpUJC/55xzw6hUMCc3iUmaUJA7TsxUhdvwlEAsVyas9eri8B0K6nMwX6qZLNnzoMFvzi5clAQvsrmFvOs1hUEhqukVtQth8kZPV4D; 25:++GP8uUqlxOwwFSPt8dXTgJJPOcsPN5pr5CcK6yo5lc7QTs+DH2wcUfasQOSrW5xsDTsRghsgCEahXYOkrJbCXstRFafuv7B6j3t4jNHT357liokKeef15k7WMCZ94/jA/V0ULLTl7ADR5JR45Qg8u6vvRGeWCqLJddTJnyr9QMbLZ/nl4IdsAu9DuTRMNd+hFBeDgTQO+4Wca6EC3XyWsSqi3kaJlAIJ6jVnB45sg3V6FxeH2eq3aT8PIwVm0r3qa+iXwkCyClJa2Ka0gjhvMS4esrkK29UTzCEm/R2HumeAJ1eAAVf+UFLUHwA2E/8kwxQ3gqyOPM5vkheMm6m4w==; 31:lEjUTdDjEBFA/ldbIWjyCnomb4h3KS0sc2meKkr31x7OipFI3aLXKNJZUWdkmTDYu0tn2Qw7aAjlh3iFYMSz45NYufM4Ypy2SW6oo1ivaTKSM1boogJku5NnvHFzDJISv78oCtpeUE0BfMc3EcKOwBARrJYa0r+mQLhhs+eiirWxuuHJmw7J6bCcDgjG10qkoGe7RRt/q2yJzi6d/O2BD7xpDZOQDxtbJYLrx5r/zLg= X-MS-TrafficTypeDiagnostic: SN2PR07MB2525: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2525; 20:yATuRQ4qVHQ5+Xz2o5K4atGYl/OxDM27TW6mw8scgx2SnvdcFHOzaGvO6GSEYf5vV7HAz5w8FtHonY5/N8m5zUVVBOP+JZ7yLWTeHYateM8ALZ889MfNZiM4OuZYQDmSvom0Ctvatj+m/qZ70k6TiABQOhfWEJAiNoohNy6p6m1XshOrxHfLBXl+agsbf286LvM6M6Je+cHp+8C9iIDcUCDQ1RuYbu/L8+KATR+Bqc0/N3r0tWa5ik+OEKKsFthJglXXUd4lQibYOoco5jCThkD+9250o1uDfFVtDAtkbcLdnZY6G8CM0Sglq8TbnTjjRKpKvNnFu5mM2Y+I5O+xUKdQjKyyM8mhW3BmmDYO4eRXPljT/2WusKhkig2U55b4NKUHVud2HzYgHbn/2Vy/wCoN83s9WHcf2iFxX4qcO5dw1rneIqg0XR4THpqnWpLcGK1o3eXsUhlQx3gIhtGp2COIGjR2gvGSWakK7XIqC2mcs7fvMlSU8mJY1zLhDilXQwxDuly550Z/44XtIjCw/WohbmRZUs9CwaZMEMFZW7ebk6aJ1KKnuSQbgN3lFIUpU7GlPpg877Vdf+8ppVvlTIp5OioFoCDQadnTn2seW/c= X-Exchange-Antispam-Report-Test: UriScan:(104084551191319)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(93006095)(10201501046)(3002001)(6041248)(20161123560025)(20161123562025)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN2PR07MB2525; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN2PR07MB2525; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2525; 4:2PCmiz5cimJ+WxDQkGXjxVeo2dbH9hTjIYTYbSgNdDbaT3B9QtzVs7gccBn2oEgBaZ+EXz6CJWynLEkDalmgC5pUgmdMx2rjzCKyUf3KaDCkhqTsHsZOSTeLB5QLwsBj+aTPcXTZQHVxIw69tfwUoTPofZA7I6yC6JwDessLK8mj5yPM/n2vNyd36y+RXPUk4uCyyWqd7vkd/BHpCv0CP9hNEdGHwG2hvQEOGc/GQW4akIKXFv9YntE6KZyLe/Oxfs1H2DuPMSZkch9HpBabz692hAcPUx8idLFidHVlHVqWecDfrWDx03XK7bap27iBTpxEsXgwpvuhjmtfAa7c/g== X-Forefront-PRVS: 0457F11EAF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(189002)(199003)(13464003)(9686003)(81156014)(5009440100003)(4326008)(81166006)(55016002)(53936002)(25786009)(6246003)(23726003)(3846002)(16586007)(50986999)(6116002)(76176999)(2950100002)(6916009)(58126008)(54356999)(33716001)(42882006)(101416001)(189998001)(54906003)(1076002)(6496005)(2906002)(72206003)(8936002)(105586002)(106356001)(33656002)(6666003)(5660300001)(229853002)(97736004)(68736007)(8676002)(16526018)(478600001)(47776003)(316002)(50466002)(7736002)(83506001)(66066001)(305945005)(110426004)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR07MB2525; H:jerin; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR07MB2525; 23:wOhwEOKeBKZF7J1DABxserE9v+0vRQkVFhGmzNeTU?= =?us-ascii?Q?YUEBeqkHmDAIrEZtn91TFMArHypBDttyqibJJbDTs+o60hF6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yeMFb56ue9+piis0MdQmjBeE8pLNMdZI9Fs6d2FQyftd4a56YdVPLP3/xx3x5YNIVLqJkCC5W1C+m2cbHOSf2wBEDm5NKH2gLsKP9sxMgYEaNLCaAu9lp00+IyPyC3ygi91+fKJvNaNrXww9SYOKJxw/bbRtr+bV4Olt9ZuQA440G36lu/gGiCYreLH9y0iNLqjo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2017 18:57:42.8910 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2525 Subject: Re: [dpdk-dev] [PATCH v2 5/5] eal/timer: honor architecture specific rdtsc hz function 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: , X-List-Received-Date: Wed, 11 Oct 2017 18:57:49 -0000 -----Original Message----- > Date: Wed, 11 Oct 2017 19:36:11 +0200 > From: Thomas Monjalon > To: Gowrishankar , Jerin Jacob > > Cc: dev@dpdk.org, Chao Zhu , Bruce Richardson > , Konstantin Ananyev > , viktorin@rehivetech.com, > jianbo.liu@linaro.org > Subject: Re: [dpdk-dev] [PATCH v2 5/5] eal/timer: honor architecture > specific rdtsc hz function > > 22/09/2017 10:25, Gowrishankar: > > From: Jerin Jacob > > > > When calibrating the tsc frequency, first, probe the architecture specific > > rdtsc hz function. if not available, use the existing calibrate scheme > > to calibrate the tsc frequency. > > > > Signed-off-by: Jerin Jacob > > I agree on the idea. OK > > The namespace of cycles related function in DPDK is a real mess. Absolutely!! > I think we can choose better names in this series as a first step > to tidy this mess. > I will explain below. > > At first, we should avoid TSC and RDTSC which are Intel-only wording. > The generic word could be "cycles" (the word used in arch headers), > or "ticks". > We should also name the timer sources or their function in a generic way. > Examples: CPU cycles? fast counter? precise counter? > > Sometimes we use "hz", sometimes "freq". > It would better to keep one of them. > > > --- a/lib/librte_eal/common/eal_common_timer.c > > +++ b/lib/librte_eal/common/eal_common_timer.c > > @@ -80,8 +80,11 @@ > > void > > set_tsc_freq(void) > > { > > - uint64_t freq = get_tsc_freq(); > > + uint64_t freq; > > > > + freq = rte_rdtsc_arch_hz(); > > This new function is arch-specific and exported as a new API. I thought of avoid exporting it. But then if the function is in lib/librte_eal/common/include/arch/../rte_cycles.h it is anyway exposed to application. i.e whatever files in lib/librte_eal/common/include/arch/../ anyway exposed to application. See last comment. > > > + if (!freq) > > + freq = get_tsc_freq(); > > The function get_tsc_freq is guessing the freq with OS-specific method. > > > if (!freq) > > freq = estimate_tsc_freq(); > > The function estimate_tsc_freq is doing an estimation based on sleep(). > > At the end, the most accurate frequency is saved in eal_tsc_resolution_hz > and can be retrieved with rte_get_tsc_hz(). > I don't understand why rte_rdtsc_arch_hz() is also exported to the apps. > > TSC and HPET timer sources are wrapped in rte_get_timer_hz() in the > Similarly we can get the current timer with rte_get_timer_cycles(). > In the case of TSC, it calls rte_get_tsc_cycles() which is an alias > of rte_rdtsc(). > Some code is still using directly rte_rdtsc(). > There is also rte_rdtsc_precise which adds a memory barrier. > > The real question is what is the right abstraction for the application? > Do we want the fastest timer? the CPU timer? a precise timer? > > I would like to see a real discussion on this topic, in order of building > a new timer API which would alias the old one for some time. I guess, we may need to see to how abstract vmware TSC support also in proper way > > If you don't want to bother with all these questions, I suggest to not > export the new function rte_rdtsc_arch_hz() and rename it to tsc_arch_hz. If I understand it correctly, You would like to create a header file in lib/librte_eal/common/include/arch/../ which should not be exported and change the name to tsc_arch_hz.