DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev]  [PATCH v2] service: fix service lcore stop function
@ 2017-09-06  7:15 Guduri Prathyusha
  2017-09-06  8:53 ` Van Haaren, Harry
  0 siblings, 1 reply; 4+ messages in thread
From: Guduri Prathyusha @ 2017-09-06  7:15 UTC (permalink / raw)
  To: harry.van.haaren; +Cc: dev, Guduri Prathyusha

lcore_states store the state of the lcore. Fixing the invalid
dereference of lcore_states with service number

Unit test case service_lcore_start_stop fails with the above fix.
Service core was stopped without stopping the service.

This commit fixes the test by adding negative and positive cases of
stopping the service lcore before and after stopping the service
respectively

Fixes: 21698354c832 ("service: introduce service cores concept")
Fixes: f038a81e1c56 ("service: add unit tests")

Signed-off-by: Guduri Prathyusha <gprathyusha@caviumnetworks.com>
---

This patch is based on [1]

v2 changes:
- Combined Patch 1/2 and 2/2 of v1
- Rebased to the future service core patches [1]

[1] http://dpdk.org/dev/patchwork/patch/27684/
---
 lib/librte_eal/common/rte_service.c | 4 ++--
 test/test/test_service_cores.c      | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c
index e7ed597d2..ae9a5263a 100644
--- a/lib/librte_eal/common/rte_service.c
+++ b/lib/librte_eal/common/rte_service.c
@@ -612,9 +612,9 @@ rte_service_lcore_stop(uint32_t lcore)
 		return -EALREADY;
 
 	uint32_t i;
+	uint64_t service_mask = lcore_states[lcore].service_mask;
 	for (i = 0; i < RTE_SERVICE_NUM_MAX; i++) {
-		int32_t enabled =
-			lcore_states[i].service_mask & (UINT64_C(1) << i);
+		int32_t enabled = service_mask & (UINT64_C(1) << i);
 		int32_t service_running = rte_service_runstate_get(i);
 		int32_t only_core = rte_services[i].num_mapped_cores == 1;
 
diff --git a/test/test/test_service_cores.c b/test/test/test_service_cores.c
index ddea7f0ba..ee8313ef6 100644
--- a/test/test/test_service_cores.c
+++ b/test/test/test_service_cores.c
@@ -576,6 +576,10 @@ service_lcore_start_stop(void)
 			"Service core expected to poll service but it didn't");
 
 	/* core stop */
+	TEST_ASSERT_EQUAL(-EBUSY, rte_service_lcore_stop(slcore_id),
+			"Service core running a service should return -EBUSY");
+	TEST_ASSERT_EQUAL(0, rte_service_runstate_set(sid, 0),
+			"Stopping valid service failed");
 	TEST_ASSERT_EQUAL(-EINVAL, rte_service_lcore_stop(100000),
 			"Invalid Service core stop should return -EINVAL");
 	TEST_ASSERT_EQUAL(0, rte_service_lcore_stop(slcore_id),
-- 
2.14.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2] service: fix service lcore stop function
  2017-09-06  7:15 [dpdk-dev] [PATCH v2] service: fix service lcore stop function Guduri Prathyusha
@ 2017-09-06  8:53 ` Van Haaren, Harry
  2017-09-06  9:01   ` Guduri Prathyusha
  2017-09-15 13:34   ` Thomas Monjalon
  0 siblings, 2 replies; 4+ messages in thread
From: Van Haaren, Harry @ 2017-09-06  8:53 UTC (permalink / raw)
  To: Guduri Prathyusha; +Cc: dev

> From: Guduri Prathyusha [mailto:gprathyusha@caviumnetworks.com]
> Sent: Wednesday, September 6, 2017 8:16 AM
> To: Van Haaren, Harry <harry.van.haaren@intel.com>
> Cc: dev@dpdk.org; Guduri Prathyusha <gprathyusha@caviumnetworks.com>
> Subject: [dpdk-dev] [PATCH v2] service: fix service lcore stop function
> 
> lcore_states store the state of the lcore. Fixing the invalid
> dereference of lcore_states with service number
> 
> Unit test case service_lcore_start_stop fails with the above fix.
> Service core was stopped without stopping the service.
> 
> This commit fixes the test by adding negative and positive cases of
> stopping the service lcore before and after stopping the service
> respectively
> 
> Fixes: 21698354c832 ("service: introduce service cores concept")
> Fixes: f038a81e1c56 ("service: add unit tests")
> 
> Signed-off-by: Guduri Prathyusha <gprathyusha@caviumnetworks.com>

