Commit Graph

997 Commits

Author SHA1 Message Date
Peter Xu c86dec5765 rt-tests: oslat: Init commit
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>
2020-08-18 16:48:08 -04:00
Peter Xu dc433f68c9 rt-tests: cyclictest: Move ftrace helpers into rt-utils.[ch]
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>
2020-08-18 16:28:25 -04:00
Clark Williams 3359c4464c pi_stress: limit the number of inversion groups to the number of online cores
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>
2020-07-22 18:54:49 -04:00
John Kacur 7731b805fa rt-tests: Install new man page get_cyclictest_snapshot.8
Install the new man page, get_cyclictest_snapshot.8

Signed-off-by: John Kacur <jkacur@redhat.com>
2020-07-06 23:19:24 -04:00
John Kacur c7b4217ff2 rt-tests: get_cyclictest_snapshot: Warn if no cyclictest instance found
- 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>
2020-07-06 16:27:24 -04:00
John Kacur 4022d106c0 rt-tests: Add some files like get_cyclictest_snapshot to .gitignore
Add some files like get_cyclictest_snapshot and .xz files etc

Signed-off-by: John Kacur <jkacur@redhat.com>
2020-07-06 16:27:24 -04:00
John Kacur 89f9ce0077 rt-tests: Tweak the cyclictest man page
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>
2020-07-06 16:27:24 -04:00
John Kacur 82aa302cc1 rt-tests: Add a man page for get_cyclictest_snapshot
Add a man page for get_cyclictest_snapshot based on -h

Signed-off-by: John Kacur <jkacur@redhat.com>
2020-07-06 16:27:24 -04:00
John Kacur e554f3d5d9 rt-tests: ptsematest.8: Update the ptsematest man page
The smp option should be a capital (-S)
Also fix the update synopsis to include missing and options

Signed-off-by: John Kacur <jkacur@redhat.com>
2020-07-06 16:27:24 -04:00
John Kacur 868ee948b6 rt-tests: pi_stress.8: Remove unused -t n from the manpage
The -t option was replaced with the -D, --duration=TIME option
Remove it from the manpage as well.

Signed-off-by: John Kacur <jkacur@redhat.com>
2020-07-06 16:27:24 -04:00
John Kacur 3ee764c75d rt-tests: improvements to the python style in get_cyclictest_snapshot
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>
2020-07-06 16:26:56 -04:00
Yunfeng Ye caaec484d8 rt-tests: cyclictest: remove the debug log "pid = xxx" in rstat_shm_open()
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>
2020-07-02 14:38:02 -04:00
John Kacur 41a3f9e539 rt-tests: queuelat: Fix storing unsigned long long in int
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>
2020-05-12 11:08:29 -04:00
Yunfeng Ye e68eb4f37e rt-tests: hachbench: Update the usage and man page for -F|--fifo option
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
2020-05-05 12:34:37 -04:00
John Kacur 56aae2fd7f cyclictest: Fix setaffinity error on large NUMA machines
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>
2020-05-04 11:54:49 -04:00
Yunfeng Ye 7b800e897f rt-tests: cyclictest: Fix -a option fail when max_cpus is more
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>
2020-04-24 16:59:02 -04:00
John Kacur 9f78b91f05 rt-tests: Makefile - update version
Update the version in the Makefile to 1.8

Signed-off-by: John Kacur <jkacur@redhat.com>
2020-03-09 14:44:20 -04:00
John Kacur f240656b05 rt-tests: cyclictest: Fix -t without a user specified [NUM]
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>
2020-03-04 16:51:40 -05:00
John Kacur 8bc0249b47 rt-tests: cyclictest: Make the affinity mask apply to the main thread too
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>
2020-03-04 13:18:29 -05:00
John Kacur 240938737e rt-tests: cyclictest: Remove support for compiling without NUMA
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>
2020-03-04 10:42:14 -05:00
John Kacur 8ec141339d rt-tests: cyclictest: Remove HAVE_PARSE_CPUSTRING_ALL
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>
2020-03-02 23:44:52 -05:00
John Kacur aaa57168df rt-tests: cyclictest: Only run on runtime affinity and user supplied affinity
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>
2020-03-02 16:22:35 -05:00
John Kacur 7093e20416 rt-tests: cyclictest: Only run on available cpus according to the affinity
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>
2020-03-02 13:44:13 -05:00
John Kacur 8a684c3db4 rt-tests: cyclictest: Fix parsing affinity with leading exclamation mark
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>
2020-03-02 08:44:57 -05:00
John Kacur 164e6251b3 rt-tests: cyclictest: Fix parsing affinity with a space and a leading zero
-/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>
2020-03-02 08:39:06 -05:00
John Kacur 96d9f54eb0 rt-tests: cyclictest: Report all errors from pthread_setaffinity_np
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>
2020-03-02 08:39:06 -05:00
John Kacur 32d41f28aa rt-tests: cyclictest: Set errno to 0 before call to mlock
Set errno to 0 before the call to mlock in rstat_mlock()

