From d89e62e7efd7eae6fa91e5ed9587c412e3afd440 Mon Sep 17 00:00:00 2001 From: YafeiWangAlice Date: Thu, 7 Jul 2022 15:51:51 +0800 Subject: [PATCH] spdk_top: In CORES tab, spdk_top can't collect the right poller count under certain conditions. spdk_top can't collect the right poller count when thread count is more than core count. Max index of g_threads_info[] should be thread count NOT cores count. Signed-off-by: YafeiWangAlice Change-Id: Iff95fb1aa7f84626a559741ad135a2cbeed04f90 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13574 Community-CI: Mellanox Build Bot Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Paul Luse Reviewed-by: Krzysztof Karas Reviewed-by: Tomasz Zawadzki --- app/spdk_top/spdk_top.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/spdk_top/spdk_top.c b/app/spdk_top/spdk_top.c index c46a52aa6..514a141df 100644 --- a/app/spdk_top/spdk_top.c +++ b/app/spdk_top/spdk_top.c @@ -1027,14 +1027,6 @@ get_cores_data(void) cores_info[i].last_busy = g_cores_info[j].busy; cores_info[i].last_idle = g_cores_info[j].idle; } - /* Do not consider threads which changed cores when issuing - * RPCs to get_core_data and get_thread_data and threads - * not currently assigned to this core. */ - if ((int)cores_info[i].lcore == g_threads_info[j].core_num) { - cores_info[i].pollers_count += g_threads_info[j].active_pollers_count + - g_threads_info[j].timed_pollers_count + - g_threads_info[j].paused_pollers_count; - } } } @@ -1053,6 +1045,12 @@ get_cores_data(void) for (k = 0; k < g_last_threads_count; k++) { if (core_info->threads.thread[j].id == g_threads_info[k].id) { g_threads_info[k].core_num = core_info->lcore; + /* Do not consider threads which changed cores when issuing + * RPCs to get_core_data and get_thread_data and threads + * not currently assigned to this core. */ + core_info->pollers_count += g_threads_info[k].active_pollers_count + + g_threads_info[k].timed_pollers_count + + g_threads_info[k].paused_pollers_count; } } }