[PATCH RFC 07/11] um: add TIMETRAVEL_REQUEST handler to request latest event

Benjamin Beichler
2023-11-03T16:42:22Z

Allow the so called Calendar (or simulation master) to request the
latest timetravel event. This can be used in situations, where the
former request message from UML to Calendar was missed.

Signed-off-by: Benjamin Beichler <benjamin.beichler@uni-rostock.de>
---
arch/um/kernel/time.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index 54fc4a69cb59..e513256eadfe 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -41,6 +41,7 @@ static bool time_travel_ext_prev_request_valid;
static unsigned long long time_travel_ext_prev_request;
static bool time_travel_ext_free_until_valid;
static unsigned long long time_travel_ext_free_until;
+static struct time_travel_event *time_travel_first_event(void);

static void time_travel_set_time(unsigned long long ns)
{
@@ -66,6 +67,7 @@ static void time_travel_handle_message(struct um_timetravel_msg *msg,
.op = UM_TIMETRAVEL_ACK,
};
int ret;
+ struct time_travel_event *event;

/*
* We can't unlock here, but interrupt signals with a timetravel_handler
@@ -103,6 +105,10 @@ static void time_travel_handle_message(struct um_timetravel_msg *msg,
time_travel_ext_free_until_valid = true;
time_travel_ext_free_until = msg->time;
break;
+ case UM_TIMETRAVEL_REQUEST:
+ event = time_travel_first_event();
+ resp.time = event->time;
+ break;
}

resp.seq = msg->seq;

--
2.34.1