All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
To: jerin.jacob@caviumnetworks.com, harry.van.haaren@intel.com,
	hemant.agrawal@nxp.com, santosh.shukla@caviumnetworks.com
Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Subject: [PATCH 3/7] app/test-eventdev: update app to use service cores
Date: Wed, 11 Oct 2017 14:39:46 +0530	[thread overview]
Message-ID: <1507712990-13064-4-git-send-email-pbhagavatula@caviumnetworks.com> (raw)
In-Reply-To: <1507712990-13064-1-git-send-email-pbhagavatula@caviumnetworks.com>

Use service cores for offloading event scheduling in case of
centralized scheduling instead of calling the schedule api directly.
This removes the dependency on dedicated scheduler core specified by
giving command line option --slcore.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
 app/test-eventdev/evt_common.h        | 41 +++++++++++++++++++++++++++++++++++
 app/test-eventdev/evt_options.c       | 10 ---------
 app/test-eventdev/test_order_atq.c    |  6 +++++
 app/test-eventdev/test_order_common.c |  3 ---
 app/test-eventdev/test_order_queue.c  |  6 +++++
 app/test-eventdev/test_perf_atq.c     |  6 +++++
 app/test-eventdev/test_perf_common.c  | 21 ------------------
 app/test-eventdev/test_perf_common.h  |  1 +
 app/test-eventdev/test_perf_queue.c   |  6 +++++
 9 files changed, 66 insertions(+), 34 deletions(-)

diff --git a/app/test-eventdev/evt_common.h b/app/test-eventdev/evt_common.h
index 4102076..0300453 100644
--- a/app/test-eventdev/evt_common.h
+++ b/app/test-eventdev/evt_common.h
@@ -36,6 +36,7 @@
 #include <rte_common.h>
 #include <rte_debug.h>
 #include <rte_eventdev.h>
+#include <rte_service.h>
 
 #define CLNRM  "\x1b[0m"
 #define CLRED  "\x1b[31m"
@@ -113,4 +114,44 @@ evt_sched_type2queue_cfg(uint8_t sched_type)
 	return ret;
 }
 
+
+static inline int
+evt_service_setup(uint8_t dev_id)
+{
+	uint32_t service_id;
+	int32_t core_cnt;
+	unsigned lcore = 0;
+	uint32_t core_array[RTE_MAX_LCORE];
+	uint8_t cnt;
+	uint8_t min_cnt = UINT8_MAX;
+
+	if (evt_has_distributed_sched(dev_id))
+		return 0;
+
+	if (!rte_service_lcore_count())
+		return -ENOENT;
+
+	if (!rte_event_dev_service_id_get(dev_id, &service_id)) {
+		core_cnt = rte_service_lcore_list(core_array,
+				RTE_MAX_LCORE);
+		if (core_cnt < 0)
+			return -ENOENT;
+		/* Get the core which has least number of services running. */
+		while (core_cnt--) {
+			/* Reset default mapping */
+			rte_service_map_lcore_set(service_id,
+					core_array[core_cnt], 0);
+			cnt = rte_service_lcore_count_services(
+					core_array[core_cnt]);
+			if (cnt < min_cnt) {
+				lcore = core_array[core_cnt];
+				min_cnt = cnt;
+			}
+		}
+		if (rte_service_map_lcore_set(service_id, lcore, 1))
+			return -ENOENT;
+	}
+	return 0;
+}
+
 #endif /*  _EVT_COMMON_*/
diff --git a/app/test-eventdev/evt_options.c b/app/test-eventdev/evt_options.c
index 65e22f8..e2187df 100644
--- a/app/test-eventdev/evt_options.c
+++ b/app/test-eventdev/evt_options.c
@@ -114,13 +114,6 @@ evt_parse_test_name(struct evt_options *opt, const char *arg)
 }
 
 static int
