Commit Graph

997 Commits

Author SHA1 Message Date
Marcelo Tosatti 4ad6aa8141 cyclictest: remove inclusion of unnecessary headers
The following three headers seem to be unnecessary,
and do not exist on FreeBSD.

Remove them.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
2023-06-01 10:44:06 -04:00
John Kacur eb18c75481 rt-tests: Makefile: Use sysconfig instead of distutils for PYLIB
Use sysconfig instead of distutils for PYLIB
Version 2 takes into consideration that different versions of python
produce different results.

Signed-off-by: John Kacur <jkacur@redhat.com>
2023-02-15 17:10:37 -05:00
Costa Shulyupin 96e7809383 rt-tests: hwlatdetect: Add field cpu to samples output
Information about CPU index is valuable for debugging
latency issues

Signed-off-by: John Kacur <jkacur@redhat.com>
2023-02-13 17:28:17 -05:00
John Kacur 37b70ea17d rt-tests: deadline_test: Fix spelling to "single" in comment
Fix the spelling in the comments before bind_cpu()
from "sigle" to "single".

Signed-off-by: John Kacur <jkacur@redhat.com>
2023-02-10 14:57:38 -05:00
John Kacur 4579b9a6d8 rt-tests: Change to version v2.5
Change the version in the Makefile to 2.5
tag this commit as v2.5

Signed-off-by: John Kacur <jkacur@redhat.com>
2023-01-20 15:36:37 -05:00
Sebastian Andrzej Siewior 6c99a5c6ff rt-numa: Use a reasonable default max CPU value.
numa_num_task_cpus() returns here > 100 CPUs while the system has only
32 populated. The BIOS assumes that I can probably use larger CPUs (with
more cores) on the socket so the number of "configured CPUs" is rather
high.

It makes sense to use the current affinity instead of looking
at the number of possible CPUs which could be brought online.
It still depends on the affinity of the created threads
if the additional CPUs can be used. In a container setup
this may not be the case.

Use sched_getaffinity() to figure out the number of possible CPUs.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
- Edited the commit message to remove reference to -S
Signed-off-by: John Kacur <jkacur@redhat.com>
2023-01-19 14:43:41 -05:00
Crystal Wood cbec2872f7 oslat: Add command line option for bucket width
New option -W/--bucket-width allows the user to specify how large of a
range of latencies is covered by a single bucket, including allowing the
creation of sub-microsecond buckets.

When the flag is not used, output should be unchanged.  However, if a
bucket width is specified that is not a multiple of one microsecond,
latencies will be output as fractional microseconds, at nanosecond
precision.  This includes JSON output.

When using this option, it is up to the user to determine what level
of precision is meaningful relative to measurement error, as is noted
in the documentation.

Signed-off-by: Crystal Wood <swood@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
2022-12-14 10:30:07 -05:00
John Kacur 8c7532b710 rt-tests: hwlatdetect: Fix incorrect comment about testduration
At some point
self.testduration = 10
was changed to
self.testduration = 30

but retained the comment, "ten seconds"

Just change the comment to say, "in seconds" so it's clear what unit
we are talking about.

Signed-off-by: John Kacur <jkacur@redhat.com>
2022-11-11 14:48:15 -05:00
Leah Leshchinsky 1eaa7feae3 rt-tests: hwlatdetect: Update to integer division
In Python 3, "/" is a float division operator, as opposed to Python 2,
which defaults to integer division. This results in an error when
calculating width, which assumes an integer.

Update width division to integer division with the "//" operator.

Signed-off-by: Leah Leshchinsky <lleshchi@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
2022-11-11 14:43:34 -05:00
Leah Leshchinsky d9acad79fa rt-tests: hwlatdetect.py Covert to f-strings
Add f-strings where applicable for readability.

Signed-off-by: Leah Leshchinsky <lleshchi@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
2022-11-11 14:29:18 -05:00
John Kacur adb33d3300 rt-tests: rt_numa.h: Remove unused paramter max_cpus
Remove unused parameter max_cpus.
Note it doesn't appear that this function is currently being called

Signed-off-by: John Kacur <jkacur@redhat.com>
2022-11-03 12:48:36 -04:00
John Kacur f10b5329ae rt-tests: hackbench: Fix compile warning about fall through
print_usage_exit(0) never returns, but the compiler doesn't understand
this. In any case it is not harmful to add a break after this statement.
Do so to keep the unhelpful compiler warning from triggering.

