From 6cafd347ce5fe9afabc409a078a1044b7842261c Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 11 Apr 2023 20:18:18 +0200 Subject: [PATCH] Add support for sponge subsystem state in Nanos6 --- src/emu/nanos6/event.c | 2 ++ src/emu/nanos6/nanos6_priv.h | 1 + test/emu/nanos6/CMakeLists.txt | 1 + test/emu/nanos6/instr_nanos6.h | 2 ++ test/emu/nanos6/sponge.c | 42 ++++++++++++++++++++++++++++++++++ 5 files changed, 48 insertions(+) create mode 100644 test/emu/nanos6/sponge.c diff --git a/src/emu/nanos6/event.c b/src/emu/nanos6/event.c index 4d55891..2fdaafc 100644 --- a/src/emu/nanos6/event.c +++ b/src/emu/nanos6/event.c @@ -35,6 +35,8 @@ static const int ss_table[256][256][3] = { ['S'] = { CHSS, POP, ST_SUSPEND }, ['r'] = { CHSS, PUSH, ST_RESUME }, ['R'] = { CHSS, POP, ST_RESUME }, + ['g'] = { CHSS, PUSH, ST_SPONGE }, + ['G'] = { CHSS, POP, ST_SPONGE }, ['*'] = { CHSS, IGN, -1 }, }, ['P'] = { diff --git a/src/emu/nanos6/nanos6_priv.h b/src/emu/nanos6/nanos6_priv.h index a971496..53d7436 100644 --- a/src/emu/nanos6/nanos6_priv.h +++ b/src/emu/nanos6/nanos6_priv.h @@ -49,6 +49,7 @@ enum nanos6_ss_state { ST_MIGRATE, ST_SUSPEND, ST_RESUME, + ST_SPONGE, /* Value 51 is broken in old Paraver */ EV_SCHED_RECV = 60, diff --git a/test/emu/nanos6/CMakeLists.txt b/test/emu/nanos6/CMakeLists.txt index 803606d..dc2e1da 100644 --- a/test/emu/nanos6/CMakeLists.txt +++ b/test/emu/nanos6/CMakeLists.txt @@ -10,5 +10,6 @@ test_emu(ss-mismatch.c SHOULD_FAIL REGEX "thread [0-9]\\+ ended with 1 stacked nanos6 subsystems") test_emu(delayed-connect-ss.c) test_emu(switch-same-type.c) +test_emu(sponge.c) test_emu(breakdown-no-black.c BREAKDOWN) diff --git a/test/emu/nanos6/instr_nanos6.h b/test/emu/nanos6/instr_nanos6.h index 6c5c621..6c361c5 100644 --- a/test/emu/nanos6/instr_nanos6.h +++ b/test/emu/nanos6/instr_nanos6.h @@ -62,6 +62,8 @@ INSTR_0ARG(instr_nanos6_suspend_enter, "6Ws") INSTR_0ARG(instr_nanos6_suspend_exit, "6WS") INSTR_0ARG(instr_nanos6_resume_enter, "6Wr") INSTR_0ARG(instr_nanos6_resume_exit, "6WR") +INSTR_0ARG(instr_nanos6_sponge_enter, "6Wg") +INSTR_0ARG(instr_nanos6_sponge_exit, "6WG") INSTR_0ARG(instr_nanos6_signal, "6W*") INSTR_0ARG(instr_nanos6_submit_task_enter, "6U[") diff --git a/test/emu/nanos6/sponge.c b/test/emu/nanos6/sponge.c new file mode 100644 index 0000000..d12e3e7 --- /dev/null +++ b/test/emu/nanos6/sponge.c @@ -0,0 +1,42 @@ +/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC) + * SPDX-License-Identifier: GPL-3.0-or-later */ + +#include +#include +#include "common.h" +#include "emu_prv.h" +#include "instr.h" +#include "instr_nanos6.h" +#include "nanos6/nanos6_priv.h" + +int +main(void) +{ + instr_start(0, 1); + + instr_nanos6_sponge_enter(); + + /* Match the PRV line in the trace */ + FILE *f = fopen("match.sh", "w"); + if (f == NULL) + die("fopen failed:"); + + int type = PRV_NANOS6_SUBSYSTEM; + int64_t t = get_delta(); + int value = ST_SPONGE; + fprintf(f, "grep ':%ld:%d:%d$' ovni/thread.prv\n", t, type, value); + fprintf(f, "grep ':%ld:%d:%d$' ovni/cpu.prv\n", t, type, value); + + instr_nanos6_sponge_exit(); + + t = get_delta(); + value = 0; + fprintf(f, "grep ':%ld:%d:%d$' ovni/thread.prv\n", t, type, value); + fprintf(f, "grep ':%ld:%d:%d$' ovni/cpu.prv\n", t, type, value); + + fclose(f); + + instr_end(); + + return 0; +}