diff options
author | Chanwoo Choi <cw00.choi@samsung.com> | 2022-09-05 02:03:22 +0900 |
---|---|---|
committer | Chanwoo Choi <cw00.choi@samsung.com> | 2022-12-13 11:41:33 +0900 |
commit | e1c72bb937a70d512f89e962ddc2a08dce444d7f (patch) | |
tree | 122ff4b452ede5a6b787cbe97a1c633dc3a80ae7 | |
parent | f823d14b83131cdb6dad145a17825d250c6f108c (diff) | |
download | pass-e1c72bb937a70d512f89e962ddc2a08dce444d7f.tar.gz pass-e1c72bb937a70d512f89e962ddc2a08dce444d7f.tar.bz2 pass-e1c72bb937a70d512f89e962ddc2a08dce444d7f.zip |
pass: rescon: Encapsulate struct pass_rescon to prevent direct access
Any modules are able to access the internal fields of struct pass_rescon
directly. It might make the problem on later and the current method
is not proper. So that move the defintion of struct pass_rescon
into src/pass/pass-rescon.c to prevent the direct access.
Instead, provide the getter/setter function for fields of struct pass_rescon.
Change-Id: I801452d0b8ae98146a74f2ebd1926f6cc4c8c47a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
-rw-r--r-- | include/util/common.h | 1 | ||||
-rw-r--r-- | src/pass/pass-cpuhp-radiation.c | 38 | ||||
-rw-r--r-- | src/pass/pass-cpuhp-step.c | 15 | ||||
-rw-r--r-- | src/pass/pass-cpuhp.c | 17 | ||||
-rw-r--r-- | src/pass/pass-parser.c | 21 | ||||
-rw-r--r-- | src/pass/pass-rescon.c | 210 | ||||
-rw-r--r-- | src/pass/pass-rescon.h | 19 | ||||
-rw-r--r-- | src/pass/pass.c | 3 | ||||
-rw-r--r-- | src/pass/pass.h | 51 | ||||
-rw-r--r-- | tests/haltest/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/integration-test/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/unittest/CMakeLists.txt | 1 |
12 files changed, 251 insertions, 127 deletions
diff --git a/include/util/common.h b/include/util/common.h index 10f465a..9f53733 100644 --- a/include/util/common.h +++ b/include/util/common.h @@ -34,6 +34,7 @@ typedef unsigned long long uint64; #define BUFF_MAX 255 #define ARRAY_SIZE(name) (sizeof(name)/sizeof(name[0])) +#define INIT_VALUE -1 /* * One byte digit has 3 position in decimal representation diff --git a/src/pass/pass-cpuhp-radiation.c b/src/pass/pass-cpuhp-radiation.c index f1af302..583ee24 100644 --- a/src/pass/pass-cpuhp-radiation.c +++ b/src/pass/pass-cpuhp-radiation.c @@ -31,6 +31,7 @@ #include <stdlib.h> #include "pass.h" +#include "pass-rescon.h" #include "pass-resmon.h" #define PASS_CPU_STATS_MAX_COUNT 20 @@ -53,7 +54,7 @@ int pass_cpuhp_radiation_governor(struct pass_resource *res, void *result) int up_threshold = cpuhp->up_threshold; int down_threshold = cpuhp->down_threshold; int num_pass_gov = 0; - int level = res->rescon.curr_level; + int level = 0; int up_count = 0; int down_count = 0; int left_count = 0; @@ -68,6 +69,10 @@ int pass_cpuhp_radiation_governor(struct pass_resource *res, void *result) int i; int j; int64_t time; + int max_level; + + pass_rescon_get_curr_level(res, &level); + pass_rescon_get_max_level(res, &max_level); for (i = 0; i < PASS_CPU_STATS_MAX_COUNT; i++) { time = cpu_stats[i].time; @@ -186,7 +191,7 @@ int pass_cpuhp_radiation_governor(struct pass_resource *res, void *result) if (up_count * 100 >= num_pass_gov * up_threshold) { level += res->config_data.num_cpus; - if (level > res->rescon.max_level) + if (level > max_level) level -= res->config_data.num_cpus; } else if (down_count * 100 >= num_pass_gov * down_threshold) { level -= res->config_data.num_cpus; @@ -195,38 +200,11 @@ int pass_cpuhp_radiation_governor(struct pass_resource *res, void *result) if (right_count * 100 >= num_pass_gov * up_threshold) { level += 1; - if (level > res->rescon.max_level) + if (level > max_level) level -= 1; } else if (left_count * 100 >= num_pass_gov * down_threshold) { level -= 1; } - /* - if (level == res->prev_level) { - for (i = num_pass_gov; i < PASS_CPU_STATS_MAX_COUNT; i++) { - time = cpu_stats[i].time; - freq = cpu_stats[i].freq; - nr_running = cpu_stats[i].nr_runnings; - busy_cpu = cpu_stats[i].num_busy_cpu; - - _I("[Level%d][%d][%lld] %d | %d | %d", - level, i, time, freq, - nr_running, busy_cpu); - } - } - - if (level != res->rescon.curr_level) { - _I("\n[Level%d] num_pass_gov: [%2d]", level, num_pass_gov); - _I("[Level%d] down_count : %2d (%3d >= %3d)", level, down_count, - down_count * 100, num_pass_gov * down_threshold); - _I("[Level%d] up_count : %2d (%3d >= %3d)", level, up_count, - up_count * 100, num_pass_gov * up_threshold); - _I("[Level%d] left_count : %2d (%3d >= %3d)", level, left_count, - left_count * 100, num_pass_gov * down_threshold); - _I("[Level%d] right_count : %2d (%3d >= %3d)", level, right_count, - right_count * 100, num_pass_gov * up_threshold); - } - */ - return level; } diff --git a/src/pass/pass-cpuhp-step.c b/src/pass/pass-cpuhp-step.c index 06983c4..6a5dec2 100644 --- a/src/pass/pass-cpuhp-step.c +++ b/src/pass/pass-cpuhp-step.c @@ -31,6 +31,7 @@ #include <stdlib.h> #include "pass.h" +#include "pass-rescon.h" #include "pass-resmon.h" #define PASS_CPU_STATS_MAX_COUNT 20 @@ -53,7 +54,7 @@ int pass_cpuhp_step_governor(struct pass_resource *res, void *result) int up_threshold = cpuhp->up_threshold; int down_threshold = cpuhp->down_threshold; int num_pass_gov = 0; - int level = res->rescon.curr_level; + int level = 0; int up_count = 0; int up_max_count = 0; int down_count = 0; @@ -65,6 +66,12 @@ int pass_cpuhp_step_governor(struct pass_resource *res, void *result) int i; int j; int64_t time; + int max_level = 0; + int min_level = 0; + + pass_rescon_get_curr_level(res, &level); + pass_rescon_get_max_level(res, &max_level); + pass_rescon_get_min_level(res, &min_level); for (i = 0; i < PASS_CPU_STATS_MAX_COUNT; i++) { time = cpu_stats[i].time; @@ -129,7 +136,7 @@ int pass_cpuhp_step_governor(struct pass_resource *res, void *result) */ } - if (level < res->rescon.max_level && + if (level < max_level && freq == levels[level].limit_max_freq) up_max_count++; } @@ -137,10 +144,10 @@ int pass_cpuhp_step_governor(struct pass_resource *res, void *result) if (!num_pass_gov) return level; - if (up_count && level < res->rescon.max_level && + if (up_count && level < max_level && up_count * 100 >= num_pass_gov * up_threshold) { level += 1; - } else if (down_count && level > res->rescon.min_level && + } else if (down_count && level > min_level && down_count * 100 >= num_pass_gov * down_threshold) { level -= 1; } diff --git a/src/pass/pass-cpuhp.c b/src/pass/pass-cpuhp.c index 27cfeb6..fadbfcc 100644 --- a/src/pass/pass-cpuhp.c +++ b/src/pass/pass-cpuhp.c @@ -101,7 +101,7 @@ static void cpuhp_calculate_busy_cpu(struct pass_resource *res, void *result) struct pass_level *levels = res->config_data.levels; struct pass_resource_config_data *config_data = &res->config_data; struct resmon_result_src_cpuhp *stats = result; - unsigned int level = res->rescon.curr_level; + int level = 0; unsigned int cpu_threshold = 0; unsigned int busy_cpu; unsigned int cur_freq; @@ -112,6 +112,14 @@ static void cpuhp_calculate_busy_cpu(struct pass_resource *res, void *result) int limit_min_cpu; int i; int j; + int ret; + + ret = pass_rescon_get_curr_level(res, &level); + if (ret < 0) { + _E("failed to get curr level of '%s' resource", + res->config_data.res_name); + return; + } limit_min_cpu = levels[level].limit_min_cpu; @@ -172,6 +180,7 @@ static int cpuhp_timer_func(void *result, void *user_data) struct pass_cpuhp *cpuhp; int curr_gov_timeout, next_gov_timeout; int level; + int curr_level; if (!res) { _E("cannot call the governor timeout callback\n"); @@ -181,11 +190,13 @@ static int cpuhp_timer_func(void *result, void *user_data) levels = res->config_data.levels; cpuhp = &res->cpuhp; + pass_rescon_get_curr_level(res, &curr_level); + /* Calculate the number of busy cpu */ cpuhp_calculate_busy_cpu(res, result); /* Store current governor timeout */ - curr_gov_timeout = levels[res->rescon.curr_level].gov_timeout; + curr_gov_timeout = levels[curr_level].gov_timeout; /* Determine the amount of proper resource */ if (cpuhp->governor->governor) { @@ -199,7 +210,7 @@ static int cpuhp_timer_func(void *result, void *user_data) } /* Get the governor timeout interval for the next */ - next_gov_timeout = levels[res->rescon.curr_level].gov_timeout; + next_gov_timeout = levels[curr_level].gov_timeout; /* * Change the governor timeout interval when the next interval is not diff --git a/src/pass/pass-parser.c b/src/pass/pass-parser.c index c2c2c67..c429fa2 100644 --- a/src/pass/pass-parser.c +++ b/src/pass/pass-parser.c @@ -44,11 +44,11 @@ #include <libsyscommon/resource-type.h> #include "pass.h" +#include "pass-rescon.h" #define MAX_NUM 255 #define MIN_TIMEOUT_MS 200 #define MAX_TIMEOUT_MS 3600000 /* 1 hour */ -#define INIT_VALUE -1 static int compare_compatible_name(const char *compatible, const char *path_compatible) @@ -484,9 +484,9 @@ static int parse_cpuhp(struct pass_resource *res, json_object *obj) } /* Initialize config_data from property values of confiugartion file */ - res->rescon.min_level = cpuhp_min_level; - res->rescon.max_level = cpuhp_max_level; - res->rescon.init_level = cpuhp_init_level; + pass_rescon_set_min_level(res, cpuhp_min_level); + pass_rescon_set_max_level(res, cpuhp_max_level); + pass_rescon_set_init_level(res, cpuhp_init_level); if (res->config_data.gov_timeout < MIN_TIMEOUT_MS || res->config_data.gov_timeout > MAX_TIMEOUT_MS) @@ -566,7 +566,9 @@ static int parse_header(struct pass_resource *res, json_object *obj) if (init_level < 0) init_level = 0; - res->rescon.init_scenario_level = init_level; + + /* Initialize config_data from property values of confiugartion file */ + pass_rescon_set_init_scenario_level(res, init_level); res->config_data.scenario_levels = calloc( res->config_data.num_scenario_levels, @@ -881,12 +883,9 @@ int pass_parser_get_each_resource_config(struct pass_resource *res, const char * res->config_data.levels = NULL; /* Initialize the ResCon's data */ - res->rescon.init_level = INIT_VALUE; - res->rescon.prev_level = INIT_VALUE; - res->rescon.min_level = INIT_VALUE; - res->rescon.max_level = INIT_VALUE; - res->rescon.init_scenario_level = INIT_VALUE; - res->rescon.overridable = 1; + ret = pass_rescon_prepare(res); + if (ret < 0) + return ret; /* Initialize the CPUHP's data */ cpuhp->pass_cpu_threshold = 0; diff --git a/src/pass/pass-rescon.c b/src/pass/pass-rescon.c index 35735d0..0cd721d 100644 --- a/src/pass/pass-rescon.c +++ b/src/pass/pass-rescon.c @@ -38,6 +38,55 @@ #define MIN_FAULT_AROUND_BYTES 4096 #define MAX_FAULT_AROUND_BYTES 65536 +/** + * @brief Represent PASS_MODULE_RESCON (Resource Controller) module. + * It should be always enabled in order to control h/w resources. + */ +struct pass_rescon { + /** State of PASS_MODULE_RESCON */ + enum pass_state state; + + /** Representing whether this resource can be overridden or not */ + int overridable; + + /** + * Initial level when initializing h/w resource by resource controller. + * If value is -1, it is not initialized by parser. + */ + int init_level; + /** + * Current level controlled by resource controller. + * If value is -1, it is not initialized by parser. + */ + int curr_level; + /** + * Previous level controlled by resource controller. + * If value is -1, it is not initialized by parser. + */ + int prev_level; + /** + * Available minimum level controlled by resource controller. + * If value is -1, it is not initialized by parser. + */ + int min_level; + /** + * Available maximum level controlled by resource controller. + * If value is -1, it is not initialized by parser. + */ + int max_level; + + /** + * Initial level when initializing h/w resource by resource controller. + * If value is -1, it is not initialized by parser. + */ + int init_scenario_level; + + /** Ondemanded scenario list */ + GList *scenario_level_list; + /** Mutex of ondemanded scenario list */ + GMutex scenario_level_mutex; +}; + static void rescon_print_level(struct pass_resource *res, struct pass_level *level) { @@ -132,7 +181,7 @@ static void rescon_adjust_level(struct pass_level *a, struct pass_level *b) static int rescon_update(struct pass_resource *res) { - struct pass_rescon *rescon = &res->rescon; + struct pass_rescon *rescon = res->rescon; struct pass_level *levels = res->config_data.levels; struct pass_level *scenario_levels = res->config_data.scenario_levels; struct pass_level adjusted_level; @@ -168,7 +217,7 @@ static int rescon_update(struct pass_resource *res) adjusted_level.charging_current_uA = MAX_INT; /* Adjust with pass_level */ - if (res->rescon.curr_level >= 0) + if (rescon->curr_level >= 0) rescon_adjust_level(&adjusted_level, &levels[rescon->curr_level]); /* Adjust with scenario pass_level */ @@ -347,7 +396,7 @@ static int rescon_update(struct pass_resource *res) static void rescon_set_scenario_level(struct pass_resource *res, int scenario_level) { - struct pass_rescon *rescon = &res->rescon; + struct pass_rescon *rescon = res->rescon; if (scenario_level < 0 || !rescon->overridable) return; @@ -362,7 +411,7 @@ static void rescon_set_scenario_level(struct pass_resource *res, static void rescon_unset_scenario_level(struct pass_resource *res, int scenario_level) { - struct pass_rescon *rescon = &res->rescon; + struct pass_rescon *rescon = res->rescon; if (scenario_level < 0 || !rescon->overridable) return; @@ -401,17 +450,17 @@ int pass_rescon_set_level(struct pass_resource *res, int new_level) if (new_level < 0) return 0; - if (new_level > res->rescon.max_level) - new_level = res->rescon.max_level; + if (new_level > res->rescon->max_level) + new_level = res->rescon->max_level; - if (new_level < res->rescon.min_level) - new_level = res->rescon.min_level; + if (new_level < res->rescon->min_level) + new_level = res->rescon->min_level; - if (new_level == res->rescon.curr_level) + if (new_level == res->rescon->curr_level) return 0; - res->rescon.prev_level = res->rescon.curr_level; - res->rescon.curr_level = new_level; + res->rescon->prev_level = res->rescon->curr_level; + res->rescon->curr_level = new_level; return 0; }; @@ -430,17 +479,17 @@ int pass_rescon_set_level_sync(struct pass_resource *res, int new_level) if (new_level < 0) return 0; - if (new_level > res->rescon.max_level) - new_level = res->rescon.max_level; + if (new_level > res->rescon->max_level) + new_level = res->rescon->max_level; - if (new_level < res->rescon.min_level) - new_level = res->rescon.min_level; + if (new_level < res->rescon->min_level) + new_level = res->rescon->min_level; - if (new_level == res->rescon.curr_level) + if (new_level == res->rescon->curr_level) return 0; - res->rescon.prev_level = res->rescon.curr_level; - res->rescon.curr_level = new_level; + res->rescon->prev_level = res->rescon->curr_level; + res->rescon->curr_level = new_level; return rescon_update(res); }; @@ -521,14 +570,99 @@ int pass_rescon_unset_scenario_level_sync(struct pass_resource *res, */ int pass_rescon_set_overridable(struct pass_resource *res, int overridable) { - if (!res) + if (!res || !res->rescon || overridable < -1 || overridable >= INT_MAX) + return -EINVAL; + + res->rescon->overridable = overridable; + + return 0; +} + +int pass_rescon_set_init_level(struct pass_resource *res, int level) +{ + if (!res || !res->rescon || level < 0 || level >= INT_MAX) return -EINVAL; - res->rescon.overridable = overridable; + res->rescon->init_level = level; return 0; } +int pass_rescon_set_curr_level(struct pass_resource *res, int level) +{ + if (!res || !res->rescon || level < 0 || level >= INT_MAX) + return -EINVAL; + + res->rescon->curr_level = level; + + return 0; +} + +int pass_rescon_set_prev_level(struct pass_resource *res, int level) +{ + if (!res || !res->rescon || level < 0 || level >= INT_MAX) + return -EINVAL; + + res->rescon->prev_level = level; + + return 0; +} + +int pass_rescon_set_min_level(struct pass_resource *res, int level) +{ + if (!res || !res->rescon || level < 0 || level >= INT_MAX) + return -EINVAL; + + res->rescon->min_level = level; + + return 0; +} + +int pass_rescon_set_max_level(struct pass_resource *res, int level) +{ + if (!res || !res->rescon || level < 0 || level >= INT_MAX) + return -EINVAL; + + res->rescon->max_level = level; + + return 0; +} + +int pass_rescon_set_init_scenario_level(struct pass_resource *res, int level) +{ + if (!res || !res->rescon || level < 0 || level >= INT_MAX) + return -EINVAL; + + res->rescon->init_scenario_level = level; + + return 0; +} + +int pass_rescon_get_init_level(struct pass_resource *res, int *level) +{ + return (!res || !res->rescon) ? -EINVAL : res->rescon->init_level; +} + +int pass_rescon_get_curr_level(struct pass_resource *res, int *level) +{ + return (!res || !res->rescon) ? -EINVAL : res->rescon->curr_level; +} + +int pass_rescon_get_prev_level(struct pass_resource *res, int *level) +{ + return (!res || !res->rescon) ? -EINVAL : res->rescon->prev_level; +} + +int pass_rescon_get_min_level(struct pass_resource *res, int *level) +{ + return (!res || !res->rescon) ? -EINVAL : res->rescon->min_level; +} + +int pass_rescon_get_max_level(struct pass_resource *res, int *level) +{ + return (!res || !res->rescon) ? -EINVAL : res->rescon->max_level; +} + /* * @brief Deprecated function to support backward compatibility with sync. * Set up the scenario pass_level by PASS_MODULE_PMQOS with data. @@ -583,6 +717,27 @@ int pass_rescon_unset_scenario_level_sync_with_data(struct pass_resource *res, return rescon_update(res); } +int pass_rescon_prepare(struct pass_resource *res) +{ + if (!res || res->rescon != NULL) + return -EINVAL; + + res->rescon = calloc(1, sizeof(struct pass_rescon)); + if (!res->rescon) + return -ENOMEM; + + res->rescon->init_level = INIT_VALUE; + res->rescon->prev_level = INIT_VALUE; + res->rescon->min_level = INIT_VALUE; + res->rescon->max_level = INIT_VALUE; + res->rescon->init_scenario_level = INIT_VALUE; + res->rescon->overridable = 1; + res->rescon->curr_level = INIT_VALUE; + res->rescon->prev_level = INIT_VALUE; + + return 0; +} + /** * @brief Initialize PASS_MODULE_RESCON(Resource Controller) module. * @param [in] res Instance of h/w resource @@ -593,15 +748,11 @@ int pass_rescon_init(struct pass_resource *res) struct pass_rescon *rescon; int ret; - if (!res || res->rescon.state == PASS_ON) + if (!res || !res->rescon || res->rescon->state == PASS_ON) return -1; - - rescon = &res->rescon; + rescon = res->rescon; /* Initialize the variables of resource-controller */ - rescon->curr_level = -1; - rescon->prev_level = -1; - if (!rescon->min_level) rescon->min_level = 0; res->config_data.default_min_level = rescon->min_level; @@ -671,10 +822,10 @@ int pass_rescon_exit(struct pass_resource *res) struct pass_rescon *rescon; int ret; - if (!res || res->rescon.state == PASS_OFF) + if (!res || !res->rescon || res->rescon->state == PASS_OFF) return -1; - rescon = &res->rescon; + rescon = res->rescon; /* Restore the h/w resource by using the saved data */ ret = pass_hal_restore_initdata(res); @@ -699,5 +850,8 @@ int pass_rescon_exit(struct pass_resource *res) rescon->state = PASS_OFF; + free(rescon); + res->rescon = NULL; + return ret; } diff --git a/src/pass/pass-rescon.h b/src/pass/pass-rescon.h index f318b55..47e7cae 100644 --- a/src/pass/pass-rescon.h +++ b/src/pass/pass-rescon.h @@ -43,7 +43,26 @@ int pass_rescon_set_scenario_level(struct pass_resource *res, int pass_rescon_unset_scenario_level(struct pass_resource *res, int scenario_level); +/* Get and set the fields of struct pass_rescon */ +int pass_rescon_set_init_level(struct pass_resource *res, int level); +int pass_rescon_set_curr_level(struct pass_resource *res, int level); +int pass_rescon_set_prev_level(struct pass_resource *res, int level); +int pass_rescon_set_min_level(struct pass_resource *res, int level); +int pass_rescon_set_max_level(struct pass_resource *res, int level); +int pass_rescon_set_init_scenario_level(struct pass_resource *res, int level); int pass_rescon_set_overridable(struct pass_resource *res, int overridable); + +int pass_rescon_get_init_level(struct pass_resource *res, int *level); +int pass_rescon_get_curr_level(struct pass_resource *res, int *level); +int pass_rescon_get_prev_level(struct pass_resource *res, int *level); +int pass_rescon_get_min_level(struct pass_resource *res, int *level); +int pass_rescon_get_max_level(struct pass_resource *res, int *level); + +/* Init, exit and prepare the resource monitor module */ +int pass_rescon_prepare(struct pass_resource *res); +int pass_rescon_init(struct pass_resource *res); +int pass_rescon_exit(struct pass_resource *res); + /* * Following APIs are deprecated. These functions are provided * for keeping the compatibility with legacy feature. diff --git a/src/pass/pass.c b/src/pass/pass.c index 50f3d2e..4d6824a 100644 --- a/src/pass/pass.c +++ b/src/pass/pass.c @@ -43,6 +43,7 @@ #include "pass.h" #include "pass-parser.h" #include "pass-hal.h" +#include "pass-rescon.h" #define PASS_JSON_PATH "/hal/etc/pass/pass.json" @@ -88,8 +89,6 @@ static uint64 supported_module[] = { | PASS_MODULE_THERMAL, }; -extern int pass_rescon_init(struct pass_resource *res); -extern int pass_rescon_exit(struct pass_resource *res); extern int pass_resmon_init(struct pass_resource *res); extern int pass_resmon_exit(struct pass_resource *res); extern int pass_cpuhp_init(struct pass_resource *res); diff --git a/src/pass/pass.h b/src/pass/pass.h index 1f41600..35702fc 100644 --- a/src/pass/pass.h +++ b/src/pass/pass.h @@ -43,6 +43,7 @@ #define PASS_LEVEL_COND_MAX 3 +struct pass_rescon; struct pass_resource; struct pass_cpuhp_governor; @@ -281,54 +282,6 @@ struct pass_scenario { * PASS Module * ******************************************************/ -/** - * @brief Represent PASS_MODULE_RESCON (Resource Controller) module. - * It should be always enabled in order to control h/w resources. - */ -struct pass_rescon { - /** State of PASS_MODULE_RESCON */ - enum pass_state state; - - /** Representing whether this resource can be overridden or not */ - int overridable; - - /** - * Initial level when initializing h/w resource by resource controller. - * If value is -1, it is not initialized by parser. - */ - int init_level; - /** - * Current level controlled by resource controller. - * If value is -1, it is not initialized by parser. - */ - int curr_level; - /** - * Previous level controlled by resource controller. - * If value is -1, it is not initialized by parser. - */ - int prev_level; - /** - * Available minimum level controlled by resource controller. - * If value is -1, it is not initialized by parser. - */ - int min_level; - /** - * Available maximum level controlled by resource controller. - * If value is -1, it is not initialized by parser. - */ - int max_level; - - /** - * Initial level when initializing h/w resource by resource controller. - * If value is -1, it is not initialized by parser. - */ - int init_scenario_level; - - /** Ondemanded scenario list */ - GList *scenario_level_list; - /** Mutex of ondemanded scenario list */ - GMutex scenario_level_mutex; -}; /** * @brief Represent PASS_MODULE_RESMON (Resource Monitor) module. @@ -633,7 +586,7 @@ struct pass_resource { } hal; /** Instance of PASS_MODULE_RESCON module */ - struct pass_rescon rescon; + struct pass_rescon *rescon; /** Instance of PASS_MODULE_RESMON module */ struct pass_resmon resmon; /** Instance of PASS_MODULE_CPUHP module */ diff --git a/tests/haltest/CMakeLists.txt b/tests/haltest/CMakeLists.txt index 1f0e9a3..1a1bcad 100644 --- a/tests/haltest/CMakeLists.txt +++ b/tests/haltest/CMakeLists.txt @@ -1,6 +1,7 @@ PROJECT(pass C CXX) SET(SRCS ${CMAKE_SOURCE_DIR}/src/pass/pass-hal.c + ${CMAKE_SOURCE_DIR}/src/pass/pass-rescon.c ${CMAKE_SOURCE_DIR}/src/pass/pass-parser.c ${CMAKE_SOURCE_DIR}/src/util/common.c ) diff --git a/tests/integration-test/CMakeLists.txt b/tests/integration-test/CMakeLists.txt index 24600cd..c0b9e64 100644 --- a/tests/integration-test/CMakeLists.txt +++ b/tests/integration-test/CMakeLists.txt @@ -1,6 +1,7 @@ PROJECT(pass C CXX) SET(SRCS ${CMAKE_SOURCE_DIR}/src/pass/pass-hal.c + ${CMAKE_SOURCE_DIR}/src/pass/pass-rescon.c ${CMAKE_SOURCE_DIR}/src/pass/pass-parser.c ${CMAKE_SOURCE_DIR}/src/util/common.c ${CMAKE_SOURCE_DIR}/src/util/privilege.c diff --git a/tests/unittest/CMakeLists.txt b/tests/unittest/CMakeLists.txt index a5ba5af..1592154 100644 --- a/tests/unittest/CMakeLists.txt +++ b/tests/unittest/CMakeLists.txt @@ -7,6 +7,7 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror") SET(PASS_SRCS ${CMAKE_SOURCE_DIR}/src/util/common.c ${CMAKE_SOURCE_DIR}/src/pass/pass-hal.c + ${CMAKE_SOURCE_DIR}/src/pass/pass-rescon.c ${CMAKE_SOURCE_DIR}/src/pass/pass-parser.c ) |