diff options
author | Vincent Guittot <vincent.guittot@linaro.org> | 2015-10-21 09:49:18 +0200 |
---|---|---|
committer | Vincent Guittot <vincent.guittot@linaro.org> | 2015-10-23 09:12:10 +0200 |
commit | be36aa5f8c6bd3c4e10af3f749a01f01cd7835f1 (patch) | |
tree | 9ca742850caf447444f42adb4df1673caaae0dc5 /src | |
parent | 6133cd743673af1f0f056d05488b2cf26dbb4eb8 (diff) |
rt-app: fix deadline parameters naming
rt-app considers all key starting by "run" in the "phases" object as a run
event. But rt-app also allows to not create a "phases" object if there is only
one phase. In this latter case, the events are directly put at the "thread"
object level where the deadline parameters are also set. In such configuration,
the "runtime" key that is used for the runtime parameter of a deadline thread
is also filtered as a "run" event whereas it should not.
In order to remove any potential mix between deadline parameters and events,
we rename the deadline parameters in the .json file: "dl-period",
"dl-deadline", "dl-runtime".
For backward compatibility reason, rt-app will continue to check the presence
of "period", "deadline" and "runtime" keys at the thread level iff new keys
have not been found.
"dl-period", "dl-runtime" and "dl-deadline" are used by to set sched_setattr's
paramters which use nanosecond unit. All other rt-app parameters uses
microsecond unit which makes the description of a deadline thread quite
confusing as described in the example below:
"thread0" : {
"policy" : "SCHED_DEADLINE",
"dl-period" : 100000000,
"dl-deadline" : 20000000,
"dl-runtime" : 10000000,
"run" : 10000,
"timer" : { "ref" : "unique", "period" : 100000 }
},
In addition, deadline scheduler doesn't accept a runtime smaller than 1 usec
(at least in the v4.3 kernel). So we can align all the parameters of the json
file to usec unit in order to have consistant values in the description of a
thread.
The usec unit only applies to "dl-period", "dl-runtime" and "dl-deadline" but
"period", "deadline" and "runtime" still use ns to keep backward
compatibility.
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/rt-app.c | 2 | ||||
-rw-r--r-- | src/rt-app_parse_config.c | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/rt-app.c b/src/rt-app.c index 5379ced..fef12d8 100644 --- a/src/rt-app.c +++ b/src/rt-app.c @@ -479,7 +479,7 @@ void *thread_body(void *arg) attr.sched_policy = SCHED_DEADLINE; attr.sched_priority = 0; attr.sched_runtime = data->runtime; - attr.sched_deadline = data->deadline; + attr.sched_deadline = data->deadline; attr.sched_period = data->period; log_notice("[%d] period: %lu, exec: %lu, deadline: %lu", diff --git a/src/rt-app_parse_config.c b/src/rt-app_parse_config.c index ef802f1..af18910 100644 --- a/src/rt-app_parse_config.c +++ b/src/rt-app_parse_config.c @@ -659,9 +659,15 @@ parse_thread_data(char *name, struct json_object *obj, int index, prior_def); /* deadline params */ - data->runtime = get_int_value_from(obj, "runtime", TRUE, 0); - data->period = get_int_value_from(obj, "period", TRUE, data->runtime); - data->deadline = get_int_value_from(obj, "period", TRUE, data->period); + data->runtime = get_int_value_from(obj, "dl-runtime", TRUE, 0) * 1000; + if (!data->runtime) + data->runtime = get_int_value_from(obj, "runtime", TRUE, 0); + data->period = get_int_value_from(obj, "dl-period", TRUE, 0) * 1000; + if (!data->period) + data->period = get_int_value_from(obj, "period", TRUE, data->runtime); + data->deadline = get_int_value_from(obj, "dl-deadline", TRUE, 0) * 1000; + if (!data->period) + data->deadline = get_int_value_from(obj, "deadline", TRUE, data->period); /* cpuset */ cpuset_obj = get_in_object(obj, "cpus", TRUE); |