From a9a2c09579b857c12087dd9265eda1ea232bebeb Mon Sep 17 00:00:00 2001 From: Krzysztof Karas Date: Fri, 28 May 2021 14:39:55 +0200 Subject: [PATCH] spdk_top: change type of core_num in rpc_thread_info Change type of core_num to be int instead of uin32_t to allow assignment of -1 value for the "hanging" threads that are not assigned to any core. Signed-off-by: Krzysztof Karas Change-Id: I708f9547ee4fa2cf49f6c38750e12380d76b1160 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8154 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Konrad Sztyber Reviewed-by: Maciej Szwed Reviewed-by: Jim Harris --- app/spdk_top/spdk_top.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/spdk_top/spdk_top.c b/app/spdk_top/spdk_top.c index c41b073fc..6b791d899 100644 --- a/app/spdk_top/spdk_top.c +++ b/app/spdk_top/spdk_top.c @@ -189,7 +189,7 @@ static struct col_desc g_col_desc[NUMBER_OF_TABS][TABS_COL_COUNT] = { struct rpc_thread_info { char *name; uint64_t id; - uint32_t core_num; + int core_num; char *cpumask; uint64_t busy; uint64_t last_busy; @@ -1389,7 +1389,7 @@ refresh_cores_tab(uint8_t current_page) { struct col_desc *col_desc = g_col_desc[CORES_TAB]; uint64_t i; - uint32_t core_num; + int core_num; uint16_t offset, count = 0; uint8_t max_pages, item_index; static uint8_t last_page = 0; @@ -1402,6 +1402,10 @@ refresh_cores_tab(uint8_t current_page) for (i = 0; i < g_threads_stats.threads.threads_count; i++) { core_num = g_threads_stats.threads.thread_info[i].core_num; + /* If the thread is hanging, do not count it. */ + if (core_num == -1) { + continue; + } cores[core_num].threads_count++; cores[core_num].pollers_count += g_threads_stats.threads.thread_info[i].active_pollers_count + g_threads_stats.threads.thread_info[i].timed_pollers_count +