Signed-off-by: John Kacur <jkacur@redhat.com>
2020-02-28 09:41:00 -05:00
Jeremy Puhlman 9c454c773e rt-tests: make manpages builds reproducible
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>
2020-02-27 13:28:49 -05:00
John Kacur 61d1fc6a1b rt-tests: Makefile - update version
Update the version in the Makefile to 1.7

Signed-off-by: John Kacur <jkacur@redhat.com>
2020-02-21 15:58:31 -05:00
John Kacur 63a2aa9ec5 rt-tests: Add get_cyclictest_snapshot to Makefile
Add get_cyclictest_snapshot to Makefile

Signed-off-by: John Kacur <jkacur@redhat.com>
2020-02-21 15:53:54 -05:00
John Kacur f6581f32d8 rt-tests: Add the get_cyclictest_snapshot.py utility
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>
2020-02-18 14:48:35 -05:00
John Kacur c63e1f24ee rt-tests: cyclictest: truncate shm files to zero when USR2 received
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>
2020-02-13 23:49:16 -05:00
John Kacur 53c4c41364 rt-tests: Use a distinct shm file for each cyclictest instance
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>
2020-02-04 12:33:16 -05:00
Kurt Kanzenbach d8de8e8e5d make: Make man page compression configurable
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>
2020-01-30 12:19:55 -05:00
John Kacur 7437ee24d0 rt-tests: svsematest: Display help with an error message for -h
Display help without an error message if the user uses the -h option

Signed-off-by: John Kacur <jkacur@redhat.com>
2020-01-23 19:59:26 +01:00
John Kacur d823298c8b rt-tests: queuelat: Fixes to man page and display_help
- 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>
2020-01-23 19:17:21 +01:00
John Kacur 68cba61ce5 rt-tests: ptsematest: Update man page and add -h option
- 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>
2020-01-23 18:19:34 +01:00
John Kacur 69f3a66767 rt-tests: determine_maximum_mpps.sh: Fix quoting and other shell issue
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>
2020-01-23 17:28:09 +01:00
John Kacur c7a8dd7f01 rt-tests: queuelat: get_cpuinfo_mhz.sh highest value
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>
2020-01-23 17:28:09 +01:00
John Kacur 950e468bab rt-tests: pi_stress: Sync man page with help
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>
2020-01-23 17:28:09 +01:00
John Kacur 7a2ce964ea rt-tests: pi_stress: Add short options to usage message
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>
2020-01-16 22:04:06 +01:00
John Kacur f90391d190 rt-tests: cyclicdeadline: Add a simple manpage for cyclicdeadline
- Add a simple manpage for cyclicdeadline
- Install it from the Makefile

Signed-off-by: John Kacur <jkacur@redhat.com>
2020-01-16 18:04:43 +01:00
John Kacur 9b3a1e9dcf rt-tests: queuelat: Assume queuelat is in the path
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>
2020-01-15 19:37:29 +01:00
John Kacur f5937e0b20 rt-tests: Makefile - update version
Update the version in the Makefile to 1.6

Signed-off-by: John Kacur <jkacur@redhat.com>
2020-01-15 15:17:53 +01:00
Uwe Kleine-König 4670b58206 queuelat: use ARM implementation of gettick also for all !x86 archs
This fixes a build error on arm64, mips*, ppc and several others

Signed-off-by: John Kacur <jkacur@redhat.com>
2019-12-10 12:18:26 +01:00
John Kacur 07a73b6ecf rt-tests: Add SPDX tag to hackbench.c
Add SPDX tag GPL-2.0-or-later
The original author is Rusty Russell

