In the previous patch:
cgroups: Mount cgroups controllers in devlib working dir
we changed the default mount point for devlib managed CGroups but forgot to
update the support for execution of a workload within a specified CGroup.
The run_into support is provide by a shutil script, which still has hardcoded
the old path (i.e. /sys/fs/cgroup/devlib_*). This patch fixes this by:
- resetting the default path to the Linux standard /sys/fs/cgroup
- use-sing the existing CGMOUNT env variable to specify which CGroups mount
point to use
The cgroups::run_into is also updated to use the self.cgroup_root via
CGMOUNT when the shutils' script is called.
Moreover, an additional cgroups::run_into_cmd method is added which just
returns a properly formatted run_into shutils' call.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
If a process is added to $PIDS but then exits before the
cgroups_task_move invokation finishes, then echoing its PID to
cgroups.procs results in an I/O error. If that process is the last in
$PIDS, then that failing echo command is the last of the function, so
the script exits with an error and devlib raises an exception.
Add `|| true` to avoid this problem.
On some systems CPUs sometimes remain idle for several seconds. If a
trace capture begins during one of these long idle periods, that CPU's
idle state is unknown (in practice it is probably in its deepest
available state from cpuidle's perspective but that can't be known for
sure).
The solution to the equivalent problem for cpufreq is to read the
current frequencies from sysfs and inject artificial cpu_frequency
events using trace_marker (see cpu_freq_trace_all_frequencies in
bin/scripts/shutils.in). However we can't read the current idle state
from sysfs.
Instead, wake up each CPU by executing the "true" command on it via
taskset.
The injection of a fake cpu_frequency event in the trace may end up getting
interleaved with trace events generated by the cpufreq governor, for example:
sh ... cpu_frequency: state=120000 cpu_id=0
kschedfreq ... cpu_frequency: state=120000 cpu_id=0
kschedfreq ... cpu_frequency: state=120000 cpu_id=1
kschedfreq ... cpu_frequency: state=120000 cpu_id=2
kschedfreq ... cpu_frequency: state=120000 cpu_id=3
sh ... cpu_frequency: state=120000 cpu_id=1
sh ... cpu_frequency: state=120000 cpu_id=2
sh ... cpu_frequency: state=120000 cpu_id=3
Such a trace may confuse trace parsers during postprocessing and lead to wrong
or no results.
This patch renames the events injected by devlib so that they can be easily
recognized and then used by the trace parser in the best way.
Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com>
On some targets the run_into function is not passing all params to the
called application. This patch should fix that using shift to get a list
of all command parameters.
Moreovere, we use now exec to spawn the command execution, which avoids to
generate yet another shell to run the required command.
CGroups controller can be mounted by specifying a "noprefix" option,
in which case attribute names are named as:
<mountpoint>/<attribute_name>
instead of the (more recent) naming schema using:
<mountpoint>/<contoller_name>.<attribute_name>
For example, Android uses the old format for backward compatibility
with user-space. Thus, it's possible in general to work on a target
system where some controller are mounted "noprefix" while others not.
This patchset adds a set of updates which allows to use the proper
attributes naming schema based on how the controller has been mounted.
This patch provides a more generic implementation of the get attributes
shutils which is working also for noprefix mounted controllers.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
This patch provides a couple of utility functions which makes it
easy to run a command under a specific CGroup or to move all tasks
from a group to another.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
The current code used to read the attributes values for a controller uses
a "grep '' CONTROLLER.*" under the assumption that the output is a list of
file:value
However, if there is a single controller attribute, grep does not report
the file name in output thus returning an empty list at the python side.
This patch fix that issue by also switching to the usage of a shutil
implementation of the attributes parsing code.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Functions profiling data are reported in a set of files, one for each CPU.
This patch adds the required support to collect these data into a single
JSON formatted file. Data are collected using a shutils routing on the
target side and formatted in JSON on the host side.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
This patch adds a couple of shutils functions to efficiently read all
the frequencies/governors and returne them into a dictionary indexed by
CPU id.
The shutils functions are returning a line per each CPU that can be easily
converted into a dictionary in the host side.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
This patch convert some functions to the usage of shutils provided calls.
This approach is more portable and allows to use these calls also on
an Android target.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
Some complex operations are faster if executed on the target side with the
help of a small script. For example, reading the current frequency and
or governor for all the online CPUs.
This patch adds a support script to be deployed on the target as well as
an internal utility function which allows to call functions provided by
that support script.
The support script has to be cross platform, thus:
1. only a limited set of shell functions can be used, which must be supported
both in BASH and the Android shell
2. some paths needs to be defined depending on the specific target
To address the last constrain, this patch provides a "template" script which
contains some tokens "__DEVLIB_<TOKEN>__" that are replaced right before to
push the script on the target.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>