1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-07-09 07:12:41 +01:00
Commit Graph

110 Commits

Author SHA1 Message Date
cc0679e40f module: sched: add support to get/set scheduler features
Scheduler features are a debbugging mechanism which allows to tune at
run-time some (usually experimental) features of the Linux scheduler.

Let's add a proper API abstraction to easily access the list of
supported features and tune them.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2019-01-28 13:56:31 +00:00
5dea9f8bcf module: sched: add get/set methods for scheduler attributes
The Linux scheduler exposes a set of tunables via /proc/sys/kernel's
attributes staring by "sched_".

Let's add a convenient API to the sched module to read and set the
values of these attributes.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2019-01-28 13:56:31 +00:00
4fabcae0b4 cgroups.py: strip slashes, don't drop first char
this makes it cope with both, names starting with or without slashes
2019-01-04 11:22:24 +00:00
f1b7fd184a module/cgroups: Execute command as root when launching cmd in cgroup
On some devices root is required to configure cgroups therefore run the
command as root if available unless otherwise specified.
2018-12-14 10:19:52 +00:00
d376bc10ee module/sched: SchedDomain: Turn flags definition into an enum
This lets us easily iterate over the known flags, and
makes the code a little neater.
2018-11-21 10:54:46 +00:00
94c1339efd module/cpufreq: Add userspace special case for use_governor()
Frequencies are not considered as governor tunables by
list_governor_tunables(), so add a special case to restore userspace
frequency when using use_governor().

While at it, reword the internal "governor" variable to not clash
with the parameter of the same name.
2018-11-13 13:44:00 +00:00
74444210e7 module/sched: Harden probe()
Running some tests on a VM I hit that unexpected scenario where the
required sched_domain file is there but then read_tree_values() fails
because there are no files to read, only directories.

This does a quick check that there's actual data to be read.
2018-11-02 10:40:25 +00:00
6089eaf40a module/sched: Fix sched procfs parsing for >= 10 CPU systems
The regexp was a bit too greedy and would match 'cpu1' as the
name of a 'cpu10' node.
2018-10-17 15:40:56 +01:00
fa41bb01d2 modules: Update docs with 'setup' stage for module initialization
Update documentation to include the 'setup' stage for module
initialization.
2018-10-10 10:31:45 +01:00
8cd1470bb8 module/cpufreq: Add a contextmanager for temporary governor changes
We may sometime want to temporarily use another governor, and then
restore whatever governor was used previously - for instance, RT-app
calibration ([1]) needs to use the performance governor, but we don't
want this to interfere with e.g. our current experiment.

[1]: https://github.com/ARM-software/lisa/blob/master/libs/wlgen/wlgen/rta.py#L118
2018-08-24 15:13:35 +01:00
66be73be3e module/hotplug: Add list_hotpluggable_cpus helper
This is similar to the list_{online/offline}_cpus helpers from Target
2018-08-23 14:30:43 +01:00
512c5f3737 Remove duplicate copyright headers
I used the "Arm Limited" spelling in some headers, but it seems that
didn't get caught by the copyright update script that was used for
9fd690efb3 ("Update copyrights").

This resulted in a duplicated header being inserted, although with the
"ARM Limited" spelling. Remove the previous header and use this one
instead.
2018-08-17 16:06:41 +01:00
511d478164 exceptions: Classify transient exceptions
Exceptions such as TargetError can sometimes be raised because of a
network issue, which is useful to distinguish from errors caused by a
missing feature for automated testing environments.

The following exceptions are introduced:
* DevlibStableError: raised when a non-transient error is encountered
    * TargetStableError

* DevlibTransientError: raised when a transient error is encountered,
including timeouts.
    * TargetTransientError

When there is an ambiguity on the type of exception to use, it can be
assumed that the configuration is correct, and therefore it is a
transient error, unless the function is specifically designed to probe a
property of the system. In that case, ambiguity is allowed to be lifted
by assuming a non-transient error, since we expect it to raise an
exception when that property is not met. Such ambiguous case can appear
when checking Android has booted, since we cannot know if this is a
timeout/connection issue, or an actual issue with the Android build or
configuration. Another case are the execute() methods, which can be
expected to fail on purpose. A new parameter will_succeed=False is
added, to automatically turn non transient errors into transient ones if
the caller is 100% sure that the command cannot fail unless there is an
environment issue that is outside of the scope controlled by the user.

devlib now never raises TargetError directly, but one of
TargetStableError or TargetTransientError. External code can therefore
rely on all (indirect) instances TargetError to be in either category.
Most existing uses of TargetError are replaced by TargetStableError.
2018-08-15 14:32:53 +01:00
241c7e01bd cgroups: fix pylin bug
In:

   commit 454b9450 ("pylint fixes")

