From patchwork Tue May 5 21:17:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 186215 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp1514434ill; Tue, 5 May 2020 14:17:49 -0700 (PDT) X-Google-Smtp-Source: APiQypLreEIjaRhj4ZmMn9Tc6yyY8PE6SE73iTtiQPl9INYXGM8yOxcQrUapCZ3oM1hRbY8M0Qfi X-Received: by 2002:a50:f74c:: with SMTP id j12mr4691682edn.197.1588713469088; Tue, 05 May 2020 14:17:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588713469; cv=none; d=google.com; s=arc-20160816; b=n2n1DYzrQI5yaTTcYtK2/myUWirYHi0Bw7fIRDany0fv0Ty73QYB6h7hunO60CzHZQ y6BcvgECZ5gwAM3Huq7DToVg2OByqLsQACoEa/TViPWQYLvSeeBzoTWGJ24cvuo0T1cI 6rH4hm+cVk+lzqIkR8xKdibw3BhKJj/IIUJcrnQ3GZUSJqbr3hBm5dnoNl4Mayafqh7a IchRLlxN/Tzwxnf6m8upMLtagAHb47JkZ7YFhZhwHmeawEGyFmoUwxl3N/PRkNaW755b cLaraE/6E6LWgzGAOpnZGrjf6LRoIjHeo3l58CNLKmR1ctnGVHlxUdHLpfuaxKyTShz9 nw/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=zNIJqADjkkg6ztMWJp4L0/EjPWn2QRNcnoOh90+Q3AI=; b=KUUs3tQneFrQeNfYn3jSLT5BmcdrazA/9QxDpdv6pNAAJ196aRpnwFCr0zbxJ0YHH8 +0hjYyBLwDTLPHot9ppBgbHuXpaF0ykuJniC0r2NYibzwI1J+P9Wa+XinMH3+xbJUmv9 7qJsLbjfvfmRkYySpf4TqAuyLcZeZ3hPG6RoeUIsVZQRdnUZeKAglcSZPvNNxSXkEUv1 MnWVdHndryf+PV6WVaG6s73CaLZxMDsOCTLl6zPoMQJG/umIndhVDhqtEWAH5bND92WW kasZ6VXLs5mgaA8rQPEkX9lSCc/h5eNjZ0ssgZllQdyCx0Xzh8mRNTYJor/hxkjfE3b8 LsQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id x15si2039237edl.247.2020.05.05.14.17.48; Tue, 05 May 2020 14:17:49 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D4C801D67E; Tue, 5 May 2020 23:17:47 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id F398D1D658 for ; Tue, 5 May 2020 23:17:46 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 65B3630E; Tue, 5 May 2020 14:17:46 -0700 (PDT) Received: from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com [10.118.14.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5271D3F305; Tue, 5 May 2020 14:17:46 -0700 (PDT) From: Honnappa Nagarahalli To: dev@dpdk.org, phil.yang@arm.com, harry.van.haaren@intel.com Cc: thomas@monjalon.net, david.marchand@redhat.com, konstantin.ananyev@intel.com, jerinj@marvell.com, hemant.agrawal@nxp.com, gage.eads@intel.com, bruce.richardson@intel.com, honnappa.nagarahalli@arm.com, nd@arm.com Date: Tue, 5 May 2020 16:17:26 -0500 Message-Id: <20200505211732.25291-1-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <1587659482-27133-1-git-send-email-phil.yang@arm.com> References: <1587659482-27133-1-git-send-email-phil.yang@arm.com> Subject: [dpdk-dev] [PATCH v4 0/6] use c11 atomics for service core lib 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" The rte_atomic ops and rte_smp barriers enforce DMB barriers on aarch64. Using c11 atomics with explicit memory ordering instead of the rte_atomic ops and rte_smp barriers for inter-threads synchronization can uplift the performance on aarch64 and no performance loss on x86. This patchset contains: 1) fix race condition for MT unsafe service. 2) clean up redundant code. 3) use c11 atomics for service core lib to avoid unnecessary barriers. v2: Still waiting on Harry for the final solution on the MT unsafe race condition issue. But I have incorporated the comments so far. 1. add 'Fixes' tag for bug-fix patches. 2. remove 'Fixes' tag for code cleanup patches. 3. remove unused parameter for service_dump_one function. 4. replace the execute_lock atomic CAS operation to spinlock_try_lock. 5. use c11 atomics with RELAXED memory ordering for num_mapped_cores. 6. relax barriers for guard variables runstate, comp_runstate and app_runstate with c11 one-way barriers. v3: Sending this version since Phil is on holiday. 1. Updated the API documentation to indicate how the locking can be avoided. v4: 1. Fix the nits in 2/6 commit message and comments in code. Honnappa Nagarahalli (2): service: fix race condition for MT unsafe service service: fix identification of service running on other lcore Phil Yang (4): service: remove rte prefix from static functions service: remove redundant code service: optimize with c11 atomics service: relax barriers with C11 atomics lib/librte_eal/common/rte_service.c | 234 ++++++++++-------- lib/librte_eal/include/rte_service.h | 8 +- .../include/rte_service_component.h | 6 +- lib/librte_eal/meson.build | 4 + 4 files changed, 141 insertions(+), 111 deletions(-) -- 2.17.1