diff --git a/src/emu/CMakeLists.txt b/src/emu/CMakeLists.txt index 9015414..4d29016 100644 --- a/src/emu/CMakeLists.txt +++ b/src/emu/CMakeLists.txt @@ -23,7 +23,6 @@ add_library(emu STATIC emu_trace.c loom.c metadata.c - model_ust.c mux.c path.c proc.c @@ -34,6 +33,8 @@ add_library(emu STATIC task.c thread.c extend.c + ovni/probe.c + ovni/event.c nanos6/probe.c nanos6/connect.c nanos6/create.c diff --git a/src/emu/emu.c b/src/emu/emu.c index 8401f53..1dc5fd2 100644 --- a/src/emu/emu.c +++ b/src/emu/emu.c @@ -8,7 +8,6 @@ #include "emu.h" #include -#include "model_ust.h" #include "models.h" int @@ -55,8 +54,8 @@ emu_init(struct emu *emu, int argc, char *argv[]) // /* Register all the models */ // emu_model_register(&emu->model, &ovni_model_spec, emu); - if (model_ust.create && model_ust.create(emu) != 0) { - err("model ust create failed"); + if (model_ovni.create && model_ovni.create(emu) != 0) { + err("model ovni create failed"); return -1; } if (model_nanos6.create && model_nanos6.create(emu) != 0) { @@ -71,8 +70,8 @@ emu_init(struct emu *emu, int argc, char *argv[]) int emu_connect(struct emu *emu) { - if (model_ust.connect && model_ust.connect(emu) != 0) { - err("model ust connect failed"); + if (model_ovni.connect && model_ovni.connect(emu) != 0) { + err("model ovni connect failed"); return -1; } if (model_nanos6.connect && model_nanos6.connect(emu) != 0) { @@ -144,7 +143,7 @@ emu_step(struct emu *emu) } /* Otherwise progress */ - if (emu->ev->m == 'O' && model_ust.event(emu) != 0) { + if (emu->ev->m == 'O' && model_ovni.event(emu) != 0) { err("ovni event failed"); panic(emu); return -1; diff --git a/src/emu/model_ust.h b/src/emu/model_ust.h deleted file mode 100644 index 4ee68cb..0000000 --- a/src/emu/model_ust.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC) - * SPDX-License-Identifier: GPL-3.0-or-later */ - -#ifndef MODEL_UST_H -#define MODEL_UST_H - -/* The user-space thread "ust" execution model tracks the state of processes and - * threads running in the CPUs by instrumenting the threads before and after - * they are going to sleep. It just provides an approximate view of the real - * execution by the kernel. */ - -#include "emu_model.h" - -extern struct model_spec model_ust; - -#include "chan.h" - -enum ust_chan_type { - UST_CHAN_FLUSH = 0, - UST_CHAN_BURST, - UST_CHAN_MAX, -}; - -struct ust_thread { - struct chan chan[UST_CHAN_MAX]; -}; - -#endif /* MODEL_UST_H */ diff --git a/src/emu/models.h b/src/emu/models.h index 17503ea..8d7bf2b 100644 --- a/src/emu/models.h +++ b/src/emu/models.h @@ -6,7 +6,7 @@ #include "emu_model.h" -extern struct model_spec model_ust; +extern struct model_spec model_ovni; extern struct model_spec model_nanos6; #endif /* MODELS_H */ diff --git a/src/emu/model_ust.c b/src/emu/ovni/event.c similarity index 95% rename from src/emu/model_ust.c rename to src/emu/ovni/event.c index 9a3f02a..04467b6 100644 --- a/src/emu/model_ust.c +++ b/src/emu/ovni/event.c @@ -3,7 +3,7 @@ #define ENABLE_DEBUG -#include "model_ust.h" +#include "ovni_priv.h" #include "emu.h" #include "loom.h" @@ -262,7 +262,7 @@ pre_affinity_remote(struct emu *emu) return -1; } - /* It must have an assigned CPU */ + /* It movni have an assigned CPU */ if (remote_th->cpu == NULL) { err("thread %d has no CPU", tid); return -1; @@ -412,31 +412,13 @@ process_ev(struct emu *emu) return 0; } -static int -ust_probe(struct emu *emu) +int +ovni_event(struct emu *emu) { - if (emu->system.nthreads == 0) - return -1; - - return 0; -} - -static int -ust_event(struct emu *emu) -{ - if (emu->ev->m != model_ust.model) { + if (emu->ev->m != 'O') { err("unexpected event model %c\n", emu->ev->m); return -1; } return process_ev(emu); } - -struct model_spec model_ust = { - .name = "ust", - .model = 'O', - .create = NULL, - .connect = NULL, - .event = ust_event, - .probe = ust_probe, -}; diff --git a/src/emu/ovni/ovni_priv.h b/src/emu/ovni/ovni_priv.h new file mode 100644 index 0000000..074753a --- /dev/null +++ b/src/emu/ovni/ovni_priv.h @@ -0,0 +1,28 @@ +/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC) + * SPDX-License-Identifier: GPL-3.0-or-later */ + +#ifndef OVNI_PRIV_H +#define OVNI_PRIV_H + +/* The user-space thread "ovni" execution model tracks the state of processes and + * threads running in the CPUs by instrumenting the threads before and after + * they are going to sleep. It jovni provides an approximate view of the real + * execution by the kernel. */ + +#include "emu.h" +#include "chan.h" + +enum ovni_chan_type { + UST_CHAN_FLUSH = 0, + UST_CHAN_BURST, + UST_CHAN_MAX, +}; + +struct ovni_thread { + struct chan chan[UST_CHAN_MAX]; +}; + +int ovni_probe(struct emu *emu); +int ovni_event(struct emu *emu); + +#endif /* OVNI_PRIV_H */ diff --git a/src/emu/ovni/probe.c b/src/emu/ovni/probe.c new file mode 100644 index 0000000..e7d6580 --- /dev/null +++ b/src/emu/ovni/probe.c @@ -0,0 +1,22 @@ +/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) + * SPDX-License-Identifier: GPL-3.0-or-later */ + +#include "ovni_priv.h" + +struct model_spec model_ovni = { + .name = "ovni", + .model = 'O', + .create = NULL, + .connect = NULL, + .event = ovni_event, + .probe = ovni_probe, +}; + +int +ovni_probe(struct emu *emu) +{ + if (emu->system.nthreads == 0) + return -1; + + return 0; +}