Commit Graph

111 Commits

Author SHA1 Message Date
ceaac3bcf0 Make calling ovni_thread_require() optional
When only emitting ovni events, there is no need to explicitly require
the ovni model, as libovni will already pre-populate it for the user.
2024-09-12 16:27:50 +02:00
f6d85e9af5 Make ovni.require a mandatory attribute
We no longer accept streams that don't have the ovni.require attribute.
2024-09-12 15:56:24 +02:00
1f30e8ef8b Parse metadata from proc and loom directly
All the metadata keys are known to proc and loom only, making it
self-contained. The metadata.c module is no longer needed.
2024-09-12 15:54:29 +02:00
24805f607b Add merge-cpus-loom test
Ensure we can merge the information of CPUs from multiple threads.
2024-09-12 09:09:09 +02:00
8d59161a62 Update tmpdir-metadata test 2024-09-10 12:43:10 +02:00
2bf739efed Reject incomplete thread streams 2024-09-10 11:57:45 +02:00
6a595fff0b Ensure the thread is ready before adding cpus 2024-09-10 11:45:24 +02:00
36cf3121d1 Fix implicit signed conversions
Some checks failed
CI / build:rt (push) Failing after 12s
CI / build:asan (push) Failing after 12s
CI / build:nompi (push) Successful in 59s
CI / build:debug (push) Successful in 1m50s
CI / build:local (push) Successful in 2m2s
CI / build:compilers (push) Successful in 2m27s
2024-09-09 13:44:05 +02:00
b2d91391b3 Add sort-into-previous-region emu test 2024-09-09 09:10:04 +02:00
c8750b9dfd Enable -Wconversion and -Wsign-conversion
Prevents implicit conversions to go undetected, as they will have to be
explicit now.
2024-09-09 08:28:02 +02:00
Miquel Vidal i Pinyol
3103018404 Use format macro constants for fprintf and fscanf family functions 2024-07-24 15:12:09 +02:00
1ab605b70d Fix calloc() argument order
Catched by a new gcc 14.1.1 warning.
2024-07-22 16:45:29 +02:00
d6a83a0520 Allow duplicate values in mark channels 2024-06-20 11:41:38 +02:00
c803a7566f Prevent zero values in the mark API
These values cannot be differentiated from a null value, due to a
Paraver limitation.
2024-06-20 11:41:09 +02:00
9da7234684 Pause one thread in mark API emu test.
The Paraver timeline should hide the value of the thread while it is
paused. This will require adding a tracking module with a mux.
2024-06-19 13:13:18 +02:00
6954f05dee Update mark test to for single and stack types 2024-06-19 12:26:35 +02:00
b4d445b378 Write mark PCF types for thread PVT 2024-06-19 12:26:35 +02:00
ea79c90c89 Connect mark channels to PRV
There must be one channel per thread and type.
2024-06-19 12:26:35 +02:00
505245d54c Implement emulator logic to parse mark metadata
The marks are parsed from the metadata definition, then merged from all
threads and a new channel for each mark type is created. The channel
type is specified using a flag when calling ovni_mark_type(), so the
channels is set to single or stack. For now, only ovni_mark_push() and
ovni_mark_pop() are implemented.
2024-06-19 12:26:35 +02:00
93ab5a5833 Add ovni_mark_* API to store custom states
In order to allow easy debugging of some programs and runtimes, it is
often neccessary to add extra information in the timeline views. The
modification of the emulator to accomodate those temporal events is time
consuming and requires knowlegde of the emulator internals.

To improve the situation, a new set of functions are added to libovni
which allow users to define their own views. Up to 100 types of events
can be declared, where each type can have an unlimited number ov values
with an optional label attached.
2024-06-19 12:26:35 +02:00
247ea7e7c3 Add nosv.can_breakdown attribute check
The nosv.can_breakdown attribute states if enough events for the
breakdown model of nOS-V are enabled at runtime. It is used to ensure
that breakdown traces have the progress events enabled along with others
required for proper visualization of traces.

