From patchwork Sun Sep 8 22:49:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 173348 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3621996ilq; Sun, 8 Sep 2019 15:50:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGBT9S1f7tdISqNB576GkmtCjVdInQbFcwrF7pBAe4zizqGKmQFVVZqQ3icbJTaUVjHRXX X-Received: by 2002:adf:dd04:: with SMTP id a4mr16294228wrm.340.1567983039294; Sun, 08 Sep 2019 15:50:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567983039; cv=none; d=google.com; s=arc-20160816; b=NI0GgiB1ll0yuHi9PmvbQJaRuDCZLy5U9MPpgqlvG7DxWbpF4uenamxrX2J9pXRCpO l/oyiknBzoRfa9FcqbTFvzDbzZG2/6TS4aKzHHNQROft8IqwaXy1EKORUhMYGm8tWdTV sD3RgRk/o+mvNr+qmQduAGJ82iqZG7RGOF8yPrOn1iv+cYqAdrDGRuuB9PkpsMeV/j6M SsXzGyV8PMmsT7qvyWQRixn5hzF2XchG2Mz8pI+YEcZCx3SrNclQ4/5Y0fQViPg4wOJo nnO4W2ogx81RWPUd8gxliydtnuUyhiKomBHDNA/hcloHppD9ImB/mxGD2YJMDvWwg1ET YKRA== 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=CYxHP8SKCiEkDKzAbH1pwr9WhcWIB4XmhgkdYVZR9S9/StJnMvRzlIeMvDw4CCUNZd FCvLB8wHxl6y0HXDjLYm1DeHn0B0C6lAuc1tnECilMWvX1GjW/Lvyb2EnPH67RYmryb3 jdsZExm2kCASSz2xdbupJqyFeyqzJtiCBinyd6B9TvlLHGuRAfGFnQieXueTAB8tzSDY uvoYLYH2BYMghCQwqWxcNsdPtkADweecqSpGSzvOKrDgpSVhhk3gIDJ7CkB/nn0HOu6B YVREh+f7PQ8/HqSSU+YL+bYjQGNdaVf8Ud9g7KCXnciucVAlspjZ+0zX/rOg2GknEkU9 McgA== 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 s22si12068055wrb.204.2019.09.08.15.50.39; Sun, 08 Sep 2019 15:50: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 CA92A1E9C5; Mon, 9 Sep 2019 00:50:38 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 80B1C1E9AE; Mon, 9 Sep 2019 00:50:37 +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 DBB01337; Sun, 8 Sep 2019 15:50:36 -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 CAFBC3F67D; Sun, 8 Sep 2019 15:50:36 -0700 (PDT) From: Honnappa Nagarahalli To: honnappa.nagarahalli@arm.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org, stable@dpdk.org Date: Sun, 8 Sep 2019 17:49:43 -0500 Message-Id: <20190908224949.34851-2-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908224949.34851-1-honnappa.nagarahalli@arm.com> References: <20190908224949.34851-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH 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 Sun Sep 8 22:49:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 173349 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3622064ilq; Sun, 8 Sep 2019 15:50:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4Hq2c/LmrJREubR8DMsN1fzfwlqQtM8zCQLjTO+7k/ZT57XIeTbATgJEP7XoGsdnJ+St3 X-Received: by 2002:adf:db47:: with SMTP id f7mr15956646wrj.1.1567983047524; Sun, 08 Sep 2019 15:50:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567983047; cv=none; d=google.com; s=arc-20160816; b=znfP7OFA6/UDouw1bd9GRW0akks2+c14soNff/6QdL7UJZ+hMtPpcaQgACy36OTOZp fIWtinsaph3sOSWy1ZJXpt7mSIJl329Vu7ZxIRXiAKhDRfdHkIH2XN4/LWNVYg/DguWi H77eg5pL8ss5DPe8dyHh9k7BqskIQcYWwit/SaYIoGNM+rl0mC8a/vNQxqf6ddRU0CfE TnJn6lGh6ef4ZFRoNlSwdfa6rur78FihfvByfhkuseDkxYMtRxA8rY7XckCicoXrDehR h1812H00FGkB6pwYZs9gjP3+7Ifav6Y87rGqIC86lq7gGuJ1AHvRVfzsGWs0mmlddChP v7JA== 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=pSFn4gFGgFVmIUJBElrHIhp1Od/pycUz1uxqOFerzLz9do1b0uU3CIXZiyczXlPneh 1SD0atgpfEBgk1EnqgiCCZCNvAlYc7YVRDfBPwG1+BVpssBY7F9mZr05nGbooJNx9Zg+ HwlZlPHlJz1+OmpDyox2hi+CCIOWTul1wQfaomcuCgs/SXLJM7MzDO/BGRnFSG6ZGr6X WQGBUMzwqgdfL36DqxjF0XMjIguIn89nj84i/V4zqJ4nk6I5j0BJ/BJZY91uAQnA4LKD p7ngV7pIikLyL1JQOOKJO/gnqIsgIZ0sRzBadC2thNIdQm16Uk276gaNkyC187YSNiAO kXLA== 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 d3si10714058wre.303.2019.09.08.15.50.47; Sun, 08 Sep 2019 15:50:47 -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 7E16B1E9E1; Mon, 9 Sep 2019 00:50:42 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 7DDBF1E9D9; Mon, 9 Sep 2019 00:50: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 08EDC1596; Sun, 8 Sep 2019 15:50: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 02ACD3F67D; Sun, 8 Sep 2019 15:50:40 -0700 (PDT) From: Honnappa Nagarahalli To: honnappa.nagarahalli@arm.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org, stable@dpdk.org Date: Sun, 8 Sep 2019 17:49:44 -0500 Message-Id: <20190908224949.34851-3-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908224949.34851-1-honnappa.nagarahalli@arm.com> References: <20190908224949.34851-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH 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 Sun Sep 8 22:49:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 173350 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3622164ilq; Sun, 8 Sep 2019 15:50:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzyEhIE7ENlBNCdw1foPq/1NoOv0Uur6tRMKy+cJ4g9UEfPxOXV4NIi+gmnnKaQjWUWnwEk X-Received: by 2002:adf:ec0a:: with SMTP id x10mr16825697wrn.292.1567983057649; Sun, 08 Sep 2019 15:50:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567983057; cv=none; d=google.com; s=arc-20160816; b=Vg+mMFlmRe4o0zmEJ9Sds3gjMAYKAJVhTckwmIsvOs75q/eZjMS7ZczpcojlZ4RgsQ uEk0m94Nv2N4UQ/guJuru4A9BoUscTxgQmGR7ilB+h9xNGYtcXq59wLLIzE7KFfmxCtQ WXafKmGbxdAItmOVXBpgSRXtQBcoDrinAbLYEsOXcoeg4osNznmbr4IR/UhnhxfuLePa 7FLiNB3IqgjEuI494EFZdEPHCbsNaPJ7L5r4m0P0Q8CuU6urBsaPPtQCHik/u5CJn/Jt X+CoLQ9p3iEZZtDlEG1I+aBrXfO8LWijd8ga2yJ/Q8iwTJAA6ziAGA/tlihs/btI9uOr eKjg== 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=frUvQsPwzL90+77a2AmT+QBdM2mpxY5E9MakMN7EIR1SlCN0cTXTad8ru7IwiblFN7 DZ+3WlRt280DwxyBxIu8Ih77v4/CIRHBU3BpPEuom3iVTA0QNHR3PBWtnetER9d7rxXB aQNIMjrnNRTPLlGfJ9jG+9YppOVYiOHfCfGK7dIfh/bnp/eQZuaIHrLNoL9S1GQBbg6g hu2OD3bCPcg8OZy4sqnszSr8AOtBurFDFb+hjZ6jAuRfQlM4hNgOdwq8tDI5RqN3tBcV SKNFCdRnHEPVfLVuWPtjKAnvwhRCabCPr/qCL6Lv5kmHYjD/7pQVZRzXUEhL9c0mquZI j68Q== 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 q19si11896657wrf.397.2019.09.08.15.50.57; Sun, 08 Sep 2019 15:50:57 -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 1CBE11EA02; Mon, 9 Sep 2019 00:50:46 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 5491D1E9DA; Mon, 9 Sep 2019 00:50: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 A6CCC337; Sun, 8 Sep 2019 15:50: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 97AD13F67D; Sun, 8 Sep 2019 15:50:43 -0700 (PDT) From: Honnappa Nagarahalli To: honnappa.nagarahalli@arm.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org, stable@dpdk.org Date: Sun, 8 Sep 2019 17:49:45 -0500 Message-Id: <20190908224949.34851-4-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908224949.34851-1-honnappa.nagarahalli@arm.com> References: <20190908224949.34851-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH 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 Sun Sep 8 22:49:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 173351 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3622256ilq; Sun, 8 Sep 2019 15:51:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZTJ/Eu8K4wbubQYniObo/t6tIg+hxUPUkKVgpHTDGG9RNToUWf8sPu8mLl/dGx3ZfQDGn X-Received: by 2002:a1c:be12:: with SMTP id o18mr6969435wmf.128.1567983065923; Sun, 08 Sep 2019 15:51:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567983065; cv=none; d=google.com; s=arc-20160816; b=suZZnRl37ASkHHeZ596ltCANUfWhXceD6ZnB3mtWfZaQ82lCNhDdaV8+tMvGKv6PHM E5hAd+nNhyXuCtUNJbTkeA6lBzM0THhxrpShKMobXLeP40cw/cPJMi8w9+Bh0QMSh0kF hD0HKsFWOUnVu3uB35NYm/l2Ahu2l1Sq+kjt7Yt4HmJ6e832W+Yv+tINJRC4CPf339ye /8S8XORfPoAZw38hJTl1dfHuGF3IjkJlG02vWIO8IjXg9TzsJaS8lbUTDOoYy79clA2o 1/ECF5MBTNdcpCDGlea+VsVaM42EZ49zgqpgAtzohZVi8Sx3SRQ64f3JrqjqbK2Ufn/O 4UPQ== 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=gnawZlEYnYwIEw0l5XvScE+T37Hqh2Wx4GHIiMucB14=; b=NXVPffwi/QNebI1N0yUfA3rTahLEeiVmrwfNpmUD/YhK++VBRIdTTxiBhtVKyCQuNc 8actaTTZTKrEbOg7Wgt/WHup7TgjOvpuQ1vZ5xWjScpesRyVwhsQlCevD3D5U5BpImVl lQuJaHd/Kjp7slO4PTjwFyX3OP1uFW9iPs4VkkmhjiA70MIlSQHjxLV/CXBdBHJjkd5/ b9qGKY4oezckWVceCrmCFx8RYeaE5KqeCtdkyf7qfFFNH6YgFh8M375FFmfRsqiPtL98 c9oAH5gnMIxkZ+TESeCUZdZkErgOlVzZDCRUQl8IVc7wPXQhATXkiYkzvi6DxdTjJlMX hpgg== 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 6si9266455wmf.188.2019.09.08.15.51.05; Sun, 08 Sep 2019 15:51:05 -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 CAA561EA21; Mon, 9 Sep 2019 00:50:49 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 0FDBF1EA15; Mon, 9 Sep 2019 00:50:48 +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 9639C337; Sun, 8 Sep 2019 15:50:47 -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 8685E3F67D; Sun, 8 Sep 2019 15:50:47 -0700 (PDT) From: Honnappa Nagarahalli To: honnappa.nagarahalli@arm.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org, stable@dpdk.org Date: Sun, 8 Sep 2019 17:49:46 -0500 Message-Id: <20190908224949.34851-5-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908224949.34851-1-honnappa.nagarahalli@arm.com> References: <20190908224949.34851-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH 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_perf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/app/test/test_rcu_qsbr_perf.c b/app/test/test_rcu_qsbr_perf.c index cb2d177b7..e0598614c 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; From patchwork Sun Sep 8 22:49:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 173352 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3622342ilq; Sun, 8 Sep 2019 15:51:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIwpxcQsjLFDaiHjRqFzjFNfVYASaSfDdW3lbL+bBMdhxgtb5rA/2QiOSyiX6O8Uq0hs0s X-Received: by 2002:adf:d84f:: with SMTP id k15mr14608533wrl.70.1567983073707; Sun, 08 Sep 2019 15:51:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567983073; cv=none; d=google.com; s=arc-20160816; b=wKZl/rCMbAQryo9SgZZcyUza3hJ6X1ye3zH+BvrgBaPBmx787OW8a/DFItvPynMC0r 38XjxXsXNVIvZFShM8l3eXWTK9eJKgdfijKJHxfk8Y9QKXc5RXV62R2uvjU3fvT2u2RL wfpDeOc2mpYJMzL1uV2u5MpP3umX7FmVud7zE2NDMT7oo5QoVoQnNIZeSwv/aK93Cnb6 Pn+mOisQf8e6d2yNQ43s6nSKxZdFL8KekgjW8R92DHinpa92MPCgVWKpnpHO1IyH4O2N FKpnwu+l0buH3qcTCpFXsmWpXSc9x0d/Z+JDFWuQqteaYsaexpfju8FiR4wzI4AG2/fm frxw== 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=YGibRMzwnMfWsd6OfqErLKh/8iuzGsLgdT7Y7zo9pHA=; b=IQMTytVf447ESWuF+cNaFM+OMg/hXkSyn4uhnWbCYW0XYNtLX+qfzkgDN+qTft36vu 1OUK8fiqYW2ZajjEDmgkci+t+v+cbS2Zhk82sJEWLKs1erBfXaJxzwGYUVIydFJXM1nO nwols8jaJYD37GeNkauITS5i/4pfysLjjDgRmZqXgJpJumMKhCjsnREN/vEXJhTAG00E Ck9uyyWRg9dQtKqC7/nCdte67YagSNpcYReeABUo8fEGb43AagiL6BjXS0JpVABb9vLm LpacJxY+b2YjhOf1St5lPfSidGO8wAKNOYXddWDZdo9cANKMJYbZYiKZYIl5+LbzCFhY RqHQ== 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 c10si5047896wmc.168.2019.09.08.15.51.13; Sun, 08 Sep 2019 15:51:13 -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 177D41BF13; Mon, 9 Sep 2019 00:50:53 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id ED7331E9AE for ; Mon, 9 Sep 2019 00:50:48 +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 821081596; Sun, 8 Sep 2019 15:50:48 -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 7BD5A3F67D; Sun, 8 Sep 2019 15:50:48 -0700 (PDT) From: Honnappa Nagarahalli To: honnappa.nagarahalli@arm.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org Date: Sun, 8 Sep 2019 17:49:47 -0500 Message-Id: <20190908224949.34851-6-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908224949.34851-1-honnappa.nagarahalli@arm.com> References: <20190908224949.34851-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH 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 e0598614c..3a1df5d17 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)); @@ -577,7 +581,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 Sun Sep 8 22:49:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 173353 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3622437ilq; Sun, 8 Sep 2019 15:51:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzmNnV6G3my0qcmgRo/NbfOp6Dj4ZR5R9jiGCIdVEAeLj8qvh7lgfR0Z0R6KiMM6jK9JseJ X-Received: by 2002:adf:ed8f:: with SMTP id c15mr15616331wro.83.1567983082959; Sun, 08 Sep 2019 15:51:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567983082; cv=none; d=google.com; s=arc-20160816; b=S9fh9A7e17kHOVcSBIbZ4RBSe3GTEmXj5pLi1iptxOxjq8Ta133Y/aMnKK0mHVAMll qx49xwF7oZmi+K/ue52RYtw5H6Z3DML1oNczhHoulFoQki9LvmhuYKZzHkvdp2zxWjn5 bztN0cPX0JsYx2hNPOFw24z0/Uhc7xBsvZMUxOdS0hI3OGNPxkvqUqcvQl3fc/NAq81m N+3TTcGQ4CFaebNBLipbeqjil1mJTnz0FT4UUV5HJ/dR+0zusnoSMsSfiUq7G5nXGn5T 14Eq88TVyfBOuHJ6lTbK87xYJDFFegXNMvM4GmgQbVLZcAXJFa6/th901PvEqiq4La2g I6lg== 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=xYH2z3tR7Qx3Y5i5Iw8cpmODKRWWGURqp2MZ3bWO4GAHqUGkE3niVTfo2tJZbrDife qjdbPme16WuXqO/oAenAFElOdtrXdsd4rgFssGgaq/DWCuh5VliKQtX7UeV5SWiYT21U BoYb3bzNugS/iB22Y2BEAuvQ/hVj9b80xTIS6Ctcdh48ppu5DQ/LacaSr6GFUKIcVFNq h4EEG+LlRjUZDWOhCEveu43PQD7hP3ceGa/gLg3dgpi6p20gtwVwKTURZ3VU2v+IWN86 yDbow1gs+C7PccZHdxq+G+lkRklyUfcE2r83POdia3x/ujH1ORvuMoQRb6VwYufAiilQ 6Ngg== 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 l9si9360462wmh.13.2019.09.08.15.51.22; Sun, 08 Sep 2019 15:51:22 -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 A76A91BFF4; Mon, 9 Sep 2019 00:50:55 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 01CEA1EA25; Mon, 9 Sep 2019 00:50:49 +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 7BF5015A2; Sun, 8 Sep 2019 15:50:49 -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 6A7C43F67D; Sun, 8 Sep 2019 15:50:49 -0700 (PDT) From: Honnappa Nagarahalli To: honnappa.nagarahalli@arm.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org, stable@dpdk.org Date: Sun, 8 Sep 2019 17:49:48 -0500 Message-Id: <20190908224949.34851-7-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908224949.34851-1-honnappa.nagarahalli@arm.com> References: <20190908224949.34851-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH 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 Sun Sep 8 22:49:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 173354 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3622522ilq; Sun, 8 Sep 2019 15:51:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqysfhMOUX7vc74rDO45vq20Y1v7rCXbWwyQVAL1dRGUKHNmDSnndWB6ZRD1AaAcu6c4zUYs X-Received: by 2002:a1c:a552:: with SMTP id o79mr16122066wme.91.1567983091384; Sun, 08 Sep 2019 15:51:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567983091; cv=none; d=google.com; s=arc-20160816; b=kNWYanMxHtiDNs8pEiNdkgm2ZY6lcwDH06M+TFO/Pg1X2ex5vXh46AptYywXcTCpLl MPu4PD5YnmdffGLafOgHMU3cBG6iTKM+j3FZrZXaV5MFvUttkEjr/hxq3jOYCU5Xmeuy x4+UWG9bjt9kgSC4amFIkGDxfIUZa8C7cMFrqoVYlnH6KZ2Jf2pWwM++p6rvZtMX8q0f qGecSI1Mvw5qvlJc3umqZGwi0BYPz2VJWw+qG+291AGDoTMcengQk4G7iAgxfgedBA2g 98LLTm7ronlACM+MlsQkgdd8iy8gzdwYEUKtBqSwwcC8s6MMBS9LpyPhq4Y9ZuuC6Wxs oPTg== 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=0iKsA37JyF4XJByeGLtJViuxf2sN2DOMVm0NKl7bwXmV51K5u1kJLaqWytZ8wxcq9d asXnpgMsIM/gNoN/+sc+LUIs9/ymTnRibnuyeGmpw4uQYaohT2JaqXSzk1dKrW+0u3aZ K4vEDlDTFkJkBDHs3GhIDp/i4vu2D+Do4pvl3/bF2WI7vCYvulqdIBpGexcd4YXooXhz 9DGGJiMdHTLoJFcvIxD4UtIvWKUiOTvcRLWGDKAJRrOOPf6aidr/CAvXxgH5oW81OxaZ NzDz4Rp8mblGa+kH+qcgSWMFirHj6GEojYOWt5dNoFBWSQ5awZCkGSp1OVkpGWGavxV2 rmzA== 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 e5si7013008wme.144.2019.09.08.15.51.31; Sun, 08 Sep 2019 15:51:31 -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 5DEB61C1E4; Mon, 9 Sep 2019 00:50:58 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 23EAE1E9AE for ; Mon, 9 Sep 2019 00:50:51 +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 AAA6A337; Sun, 8 Sep 2019 15:50:50 -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 9B5E13F67D; Sun, 8 Sep 2019 15:50:50 -0700 (PDT) From: Honnappa Nagarahalli To: honnappa.nagarahalli@arm.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org Date: Sun, 8 Sep 2019 17:49:49 -0500 Message-Id: <20190908224949.34851-8-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190908224949.34851-1-honnappa.nagarahalli@arm.com> References: <20190908224949.34851-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH 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);