From: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
To: dev@dpdk.org, honnappa.nagarahalli@arm.com,
olivier.matz@6wind.com, lucp.at.work@gmail.com,
stephen@networkplumber.org, david.marchand@redhat.com,
thomas@monjalon.net
Cc: ruifeng.wang@arm.com, nd@arm.com
Subject: [dpdk-dev] [PATCH v4 2/2] test/eal: add a test for rte_ctrl_thread_create
Date: Wed, 13 Oct 2021 15:18:11 -0500 [thread overview]
Message-ID: <20211013201811.15247-2-honnappa.nagarahalli@arm.com> (raw)
In-Reply-To: <20211013201811.15247-1-honnappa.nagarahalli@arm.com>
Add a testcase to test launching of control threads.
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
app/test/test_lcores.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/app/test/test_lcores.c b/app/test/test_lcores.c
index 19a7ab9fce..35c47d5372 100644
--- a/app/test/test_lcores.c
+++ b/app/test/test_lcores.c
@@ -340,6 +340,44 @@ test_non_eal_lcores_callback(unsigned int eal_threads_count)
return -1;
}
+static void *ctrl_thread_loop(void *arg)
+{
+ struct thread_context *t = arg;
+
+ printf("Control thread running successfully\n");
+
+ /* Set the thread state to DONE */
+ t->state = DONE;
+
+ return NULL;
+}
+
+static int
+test_ctrl_thread(void)
+{
+ struct thread_context ctrl_thread_context;
+ struct thread_context *t;
+
+ /* Create one control thread */
+ t = &ctrl_thread_context;
+ t->state = INIT;
+ if (rte_ctrl_thread_create(&t->id, "test_ctrl_threads",
+ NULL, ctrl_thread_loop, t) != 0)
+ return -1;
+
+ /* Wait till the control thread exits.
+ * This also acts as the barrier such that the memory operations
+ * in control thread are visible to this thread.
+ */
+ pthread_join(t->id, NULL);
+
+ /* Check if the control thread set the correct state */
+ if (t->state != DONE)
+ return -1;
+
+ return 0;
+}
+
static int
test_lcores(void)
{
@@ -367,6 +405,9 @@ test_lcores(void)
if (test_non_eal_lcores_callback(eal_threads_count) < 0)
return TEST_FAILED;
+ if (test_ctrl_thread() < 0)
+ return TEST_FAILED;
+
return TEST_SUCCESS;
}
--
2.25.1
next prev parent reply other threads:[~2021-10-13 20:18 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-30 21:37 [dpdk-dev] [RFC] eal: simplify the implementation of rte_ctrl_thread_create Honnappa Nagarahalli
2021-08-02 5:16 ` [dpdk-dev] [RFC v2] " Honnappa Nagarahalli
2021-08-23 10:16 ` Olivier Matz
2021-08-24 20:03 ` Honnappa Nagarahalli
2021-08-24 21:30 ` Stephen Hemminger
2021-08-25 1:26 ` Honnappa Nagarahalli
2021-08-25 15:19 ` Mattias Rönnblom
2021-08-25 15:31 ` Honnappa Nagarahalli
2021-09-01 20:04 ` Mattias Rönnblom
2021-09-01 22:21 ` Honnappa Nagarahalli
2021-08-30 22:30 ` Honnappa Nagarahalli
2021-08-25 15:12 ` Mattias Rönnblom
2021-08-25 15:23 ` Honnappa Nagarahalli
2021-08-25 21:57 ` Stephen Hemminger
2021-08-25 18:48 ` [dpdk-dev] [RFC] " Luc Pelletier
2021-08-25 19:26 ` Honnappa Nagarahalli
2021-08-30 16:34 ` [dpdk-dev] [PATCH v3 1/2] " Honnappa Nagarahalli
2021-08-30 16:34 ` [dpdk-dev] [PATCH v3 2/2] test/eal: add a test for rte_ctrl_thread_create Honnappa Nagarahalli
2021-08-30 16:41 ` Stephen Hemminger
2021-08-30 16:42 ` Honnappa Nagarahalli
2021-08-30 16:44 ` [dpdk-dev] [PATCH v3 1/2] eal: simplify the implementation of rte_ctrl_thread_create Stephen Hemminger
2021-08-30 22:12 ` Honnappa Nagarahalli
2021-10-13 20:18 ` [dpdk-dev] [PATCH v4 " Honnappa Nagarahalli
2021-10-13 20:18 ` Honnappa Nagarahalli [this message]
2021-10-21 15:46 ` Olivier Matz
2021-10-21 20:49 ` Honnappa Nagarahalli
2021-10-21 21:32 ` [dpdk-dev] [PATCH v5 " Honnappa Nagarahalli
2021-10-21 21:32 ` [dpdk-dev] [PATCH v5 2/2] test/eal: add a test for rte_ctrl_thread_create Honnappa Nagarahalli
2021-10-22 8:35 ` Olivier Matz
2021-10-25 19:46 ` David Marchand
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=20211013201811.15247-2-honnappa.nagarahalli@arm.com \
--to=honnappa.nagarahalli@arm.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=lucp.at.work@gmail.com \
--cc=nd@arm.com \
--cc=olivier.matz@6wind.com \
--cc=ruifeng.wang@arm.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/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.