From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0064.outbound.protection.outlook.com [104.47.37.64]) by dpdk.org (Postfix) with ESMTP id AA1B35A69 for ; Thu, 18 Aug 2016 13:52:18 +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=kyR+FrCdDMSiXVsSijpA0MSOWGMgCp5uLENdDPTK4D8=; b=O7igjhx1y9xoCtVdQ3K9JdgZ/ax4EB4aY/0Umqou0cypzbxBhc5P7rYLymgcwyCrGYXhk9392J04h1MrwTq2uP6AsWkBiKIffewuJX/nDg49TXk46fV10mTDSixmiTWndXlYuH7wbXr30P0Yb3NFPBwSCXla7a3hy/bdD2XVIPg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.localdomain.com (111.93.218.67) by BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.549.15; Thu, 18 Aug 2016 11:52:12 +0000 From: Jerin Jacob To: CC: , , , Jerin Jacob Date: Thu, 18 Aug 2016 17:21:30 +0530 Message-ID: <1471521090-21067-1-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: PN1PR01CA0059.INDPRD01.PROD.OUTLOOK.COM (10.164.136.159) To BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) X-MS-Office365-Filtering-Correlation-Id: 48bc0342-2890-4075-1a03-08d3c75e191f X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 2:M9C4TsvHfNl2liYv+rB5XHXt+JvJ8HgBnACx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8b0torrscSHDF1fkU5tuoBJhdmQ4c45bRK/MYVNdIMNVMO68BmaEY1O6I= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(166708455590820); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001); SRVR:BLUPR0701MB1714; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 4:UoejNTP75SxS9jgMyC+fWrWseK3nYpTLh1wsTCTE6c0niwgVuBUTrjSqn3aYATdXuy7ltheScBpa6otlTDvofFfk2Nxzd6sHsgKNGJTfDHwcdTqymuEZgvvVTqvFIr7zH1SnDQzS0SiTXAIPVPyHDINMQyshJqtWzJEm+uPJnEILlxZnm36WhB0HN/hQ3ZDxhQNK0aegBX8d4Yd1Yyb7SJyEEGDM8kGu/aPP9QcnBSY4tFcFt/OdMDML94BC7Vn/6l/TjKLOrq4HQqSZV3DhDix27gA/RaZpreakseTeLkCXFArY5EoAi0MaynFM+BFfHNyTlfCdReyiWYZu7EoZEl1QyYmFaFARAYztlTqukqLplN2pIb/1I+QqPc1tTPklevHwTpZooc7SCxjcXod43DFE5MnGfdgLatmN0D55QgWpZgv3virbQsiL6Tgx8uw/ X-Forefront-PRVS: 0038DE95A2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(189002)(199003)(42186005)(48376002)(7846002)(33646002)(110136002)(107886002)(106356001)(53416004)(105586002)(4326007)(2906002)(66066001)(101416001)(3846002)(77096005)(189998001)(6116002)(7736002)(50986999)(4001430100002)(5009440100003)(8676002)(305945005)(19580405001)(47776003)(15975445007)(5003940100001)(50226002)(19580395003)(229853001)(36756003)(586003)(68736007)(81166006)(97736004)(81156014)(69596002)(50466002)(2351001)(92566002)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1714; H:localhost.localdomain.com; 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; BLUPR0701MB1714; 23:3xjgUGsPvsTa1ycTw84Z/vsJ1Ahsb9KnJpsGlK5?= =?us-ascii?Q?EeB0d8awZUmBzlCShioz37S0u78ne+2yuOVoiPhHFdWUZApoGvKicCuI6xJL?= =?us-ascii?Q?AeZY0Zyx9qddu4OvcEa2cQnu6jOduktmz66cEo2oMg6Cdp0+uMW2bRM0+kt1?= =?us-ascii?Q?cjwcA3djVB2bcGx+I62LsPGowo1zmQMiuCExK5t7UlgJtL3u8sCNCw7PQpwc?= =?us-ascii?Q?GcIH6kEGWEy+gMbv5ea0Fn0AfuF6wLFq/T7H1G2pB98h5O98TLBtOxqH+U2p?= =?us-ascii?Q?QYJIWQI1Ks6cuwEYcphFdO5Ibl51QG5VXj27lwaxN88+ArWT4XqdtcjMStoF?= =?us-ascii?Q?SjewbYZBcdMsWLauW0IhRodrkVfBtfmJSEXdMS4GWosT8Oo1Pj2a8StfsWCE?= =?us-ascii?Q?RRQsYvww1aa0yvy7aQXuO109IQC4P+P87s4QI2r2Tyi7bgR6jTybaxeniv91?= =?us-ascii?Q?9mIjaTGxc3hQjPlARSR6NN2on97iU3GyzA52JdPgsyPusmZeTo0oldJMxuOz?= =?us-ascii?Q?M5ejS3EvwbagF9HMT8BKYVYOd2ALGX0sanXtg+8OpI6HPTY2aom3ti4MguK2?= =?us-ascii?Q?BcGk2yqobNzAGvr3RXKXW5YdSWNzNQAtMC2iBTdmdZdkOLnHr0GAItaV/DzJ?= =?us-ascii?Q?oVISwCC4461b2RcobS9OLO79QCANlYYkFaE4ShYlwOdkPVfgupEkf2JQ2ZV6?= =?us-ascii?Q?ZM/LnMo8fg8TCR/XqLK2XoHm/lsAauXeSVHZjjn0TyXAuAw/XvtwsVK7gKbv?= =?us-ascii?Q?haAX2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U6BDkekfHcc2DqaVIq7c99s2BvcrXIDT/b40HC8Va+B6hU6lKacjvs=; 7:VwjZtJafSobVI1K+6bB2zj1/jTy9WIASlGzkBnEQL9VIv/v+hzRXfzRzbpF7QySlp829OX+cxfDBaWZ3E1NOH7rTmovbMnjiDTNzHF2ndSHoEajuIISMCjXFh2ti5eKQ3/6rICyzDfIUgRDs6oDDX0g2wfPlzlLp5pTbphN4q8JBY/j1EIyDivWg2HSNk/T2y4eRcaDuk8A52h9xzX7FMxISt10n2xW6eRCSSXZo6iPc54UoZpFGwmpLwFK4I6Ck SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2016 11:52:12.2156 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1714 Subject: [dpdk-dev] [PATCH] eal/armv8: high-resolution cycle counter X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 11:52:19 -0000 Existing cntvct_el0 based rte_rdtsc() provides portable means to get wall clock counter at user space. Typically it runs at <= 100MHz. The alternative method to enable rte_rdtsc() for high resolution wall clock counter is through armv8 PMU subsystem. The PMU cycle counter runs at CPU frequency, However, access to PMU cycle counter from user space is not enabled by default in the arm64 linux kernel. It is possible to enable cycle counter at user space access by configuring the PMU from the privileged mode (kernel space). by default rte_rdtsc() implementation uses portable cntvct_el0 scheme. Application can choose the PMU based implementation with CONFIG_RTE_ARM_EAL_RDTSC_USE_PMU Signed-off-by: Jerin Jacob --- The PMU based scheme useful for high accuracy performance profiling. Find below the example steps to configure the PMU based cycle counter on an armv8 machine. # git clone https://github.com/jerinjacobk/armv8_pmu_cycle_counter_el0 # cd armv8_pmu_cycle_counter_el0 # make # sudo insmod pmu_el0_cycle_counter.ko # cd $DPDK_DIR # make config T=arm64-armv8a-linuxapp-gcc # echo "CONFIG_RTE_ARM_EAL_RDTSC_USE_PMU=y" >> build/.config # make -j 4 --- .../common/include/arch/arm/rte_cycles_64.h | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h b/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h index 14f2612..867a946 100644 --- a/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h +++ b/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h @@ -45,6 +45,11 @@ extern "C" { * @return * The time base for this lcore. */ +#ifndef RTE_ARM_EAL_RDTSC_USE_PMU +/** + * This call is portable to any ARMv8 architecture, however, typically + * cntvct_el0 runs at <= 100MHz and it may be imprecise for some tasks. + */ static inline uint64_t rte_rdtsc(void) { @@ -53,6 +58,34 @@ rte_rdtsc(void) asm volatile("mrs %0, cntvct_el0" : "=r" (tsc)); return tsc; } +#else +/** + * This is an alternative method to enable rte_rdtsc() with high resolution + * PMU cycles counter.The cycle counter runs at cpu frequency and this scheme + * uses ARMv8 PMU subsystem to get the cycle counter at userspace, However, + * access to PMU cycle counter from user space is not enabled by default in + * arm64 linux kernel. + * It is possible to enable cycle counter at user space access by configuring + * the PMU from the privileged mode (kernel space). + * + * asm volatile("msr pmintenset_el1, %0" : : "r" ((u64)(0 << 31))); + * asm volatile("msr pmcntenset_el0, %0" :: "r" BIT(31)); + * asm volatile("msr pmuserenr_el0, %0" : : "r"(BIT(0) | BIT(2))); + * asm volatile("mrs %0, pmcr_el0" : "=r" (val)); + * val |= (BIT(0) | BIT(2)); + * isb(); + * asm volatile("msr pmcr_el0, %0" : : "r" (val)); + * + */ +static inline uint64_t +rte_rdtsc(void) +{ + uint64_t tsc; + + asm volatile("mrs %0, pmccntr_el0" : "=r"(tsc)); + return tsc; +} +#endif static inline uint64_t rte_rdtsc_precise(void) -- 2.5.5