Commit Graph

277 Commits

Author SHA1 Message Date
Philippe Gerum 1ae1076d45 build: do apply generated header dependencies
We did produce the depfiles, but no target would depend on it. Oh,
well.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-03-26 10:20:16 +01:00
Philippe Gerum 8f0a6f5d7a build: install script must create target directory 2020-03-19 12:30:55 +01:00
Philippe Gerum 6d70a9be37 utils: evl: follow git logic for looking for commands
Instead of requiring all commands to be located at $libexec, simply do
a search path look up for evl-<command_name> via execvp().
2020-03-19 12:30:55 +01:00
Philippe Gerum a9f1e2f678 lib: fix unfortunate misnomer 2020-03-19 12:30:55 +01:00
Philippe Gerum 865d8f62da build: catch obviously wrong UAPI setting 2020-03-19 12:30:55 +01:00
Philippe Gerum 01a10f0d5d lib/init: better detect ABI discrepancies
Post ABI 18 libevl would fail to detect incompatible core support by
receiving ENOTTY as a result of asking for the core information, due
to the change in size of the argument struct which was introduced to
support ABI ranges. Make sure to trap ENOTTY on this call as an ABI
mismatch too.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-03-19 12:30:55 +01:00
Philippe Gerum a9653c72b4 include: do not export uapi/linux
uapi/evl should not directly depend on uapi/linux from the same kernel
release. The kernel definitions we need in uapi/evl should be limited
to linux/types.h, as available from a current toolchain. Revert the
uapi/linux export introduced by commit #5f68658b8.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-03-19 12:30:55 +01:00
Philippe Gerum 4204f25b5c lib: y2038: convert to timespec64 kernel interface
This set of changes makes libevl y2038-safe by switching to the ABI
revision 19 of the EVL core, which generalizes the use of a 64bit
timespec type. These changes also go a long way preparing for the
upcoming mixed 32/64 ABI support (aka compat mode).

The changes only affect the internal interface between libevl and the
kernel, not the API.  Nevertheless, the API was bumped to revision 10
with the removal of the evl_adjust_clock() service, which neither had
proper specification nor defined use case currently, but would stand
in the way of the sanitization work for y2038. At any rate, any future
service implementing some sort of EVL clock adjustment should
definitely not depend on the legacy struct timex which is
y2038-unsafe.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-03-19 12:30:55 +01:00
Philippe Gerum d075fbab09 tests/heap-torture: attach the test thread once
Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-03-19 12:30:55 +01:00
Philippe Gerum f7c6c22963 utils/trace: fix argument parsing
Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-03-19 12:30:55 +01:00
Philippe Gerum 1565744da2 lib/init: state ABI requirement explicitly
Instead of matching whatever ABI we might be compiled against like
previously, define the kernel ABI we need as a prerequisite
(EVL_KABI_PREREQ), checking for sanity at build time and runtime.

This prerequisite is matched against the range of ABI revisions the
kernel supports (from EVL_ABI_BASE to EVL_ABI_CURRENT). In the
simplest case, the kernel implements a single ABI with no backward
compatibility mechanism (EVL_ABI_BASE == EVL_ABI_CURRENT).

This addresses two issues:

- the fact that libevl might build against a given set of uapi/ files
  does not actually mean that the corresponding kernel ABI found there
  is fully compatible with what libevl expects. Specifying a
  compatible ABI prereq explicitly addresses this problem.