The emulator will panic when the level is not enough, instead of relying
on users to always remember to enable the correct level.
2024-06-18 12:06:42 +02:00
d1e8a62396 Add API to manage metadata in streams
The ovni_attr_* set of functions allows users to write and read metadata
stores in the thread stream. The metadata information is available to
the emulator at the beginning of the emulation.
2024-06-13 11:09:40 +02:00
8c8bde4a0f Add emulation test for breakdown zero values 2024-05-09 15:36:58 +02:00
eb1fc0f7da Add nosv barrier API event 2024-03-22 16:58:14 +01:00
aaa7769448 Add nosv mutex API events 2024-03-22 16:56:25 +01:00
6aff4388eb Panic on events when the thread is preempted
When the thread is not running on the CPU it shouldn't be able to emit
events. A new emulation test ensures the emulation fails if it happens.
2024-03-20 15:55:43 +01:00
2c58a6058b Document version changes in emulator models
A consistency check ensures that all versions reported by the emulator
appear in the documentation as the latest version. This prevents
forgetting updating the version in the documentation.
2024-03-14 13:56:37 +01:00
929cc12c04 Make attach-old nOS-V RT test fail now
The new nOS-V emulation version 2.0.0 is no longer compatible with the
old traces.
2024-03-13 17:44:13 +01:00
f8fdcc0a79 Add Nanos6 emu test to check strict nesting model 2024-03-13 17:44:13 +01:00
24324ae734 Add parallel task and update old emu tests
All task-related events now require the body id as argument.
Additionally, in nOS-V, nested tasks require the parents to be paused.
2024-03-13 17:07:32 +01:00
50837d6173 Port Nanos6 model to tasks with bodies
For now we still allow Nanos6 to use the relaxed nest model, so a nested
task can begin the execution without the parent being paused.
2024-03-13 17:07:32 +01:00
815633221d Port nOS-V model to task bodies
The nOS-V events are modified in two ways: 1) to create a parallel task
the new VTC event must be used and 2) all task events for both normal
(VTc) and parallel (VTC) tasks require an extra argument in the payload
to indicate the body id. As a consequence, the nOS-V model version is
now increased to 2.0.0.

Additionally, all the channel PRV flags are set to PRV_SKIPDUPNULL, so
duplicates are only emitted if they are not null. It solves the problem
when a task switches to another task with the same body id.

A new Paraver configuration is added for the body id.
2024-03-13 17:07:26 +01:00
4993197fb9 Add nOS-V attach and detach API events
Instead of showing the "attached" state with the VH{aA} events, we show
when the call to nosv_attach() and nosv_detach() take place. The old
VH{aA} events are now ignored. Bumps the nOS-V model version to 1.1.0.
2024-02-15 17:59:41 +01:00
df0e7b2bd4 Test generated events match documentation
The test ensures that the generated documentation of emulation events is
kept up to date. To locate the events.md file, the source root path is
now exported to tests in OVNI_SOURCE_DIR.

The "Built on ..." message with the date of the build is removed as
otherwise it will always make the comparison fail.
2024-01-30 12:02:02 +01:00
0439399f05 Fix ovni_thread_isready() after ovni_thread_free()
Until now, the value returned by ovni_thread_isready() was still
non-zero when the thread stream was destroyed in ovni_thread_free()
This was making it impossible to detect when a stream was destroyed.

This change makes it return 0 after ovni_thread_free() by using a new
finished flag. The flag keeps track on then the stream is destroyed,
preventing double initialization of a free stream.
2023-12-19 17:30:20 +01:00
6d584c646c Install ovniver with the runpath set
When running ovniver without LD_LIBRARY_PATH set, the loader couldn't
find any ovni installation and therefore was failing to start the
program. With this change we set the RUNPATH (not RPATH) of ovniver to
the installation libdir, so when no other libovni library is loaded via
LD_LIBRARY_PATH the one provided by the same source as ovniver is used.

The value of LD_LIBRARY_PATH is also printed so we can determine where
it may be loading libovni. Using LD_DEBUG=libs will give more
information of the search process.

