From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37410) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6HNw-0007cY-UM for qemu-devel@nongnu.org; Fri, 27 May 2016 09:01:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b6HNr-0001Eu-H9 for qemu-devel@nongnu.org; Fri, 27 May 2016 09:01:03 -0400 Received: from mail-lf0-x22f.google.com ([2a00:1450:4010:c07::22f]:36679) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6HNr-0001El-45 for qemu-devel@nongnu.org; Fri, 27 May 2016 09:00:59 -0400 Received: by mail-lf0-x22f.google.com with SMTP id b73so23106481lfb.3 for ; Fri, 27 May 2016 06:00:58 -0700 (PDT) From: riku.voipio@linaro.org Date: Fri, 27 May 2016 16:00:12 +0300 Message-Id: <71a8f7fece3e42dc55e865e081866f62f5c8c07e.1464353863.git.riku.voipio@linaro.org> In-Reply-To: References: Subject: [Qemu-devel] [PULL v2 21/38] linux-user: Add debug code to exercise restarting system calls List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Timothy E Baldwin From: Timothy E Baldwin 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 Message-id: 1441497448-32489-10-git-send-email-T.E.Baldwin99@members.leeds.ac.uk [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 Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- 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 #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