From 2acde1ad49b55e23ddcdf39eab63797ff936167a Mon Sep 17 00:00:00 2001 From: Valentin Schneider Date: Mon, 17 Dec 2018 11:49:06 +0000 Subject: [PATCH 1/4] tests: misfit: Fix test_migration_delay() threshold name --- lisa/tests/kernel/scheduler/misfit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisa/tests/kernel/scheduler/misfit.py b/lisa/tests/kernel/scheduler/misfit.py index ab8e844bb..b00ce2008 100644 --- a/lisa/tests/kernel/scheduler/misfit.py +++ b/lisa/tests/kernel/scheduler/misfit.py @@ -307,7 +307,7 @@ class StaggeredFinishes(MisfitMigrationBase): return res @requires_events('sched_switch') - def test_migration_delay(self, allowed_delay_s=0.001) -> ResultBundle: + def test_migration_delay(self, allowed_idle_time_s=0.001) -> ResultBundle: """ Test that big CPUs pull tasks ASAP @@ -337,7 +337,7 @@ class StaggeredFinishes(MisfitMigrationBase): task_state_dfs[task] = df[:first_big] - return self._test_cpus_busy(task_state_dfs, self.dst_cpus, allowed_delay_s) + return self._test_cpus_busy(task_state_dfs, self.dst_cpus, allowed_idle_time_s) @requires_events('sched_switch') def test_throughput(self, allowed_idle_time_s=0.001) -> ResultBundle: -- GitLab From 6d9120af63a0946cf0035d831cde47385cc0c0f1 Mon Sep 17 00:00:00 2001 From: Valentin Schneider Date: Mon, 17 Dec 2018 11:54:26 +0000 Subject: [PATCH 2/4] tests: misfit: Use saner default for misfit migration tests This saner default makes test_migration_delay() (which is a subset of test_throughput) relatively useless, however we should keep it for at least one more integration run just to make sure. --- lisa/tests/kernel/scheduler/misfit.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lisa/tests/kernel/scheduler/misfit.py b/lisa/tests/kernel/scheduler/misfit.py index b00ce2008..f2efd5ee7 100644 --- a/lisa/tests/kernel/scheduler/misfit.py +++ b/lisa/tests/kernel/scheduler/misfit.py @@ -287,6 +287,9 @@ class StaggeredFinishes(MisfitMigrationBase): Test that for every window in which the tasks are running, :attr:`cpus` are not idle for more than :attr:`allowed_idle_time_s` """ + if allowed_idle_time_s is None: + allowed_idle_time_s = 1e-3 * self.plat_info["cpus-count"] + res = ResultBundle.from_bool(True) for task, state_df in task_state_dfs.items(): @@ -307,7 +310,7 @@ class StaggeredFinishes(MisfitMigrationBase): return res @requires_events('sched_switch') - def test_migration_delay(self, allowed_idle_time_s=0.001) -> ResultBundle: + def test_migration_delay(self, allowed_idle_time_s=None) -> ResultBundle: """ Test that big CPUs pull tasks ASAP @@ -316,6 +319,13 @@ class StaggeredFinishes(MisfitMigrationBase): a newidle balance should lead to a null delay, but in practice there's a tiny one, so don't set that to 0 and expect the test to pass. + + Furthermore, we're not always guaranteed to get a newidle pull, so + allow time for a regular load balance to happen. + + When ``None``, this defaults to (1ms x number_of_cpus) to mimic the + default balance_interval (balance_interval = sd_weight), see + kernel/sched/topology.c:sd_init(). :type allowed_idle_time_s: int This test is about the very first migration from LITTLE to big. @@ -340,7 +350,7 @@ class StaggeredFinishes(MisfitMigrationBase): return self._test_cpus_busy(task_state_dfs, self.dst_cpus, allowed_idle_time_s) @requires_events('sched_switch') - def test_throughput(self, allowed_idle_time_s=0.001) -> ResultBundle: + def test_throughput(self, allowed_idle_time_s=None) -> ResultBundle: """ Test that big CPUs are not idle when there are misfit tasks to upmigrate @@ -349,6 +359,13 @@ class StaggeredFinishes(MisfitMigrationBase): a newidle balance should lead to a null delay, but in practice there's a tiny one, so don't set that to 0 and expect the test to pass. + + Furthermore, we're not always guaranteed to get a newidle pull, so + allow time for a regular load balance to happen. + + When ``None``, this defaults to (1ms x number_of_cpus) to mimic the + default balance_interval (balance_interval = sd_weight), see + kernel/sched/topology.c:sd_init(). :type allowed_idle_time_s: int """ task_state_dfs = {} -- GitLab From 2f5ed4c153c67c4c2747c9d6ade4cc111bf9b945 Mon Sep 17 00:00:00 2001 From: Valentin Schneider Date: Mon, 17 Dec 2018 11:56:42 +0000 Subject: [PATCH 3/4] tests: misfit: Class attributes cleanup --- lisa/tests/kernel/scheduler/misfit.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lisa/tests/kernel/scheduler/misfit.py b/lisa/tests/kernel/scheduler/misfit.py index f2efd5ee7..eb1e34e27 100644 --- a/lisa/tests/kernel/scheduler/misfit.py +++ b/lisa/tests/kernel/scheduler/misfit.py @@ -111,15 +111,13 @@ class StaggeredFinishes(MisfitMigrationBase): task_prefix = "misfit" - pin_delay_s = 0.001 + PIN_DELAY_S = 0.001 """ How long the tasks will be pinned to their "starting" CPU. Doesn't have to be long (we just have to ensure they spawn there), so arbitrary value """ - # Somewhat arbitrary delay - long enough to ensure - # rq->avg_idle > sysctl_sched_migration_cost - idling_delay_s = 1 + IDLING_DELAY_S = 1 """ A somewhat arbitray delay - long enough to ensure rq->avg_idle > sysctl_sched_migration_cost @@ -148,7 +146,7 @@ class StaggeredFinishes(MisfitMigrationBase): # the last to wake up. last_start = 0 - sdf = sdf[init_start + self.idling_delay_s * 0.9 :] + sdf = sdf[init_start + self.IDLING_DELAY_S * 0.9 :] for task in self.rtapp_profile.keys(): task_cpu = int(task.strip("{}_".format(self.task_prefix))) @@ -188,8 +186,8 @@ class StaggeredFinishes(MisfitMigrationBase): profile["{}_{}".format(cls.task_prefix, cpu)] = ( Periodic( duty_cycle_pct=100, - duration_s=cls.pin_delay_s, - delay_s=cls.idling_delay_s, + duration_s=cls.PIN_DELAY_S, + delay_s=cls.IDLING_DELAY_S, period_ms=cls.TASK_PERIOD_MS, cpus=[cpu] ) + Periodic( -- GitLab From d69ea69a36f69441ac2df3efb1df9d99265d7ab7 Mon Sep 17 00:00:00 2001 From: Valentin Schneider Date: Mon, 17 Dec 2018 12:08:58 +0000 Subject: [PATCH 4/4] tests: misfit: Use correct trace events decorators --- lisa/tests/kernel/scheduler/misfit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisa/tests/kernel/scheduler/misfit.py b/lisa/tests/kernel/scheduler/misfit.py index eb1e34e27..6a05bfdbc 100644 --- a/lisa/tests/kernel/scheduler/misfit.py +++ b/lisa/tests/kernel/scheduler/misfit.py @@ -307,7 +307,7 @@ class StaggeredFinishes(MisfitMigrationBase): return res - @requires_events('sched_switch') + @TasksAnalysis.df_task_states.used_events def test_migration_delay(self, allowed_idle_time_s=None) -> ResultBundle: """ Test that big CPUs pull tasks ASAP @@ -347,7 +347,7 @@ class StaggeredFinishes(MisfitMigrationBase): return self._test_cpus_busy(task_state_dfs, self.dst_cpus, allowed_idle_time_s) - @requires_events('sched_switch') + @TasksAnalysis.df_task_states.used_events def test_throughput(self, allowed_idle_time_s=None) -> ResultBundle: """ Test that big CPUs are not idle when there are misfit tasks to upmigrate -- GitLab