From patchwork Tue Oct 8 21:12:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 175576 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6230868ill; Tue, 8 Oct 2019 14:12:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqysE0iLAOu7LJ7H0WFn2PM47yY6oJeWXo8Snr94paoProXVYr8Rsq43vNs5tQxKY7zQdFCm X-Received: by 2002:a17:906:1f57:: with SMTP id d23mr31372669ejk.103.1570569164157; Tue, 08 Oct 2019 14:12:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570569164; cv=none; d=google.com; s=arc-20160816; b=q1SoUM3eOE6EVgHnbJd6rr/GhJC5W/qItxfgXyPagI9B6b43NqTwixQnr0l+RrSvOF l4Wpf7P4CCAYJSjvKa3PBqPVr5vDHWenVYnAVh4CRedcEvoeMcjBVI6oGfm4qCYqQUA9 n40h2sM7fB/tKDXHHEQ28PqkGC0+YYvtdBAS+z4Z0FEL1akRTZEySSmNwmpJnT60TcNs XRcBQiKdtmxUuGoi5PBT9QRP0VR8wJlbwKelpBFvdGs/gYuWLNTn4iejIKpTCdbMsQpK xsn7A2oVARwt/ikQvjAnLXfLf8beFVnT7g39J8DfhUOJL+gWF+4dtrET/CEH0r7CPAfP Ei/Q== 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=kvfGr4DKZy5j3QNPzfpyjUtZMohBZzTnp1s3rclQedI=; b=0cMgg/E/SAurZt2nHtXGPoY3QYdRC37p9e2xIaeTir4p/NnHPNyWcK7i5ve5MJ6Zsj Zu5lQmz4dUrpM73sM/32RkMKJQeJVIxVRjzSQR5KMAyKzFKfJXVPT8toGU/Z1zp/ScDv 1KdAAwqwjnASA10bPe6xqdh1zrgpCGL1FSGzBG88wMUGKWKtKjesl0hUOfmD4x55u2wD W9oIUygzoYfBy7Niu2QIy8vK5cqHDJJ+PqttLpz9ew+xRN+1NCHWHfZxaOksPcPI0fIv 7pjYC3qlbeHscASKYt5jhQW2PCPBAQdbieSgRZXOUbcogholyM6RDJVHrtjWXsEZfX/S 5MIw== 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 p14si158421eda.411.2019.10.08.14.12.43; Tue, 08 Oct 2019 14:12:44 -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 26BD41C119; Tue, 8 Oct 2019 23:12:42 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 304731C124; Tue, 8 Oct 2019 23:12:40 +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 856CA28; Tue, 8 Oct 2019 14:12:39 -0700 (PDT) Received: from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com [10.118.12.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7467B3F68E; Tue, 8 Oct 2019 14:12:39 -0700 (PDT) From: Honnappa Nagarahalli To: honnappa.nagarahalli@arm.com, david.marchand@redhat.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org, ruifeng.wang@arm.com, stable@dpdk.org, nd@arm.com Date: Tue, 8 Oct 2019 16:12:14 -0500 Message-Id: <20191008211220.31586-2-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191008211220.31586-1-honnappa.nagarahalli@arm.com> References: <20191008211220.31586-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH v2 1/7] doc/rcu: fix typos 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" Fix typos. Fixes: 64994b56cfd7 ("rcu: add RCU library supporting QSBR mechanism") Cc: stable@dpdk.org Signed-off-by: Honnappa Nagarahalli Reviewed-by: Ruifeng Wang Reviewed-by: Gavin Hu --- doc/guides/prog_guide/rcu_lib.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/doc/guides/prog_guide/rcu_lib.rst b/doc/guides/prog_guide/rcu_lib.rst index 8fe5b1f73..c019dfca8 100644 --- a/doc/guides/prog_guide/rcu_lib.rst +++ b/doc/guides/prog_guide/rcu_lib.rst @@ -37,8 +37,8 @@ What is Quiescent State ----------------------- Quiescent State can be defined as "any point in the thread execution where the -thread does not hold a reference to shared memory". It is up to the application -to determine its quiescent state. +thread does not hold a reference to shared memory". It is the responsibility of +the application to determine its quiescent state. Let us consider the following diagram: @@ -76,7 +76,7 @@ Factors affecting the RCU mechanism It is important to make sure that this library keeps the overhead of identifying the end of grace period and subsequent freeing of memory, -to a minimum. The following explains how grace period and critical +to a minimum. The following paras explain how grace period and critical section affect this overhead. The writer has to poll the readers to identify the end of grace period. @@ -91,14 +91,14 @@ critical sections smaller requires additional CPU cycles (due to additional reporting) in the readers. Hence, we need the characteristics of a small grace period and large critical -section. This library addresses this by allowing the writer to do -other work without having to block until the readers report their quiescent -state. +section. This library addresses these characteristics by allowing the writer +to do other work without having to block until the readers report their +quiescent state. RCU in DPDK ----------- -For DPDK applications, the start and end of a ``while(1)`` loop (where no +For DPDK applications, the beginning and end of a ``while(1)`` loop (where no references to shared data structures are kept) act as perfect quiescent states. This will combine all the shared data structure accesses into a single, large critical section which helps keep the overhead on the @@ -106,11 +106,11 @@ reader side to a minimum. DPDK supports a pipeline model of packet processing and service cores. In these use cases, a given data structure may not be used by all the -workers in the application. The writer does not have to wait for all -the workers to report their quiescent state. To provide the required -flexibility, this library has a concept of a QS variable. The application -can create one QS variable per data structure to help it track the -end of grace period for each data structure. This helps keep the grace +workers in the application. The writer has to wait only for the workers that +use the data structure to report their quiescent state. To provide the required +flexibility, this library has a concept of a QS variable. If required, the +application can create one QS variable per data structure to help it track the +end of grace period for each data structure. This helps keep the length of grace period to a minimum. How to use this library From patchwork Tue Oct 8 21:12:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 175577 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6231053ill; Tue, 8 Oct 2019 14:12:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKShAdjzRV1qVHZ6FC9RE6G+tw/pmxRFC5vcRqUUB/VVACYZ+oQm/ulvnNGLDeHNlKF7rx X-Received: by 2002:a05:6402:19b4:: with SMTP id o20mr81933edz.10.1570569173102; Tue, 08 Oct 2019 14:12:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570569173; cv=none; d=google.com; s=arc-20160816; b=B8IWvELiT4Xy/g408lKUPVmFLMmNjlY7qy84dqYxc0xBX89jFptz0GfOTNlGuRlvH6 5Dl71+oK2JnK+pt+/qxgiWYSsjdBUO7CUhbOHNcDYHpynlJbPtbsConxOUh9s2JnY9Pg Xik/188ZjrwjLHoVebIC/TpLNKLT4rT7jUgpETQIo5izijuLOkPXnmSRdYcK7Sx9FB8L ZFqoM0rvWiugRBSYX5TmmBth+zcbzlt4nlVcK+IxS4pTqaLGgJogVnSh5ttex8jRJ4WA mnTTEbjaqfnjO8R9mZOjmW3rq2vtRBDAA9UAjFybwE6p7xxi5u4ofeq1ohlTselkBvoq qbnA== 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=/y8avZxX8ltkMfLPAcKnC91XiUEBl4aMBfJQ/SeFed8=; b=RoUgvShrKZvw+Wx9vr6J8dMN9tKM0nCRGYXwCEOBH4+y5d1QZg2u/eVP4KXmS6jzmX wEZnExG5xquVZSqbrm8SqUZEuwvUk6Shu5VeQa1qbq+QceaJUjuNt9Ol7HmyaJhsjA50 VSuBJooREU4NwBB+5fu+lvm0Hd1qX991aEiHdnMFTUPRJuFwE+HMuQtIbBGTmRWfJ8uH eAHBzswtAuwA9r/mmkwFceFqgw4Gf58fgEA6BxqdjiQV8uDkOjMU1RMP8mN9JCARl2xQ 76nIxMXJ6y9X7izRXcK8X/++TMv1fGIaTYXaulGrAtoN4fEWnN9RlxVwax+z25J0pVBP vTHA== 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 p22si38292ejf.278.2019.10.08.14.12.52; Tue, 08 Oct 2019 14:12:53 -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 2B6301C195; Tue, 8 Oct 2019 23:12:45 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id D6CE31C0D2; Tue, 8 Oct 2019 23:12:40 +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 69E7D337; Tue, 8 Oct 2019 14:12:40 -0700 (PDT) Received: from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com [10.118.12.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 633123F68E; Tue, 8 Oct 2019 14:12:40 -0700 (PDT) From: Honnappa Nagarahalli To: honnappa.nagarahalli@arm.com, david.marchand@redhat.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org, ruifeng.wang@arm.com, stable@dpdk.org, nd@arm.com Date: Tue, 8 Oct 2019 16:12:15 -0500 Message-Id: <20191008211220.31586-3-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191008211220.31586-1-honnappa.nagarahalli@arm.com> References: <20191008211220.31586-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH v2 2/7] doc/rcu: correct the limitation on number of threads 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" There is no limitation of 1024 reader threads. Fixes: 64994b56cfd7 ("rcu: add RCU library supporting QSBR mechanism") Cc: stable@dpdk.org Signed-off-by: Honnappa Nagarahalli Reviewed-by: Ruifeng Wang Reviewed-by: Gavin Hu --- doc/guides/prog_guide/rcu_lib.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.17.1 diff --git a/doc/guides/prog_guide/rcu_lib.rst b/doc/guides/prog_guide/rcu_lib.rst index c019dfca8..4d1ed3954 100644 --- a/doc/guides/prog_guide/rcu_lib.rst +++ b/doc/guides/prog_guide/rcu_lib.rst @@ -120,8 +120,7 @@ The application must allocate memory and initialize a QS variable. Applications can call ``rte_rcu_qsbr_get_memsize()`` to calculate the size of memory to allocate. This API takes a maximum number of reader threads, -using this variable, as a parameter. Currently, a maximum of 1024 threads -are supported. +using this variable, as a parameter. Further, the application can initialize a QS variable using the API ``rte_rcu_qsbr_init()``. From patchwork Tue Oct 8 21:12:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 175578 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6231251ill; Tue, 8 Oct 2019 14:13:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2XMrCc346f1eqiTf5zMJ+iNrxyTDhSY9feVUnru/BC74+Y+4QphRCtrAs4Iq4pCXa8xz2 X-Received: by 2002:aa7:db43:: with SMTP id n3mr67692edt.176.1570569182816; Tue, 08 Oct 2019 14:13:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570569182; cv=none; d=google.com; s=arc-20160816; b=UGwk6xTGnFeKzoaWKSEDtJNYvsCW9tnrjeVCdx3gIUeuex5NI7ZvFdHdT1TiPB1fQs EVtZu9O5K04qjQwurx102pRgtea1oZrQRl+lQKsHgpMchCMap5v5VEQ9i0XOscPsn8IX OcPa5owDQP9hg17yTtr702QPXteFYMwXbxWFUTkLvuL6FC8JcHLO8aWZxGc8GhJXdl69 DKsB1XtYNoiMI+KFTCVdClK/K91bPkFcy6Q+03s1SVoijjwwiQIwwybqqcCC+4SJLX0J nkWvfla9TD5U2nifXT54AfFHONPSBYyhK2EkzrSMe0BI1YxEJnc8ve3v2mG1IKiMOoyR QpDg== 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=zFfpJlc1r0SNDnlZaKxy8seOd6LoByrZyTSF9iy0q54=; b=DAc5oFgN4/LImgohUKhUb/gWm4+Dt1o0nLG9Qvm6A81LUmxgehPN1atSLWucFBMTRO hBipzkN96XTmtnTWBqRY9enRxEgLWc2kOJUsvis4809OOtmllfk1s/xPFkpGTmFSxdul XcgmcMIYoWXAlCsXboHmHkGB+lyx4SqB54NppShdr60SWxK1mlxENM8CSG2egKsf4AJ5 btb7q/c6GsfbcYvZEkKEbJfhdzm0hFsys4jigeFxt9r1JgK46daZJqInDskd4QSsBIPB t/yyiVoAfAKp3AigVRWGjUiggFSORF6Se5RkkfyjAclwCDV8E7caUhlk65txUdS73tKI fJ1g== 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 q1si112000edj.354.2019.10.08.14.13.02; Tue, 08 Oct 2019 14:13:02 -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 9851F1C43E; Tue, 8 Oct 2019 23:12:47 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id B444F1C0D2; Tue, 8 Oct 2019 23:12:41 +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 3FEA615BE; Tue, 8 Oct 2019 14:12:41 -0700 (PDT) Received: from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com [10.118.12.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 300533F68E; Tue, 8 Oct 2019 14:12:41 -0700 (PDT) From: Honnappa Nagarahalli To: honnappa.nagarahalli@arm.com, david.marchand@redhat.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org, ruifeng.wang@arm.com, stable@dpdk.org, nd@arm.com Date: Tue, 8 Oct 2019 16:12:16 -0500 Message-Id: <20191008211220.31586-4-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191008211220.31586-1-honnappa.nagarahalli@arm.com> References: <20191008211220.31586-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH v2 3/7] doc/rcu: add information about storing token and resource 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" After calling rte_rcu_qsbr_start API, the token and the deleted resource need to be stored for subsequent query/free. Fixes: 64994b56cfd7 ("rcu: add RCU library supporting QSBR mechanism") Cc: stable@dpdk.org Signed-off-by: Honnappa Nagarahalli Reviewed-by: Gavin Hu --- doc/guides/prog_guide/rcu_lib.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/doc/guides/prog_guide/rcu_lib.rst b/doc/guides/prog_guide/rcu_lib.rst index 4d1ed3954..8d0dfcf29 100644 --- a/doc/guides/prog_guide/rcu_lib.rst +++ b/doc/guides/prog_guide/rcu_lib.rst @@ -162,14 +162,19 @@ running as worker threads. The separation of triggering the reporting from querying the status provides the writer threads flexibility to do useful work instead of blocking for the reader threads to enter the quiescent state or go offline. This reduces the -memory accesses due to continuous polling for the status. +memory accesses due to continuous polling for the status. But, since the +resource is freed at a later time, the token and the reference to the deleted +resource need to be stored for later queries. The ``rte_rcu_qsbr_synchronize()`` API combines the functionality of ``rte_rcu_qsbr_start()`` and blocking ``rte_rcu_qsbr_check()`` into a single API. This API triggers the reader threads to report their quiescent state and polls till all the readers enter the quiescent state or go offline. This API does not allow the writer to do useful work while waiting and introduces -additional memory accesses due to continuous polling. +additional memory accesses due to continuous polling. However, the application +does not have to store the token or the reference to the deleted resource. The +resource can be freed immediately after ``rte_rcu_qsbr_synchronize()`` API +returns. The reader thread must call ``rte_rcu_qsbr_thread_offline()`` and ``rte_rcu_qsbr_thread_unregister()`` APIs to remove itself from reporting its From patchwork Tue Oct 8 21:12:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 175579 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6231382ill; Tue, 8 Oct 2019 14:13:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyj6MngFx6mqs2KMhiZkiI8K2cLWz8mLZ1nqch8voBfobY9Ev5+ZBsKto6IAO2pjcaNq27G X-Received: by 2002:a17:906:1c06:: with SMTP id k6mr30132312ejg.217.1570569190960; Tue, 08 Oct 2019 14:13:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570569190; cv=none; d=google.com; s=arc-20160816; b=fLyrBxNhEKpGtyQQwEcaYKl3ilnhbTLHsR2PYiDoz50DikUgG1esPlNZfxGIXGJNTK ySBUoeZu4gXQE8sb2D8rElL4hAij4gk942d5eukUWp+q3wxs0uB8Rg2Qg7hReaC2TzmX 54GyGqbmqwYOvaMd5kcTC1xmzIYV2maJkPmn2zwqnrZ+pAe0SZkJQieT9b0kEdmgstxM 1aY/V3xC1TFO7TKefgpwvLWfa+hdNEPdF58LZTjwm4fd7w+Y9pQCwUxO0GcBQeaVdCC6 qf/brEzcr++/Lmlb5xVLX8LhGzeLvZi5ZqE18bePLF3WFE/hVukyRaote/zDNcZPZ0iJ WRnw== 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=RuvYhJ825n44r/OVzpnGsj+IJEwnHXfy6AAD4Kmcwo8=; b=Fydp8QGigzg006Wg9WekCH1mRLFVjE75T7Xsnbo4YYNjpXbikGUdjwFiiqCglBjkWi aSyOG7hbF5HAFxvD8+uKnxoTRHgFA+wBDdzCfZDWQu/VU7X5tSyxg+VqjSu1Pgs2EMaH vIbGupPKIh/oAtcesibpgCr62mqePpDY1R0hR5IF/va3LCzF4HFYBC9UUDGLOoEh8FYr 2jlAekRwB5+YK9Jr9H+7sp8Bfd5kO4b0UDArbyIP7yilOHwxeMTwJB1/ypKHPMKXQqsT GJC1lAx8n3NAHIBaskY79y8Q5sU1S/iTvx1ULJryoI0k3r0EAORy2MeaDIArn14l+DXt SAdw== 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 f20si117945edm.365.2019.10.08.14.13.10; Tue, 08 Oct 2019 14:13:10 -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 E5B111D161; Tue, 8 Oct 2019 23:12:49 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id BBE4A1C134; Tue, 8 Oct 2019 23:12:42 +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 1015315BF; Tue, 8 Oct 2019 14:12:42 -0700 (PDT) Received: from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com [10.118.12.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F335B3F68E; Tue, 8 Oct 2019 14:12:41 -0700 (PDT) From: Honnappa Nagarahalli To: honnappa.nagarahalli@arm.com, david.marchand@redhat.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org, ruifeng.wang@arm.com, stable@dpdk.org, nd@arm.com Date: Tue, 8 Oct 2019 16:12:17 -0500 Message-Id: <20191008211220.31586-5-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191008211220.31586-1-honnappa.nagarahalli@arm.com> References: <20191008211220.31586-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH v2 4/7] test/rcu: use size_t instead of int 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" Variables used to store the return value of rte_rcu_qsbr_get_memsize in variables of type 'int'. The variables are of type 'size_t' now. Fixes: b87089b0bb19 ("test/rcu: add API and functional tests") Cc: stable@dpdk.org Signed-off-by: Honnappa Nagarahalli Reviewed-by: Gavin Hu --- app/test/test_rcu_qsbr.c | 4 ++-- app/test/test_rcu_qsbr_perf.c | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/app/test/test_rcu_qsbr.c b/app/test/test_rcu_qsbr.c index d1b9e46a2..2f71ec6ad 100644 --- a/app/test/test_rcu_qsbr.c +++ b/app/test/test_rcu_qsbr.c @@ -52,7 +52,7 @@ static int alloc_rcu(void) { int i; - uint32_t sz; + size_t sz; sz = rte_rcu_qsbr_get_memsize(RTE_MAX_LCORE); @@ -81,7 +81,7 @@ free_rcu(void) static int test_rcu_qsbr_get_memsize(void) { - uint32_t sz; + size_t sz; printf("\nTest rte_rcu_qsbr_thread_register()\n"); diff --git a/app/test/test_rcu_qsbr_perf.c b/app/test/test_rcu_qsbr_perf.c index cb2d177b7..280f1811f 100644 --- a/app/test/test_rcu_qsbr_perf.c +++ b/app/test/test_rcu_qsbr_perf.c @@ -125,7 +125,7 @@ test_rcu_qsbr_writer_perf(void *arg) static int test_rcu_qsbr_perf(void) { - int sz; + size_t sz; unsigned int i, tmp_num_cores; writer_done = 0; @@ -188,7 +188,7 @@ test_rcu_qsbr_perf(void) static int test_rcu_qsbr_rperf(void) { - int sz; + size_t sz; unsigned int i, tmp_num_cores; rte_atomic64_clear(&updates); @@ -234,7 +234,7 @@ test_rcu_qsbr_rperf(void) static int test_rcu_qsbr_wperf(void) { - int sz; + size_t sz; unsigned int i; rte_atomic64_clear(&checks); @@ -379,7 +379,7 @@ static int test_rcu_qsbr_sw_sv_1qs(void) { uint64_t token, begin, cycles; - int sz; + size_t sz; unsigned int i, j, tmp_num_cores; int32_t pos; @@ -498,7 +498,8 @@ static int test_rcu_qsbr_sw_sv_1qs_non_blocking(void) { uint64_t token, begin, cycles; - int ret, sz; + int ret; + size_t sz; unsigned int i, j, tmp_num_cores; int32_t pos; From patchwork Tue Oct 8 21:12:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 175580 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6231531ill; Tue, 8 Oct 2019 14:13:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwUdtt6hhaaA3lrwagFEnId+L+KwPVElODFlWazGmOlLVxr/wdnzWe7HG/XrVvmX5IJotOn X-Received: by 2002:a17:906:60a:: with SMTP id s10mr5743899ejb.300.1570569200349; Tue, 08 Oct 2019 14:13:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570569200; cv=none; d=google.com; s=arc-20160816; b=ACyP/4qPesSkwpKlSdv4aH9ZbA3rkPAPNmElqpOiMhoE25NwxsvOIILVwFjj455X1o S8x9fYeHpn40AjDQI/NM/vIbifcKh5nhMvPzbQpoF315Skge3xwyc9vIrWI4hVme+wlb 3d9F8sZ+hW6WcvwLpukQoWC+Ik9Be+h39Jj7yuKZaIfBIF+LDU/c1WhVZeJEuExp/KQ7 OF6f7H2Se4COUGDzz6E5cV0Q7wOZNTc/Pw6ow8UCBbeFmkHBxHDbt3TIBAh73L89/B0T QkhvDfbfwD3dFT50jNeKwTYqyk6Nz6vJZdgmSORqlJGPhkgRdwQeAypseHiMjMmQXYeS PiOw== 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=AeezKaGDRR1hRVjYeLAZIsaGS1cCTRn76j420sJPKUI=; b=d0QASSlbkjIZTHTU+hBLjfHgr3eujnhTxTbv/vFM8xuME/fkozxQlKiMPxtRg/+Klk avln61GLAeRpv43XYckd1vJAFIqtoreNJnbZeW1CuQrXuLOLHCHsWgTcG/STH5kZLFHm THgIliP3YlviRgDxa5AbKBZtIGZnwC8RJFrG/ohuDR+He5aBOiEeK/Kl+6HijPf8J7N9 +h5bvByjRoWbs8+xINwQXgpUotqvUOc7KkbZA5xKRZklrq98G4IlVliLwNh54RXGqjfe 3NBzIWYNbFAqUkJmarYR/dg3Rv+NZUmC+FlNZlhOYnonyVER3F4cjoK01HfYEAKNXB+R Ok6g== 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 qn24si43597ejb.200.2019.10.08.14.13.20; Tue, 08 Oct 2019 14:13:20 -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 DD2E81D419; Tue, 8 Oct 2019 23:12:51 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 696301C134; Tue, 8 Oct 2019 23:12:43 +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 E9BA928; Tue, 8 Oct 2019 14:12:42 -0700 (PDT) Received: from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com [10.118.12.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E22BD3F68E; Tue, 8 Oct 2019 14:12:42 -0700 (PDT) From: Honnappa Nagarahalli To: honnappa.nagarahalli@arm.com, david.marchand@redhat.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org, ruifeng.wang@arm.com, stable@dpdk.org, nd@arm.com Date: Tue, 8 Oct 2019 16:12:18 -0500 Message-Id: <20191008211220.31586-6-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191008211220.31586-1-honnappa.nagarahalli@arm.com> References: <20191008211220.31586-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH v2 5/7] test/rcu: use correct nomenclature while printing results 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" Use 'quiescent state updates' instead of just 'updates'. Signed-off-by: Honnappa Nagarahalli Reviewed-by: Gavin Hu --- app/test/test_rcu_qsbr_perf.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/app/test/test_rcu_qsbr_perf.c b/app/test/test_rcu_qsbr_perf.c index 280f1811f..d35a6d089 100644 --- a/app/test/test_rcu_qsbr_perf.c +++ b/app/test/test_rcu_qsbr_perf.c @@ -167,8 +167,10 @@ test_rcu_qsbr_perf(void) /* Wait until all readers have exited */ rte_eal_mp_wait_lcore(); - printf("Total RCU updates = %"PRIi64"\n", rte_atomic64_read(&updates)); - printf("Cycles per %d updates: %"PRIi64"\n", RCU_SCALE_DOWN, + printf("Total quiescent state updates = %"PRIi64"\n", + rte_atomic64_read(&updates)); + printf("Cycles per %d quiescent state updates: %"PRIi64"\n", + RCU_SCALE_DOWN, rte_atomic64_read(&update_cycles) / (rte_atomic64_read(&updates) / RCU_SCALE_DOWN)); printf("Total RCU checks = %"PRIi64"\n", rte_atomic64_read(&checks)); @@ -217,8 +219,10 @@ test_rcu_qsbr_rperf(void) /* Wait until all readers have exited */ rte_eal_mp_wait_lcore(); - printf("Total RCU updates = %"PRIi64"\n", rte_atomic64_read(&updates)); - printf("Cycles per %d updates: %"PRIi64"\n", RCU_SCALE_DOWN, + printf("Total quiescent state updates = %"PRIi64"\n", + rte_atomic64_read(&updates)); + printf("Cycles per %d quiescent state updates: %"PRIi64"\n", + RCU_SCALE_DOWN, rte_atomic64_read(&update_cycles) / (rte_atomic64_read(&updates) / RCU_SCALE_DOWN)); @@ -462,7 +466,7 @@ test_rcu_qsbr_sw_sv_1qs(void) rte_free(keys); printf("Following numbers include calls to rte_hash functions\n"); - printf("Cycles per 1 update(online/update/offline): %"PRIi64"\n", + printf("Cycles per 1 quiescent state update(online/update/offline): %"PRIi64"\n", rte_atomic64_read(&update_cycles) / rte_atomic64_read(&updates)); @@ -578,7 +582,7 @@ test_rcu_qsbr_sw_sv_1qs_non_blocking(void) rte_free(keys); printf("Following numbers include calls to rte_hash functions\n"); - printf("Cycles per 1 update(online/update/offline): %"PRIi64"\n", + printf("Cycles per 1 quiescent state update(online/update/offline): %"PRIi64"\n", rte_atomic64_read(&update_cycles) / rte_atomic64_read(&updates)); From patchwork Tue Oct 8 21:12:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 175581 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6231687ill; Tue, 8 Oct 2019 14:13:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNQbBr1fAT1wTPF3+5311u2I1o4f/vKANxKDv+ZtBxhIMnfIVt3nZN+OOhTFkiUjAeEpzX X-Received: by 2002:a17:906:1801:: with SMTP id v1mr30498540eje.146.1570569208616; Tue, 08 Oct 2019 14:13:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570569208; cv=none; d=google.com; s=arc-20160816; b=Wm5pzfZbuJbugPDZFMT7YKOc2guEukKwnzswd/+KnIvVN96MIVtRfdIoVIipuW8fz+ XEKn5bMFf84eYehve08chw9OOD+hHDmYaOod1cjK5sZTB5zCjp/M3JW8T1mat9N0Q/O/ wdnaP5z7+NF0At5R8mTQS1AFE7egnVVnQ+CmcDz1f0m6aX/CIlaeMOd7Q4RizWrqxP64 xFvGbUGJwMiwxHmXPe3IU9ts6A6C2T92yF+dzxCtlORV8/ULewBWupyRlvBYzXFE0ey3 XKlrAPhVgSL7hNYUTZi3lzq6fEPHCLcK08QZP7M9dBTGAEN/AwxtP0FaTP0DqlUZ85D2 kbuA== 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=/AkSQxzBAdp6jE2ombKeKyFkXLmyvqpJnd8wp+DAcl8=; b=OKUv5W5Jr+gFSHN40s/LXR5hdUPDFZRDcxqc7MZUowD1l9mksyTK+HqJ6VKPFrHX/d Ye30o7SZn2RNTEwwq78k4+OCiHj4eCAQtXQMH8V48HKCHy+1GI/NOnu9JD+/ml+JrKs0 wXSDhdPU0Ik1EZpSBighkP37M7HI9kVl2SczRhizOftfj/zrLBvDKLg1xyhLfjAX773d WC+NO5wYAEpNyoU8mQCR4kjXPEiCBPAHVzWbGYfEQrZ2Fhf7hCQYLFrIgmtFF8whzobb g28iZ0EnRDCg2YuEkfOeb3KPv7isn/pMu2cw6aJR5awi1/OQIZFtm/JbpJuQ4RK+g6iV 5FJA== 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 e50si195938edb.177.2019.10.08.14.13.28; Tue, 08 Oct 2019 14:13:28 -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 9F3D61D427; Tue, 8 Oct 2019 23:12:53 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 3F1B91C138; Tue, 8 Oct 2019 23:12:44 +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 C909B337; Tue, 8 Oct 2019 14:12:43 -0700 (PDT) Received: from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com [10.118.12.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BFF9E3F68E; Tue, 8 Oct 2019 14:12:43 -0700 (PDT) From: Honnappa Nagarahalli To: honnappa.nagarahalli@arm.com, david.marchand@redhat.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org, ruifeng.wang@arm.com, stable@dpdk.org, nd@arm.com Date: Tue, 8 Oct 2019 16:12:19 -0500 Message-Id: <20191008211220.31586-7-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191008211220.31586-1-honnappa.nagarahalli@arm.com> References: <20191008211220.31586-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH v2 6/7] lib/rcu: add least acknowledged token optimization 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" When the rte_rcu_qsbr_check API is called, it is possible to calculate the least valued token acknowledged by all the readers. When the API is called next time, the readers' token counters do not need to be scanned if the value of the token being queried is less than the last least token acknowledged. This avoids the cache line bounces between readers and writer. Fixes: 64994b56cfd7 ("rcu: add RCU library supporting QSBR mechanism") Cc: stable@dpdk.org Signed-off-by: Honnappa Nagarahalli Reviewed-by: Gavin Hu --- lib/librte_rcu/rte_rcu_qsbr.c | 4 ++++ lib/librte_rcu/rte_rcu_qsbr.h | 42 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) -- 2.17.1 diff --git a/lib/librte_rcu/rte_rcu_qsbr.c b/lib/librte_rcu/rte_rcu_qsbr.c index ce7f93dd3..c9ca66aaa 100644 --- a/lib/librte_rcu/rte_rcu_qsbr.c +++ b/lib/librte_rcu/rte_rcu_qsbr.c @@ -73,6 +73,7 @@ rte_rcu_qsbr_init(struct rte_rcu_qsbr *v, uint32_t max_threads) __RTE_QSBR_THRID_ARRAY_ELM_SIZE) / __RTE_QSBR_THRID_ARRAY_ELM_SIZE; v->token = __RTE_QSBR_CNT_INIT; + v->acked_token = __RTE_QSBR_CNT_INIT - 1; return 0; } @@ -245,6 +246,9 @@ rte_rcu_qsbr_dump(FILE *f, struct rte_rcu_qsbr *v) fprintf(f, " Token = %"PRIu64"\n", __atomic_load_n(&v->token, __ATOMIC_ACQUIRE)); + fprintf(f, " Least Acknowledged Token = %"PRIu64"\n", + __atomic_load_n(&v->acked_token, __ATOMIC_ACQUIRE)); + fprintf(f, "Quiescent State Counts for readers:\n"); for (i = 0; i < v->num_elems; i++) { bmap = __atomic_load_n(__RTE_QSBR_THRID_ARRAY_ELM(v, i), diff --git a/lib/librte_rcu/rte_rcu_qsbr.h b/lib/librte_rcu/rte_rcu_qsbr.h index c80f15c00..3f445ba6c 100644 --- a/lib/librte_rcu/rte_rcu_qsbr.h +++ b/lib/librte_rcu/rte_rcu_qsbr.h @@ -83,6 +83,7 @@ struct rte_rcu_qsbr_cnt { #define __RTE_QSBR_CNT_THR_OFFLINE 0 #define __RTE_QSBR_CNT_INIT 1 +#define __RTE_QSBR_CNT_MAX ((uint64_t)~0) /* RTE Quiescent State variable structure. * This structure has two elements that vary in size based on the @@ -93,6 +94,10 @@ struct rte_rcu_qsbr_cnt { struct rte_rcu_qsbr { uint64_t token __rte_cache_aligned; /**< Counter to allow for multiple concurrent quiescent state queries */ + uint64_t acked_token; + /**< Least token acked by all the threads in the last call to + * rte_rcu_qsbr_check API. + */ uint32_t num_elems __rte_cache_aligned; /**< Number of elements in the thread ID array */ @@ -472,6 +477,7 @@ __rte_rcu_qsbr_check_selective(struct rte_rcu_qsbr *v, uint64_t t, bool wait) uint64_t bmap; uint64_t c; uint64_t *reg_thread_id; + uint64_t acked_token = __RTE_QSBR_CNT_MAX; for (i = 0, reg_thread_id = __RTE_QSBR_THRID_ARRAY_ELM(v, 0); i < v->num_elems; @@ -493,6 +499,7 @@ __rte_rcu_qsbr_check_selective(struct rte_rcu_qsbr *v, uint64_t t, bool wait) __RTE_RCU_DP_LOG(DEBUG, "%s: status: token = %"PRIu64", wait = %d, Thread QS cnt = %"PRIu64", Thread ID = %d", __func__, t, wait, c, id+j); + /* Counter is not checked for wrap-around condition * as it is a 64b counter. */ @@ -512,10 +519,25 @@ __rte_rcu_qsbr_check_selective(struct rte_rcu_qsbr *v, uint64_t t, bool wait) continue; } + /* This thread is in quiescent state. Use the counter + * to find the least acknowledged token among all the + * readers. + */ + if (c != __RTE_QSBR_CNT_THR_OFFLINE && acked_token > c) + acked_token = c; + bmap &= ~(1UL << j); } } + /* All readers are checked, update least acknowledged token. + * There might be multiple writers trying to update this. There is + * no need to update this very accurately using compare-and-swap. + */ + if (acked_token != __RTE_QSBR_CNT_MAX) + __atomic_store_n(&v->acked_token, acked_token, + __ATOMIC_RELAXED); + return 1; } @@ -528,6 +550,7 @@ __rte_rcu_qsbr_check_all(struct rte_rcu_qsbr *v, uint64_t t, bool wait) uint32_t i; struct rte_rcu_qsbr_cnt *cnt; uint64_t c; + uint64_t acked_token = __RTE_QSBR_CNT_MAX; for (i = 0, cnt = v->qsbr_cnt; i < v->max_threads; i++, cnt++) { __RTE_RCU_DP_LOG(DEBUG, @@ -538,6 +561,7 @@ __rte_rcu_qsbr_check_all(struct rte_rcu_qsbr *v, uint64_t t, bool wait) __RTE_RCU_DP_LOG(DEBUG, "%s: status: token = %"PRIu64", wait = %d, Thread QS cnt = %"PRIu64", Thread ID = %d", __func__, t, wait, c, i); + /* Counter is not checked for wrap-around condition * as it is a 64b counter. */ @@ -550,8 +574,22 @@ __rte_rcu_qsbr_check_all(struct rte_rcu_qsbr *v, uint64_t t, bool wait) rte_pause(); } + + /* This thread is in quiescent state. Use the counter to find + * the least acknowledged token among all the readers. + */ + if (likely(c != __RTE_QSBR_CNT_THR_OFFLINE && acked_token > c)) + acked_token = c; } + /* All readers are checked, update least acknowledged token. + * There might be multiple writers trying to update this. There is + * no need to update this very accurately using compare-and-swap. + */ + if (acked_token != __RTE_QSBR_CNT_MAX) + __atomic_store_n(&v->acked_token, acked_token, + __ATOMIC_RELAXED); + return 1; } @@ -595,6 +633,10 @@ rte_rcu_qsbr_check(struct rte_rcu_qsbr *v, uint64_t t, bool wait) { RTE_ASSERT(v != NULL); + /* Check if all the readers have already acknowledged this token */ + if (likely(t <= v->acked_token)) + return 1; + if (likely(v->num_threads == v->max_threads)) return __rte_rcu_qsbr_check_all(v, t, wait); else From patchwork Tue Oct 8 21:12:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 175582 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp6231852ill; Tue, 8 Oct 2019 14:13:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBzD2+jeclk0cNL6vXjmOm4a82oLDaG8K300pEGPh1tiG5ALnVRAVzW7/JxSVsJt92Itfo X-Received: by 2002:a17:906:d97a:: with SMTP id rp26mr31580625ejb.251.1570569219231; Tue, 08 Oct 2019 14:13:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570569219; cv=none; d=google.com; s=arc-20160816; b=oLoOULlyhAcJMri1zjadLsTG+F/jD66cmoLTkPSDVqPWfkx8yvuE0Rn423HXvzUfro evTuSPWzEl4hfIZ8d8Kmk3hQ8ZQKR3gUOuMxihA331rdQx2gupD/RbldL4+VXoGkLTYO 2l1PiOOa4NSgATXrY5tVr06KUlLRpqdKR+oTKk595CZ1HQc+/GBgvk2vuGSrR19qYTZC 3q7SSvvOK6MmwekLMNglllMJ+FR2PgCjx8gGieO32TrtDZCqUMKkwfYJUAeHYgMTkIum vRd2vQ+Z2cq3oFLQvYpTN3HLpFt5LK71kn4lgE/TE0gBWw3fpqAWyX+3BWltX49uaWkt 4JEQ== 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=Z2ijQeeAsuHGJzpikFMphUyLtyd5thKe6cAYSbAgR5c=; b=nxc/BnNuAgVNw6ykwJnOI2/1LvXnsV5qpycKqm7VNevAdAuZjKQHEf2iCfDd+HuS3Z C10BP+dm2egd495G5Ue5VwuD0/C6iloptqxhrYPsSSauzI2bV9q/79loyVZxiuyMq8EO k0g1QZWf0MO96qFCCB3lofMnWNAsPDt16l5dRf1KSt9gCN8uaMOkjmvM9CTQfAY/VsdV F3Vd21Bz906RXtiWHbfy32N/oH2bj00sDumuUWxK2NF1AEWtRXhdJSQnWnlQ/w00M3tO onmSEnPk7BNP1/mcp9JWWv88TBZfh2zCXZJbjkGdmmYMmcml5vT9G4pgOoslHcfcXkku E/jA== 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 x51si160507edd.193.2019.10.08.14.13.39; Tue, 08 Oct 2019 14:13:39 -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 D85101D453; Tue, 8 Oct 2019 23:12:55 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 137581C192; Tue, 8 Oct 2019 23:12:45 +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 95BF115BE; Tue, 8 Oct 2019 14:12:44 -0700 (PDT) Received: from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com [10.118.12.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 857DE3F68E; Tue, 8 Oct 2019 14:12:44 -0700 (PDT) From: Honnappa Nagarahalli To: honnappa.nagarahalli@arm.com, david.marchand@redhat.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org, ruifeng.wang@arm.com, stable@dpdk.org, nd@arm.com Date: Tue, 8 Oct 2019 16:12:20 -0500 Message-Id: <20191008211220.31586-8-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191008211220.31586-1-honnappa.nagarahalli@arm.com> References: <20191008211220.31586-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH v2 7/7] lib/rcu: update QS only when there are updates from writer 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" When the writer is checking the quiescent state status, it is not deleting any entries in the data structure. This means, the readers do not need to update their quiescent state during that period. Readers update the quiescent state only when there are updates available from the writer. Signed-off-by: Honnappa Nagarahalli Reviewed-by: Gavin Hu --- lib/librte_rcu/rte_rcu_qsbr.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/lib/librte_rcu/rte_rcu_qsbr.h b/lib/librte_rcu/rte_rcu_qsbr.h index 3f445ba6c..0d4664572 100644 --- a/lib/librte_rcu/rte_rcu_qsbr.h +++ b/lib/librte_rcu/rte_rcu_qsbr.h @@ -456,12 +456,14 @@ rte_rcu_qsbr_quiescent(struct rte_rcu_qsbr *v, unsigned int thread_id) */ t = __atomic_load_n(&v->token, __ATOMIC_ACQUIRE); - /* Inform the writer that updates are visible to this reader. + /* Check if there are updates available from the writer. + * Inform the writer that updates are visible to this reader. * Prior loads of the shared data structure should not move * beyond this store. Hence use store-release. */ - __atomic_store_n(&v->qsbr_cnt[thread_id].cnt, - t, __ATOMIC_RELEASE); + if (t != __atomic_load_n(&v->qsbr_cnt[thread_id].cnt, __ATOMIC_RELAXED)) + __atomic_store_n(&v->qsbr_cnt[thread_id].cnt, + t, __ATOMIC_RELEASE); __RTE_RCU_DP_LOG(DEBUG, "%s: update: token = %"PRIu64", Thread ID = %d", __func__, t, thread_id);