From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id A8CFAA051C
	for <public@inbox.dpdk.org>; Tue, 11 Feb 2020 12:29:52 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 032D21BFB4;
	Tue, 11 Feb 2020 12:29:49 +0100 (CET)
Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com
 [209.85.128.65]) by dpdk.org (Postfix) with ESMTP id 8D9382BE9
 for <stable@dpdk.org>; Tue, 11 Feb 2020 12:29:48 +0100 (CET)
Received: by mail-wm1-f65.google.com with SMTP id p9so3045199wmc.2
 for <stable@dpdk.org>; Tue, 11 Feb 2020 03:29:48 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=wPlzeyG4/6aXYjlUZD5cFWDzOPIv6XjscuLfixpdF3A=;
 b=u3apYWe9C+8w9VMaWN5LLE+Bs4i4hWOfKYt8tkO+ctPcfdKTbJ14aNJ3kJAKjwpNN+
 mANtIO6+8PdVk+tMzKZc679Y9etMaRjqNnYJk0SRUG9HCz4gZICcqKh7oiu3DsPCBTLC
 m+hYPosKob/SWwMH+kJENZEBiZyHBSvfRpr1jhQMLE9OjvA/tfJyxDsD2ZJmHEdTVVDu
 KwUHCJerAiI0LDpHuOH2hBC0pC11Bcqmrzr84k4pMEl9d14go0zXu5MY9FYnLGPOriKO
 bFuL4YdHMCD7+8MUTSgOKHhkNu9eiJ5eOS9IOStR9y3nGVtLRn3sdN+ELVd97QoUkGmq
 88zQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=wPlzeyG4/6aXYjlUZD5cFWDzOPIv6XjscuLfixpdF3A=;
 b=l8nFtU5gmyy6bKZDOLFICpYE3DibCujrjx/KZIg8jQMg76Pnwm562vx1ClLk6+jjGB
 0sEZjjDHut0NddTnXvHi8H8Dtzu0Q+X6HsY2expi/sZSzkRkh8m+6sjdgit1x+c1lyfS
 JkgX48/lhzGQ+8AHJOyiCYnh4oDtbS73427u/2uwKGHyBBEtzaLWR5gVPpZ/O+v2hDDq
 jlsQxsX6yhuuktRevOVla9t+ca/cH9+B1gS6S8LlHAViBudkR1MyqH9FeAjAWdN2Xgo2
 vhNGM3OojCB8CTpxsG103p4qneUzd5F5GosmacaEMrrqOHQo0ZZFshs+m+vfhJYPHWe9
 SKTw==
X-Gm-Message-State: APjAAAWZD8dI0f9BJ1V7wXUfO3FLbN5zGS62FupzJ94vLPdaJycQnR9G
 xLZwGlkRI/RMEkBvhndTCOvAuAMOdpk=
X-Google-Smtp-Source: APXvYqzD9VmOcS05M9gwwUsCm3RYwVZt6xHVn661IEU2lUCiySMst/Y41K/A2RO2s9Cg+rQObAu+5Q==
X-Received: by 2002:a05:600c:2383:: with SMTP id
 m3mr5359676wma.32.1581420588323; 
 Tue, 11 Feb 2020 03:29:48 -0800 (PST)
Received: from localhost ([88.98.246.218])
 by smtp.gmail.com with ESMTPSA id p11sm5031663wrn.40.2020.02.11.03.29.47
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 11 Feb 2020 03:29:47 -0800 (PST)
From: luca.boccassi@gmail.com
To: Reshma Pattan <reshma.pattan@intel.com>
Cc: dpdk stable <stable@dpdk.org>
Date: Tue, 11 Feb 2020 11:20:54 +0000
Message-Id: <20200211112216.3929-108-luca.boccassi@gmail.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200211112216.3929-1-luca.boccassi@gmail.com>
References: <20200211112216.3929-1-luca.boccassi@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-stable] patch 'latency: fix calculation for multi-thread' has
	been queued to stable release 19.11.1
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

Hi,

FYI, your patch has been queued to stable release 19.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/13/20. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Thanks.

Luca Boccassi

---
>From 94047950e2b4887d5bf4be4073e6be37c3ae64c0 Mon Sep 17 00:00:00 2001
From: Reshma Pattan <reshma.pattan@intel.com>
Date: Thu, 5 Dec 2019 17:18:11 +0000
Subject: [PATCH] latency: fix calculation for multi-thread

[ upstream commit 2a178702c00f2a8b547358fedc7107d376f8825e ]

Make latency calculation multithread safe by
using spinlock.

Fixes: 5cd3cac9ed ("latency: added new library for latency stats")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
 lib/librte_latencystats/rte_latencystats.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/librte_latencystats/rte_latencystats.c b/lib/librte_latencystats/rte_latencystats.c
index 98e018939e..ba2fff3bcb 100644
--- a/lib/librte_latencystats/rte_latencystats.c
+++ b/lib/librte_latencystats/rte_latencystats.c
@@ -42,6 +42,7 @@ struct rte_latency_stats {
 	float avg_latency; /**< Average latency in nano seconds */
 	float max_latency; /**< Maximum latency in nano seconds */
 	float jitter; /** Latency variation */
+	rte_spinlock_t lock; /** Latency calculation lock */
 };
 
 static struct rte_latency_stats *glob_stats;
@@ -164,6 +165,7 @@ calc_latency(uint16_t pid __rte_unused,
 			latency[cnt++] = now - pkts[i]->timestamp;
 	}
 
+	rte_spinlock_lock(&glob_stats->lock);
 	for (i = 0; i < cnt; i++) {
 		/*
 		 * The jitter is calculated as statistical mean of interpacket
@@ -193,6 +195,7 @@ calc_latency(uint16_t pid __rte_unused,
 			alpha * (latency[i] - glob_stats->avg_latency);
 		prev_latency = latency[i];
 	}
+	rte_spinlock_unlock(&glob_stats->lock);
 
 	return nb_pkts;
 }
@@ -223,6 +226,7 @@ rte_latencystats_init(uint64_t app_samp_intvl,
 	}
 
 	glob_stats = mz->addr;
+	rte_spinlock_init(&glob_stats->lock);
 	samp_intvl = app_samp_intvl * latencystat_cycles_per_ns();
 
 	/** Register latency stats with stats library */
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-02-11 11:17:42.579087906 +0000
+++ 0108-latency-fix-calculation-for-multi-thread.patch	2020-02-11 11:17:38.572004563 +0000
@@ -1,13 +1,14 @@
-From 2a178702c00f2a8b547358fedc7107d376f8825e Mon Sep 17 00:00:00 2001
+From 94047950e2b4887d5bf4be4073e6be37c3ae64c0 Mon Sep 17 00:00:00 2001
 From: Reshma Pattan <reshma.pattan@intel.com>
 Date: Thu, 5 Dec 2019 17:18:11 +0000
 Subject: [PATCH] latency: fix calculation for multi-thread
 
+[ upstream commit 2a178702c00f2a8b547358fedc7107d376f8825e ]
+
 Make latency calculation multithread safe by
 using spinlock.
 
 Fixes: 5cd3cac9ed ("latency: added new library for latency stats")
-Cc: stable@dpdk.org
 
 Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
 ---