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.
This commit is contained in:
Rodrigo Arias 2024-02-14 13:23:28 +01:00
parent 233e35e8ff
commit 4993197fb9
12 changed files with 97 additions and 14 deletions

View File

@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Changed
- Add support for `nosv_attach` and `nosv_detach` events VA{aAeE}.
- Ignore old nOS-V attach events VH{aA}.
- The nOS-V model version is bumped to 1.1.0.
## [1.6.0] - 2024-02-14
### Changed

View File

@ -17,7 +17,7 @@ window_comm_lines_enabled true
window_flags_enabled false
window_noncolor_mode true
window_custom_color_enabled true
window_custom_color_palette {6.000000000000:94,0,0},{7.000000000000:153,114,0},{9.000000000000:124,213,228},{10.000000000000:242,239,141},{11.000000000000:0,70,0}
window_custom_color_palette {6.000000000000:94,0,0},{7.000000000000:153,114,0},{9.000000000000:124,213,228},{10.000000000000:242,239,141},{11.000000000000:0,70,0},{19.000000000000:195,96,151},{20.000000000000:255,162,255},{21.000000000000:0,99,162}
window_logical_filtered true
window_physical_filtered false
window_comm_fromto true

View File

@ -17,7 +17,7 @@ window_comm_lines_enabled true
window_flags_enabled false
window_noncolor_mode true
window_custom_color_enabled true
window_custom_color_palette {6.000000000000:94,0,0},{7.000000000000:153,114,0},{9.000000000000:124,213,228},{10.000000000000:242,239,141},{11.000000000000:0,70,0}
window_custom_color_palette {6.000000000000:94,0,0},{7.000000000000:153,114,0},{9.000000000000:124,213,228},{10.000000000000:242,239,141},{11.000000000000:0,70,0},{19.000000000000:195,96,151},{20.000000000000:255,162,255},{21.000000000000:0,99,162}
window_logical_filtered true
window_physical_filtered false
window_comm_fromto true

View File

