From patchwork Fri Dec 16 17:16:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 120987 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 14F99A0542; Fri, 16 Dec 2022 18:16:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5FC0B42D32; Fri, 16 Dec 2022 18:16:47 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 411E042D25; Fri, 16 Dec 2022 18:16:45 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 82EA120B96DE; Fri, 16 Dec 2022 09:16:44 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 82EA120B96DE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1671211004; bh=tmEq2y2ofztDWyVbXpycKDPx7XHdv1RGWbAMfn7TudM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hxJu4/uQ0lmyaAMdjhXKcLhkDOe3xR7BOcQNs3z/FRBaxAweJ/6yHp5FR/QFyzfzw bPkb8/r8A0ug/gYIc5SJK9zT0OAlzOuKPVZ8cKWKYCSrqWX3GSDARrR+NSMX2ySnHL GnaoIbk5d6Q0b7zvZkFcr9iJgao3zoFDBanLHfJM= From: Tyler Retzlaff To: dev@dpdk.org Cc: stable@dpdk.org, david.marchand@redhat.com, dmitry.kozliuk@gmail.com, stephen@networkplumber.org, Tyler Retzlaff Subject: [PATCH v2 1/2] eal: add missing call marking memory config complete Date: Fri, 16 Dec 2022 09:16:39 -0800 Message-Id: <1671211000-14856-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1671211000-14856-1-git-send-email-roretzla@linux.microsoft.com> References: <1670287169-15325-1-git-send-email-roretzla@linux.microsoft.com> <1671211000-14856-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Memory configuration was not being marked as completed add the missing call to rte_eal_init() for Windows. Allows rte_thread_register to work on Windows and lcores_autotest to be built and run Windows which also exercises the rte_ctrl_thread_create API on Windows. Fixes: 5c307ba2a5b1 ("eal: register non-EAL threads as lcores") Signed-off-by: Tyler Retzlaff --- lib/eal/windows/eal.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c index adb929a..56fadc7 100644 --- a/lib/eal/windows/eal.c +++ b/lib/eal/windows/eal.c @@ -462,6 +462,9 @@ enum rte_proc_type_t */ rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MAIN); rte_eal_mp_wait_lcore(); + + eal_mcfg_complete(); + return fctret; } From patchwork Fri Dec 16 17:16:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 120988 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6E210A0542; Fri, 16 Dec 2022 18:17:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6063C42D42; Fri, 16 Dec 2022 18:16:48 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 4432242D29; Fri, 16 Dec 2022 18:16:45 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 8F19B20B96E1; Fri, 16 Dec 2022 09:16:44 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8F19B20B96E1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1671211004; bh=tUrEXmjD9BK5N5a/VgjhPvJEPVVRSsXdMCCbhNfrMzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FGm7EPcBziFUki2SHL+6nUV64hnAFtvNcXHqJJWmbNPLq3ZChpQnvMtlUJLGhyo6W y71JhV0Id/aqC6mekwgHpuM+AvUfdqbp22aymZgRneEDYBKn8FTRrjkiDwleUAbAT/ l5eUDUZC85xpZE4YzWEW3odR3XhzMEAgb6T4T4tc= From: Tyler Retzlaff To: dev@dpdk.org Cc: stable@dpdk.org, david.marchand@redhat.com, dmitry.kozliuk@gmail.com, stephen@networkplumber.org, Tyler Retzlaff Subject: [PATCH v2 2/2] test: enable lcores test on Windows Date: Fri, 16 Dec 2022 09:16:40 -0800 Message-Id: <1671211000-14856-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1671211000-14856-1-git-send-email-roretzla@linux.microsoft.com> References: <1670287169-15325-1-git-send-email-roretzla@linux.microsoft.com> <1671211000-14856-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Stop using pthread and convert the test to use EAL thread APIs. Because the EAL thread APIs provide more than just a stub for thread join on Windows the tests now pass and need not be skipped. Signed-off-by: Tyler Retzlaff --- app/test/test_lcores.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/app/test/test_lcores.c b/app/test/test_lcores.c index a6bb412..5b43aa5 100644 --- a/app/test/test_lcores.c +++ b/app/test/test_lcores.c @@ -8,17 +8,18 @@ #include #include #include +#include #include "test.h" struct thread_context { enum { Thread_INIT, Thread_ERROR, Thread_DONE } state; bool lcore_id_any; - pthread_t id; + rte_thread_t id; unsigned int *registered_count; }; -static void *thread_loop(void *arg) +static uint32_t thread_loop(void *arg) { struct thread_context *t = arg; unsigned int lcore_id; @@ -55,7 +56,7 @@ static void *thread_loop(void *arg) if (t->state != Thread_ERROR) t->state = Thread_DONE; - return NULL; + return 0; } static int @@ -77,7 +78,7 @@ static void *thread_loop(void *arg) t->state = Thread_INIT; t->registered_count = ®istered_count; t->lcore_id_any = false; - if (pthread_create(&t->id, NULL, thread_loop, t) != 0) + if (rte_thread_create(&t->id, NULL, thread_loop, t) != 0) break; non_eal_threads_count++; } @@ -96,7 +97,7 @@ static void *thread_loop(void *arg) t->state = Thread_INIT; t->registered_count = ®istered_count; t->lcore_id_any = true; - if (pthread_create(&t->id, NULL, thread_loop, t) == 0) { + if (rte_thread_create(&t->id, NULL, thread_loop, t) == 0) { non_eal_threads_count++; printf("non-EAL threads count: %u\n", non_eal_threads_count); while (__atomic_load_n(®istered_count, __ATOMIC_ACQUIRE) != @@ -110,7 +111,7 @@ static void *thread_loop(void *arg) ret = 0; for (i = 0; i < non_eal_threads_count; i++) { t = &thread_contexts[i]; - pthread_join(t->id, NULL); + rte_thread_join(t->id, NULL); if (t->state != Thread_DONE) ret = -1; } @@ -262,7 +263,7 @@ struct limit_lcore_context { t->state = Thread_INIT; t->registered_count = ®istered_count; t->lcore_id_any = false; - if (pthread_create(&t->id, NULL, thread_loop, t) != 0) + if (rte_thread_create(&t->id, NULL, thread_loop, t) != 0) goto cleanup_threads; non_eal_threads_count++; while (__atomic_load_n(®istered_count, __ATOMIC_ACQUIRE) != @@ -285,7 +286,7 @@ struct limit_lcore_context { t->state = Thread_INIT; t->registered_count = ®istered_count; t->lcore_id_any = true; - if (pthread_create(&t->id, NULL, thread_loop, t) != 0) + if (rte_thread_create(&t->id, NULL, thread_loop, t) != 0) goto cleanup_threads; non_eal_threads_count++; while (__atomic_load_n(®istered_count, __ATOMIC_ACQUIRE) != @@ -309,7 +310,7 @@ struct limit_lcore_context { ret = 0; for (i = 0; i < non_eal_threads_count; i++) { t = &thread_contexts[i]; - pthread_join(t->id, NULL); + rte_thread_join(t->id, NULL); if (t->state != Thread_DONE) ret = -1; } @@ -330,7 +331,7 @@ struct limit_lcore_context { __atomic_store_n(®istered_count, 0, __ATOMIC_RELEASE); for (i = 0; i < non_eal_threads_count; i++) { t = &thread_contexts[i]; - pthread_join(t->id, NULL); + rte_thread_join(t->id, NULL); } error: if (handle[1] != NULL) @@ -361,7 +362,7 @@ static void *ctrl_thread_loop(void *arg) /* Create one control thread */ t = &ctrl_thread_context; t->state = Thread_INIT; - if (rte_ctrl_thread_create(&t->id, "test_ctrl_threads", + if (rte_ctrl_thread_create((pthread_t *)&t->id, "test_ctrl_threads", NULL, ctrl_thread_loop, t) != 0) return -1; @@ -369,7 +370,7 @@ static void *ctrl_thread_loop(void *arg) * This also acts as the barrier such that the memory operations * in control thread are visible to this thread. */ - pthread_join(t->id, NULL); + rte_thread_join(t->id, NULL); /* Check if the control thread set the correct state */ if (t->state != Thread_DONE) @@ -384,9 +385,6 @@ static void *ctrl_thread_loop(void *arg) unsigned int eal_threads_count = 0; unsigned int i; - if (RTE_EXEC_ENV_IS_WINDOWS) - return TEST_SKIPPED; - for (i = 0; i < RTE_MAX_LCORE; i++) { if (!rte_lcore_has_role(i, ROLE_OFF)) eal_threads_count++;