When the quiet option is used don't print all threads stats. The first
thread will pause every 16 cycles for 10000us. This will show up in
the max values for all other threads when the final results are
printed:
# signaltest -q -D 2s
T: 0 ( 4517) P: 0 C: 3121 Min: 5 Act: 8 Avg: 8 Max: 19
T: 1 ( 4518) P: 0 C: 3121 Min: 5 Act:10065 Avg: 639 Max: 10073
We could also remove the sleep but then the system gets fully loaded
by the test. Furthermore, we would keep the path pretty hot and that's
not ideal if one wants to test the eratic signal behavior. So only
consider the first thread for the stats.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
Move the ARRAY_SIZE macro to a common header to avoid code
duplication.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
Several tests define the same time values. Move them all to
common header to avoid code duplication.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
Several test implement the same helpers. Move it to a
common header to avoid code duplication.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
Format the code with kernel coding style. Meanwhile use spdx license
identifier as suggested by John.
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
oslat was initially a standalone program [1]. This patch merges oslat into
rt-tests repo.
This is a direct port of oslat v0.1.7 into rt-tests. It naturally bumps the
version to latest rt-tests version.
[1] https://github.com/xzpeter/oslat
Signed-off-by: Peter Xu <peterx@redhat.com>
A few minor fixes to the grammar in the man page
Signed-off-by: John Kacur <jkacur@redhat.com>
Then they can be further used by other programs too.
Two trivial things to mention.
Firstly, move trace_marker out of enable_trace_mark(). No functional change.
Secondly, remove the fileprefix setting in process_options(), because if
tracelimit is non-zero, fileprefix will be after all replaced by a further call
to get_debugfileprefix() in debugfs_prepare().
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Each inversion group is three SCHED_FIFO threads, so the chances of more groups
than online cores actually getting to run is very slim. Limit the number of
groups requested to be <= the number of online cpus.
Signed-off-by: Clark Williams <williams@redhat.com>
Changing the conversion in printf to %ld since the number of online
processors is a long.
Signed-off-by: John Kacur <jkacur@redhat.com>
- Print a warning if no cyclictest instance is found.
- Also fix up the method take_snapshot for the case when the user
provides a pid.
Signed-off-by: John Kacur <jkacur@redhat.com>
Tweak the cyclictest man page with the .SY macro to make the cyclictest
command stand out apart from the options
Signed-off-by: John Kacur <jkacur@redhat.com>
Improvements to the python style in get_cyclictest_snapshot
- Add comments to the methods, functions, class and moduleb
- Put imports on individual lines
- Use "is" and "is not" with None insteald of == or !=
- Don't compare the length of lists to zero, to determine if they are
empty
Signed-off-by: John Kacur <jkacur@redhat.com>
The infomation "pid = xxx" is printed with other infomation on the same
line. so remove this left over debug message in rstat_shm_open().
Signed-off-by: yeyunfeng <yeyunfeng@huawei.com>
Edited the descriptioin in the log a little bit.
Signed-off-by: John Kacur <jkacur@redhat.com>
queuelat can occassionally hang because of overflow mixing
unsigned long long and int
Attaching to process 173912
Reading symbols from /root/rt-tests/queuelat...done.
Reading symbols from /lib64/librt.so.1...Reading symbols from /usr/lib/debug/usr/lib64/librt-2.28.so.debug...done.
done.
Reading symbols from /lib64/libpthread.so.0...Reading symbols from /usr/lib/debug/usr/lib64/libpthread-2.28.so.debug...done.
done.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Reading symbols from /lib64/libc.so.6...Reading symbols from /usr/lib/debug/usr/lib64/libc-2.28.so.debug...done.
done.
Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from /usr/lib/debug/usr/lib64/ld-2.28.so.debug...done.
done.
__memmove_avx_unaligned_erms ()
at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:254
254 rep movsb
(gdb) c
Continuing.
Program received signal SIGSEGV, Segmentation fault.
0x0000000000400c02 in account (val=18446744071562067968)
at src/queuelat/queuelat.c:93
93 buckets[bucket_nr]++;
(gdb) bt full
at src/queuelat/queuelat.c:93
bucket_nr = -193273529
a = 825932047802952
b = 825925371232340
dest = 0xf322b0
src = 0xf4e3f0
i = 45749
delta = -2147483648
loops = 50000
time = 6500
bucket_nr = 65
n = 115000
delta = 3500
at src/queuelat/queuelat.c:671
tsc_freq_mhz = 2398.5039999999999
max_queue_len_f = 159.900284
mvalue = 0x7ffc99d3021c "20000"
cvalue = 0x7ffc99d30225 "300"
pvalue = 0x7ffc99d30238 "6.1"
fvalue = 0x7ffc99d3022c "2398.504"
tvalue = 0x7ffc99d3023f "30"
qvalue = 0x0
index = 0
c = -1
Fix the above by declaring delta as an unsigned long long
Signed-off-by: John Kacur <jkacur@redhat.com>
The commit 6c0c79b515 ("hackbench mods to work better under stress")
add -F|--fifo option, but not update the usage and man page, so this
patch fix it.
Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
- Fixed-up rejected patch hunk in man page
- Changed the wording in the man page
On large NUMA machines still getting the following error
WARN: Couldn't setaffinity in main thread: Invalid argument
Instead of calling numa_bitmask_alloc() with max_cpus, use
numa_allocate_cpumask() to fix this.
Also, make sure numa_available() is called before any other calls to the
numa library. Depending on how the options were invoked this could
happen in parse_cpumask for example. Note, this did not seem to cause
any problems in practice, but let's adhere to the library contract.
Signed-off-by: John Kacur <jkacur@redhat.com>
An Error occurs when run: ./cyclictest -v -t 5 -p 80 -i 1000 -a 3
parse_cpumask: Using 0 cpus.
Max CPUs = 96
WARN: Couldn't setaffinity in main thread: Invalid argument
# /dev/cpu_dma_latency set to 0us
FATAL: No allowable cpus to run on
We find that numa_bitmask_alloc() is used incorrectly in
use_current_cpuset(), it should pass the number of cpus as parameters,
not the sizeof(struct bitmask), which is only 8 bytes.
The syscall sched_getaffinity will check the parameters, if using
sizeof(struct bitmask), it will fail when cpus is more:
SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
unsigned long __user *, user_mask_ptr)
{
int ret;
cpumask_var_t mask;
if ((len * BITS_PER_BYTE) < nr_cpu_ids)
return -EINVAL;
Fix it by passing max_cpus as parameters to numa_bitmask_alloc().
Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Fix -t without a specified [NUM] to run the same number of threads as
available processors.
Currently it runs the same number of threads as cpus on a system.
However, if cyclictest is contrained to run on a smaller set of cpus
either because of a container or a user specified affinity or a
combination of the two, then the actual number of available cpus is
smaller. -t should reflect that.
Signed-off-by: John Kacur <jkacur@redhat.com>
There is no reason that the main thread should be treated differently,
so apply the affinity setting there too.
Signed-off-by: John Kacur <jkacur@redhat.com>
We announced way back in 2015 that compiling without the NUMA libs was
no-longer supported, but we left the bits in there for you to do it
anyway.
Since this is not supported, and is broken now anyway, let's remove the
cruft.
Of course running on non-NUMA machines should still work fine.
Signed-off-by: John Kacur <jkacur@redhat.com>
We assume that numa_parse_cpustring_all() is available.
Older numa libs without it are no-longer supported
Signed-off-by: John Kacur <jkacur@redhat.com>
Currently if the user passes the affinity to cyclictest, threads are run
there even if they should be excluded according to the affinity of the
runtime environment.
For example
taskset -c 4-7 cyclictest -t -a 1-6
Should run on the interesection of this, that is on cpus 4,5,6
Fix this so it works as expected
Note, one caveat, this apply to the threads that cyclictest creates, but
only the initial taskset applies to the main cyclictest thread, so the
main thread can run on cpus 4,5,6 and 7
Signed-off-by: John Kacur <jkacur@redhat.com>
Right now cyclictest acts as if it owns the machine. If you don't
specify the affinity with -a [CPUSET] it will run threads on all cpus.
Change this to only run on cpus according to the affinity.
For example.
taskset -c 0-3 ./cyclictest -t
will only affect the main thread and limit it that to cpus 0-3 but the
threads that are spun off can run anywhere, with this change all threads
will be limited to cpus 0-3
Signed-off-by: John Kacur <jkacur@redhat.com>
The case in which the user specifies the affinity with a space and a
leading exclamation mark was not working. For example
./cyclictest -t -a'!4-5'
was working correctly, but the following was not.
./cyclictest -t -a '!4-5'
Fix this by recognizing this input as a non-error case.
Signed-off-by: John Kacur <jkacur@redhat.com>
-/cyclictest -t -a1-4
./cyclictest -t -a 1-4
./cyclictest -t -a0-4
all work as expected, but
./cyclictest -t -a 0-4
did not work, and instead AFFINITY_USEALL was set.
This is because atoi(argv[optind]) returns 0 for parsing non-numbers,
and this was treated as an error.
This missed the case where the user intentionally passes a 0 which
should not be treated as an error.
Fix this by testing for this case.
Signed-off-by: John Kacur <jkacur@redhat.com>
On error pthread_setaffinity_np returns a non-zero number.
Make sure cyclictest prints a warning in all such cases.
Signed-off-by: John Kacur <jkacur@redhat.com>
Add -n to gzip call to make the build output
of the manpages reproducible.
Signed-off-by: Jeremy A. Puhlman <jpuhlman@mvista.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Add a python script to get the current status of running cyclictest
instances.
There are a few options as explained in the online help, but you can
simply run it without any options to get the status of all instances.
Signed-off-by: John Kacur <jkacur@redhat.com>
If SIGUSR2 is sent more than once to cyclictest, truncate the shared
memory file for writing the latest snapshot.
Signed-off-by: John Kacur <jkacur@redhat.com>
When running multiple instances of cyclictest, getting a snapshot from
one will overwrite any snapshots from other instances.
So, create a different shm_file based on the pid for each instance.
For example if you have two instances of cyclictest running
ls /dev/shm/
cyclictest8264 cyclictest8276
You can also use the pid from the file name to know where to send
SIGUSR2
Signed-off-by: John Kacur <jkacur@redhat.com>
Currently the man pages are unconditionally gzip compressed. However, users
might want to use something else such as bzip2 or none.
When using package management systems it makes sense to use no compression at
all, as the package system might chose the appropriate one. Therefore, introduce
MAN_COMPRESSION. This variable is handling how the compression is done. Default
is gzip.
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
- Make sure that help is displayed and not just the message
"Unknown option" when the options are incorrect.
- Add -q to the man page and to the print_help()
Signed-off-by: John Kacur <jkacur@redhat.com>
- Update the man page with the -s or --smp option
- Reorder the program help to match the man page
- Make the -h option work correctly
Signed-off-by: John Kacur <jkacur@redhat.com>
Fix a number of issues in the script determine_maximum_mpps.sh such as
1. Convert legacy backticks to $(...) notation
2. Double quote where necessary to prevent globbing
3. Double quote where necessary to prevent word splitting.
Note: these fixes are more than just cosmetic, they are needed for the
script to work correctly.
Signed-off-by: John Kacur <jkacur@redhat.com>
get_cpuinfo_mhz.sh greps for the Mhz from the /proc/cpuinfo file
It assumes that for multiple cpus the value will be the same, and
intends to return one value using uniq as a filter.
Typically the reported Mhz values can all be slightly different though
It would probably be good enough to simply take the first match as a
heuristic, but to be safe, take the highest number.
Also replace the legacy backticks with the modern $(...) construct, and
quote the $mhz variable.
Signed-off-by: John Kacur <jkacur@redhat.com>
Sync the man page with help.
Specifically, remove the signal option which is not supported and
document the sched option
Signed-off-by: John Kacur <jkacur@redhat.com>
Add short options to usage message. Note, the options all ready exist,
they simply were not documented in the usage message.
Signed-off-by: John Kacur <jkacur@redhat.com>
The script determine_maximum_mpps.sh in queuelat hard codes the path to
queuelat. Assume that it is in the path.
Signed-off-by: John Kacur <jkacur@redhat.com>