From patchwork Thu Nov 7 21:35:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 62706 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 62F28A04AB; Thu, 7 Nov 2019 22:36:11 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 969C11BFF4; Thu, 7 Nov 2019 22:35:53 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id 184681BFE2 for ; Thu, 7 Nov 2019 22:35:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573162550; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7FcBahTFoLUWe7kYcAz2Bkf5qFTqB8bzGqgv9/zW4F4=; b=EkGVsCSJ9X5Atn52q0h3VkYd1VNYA6U5pyVNRpUE0YkJJuzh3p9txLBYXgv9ZYk22KZfk7 CHB1zaJXCHO/3UpI+QdEr2gigrVTWTpLLSjtyK0hn6/Od6JC2aA2HNd7rUy7LuEnStFs63 n0aAyvn8X/YDElKYqIu0h68+LlU4UAQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-150-YEu60hSLMMSohNpRQVyI2Q-1; Thu, 07 Nov 2019 16:35:46 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1CD731005500; Thu, 7 Nov 2019 21:35:45 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-222.brq.redhat.com [10.40.204.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E008608B2; Thu, 7 Nov 2019 21:35:42 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: nd@arm.com, konstantin.ananyev@intel.com, Gavin Hu , Joyce Kong Date: Thu, 7 Nov 2019 22:35:26 +0100 Message-Id: <1573162528-16230-4-git-send-email-david.marchand@redhat.com> In-Reply-To: <1573162528-16230-1-git-send-email-david.marchand@redhat.com> References: <1561911676-37718-1-git-send-email-gavin.hu@arm.com> <1573162528-16230-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: YEu60hSLMMSohNpRQVyI2Q-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH v13 3/5] ticketlock: use new API to reduce contention on aarch64 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" From: Gavin Hu While using ticket lock, cores repeatedly poll the lock variable. This is replaced by rte_wait_until_equal API. Running ticketlock_autotest on ThunderX2, Ampere eMAG80, and Arm N1SDP[1], there were variances between runs, but no notable performance gain or degradation were seen with and without this patch. [1] https://community.arm.com/developer/tools-software/oss-platforms/w/\ docs/440/neoverse-n1-sdp Signed-off-by: Gavin Hu Reviewed-by: Honnappa Nagarahalli Tested-by: Phil Yang Tested-by: Pavan Nikhilesh Reviewed-by: Jerin Jacob --- lib/librte_eal/common/include/generic/rte_ticketlock.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/librte_eal/common/include/generic/rte_ticketlock.h b/lib/librte_eal/common/include/generic/rte_ticketlock.h index d9bec87..c295ae7 100644 --- a/lib/librte_eal/common/include/generic/rte_ticketlock.h +++ b/lib/librte_eal/common/include/generic/rte_ticketlock.h @@ -66,8 +66,7 @@ static inline void rte_ticketlock_lock(rte_ticketlock_t *tl) { uint16_t me = __atomic_fetch_add(&tl->s.next, 1, __ATOMIC_RELAXED); - while (__atomic_load_n(&tl->s.current, __ATOMIC_ACQUIRE) != me) - rte_pause(); + rte_wait_until_equal_16(&tl->s.current, me, __ATOMIC_ACQUIRE); } /**