Commit 56142e27 authored by Anisa Su's avatar Anisa Su Committed by Konrad Sztyber
Browse files

lib/event: setup tracing before creating app_thread



If app_thread is created before tracing is set up,
the THREAD_STATS scheduler tracepoint has an issue with
reading the app_thread's name (it appears blank).

Change-Id: Ia1c3c8e4aa6ed73243f535e420b6d12a25aa6744
Signed-off-by: default avatarAnisa Su <anisa.su@samsung.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/24999


Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
parent e0966436
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -923,19 +923,6 @@ spdk_app_start(struct spdk_app_opts *opts_user, spdk_msg_fn start_fn,

	spdk_cpuset_set_cpu(&tmp_cpumask, spdk_env_get_current_core(), true);

	/* Now that the reactors have been initialized, we can create the app thread. */
	spdk_thread_create("app_thread", &tmp_cpumask);
	if (!spdk_thread_get_app_thread()) {
		SPDK_ERRLOG("Unable to create an spdk_thread for initialization\n");
		return 1;
	}

	SPDK_ENV_FOREACH_CORE(core) {
		rc = init_proc_stat(core);
		if (rc) {
			SPDK_NOTICELOG("Unable to parse /proc/stat [core: %d].\n", core);
		}
	}
	/*
	 * Disable and ignore trace setup if setting num_entries
	 * to be 0.
@@ -950,6 +937,20 @@ spdk_app_start(struct spdk_app_opts *opts_user, spdk_msg_fn start_fn,
		return 1;
	}

	/* Now that the reactors have been initialized, we can create the app thread. */
	spdk_thread_create("app_thread", &tmp_cpumask);
	if (!spdk_thread_get_app_thread()) {
		SPDK_ERRLOG("Unable to create an spdk_thread for initialization\n");
		return 1;
	}

	SPDK_ENV_FOREACH_CORE(core) {
		rc = init_proc_stat(core);
		if (rc) {
			SPDK_NOTICELOG("Unable to parse /proc/stat [core: %d].\n", core);
		}
	}

	if (!opts->disable_signal_handlers && app_setup_signal_handlers(opts) != 0) {
		return 1;
	}