- we can obtain services from EVL cores supporting multiple ABI
  revisions (i.e. providing backward compat feat).

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-03-19 12:30:45 +01:00
Philippe Gerum 01f1cc273d include/evl: drop leftover declaration 2020-02-26 18:56:20 +01:00
Philippe Gerum 7eb34337fd benchmarks/latmus: set default responder priority to 99
This won't change anything EVL-wise, but this minimizes the risk of
conflicting thread priorities when running the in-band GPIO test over
a native preemption kernel.
2020-02-23 12:31:22 +01:00
Philippe Gerum b60f9257e5 tests: stax-lock: stax should be unlocked before leaving a thread
Make sure we always drop the stax before exiting the test thread,
otherwise we might deadlock contenders. Replace the async cancellation
with a synchronous exit condition.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-02-21 18:45:10 +01:00
Philippe Gerum f5ad0e320f tests: stax-warn: simplify test case
Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-02-21 18:45:10 +01:00
Philippe Gerum 991da83e74 lib/init: evl_read_clock() should fallback to clock_gettime() if uninit
Calling evl_read_clock() before the library is initialized should not
fault. Set arch_clock_gettime() to a valid fallback routine which
eventually hands over the request to clock_gettime().

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-02-21 18:45:10 +01:00
Philippe Gerum fa90a19e76 lib/init: drop obsolete SIGEVL_ACTION_HOME
Since EVL-ABI rev. 17, the core sends an INBAND_TASK_RETUSER event to
force a user thread to call back, so that it can switch it to
out-of-band context. This mechanism does not require any support from
libevl. Drop SIGEVL_ACTION_HOME since it is now useless.
2020-02-16 15:56:13 +01:00
Philippe Gerum 5b33e0ebb9 build: do not default to -fasynchronous-unwind-tables
Crashes related to enabling precise unwind tables have been observed
in the implementation of the arm* unwinder upon receipt of SIGCANCEL,
triggered by a call to pthread_cancel(). Typically, the latmus program
might randomly crash or enter a runaway loop at exit on cancelling the
timer responder thread for no obvious reason, including anything
related to stack sanity (size or corruption).

This switch was originally turned on to help backtrace() in collecting
more accurate information when called from a SIGDEBUG
handler. Unfortunately, support for stack unwinding is tricky in
essence, and may be broken in specific toolchain releases, causing
segmentation violation on exit, e.g.:

With libevl built using
gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf:

warming up on CPU0 (not isolated)...
RTT|  00:00:01  (user, 1000 us period, priority 90, CPU0-noisol)
RTH|----lat min|----lat avg|----lat max|-overrun|---msw|---lat best|--lat worst
RTD|      6.333|      6.874|     13.000|       0|     0|      6.333|     13.000
RTD|      6.333|      6.904|     19.666|       0|     0|      6.333|     19.666
^C
---|-----------|-----------|-----------|--------|------|-------------------------
RTS|      6.333|      6.889|     19.666|       0|     0|    00:00:02/00:00:02
Segmentation fault (core dumped)

(gdb) bt
    regclass=regclass@entry=_UVRSC_CORE,
    discriminator=discriminator@entry=16624,
    representation=representation@entry=_UVRSD_UINT32)
    at /home/tcwg-buildslave/workspace/tcwg-make-release_1/snapshots/gcc.git~linaro-7.5-2019.12/libgcc/config/arm/unwind-arm.c:240
    uws=uws@entry=0xb6e35e64)
    at /home/tcwg-buildslave/workspace/tcwg-make-release_1/snapshots/gcc.git~linaro-7.5-2019.12/libgcc/config/arm/pr-support.c:179
    ucbp=0xb6e372a8, context=0xb6e36080, id=0)
    at /home/tcwg-buildslave/workspace/tcwg-make-release_1/snapshots/gcc.git~linaro-7.5-2019.12/libgcc/unwind-arm-common.inc:842
    entry_vrs=<optimized out>, resuming=0)
    at /home/tcwg-buildslave/workspace/tcwg-make-release_1/snapshots/gcc.git~linaro-7.5-2019.12/libgcc/unwind-arm-common.inc:349
    at /home/tcwg-buildslave/workspace/tcwg-make-release_1/snapshots/gcc.git~linaro-7.5-2019.12/libgcc/config/arm/libunwind.S:359
---Type <return> to continue, or q <return> to quit---
    ctx=<optimized out>) at nptl-init.c:216
   from /lib/libc.so.6

