From patchwork Thu Feb 22 05:36:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Nikhilesh Bhagavatula X-Patchwork-Id: 136990 X-Patchwork-Delegate: thomas@monjalon.net 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 59BEB43B68; Thu, 22 Feb 2024 06:37:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 00BA240608; Thu, 22 Feb 2024 06:37:25 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 33CCC402DA for ; Thu, 22 Feb 2024 06:37:23 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41LNpFnK007495; Wed, 21 Feb 2024 21:37:22 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= pfpt0220; bh=zu2uSK0CYXPOFPrEI1rDf/WUnhTzA/sQOnXb8xkqw3g=; b=BG7 5qcV+EiLrxAV30NTHcRGbTBrZcCMrrehWmEvmCZmXEmCYrk3KbE/tlHwQlr/pd/W 0EX0r1yR3cclK2F1ER/AWQAgo3CjxY6azN/pLAzPVHT408YEV14jiTP1KseqJy9m 3EOHLJTJkJYNXIWIRXy3f+BRsU5SMsee3JeaEzrMJdpRtUrqPEGt7OGs4Attwwpo qwelOCs0Jsg6aHviAwckXCSQE8oV+FTS+0oqBEGKRSv1eWD4pfeXToBYzhTNuhtb sQfno9i4LANb/PfpjGRtSPgbsX1ElofaY9Eja2BqxIPx9ZrrT3Ny8SpHJBjE8uvz Wlu36L1NSXWuFZhagQw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3wd21kf9q0-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 21 Feb 2024 21:37:22 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 21 Feb 2024 21:36:56 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 21 Feb 2024 21:36:56 -0800 Received: from MININT-80QBFE8.corp.innovium.com (MININT-80QBFE8.marvell.com [10.28.8.42]) by maili.marvell.com (Postfix) with ESMTP id A112B3F70A7; Wed, 21 Feb 2024 21:36:54 -0800 (PST) From: To: , , , CC: , Pavan Nikhilesh Subject: [24.11 PATCH v2 3/5] graph: add stats for node specific errors Date: Thu, 22 Feb 2024 11:06:37 +0530 Message-ID: <20240222053639.15057-3-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240222053639.15057-1-pbhagavatula@marvell.com> References: <20240221162608.10412-1-pbhagavatula@marvell.com> <20240222053639.15057-1-pbhagavatula@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: qJm9bYAINN69TpKfPPMB8Hiap8RP3e2v X-Proofpoint-ORIG-GUID: qJm9bYAINN69TpKfPPMB8Hiap8RP3e2v X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_03,2024-02-22_01,2023-05-22_02 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 From: Pavan Nikhilesh Add support for retrieving/printing stats for node specific errors using rte_graph_cluster_stats_get(). Signed-off-by: Pavan Nikhilesh --- lib/graph/graph_stats.c | 81 ++++++++++++++++++++++++++++++++++++++++- lib/graph/rte_graph.h | 4 ++ 2 files changed, 84 insertions(+), 1 deletion(-) diff --git a/lib/graph/graph_stats.c b/lib/graph/graph_stats.c index cc32245c05..7e026f0c68 100644 --- a/lib/graph/graph_stats.c +++ b/lib/graph/graph_stats.c @@ -122,6 +122,26 @@ print_node(FILE *f, const struct rte_graph_cluster_node_stats *stat) } } +static inline void +print_err(FILE *f, const struct rte_graph_cluster_node_stats *stat) +{ + int i; + + if (rte_graph_worker_model_get(STAILQ_FIRST(graph_list_head_get())->graph) == + RTE_GRAPH_MODEL_MCORE_DISPATCH) { + for (i = 0; i < stat->node_error_cntrs; i++) + fprintf(f, + "|\t%-24s|%15s|%-15" PRIu64 "|%15s|%15s|%15s|%15s|%15s|%11.4s|\n", + stat->node_error_desc[i], "", stat->node_error_count[i], "", "", "", + "", "", ""); + } else { + for (i = 0; i < stat->node_error_cntrs; i++) + fprintf(f, "|\t%-24s|%15s|%-15" PRIu64 "|%15s|%15.3s|%15.6s|%11.4s|\n", + stat->node_error_desc[i], "", stat->node_error_count[i], "", "", "", + ""); + } +} + static int graph_cluster_stats_cb(bool is_first, bool is_last, void *cookie, const struct rte_graph_cluster_node_stats *stat) @@ -133,8 +153,11 @@ graph_cluster_stats_cb(bool is_first, bool is_last, void *cookie, if (unlikely(is_first)) print_banner(f); - if (stat->objs) + if (stat->objs) { print_node(f, stat); + if (stat->node_error_cntrs) + print_err(f, stat); + } if (unlikely(is_last)) { if (model == RTE_GRAPH_MODEL_MCORE_DISPATCH) boarder_model_dispatch(); @@ -188,6 +211,7 @@ stats_mem_populate(struct rte_graph_cluster_stats **stats_in, struct cluster_node *cluster; struct rte_node *node; rte_node_t count; + uint8_t i; cluster = stats->clusters; @@ -225,6 +249,36 @@ stats_mem_populate(struct rte_graph_cluster_stats **stats_in, SET_ERR_JMP(ENOENT, free, "Failed to find node %s in graph %s", graph_node->node->name, graph->name); cluster->nodes[cluster->nb_nodes++] = node; + if (graph_node->node->errs) { + cluster->stat.node_error_cntrs = graph_node->node->errs->nb_errors; + cluster->stat.node_error_count = rte_zmalloc_socket( + NULL, sizeof(uint64_t) * graph_node->node->errs->nb_errors, + RTE_CACHE_LINE_SIZE, stats->socket_id); + if (cluster->stat.node_error_count == NULL) + SET_ERR_JMP(ENOMEM, free, "Failed to allocate memory node %s graph %s", + graph_node->node->name, graph->name); + + cluster->stat.node_error_desc = rte_zmalloc_socket( + NULL, sizeof(RTE_NODE_ERROR_DESC_SIZE) * graph_node->node->errs->nb_errors, + RTE_CACHE_LINE_SIZE, stats->socket_id); + if (cluster->stat.node_error_desc == NULL) { + rte_free(cluster->stat.node_error_count); + SET_ERR_JMP(ENOMEM, free, "Failed to allocate memory node %s graph %s", + graph_node->node->name, graph->name); + } + + for (i = 0; i < cluster->stat.node_error_cntrs; i++) { + if (rte_strscpy(cluster->stat.node_error_desc[i], + graph_node->node->errs->err_desc[i], + RTE_NODE_ERROR_DESC_SIZE) < 0) { + rte_free(cluster->stat.node_error_count); + rte_free(cluster->stat.node_error_desc); + SET_ERR_JMP(E2BIG, free, + "Error description overflow node %s graph %s", + graph_node->node->name, graph->name); + } + } + } stats->sz += stats->cluster_node_size; stats->max_nodes++; @@ -371,6 +425,18 @@ rte_graph_cluster_stats_create(const struct rte_graph_cluster_stats_param *prm) void rte_graph_cluster_stats_destroy(struct rte_graph_cluster_stats *stat) { + struct cluster_node *cluster; + rte_node_t count; + + cluster = stat->clusters; + for (count = 0; count < stat->max_nodes; count++) { + if (cluster->stat.node_error_cntrs) { + rte_free(cluster->stat.node_error_count); + rte_free(cluster->stat.node_error_desc); + } + + cluster = RTE_PTR_ADD(cluster, stat->cluster_node_size); + } return rte_free(stat); } @@ -382,9 +448,13 @@ cluster_node_arregate_stats(struct cluster_node *cluster) uint64_t sched_objs = 0, sched_fail = 0; struct rte_node *node; rte_node_t count; + uint64_t *err; + uint8_t i; int model; model = rte_graph_worker_model_get(STAILQ_FIRST(graph_list_head_get())->graph); + + memset(stat->node_error_count, 0, sizeof(uint64_t) * stat->node_error_cntrs); for (count = 0; count < cluster->nb_nodes; count++) { node = cluster->nodes[count]; @@ -397,6 +467,12 @@ cluster_node_arregate_stats(struct cluster_node *cluster) objs += node->total_objs; cycles += node->total_cycles; realloc_count += node->realloc_count; + + if (node->err_off == 0) + continue; + err = RTE_PTR_ADD(node, node->err_off); + for (i = 0; i < stat->node_error_cntrs; i++) + stat->node_error_count[i] += err[i]; } stat->calls = calls; @@ -449,6 +525,7 @@ rte_graph_cluster_stats_reset(struct rte_graph_cluster_stats *stat) { struct cluster_node *cluster; rte_node_t count; + uint8_t i; cluster = stat->clusters; @@ -464,6 +541,8 @@ rte_graph_cluster_stats_reset(struct rte_graph_cluster_stats *stat) node->prev_objs = 0; node->prev_cycles = 0; node->realloc_count = 0; + for (i = 0; i < node->node_error_cntrs; i++) + node->node_error_count[i] = 0; cluster = RTE_PTR_ADD(cluster, stat->cluster_node_size); } } diff --git a/lib/graph/rte_graph.h b/lib/graph/rte_graph.h index 70b68673c1..35f4c8db0c 100644 --- a/lib/graph/rte_graph.h +++ b/lib/graph/rte_graph.h @@ -223,6 +223,10 @@ struct rte_graph_cluster_node_stats { uint64_t realloc_count; /**< Realloc count. */ + uint8_t node_error_cntrs; /**< Number of Node error counters. */ + char (*node_error_desc)[RTE_NODE_ERROR_DESC_SIZE]; /**< Names of the Node error counters. */ + uint64_t *node_error_count; /**< Total error count per each error. */ + rte_node_t id; /**< Node identifier of stats. */ uint64_t hz; /**< Cycles per seconds. */ char name[RTE_NODE_NAMESIZE]; /**< Name of the node. */