Show a patch.

GET /api/patches/73343/
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 73343,
    "url": "https://patches.dpdk.org/api/patches/73343/",
    "web_url": "https://patches.dpdk.org/patch/73343/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<20200706205234.8040-5-david.marchand@redhat.com>",
    "date": "2020-07-06T20:52:28",
    "name": "[v6,04/10] eal: introduce thread uninit helper",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "ca6a1a069e164cd8d9039cf35e5463e9263b1b22",
    "submitter": {
        "id": 1173,
        "url": "https://patches.dpdk.org/api/people/1173/",
        "name": "David Marchand",
        "email": "david.marchand@redhat.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/patch/73343/mbox/",
    "series": [
        {
            "id": 10826,
            "url": "https://patches.dpdk.org/api/series/10826/",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=10826",
            "date": "2020-07-06T20:52:25",
            "name": "Register non-EAL threads as lcore",
            "version": 6,
            "mbox": "https://patches.dpdk.org/series/10826/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/73343/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/73343/checks/",
    "tags": {},
    "headers": {
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "To": "dev@dpdk.org",
        "X-MC-Unique": "VaaJtE0MOiW20SscaOXETw-1",
        "Message-Id": "<20200706205234.8040-5-david.marchand@redhat.com>",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1594068794;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=ED4q3Pdx0l6mBkvLKMsv27ndbihL6yPAg0JeujBn7Eg=;\n b=LXflOfDIWQs1pI28G5KqtaxzoUoHRoLHUeqZNCiTZolFNGnxzqh8J71V+f66aO4JXuzdPE\n FO7Dd+53LT38ySlTUvOIGB2zosaEHdqIaZ7aowbiYiZzUmeOjN8kn4pyje5q52dXAC8alT\n a2UWI6XCPEGbWFtOzFvi6qSUWvrcaOs=",
        "X-Scanned-By": "MIMEDefang 2.84 on 10.5.11.22",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-BeenThere": "dev@dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 8F87EA00C5;\n\tMon,  6 Jul 2020 22:53:33 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 447C31DDBA;\n\tMon,  6 Jul 2020 22:53:16 +0200 (CEST)",
            "from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com\n [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id ED3D71DDB2\n for <dev@dpdk.org>; Mon,  6 Jul 2020 22:53:14 +0200 (CEST)",
            "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id\n us-mta-147-VaaJtE0MOiW20SscaOXETw-1; Mon, 06 Jul 2020 16:53:10 -0400",
            "from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com\n [10.5.11.22])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 78362107B7C5;\n Mon,  6 Jul 2020 20:53:08 +0000 (UTC)",
            "from dmarchan.remote.csb (unknown [10.40.195.188])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 1079A10013D7;\n Mon,  6 Jul 2020 20:53:02 +0000 (UTC)"
        ],
        "Subject": "[dpdk-dev] [PATCH v6 04/10] eal: introduce thread uninit helper",
        "In-Reply-To": "<20200706205234.8040-1-david.marchand@redhat.com>",
        "Authentication-Results": "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com",
        "X-Mimecast-Spam-Score": "0",
        "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-Post": "<mailto:dev@dpdk.org>",
        "Cc": "jerinjacobk@gmail.com, bruce.richardson@intel.com, mdr@ashroe.eu,\n thomas@monjalon.net, arybchenko@solarflare.com, ktraynor@redhat.com,\n ian.stokes@intel.com, i.maximets@ovn.org, olivier.matz@6wind.com,\n konstantin.ananyev@intel.com, Jerin Jacob <jerinj@marvell.com>,\n Sunil Kumar Kori <skori@marvell.com>,\n Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>,\n Omar Cardona <ocardona@microsoft.com>,\n Pallavi Kadam <pallavi.kadam@intel.com>,\n Ranjit Menon <ranjit.menon@intel.com>",
        "Precedence": "list",
        "From": "David Marchand <david.marchand@redhat.com>",
        "Content-Transfer-Encoding": "8bit",
        "MIME-Version": "1.0",
        "References": "<20200610144506.30505-1-david.marchand@redhat.com>\n <20200706205234.8040-1-david.marchand@redhat.com>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "Errors-To": "dev-bounces@dpdk.org",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Content-Type": "text/plain; charset=US-ASCII",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Date": "Mon,  6 Jul 2020 22:52:28 +0200",
        "X-Mimecast-Originator": "redhat.com",
        "X-Mailman-Version": "2.1.15"
    },
    "content": "This is a preparation step for dynamically unregistering threads.\n\nSince we explicitly allocate a per thread trace buffer in\n__rte_thread_init, add an internal helper to free this buffer.\n\nSigned-off-by: David Marchand <david.marchand@redhat.com>\n---\nChanges since v5:\n- fixed windows build,\n\nChanges since v4:\n- renamed rte_thread_uninit and moved to eal_private.h,\n- hid freeing helper,\n\nChanges since v2:\n- added missing stub for windows tracing support,\n- moved free symbol to exported (experimental) ABI as a counterpart of\n  the alloc symbol we already had,\n\nChanges since v1:\n- rebased on master, removed Windows workaround wrt traces support,\n\n---\n lib/librte_eal/common/eal_common_thread.c |  9 +++++\n lib/librte_eal/common/eal_common_trace.c  | 49 +++++++++++++++++++----\n lib/librte_eal/common/eal_private.h       |  5 +++\n lib/librte_eal/common/eal_trace.h         |  1 +\n lib/librte_eal/windows/eal.c              |  7 +++-\n 5 files changed, 63 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/common/eal_common_thread.c b/lib/librte_eal/common/eal_common_thread.c\nindex fb06f8f802..6d1c87b1c2 100644\n--- a/lib/librte_eal/common/eal_common_thread.c\n+++ b/lib/librte_eal/common/eal_common_thread.c\n@@ -20,6 +20,7 @@\n #include \"eal_internal_cfg.h\"\n #include \"eal_private.h\"\n #include \"eal_thread.h\"\n+#include \"eal_trace.h\"\n \n RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY;\n RTE_DEFINE_PER_LCORE(int, _thread_id) = -1;\n@@ -161,6 +162,14 @@ __rte_thread_init(unsigned int lcore_id, rte_cpuset_t *cpuset)\n \t__rte_trace_mem_per_thread_alloc();\n }\n \n+void\n+__rte_thread_uninit(void)\n+{\n+\ttrace_mem_per_thread_free();\n+\n+\tRTE_PER_LCORE(_lcore_id) = LCORE_ID_ANY;\n+}\n+\n struct rte_thread_ctrl_params {\n \tvoid *(*start_routine)(void *);\n \tvoid *arg;\ndiff --git a/lib/librte_eal/common/eal_common_trace.c b/lib/librte_eal/common/eal_common_trace.c\nindex 875553d7e5..b6da5537fe 100644\n--- a/lib/librte_eal/common/eal_common_trace.c\n+++ b/lib/librte_eal/common/eal_common_trace.c\n@@ -101,7 +101,7 @@ eal_trace_fini(void)\n {\n \tif (!rte_trace_is_enabled())\n \t\treturn;\n-\ttrace_mem_per_thread_free();\n+\ttrace_mem_free();\n \ttrace_metadata_destroy();\n \teal_trace_args_free();\n }\n@@ -370,24 +370,59 @@ __rte_trace_mem_per_thread_alloc(void)\n \trte_spinlock_unlock(&trace->lock);\n }\n \n+static void\n+trace_mem_per_thread_free_unlocked(struct thread_mem_meta *meta)\n+{\n+\tif (meta->area == TRACE_AREA_HUGEPAGE)\n+\t\teal_free_no_trace(meta->mem);\n+\telse if (meta->area == TRACE_AREA_HEAP)\n+\t\tfree(meta->mem);\n+}\n+\n void\n trace_mem_per_thread_free(void)\n+{\n+\tstruct trace *trace = trace_obj_get();\n+\tstruct __rte_trace_header *header;\n+\tuint32_t count;\n+\n+\theader = RTE_PER_LCORE(trace_mem);\n+\tif (header == NULL)\n+\t\treturn;\n+\n+\trte_spinlock_lock(&trace->lock);\n+\tfor (count = 0; count < trace->nb_trace_mem_list; count++) {\n+\t\tif (trace->lcore_meta[count].mem == header)\n+\t\t\tbreak;\n+\t}\n+\tif (count != trace->nb_trace_mem_list) {\n+\t\tstruct thread_mem_meta *meta = &trace->lcore_meta[count];\n+\n+\t\ttrace_mem_per_thread_free_unlocked(meta);\n+\t\tif (count != trace->nb_trace_mem_list - 1) {\n+\t\t\tmemmove(meta, meta + 1,\n+\t\t\t\tsizeof(*meta) *\n+\t\t\t\t (trace->nb_trace_mem_list - count - 1));\n+\t\t}\n+\t\ttrace->nb_trace_mem_list--;\n+\t}\n+\trte_spinlock_unlock(&trace->lock);\n+}\n+\n+void\n+trace_mem_free(void)\n {\n \tstruct trace *trace = trace_obj_get();\n \tuint32_t count;\n-\tvoid *mem;\n \n \tif (!rte_trace_is_enabled())\n \t\treturn;\n \n \trte_spinlock_lock(&trace->lock);\n \tfor (count = 0; count < trace->nb_trace_mem_list; count++) {\n-\t\tmem = trace->lcore_meta[count].mem;\n-\t\tif (trace->lcore_meta[count].area == TRACE_AREA_HUGEPAGE)\n-\t\t\teal_free_no_trace(mem);\n-\t\telse if (trace->lcore_meta[count].area == TRACE_AREA_HEAP)\n-\t\t\tfree(mem);\n+\t\ttrace_mem_per_thread_free_unlocked(&trace->lcore_meta[count]);\n \t}\n+\ttrace->nb_trace_mem_list = 0;\n \trte_spinlock_unlock(&trace->lock);\n }\n \ndiff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h\nindex 5d8b53882d..a77ac7a963 100644\n--- a/lib/librte_eal/common/eal_private.h\n+++ b/lib/librte_eal/common/eal_private.h\n@@ -709,4 +709,9 @@ eal_get_application_usage_hook(void);\n  */\n void __rte_thread_init(unsigned int lcore_id, rte_cpuset_t *cpuset);\n \n+/**\n+ * Uninitialize per-lcore info for current thread.\n+ */\n+void __rte_thread_uninit(void);\n+\n #endif /* _EAL_PRIVATE_H_ */\ndiff --git a/lib/librte_eal/common/eal_trace.h b/lib/librte_eal/common/eal_trace.h\nindex 8f60616156..92c5951c3a 100644\n--- a/lib/librte_eal/common/eal_trace.h\n+++ b/lib/librte_eal/common/eal_trace.h\n@@ -106,6 +106,7 @@ int trace_metadata_create(void);\n void trace_metadata_destroy(void);\n int trace_mkdir(void);\n int trace_epoch_time_save(void);\n+void trace_mem_free(void);\n void trace_mem_per_thread_free(void);\n \n /* EAL interface */\ndiff --git a/lib/librte_eal/windows/eal.c b/lib/librte_eal/windows/eal.c\nindex 9f5d019e64..addac62ae5 100644\n--- a/lib/librte_eal/windows/eal.c\n+++ b/lib/librte_eal/windows/eal.c\n@@ -17,10 +17,10 @@\n #include <eal_filesystem.h>\n #include <eal_options.h>\n #include <eal_private.h>\n-#include <rte_trace_point.h>\n #include <rte_vfio.h>\n \n #include \"eal_hugepages.h\"\n+#include \"eal_trace.h\"\n #include \"eal_windows.h\"\n \n #define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL)\n@@ -215,6 +215,11 @@ __rte_trace_mem_per_thread_alloc(void)\n {\n }\n \n+void\n+trace_mem_per_thread_free(void)\n+{\n+}\n+\n void\n __rte_trace_point_emit_field(size_t sz, const char *field,\n \tconst char *type)\n",
    "prefixes": [
        "v6",
        "04/10"
    ]
}