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:
		
							parent
							
								
									233e35e8ff
								
							
						
					
					
						commit
						4993197fb9
					
				| @ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||||||
| 
 | 
 | ||||||
| ## [Unreleased] | ## [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 | ## [1.6.0] - 2024-02-14 | ||||||
| 
 | 
 | ||||||
| ### Changed | ### Changed | ||||||
|  | |||||||
| @ -17,7 +17,7 @@ window_comm_lines_enabled true | |||||||
| window_flags_enabled false | window_flags_enabled false | ||||||
| window_noncolor_mode true | window_noncolor_mode true | ||||||
| window_custom_color_enabled 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_logical_filtered true | ||||||
| window_physical_filtered false | window_physical_filtered false | ||||||
| window_comm_fromto true | window_comm_fromto true | ||||||
|  | |||||||
| @ -17,7 +17,7 @@ window_comm_lines_enabled true | |||||||
| window_flags_enabled false | window_flags_enabled false | ||||||
| window_noncolor_mode true | window_noncolor_mode true | ||||||
| window_custom_color_enabled 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_logical_filtered true | ||||||
| window_physical_filtered false | window_physical_filtered false | ||||||
| window_comm_fromto true | window_comm_fromto true | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| # Emulator events | # Emulator events | ||||||
| 
 | 
 | ||||||
| This is a exhaustive list of the events recognized by the emulator. | This is a exhaustive list of the events recognized by the emulator. | ||||||
| Built on Jan 29 2024. | Built on Feb 15 2024. | ||||||
| 
 | 
 | ||||||
| ## Model nanos6 | ## Model nanos6 | ||||||
| 
 | 
 | ||||||
| @ -485,7 +485,7 @@ List of events for the model *tampi* with identifier **`T`** at version `1.0.0`: | |||||||
| 
 | 
 | ||||||
| ## Model nosv | ## 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> | <dl> | ||||||
| <dt><a id="VTc" href="#VTc"><pre>VTc(u32 taskid, u32 typeid)</pre></a></dt> | <dt><a id="VTc" href="#VTc"><pre>VTc(u32 taskid, u32 typeid)</pre></a></dt> | ||||||
| <dd>creates task %{taskid} with type %{typeid}</dd> | <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> | <dd>enters nosv_schedpoint()</dd> | ||||||
| <dt><a id="VAC" href="#VAC"><pre>VAC</pre></a></dt> | <dt><a id="VAC" href="#VAC"><pre>VAC</pre></a></dt> | ||||||
| <dd>leaves nosv_schedpoint()</dd> | <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> | <dt><a id="VHa" href="#VHa"><pre>VHa</pre></a></dt> | ||||||
| <dd>enters nosv_attach()</dd> | <dd>enters nosv_attach()</dd> | ||||||
| <dt><a id="VHA" href="#VHA"><pre>VHA</pre></a></dt> | <dt><a id="VHA" href="#VHA"><pre>VHA</pre></a></dt> | ||||||
|  | |||||||
| @ -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 */ |  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||||
| 
 | 
 | ||||||
