From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <yliu@fridaylinux.org>
Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com
 [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 907C51B173
 for <stable@dpdk.org>; Wed, 24 Jan 2018 16:36:15 +0100 (CET)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id 477122226F;
 Wed, 24 Jan 2018 10:36:15 -0500 (EST)
Received: from frontend1 ([10.202.2.160])
 by compute1.internal (MEProxy); Wed, 24 Jan 2018 10:36:15 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org;
 h=cc:date:from:in-reply-to:message-id:references:subject:to
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=cAj02JwBmsXMAx611
 JHIF2321aK2AqCY7jeoUVIlMy4=; b=FC51PypJZWgTRwenqkdZijHXnVWiBZi5/
 LI2n1QStfWTPvtyFwBx3pneOZ15HjylqjAkiMV0RF0TWdHMnByP8c/0ZmtatvKy+
 htET4UDifMHw2f+pi/ycsyxFtls6Aqd7b3bznzbGWxTF1uw1Cdd40+aGcxPKyDZQ
 UmnRpyo5kNiYOh3XvA3e/pP4Yd88s9ITjJvSWzv8+BuJGlzRQjEuWZvd7dCFr2dB
 18dp7hP+pIsln3srmuzr2y24vEmf+Ru8UhLxHDeTtPsedcbGu2BIgSyI2jz2BMRM
 EuO5QgevZYLJ4nfgS2WSJK1+wBgaleZGX9/I3L3fSNrUuQwj7Dc1A==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:date:from:in-reply-to:message-id
 :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=
 fm1; bh=cAj02JwBmsXMAx611JHIF2321aK2AqCY7jeoUVIlMy4=; b=e7IYNiL5
 UKMachGoKBrq+uMmbQRPIEQYFxxMYXcECvB0ALV7jvdHNGMKsnbIkxApjNMeS7+p
 XrAzRF1VLrvrpdVQ8lkxAWvcf6N7bCU6QPqmtgqfBIF/7ALXxU69ogddv1q7Gloa
 eryGKWpBB3aHBfFHSkEvYUZ0XbNy7KSuZ+ARaTFMg9XBqDFCBLKGfWoT7j7Qi1ox
 Kddj+OosXbCOOc6kEJbK5xUXkFvQg1I98gj5D0ziOJnSMJs9Jb5yhGHwUIzFkwaY
 JmE765icaivzAXilptZ2DfYkafKrITjMWGpUlojXqvRMv3G4nMC2S51519cO5NY5
 /bbFb4gWIOB0lQ==
X-ME-Sender: <xms:76doWjk4Kapl6N4nPBi_5FXLRzDQ7jX0pCw7dJC_bJs31_aqgT5pRg>
Received: from localhost.localdomain (unknown [115.150.27.206])
 by mail.messagingengine.com (Postfix) with ESMTPA id 2F4017E3D4;
 Wed, 24 Jan 2018 10:36:12 -0500 (EST)
From: Yuanhan Liu <yliu@fridaylinux.org>
To: Harry van Haaren <harry.van.haaren@intel.com>
Cc: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>,
 dpdk stable <stable@dpdk.org>
Date: Wed, 24 Jan 2018 23:31:17 +0800
Message-Id: <1516808026-25523-9-git-send-email-yliu@fridaylinux.org>
X-Mailer: git-send-email 2.7.4
In-Reply-To: <1516808026-25523-1-git-send-email-yliu@fridaylinux.org>
References: <1516808026-25523-1-git-send-email-yliu@fridaylinux.org>
Subject: [dpdk-stable] patch 'service: fix lcore role after delete' has been
	queued to LTS release 17.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://dpdk.org/ml/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jan 2018 15:36:15 -0000

Hi,

FYI, your patch has been queued to LTS release 17.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 01/26/18. So please
shout if anyone has objections.

Thanks.

	--yliu

---
>>From 7a393b2d5812120d1e85e6aa48cd004f8be1f2f2 Mon Sep 17 00:00:00 2001
From: Harry van Haaren <harry.van.haaren@intel.com>
Date: Tue, 9 Jan 2018 13:37:40 +0000
Subject: [PATCH] service: fix lcore role after delete

[ upstream commit 54e7456a3bfdf2d7fe651ec25e951fe4b44be569 ]

This patch fixes the reset of the service core,
that when rte_service_lcore_del() is called, the
lcore_role is restored to RTE.

This issue was reported as when running the unit tests, an
error was thrown that "failed to allocate lcore". Investigating
revealed that the state of the service-cores after del() was
not allowing a core to be re-used at a later point in time.

Fixes: 21698354c832 ("service: introduce service cores concept")

Reported-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
 lib/librte_eal/common/rte_service.c | 36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c
index 2630770..9ff4136 100644
--- a/lib/librte_eal/common/rte_service.c
+++ b/lib/librte_eal/common/rte_service.c
@@ -587,23 +587,6 @@ rte_service_map_lcore_get(uint32_t id, uint32_t lcore)
 	return ret;
 }
 
-int32_t rte_service_lcore_reset_all(void)
-{
-	/* loop over cores, reset all to mask 0 */
-	uint32_t i;
-	for (i = 0; i < RTE_MAX_LCORE; i++) {
-		lcore_states[i].service_mask = 0;
-		lcore_states[i].is_service_core = 0;
-		lcore_states[i].runstate = RUNSTATE_STOPPED;
-	}
-	for (i = 0; i < RTE_SERVICE_NUM_MAX; i++)
-		rte_atomic32_set(&rte_services[i].num_mapped_cores, 0);
-
-	rte_smp_wmb();
-
-	return 0;
-}
-
 static void
 set_lcore_state(uint32_t lcore, int32_t state)
 {
@@ -618,6 +601,25 @@ set_lcore_state(uint32_t lcore, int32_t state)
 	lcore_states[lcore].is_service_core = (state == ROLE_SERVICE);
 }
 
+int32_t rte_service_lcore_reset_all(void)
+{
+	/* loop over cores, reset all to mask 0 */
+	uint32_t i;
+	for (i = 0; i < RTE_MAX_LCORE; i++) {
+		if (lcore_states[i].is_service_core) {
+			lcore_states[i].service_mask = 0;
+			set_lcore_state(i, ROLE_RTE);
+			lcore_states[i].runstate = RUNSTATE_STOPPED;
+		}
+	}
+	for (i = 0; i < RTE_SERVICE_NUM_MAX; i++)
+		rte_atomic32_set(&rte_services[i].num_mapped_cores, 0);
+
+	rte_smp_wmb();
+
+	return 0;
+}
+
 int32_t
 rte_service_lcore_add(uint32_t lcore)
 {
-- 
2.7.4