From: Chanwoo Choi Date: Mon, 19 Jun 2017 05:13:35 +0000 (+0900) Subject: pmqos: Add 'scenario_max_timeout_ms' property to set the maximum timeout X-Git-Tag: submit/tizen/20170629.044637~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b0174670bbdcc82245501d1ccf349d1c73cea9f;p=platform%2Fcore%2Fsystem%2Fpass.git pmqos: Add 'scenario_max_timeout_ms' property to set the maximum timeout Each scenario wants to lock the h/w resources within their own timeout. If the specific scenario wants to lock the h/w resources for so long time, it is not reasonable. So, PMQoS core has the maximum timeout in order to protect the excessive occupation of h/w resources. This patch adds the new 'scenario_max_timeout_ms' property which means the maximum timeout for the scenarios on specific h/w board. The owner of PASS daemon can adjust the maximum timeout according to the h/w board. Change-Id: Ic38137f667c34230b90e9217d33549d5859fd5fa Signed-off-by: Chanwoo Choi --- diff --git a/src/pmqos/pass-pmqos.conf b/src/pmqos/pass-pmqos.conf index b55f023..4c4a8bd 100644 --- a/src/pmqos/pass-pmqos.conf +++ b/src/pmqos/pass-pmqos.conf @@ -1,6 +1,7 @@ [PassScenario] # set to "yes" scenario_support (Default value is no) # set scenario_num to be tested +# set scenario_max_timeout_ms (unit:millisecond, default timeout is 3000ms) scenario_support=yes scenario_num=52 diff --git a/src/pmqos/pmqos-parser.c b/src/pmqos/pmqos-parser.c index 6f5a13b..daff810 100644 --- a/src/pmqos/pmqos-parser.c +++ b/src/pmqos/pmqos-parser.c @@ -67,6 +67,14 @@ static int pmqos_parse_scenario(struct parse_result *result, void *user_data, un return -errno; } } + } else if (MATCH(result->name, "scenario_max_timeout_ms")) { + int max_timeout_ms = atoi(result->value); + + if (max_timeout_ms < 0) { + _E("failed to get maximum timeout of scenario"); + return -ERANGE; + } + scenarios->max_timeout_ms = max_timeout_ms; } } @@ -140,6 +148,7 @@ int pmqos_put_scenario(struct pmqos_scenario *scenarios) if (scenarios->num > 0 && !scenarios->list) { scenarios->num = 0; + scenarios->max_timeout_ms = 0; free(scenarios->list); } @@ -150,6 +159,10 @@ int pmqos_get_scenario(const char *path, struct pmqos_scenario *scenarios) { int ret; + /* Initialize the variables before parsing the pass-pmqos.conf */ + scenarios->num = 0; + scenarios->max_timeout_ms = 0; + /* get configuration file */ ret = config_parse(path, pmqos_load_config, scenarios); if (ret < 0) { diff --git a/src/pmqos/pmqos.c b/src/pmqos/pmqos.c index 1869c00..9cf9f6d 100644 --- a/src/pmqos/pmqos.c +++ b/src/pmqos/pmqos.c @@ -47,6 +47,7 @@ struct pmqos_cpu { static dd_list *pmqos_head; static Ecore_Timer *unlock_timer; +static int unlock_max_timeout_ms; static struct timespec unlock_timer_start_st; static struct timespec unlock_timer_end_st; static struct pmqos_cpu unlock_timer_owner = {"", 0}; @@ -229,9 +230,10 @@ static int pmqos_request(const char *name, int val) int ret; /* Check valid parameter */ - if (val > DEFAULT_PMQOS_TIMER) { - _I("The timer value cannot be higher than default time value(%dms)", DEFAULT_PMQOS_TIMER); - val = DEFAULT_PMQOS_TIMER; + if (val > unlock_max_timeout_ms) { + _I("Timeout cannot be higher than maximum timeout (%d ms)", + unlock_max_timeout_ms); + val = unlock_max_timeout_ms; } /* find cpu */ DD_LIST_FOREACH(pmqos_head, elem, cpu) { @@ -347,6 +349,16 @@ static int get_methods_from_conf(const char *path, struct edbus_method **edbus_m _D("support [%s] scenario", scenarios.list[i].name); } + /* + * Set maximum timeout for the sceanrio by using the parsed data from + * pass-pmqos.conf. But, if there is no setting from pass-pmqos.conf + * pmqos uses the default timeout value (3000 millisecond). + */ + if (scenarios.max_timeout_ms) + unlock_max_timeout_ms = scenarios.max_timeout_ms; + else + unlock_max_timeout_ms = DEFAULT_PMQOS_TIMER; + *edbus_methods = methods; ret = count; pmqos_put_scenario(&scenarios); diff --git a/src/pmqos/pmqos.h b/src/pmqos/pmqos.h index 8a4d381..2337cb7 100644 --- a/src/pmqos/pmqos.h +++ b/src/pmqos/pmqos.h @@ -29,6 +29,7 @@ struct pmqos_scenario { bool support; } *list; int num; + int max_timeout_ms; bool support; };