um: time-travel: Rewrite as an event scheduler
authorJohannes Berg <johannes.berg@intel.com>
Thu, 13 Feb 2020 13:26:45 +0000 (14:26 +0100)
committerRichard Weinberger <richard@nod.at>
Sun, 29 Mar 2020 21:28:51 +0000 (23:28 +0200)
commit4b786e24ca80a492736b359b3d1a8d07612a78e5
tree9339ed3ac66bec47806a03f8dbccb63cee77a57f
parentf185063bff914e589b50f1b711fc42218c4790c6
um: time-travel: Rewrite as an event scheduler

Instead of tracking all the various timer configurations,
modify the time-travel mode to have an event scheduler and
use a timer event on the scheduler to handle the different
timer configurations.

This doesn't change the function right now, but it prepares
the code for having different kinds of events in the future
(i.e. interrupts coming from other devices that are part of
co-simulation.)

While at it, also move time_travel_sleep() to time.c to
reduce the externally visible API surface.

Also, we really should mark time-travel as incompatible with
SMP, even if UML doesn't support SMP yet.

Finally, I noticed a bug while developing this - if we move
time forward due to consuming time while reading the clock,
we might move across the next event and that would cause us
to go backward in time when we then handle that event. Fix
that by invoking the whole event machine in this case, but
in order to simplify this, make reading the clock only cost
something when interrupts are not disabled. Otherwise, we'd
have to hook into the interrupt delivery machinery etc. and
that's somewhat intrusive.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
arch/um/Kconfig
arch/um/include/linux/time-internal.h
arch/um/kernel/process.c
arch/um/kernel/time.c