@@ -28,7 +28,7 @@ struct time_travel_event {
extern enum time_travel_mode time_travel_mode;
-void time_travel_sleep(unsigned long long duration);
+void time_travel_sleep(void);
static inline void
time_travel_set_event_fn(struct time_travel_event *e,
@@ -256,7 +256,7 @@ extern void os_warn(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
/* time.c */
-extern void os_idle_sleep(unsigned long long nsecs);
+extern void os_idle_sleep(void);
extern int os_timer_create(void);
extern int os_timer_set_interval(unsigned long long nsecs);
extern int os_timer_one_shot(unsigned long long nsecs);
@@ -204,13 +204,10 @@ void initial_thread_cb(void (*proc)(void *), void *arg)
static void um_idle_sleep(void)
{
- unsigned long long duration = UM_NSEC_PER_SEC;
-
- if (time_travel_mode != TT_MODE_OFF) {
- time_travel_sleep(duration);
- } else {
- os_idle_sleep(duration);
- }
+ if (time_travel_mode != TT_MODE_OFF)
+ time_travel_sleep();
+ else
+ os_idle_sleep();
}
void arch_cpu_idle(void)
@@ -399,13 +399,22 @@ static void time_travel_oneshot_timer(struct time_travel_event *e)
deliver_alarm();
}
-void time_travel_sleep(unsigned long long duration)
+void time_travel_sleep(void)
{
+ unsigned long long duration = NSEC_PER_SEC * 120;
unsigned long long next = time_travel_time + duration;
if (time_travel_mode == TT_MODE_BASIC)
os_timer_disable();
+ /*
+ * In external mode, just tell the external controller we'll
+ * (essentially) wait "forever" (S64_MAX because there are
+ * some potential wrapping issues.)
+ */
+ if (time_travel_mode == TT_MODE_EXTERNAL)
+ next = S64_MAX;
+
time_travel_update_time(next, true);
if (time_travel_mode == TT_MODE_BASIC &&
@@ -99,14 +99,12 @@ long long os_nsecs(void)
}
/**
- * os_idle_sleep() - sleep for a given time of nsecs
- * @nsecs: nanoseconds to sleep
+ * os_idle_sleep() - idle sleep for some (long) time
*/
-void os_idle_sleep(unsigned long long nsecs)
+void os_idle_sleep(void)
{
struct timespec ts = {
- .tv_sec = nsecs / UM_NSEC_PER_SEC,
- .tv_nsec = nsecs % UM_NSEC_PER_SEC
+ .tv_sec = 120,
};
/*