-evt_parse_slcore(struct evt_options *opt, const char *arg)
-{
-	opt->slcore = atoi(arg);
-	return 0;
-}
-
-static int
 evt_parse_socket_id(struct evt_options *opt, const char *arg)
 {
 	opt->socket_id = atoi(arg);
@@ -188,7 +181,6 @@ usage(char *program)
 		"\t--test             : name of the test application to run\n"
 		"\t--socket_id        : socket_id of application resources\n"
 		"\t--pool_sz          : pool size of the mempool\n"
-		"\t--slcore           : lcore id of the scheduler\n"
 		"\t--plcores          : list of lcore ids for producers\n"
 		"\t--wlcores          : list of lcore ids for workers\n"
 		"\t--stlist           : list of scheduled types of the stages\n"
@@ -254,7 +246,6 @@ static struct option lgopts[] = {
 	{ EVT_POOL_SZ,          1, 0, 0 },
 	{ EVT_NB_PKTS,          1, 0, 0 },
 	{ EVT_WKR_DEQ_DEP,      1, 0, 0 },
-	{ EVT_SCHED_LCORE,      1, 0, 0 },
 	{ EVT_SCHED_TYPE_LIST,  1, 0, 0 },
 	{ EVT_FWD_LATENCY,      0, 0, 0 },
 	{ EVT_QUEUE_PRIORITY,   0, 0, 0 },
@@ -278,7 +269,6 @@ evt_opts_parse_long(int opt_idx, struct evt_options *opt)
 		{ EVT_POOL_SZ, evt_parse_pool_sz},
 		{ EVT_NB_PKTS, evt_parse_nb_pkts},
 		{ EVT_WKR_DEQ_DEP, evt_parse_wkr_deq_dep},
-		{ EVT_SCHED_LCORE, evt_parse_slcore},
 		{ EVT_SCHED_TYPE_LIST, evt_parse_sched_type_list},
 		{ EVT_FWD_LATENCY, evt_parse_fwd_latency},
 		{ EVT_QUEUE_PRIORITY, evt_parse_queue_priority},
diff --git a/app/test-eventdev/test_order_atq.c b/app/test-eventdev/test_order_atq.c
index 7e6c67d..4ee0dea 100644
--- a/app/test-eventdev/test_order_atq.c
+++ b/app/test-eventdev/test_order_atq.c
@@ -179,6 +179,12 @@ order_atq_eventdev_setup(struct evt_test *test, struct evt_options *opt)
 	if (ret)
 		return ret;
 
+	ret = evt_service_setup(opt->dev_id);
+	if (ret) {
+		evt_err("No service lcore found to run event dev.");
+		return ret;
+	}
+
 	ret = rte_event_dev_start(opt->dev_id);
 	if (ret) {
 		evt_err("failed to start eventdev %d", opt->dev_id);
diff --git a/app/test-eventdev/test_order_common.c b/app/test-eventdev/test_order_common.c
index 80e14c0..7cfe7fa 100644
--- a/app/test-eventdev/test_order_common.c
+++ b/app/test-eventdev/test_order_common.c
@@ -292,9 +292,6 @@ order_launch_lcores(struct evt_test *test, struct evt_options *opt,
 	int64_t old_remaining  = -1;
 
 	while (t->err == false) {
-
-		rte_event_schedule(opt->dev_id);
-
 		uint64_t new_cycles = rte_get_timer_cycles();
 		int64_t remaining = rte_atomic64_read(&t->outstand_pkts);
 
diff --git a/app/test-eventdev/test_order_queue.c b/app/test-eventdev/test_order_queue.c
index beadd9c..a14e0b0 100644
--- a/app/test-eventdev/test_order_queue.c
+++ b/app/test-eventdev/test_order_queue.c
@@ -192,6 +192,12 @@ order_queue_eventdev_setup(struct evt_test *test, struct evt_options *opt)
 	if (ret)
 		return ret;
 
+	ret = evt_service_setup(opt->dev_id);
+	if (ret) {
+		evt_err("No service lcore found to run event dev.");
+		return ret;
+	}
+
 	ret = rte_event_dev_start(opt->dev_id);
 	if (ret) {
 		evt_err("failed to start eventdev %d", opt->dev_id);
diff --git a/app/test-eventdev/test_perf_atq.c b/app/test-eventdev/test_perf_atq.c
index 9c3efa3..0e9f2db 100644
--- a/app/test-eventdev/test_perf_atq.c
+++ b/app/test-eventdev/test_perf_atq.c
@@ -221,6 +221,12 @@ perf_atq_eventdev_setup(struct evt_test *test, struct evt_options *opt)
 	if (ret)
 		return ret;
 
+	ret = evt_service_setup(opt->dev_id);
+	if (ret) {
+		evt_err("No service lcore found to run event dev.");
+		return ret;
+	}
+
 	ret = rte_event_dev_start(opt->dev_id);
 	if (ret) {
 		evt_err("failed to start eventdev %d", opt->dev_id);
diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
index 7b09299..770e365 100644
--- a/app/test-eventdev/test_perf_common.c
+++ b/app/test-eventdev/test_perf_common.c
@@ -88,18 +88,6 @@ perf_producer(void *arg)
 	return 0;
 }
 
-static inline int
-scheduler(void *arg)
-{
-	struct test_perf *t = arg;
-	const uint8_t dev_id = t->opt->dev_id;
-
-	while (t->done == false)
-		rte_event_schedule(dev_id);
-
-	return 0;
-}
-
 static inline uint64_t
 processed_pkts(struct test_perf *t)
 {
@@ -163,15 +151,6 @@ perf_launch_lcores(struct evt_test *test, struct evt_options *opt,
 		port_idx++;
 	}
 
-	/* launch scheduler */
-	if (!evt_has_distributed_sched(opt->dev_id)) {
-		ret = rte_eal_remote_launch(scheduler, t, opt->slcore);
-		if (ret) {
-			evt_err("failed to launch sched %d", opt->slcore);
-			return ret;
-		}
-	}
-
 	const uint64_t total_pkts = opt->nb_pkts *
 			evt_nr_active_lcores(opt->plcores);
 
diff --git a/app/test-eventdev/test_perf_common.h b/app/test-eventdev/test_perf_common.h
index 4956586..c6fc70c 100644
--- a/app/test-eventdev/test_perf_common.h
+++ b/app/test-eventdev/test_perf_common.h
@@ -159,6 +159,7 @@ int perf_test_setup(struct evt_test *test, struct evt_options *opt);
 int perf_mempool_setup(struct evt_test *test, struct evt_options *opt);
 int perf_event_dev_port_setup(struct evt_test *test, struct evt_options *opt,
 				uint8_t stride, uint8_t nb_queues);
+int perf_event_dev_service_setup(uint8_t dev_id);
 int perf_launch_lcores(struct evt_test *test, struct evt_options *opt,
 		int (*worker)(void *));
 void perf_opt_dump(struct evt_options *opt, uint8_t nb_queues);
diff --git a/app/test-eventdev/test_perf_queue.c b/app/test-eventdev/test_perf_queue.c
index 658c08a..78f43b5 100644
--- a/app/test-eventdev/test_perf_queue.c
+++ b/app/test-eventdev/test_perf_queue.c
@@ -232,6 +232,12 @@ perf_queue_eventdev_setup(struct evt_test *test, struct evt_options *opt)
 	if (ret)
 		return ret;
 
+	ret = evt_service_setup(opt->dev_id);
+	if (ret) {
+		evt_err("No service lcore found to run event dev.");
+		return ret;
+	}
+
 	ret = rte_event_dev_start(opt->dev_id);
 	if (ret) {
 		evt_err("failed to start eventdev %d", opt->dev_id);
-- 
2.7.4

  parent reply	other threads:[~2017-10-11  9:10 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-11  9:09 [PATCH 0/7] eventdev: remove event schedule API for SW driver Pavan Nikhilesh
2017-10-11  9:09 ` [PATCH 1/7] eventdev: add API to get service id Pavan Nikhilesh
2017-10-11  9:09 ` [PATCH 2/7] event/sw: extend service capability Pavan Nikhilesh
2017-10-11  9:09 ` Pavan Nikhilesh [this message]
2017-10-11  9:09 ` [PATCH 4/7] test/eventdev: update test to use service core Pavan Nikhilesh
2017-10-11  9:09 ` [PATCH 5/7] examples/eventdev: update sample app to use service Pavan Nikhilesh
2017-10-11  9:09 ` [PATCH 6/7] eventdev: remove eventdev schedule API Pavan Nikhilesh
2017-10-11  9:09 ` [PATCH 7/7] doc: update software event device Pavan Nikhilesh
2017-10-12 12:29   ` Mcnamara, John
2017-10-13 16:36 ` [PATCH v2 1/7] eventdev: add API to get service id Pavan Nikhilesh
2017-10-13 16:36   ` [PATCH v2 2/7] event/sw: extend service capability Pavan Nikhilesh
2017-10-20 10:30     ` Van Haaren, Harry
2017-10-13 16:36   ` [PATCH v2 3/7] app/test-eventdev: update app to use service cores Pavan Nikhilesh
2017-10-21 17:01     ` Jerin Jacob
2017-10-13 16:36   ` [PATCH v2 4/7] test/eventdev: update test to use service core Pavan Nikhilesh
2017-10-13 16:36   ` [PATCH v2 5/7] examples/eventdev: update sample app to use service Pavan Nikhilesh
2017-10-23 17:17     ` Van Haaren, Harry
2017-10-23 17:51       ` Pavan Nikhilesh Bhagavatula
2017-10-13 16:36   ` [PATCH v2 6/7] eventdev: remove eventdev schedule API Pavan Nikhilesh
2017-10-21 17:07     ` Jerin Jacob
2017-10-13 16:36   ` [PATCH v2 7/7] doc: update software event device Pavan Nikhilesh
2017-10-20 10:21   ` [PATCH v2 1/7] eventdev: add API to get service id Van Haaren, Harry
2017-10-20 11:11     ` Pavan Nikhilesh Bhagavatula
2017-10-22  9:16 ` [PATCH v3 " Pavan Nikhilesh
2017-10-22  9:16   ` [PATCH v3 2/7] event/sw: extend service capability Pavan Nikhilesh
2017-10-22  9:16   ` [PATCH v3 3/7] app/test-eventdev: update app to use service cores Pavan Nikhilesh
2017-10-22  9:16   ` [PATCH v3 4/7] test/eventdev: update test to use service core Pavan Nikhilesh
2017-10-22  9:16   ` [PATCH v3 5/7] examples/eventdev: update sample app to use service Pavan Nikhilesh
2017-10-22  9:16   ` [PATCH v3 6/7] eventdev: remove eventdev schedule API Pavan Nikhilesh
2017-10-22  9:16   ` [PATCH v3 7/7] doc: update software event device Pavan Nikhilesh
2017-10-25 11:59 ` [PATCH v4 1/7] eventdev: add API to get service id Pavan Nikhilesh
2017-10-25 11:59   ` [PATCH v4 2/7] event/sw: extend service capability Pavan Nikhilesh
2017-10-25 11:59   ` [PATCH v4 3/7] app/test-eventdev: update app to use service cores Pavan Nikhilesh
2017-10-25 11:59   ` [PATCH v4 4/7] test/eventdev: update test to use service iter Pavan Nikhilesh
2017-10-25 14:24     ` Van Haaren, Harry
2017-10-25 11:59   ` [PATCH v4 5/7] examples/eventdev: update sample app to use service Pavan Nikhilesh
2017-10-25 14:24     ` Van Haaren, Harry
2017-10-25 11:59   ` [PATCH v4 6/7] eventdev: remove eventdev schedule API Pavan Nikhilesh
2017-10-25 11:59   ` [PATCH v4 7/7] doc: update software event device Pavan Nikhilesh
2017-10-25 14:50 ` [PATCH v5 1/7] eventdev: add API to get service id Pavan Nikhilesh
2017-10-25 14:50   ` [PATCH v5 2/7] event/sw: extend service capability Pavan Nikhilesh
2017-10-25 14:50   ` [PATCH v5 3/7] app/test-eventdev: update app to use service cores Pavan Nikhilesh
2017-10-25 14:50   ` [PATCH v5 4/7] test/eventdev: update test to use service iter Pavan Nikhilesh
2017-10-25 14:50   ` [PATCH v5 5/7] examples/eventdev: update sample app to use service Pavan Nikhilesh
2017-10-25 14:50   ` [PATCH v5 6/7] eventdev: remove eventdev schedule API Pavan Nikhilesh
2017-10-25 14:50   ` [PATCH v5 7/7] doc: update software event device Pavan Nikhilesh
2017-10-26 22:47   ` [PATCH v5 1/7] eventdev: add API to get service id Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1507712990-13064-4-git-send-email-pbhagavatula@caviumnetworks.com \
    --to=pbhagavatula@caviumnetworks.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=santosh.shukla@caviumnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.