This pull request contains a single bug fix for UML:

- Fix time travel mode
 -----BEGIN PGP SIGNATURE-----
 
 iQJKBAABCAA0FiEEdgfidid8lnn52cLTZvlZhesYu8EFAl1ikVwWHHJpY2hhcmRA
 c2lnbWEtc3Rhci5hdAAKCRBm+VmF6xi7waNYEADaqyJu+2UAp2hZGkwric9dqh4l
 IibXY0bPKokDIAt/gGmh5CX8cqBWKjWJSny91mqrINm1SBv4iTm0GLrSq7ZmQmYH
 1JRZSk3QtxRfVMVKizp2L/K22lPSMIViYoAsTGYTbRAmNyjBGJNSZrgCs3BBi/1F
 mxINtpyg2MyWOg9aNIzil6ZfwcPEazt9US6XM/2Tcs3z9wDO5bfRIgD3ILoWcT7D
 RPwLbtMi242Uak+Eyi44QCfwB5UjC1UvDdKjgr3paHiTVm7LS0dCEnBhaDhtGeb8
 bqEnSVH9oHA0XQhUAYdFNMQN0n1+bEDbqnbz9JLg4iJt6jXpvY8oL9xi7k/FglSu
 zXlhRRE4G7AYpBoCvQp/Anh85aCAcsZ9nP4aSN8GXLi7IqyaZ7KRTBHrAFxYi/WP
 dXVaqR984w5bEBDLRUsGosKHlHXHMnAwPDthQhuRrCqqmE/YyzpOaCsG46Wzpriy
 Jg302QmlTOMfx0uUoCVsiEq6rwar6LGTP7raihaR8j9g0EzFr7f4FpzmWxQpvJqG
 YpE3jVwp3OOKJjOETIW6ko2lzai3GOP9rPqoPfOhtqeALHLtORlg7XAhBj7n3Tji
 rLHKmVIxiiAmkfQItMdRjJbu9gFAiW+ZR7nEnDnhMjer1iPkJX+DtCLEZFpui7Me
 WrrQx4ypeO4RFemQCQ==
 =bDrL
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-5.3-rc6' of git://git.kernel.org/pub/scm/linux/kernel/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
This commit is contained in:
Linus Torvalds 2019-08-25 11:40:24 -07:00
commit 32ae83ffec
3 changed files with 20 additions and 12 deletions

View File

@ -34,10 +34,13 @@ static inline void time_travel_set_time(unsigned long long ns)
time_travel_time = ns; time_travel_time = ns;
} }
static inline void time_travel_set_timer(enum time_travel_timer_mode mode, static inline void time_travel_set_timer_mode(enum time_travel_timer_mode mode)
unsigned long long expiry)
{ {
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; time_travel_timer_expiry = expiry;
} }
#else #else
@ -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, static inline void time_travel_set_timer_mode(enum time_travel_timer_mode mode)
unsigned long long expiry) {
}
static inline void time_travel_set_timer_expiry(unsigned long long expiry)
{ {
} }

View File

@ -213,7 +213,7 @@ static void time_travel_sleep(unsigned long long duration)
if (time_travel_timer_mode != TT_TMR_DISABLED || if (time_travel_timer_mode != TT_TMR_DISABLED ||
time_travel_timer_expiry < next) { time_travel_timer_expiry < next) {
if (time_travel_timer_mode == TT_TMR_ONESHOT) 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 * time_travel_time will be adjusted in the timer
* IRQ handler so it works even when the signal * IRQ handler so it works even when the signal

View File

@ -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) static int itimer_shutdown(struct clock_event_device *evt)
{ {
if (time_travel_mode != TT_MODE_OFF) 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) if (time_travel_mode != TT_MODE_INFCPU)
os_timer_disable(); os_timer_disable();
@ -62,9 +62,10 @@ static int itimer_set_periodic(struct clock_event_device *evt)
{ {
unsigned long long interval = NSEC_PER_SEC / HZ; unsigned long long interval = NSEC_PER_SEC / HZ;
if (time_travel_mode != TT_MODE_OFF) if (time_travel_mode != TT_MODE_OFF) {
time_travel_set_timer(TT_TMR_PERIODIC, time_travel_set_timer_mode(TT_TMR_PERIODIC);
time_travel_time + interval); time_travel_set_timer_expiry(time_travel_time + interval);
}
if (time_travel_mode != TT_MODE_INFCPU) if (time_travel_mode != TT_MODE_INFCPU)
os_timer_set_interval(interval); os_timer_set_interval(interval);
@ -77,9 +78,10 @@ static int itimer_next_event(unsigned long delta,
{ {
delta += 1; delta += 1;
if (time_travel_mode != TT_MODE_OFF) if (time_travel_mode != TT_MODE_OFF) {
time_travel_set_timer(TT_TMR_ONESHOT, time_travel_set_timer_mode(TT_TMR_ONESHOT);
time_travel_time + delta); time_travel_set_timer_expiry(time_travel_time + delta);
}
if (time_travel_mode != TT_MODE_INFCPU) if (time_travel_mode != TT_MODE_INFCPU)
return os_timer_one_shot(delta); return os_timer_one_shot(delta);