Skip to content

Commit 49caacf

Browse files
benzeajmberg-intel
authored andcommitted
um: do not send SIGALRM to userspace in time-travel mode
We send a SIGALRM to userspace processes to interrupt them. Really, doing so is only needed if they are actually executing at the time (to ensure we return to kernelspace). Unfortunately, we do not have that information readily available. We can however be sure that this is never the case when we are in time-travel mode with infinite CPU. Signed-off-by: Benjamin Berg <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent 82c8e12 commit 49caacf

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

arch/um/kernel/time.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -856,11 +856,16 @@ static struct clock_event_device timer_clockevent = {
856856

857857
static irqreturn_t um_timer(int irq, void *dev)
858858
{
859-
if (get_current()->mm != NULL)
860-
{
861-
/* userspace - relay signal, results in correct userspace timers */
859+
/*
860+
* Interrupt the (possibly) running userspace process, technically this
861+
* should only happen if userspace is currently executing.
862+
* With infinite CPU time-travel, we can only get here when userspace
863+
* is not executing. Do not notify there and avoid spurious scheduling.
864+
*/
865+
if (time_travel_mode != TT_MODE_INFCPU &&
866+
time_travel_mode != TT_MODE_EXTERNAL &&
867+
get_current()->mm)
862868
os_alarm_process(get_current()->mm->context.id.pid);
863-
}
864869

865870
(*timer_clockevent.event_handler)(&timer_clockevent);
866871

0 commit comments

Comments
 (0)