From patchwork Tue Jan 28 21:02:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Tran X-Patchwork-Id: 65283 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1A59CA04B3; Tue, 28 Jan 2020 22:03:38 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 888F81D5F6; Tue, 28 Jan 2020 22:02:45 +0100 (CET) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by dpdk.org (Postfix) with ESMTP id 8E0C91D5BF for ; Tue, 28 Jan 2020 22:02:44 +0100 (CET) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 00SKrqpL117296 for ; Tue, 28 Jan 2020 16:02:43 -0500 Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com with ESMTP id 2xrgvnph4q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 28 Jan 2020 16:02:43 -0500 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 00SL2CmS014600 for ; Tue, 28 Jan 2020 21:02:42 GMT Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by ppma02dal.us.ibm.com with ESMTP id 2xrda6ktup-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 28 Jan 2020 21:02:42 +0000 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 00SL2fkl39387408 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jan 2020 21:02:41 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1AF78BE04F; Tue, 28 Jan 2020 21:02:41 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DE082BE053; Tue, 28 Jan 2020 21:02:40 +0000 (GMT) Received: from LAPTOP-EKJMKVH8.austin.ibm.com (unknown [9.41.98.98]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 28 Jan 2020 21:02:40 +0000 (GMT) From: Thinh Tran To: dev@dpdk.org Cc: drc@linux.vnet.ibm.com, Thinh Tran Date: Tue, 28 Jan 2020 15:02:33 -0600 Message-Id: <20200128210233.691-1-thinhtr@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-01-28_08:2020-01-28, 2020-01-28 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=1 mlxlogscore=739 impostorscore=0 bulkscore=0 priorityscore=1501 clxscore=1011 spamscore=0 phishscore=0 lowpriorityscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1911200001 definitions=main-2001280157 Subject: [dpdk-dev] [PATCH] eal/ppc64: improve rte_rdtsc with ppc_get_timebase 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" __ppc_get_timebase() is GNU extention and is more efficient Signed-off-by: Thinh Tran Reviewed-by: David Christensen --- .../common/include/arch/ppc_64/rte_cycles.h | 28 ++----------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_cycles.h b/lib/librte_eal/common/include/arch/ppc_64/rte_cycles.h index 8f2e98642..871f9b6e4 100644 --- a/lib/librte_eal/common/include/arch/ppc_64/rte_cycles.h +++ b/lib/librte_eal/common/include/arch/ppc_64/rte_cycles.h @@ -14,6 +14,7 @@ extern "C" { #include #include +#include /** * Read the time base register. @@ -24,32 +25,7 @@ extern "C" { static inline uint64_t rte_rdtsc(void) { - union { - uint64_t tsc_64; - RTE_STD_C11 - struct { -#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN - uint32_t hi_32; - uint32_t lo_32; -#else - uint32_t lo_32; - uint32_t hi_32; -#endif - }; - } tsc; - uint32_t tmp; - - asm volatile( - "0:\n" - "mftbu %[hi32]\n" - "mftb %[lo32]\n" - "mftbu %[tmp]\n" - "cmpw %[tmp],%[hi32]\n" - "bne 0b\n" - : [hi32] "=r"(tsc.hi_32), [lo32] "=r"(tsc.lo_32), - [tmp] "=r"(tmp) - ); - return tsc.tsc_64; + return __ppc_get_timebase(); } static inline uint64_t