| #include "nosv_priv.h" | #include "nosv_priv.h" | ||||||
| @ -55,11 +55,15 @@ static const int ss_table[256][256][3] = { | |||||||
| 		['W'] = { CHSS, POP,  ST_API_WAITFOR }, | 		['W'] = { CHSS, POP,  ST_API_WAITFOR }, | ||||||
| 		['c'] = { CHSS, PUSH, ST_API_SCHEDPOINT }, | 		['c'] = { CHSS, PUSH, ST_API_SCHEDPOINT }, | ||||||
| 		['C'] = { CHSS, POP,  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 */ | 	/* FIXME: Move thread type to another channel, like nanos6 */ | ||||||
| 	['H'] = { | 	['H'] = { | ||||||
| 		['a'] = { CHSS, PUSH, ST_ATTACH }, | 		['a'] = { CHSS, IGN,  0 }, | ||||||
| 		['A'] = { CHSS, POP,  ST_ATTACH }, | 		['A'] = { CHSS, IGN,  0 }, | ||||||
| 		['w'] = { CHSS, PUSH, ST_WORKER }, | 		['w'] = { CHSS, PUSH, ST_WORKER }, | ||||||
| 		['W'] = { CHSS, POP,  ST_WORKER }, | 		['W'] = { CHSS, POP,  ST_WORKER }, | ||||||
| 		['d'] = { CHSS, PUSH, ST_DELEGATE }, | 		['d'] = { CHSS, PUSH, ST_DELEGATE }, | ||||||
|  | |||||||
| @ -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 */ |  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||||
| 
 | 
 | ||||||
| #ifndef NOSV_PRIV_H | #ifndef NOSV_PRIV_H | ||||||
| @ -34,7 +34,8 @@ enum nosv_ss_values { | |||||||
| 	ST_API_YIELD, | 	ST_API_YIELD, | ||||||
| 	ST_API_WAITFOR, | 	ST_API_WAITFOR, | ||||||
| 	ST_API_SCHEDPOINT, | 	ST_API_SCHEDPOINT, | ||||||
| 	ST_ATTACH, | 	ST_API_ATTACH, | ||||||
|  | 	ST_API_DETACH, | ||||||
| 	ST_WORKER, | 	ST_WORKER, | ||||||
| 	ST_DELEGATE, | 	ST_DELEGATE, | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -57,6 +57,8 @@ static struct ev_decl model_evlist[] = { | |||||||
| 	PAIR_E("VAy", "VAY", "nosv_yield()") | 	PAIR_E("VAy", "VAY", "nosv_yield()") | ||||||
| 	PAIR_E("VAw", "VAW", "nosv_waitfor()") | 	PAIR_E("VAw", "VAW", "nosv_waitfor()") | ||||||
| 	PAIR_E("VAc", "VAC", "nosv_schedpoint()") | 	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 */ | 	/* FIXME: VHA and VHa are not subsystems */ | ||||||
| 	{ "VHa", "enters nosv_attach()" }, | 	{ "VHa", "enters nosv_attach()" }, | ||||||
| @ -70,7 +72,7 @@ static struct ev_decl model_evlist[] = { | |||||||
| 
 | 
 | ||||||
| struct model_spec model_nosv = { | struct model_spec model_nosv = { | ||||||
| 	.name    = model_name, | 	.name    = model_name, | ||||||
| 	.version = "1.0.0", | 	.version = "1.1.0", | ||||||
| 	.evlist  = model_evlist, | 	.evlist  = model_evlist, | ||||||
| 	.model   = model_id, | 	.model   = model_id, | ||||||
| 	.create  = model_nosv_create, | 	.create  = model_nosv_create, | ||||||
| @ -135,7 +137,8 @@ static const struct pcf_value_label nosv_ss_values[] = { | |||||||
| 	{ ST_API_YIELD,        "API: Yield" }, | 	{ ST_API_YIELD,        "API: Yield" }, | ||||||
| 	{ ST_API_WAITFOR,      "API: Waitfor" }, | 	{ ST_API_WAITFOR,      "API: Waitfor" }, | ||||||
| 	{ ST_API_SCHEDPOINT,   "API: Scheduling point" }, | 	{ 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_WORKER,           "Thread: Worker" }, | ||||||
| 	{ ST_DELEGATE,         "Thread: Delegate" }, | 	{ ST_DELEGATE,         "Thread: Delegate" }, | ||||||
| 	{ EV_SCHED_SEND,       "EV Scheduler: Send task" }, | 	{ EV_SCHED_SEND,       "EV Scheduler: Send task" }, | ||||||
|  | |||||||
| @ -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 | # 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.c) | ||||||
| test_emu(nested-tasks-bad.c SHOULD_FAIL | test_emu(nested-tasks-bad.c SHOULD_FAIL | ||||||
|   REGEX "cannot execute task 1: state is not created") |   REGEX "cannot execute task 1: state is not created") | ||||||
|  | |||||||
							
								
								
									
										25
									
								
								test/emu/nosv/attach-old.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								test/emu/nosv/attach-old.c
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										28
									
								
								test/emu/nosv/attach.c
									
									
									
									
									
										Normal 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; | ||||||
|  | } | ||||||
| @ -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 */ |  * SPDX-License-Identifier: GPL-3.0-or-later */ | ||||||
| 
 | 
 | ||||||
| #ifndef INSTR_NOSV_H | #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_enter, "VAs") | ||||||
| INSTR_0ARG(instr_nosv_submit_exit,  "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 */ | #endif /* INSTR_NOSV_H */ | ||||||
|  | |||||||
| @ -13,7 +13,7 @@ main(void) | |||||||
| 	nosv_init(); | 	nosv_init(); | ||||||
| 
 | 
 | ||||||
| 	nosv_task_t task; | 	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"); | 		die("nosv_attach failed"); | ||||||
| 
 | 
 | ||||||
| 	sleep_us(100); | 	sleep_us(100); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user