Commit 7ea417e5 authored by Maciej Szwed's avatar Maciej Szwed Committed by Tomasz Zawadzki
Browse files

spdk_top: Issue crash when pollers number changes



Root cause: We hit assert because we don't find
previous poller run counter. This happens when
new poller is created but 'last_run_counter' is
not being initialized for that poller.

Solution:
Force running store_last_run_counter() (which
inits last_run_counter) inside copy_pollers() by
simulating page change by changing value of
g_last_page and calling refresh_pollers_tab() again.

Fixes issue #1436

Signed-off-by: default avatarMaciej Szwed <maciej.szwed@intel.com>
Change-Id: I983154ba1f7a46a92cba41c83691f71be8ab40b0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2847


Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
parent af0057e6
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -1083,6 +1083,8 @@ refresh_pollers_tab(uint8_t current_page)
		g_last_page = current_page;
	}

	max_pages = (count + g_max_data_rows - 1) / g_max_data_rows;

	/* Clear screen if number of pollers changed */
	if (g_last_pollers_count != count) {
		for (i = TABS_DATA_START_ROW; i < g_data_win_size; i++) {
@@ -1092,9 +1094,13 @@ refresh_pollers_tab(uint8_t current_page)
		}

		g_last_pollers_count = count;
	}

	max_pages = (count + g_max_data_rows - 1) / g_max_data_rows;
		/* We need to run store_last_run_counter() again, so the easiest way is to call this function
		 * again with changed g_last_page value */
		g_last_page = 0xF;
		refresh_pollers_tab(current_page);
		return max_pages;
	}

	/* Timed pollers can switch their possition on a list because of how they work.
	 * Let's sort them by name first so that they won't switch on data refresh */