From patchwork Fri May 27 13:00:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 9138353 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2FC0D60467 for ; Fri, 27 May 2016 13:23:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FE5726FC9 for ; Fri, 27 May 2016 13:23:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 14AFB27E3D; Fri, 27 May 2016 13:23:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, FSL_HELO_HOME, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8047526FC9 for ; Fri, 27 May 2016 13:23:31 +0000 (UTC) Received: from localhost ([::1]:45798 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6Hje-0003h7-3u for patchwork-qemu-devel@patchwork.kernel.org; Fri, 27 May 2016 09:23:30 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2fg6gGN3x24/o2IWhl+bi6/Z1GlkYMR6n+8SCS9PKFg=; b=EcVJ9C5p1J3So0aCXbCei9ryM9AvJePPCpfK7wz4B+E+FyQG19IPuqfSTc5BmHFyfg +5CloB5FGTyw8n3DPlKW1jNO+oyfXaJMpfF2I4GYPdvmf/FibN27tWWboGFPn0m1kB+m eYje4yruNlSfPlln+MLmuD541zlqiWt2fbBeE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2fg6gGN3x24/o2IWhl+bi6/Z1GlkYMR6n+8SCS9PKFg=; b=FLPnZFnuMyjnBii3KfyFCfNOU//pauWt9CZsyni5qsT3urhm9gbTfv4PV+WsBnIhBQ GHMRRDa8WcTclQqnOV37g68AohWGcj8LtWEa2/xWdg6aL/HgMGLnp7EeYyZXwN2Nag/0 6S6xfZEr+60qpS97QnC/+ymQzBlkZUg4zbb3lrDmfKKWRMUqx9l+ZAVXyP2LkgTGQhKo 1dAVoykIPCQ8pYwf/N/yYMNW1C2xYSH8EmLc9FmsQK4gJRlvpWzY1SpLY5nFhl+i570o +Y4pgQ07XUXOjaoaF1PWUioEInreeFgwXIuJqAWJAIVGT9ilr0CpuC3lYGTE4Oytfi7h BCWw== X-Gm-Message-State: ALyK8tIeYUHjEg3KcEvmHzb7ZN3TBsCT9uY7Pd3eymwXgWMK1AhEjMDdOUn3h9IvOob+zmQM X-Received: by 10.25.90.15 with SMTP id o15mr4360207lfb.67.1464354058280; Fri, 27 May 2016 06:00:58 -0700 (PDT) Received: from beaming.home (91-157-168-132.elisa-laajakaista.fi. [91.157.168.132]) by smtp.gmail.com with ESMTPSA id n16sm2281066lfg.31.2016.05.27.06.00.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 May 2016 06:00:57 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Fri, 27 May 2016 16:00:12 +0300 Message-Id: <71a8f7fece3e42dc55e865e081866f62f5c8c07e.1464353863.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::22f Subject: [Qemu-devel] [PULL v2 21/38] linux-user: Add debug code to exercise restarting system calls X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Timothy E Baldwin Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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