Move ust model back to ovni

This commit is contained in:
Rodrigo Arias 2023-02-01 12:16:11 +01:00 committed by Rodrigo Arias Mallo
parent 9202085267
commit 2c43a6c155
7 changed files with 63 additions and 59 deletions

View File

@ -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

View File

@ -8,7 +8,6 @@
#include "emu.h"
#include <unistd.h>
#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;

View File

@ -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 */

View File

@ -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 */

View File

@ -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,
};

28
src/emu/ovni/ovni_priv.h Normal file
View File

@ -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 */

22
src/emu/ovni/probe.c Normal file
View File

@ -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;
}