Thanks for fixing and rebase / update to v2. Please mark the v1 of this patchset as "Superseded" in patchwork.

Reviewed-by: Harry van Haaren <harry.van.haaren@intel.com>


> This patch is based on [1]

To be totally clear, this patch depends on the service cores (v2) patchset,
as linked at [1].


> v2 changes:
> - Combined Patch 1/2 and 2/2 of v1
> - Rebased to the future service core patches [1]
> 
> [1] http://dpdk.org/dev/patchwork/patch/27684/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2] service: fix service lcore stop function
  2017-09-06  8:53 ` Van Haaren, Harry
@ 2017-09-06  9:01   ` Guduri Prathyusha
  2017-09-15 13:34   ` Thomas Monjalon
  1 sibling, 0 replies; 4+ messages in thread
From: Guduri Prathyusha @ 2017-09-06  9:01 UTC (permalink / raw)
  To: Van Haaren, Harry; +Cc: dev

On Wed, Sep 06, 2017 at 08:53:30AM +0000, Van Haaren, Harry wrote:
> > From: Guduri Prathyusha [mailto:gprathyusha@caviumnetworks.com]
> > Sent: Wednesday, September 6, 2017 8:16 AM
> > To: Van Haaren, Harry <harry.van.haaren@intel.com>
> > Cc: dev@dpdk.org; Guduri Prathyusha <gprathyusha@caviumnetworks.com>
> > Subject: [dpdk-dev] [PATCH v2] service: fix service lcore stop function
> >
> > lcore_states store the state of the lcore. Fixing the invalid
> > dereference of lcore_states with service number
> >
> > Unit test case service_lcore_start_stop fails with the above fix.
> > Service core was stopped without stopping the service.
> >
> > This commit fixes the test by adding negative and positive cases of
> > stopping the service lcore before and after stopping the service
> > respectively
> >
> > Fixes: 21698354c832 ("service: introduce service cores concept")
> > Fixes: f038a81e1c56 ("service: add unit tests")
> >
> > Signed-off-by: Guduri Prathyusha <gprathyusha@caviumnetworks.com>
>
> Thanks for fixing and rebase / update to v2. Please mark the v1 of this patchset as "Superseded" in patchwork.
>
> Reviewed-by: Harry van Haaren <harry.van.haaren@intel.com>
>
>
> > This patch is based on [1]
>
> To be totally clear, this patch depends on the service cores (v2) patchset,
> as linked at [1].
>
>

Thanks. Updated the patchwork status for v1

-Prathyusha
> > v2 changes:
> > - Combined Patch 1/2 and 2/2 of v1
> > - Rebased to the future service core patches [1]
> >
> > [1] http://dpdk.org/dev/patchwork/patch/27684/
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2] service: fix service lcore stop function
  2017-09-06  8:53 ` Van Haaren, Harry
  2017-09-06  9:01   ` Guduri Prathyusha
@ 2017-09-15 13:34   ` Thomas Monjalon
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2017-09-15 13:34 UTC (permalink / raw)
  To: Guduri Prathyusha; +Cc: dev, Van Haaren, Harry

> > lcore_states store the state of the lcore. Fixing the invalid
> > dereference of lcore_states with service number
> > 
> > Unit test case service_lcore_start_stop fails with the above fix.
> > Service core was stopped without stopping the service.
> > 
> > This commit fixes the test by adding negative and positive cases of
> > stopping the service lcore before and after stopping the service
> > respectively
> > 
> > Fixes: 21698354c832 ("service: introduce service cores concept")
> > Fixes: f038a81e1c56 ("service: add unit tests")
> > 
> > Signed-off-by: Guduri Prathyusha <gprathyusha@caviumnetworks.com>
> 
> Thanks for fixing and rebase / update to v2. Please mark the v1 of this patchset as "Superseded" in patchwork.
> 
> Reviewed-by: Harry van Haaren <harry.van.haaren@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-09-15 13:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-06  7:15 [dpdk-dev] [PATCH v2] service: fix service lcore stop function Guduri Prathyusha
2017-09-06  8:53 ` Van Haaren, Harry
2017-09-06  9:01   ` Guduri Prathyusha
2017-09-15 13:34   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).