From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0047.outbound.protection.outlook.com [104.47.40.47]) by dpdk.org (Postfix) with ESMTP id 735551B1EC for ; Thu, 12 Oct 2017 12:16:36 +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=fE3wuF/iW4ezNjKGx112m7z3Pao6/ov22SbJtcp94ms=; b=FsyPP0n0j9AWQLRQ6mJqWl8Iozu6kRrQ4pQiuOnV4Z64oEQzDrZnfJUInGi5AoulaacXSOLnt4dFUa04g1F+UOeyGJkVsa1mMzltj/aLh71GIHNiouPsyXj6fxXMzbSqxzZOZb2p0l68c9ZEFtuzk5B4EH7vD92FDQr7EKNJgNU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from jerin (14.140.2.178) by BN3PR07MB2513.namprd07.prod.outlook.com (10.167.4.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Thu, 12 Oct 2017 10:16:30 +0000 Date: Thu, 12 Oct 2017 15:46:10 +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: <20171012101608.GA26738@jerin> References: <3939224.L4DEiYxvN2@xps> <20171011185719.GA19065@jerin> <1897496.fbWrZq1zZe@xps> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1897496.fbWrZq1zZe@xps> User-Agent: Mutt/1.9.1 (2017-09-22) X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: BMXPR01CA0017.INDPRD01.PROD.OUTLOOK.COM (10.174.214.155) To BN3PR07MB2513.namprd07.prod.outlook.com (10.167.4.138) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0ee2711e-8ed9-4c06-76b0-08d5115a50ec X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:BN3PR07MB2513; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2513; 3:F2xSXTQb6NyMuN2Q8TH5vBAzAqTubF4FBC/gHEwXGu+JoQXuuOZheJSHDPqlmT7oo7HNY7dz92yggVBwAF1tDSAyLaRk1ePI1MTWcF+QlabVjUvwvRd6rXNFmVkxnUpEZ8fN1nqxk5UxAR+2M4UakSvnJ1eT09kQ6k6FizUZb5j34xv/WqOrktdF1t+lKet/LdDs/ijXzSGxgKwrPi9V+4KOk5jH4mVIuGJxf86BB0PPLqc2k5fOpXIrwq3H7IFL; 25:WUzrUUnnNW+VJy2U/JyorFHz8nEdKRRd8h28ztZnfQINb6BMawRm4jsG1Jo8bqVmlzlCOSyjSHlMSuIRAUl88Ye6QcxWPrInKSKPtT0OQ2M0liUUwXjIXCqkT+50lauJgHmQA903vUd4WjLKnnU2cduLWbkjodDXarewxJ2KxjPZXTynVazrsHYVBrAW0RXTeaeeIRZ78oXRNHelGcM2ObYHpXvN8zPMOorbp6b9GjZiEAt+GFso4bU2dA95Ldqkpi+tZT/QLvcWk8W/tk/DT7vnyixFz3nCqFBEp2xWwMv7WcvuLjrUWQeG+buNJOF0LiGBaCh8idY1CYDPHOFfmJWhHEU4DVNvUHIkIXKQico=; 31:6L9Qj+31oSvNtRYTGiPfop8iTUmF7dk7sv926ie4lKgUum5n/LFDjeClQNntEHN7PF0dpOEaEBwRGY84XSrHMOZMgWrnTxThZJvVxuX1F6ocf0AqDg0MhRBJ81u3ZVCEaJ17tMy/gT1Gdoj6zhDoqIb3Y7FNJeLKYsLT2DhcmMxVAk3Oy0CuourS/Jd6S8udV0lebHVj7pG4NbcwDwlXZcglgwy85I9SGinHXRF5iIY= X-MS-TrafficTypeDiagnostic: BN3PR07MB2513: X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2513; 20:jyJlbziZYGwO2ApfPQji4VHEYYmd+VXu56NEiPeUqTnQkeCVaSihNAnAkwhxOa9628Q/5KdOK03cmNcFmJr7JKnSMohXEGPV2hUo2vhsLTitGgv4puD0MrctncuzC2xkqSh9h1lzNdHyFXDIntsoaw9Jrt+JPtG6MYuKFP3OIambeWH4QOElAY79KA6jdjxAGoHkWtzxFylFTjFHs8S1U9EtC4YErmGeD1iV3lO/RXhVTKxfkvZfjn8ZfqiDk0flcEyEARSk3FUqugmVRUtpCgsb+NMDm9rf5aULc5QpezMCUHTrQK/C9zDowg5FuyoeOaH8iv2kPNIVQHIYeUB23GyLngpoY+ssgUb54bDzyg+jt+luOyBnbf1pyLq8JPEwZXjhAGbXuKvOMknrZJYPuA84a9w4Q6AqgqUcb0/SaTWgu9SiMgOPCRx/OqjPjwBKOPhyzHKQt92Odp6Hy6EcYnU/YmrtcVG/mS1BJ91BWgMJYfmFyTJ5s5DOcUPhEVNr9Z6ZWHVK5ZJxlI1LN6FOWnioQOSQYmX5em1lqTSVTZelaHMe+pyWIJTaDRVdwqdZ/DqEo0IGKZx90tHbSByheqyCDxYeM1Af+PwH1ld+8K8= 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)(5005006)(8121501046)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(6041248)(20161123562025)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN3PR07MB2513; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN3PR07MB2513; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2513; 4:3Evfp4+bSTi3bdIOn8q8fHOCM7nXBIT6G9Y3wYiexP6406SlMebzFsJmjBglzXEAawkLvolF84dkqRLIrPhFW5QqkACCSDTK7G5EMHzvTiZ3KnX9dC8v28X3Z07MolQbT4u8X5A0HPG5jEAT2VvkZhYopeiwyH15ajIxHqpEBfY2EANde45XlThXAMfw5TbtQuAI1sid9WELxwA+zjQQDCQdjJyTe59fMOErajaFCp2F+8jiFz/EzaXk/31kOL3UrXEnHRxyHVNP2ZEtmlv0d6NJkxfWKJdzPs+k5WQYZyfxp3VqPqBNI9Glfm3fVoVeOW3Sh4wMAshH/pIjTuFQIQ== X-Forefront-PRVS: 04583CED1A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(189002)(199003)(13464003)(6496005)(58126008)(6246003)(6916009)(16526018)(53936002)(229853002)(33716001)(42882006)(25786009)(47776003)(66066001)(4326008)(2906002)(2950100002)(16586007)(81156014)(50466002)(316002)(55016002)(83506001)(93886005)(9686003)(1076002)(54356999)(305945005)(478600001)(72206003)(50986999)(76176999)(189998001)(6116002)(23726003)(3846002)(33656002)(6666003)(97736004)(5660300001)(105586002)(8676002)(81166006)(101416001)(8936002)(7736002)(54906003)(5009440100003)(68736007)(106356001)(110426004)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR07MB2513; 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; BN3PR07MB2513; 23:J2uxZFhTtK2cG+6Qz76JFeJ2UQv+0MjbLpibbqp+C?= =?us-ascii?Q?oN6Dp1iY4Y0mRrZdv9Hls4KejJ6XNNCimOH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AkQwV1+SnM=; 7:cjj/80v36vNORVZjavnskyJyqDAo6gSZ4Cm3NLiQLThKe9fQGF1I+4GGrTCzaFlLijMCRBGNcZw2h7UtmRhsynsjsy/+oYD9OpQzyTMbpa46w9D1cjB5NTwzoYgVTKxJ2UeNwQbL0urggWQPXH+cbr6Sl/+gEQVrnGBDXTBK1jjcnDb9bxyvQ31VgtdM82AOsiMXPdTRh+V9ajNyVtPe7YyIWb81ZM6zjj2rk2DsJys= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2017 10:16:30.2226 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2513 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: Thu, 12 Oct 2017 10:16:37 -0000 -----Original Message----- > Date: Wed, 11 Oct 2017 21:25:58 +0200 > From: Thomas Monjalon > To: Jerin Jacob > Cc: Gowrishankar , 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 > > 11/10/2017 20:57, Jerin Jacob: > > From: Thomas Monjalon > > > 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. > > Ah yes, you are right! > > > 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 > > Yes > > > > 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. > > I had not think about the way to do this. > What about having internal headers in lib/librte_eal/common/arch/ ? Looks bit odd when compare with existing scheme of arch function management. Anyway the whole timer stuff needs to be cleanup. I think, we can take that when do the cleanup. On the other side, This API has real ARM64, PPC, x86 implementation now. I think,it is important to have this feature for v17.11 >