Fixes: https://pm.bsc.es/gitlab/rarias/ovni/-/issues/163
2023-12-12 17:06:24 +01:00
0f7ccc89de Add -a flag in ovniemu to enable all models
The experimental flag -a is used to ease the transition to the usage of
ovni_thread_require(), as it may be posible to have traces in which not
all libraries have requested their model. The flag causes all emulation
models to be enabled. This flag is considered experimental and it may be
removed or renamed in future versions.
2023-12-11 14:29:40 +01:00
c424a3177d Test temporal directories are removed at the end 2023-11-16 12:39:15 +01:00
423e3b15d2 Test multiple calls to ovni_thread_require() 2023-11-16 12:39:14 +01:00
93fdfd51de Add flush-tmpdir test 2023-11-16 12:39:14 +01:00
6b0b5bfbbd Add require test for missing models 2023-11-16 12:39:14 +01:00
72b7eb8332 Mark the finalization of streams
The emulator will now check that all threads are properly finalyzed by
calling ovni_thread_free(), as required by the specification. For now
only a warning is issued, which is enough to determine the cause of
potential emulator panics.

The ovni model is now always enabled.
2023-11-16 12:39:14 +01:00
25cf46036d Add no-require emulation test 2023-11-16 12:39:14 +01:00
6f7ce4063f Enable all models if the require key is missing
Allows programs to update to a new libovni library without breaking the
instrumentation. Only until the first call to ovni_thread_require() the
models are enabled on demand.
2023-11-16 12:39:14 +01:00
354f2f50eb Register emulation models only if required
Until now, emulation models were always being registered via probe(),
which causes the emulator to initialize all the channels. To reduce the
overhead, the channels were not connected or registered in the bay
until the first event of that model was received. This delayed connect
was causing issues in muxes where the newly connected model required
refreshing the touched channels. Which in turn was causing unexpected
PRV events.

By determining which models we need to enable, we can remove the delayed
connect mechanism and just enable those models at initialization time,
and connect the channels.
2023-11-16 12:39:05 +01:00
428e0b44b8 Add emu test for ovni_thread_require 2023-11-16 12:21:50 +01:00
c13d57f0f6 Fix for nOS-V with ovni.level=2
When running without all the subsystem events enabled in nOS-V, it is
possible to emit two consecutive VTx events, which would push twice the
same value ST_TASK_BODY into the subsystem channel. This change relaxes
the subsystem channel to accept duplicate stacked values. A regression
test is also added.

Reported-By: Raúl Peñacoba Veigas <raul.penacoba@bsc.es>
2023-11-14 17:26:43 +01:00
4b4f1bd218 Don't modify nOS-V subsystem state on task pause
In nOS-V, when a task was paused via the VTp event, two things were
happening: 1) the task state was set to pause and 2) the subsystem state
"Task: Running" was being popped.

This causes a problem when a task calls nosv_submit() in blocking mode,
as it will call nosv_pause() which will emit a VTp event from a
subsystem different than "Task: Running".

To solve this conflict, we handle the subsystems state and the task
state separately with the VTp and VTr events. The subsystem state "Task:
Running" no longer is connected to the state of the task and only shows
if we entered the body of the task or not. It has now been renamed to
"Task: In body".

The new state "Task: In body" represents that the task body has begun
the execution and is still in the stack, but the task may be paused. The
subsystem is not changed by the VTp (pause) or VTr (resume) events.

Fixes: https://pm.bsc.es/gitlab/rarias/ovni/-/issues/128
2023-10-23 11:26:17 +02:00
0df018cf5f Fix segfault reading empty streams
The check_clock_gate() was trying to access to the first event in all
streams. However, streams that are empty don't have any event, so they
cause a NULL dereference. Skipping not active streams avoids the
problem.
2023-10-23 10:07:44 +02:00
0db35980a0 Add a test for multiple values of OVNI_TRACEDIR 2023-10-23 07:49:28 +00:00