get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 139017,
    "url": "http://patchwork.dpdk.org/api/patches/139017/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20240401203647.1909165-3-rjarry@redhat.com/",
    "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": "<20240401203647.1909165-3-rjarry@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240401203647.1909165-3-rjarry@redhat.com",
    "date": "2024-04-01T20:36:49",
    "name": "[v2] graph: avoid accessing graph list when getting stats",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "bedd91777fbf08d510b3dc28d22581dfc730c86a",
    "submitter": {
        "id": 2850,
        "url": "http://patchwork.dpdk.org/api/people/2850/?format=api",
        "name": "Robin Jarry",
        "email": "rjarry@redhat.com"
    },
    "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/20240401203647.1909165-3-rjarry@redhat.com/mbox/",
    "series": [
        {
            "id": 31654,
            "url": "http://patchwork.dpdk.org/api/series/31654/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=31654",
            "date": "2024-04-01T20:36:49",
            "name": "[v2] graph: avoid accessing graph list when getting stats",
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/31654/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/139017/comments/",
    "check": "warning",
    "checks": "http://patchwork.dpdk.org/api/patches/139017/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 4072A43DAC;\n\tMon,  1 Apr 2024 22:37:34 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id C0C76402A3;\n\tMon,  1 Apr 2024 22:37:33 +0200 (CEST)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by mails.dpdk.org (Postfix) with ESMTP id 8411B4029F\n for <dev@dpdk.org>; Mon,  1 Apr 2024 22:37:31 +0200 (CEST)",
            "from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com\n [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-141-XCti7M1jMh6a1u1sEFY5AQ-1; Mon, 01 Apr 2024 16:37:28 -0400",
            "from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com\n [10.11.54.6])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ED9A18007A6;\n Mon,  1 Apr 2024 20:37:27 +0000 (UTC)",
            "from localhost.localdomain (unknown [10.39.208.8])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 962F62166B31;\n Mon,  1 Apr 2024 20:37:26 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1712003850;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to: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=hfP/j6l5vwI7HMdoLnDlMrD4y3oU601C66vfFNLNYSI=;\n b=YytlYhfx5Oa9q94EkdcuqPKkKI+XzRatOhEfpe2S1WoWwdbIe4hViZm5hRasJdzhDpt+nC\n J3YNRKvTcx+MBoJ0CnyiVsFkg1ZESTaZTeHGmJ59N2TW44K+/Bvd1g67nfZVKMF0Es6sp5\n kWBXIOcfEQkxLpAA3Xuw5q1bKE8DAdE=",
        "X-MC-Unique": "XCti7M1jMh6a1u1sEFY5AQ-1",
        "From": "Robin Jarry <rjarry@redhat.com>",
        "To": "dev@dpdk.org, Jerin Jacob <jerinj@marvell.com>,\n Kiran Kumar K <kirankumark@marvell.com>,\n Nithin Dabilpuram <ndabilpuram@marvell.com>,\n Zhirun Yan <yanzhirun_163@163.com>",
        "Subject": "[PATCH v2] graph: avoid accessing graph list when getting stats",
        "Date": "Mon,  1 Apr 2024 22:36:49 +0200",
        "Message-ID": "<20240401203647.1909165-3-rjarry@redhat.com>",
        "In-Reply-To": "<20240325155303.770468-2-rjarry@redhat.com>",
        "References": "<20240325155303.770468-2-rjarry@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.11.54.6",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"US-ASCII\"; x-default=true",
        "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": "In rte_graph_cluster_stats_get, the walk model of the first graph is\nchecked to determine if multi-core dispatch specific counters should be\nupdated or not. This global list is accessed without any locks.\n\nIf the global list is modified by another thread while\nrte_graph_cluster_stats_get is called, it can result in undefined\nbehaviour.\n\nAdding a lock would make it impossible to call\nrte_graph_cluster_stats_get in packet processing code paths. Avoid\naccessing the global list instead by storing a bool field in the private\nrte_graph_cluster_stats structure.\n\nAlso update the default callback to avoid accessing the global list and\nuse a different default callback depending on the graph model.\n\nSigned-off-by: Robin Jarry <rjarry@redhat.com>\n---\n\nNotes:\n    v2:\n    \n    * (kiran) removed unnecessary loop in stats_mem_init.\n\n lib/graph/graph_stats.c | 57 ++++++++++++++++++++++++++---------------\n 1 file changed, 36 insertions(+), 21 deletions(-)",
    "diff": "diff --git a/lib/graph/graph_stats.c b/lib/graph/graph_stats.c\nindex 2fb808b21ec5..d71451a17b95 100644\n--- a/lib/graph/graph_stats.c\n+++ b/lib/graph/graph_stats.c\n@@ -34,6 +34,7 @@ struct __rte_cache_aligned rte_graph_cluster_stats {\n \tuint32_t cluster_node_size; /* Size of struct cluster_node */\n \trte_node_t max_nodes;\n \tint socket_id;\n+\tbool dispatch;\n \tvoid *cookie;\n \tsize_t sz;\n \n@@ -74,17 +75,16 @@ print_banner_dispatch(FILE *f)\n }\n \n static inline void\n-print_banner(FILE *f)\n+print_banner(FILE *f, bool dispatch)\n {\n-\tif (rte_graph_worker_model_get(STAILQ_FIRST(graph_list_head_get())->graph) ==\n-\t    RTE_GRAPH_MODEL_MCORE_DISPATCH)\n+\tif (dispatch)\n \t\tprint_banner_dispatch(f);\n \telse\n \t\tprint_banner_default(f);\n }\n \n static inline void\n-print_node(FILE *f, const struct rte_graph_cluster_node_stats *stat)\n+print_node(FILE *f, const struct rte_graph_cluster_node_stats *stat, bool dispatch)\n {\n \tdouble objs_per_call, objs_per_sec, cycles_per_call, ts_per_hz;\n \tconst uint64_t prev_calls = stat->prev_calls;\n@@ -104,8 +104,7 @@ print_node(FILE *f, const struct rte_graph_cluster_node_stats *stat)\n \tobjs_per_sec = ts_per_hz ? (objs - prev_objs) / ts_per_hz : 0;\n \tobjs_per_sec /= 1000000;\n \n-\tif (rte_graph_worker_model_get(STAILQ_FIRST(graph_list_head_get())->graph) ==\n-\t    RTE_GRAPH_MODEL_MCORE_DISPATCH) {\n+\tif (dispatch) {\n \t\tfprintf(f,\n \t\t\t\"|%-31s|%-15\" PRIu64 \"|%-15\" PRIu64 \"|%-15\" PRIu64\n \t\t\t\"|%-15\" PRIu64 \"|%-15\" PRIu64\n@@ -123,20 +122,17 @@ print_node(FILE *f, const struct rte_graph_cluster_node_stats *stat)\n }\n \n static int\n-graph_cluster_stats_cb(bool is_first, bool is_last, void *cookie,\n+graph_cluster_stats_cb(bool dispatch, bool is_first, bool is_last, void *cookie,\n \t\t       const struct rte_graph_cluster_node_stats *stat)\n {\n \tFILE *f = cookie;\n-\tint model;\n-\n-\tmodel = rte_graph_worker_model_get(STAILQ_FIRST(graph_list_head_get())->graph);\n \n \tif (unlikely(is_first))\n-\t\tprint_banner(f);\n+\t\tprint_banner(f, dispatch);\n \tif (stat->objs)\n-\t\tprint_node(f, stat);\n+\t\tprint_node(f, stat, dispatch);\n \tif (unlikely(is_last)) {\n-\t\tif (model == RTE_GRAPH_MODEL_MCORE_DISPATCH)\n+\t\tif (dispatch)\n \t\t\tboarder_model_dispatch();\n \t\telse\n \t\t\tboarder();\n@@ -145,6 +141,20 @@ graph_cluster_stats_cb(bool is_first, bool is_last, void *cookie,\n \treturn 0;\n };\n \n+static int\n+graph_cluster_stats_cb_rtc(bool is_first, bool is_last, void *cookie,\n+\t\t\t   const struct rte_graph_cluster_node_stats *stat)\n+{\n+\treturn graph_cluster_stats_cb(false, is_first, is_last, cookie, stat);\n+};\n+\n+static int\n+graph_cluster_stats_cb_dispatch(bool is_first, bool is_last, void *cookie,\n+\t\t\t\tconst struct rte_graph_cluster_node_stats *stat)\n+{\n+\treturn graph_cluster_stats_cb(true, is_first, is_last, cookie, stat);\n+};\n+\n static struct rte_graph_cluster_stats *\n stats_mem_init(struct cluster *cluster,\n \t       const struct rte_graph_cluster_stats_param *prm)\n@@ -157,8 +167,13 @@ stats_mem_init(struct cluster *cluster,\n \n \t/* Fix up callback */\n \tfn = prm->fn;\n-\tif (fn == NULL)\n-\t\tfn = graph_cluster_stats_cb;\n+\tif (fn == NULL) {\n+\t\tconst struct rte_graph *graph = cluster->graphs[0]->graph;\n+\t\tif (graph->model == RTE_GRAPH_MODEL_MCORE_DISPATCH)\n+\t\t\tfn = graph_cluster_stats_cb_dispatch;\n+\t\telse\n+\t\t\tfn = graph_cluster_stats_cb_rtc;\n+\t}\n \n \tcluster_node_size = sizeof(struct cluster_node);\n \t/* For a given cluster, max nodes will be the max number of graphs */\n@@ -350,6 +365,8 @@ rte_graph_cluster_stats_create(const struct rte_graph_cluster_stats_param *prm)\n \t\t\tif (stats_mem_populate(&stats, graph_fp, graph_node))\n \t\t\t\tgoto realloc_fail;\n \t\t}\n+\t\tif (graph->graph->model == RTE_GRAPH_MODEL_MCORE_DISPATCH)\n+\t\t\tstats->dispatch = true;\n \t}\n \n \t/* Finally copy to hugepage memory to avoid pressure on rte_realloc */\n@@ -375,20 +392,18 @@ rte_graph_cluster_stats_destroy(struct rte_graph_cluster_stats *stat)\n }\n \n static inline void\n-cluster_node_arregate_stats(struct cluster_node *cluster)\n+cluster_node_arregate_stats(struct cluster_node *cluster, bool dispatch)\n {\n \tuint64_t calls = 0, cycles = 0, objs = 0, realloc_count = 0;\n \tstruct rte_graph_cluster_node_stats *stat = &cluster->stat;\n \tuint64_t sched_objs = 0, sched_fail = 0;\n \tstruct rte_node *node;\n \trte_node_t count;\n-\tint model;\n \n-\tmodel = rte_graph_worker_model_get(STAILQ_FIRST(graph_list_head_get())->graph);\n \tfor (count = 0; count < cluster->nb_nodes; count++) {\n \t\tnode = cluster->nodes[count];\n \n-\t\tif (model == RTE_GRAPH_MODEL_MCORE_DISPATCH) {\n+\t\tif (dispatch) {\n \t\t\tsched_objs += node->dispatch.total_sched_objs;\n \t\t\tsched_fail += node->dispatch.total_sched_fail;\n \t\t}\n@@ -403,7 +418,7 @@ cluster_node_arregate_stats(struct cluster_node *cluster)\n \tstat->objs = objs;\n \tstat->cycles = cycles;\n \n-\tif (model == RTE_GRAPH_MODEL_MCORE_DISPATCH) {\n+\tif (dispatch) {\n \t\tstat->dispatch.sched_objs = sched_objs;\n \t\tstat->dispatch.sched_fail = sched_fail;\n \t}\n@@ -433,7 +448,7 @@ rte_graph_cluster_stats_get(struct rte_graph_cluster_stats *stat, bool skip_cb)\n \tcluster = stat->clusters;\n \n \tfor (count = 0; count < stat->max_nodes; count++) {\n-\t\tcluster_node_arregate_stats(cluster);\n+\t\tcluster_node_arregate_stats(cluster, stat->dispatch);\n \t\tif (!skip_cb)\n \t\t\trc = stat->fn(!count, (count == stat->max_nodes - 1),\n \t\t\t\t      stat->cookie, &cluster->stat);\n",
    "prefixes": [
        "v2"
    ]
}