Signed-off-by: John Kacur <jkacur@redhat.com>
2022-11-03 12:48:36 -04:00
John Kacur ca89bc8f63 rt-tests: hackbench: Fix compile comparison of different signed ints
Fix compile warnings about comparisons of integers of different
signedness.

Signed-off-by: John Kacur <jkacur@redhat.com>
2022-11-03 12:48:36 -04:00
John Kacur c7768aae2e rt-tests: hackbench: Add error checking to connect and getsockname
Add error checking around the calls connect and getsockname

Signed-off-by: John Kacur <jkacur@redhat.com>
2022-11-03 12:48:36 -04:00
John Kacur d356a6ae3c rt-tests: Remove arbitrary num of threads limits
Remove the arbitrary limit to the number of threads in pmqtest,
ptsematest, sigwaittest and svsematest.

Signed-off-by: John Kacur <jkacur@redhat.com>
2022-10-06 16:00:44 -04:00
John Stultz 2d910eecf1 cyclictest: Fix threads being affined even when -a isn't set
Using cyclictest without specifying affinity via -a, I was
noticing a strange issue where the rt threads where not
migrating when being blocked.

After lots of debugging in the kernel, I found its actually an
issue with cyclictest.

When using -t there is no behavioral difference between specifying
-a or not specifying -a.

This can be confirmed by adding printf messages around the
pthread_setaffinity_np() call in the threadtest function.

Currently:

root@localhost:~/rt-tests# ./cyclictest -t -a -q -D1
Affining thread 0 to cpu: 0
Affining thread 1 to cpu: 1
Affining thread 2 to cpu: 2
Affining thread 3 to cpu: 3
Affining thread 4 to cpu: 4
Affining thread 5 to cpu: 5
Affining thread 7 to cpu: 7
Affining thread 6 to cpu: 6
T: 0 (15034) P: 0 I:1000 C:   1000 Min:     82 Act:  184 Avg:  180 Max: 705
...

root@localhost:~/rt-tests# ./cyclictest -t -q -D1
Affining thread 0 to cpu: 0
Affining thread 1 to cpu: 1
Affining thread 2 to cpu: 2
Affining thread 3 to cpu: 3
Affining thread 4 to cpu: 4
Affining thread 5 to cpu: 5
Affining thread 6 to cpu: 6
Affining thread 7 to cpu: 7
T: 0 (15044) P: 0 I:1000 C:   1000 Min:     74 Act:  144 Avg:  162 Max: 860
..

This issue seems to come from the logic in process_options():
	/* if smp wasn't requested, test for numa automatically */
	if (!smp) {
		numa = numa_initialize();
		if (setaffinity == AFFINITY_UNSPECIFIED)
			setaffinity = AFFINITY_USEALL;
        }

Here, by setting setaffinity = AFFINITY_USEALL, we effectively
pin each thread to its respective cpu, same as the "-a" option.

This was most recently introduced in commit bdb8350f1b
("Revert "cyclictest: Use affinity_mask for steering
thread placement"").

This seems erronious to me, so I wanted to share this patch
which removes the overriding AFFINITY_UNSPECIFIED with
AFFINITY_USEALL by default. Also, some additional tweaks to
preserve the existing numa allocation affinity.

With this patch, we no longer call pthread_setaffinity_np() in the
"./cyclictest -t -q -D1"  case.

Cc: John Kacur <jkacur@redhat.com>
Cc: Connor O'Brien <connoro@google.com>
Cc: Qais Yousef <qais.yousef@arm.com>
Signed-off-by: John Stultz <jstultz@google.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
2022-08-11 13:35:51 -04:00
John Kacur ca4a6293da rt-tests: Change to version v2.4
Change the version in the Makefile to 2.4
tag this commit as v2.4

Signed-off-by: John Kacur <jkacur@redhat.com>
2022-07-08 10:46:01 -04:00
Song Chen 4692d35e41 sched_deadline/cyclicdeadline: add tracelimit
cyclictest has tracelimit to stop running when max latency
is higher than threshold but cyclicdeadline doesn't.

Therefore, tracelimit is introduced to cyclicdeadline in
this commit, once max latency is over, test stops and log
prints at the bottom of the ftrace file.

Signed-off-by: Song Chen <chensong_2000@189.cn>
Reviewed-by: Daniel Wagner <wagi@monom.org>
- Fixed style problems reported by checkpatch from kernel, namely
- Don't initialize static to 0
- no space after open parenthesis
- removed multiple spaces after Reviewed-by
Signed-off-by: John Kacur <jkacur@redhat.com>
2022-07-07 15:23:56 -04:00
John Kacur ae90fa3bc0 rt-tests: cyclictest: Fix seg fault for verbose with no affinity maxk
Using verbose with affinity and no affinity mask causes a
segmentation mask. Fix this by checking if the affinity mask is NULL
before printing the verbose message.