we added:

```diff
@@ -363,7 +368,7 @@ class CgroupsModule(Module):

         # Get the list of the available controllers
         subsys = self.list_subsystems()
-        if len(subsys) == 0:
+        if subsys:
             self.logger.warning('No CGroups controller available')
             return

```

which changed the invariant condition to enabled the cgroup module:
the module is enabled we we can find a "non empty" list of subsystems.

Let's fix this to bail out on an empyt list.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2018-07-25 15:16:17 +01:00
68b418dac2 cgroups: explicitly check for proper CGroup naming
The shutils run_into support assumes that we always specify a full
cgroup path starting by "/". If, by error, we specify a cgroup name
without the leading "/" we get an ambiguous message about the cgroup not
being found.

Since this already happened to me many times, let's add an explicit
check about the cgroup name parameter to better info the user about the
requirement.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
2018-07-25 15:16:17 +01:00
454b94501c pylint fixes 2018-07-13 16:05:49 +01:00
473f37f1bc utils/ssh: Remove unused paramter from method 2018-07-13 16:05:49 +01:00
9fd690efb3 Update copyrights
- Update the year in the copyrights to match the last year the file was
  modified.
- Add the copyright header to files that did not already have one.
2018-07-04 16:01:47 +01:00
0915d97f71 module: Add devfreq module
Add support for devfreq. This is used for example to get/set the frequency
and/or governor of the GPU.
2018-06-26 12:18:06 +01:00
51452d204c module: Add sched module
This module is a collection of scheduler data getters.
2018-06-14 12:09:25 +01:00
5cafd2ec4d Add support for Python 3
Add support for running on Python 3 while maintaining Python 2
compatibility.
2018-06-07 14:45:43 +01:00
0d63386343 module/cpufreq: include policy0 in probe path
Check /sys/devices/system/cpu/cpufreq/policy0 rather than its parent
during the probe. This is to handle the edge case where cpufreq has
been enabled in the kernel, but no frequency domains have been defined
(in which case, the module should not install).
2018-06-06 15:37:10 +01:00
55762edf19 cpufreq: Add methods to retrieve max/min available frequencies for a cpu
Adds usability methods methods to allow easy retrieval of the maximum
and minimum frequencies available for a given cpu
2018-05-31 09:49:37 +01:00
be4f01ebaf cgroups: add execute as root
On latest hikey960 android image, only root can execute: cat /proc/cgroups

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
2018-05-30 11:45:34 +01:00
d6ccbb44c3 module/cpuidle: ensure get_states() returns a list
Ensure that cpuidle.get_states() always returns a list, even if no idle
states are available on the target.
2018-05-23 10:31:38 +01:00
7e39ecf142 cpufreq: add missing get_driver() method
Add a method to read the name of the driver for cpufreq policy for a
cpu.
2018-05-01 11:38:11 +01:00
f515420387 cgroups: fix Controller.tasks()
Fix cgroups tasks parsing in Controller.tasks() method, to ignore lines
that are not formatted properly.
2018-03-13 14:22:43 +00:00
d5ff73290e module/vexpress catch CalledProcessError
Depending on what goes wrong, this may also be raised.
2018-03-07 18:19:59 +00:00
0e017ddf9f module/vexpress: fix reboot for Juno
- The autoboot message in the firmware has changed; detect both the old
  and the new messages.
- Depending on where exactly the boot was interrupted, either a "reboot"
  or a "reset" may be required; so send both.
2018-03-07 18:19:59 +00:00
8f3dc05f97 cgroups.py: Add filters for the tasks() function
The tasks() function allows to get the tasks that are in a cgroup.
Filters for the tasks TID, name and cmdline have been added to the
parameters of the function such that it is possible to select the tasks
that match these patterns.

Signed-off-by: Elieva Pignat <Elieva.Pignat@arm.com>
2018-02-28 14:44:50 +00:00
002939d599 module/cpuidle: remove stray print
Remove a stray debug print which was accidentally committed.
2017-12-08 10:46:38 +00:00
dd4c37901b cpufreq: Fix list_frequencies when not available
On intel_pstate machines, we can't get a list of available CPU
frequencies. In that case, return empty list as per the docastring.
2017-12-08 09:46:58 +00:00
02384615dd Merge pull request from mdigiorgio/fix-cgroups
module/cgroups: fix typo in exists method
2017-11-15 16:00:45 +00:00
791edc297c module/cgroups: fix typo in exists method 2017-11-15 15:56:06 +00:00
e2ce5689bd module: add a gpufreq module for interacting with GPUs.
Add a module for controlling and interacting with GPUs. The module
currently supports kgsl/adreno based GPUs. This allows for querying
and setting the governor on the GPU, as well as seeing the frequencies
at which the the GPU can can operate.