@ -1,7 +1,7 @@
# Emulator events
This is a exhaustive list of the events recognized by the emulator.
Built on Jan 29 2024.
Built on Feb 15 2024.
## Model nanos6
@ -485,7 +485,7 @@ List of events for the model *tampi* with identifier **`T`** at version `1.0.0`:
## Model nosv
List of events for the model *nosv* with identifier **`V`** at version `1.0.0`:
List of events for the model *nosv* with identifier **`V`** at version `1.1.0`:
<dl>
<dt><a id="VTc" href="#VTc"><pre>VTc(u32 taskid, u32 typeid)</pre></a></dt>
<dd>creates task %{taskid} with type %{typeid}</dd>
@ -553,6 +553,14 @@ List of events for the model *nosv* with identifier **`V`** at version `1.0.0`:
<dd>enters nosv_schedpoint()</dd>
<dt><a id="VAC" href="#VAC"><pre>VAC</pre></a></dt>
<dd>leaves nosv_schedpoint()</dd>
<dt><a id="VAa" href="#VAa"><pre>VAa</pre></a></dt>
<dd>enters nosv_attach()</dd>
<dt><a id="VAA" href="#VAA"><pre>VAA</pre></a></dt>
<dd>leaves nosv_attach()</dd>
<dt><a id="VAe" href="#VAe"><pre>VAe</pre></a></dt>
<dd>enters nosv_detach()</dd>
<dt><a id="VAE" href="#VAE"><pre>VAE</pre></a></dt>
<dd>leaves nosv_detach()</dd>
<dt><a id="VHa" href="#VHa"><pre>VHa</pre></a></dt>
<dd>enters nosv_attach()</dd>
<dt><a id="VHA" href="#VHA"><pre>VHA</pre></a></dt>

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: GPL-3.0-or-later */
#include "nosv_priv.h"
@ -55,11 +55,15 @@ static const int ss_table[256][256][3] = {
['W'] = { CHSS, POP, ST_API_WAITFOR },
['c'] = { CHSS, PUSH, ST_API_SCHEDPOINT },
['C'] = { CHSS, POP, ST_API_SCHEDPOINT },
['a'] = { CHSS, PUSH, ST_API_ATTACH },
['A'] = { CHSS, POP, ST_API_ATTACH },
['e'] = { CHSS, PUSH, ST_API_DETACH },
['E'] = { CHSS, POP, ST_API_DETACH },
},
/* FIXME: Move thread type to another channel, like nanos6 */
['H'] = {
['a'] = { CHSS, PUSH, ST_ATTACH },
['A'] = { CHSS, POP, ST_ATTACH },
['a'] = { CHSS, IGN, 0 },
['A'] = { CHSS, IGN, 0 },
['w'] = { CHSS, PUSH, ST_WORKER },
['W'] = { CHSS, POP, ST_WORKER },
['d'] = { CHSS, PUSH, ST_DELEGATE },

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: GPL-3.0-or-later */
#ifndef NOSV_PRIV_H
@ -34,7 +34,8 @@ enum nosv_ss_values {
ST_API_YIELD,
ST_API_WAITFOR,
ST_API_SCHEDPOINT,
ST_ATTACH,
ST_API_ATTACH,
ST_API_DETACH,
ST_WORKER,
ST_DELEGATE,

View File

@ -57,6 +57,8 @@ static struct ev_decl model_evlist[] = {
PAIR_E("VAy", "VAY", "nosv_yield()")
PAIR_E("VAw", "VAW", "nosv_waitfor()")
PAIR_E("VAc", "VAC", "nosv_schedpoint()")
PAIR_E("VAa", "VAA", "nosv_attach()")
PAIR_E("VAe", "VAE", "nosv_detach()")
/* FIXME: VHA and VHa are not subsystems */
{ "VHa", "enters nosv_attach()" },
@ -70,7 +72,7 @@ static struct ev_decl model_evlist[] = {
struct model_spec model_nosv = {
.name = model_name,
.version = "1.0.0",
.version = "1.1.0",
.evlist = model_evlist,
.model = model_id,
.create = model_nosv_create,
@ -135,7 +137,8 @@ static const struct pcf_value_label nosv_ss_values[] = {
{ ST_API_YIELD, "API: Yield" },
{ ST_API_WAITFOR, "API: Waitfor" },
{ ST_API_SCHEDPOINT, "API: Scheduling point" },
{ ST_ATTACH, "Thread: Attached" },
{ ST_API_ATTACH, "API: Attach" },
{ ST_API_DETACH, "API: Detach" },
{ ST_WORKER, "Thread: Worker" },
{ ST_DELEGATE, "Thread: Delegate" },
{ EV_SCHED_SEND, "EV Scheduler: Send task" },

View File

@ -1,6 +1,8 @@
# Copyright (c) 2022-2023 Barcelona Supercomputing Center (BSC)
# Copyright (c) 2022-2024 Barcelona Supercomputing Center (BSC)
# SPDX-License-Identifier: GPL-3.0-or-later
test_emu(attach.c)
test_emu(attach-old.c)
test_emu(nested-tasks.c)
test_emu(nested-tasks-bad.c SHOULD_FAIL
REGEX "cannot execute task 1: state is not created")

View File

@ -0,0 +1,25 @@
/* Copyright (c) 2024 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: GPL-3.0-or-later */
#include "compat.h"
#include "ovni.h"
#include "instr.h"
#include "instr_nosv.h"
/* Checks that we can still process a trace which contains the VH{aA} attach
* events, by simply ignoring them */
int
main(void)
{
instr_start(0, 1);
ovni_thread_require("nosv", "1.0.0");
instr_nosv_attached();
sleep_us(100);
instr_nosv_detached();
instr_end();
return 0;
}

28
test/emu/nosv/attach.c Normal file
View File

@ -0,0 +1,28 @@
/* Copyright (c) 2024 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: GPL-3.0-or-later */
#include "compat.h"
#include "instr.h"
#include "instr_nosv.h"
/* Test the nosv_attach() and nosv_detach() API events, introduced in the nOS-V
* model 1.1.0 */
int
main(void)
{
instr_start(0, 1);
instr_nosv_init();
instr_nosv_attach_enter();
sleep_us(100);
instr_nosv_attach_exit();
instr_nosv_detach_enter();
sleep_us(100);
instr_nosv_detach_exit();
instr_end();
return 0;
}

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: GPL-3.0-or-later */
#ifndef INSTR_NOSV_H
@ -45,6 +45,12 @@ INSTR_1ARG(instr_nosv_task_end, "VTe", int32_t, id)
INSTR_0ARG(instr_nosv_submit_enter, "VAs")
INSTR_0ARG(instr_nosv_submit_exit, "VAS")
INSTR_0ARG(instr_nosv_attach_enter, "VAa")
INSTR_0ARG(instr_nosv_attach_exit, "VAA")
INSTR_0ARG(instr_nosv_detach_enter, "VAe")
INSTR_0ARG(instr_nosv_detach_exit, "VAE")
INSTR_0ARG(instr_nosv_attached, "VHa") /* deprecated */
INSTR_0ARG(instr_nosv_detached, "VHA") /* deprecated */
#endif /* INSTR_NOSV_H */

View File

@ -13,7 +13,7 @@ main(void)
nosv_init();
nosv_task_t task;
if (nosv_attach(&task, NULL, NULL, 0) != 0)
if (nosv_attach(&task, NULL, "attached-task", 0) != 0)
die("nosv_attach failed");
sleep_us(100);