Reported-by: Pierre Gondois <pierre.gondois@arm.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
2022-06-29 11:23:22 -04:00
Sebastian Andrzej Siewior c58720de41 cyclictest: Delay setting of main_affinity_mask after creating threads.
Assuming the current affinity mask of the task is 0x31 (CPUs 0, 4, 5).
Starting cyclictest with '-S' option will fork the following threads:
- monitor, mask 0x31
- measure thread 1, mask 0x01
- measure thread 2, mask 0x10
- measure thread 3, mask 0x20

works as expected. Using the options '-S --mainaffinity=0' leads to:
- monitor, mask 0x01
- measure thread 1, mask 0x01
- measure thread 2, mask 0x01
- measure thread 3, mask 0x01

because the mask of the main thread has been reset early to 0x01 and
does not allow a CPU mask outside of this mask while setting the
affinity for the new threads.

Delay setting the affinity of the main/ monitor thread after the
measuring threads have been deployed. This leads to the following
state:
- monitor, mask 0x01
- measure thread 1, mask 0x01
- measure thread 2, mask 0x10
- measure thread 3, mask 0x20

Signed-off-by: Sebastian Andrzej Savior <bigeasy@linutronix.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
2022-06-29 10:51:17 -04:00
Yihao Wu 1b28b9425f hackbench: Add af_inet mode besides af_unix and pipe
We observerved strange performance regression with hackbench, but only with
its default mode instead of pipe mode. It turned out it was unix domain
socket to blame rather than the scheduler. Because on older kernels, there
was a big lock. And modifications to the scheduler made the contension
worse.

However pipe mode is much different from the default af_unix mode. So it's
hard to prove it's really the case. So we think it might be a good idea to
have af_inet mode for hackbench.

After implementing it, we compare these three modes. And the result shows
as what we expect, that only af_unix mode has regression, the others don't.
This proves adding af_inet mode is valuable.

Signed-off-by: Yihao Wu <wuyihao@linux.alibaba.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
2022-06-24 12:19:53 -04:00
John Kacur 974241c78a rt-tests: Makefile: ctags: Change obsolete extra to extras
Change obsolete extra to extras in ctags

Signed-off-by: John Kacur <jkacur@redhat.com>
2022-06-23 16:05:56 -04:00
John Kacur d7f457b5f8 rt-tests: Remove classic_pi
This very early program in the rt-tests suite has been completed
rewritten and is now called pi_stress. There is no reason to keep these
old files around.

Signed-off-by: John Kacur <jkacur@redhat.com>
2022-05-10 14:11:17 -04:00
bartwensley 9d6093b0c1 rt-tests: resync has_smi_counter with turbostat code
Updating has_smi_counter to match most recent turbostat code, in
order to support recent cpu models (e.g. Ice Lake).

Restructured the code to match the turbostat functions so it will
be easier to keep the code in sync in the future.

Signed-off-by: Bart Wensley <bwensley@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
2022-05-09 15:19:36 -04:00
Oscar Shiang 6f5ac3d20a rt-tests: hwlatdetect: Add option to specify cpumask
The hwlat tracer can be configured to run on a set of cpus via
tracing_cpumask [1].

Add a new option cpu-list to support the configuration of
tracing_cpumask in the format of cpu list.

For example, if we want the thread to run on CPU 1,2,3 and 5,
we can specify the cpu list to 1-3,5

The value to pass to hwlatdetect is:

    $ hwlatdetect --cpu-list=1-3,5

[1]: https://docs.kernel.org/trace/hwlat_detector.html

Signed-off-by: Oscar Shiang <oscar0225@livemail.tw>
Signed-off-by: John Kacur <jkacur@redhat.com>
2022-04-16 16:06:24 -04:00
Nicolas Saenz Julienne 7740534f3d oslat: Print offending cpu number when above threshold
Knowing which CPU went above the trace threshold is useful information,
even when not tracing. So let's print it.

Signed-off-by: Nicolas Saenz Julienne <nsaenzju@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
2022-04-13 11:40:55 -04:00
Liwei Song 2af2bc2bbf rt-migrate-test: increase the buf size to 2048 when parse cpuinfo
When parse /proc/cpuinfo, the size of "flags" may exceed 1024,
this will cause "realloc(): invalid next size" error, increase
the buf size to 2048 to fix this case.

