Commit 8a610145 authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

dpdk_governor: don't load if app core mask has subset of SMT siblings



SPDK schedulers and governors don't understand SMT yet, but let's at
least disable the case where the app core mask contains one SMT core
but not its sibling. Upcoming patches will teach schedulers about
SMT to make better decisions, but we can never really make
governor changes if SPDK only is managing one core out of a set of
siblings.

Signed-off-by: default avatarJim Harris <jim.harris@samsung.com>
Change-Id: Ie2a7403e2b5a7c3ab47023f01c2edec5de020ab6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/23528


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent 3daf1f00
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ DEPDIRS-sock_uring := log sock util thread trace
# module/scheduler
DEPDIRS-scheduler_dynamic := event log thread util json
ifeq (y,$(DPDK_POWER))
DEPDIRS-scheduler_dpdk_governor := event json log
DEPDIRS-scheduler_dpdk_governor := event json log util
DEPDIRS-scheduler_gscheduler := event log
endif

+20 −0
Original line number Diff line number Diff line
@@ -151,9 +151,29 @@ _init_core(uint32_t lcore_id)
static int
_init(void)
{
	struct spdk_cpuset smt_mask, app_mask;
	uint32_t i, j;
	int rc = 0;

	if (!spdk_env_core_get_smt_cpuset(&smt_mask, UINT32_MAX)) {
		/* We could not get SMT status on this system, don't allow
		 * the governor to load since we cannot guarantee we are running
		 * on a subset of some SMT siblings.
		 */
		SPDK_ERRLOG("Cannot detect SMT status\n");
		return -1;
	}

	/* Verify that if our app mask includes any SMT siblings, that it has
	 * all of those siblings. Otherwise the governor cannot work.
	 */
	spdk_env_get_cpuset(&app_mask);
	spdk_cpuset_and(&app_mask, &smt_mask);
	if (!spdk_cpuset_equal(&app_mask, &smt_mask)) {
		SPDK_ERRLOG("App core mask contains some but not all of a set of SMT siblings\n");
		return -1;
	}

#if RTE_VERSION >= RTE_VERSION_NUM(23, 11, 0, 0)
	for (i = PM_ENV_ACPI_CPUFREQ; i <= PM_ENV_AMD_PSTATE_CPUFREQ; i++) {
#else