From 4658feb2811fe2019602899df35f5f5523e4d6b2 Mon Sep 17 00:00:00 2001 From: Brendan Jackman Date: Fri, 31 Mar 2017 11:31:53 +0100 Subject: [PATCH] tests/eas/preliminary: Check schedutil tunables are sensible The default rate limits for schedutil are currently 1000 * the transition latency reported by the cpufreq driver, so it's necessary to manually set these tunables to a sensible value from init.rc or similar. Add a test to highlight if this isn't being done. --- tests/eas/preliminary.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/eas/preliminary.py b/tests/eas/preliminary.py index 920848e5c..242eb5184 100644 --- a/tests/eas/preliminary.py +++ b/tests/eas/preliminary.py @@ -174,3 +174,42 @@ class TestEnergyModelPresent(BasicCheckTest): 'No energy model visible in procfs. Possible causes: \n' '- Kernel built without (CONFIG_SCHED_DEBUG && CONFIG_SYSCTL)\n' '- No energy model in kernel') + +class TestSchedutilTunables(BasicCheckTest): + MAX_UP_RATE_LIMIT_US = 20 * 1e3 + MAX_DOWN_RATE_LIMIT_US = 20 * 1e3 + + def test_rate_limit_not_too_high(self): + """Test that the schedutil ratelimiting is not too harsh""" + governors = self.target.cpufreq.list_governors(0) + if 'schedutil' not in governors: + raise SkipTest('schedutil not present on target') + self.target.cpufreq.set_all_governors('schedutil') + + cpus = set(range(self.target.number_of_cpus)) + up_limit_fail_cpus = [] + down_limit_fail_cpus = [] + while cpus: + cpu = iter(cpus).next() + domain = tuple(self.target.cpufreq.get_domain_cpus(cpu)) + + tunables = self.target.cpufreq.get_governor_tunables(cpu) + if int(tunables['up_rate_limit_us']) > self.MAX_UP_RATE_LIMIT_US: + up_limit_fail_cpus += domain + if int(tunables['down_rate_limit_us']) > self.MAX_DOWN_RATE_LIMIT_US: + down_limit_fail_cpus += domain + + cpus = cpus.difference(domain) + + self.assertTrue( + up_limit_fail_cpus == [], + 'schedutil up_rate_limit_us greater than {} on CPUs {}. ' + 'Responsiveness will be affected.'.format( + self.MAX_UP_RATE_LIMIT_US, up_limit_fail_cpus)) + self.assertTrue( + down_limit_fail_cpus == [], + 'schedutil down_rate_limit_us greater than {} on CPUs {}. ' + 'Responsiveness will be affected.'.format( + self.MAX_DOWN_RATE_LIMIT_US, down_limit_fail_cpus)) + +======= end -- GitLab