Signed-off-by: Liwei Song <liwei.song@windriver.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
2022-02-15 17:08:07 -05:00
Marcelo Tosatti 795433f50f rt-numa: ignore runtime cpumask if -a CPULIST is specified
When using isolcpus kernel command line option, the CPUs
specified at isolcpus= are not part of the run time environment
cpumask.

This causes "cyclictest -a isolatedcpus" to fail with:

WARN: Couldn't setaffinity in main thread: Invalid argument
FATAL: No allowable cpus to run on
 # /dev/cpu_dma_latency set to 0us

To fix this, ignore the runtime cpumask if neither "+", "!"
are specified in the cpu list string.

Suggested by Sebastian Andrzej Siewior.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

v2: fix changelog typo
v3: simplified version (John Kacur)

Signed-off-by: John Kacur <jkacur@redhat.com>
2022-01-28 16:09:57 -05:00
John Kacur 4fac6f28af rt-tests: Fix parsing of affinity when there is a space.
Make sure that -a all and -a '+' are passed to parse_cpumask().
Currently this doesn't work correctly if there is a space after -a and the
string.

While we are at it, fix the message in oslat which calls
numa_parse_cpustring_all directly to say that.

Signed-off-by: John Kacur <jkacur@redhat.com>
2022-01-28 12:57:16 -05:00
Oscar Shiang d2ded8b1e8 rt-tests: oslat.8: Remove the argument of --bias
The option --bias does not require an argument and the bias should
be estimated later.

There is no need to provide USEC to --bias option.

Signed-off-by: Oscar Shiang <oscar0225@livemail.tw>
Signed-off-by: John Kacur <jkacur@redhat.com>
2022-01-01 16:18:03 -05:00
Oscar Shiang d83bc06e1f rt-numa: Correct the comment of numa_initialize()
numa_initialize() returns 0 only when numa_available() returns -1,
which means that libnuma is unavailable.

The return values in the comment should be corrected to 1 if all
functions are available and 0 when the functions are unavailable.

Signed-off-by: Oscar Shiang <oscar0225@livemail.tw>
Signed-off-by: John Kacur <jkacur@redhat.com>
2021-12-25 11:41:44 -05:00
John Kacur 338843c1ee rt-tests: Change to version 2.3
Change the version in the Makefile to 2.3

Signed-off-by: John Kacur <jkacur@redhat.com>
2021-12-10 12:59:55 -05:00
John Kacur ab6efa49af rt-tests: deadline_test: Fix typo "highes"
Fix typo of "highes" to "highest" in deadline_test

Signed-off-by: John Kacur <jkacur@redhat.com>
2021-11-22 12:01:12 -05:00
Oscar Shiang c96e77dc74 rt-tests: cyclictest.8: Remove reference to -n in --system in manpage
clock_nanosleep is default now.
There is no need to use -s with -n.

Signed-off-by: Oscar Shiang <oscar0225@livemail.tw>
Signed-off-by: John Kacur <jkacur@redhat.com>
2021-11-21 23:05:23 -05:00
John Kacur 47e857d4bf rt-tests: cyclicdeadline: Fix double mount of cgroups
If /sys/fs/cgroup exists and it is type cgroup2, cyclicdeadline mounts it a
second time as cgroup.

systemd is creating cgroup2 for logins and this can hang the machine and
not allow logins.

Fix this by:

If /sys/fs/cgroup exists, then use it for cyclicdeadline_test.

If it exists but the type is not recognized, exit with an error.
Do not simply mount it as type cgroup.

TODO: If the file doesn't exit but cgroups are supported in the kernel,
the file could be created and mounted.

Signed-off-by: John Kacur <jkacur@redhat.com>
2021-11-19 11:44:18 -05:00
John Kacur c88f1a8baa rt-tests: deadline_test: Fix double mount of cgroups
If /sys/fs/cgroup exists and it is type cgroup2, deadline mounts it a
second time as cgroup.

systemd is creating cgroup2 for logins and this can hang the machine and
not allow logins.

Fix this by:

If /sys/fs/cgroup exists, then use it for deadline_test.

If it exists but the type is not recognized, exit with an error.
Do not simply mount it as type cgroup.

TODO: If the file doesn't exit but cgroups are supported in the kernel,
the file could be created and mounted.