Which in this particular case pointed at:

(gdb) x/20i $pc
=> 0xb6f4ca2c <_Unwind_VRS_Pop+244>:	ldr	r1, [r4, #0]
   0xb6f4ca2e <_Unwind_VRS_Pop+246>:	adds	r4, #4
   0xb6f4ca30 <_Unwind_VRS_Pop+248>:	str.w	r1, [r0, #-4]
   0xb6f4ca34 <_Unwind_VRS_Pop+252>:	cmp	r3, #16
   0xb6f4ca36 <_Unwind_VRS_Pop+254>:

(gdb) info reg
r0             0xb6e36098	3068354712
r1             0x10	16
r2             0x40f0	16624
r3             0x5	5
r4             0xf009e	983198
r5             0xb6e36080	3068354688
r6             0x1	1
r7             0x40f0	16624
r8             0x0	0
r9             0xb6e35e24	3068354084
r10            0x0	0
r11            0x1	1
r12            0xb6f5e0ac	3069567148
sp             0xb6e35cf0	0xb6e35cf0
lr             0xb6f4cf23	-1225470173
pc             0xb6f4ca2c	0xb6f4ca2c <_Unwind_VRS_Pop+244>
cpsr           0x40d1c30	67968048

Something definitely bad happened in the unwinder. Disable this option
by default, which works around the toolchain issue for the most common
use case.
2020-02-16 12:49:24 +01:00
Philippe Gerum 4639cf94a5 lib/proxy: send default output to stderr 2020-02-14 19:27:13 +01:00
Philippe Gerum 278f8d308f lib/proxy: output calls should return ssize_t for consistency 2020-02-14 19:00:21 +01:00
Philippe Gerum 5d360c615c lib/proxy: default to in-band printout on bad fd
This covers the uninit case (i.e. evl_init() did not run yet) and
whenever evl_vprint_proxy() is given an obviously invalid proxyfd
(i.e. negative), in which case we want the message to be sent out if
the caller runs in-band (not to induce any stage switch).
2020-02-14 18:57:21 +01:00
Philippe Gerum 34a16c3f9d evl/tests: test: fix usage string 2020-02-14 17:20:45 +01:00
Philippe Gerum c5eb1e1d31 lib/init: do not leak internal SIGDEBUG causes 2020-02-10 14:29:07 +01:00
Philippe Gerum f0ca4abc34 lib/thread: translate SCHED_BATCH, SCHED_IDLE in attachment
The in-band SCHED_BATCH and SCHED_IDLE policies should translate as
[SCHED_WEAK, 0] when attaching a thread to the core.
2020-02-10 14:25:56 +01:00
Philippe Gerum 572a606b7a lib/thread: force T_WOSS off on detach operation
There is no point in receiving SIGDEBUG as a result of calling ioctl()
to detach from the core.
2020-02-10 14:25:56 +01:00
Philippe Gerum 34bf02d799 utils/ps: fix inifinite loop in CPU list parser 2020-02-10 14:25:56 +01:00
Philippe Gerum 0d8639ceb8 utils/gdb: add helper to debug a helper 2020-02-10 14:25:56 +01:00
Philippe Gerum 360156366a tests/helpers: do not trigger WOSS on warning message 2020-02-10 14:25:56 +01:00
Philippe Gerum 5b0fe7eebd lib/clock: trap invalid evl_usleep() argument 2020-02-10 14:25:56 +01:00
Philippe Gerum e663990717 tests: stax-lock: prevent UMR with sigmask 2020-02-10 14:25:56 +01:00
Philippe Gerum 43c13cfb6a tests: clock-timer-periodic: run main() as out-of-band thread 2020-02-10 14:25:53 +01:00
Philippe Gerum 56257fd902 tests: stage lock out detection (T_WOSX) 2020-01-26 18:52:03 +01:00
Philippe Gerum 01511abbe6 lib/init: handle SIGDEBUG_STAGE_LOCKED (T_WOSX) 2020-01-25 12:10:20 +01:00
Philippe Gerum da9688fd88 tests: stax serialization 2020-01-22 12:44:34 +01:00
Philippe Gerum ceea63ef00 include/atomic: add atomic_load() 2020-01-22 11:57:11 +01:00
Philippe Gerum db712cc191 lib: rename evl_udelay() to evl_usleep()
evl_udelay() was an annoying misnomer for people with kernel
development background, as this relates to a busy wait loop, not to a
sleeping call, which evl_udelay() actually was.

Rename this call to evl_usleep(), converging to the glibc signature
for usleep(3) in the same move.
2020-01-21 14:52:21 +01:00
Philippe Gerum d816bdc993 tests: add status about missing kernel support
Some tests might fail due to a lack of kernel support, such as a
missing driver which have to to be involved for running such
tests. Introduce the EXIT_NO_SUPPORT code for this case, to be
distinguished by the test runner from a functional failure.
2020-01-21 14:45:20 +01:00
Philippe Gerum 9aa9a84489 benchmarks/latmus: add clocksource info to report 2020-01-20 17:44:29 +01:00
Philippe Gerum a57a529e9c benchmarks/latmus: default to abort-on-switch
Replace -a (abort-on-switch) with -K (keep-going upon
switch). Aborting becomes the default setting upon unexpected switch
to in-band mode of the responder thread, in order to prevent any
misinterpretation of broken results obtained from a broken set up.
2020-01-20 17:06:49 +01:00
Philippe Gerum 40f48e15e7 benchmarks/latmus: more help to locate command syntax errors 2020-01-19 15:29:43 +01:00
Philippe Gerum 737ffdfbbd utils/evl: more nitpicking on usage string 2020-01-09 17:51:17 +01:00
Philippe Gerum 583b4b08ab utils/evl: nitpicking on usage string 2020-01-09 16:21:49 +01:00
Philippe Gerum b2787140b4 utils/trace: allow help display before sanity checks 2020-01-09 16:21:28 +01:00
Philippe Gerum 451a5ed15b benchmarks/latmus: fix optional arguments in optlist 2020-01-08 17:47:13 +01:00
Philippe Gerum f43fbd158a benchmarks/hectic: fix infinite loop in CPU list parser 2020-01-08 17:41:41 +01:00
Philippe Gerum b5ba72a91a benchmarks/latmus: fix infinite loop in CPU list parser 2020-01-08 17:41:29 +01:00
Philippe Gerum ff99204ba2 benchmarks/latmus: drop background load generation
Let the user generate any background noise as/if required. We simply
cannot approximate the typical load of the target system in a reliable
manner with a fixed dd-like loop.
2020-01-04 18:34:10 +01:00
Philippe Gerum a7f538be1a benchmarks/gpio-echo: remove superseded test
Merged into the latmus framework.
2020-01-04 18:12:32 +01:00
Philippe Gerum 568e21d3da benchmarks/latmus: measure response time to GPIO events
Measure response time to GPIO events sent by a remote Zephyr-based
latency monitor (latmon). This monitor collects then sends the latency
data over a network connection to the latmus front-end which displays
the results received:

[Linux device under test running latmus]  <--+
                                             |
        ^                 | (GPIO ack)       |
        |                 |                  |  TCP/IP network connection
        |                 |                  |  (control & data samples)
        | (GPIO pulse)    v                  |
                                             |
[Zephyr-based device running latmon]      <--+

The generic latency monitor code running the measurement loop is
available from the zephyr/ directory. This support comes with a Zephyr
device tree patch for enabling this monitor on NXP's FRDM-K64F
development board.
2020-01-04 18:12:32 +01:00
Philippe Gerum c3a5a1a516 benchmarks/latmus: reformat warning message 2019-12-22 13:29:02 +01:00