lib/event: remove get/enable/disable turbo API from governor
In rte_power all that enabling/disabling turbo does is allows for additional entry in frequency array for particular core. Instead of exposing this API through spdk governor, just make sure that dpdk_governor enables turbo by default. Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: I994b326a57c01889bccea26635753c56637259d2 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8789 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
12fcf7e1d5
commit
8e649e83b2
@ -164,7 +164,6 @@ int spdk_reactor_set_interrupt_mode(uint32_t lcore, bool new_in_interrupt,
|
||||
struct spdk_thread *_spdk_get_app_thread(void);
|
||||
|
||||
struct spdk_governor_capabilities {
|
||||
bool turbo_available;
|
||||
bool priority;
|
||||
};
|
||||
|
||||
@ -180,17 +179,6 @@ struct spdk_governor {
|
||||
int (*set_core_freq_max)(uint32_t lcore_id);
|
||||
int (*set_core_freq_min)(uint32_t lcore_id);
|
||||
|
||||
/**
|
||||
* return
|
||||
* - 1 Turbo Boost is enabled for this lcore.
|
||||
* - 0 Turbo Boost is disabled for this lcore.
|
||||
* - Negative on error.
|
||||
*/
|
||||
int (*get_core_turbo_status)(uint32_t lcore_id);
|
||||
|
||||
/* return - 0 on success; negative on error */
|
||||
int (*enable_core_turbo)(uint32_t lcore_id);
|
||||
int (*disable_core_turbo)(uint32_t lcore_id);
|
||||
int (*get_core_capabilities)(uint32_t lcore_id, struct spdk_governor_capabilities *capabilities);
|
||||
int (*init_core)(uint32_t lcore_id);
|
||||
int (*deinit_core)(uint32_t lcore_id);
|
||||
|
@ -87,24 +87,6 @@ _set_core_freq_min(uint32_t lcore_id)
|
||||
return rte_power_freq_min(lcore_id);
|
||||
}
|
||||
|
||||
static int
|
||||
_get_core_turbo_status(uint32_t lcore_id)
|
||||
{
|
||||
return rte_power_turbo_status(lcore_id);
|
||||
}
|
||||
|
||||
static int
|
||||
_enable_core_turbo(uint32_t lcore_id)
|
||||
{
|
||||
return rte_power_freq_enable_turbo(lcore_id);
|
||||
}
|
||||
|
||||
static int
|
||||
_disable_core_turbo(uint32_t lcore_id)
|
||||
{
|
||||
return rte_power_freq_disable_turbo(lcore_id);
|
||||
}
|
||||
|
||||
static int
|
||||
_get_core_capabilities(uint32_t lcore_id, struct spdk_governor_capabilities *capabilities)
|
||||
{
|
||||
@ -116,7 +98,6 @@ _get_core_capabilities(uint32_t lcore_id, struct spdk_governor_capabilities *cap
|
||||
return rc;
|
||||
}
|
||||
|
||||
capabilities->turbo_available = caps.turbo == 0 ? false : true;
|
||||
capabilities->priority = caps.priority == 0 ? false : true;
|
||||
|
||||
return 0;
|
||||
@ -125,11 +106,27 @@ _get_core_capabilities(uint32_t lcore_id, struct spdk_governor_capabilities *cap
|
||||
static int
|
||||
_init_core(uint32_t lcore_id)
|
||||
{
|
||||
struct rte_power_core_capabilities caps;
|
||||
int rc;
|
||||
|
||||
rc = rte_power_init(lcore_id);
|
||||
if (rc) {
|
||||
SPDK_ERRLOG("DPDK Power management library initialization failed on core%d\n", lcore_id);
|
||||
if (rc != 0) {
|
||||
SPDK_ERRLOG("Failed to initialize on core%d\n", lcore_id);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = rte_power_get_capabilities(lcore_id, &caps);
|
||||
if (rc != 0) {
|
||||
SPDK_ERRLOG("Failed retrievie capabilities of core%d\n", lcore_id);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (caps.turbo) {
|
||||
rc = rte_power_freq_enable_turbo(lcore_id);
|
||||
if (rc != 0) {
|
||||
SPDK_ERRLOG("Failed to set turbo on core%d\n", lcore_id);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
@ -155,9 +152,6 @@ static struct spdk_governor dpdk_governor = {
|
||||
.core_freq_down = _core_freq_down,
|
||||
.set_core_freq_max = _set_core_freq_max,
|
||||
.set_core_freq_min = _set_core_freq_min,
|
||||
.get_core_turbo_status = _get_core_turbo_status,
|
||||
.enable_core_turbo = _enable_core_turbo,
|
||||
.disable_core_turbo = _disable_core_turbo,
|
||||
.get_core_capabilities = _get_core_capabilities,
|
||||
.init_core = _init_core,
|
||||
.deinit_core = _deinit_core,
|
||||
|
@ -75,7 +75,6 @@ balance(struct spdk_scheduler_core_info *cores, int core_count, struct spdk_gove
|
||||
struct spdk_governor_capabilities capabilities;
|
||||
uint32_t i;
|
||||
int rc;
|
||||
bool turbo_available = false;
|
||||
|
||||
/* Gather active/idle statistics */
|
||||
SPDK_ENV_FOREACH_CORE(i) {
|
||||
@ -87,21 +86,12 @@ balance(struct spdk_scheduler_core_info *cores, int core_count, struct spdk_gove
|
||||
return;
|
||||
}
|
||||
|
||||
turbo_available = (capabilities.turbo_available) ? true : false;
|
||||
|
||||
if (core->total_busy_tsc < (core->total_idle_tsc / 1000)) {
|
||||
rc = governor->set_core_freq_min(core->lcore);
|
||||
if (rc < 0) {
|
||||
SPDK_ERRLOG("setting to minimal frequency for core %u failed\n", core->lcore);
|
||||
}
|
||||
|
||||
if (turbo_available) {
|
||||
rc = governor->disable_core_turbo(core->lcore);
|
||||
if (rc < 0) {
|
||||
SPDK_ERRLOG("setting to minimal frequency for core %u failed\n", core->lcore);
|
||||
}
|
||||
}
|
||||
|
||||
SPDK_DEBUGLOG(reactor, "setting to minimal frequency for core: %u\n", core->lcore);
|
||||
} else if (core->total_idle_tsc > core->total_busy_tsc) {
|
||||
rc = governor->core_freq_down(core->lcore);
|
||||
@ -109,13 +99,6 @@ balance(struct spdk_scheduler_core_info *cores, int core_count, struct spdk_gove
|
||||
SPDK_ERRLOG("lowering frequency for core %u failed\n", core->lcore);
|
||||
}
|
||||
|
||||
if (turbo_available) {
|
||||
rc = governor->disable_core_turbo(core->lcore);
|
||||
if (rc < 0) {
|
||||
SPDK_ERRLOG("disabling turbo for core %u failed\n", core->lcore);
|
||||
}
|
||||
}
|
||||
|
||||
SPDK_DEBUGLOG(reactor, "lowering frequency for core: %u\n", core->lcore);
|
||||
} else if (core->total_idle_tsc < (core->total_busy_tsc / 1000)) {
|
||||
rc = governor->set_core_freq_max(core->lcore);
|
||||
@ -123,13 +106,6 @@ balance(struct spdk_scheduler_core_info *cores, int core_count, struct spdk_gove
|
||||
SPDK_ERRLOG("setting to maximal frequency for core %u failed\n", core->lcore);
|
||||
}
|
||||
|
||||
if (turbo_available) {
|
||||
rc = governor->enable_core_turbo(core->lcore);
|
||||
if (rc < 0) {
|
||||
SPDK_ERRLOG("enabling turbo for core %u failed\n", core->lcore);
|
||||
}
|
||||
}
|
||||
|
||||
SPDK_DEBUGLOG(reactor, "setting to maximum frequency for core: %u\n", core->lcore);
|
||||
} else {
|
||||
rc = governor->core_freq_up(core->lcore);
|
||||
@ -137,13 +113,6 @@ balance(struct spdk_scheduler_core_info *cores, int core_count, struct spdk_gove
|
||||
SPDK_ERRLOG("increasing frequency for core %u failed\n", core->lcore);
|
||||
}
|
||||
|
||||
if (turbo_available) {
|
||||
rc = governor->disable_core_turbo(core->lcore);
|
||||
if (rc < 0) {
|
||||
SPDK_ERRLOG("disabling turbo for core %u failed\n", core->lcore);
|
||||
}
|
||||
}
|
||||
|
||||
SPDK_DEBUGLOG(reactor, "increasing frequency for core: %u\n", core->lcore);
|
||||
}
|
||||
}
|
||||
|
@ -1476,7 +1476,6 @@ static int
|
||||
_governor_get_capabilities(uint32_t lcore_id, struct spdk_governor_capabilities *capabilities)
|
||||
{
|
||||
capabilities->priority = false;
|
||||
capabilities->turbo_available = false;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -769,9 +769,6 @@ static struct spdk_governor governor = {
|
||||
.core_freq_down = core_freq_down,
|
||||
.set_core_freq_max = core_freq_max,
|
||||
.set_core_freq_min = NULL,
|
||||
.get_core_turbo_status = NULL,
|
||||
.enable_core_turbo = NULL,
|
||||
.disable_core_turbo = NULL,
|
||||
.get_core_capabilities = NULL,
|
||||
.init_core = NULL,
|
||||
.deinit_core = NULL,
|
||||
|
Loading…
Reference in New Issue
Block a user