summaryrefslogtreecommitdiff
path: root/arch/um/kernel/skas/syscall.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/kernel/skas/syscall.c')
-rw-r--r--arch/um/kernel/skas/syscall.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/arch/um/kernel/skas/syscall.c b/arch/um/kernel/skas/syscall.c
index b783ac87d98a..f574b1856bc6 100644
--- a/arch/um/kernel/skas/syscall.c
+++ b/arch/um/kernel/skas/syscall.c
@@ -1,6 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
- * Licensed under the GPL
*/
#include <linux/kernel.h>
@@ -10,12 +10,23 @@
#include <sysdep/ptrace.h>
#include <sysdep/ptrace_user.h>
#include <sysdep/syscalls.h>
+#include <shared/timer-internal.h>
void handle_syscall(struct uml_pt_regs *r)
{
struct pt_regs *regs = container_of(r, struct pt_regs, regs);
int syscall;
+ /*
+ * If we have infinite CPU resources, then make every syscall also a
+ * preemption point, since we don't have any other preemption in this
+ * case, and kernel threads would basically never run until userspace
+ * went to sleep, even if said userspace interacts with the kernel in
+ * various ways.
+ */
+ if (time_travel_mode == TT_MODE_INFCPU)
+ schedule();
+
/* Initialize the syscall number and default return value. */
UPT_SYSCALL_NR(r) = PT_SYSCALL_NR(r->gp);
PT_REGS_SET_SYSCALL_RETURN(regs, -ENOSYS);