Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/130320/?format=api
http://patchwork.dpdk.org/api/patches/130320/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20230815031307.1299726-8-okaya@kernel.org/", "project": { "id": 1, "url": "http://patchwork.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20230815031307.1299726-8-okaya@kernel.org>", "list_archive_url": "https://inbox.dpdk.org/dev/20230815031307.1299726-8-okaya@kernel.org", "date": "2023-08-15T03:13:07", "name": "[v2,7/7] eal: initialize worker threads once", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "682bf5368720585a1f192365e1861cbb18881c98", "submitter": { "id": 2903, "url": "http://patchwork.dpdk.org/api/people/2903/?format=api", "name": "Sinan Kaya", "email": "okaya@kernel.org" }, "delegate": { "id": 1, "url": "http://patchwork.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20230815031307.1299726-8-okaya@kernel.org/mbox/", "series": [ { "id": 29224, "url": "http://patchwork.dpdk.org/api/series/29224/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=29224", "date": "2023-08-15T03:13:00", "name": "support reinit flow", "version": 2, "mbox": "http://patchwork.dpdk.org/series/29224/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/130320/comments/", "check": "warning", "checks": "http://patchwork.dpdk.org/api/patches/130320/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "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])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 905F243069;\n\tTue, 15 Aug 2023 05:13:50 +0200 (CEST)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 1E08843279;\n\tTue, 15 Aug 2023 05:13:22 +0200 (CEST)", "from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217])\n by mails.dpdk.org (Postfix) with ESMTP id 2851043268\n for <dev@dpdk.org>; Tue, 15 Aug 2023 05:13:17 +0200 (CEST)", "from smtp.kernel.org (relay.kernel.org [52.25.139.140])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits))\n (No client certificate requested)\n by dfw.source.kernel.org (Postfix) with ESMTPS id A9775618CD\n for <dev@dpdk.org>; Tue, 15 Aug 2023 03:13:16 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id BC636C433C7;\n Tue, 15 Aug 2023 03:13:15 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n s=k20201202; t=1692069196;\n bh=rga/mfWK9txfZleEC0PNVXGxa2wYApaIHcY7uIUrOT8=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=HJycr2yBvY91ujAFEPJRTdcscSUX57gmFF+Aa+H9ONc6bx9ClRZNTcFqvNhLSnFiy\n ZA70a6iNuf2guccAdGcAAKGlr10YAYz9KfJxQDXrYfLZUMFSdal/IIIY7KX4awsmrY\n TEgI7xti3e4hGIK4Kzm6vromL711G44bV3hbWvkBVCnZGdjsA95kICH8YqF62ovNrx\n WzOewMh1eJWhUZd5PC20pnz+Rb10uGmKSe6QpJtn+EAXSwcrqgxc9eatC+9t7PjHWb\n xDm7+7ZxJkzR87igsxop5bhT2+4F6poRXOODY4HqvUkMTF4b4FPybObrVdqf5FFzoB\n ID+WQcHER43KA==", "From": "okaya@kernel.org", "To": "", "Cc": "dev@dpdk.org,\n\tSinan Kaya <okaya@kernel.org>", "Subject": "[PATCH v2 7/7] eal: initialize worker threads once", "Date": "Mon, 14 Aug 2023 23:13:07 -0400", "Message-Id": "<20230815031307.1299726-8-okaya@kernel.org>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20230815031307.1299726-1-okaya@kernel.org>", "References": "<20230815031307.1299726-1-okaya@kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org" }, "content": "From: Sinan Kaya <okaya@kernel.org>\n\nInitialize worker threads once and keep a flag\nfor other init calls.\n\nSigned-off-by: Sinan Kaya <okaya@kernel.org>\n---\n lib/eal/linux/eal.c | 68 ++++++++++++++++++++++++---------------------\n 1 file changed, 36 insertions(+), 32 deletions(-)", "diff": "diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c\nindex 385a3427d4..d12b438d2b 100644\n--- a/lib/eal/linux/eal.c\n+++ b/lib/eal/linux/eal.c\n@@ -79,6 +79,7 @@ int rte_cycles_vmware_tsc_map;\n \n \n static uint32_t run_once;\n+static bool worker_initialized;\n \n int\n eal_clean_runtime_dir(void)\n@@ -1236,46 +1237,49 @@ rte_eal_init(int argc, char **argv)\n \t\tconfig->main_lcore, (uintptr_t)pthread_self(), cpuset,\n \t\tret == 0 ? \"\" : \"...\");\n \n-\tRTE_LCORE_FOREACH_WORKER(i) {\n+\tif (worker_initialized == false) {\n+\t\tRTE_LCORE_FOREACH_WORKER(i) {\n \n \t\t/*\n \t\t * create communication pipes between main thread\n \t\t * and children\n \t\t */\n-\t\tif (pipe(lcore_config[i].pipe_main2worker) < 0)\n-\t\t\trte_panic(\"Cannot create pipe\\n\");\n-\t\tif (pipe(lcore_config[i].pipe_worker2main) < 0)\n-\t\t\trte_panic(\"Cannot create pipe\\n\");\n-\n-\t\tlcore_config[i].state = WAIT;\n-\n-\t\t/* create a thread for each lcore */\n-\t\tret = eal_worker_thread_create(i);\n-\t\tif (ret != 0)\n-\t\t\trte_panic(\"Cannot create thread\\n\");\n-\n-\t\t/* Set thread_name for aid in debugging. */\n-\t\tsnprintf(thread_name, sizeof(thread_name),\n-\t\t\t\"rte-worker-%d\", i);\n-\t\tret = rte_thread_setname(lcore_config[i].thread_id,\n-\t\t\t\t\t\tthread_name);\n-\t\tif (ret != 0)\n-\t\t\tRTE_LOG(DEBUG, EAL,\n-\t\t\t\t\"Cannot set name for lcore thread\\n\");\n+\t\t\tif (pipe(lcore_config[i].pipe_main2worker) < 0)\n+\t\t\t\trte_panic(\"Cannot create pipe\\n\");\n+\t\t\tif (pipe(lcore_config[i].pipe_worker2main) < 0)\n+\t\t\t\trte_panic(\"Cannot create pipe\\n\");\n+\n+\t\t\tlcore_config[i].state = WAIT;\n+\n+\t\t\t/* create a thread for each lcore */\n+\t\t\tret = eal_worker_thread_create(i);\n+\t\t\tif (ret != 0)\n+\t\t\t\trte_panic(\"Cannot create thread\\n\");\n+\n+\t\t\t/* Set thread_name for aid in debugging. */\n+\t\t\tsnprintf(thread_name, sizeof(thread_name),\n+\t\t\t\t\"rte-worker-%d\", i);\n+\t\t\tret = rte_thread_setname(lcore_config[i].thread_id,\n+\t\t\t\t\t\t\tthread_name);\n+\t\t\tif (ret != 0)\n+\t\t\t\tRTE_LOG(DEBUG, EAL,\n+\t\t\t\t\t\"Cannot set name for lcore thread\\n\");\n+\n+\t\t\tret = pthread_setaffinity_np(lcore_config[i].thread_id,\n+\t\t\t\tsizeof(rte_cpuset_t), &lcore_config[i].cpuset);\n+\t\t\tif (ret != 0)\n+\t\t\t\trte_panic(\"Cannot set affinity\\n\");\n+\t\t}\n \n-\t\tret = pthread_setaffinity_np(lcore_config[i].thread_id,\n-\t\t\tsizeof(rte_cpuset_t), &lcore_config[i].cpuset);\n-\t\tif (ret != 0)\n-\t\t\trte_panic(\"Cannot set affinity\\n\");\n+\t\t/*\n+\t\t * Launch a dummy function on all worker lcores, so that main lcore\n+\t\t * knows they are all ready when this function returns.\n+\t\t */\n+\t\trte_eal_mp_remote_launch(sync_func, NULL, SKIP_MAIN);\n+\t\trte_eal_mp_wait_lcore();\n+\t\tworker_initialized = true;\n \t}\n \n-\t/*\n-\t * Launch a dummy function on all worker lcores, so that main lcore\n-\t * knows they are all ready when this function returns.\n-\t */\n-\trte_eal_mp_remote_launch(sync_func, NULL, SKIP_MAIN);\n-\trte_eal_mp_wait_lcore();\n-\n \t/* initialize services so vdevs register service during bus_probe. */\n \tret = rte_service_init();\n \tif (ret) {\n", "prefixes": [ "v2", "7/7" ] }{ "id": 130320, "url": "