From patchwork Wed May 25 10:31:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 9135125 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 ECD7960221 for ; Wed, 25 May 2016 10:46:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2002281E3 for ; Wed, 25 May 2016 10:46:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6F2A282A2; Wed, 25 May 2016 10:46:12 +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 B6FC02824F for ; Wed, 25 May 2016 10:46:11 +0000 (UTC) Received: from localhost ([::1]:58870 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5WKI-00055S-RK for patchwork-qemu-devel@patchwork.kernel.org; Wed, 25 May 2016 06:46:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5W79-0001EH-U8 for qemu-devel@nongnu.org; Wed, 25 May 2016 06:32:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b5W72-0003Bf-2y for qemu-devel@nongnu.org; Wed, 25 May 2016 06:32:35 -0400 Received: from mail-lb0-x232.google.com ([2a00:1450:4010:c04::232]:35103) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5W71-0003BO-R4 for qemu-devel@nongnu.org; Wed, 25 May 2016 06:32:28 -0400 Received: by mail-lb0-x232.google.com with SMTP id ww9so14019736lbc.2 for ; Wed, 25 May 2016 03:32:27 -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=TL+zyD5tZ59fUY3iY9yh1MQwgaeSJcvM2niXDjV/dqh+Dk6tUgc/x6o6Nfa+zwHlvX fJtkPKu3d2njLouq5PbHI31HngpCzx5wxKwSaHprwZ9tWW1vmm7cDJme4bNQpXFB7vbc phsAztb2WyIiYIeC2wmBS9unaR+JN7MXEW3WI= 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=JG8ph1iSvoQ+Su+jfswsuESfrZiGMQa/oKRlap3+GLBZcyPHk8XKpdG67loipfvzNf 8Yqokm/IycZ3Evn7RF/9vAPfCKhf7p09fNoM6LWIs0izps85n53qROCps3OdzrQY3idi IWZpp7aQNWLHaUvQXtjHb+7rVKw/D2Ep2RjH2c1WVPSk/yilz0PRD2e9SHQPpKlqw+ur Sps7HTN28lU1QUYKI6uiuEZ5mxakG5kq1ysHJlUw2LzVpUWEdE7pT9VABySUfnyzWNxt /WUpFjk5pSc6SNjtfc/iWUCDDiYvSyAmBv/Tkm9hz3qYKOeKIUjt+1VYUCML+wxnjrVR i1JQ== X-Gm-Message-State: ALyK8tILZT04+ZcvlAK5NnacB7277BuNV+20O6rVuXqmDUo5M1NILVGfNktMM1GBcqyf4Awj X-Received: by 10.112.158.71 with SMTP id ws7mr794086lbb.32.1464172347030; Wed, 25 May 2016 03:32:27 -0700 (PDT) Received: from beaming.home (91-157-168-132.elisa-laajakaista.fi. [91.157.168.132]) by smtp.gmail.com with ESMTPSA id o75sm1379610lfi.9.2016.05.25.03.32.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 May 2016 03:32:26 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 25 May 2016 13:31:53 +0300 Message-Id: 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:c04::232 Subject: [Qemu-devel] [PULL 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