In his mail with the following message-id, he says:
Message-ID: <200911022357.36541.rusty@rustcorp.com.au>

> ( I've Cc:-ed Rusty, the original author of hackbench.c. Rusty, the file
>   has no explicit GPLv2 compatible license - is it fine to be put
>   into GPLv2 code? )

Yep, like all my code it's standard v2 "or later".

Sounds like a good plan, thanks!
Rusty.

Signed-off-by: John Kacur <jkacur@redhat.com>
2019-11-26 17:33:27 +01:00
John Kacur 64a823d216 rt-tests: Add SPDX tags V3
Add SPDX tags instead of having out-of-date and incomplete licences at
the top of files

Audited again to make sure that GPL-2.0-only is used where appropriate
and not GPL-2.0-or-later (and the other way around)

Signed-off-by: John Kacur <jkacur@redhat.com>
2019-11-26 17:33:27 +01:00
John Kacur b8a602c2b9 svsematest: Add -S, --smp option to manpage
The -S, or --smp option is in the help but missing from the manpage.

We should really revisit these tests as these options have changed a bit
in cyclictest and they are all modeled after cyclictest.

Signed-off-by: John Kacur <jkacur@redhat.com>
2019-11-26 17:33:27 +01:00
John Kacur 86936690f5 cyclictest: Sync manpage with the help option
Sync the manpage with the help option, as the manpage has not kept-up
with changes to help

Signed-off-by: John Kacur <jkacur@redhat.com>
2019-11-26 17:33:27 +01:00
John Kacur 65a3bcda1d rt-tests: cyclictest: Get a snapshot of cyclictest without interuppting it
Right now if you are running cyclictest you can send it SIGUSR1
and it will spill out the data at a moment in time, and keep running.

However, this can be problematic if you are using another program such
as rteval to consume the data.

This feature here lets you send SIGUSR2 to cyclictest and it dumps
status to shared memory so you can read it without interrupting
cyclictest and without interferring with the data it is outputing.

To use it, start cyclictest in one term, then in another term send it
SIGUSR2, and then you can just cat the results like this:

    [jkacur@planxty rt-tests]$ ps ax | tail
    14083 ?        I      0:00 [kworker/1:0-events]
    14108 ?        I      0:01 [kworker/u16:3-events_unbound]
    14150 ?        I      0:00 [kworker/7:0-mm_percpu_wq]
    14287 pts/9    SLl+   0:14 ./cyclictest -t
    14324 ?        I      0:00 [kworker/1:2]
    14341 ?        I      0:00 [kworker/0:2]
    14342 ?        I      0:00 [kworker/2:1]
    14363 ?        I      0:00 [kworker/u16:0-events_unbound]
    14381 pts/2    R+     0:00 ps ax
    14382 pts/2    S+     0:00 tail

    [jkacur@planxty rt-tests]$ cat /dev/shm/cyclictest_shm
    [jkacur@planxty rt-tests]$ kill -s USR2 14287
    [jkacur@planxty rt-tests]$ cat /dev/shm/cyclictest_shm
    #---------------------------
    # cyclictest current status:
    T: 0 (14288) P: 0 I:1000 C: 124852 Min:     20 Act:   65 Avg:  104 Max:     354
    T: 1 (14289) P: 0 I:1500 C:  83235 Min:      6 Act:   77 Avg:   82 Max:     330
    T: 2 (14290) P: 0 I:2000 C:  62426 Min:      9 Act:   71 Avg:  110 Max:     358
    T: 3 (14291) P: 0 I:2500 C:  49940 Min:      9 Act:   77 Avg:  111 Max:     453
    T: 4 (14292) P: 0 I:3000 C:  41617 Min:     14 Act:   68 Avg:   69 Max:     815
    T: 5 (14293) P: 0 I:3500 C:  35672 Min:     15 Act:   68 Avg:  105 Max:     360
    T: 6 (14294) P: 0 I:4000 C:  31212 Min:     15 Act:   64 Avg:  103 Max:     372
    T: 7 (14295) P: 0 I:4500 C:  27744 Min:     20 Act:  118 Avg:   93 Max:     681
    #---------------------------

Signed-off-by: John Kacur <jkacur@redhat.com>
2019-11-26 17:33:27 +01:00