[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 21/38] linux-user: Add debug code to exercise rest
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PULL v2 21/38] linux-user: Add debug code to exercise restarting system calls |
Date: |
Fri, 27 May 2016 16:00:12 +0300 |
From: Timothy E Baldwin <address@hidden>
If DEBUG_ERESTARTSYS is set restart all system calls once. This
is pure debug code for exercising the syscall restart code paths
in the per-architecture cpu main loops.
Signed-off-by: Timothy Edward Baldwin <address@hidden>
Message-id: address@hidden
[PMM: Add comment and a commented-out #define next to the commented-out
generic DEBUG #define; remove the check on TARGET_USE_ERESTARTSYS;
tweak comment message]
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Peter Maydell <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
linux-user/syscall.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index a4a1af7..ced519d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -110,6 +110,10 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
CLONE_PARENT_SETTID | CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID)
//#define DEBUG
+/* Define DEBUG_ERESTARTSYS to force every syscall to be restarted
+ * once. This exercises the codepaths for restart.
+ */
+//#define DEBUG_ERESTARTSYS
//#include <linux/msdos_fs.h>
#define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct
linux_dirent [2])
@@ -5871,6 +5875,21 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
arg1,
struct statfs stfs;
void *p;
+#if defined(DEBUG_ERESTARTSYS)
+ /* Debug-only code for exercising the syscall-restart code paths
+ * in the per-architecture cpu main loops: restart every syscall
+ * the guest makes once before letting it through.
+ */
+ {
+ static int flag;
+
+ flag = !flag;
+ if (flag) {
+ return -TARGET_ERESTARTSYS;
+ }
+ }
+#endif
+
#ifdef DEBUG
gemu_log("syscall %d", num);
#endif
--
2.1.4
- [Qemu-devel] [PULL v2 16/38] linux-user: Support for restarting system calls for S390 targets, (continued)
- [Qemu-devel] [PULL v2 16/38] linux-user: Support for restarting system calls for S390 targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 11/38] linux-user: Support for restarting system calls for SH4 targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 14/38] linux-user: Support for restarting system calls for OpenRISC targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 13/38] linux-user: Support for restarting system calls for UniCore32 targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 15/38] linux-user: Support for restarting system calls for M68K targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 12/38] linux-user: Support for restarting system calls for Alpha targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 17/38] linux-user: Support for restarting system calls for CRIS targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 18/38] linux-user: Support for restarting system calls for tilegx targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 23/38] linux-user: Use safe_syscall for read and write system calls, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 20/38] linux-user: Support for restarting system calls for Microblaze targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 21/38] linux-user: Add debug code to exercise restarting system calls,
riku . voipio <=
- [Qemu-devel] [PULL v2 19/38] linux-user: Set r14 on exit from microblaze syscall, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 22/38] linux-user: Provide safe_syscall for fixing races between signals and syscalls, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 24/38] linux-user: Use safe_syscall for open and openat system calls, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 25/38] linux-user: Use safe_syscall for wait system calls, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 29/38] linux-user: Handle negative values in timespec conversion, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 26/38] linux-user: Use safe_syscall for execve syscall, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 27/38] linux-user: Use safe_syscall for pselect, select syscalls, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 28/38] linux-user: Use safe_syscall for futex syscall, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 31/38] linux-user: Use g_try_malloc() in do_msgrcv(), riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 33/38] linux-user: Use direct syscalls for setuid(), etc, riku . voipio, 2016/05/27