Signed-off-by: John Kacur <jkacur@redhat.com>
2021-11-19 11:44:07 -05:00
Punit Agrawal 7fc6e80b21 rt-tests: cyclictest: Drop unnecessary variable "bufsize"
Two copies of "bufsize", initialised with the same value are declared
in enclosed blocks. Remove the redundant declaration.

Signed-off-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Signed-off-by: John Kacur <jkacur@redhat.com>
2021-11-11 15:35:39 -05:00
Punit Agrawal b1f89cadcb rt-tests: cyclictest: Simplify duplicate initialization of "stop"
The timespec structure "stop" is initialised whether it is used or not
as the compiler is not smart enough to figure out that it's use is
always guarded by the "duration" variable. As a result, "stop" needs
to be initialised whether it's used or not to avoid a compiler
warning.

Replace the duplicate memset statements by initializing "stop" using
structure initialiser.

Signed-off-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Signed-off-by: John Kacur <jkacur@redhat.com>
2021-11-11 15:29:18 -05:00
Punit Agrawal 85d13f3e71 rt-tests: cyclictest: Drop unused defines
KVARS, KVARNAMELEN and KVALUELEN defines are not used in
cyclictest. Drop them.

Signed-off-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Signed-off-by: John Kacur <jkacur@redhat.com>
2021-11-11 15:27:49 -05:00
John Kacur a5b824f9ed rt-tests: hwlatdetect: Don't use built-in name str as a variable
- Don't use built-in name "str" as a variable
- Add some more docstrings to methods

Signed-off-by: John Kacur <jkacur@redhat.com>
2021-11-11 14:52:18 -05:00
John Kacur 6293cf61fb rt-tests: hwlatdetect: Remove unused class Kmod
- Remove class Kmod
  Kmod was used for loading and unloading of a kernel module, but
  hwlatdetect uses ftrace now so this class is unneeded.
- Improve the spacing in the code

Signed-off-by: John Kacur <jkacur@redhat.com>
2021-11-11 12:48:16 -05:00
John Kacur d8d954f896 rt-tests: hwlatdetect: Use abstractmethod decorator
- Use abstractmethod decorator instead of raising error if a method is
  not overridden.
- Remove unnecessary trailing comma
- fix import order

Signed-off-by: John Kacur <jkacur@redhat.com>
2021-11-11 11:41:52 -05:00
John Kacur e4e74e2cd1 rt-tests: hwlatdetect: Remove class Hwlat
hwlatdetect converted to using ftrace a long time ago.
Since we no longer need to load a kernel module, the class Hwlat can be
removed.

Signed-off-by: John Kacur <jkacur@redhat.com>
2021-11-11 11:06:53 -05:00
John Kacur b127901601 rt-tests: hwlatdetect: Keep consistent name from abstract method
Keep the variable name consistent between the abstract method and the
method overriding it.

Signed-off-by: John Kacur <jkacur@redhat.com>
2021-11-11 10:23:59 -05:00
John Kacur 665bf912d2 rt-tests: hwlatdetect: Use python3 style super()
Use python3 style super(), no need to specify __class__ and self

Signed-off-by: John Kacur <jkacur@redhat.com>
2021-11-11 10:16:51 -05:00
John Kacur c6f4d83054 rt-tests: hwlatdetect: Use "with" for opening files
Use "with" for opening files

Signed-off-by: John Kacur <jkacur@redhat.com>
2021-11-11 10:13:29 -05:00
John Kacur b7ef01dfe0 rt-tests: hwlatdetect: Remove unnessary parens after return
Remove unnecessary parens after return

Signed-off-by: John Kacur <jkacur@redhat.com>
2021-11-11 09:41:59 -05:00
John Kacur 63fb2b0249 rt-tests: get_cyclictest_snapshot: print_warning should be a classmethod
Make print_warning a class method since it only references a class
variable and doesn't require self

Signed-off-by: John Kacur <jkacur@redhat.com>
2021-11-11 09:36:28 -05:00
John Kacur 331e3f0c3c rt-tests: cyclictest: Check user supplies an value to histogram
histogram and histofall take a required argument.

If the user fails to supply one, display the help and exit with an error

Signed-off-by: John Kacur <jkacur@redhat.com>
2021-11-11 09:02:01 -05:00
John Kacur 6a3dd40539 rt-tests: deadline_tests: Null check to prevent floating point exception
Fix a floating point exception that can occur if sd->nr_adjust is 0
by checking it before performing a division by zero.

Signed-off-by: John Kacur <jkacur@redhat.com>
2021-11-11 08:56:54 -05:00