Skip to content

Commit

Permalink
Merge tag 'for-linus-5.3-rc6' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/git/rw/uml

Pull UML fix from Richard Weinberger:
 "Fix time travel mode"

* tag 'for-linus-5.3-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml:
  um: fix time travel mode
  • Loading branch information
torvalds committed Aug 25, 2019
2 parents 94a76d9 + e0917f8 commit 32ae83f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
14 changes: 10 additions & 4 deletions arch/um/include/shared/timer-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ static inline void time_travel_set_time(unsigned long long ns)
time_travel_time = ns;
}

static inline void time_travel_set_timer(enum time_travel_timer_mode mode,
unsigned long long expiry)
static inline void time_travel_set_timer_mode(enum time_travel_timer_mode mode)
{
time_travel_timer_mode = mode;
}

static inline void time_travel_set_timer_expiry(unsigned long long expiry)
{
time_travel_timer_expiry = expiry;
}
#else
Expand All @@ -50,8 +53,11 @@ static inline void time_travel_set_time(unsigned long long ns)
{
}

static inline void time_travel_set_timer(enum time_travel_timer_mode mode,
unsigned long long expiry)
static inline void time_travel_set_timer_mode(enum time_travel_timer_mode mode)
{
}

static inline void time_travel_set_timer_expiry(unsigned long long expiry)
{
}

Expand Down
2 changes: 1 addition & 1 deletion arch/um/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ static void time_travel_sleep(unsigned long long duration)
if (time_travel_timer_mode != TT_TMR_DISABLED ||
time_travel_timer_expiry < next) {
if (time_travel_timer_mode == TT_TMR_ONESHOT)
time_travel_set_timer(TT_TMR_DISABLED, 0);
time_travel_set_timer_mode(TT_TMR_DISABLED);
/*
* time_travel_time will be adjusted in the timer
* IRQ handler so it works even when the signal
Expand Down
16 changes: 9 additions & 7 deletions arch/um/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void timer_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs)
static int itimer_shutdown(struct clock_event_device *evt)
{
if (time_travel_mode != TT_MODE_OFF)
time_travel_set_timer(TT_TMR_DISABLED, 0);
time_travel_set_timer_mode(TT_TMR_DISABLED);

if (time_travel_mode != TT_MODE_INFCPU)
os_timer_disable();
Expand All @@ -62,9 +62,10 @@ static int itimer_set_periodic(struct clock_event_device *evt)
{
unsigned long long interval = NSEC_PER_SEC / HZ;

if (time_travel_mode != TT_MODE_OFF)
time_travel_set_timer(TT_TMR_PERIODIC,
time_travel_time + interval);
if (time_travel_mode != TT_MODE_OFF) {
time_travel_set_timer_mode(TT_TMR_PERIODIC);
time_travel_set_timer_expiry(time_travel_time + interval);
}

if (time_travel_mode != TT_MODE_INFCPU)
os_timer_set_interval(interval);
Expand All @@ -77,9 +78,10 @@ static int itimer_next_event(unsigned long delta,
{
delta += 1;

if (time_travel_mode != TT_MODE_OFF)
time_travel_set_timer(TT_TMR_ONESHOT,
time_travel_time + delta);
if (time_travel_mode != TT_MODE_OFF) {
time_travel_set_timer_mode(TT_TMR_ONESHOT);
time_travel_set_timer_expiry(time_travel_time + delta);
}

if (time_travel_mode != TT_MODE_INFCPU)
return os_timer_one_shot(delta);
Expand Down

0 comments on commit 32ae83f

Please sign in to comment.