From 984556bc8e38caea74c6fef135f7866a1cf38496 Mon Sep 17 00:00:00 2001 From: Valentin Schneider Date: Tue, 9 Jul 2019 14:56:57 +0100 Subject: [PATCH] module/sched: Make SchedModule probing more accurate Right now, this module won't be loaded if the sched_domain procfs entries are not present on the target. However, other pieces of information may be present in which case it would make sense to load the module. For instance, mainline kernels compiled without SCHED_DEBUG can still expose the cpu_capacity sysfs entry. As such, try to get a better idea of what's available and only disable the loading of the module if it can provide absolutely nothing. --- devlib/module/sched.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/devlib/module/sched.py b/devlib/module/sched.py index 08a43b1..8fad08a 100644 --- a/devlib/module/sched.py +++ b/devlib/module/sched.py @@ -259,7 +259,21 @@ class SchedModule(Module): logger = logging.getLogger(SchedModule.name) SchedDomainFlag.check_version(target, logger) - return SchedProcFSData.available(target) + # It makes sense to load this module if at least one of those + # functionalities is enabled + schedproc = SchedProcFSData.available(target) + debug = SchedModule.target_has_debug(target) + dmips = any([target.file_exists(SchedModule.cpu_dmips_capacity_path(target, cpu)) + for cpu in target.list_online_cpus()]) + + logger.info("Scheduler sched_domain procfs entries %s", + "found" if schedproc else "not found") + logger.info("Detected kernel compiled with SCHED_DEBUG=%s", + "y" if debug else "n") + logger.info("CPU capacity sysfs entries %s", + "found" if dmips else "not found") + + return schedproc or debug or dmips def get_kernel_attributes(self, matching=None, check_exit_code=True): """