aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@linaro.org>2018-12-18 12:56:10 +0200
committerMaxim Uvarov <maxim.uvarov@linaro.org>2018-12-26 16:48:54 +0300
commit3e9428c476bf8527e9c294f298fa550f634ae40b (patch)
tree9c1c2b5ef1cb075cba1b8f86ea302fcf6f69c5ac
parentb0d8afdb22c92c4f0974acbe30e346110b8a8fc6 (diff)
linux-gen: sched: check that config has been done
Check always on slow path functions that schedule config has been called. Fast path functions do the check only when debugging is enabled. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> Reviewed-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
-rw-r--r--platform/linux-generic/odp_schedule_basic.c5
-rw-r--r--platform/linux-generic/odp_schedule_if.c11
-rw-r--r--platform/linux-generic/odp_schedule_sp.c8
3 files changed, 13 insertions, 11 deletions
diff --git a/platform/linux-generic/odp_schedule_basic.c b/platform/linux-generic/odp_schedule_basic.c
index 48f232e6b..e5a9cfc72 100644
--- a/platform/linux-generic/odp_schedule_basic.c
+++ b/platform/linux-generic/odp_schedule_basic.c
@@ -597,7 +597,10 @@ static int schedule_init_queue(uint32_t queue_index,
int i;
int prio = prio_level_from_api(sched_param->prio);
- ODP_ASSERT(_odp_schedule_configured);
+ if (_odp_schedule_configured == 0) {
+ ODP_ERR("Scheduler has not been configured\n");
+ return -1;
+ }
pri_set_queue(queue_index, prio);
sched->queue[queue_index].grp = sched_param->group;
diff --git a/platform/linux-generic/odp_schedule_if.c b/platform/linux-generic/odp_schedule_if.c
index cb52f1554..ba903e581 100644
--- a/platform/linux-generic/odp_schedule_if.c
+++ b/platform/linux-generic/odp_schedule_if.c
@@ -24,10 +24,7 @@ extern const schedule_api_t schedule_scalable_api;
const schedule_fn_t *sched_fn;
const schedule_api_t *sched_api;
-
-#ifdef ODP_DEBUG
int _odp_schedule_configured;
-#endif
uint64_t odp_schedule_wait_time(uint64_t ns)
{
@@ -51,7 +48,10 @@ int odp_schedule_config(const odp_schedule_config_t *config)
int ret;
odp_schedule_config_t defconfig;
- ODP_ASSERT(!_odp_schedule_configured);
+ if (_odp_schedule_configured) {
+ ODP_ERR("Scheduler has been configured already\n");
+ return -1;
+ }
if (!config) {
odp_schedule_config_init(&defconfig);
@@ -59,10 +59,9 @@ int odp_schedule_config(const odp_schedule_config_t *config)
}
ret = sched_api->schedule_config(config);
-#ifdef ODP_DEBUG
+
if (ret >= 0)
_odp_schedule_configured = 1;
-#endif
return ret;
}
diff --git a/platform/linux-generic/odp_schedule_sp.c b/platform/linux-generic/odp_schedule_sp.c
index eec88a60a..e7b378950 100644
--- a/platform/linux-generic/odp_schedule_sp.c
+++ b/platform/linux-generic/odp_schedule_sp.c
@@ -375,10 +375,10 @@ static int init_queue(uint32_t qi, const odp_schedule_param_t *sched_param)
odp_schedule_group_t group = sched_param->group;
int prio = 0;
-#ifdef ODP_DEBUG
- if (!_odp_schedule_configured)
- ODP_ABORT("Scheduler not configured!\n");
-#endif
+ if (_odp_schedule_configured == 0) {
+ ODP_ERR("Scheduler has not been configured\n");
+ return -1;
+ }
if (group < 0 || group >= NUM_GROUP)
return -1;