Change-Id: I02bb997b51426ddaa13e1f8da375aa4c4a0d341a
2017-11-06 09:42:13 -08:00
f042646792 module/hotplug: optimize online_all
Optimize online_all by offloading it to a shutils function which only
requres a single call to the target.
2017-10-04 15:59:19 +01:00
d7ca39e4d1 module/cpuidle: optimize initialization.
Optimize cpuidle module initialization by using the new Target.grep_values
call to get information about all idle states in a single call to the
target during module intialization, rather lazily fetching them from the
target afterwards.
2017-10-04 15:59:19 +01:00
5a599f91db module/hwmon: optimize initialization.
Optimize hwmon module initialization by using the new Target.grep_values
call to get information about all HWMON devices in a single call to the
target.
2017-10-04 15:59:19 +01:00
92fb54d57b module: nicer logger name
Use Module.name rather than Module.__name__ to name the logger for
slightly more readable log output.
2017-10-04 13:21:26 +01:00
6bb24aa12a hwmon: Disable if no permissions
If we don't have permissions, scan() currently raises a
TargetError. Instead we should return False from probe() so the
module is disabled
2017-09-21 13:31:59 +01:00
f5a00140e4 Merge pull request from qperret/gem5/stats/match-regex
module/gem5stats: enhance match() with regex support
2017-08-23 17:27:46 +01:00
4b36439de8 module/cgroups: robustify task freezer
The set() method of the CGroup class used to freeze tasks relies on
target's write_value(). Sometimes, the freezing procedure takes some
time and the call to write_value() in set() fails by reading "FREEZING"
while it expected "FROZEN". To avoid this issue, this commits introduces
a shutil call dedicated to changing the state of the freezer controller.
2017-08-21 18:16:10 +01:00
3c8294c6eb module/gem5stats: better document match() and match_iter() behaviours 2017-08-21 11:12:11 +01:00
64c865de59 module: gem5stats: enhance match() with regex support
The current implementation of match() in the gem5stats module returns
records matching exactly the specified keys. This commit changes this
behaviour by matching keys over regular expressions, hence resulting in
a much more powerful match() implementation.
2017-08-21 11:12:11 +01:00
38258eb74c module: gem5stats: enable asynchronous origins in gem5 stats file
Currently, reset_origin() in the gem5stats module enables to virtually
truncate the existing dumps from the gem5 statistics file so that any
subsequent match() calls will apply only on new dumps. However, the
current implementation resets the origin of the stats file unilaterally,
without other clients knowing about it, hence leading to data being
lost.

This commits removes the reset_origin() method and provides a different
API to handle virtual truncatures in the stats file. Namely, the match()
method now takes a base_dump parameter letting clients specifiying from
which dump they want match() to apply. This feature could also be usefull
if someone wanted to add off-line processing features for statistics
files.
2017-08-16 10:40:10 +01:00
d25beb5c8b gem5stats: fix missing import for TargetError
Signed-off-by: Ionela Voinescu <ionela.voinescu@arm.com>
2017-07-27 11:07:05 +01:00
63e60401d5 module/cpufreq: rename get_domain_cpus
Rename get_domain_cpus to get_related_cpus to match cpufreq nomenclature.
2017-07-26 14:23:34 +01:00
e206e9b24a module/cpufreq: fix get_affected_cpus docstring
The docstring was duplicated from get_domain_cpus. This updates the
docstring to reflect the difference from get_domain_cpus.
2017-07-26 14:23:34 +01:00
36aa3af66d module/cpufreq: fix domain cpus.
- Use related_cpus rather than affected_cpus inside get_domain_cpus to
  return all cpus in the domain (including those online). This changes
  the behavior, but old behavior was almost certainly wrong as the
  method is memoized, and so the result should not be affected by
  hotplug.
- Add a non-memoized get_affected_cpus() which implements the old
  behavior.
2017-07-26 14:02:59 +01:00
b54dc19b81 devlib/module/thermal: Fix thermal zone disabling
Calling thermal.disable_all_zones() would raise an exception.
I've changed a few things:
* use self.zones.itervalues() in disable_all_zones to fix that exception
* renamed zone.set_mode() to zone.set_enabled()
2017-07-26 11:39:49 +01:00