From nobody Tue Apr 23 15:04:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486752433883263.50360584860914; Fri, 10 Feb 2017 10:47:13 -0800 (PST) Received: from localhost ([::1]:45519 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccGDw-00053H-6u for importer@patchew.org; Fri, 10 Feb 2017 13:47:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccGCM-0004Aj-FD for qemu-devel@nongnu.org; Fri, 10 Feb 2017 13:45:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ccGCH-0004p3-Ot for qemu-devel@nongnu.org; Fri, 10 Feb 2017 13:45:34 -0500 Received: from mail-yw0-x241.google.com ([2607:f8b0:4002:c05::241]:34005) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ccGCH-0004oj-JV for qemu-devel@nongnu.org; Fri, 10 Feb 2017 13:45:29 -0500 Received: by mail-yw0-x241.google.com with SMTP id v73so3180370ywg.1 for ; Fri, 10 Feb 2017 10:45:29 -0800 (PST) Received: from localhost.localdomain (c-73-207-178-95.hsd1.ga.comcast.net. [73.207.178.95]) by smtp.gmail.com with ESMTPSA id p4sm1065798ywe.30.2017.02.10.10.45.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Feb 2017 10:45:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WWf9nAL7AlPALT/08P1mnBd7TNyhg+8+aQ1eAVQwkxo=; b=o4nhFcWgjJnSkvaOuLImALHeErNsz9ezxJ4B9CqVDtizGneYodLeF7/lAqT415bseh hAElsAI3ikhOd7e0LGqRHJKpDPTvYoz3eVd2MNTF9D6YE33bG2v8kTNr5Ll9NpNkpIC/ rbmbE+SdjhZ81aWh5SGD3cFC/W7q5kNYq9AiDL2r1agVo1vkt++YOIybrR0CyPgB+6rg jPVkC2iZnFlv1tevY+NhGkhORS+ITzCBfCfOATkjLxyTB2hqqSzBgGQYms2qm0BB7L/H flGFpwu11YEu55/pOoICl/Imvtt2AiCsn9TwgGcT2+KmnHpG+PrNuarN6BfS3F085VIs U/8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WWf9nAL7AlPALT/08P1mnBd7TNyhg+8+aQ1eAVQwkxo=; b=fSY0ZoesxsHD+ZOqDFOSCu41bXTpUP31W3DbnbEVFJJwOvs6a/jqKuCPtaIU9oSyBJ IK6i0zNWqevirBOj7w4ZAm7tz/yqz0QVKt3sNTYb0hXRcxOMZGBQ0R1W9VrCVO736M4+ /xW/+KmBbOKKY4OKRGvLo6hZtRDTd3yMIbvc+2Zg/oyPD/J5DZrs0I9V4arEW8AuOyIM Va4S1/nsTXeOomZW3ncTvvmeKRnyj3iBBIhT8hl0bkh/eX7UStpE151fXhxgso3PLCwl CobL712ZygXotUzw2OU5x6OzQ3U3z2Hw9eMTefk9gZsQBXXyPadFTQjdTzCnbgeHyuKI UxIw== X-Gm-Message-State: AMke39l5sd+n3TdsOOUn2u7CMTEGev1tlSxxI/XXLpkuGhniAaOGkDoQJjaRk4aQe3brTQ== X-Received: by 10.13.205.2 with SMTP id p2mr7659683ywd.358.1486752328726; Fri, 10 Feb 2017 10:45:28 -0800 (PST) From: Pranith Kumar To: Paolo Bonzini , Peter Crosthwaite , Richard Henderson , qemu-devel@nongnu.org (open list:Overall) Date: Fri, 10 Feb 2017 13:45:24 -0500 Message-Id: <20170210184525.10966-2-bobby.prani@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170210184525.10966-1-bobby.prani@gmail.com> References: <20170210184525.10966-1-bobby.prani@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4002:c05::241 Subject: [Qemu-devel] [PATCH v2 1/2] tcg: Save cpu flags in atomic execution 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 The current mechanism discards the flags which were set in atomic execution. Properly save them. CC: Alex Benn=C3=A9e CC: Richard Henderson CC: Paolo Bonzini Signed-off-by: Pranith Kumar --- cpu-exec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cpu-exec.c b/cpu-exec.c index b0ddada8c1..9200c643c2 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -228,6 +228,7 @@ static void cpu_exec_nocache(CPUState *cpu, int max_cyc= les, =20 static void cpu_exec_step(CPUState *cpu) { + CPUClass *cc =3D CPU_GET_CLASS(cpu); CPUArchState *env =3D (CPUArchState *)cpu->env_ptr; TranslationBlock *tb; target_ulong cs_base, pc; @@ -239,9 +240,13 @@ static void cpu_exec_step(CPUState *cpu) 1 | CF_NOCACHE | CF_IGNORE_ICOUNT); tb->orig_tb =3D NULL; tb_unlock(); + + cc->cpu_exec_enter(cpu); /* execute the generated code */ trace_exec_tb_nocache(tb, pc); cpu_tb_exec(cpu, tb); + + cc->cpu_exec_exit(cpu); tb_lock(); tb_phys_invalidate(tb, -1); tb_free(tb); --=20 2.11.0 From nobody Tue Apr 23 15:04:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486752435792455.8378861144996; Fri, 10 Feb 2017 10:47:15 -0800 (PST) Received: from localhost ([::1]:45521 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccGDy-0005CC-Ed for importer@patchew.org; Fri, 10 Feb 2017 13:47:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccGCM-0004Ak-J6 for qemu-devel@nongnu.org; Fri, 10 Feb 2017 13:45:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ccGCI-0004ph-Ic for qemu-devel@nongnu.org; Fri, 10 Feb 2017 13:45:34 -0500 Received: from mail-yw0-x242.google.com ([2607:f8b0:4002:c05::242]:36104) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ccGCI-0004pO-E8 for qemu-devel@nongnu.org; Fri, 10 Feb 2017 13:45:30 -0500 Received: by mail-yw0-x242.google.com with SMTP id q71so3159902ywg.3 for ; Fri, 10 Feb 2017 10:45:30 -0800 (PST) Received: from localhost.localdomain (c-73-207-178-95.hsd1.ga.comcast.net. [73.207.178.95]) by smtp.gmail.com with ESMTPSA id p4sm1065798ywe.30.2017.02.10.10.45.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Feb 2017 10:45:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VTbZn1f+2L75bdyrsF7pw//6OWyuuQ4HFPdwAWmOklo=; b=pq5kP+7xz0Fz61/wfZWBZ6WyERwaxc6UxQzD/wHeKBdkplq+I4MNBOxsLpbjYlS7L3 yiuWHbHUBpoNTNIAgrNEvGqFYA5zuUyYjhdtBws5iL7jQhEJSLj2yxDbmsY2yDQeLtXX Ur6o8zojS3czoWTti91EvVyLVK4keNSc9er6Ib5JnDMgmWOFiO9xf0kt0cwskbLdj++N j0glPXII9Oz0HboGqsHkrKFjzAX8KA7xRLYAFn1WOGOZtUdYMTnrtAw7NBDuEju9Owit s1ov3GinMspNrZP117GQOhdGTJRU6/V4W5xRUA2AAK8rc9WYtb9SUN35D/ugPUdK/D7c Fw0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VTbZn1f+2L75bdyrsF7pw//6OWyuuQ4HFPdwAWmOklo=; b=PG+BPFzxYphGhw2xJrAGxLDwKJ2FwXWBHgF5hXVsMFGnw1PdeA/IjxQGJ+dB+1C2mv FUMZF/MwE1SwM1Y70qLZFJAAdxHPhYrnk5pJELiE7oFOl9Kq/IpbPGftxz45RBBa2Wba YH/pYi5oz3alDPsXRSu5B8h36u3OiJKaTmlWsewrYUJJ//+1/H2+fZd53/3krCj3QOh5 nfsFeVviPk7gMjX4wBhT3mF/sD0jAQfy8qmUb/pz3nWkaz816vJ06q0eXjtPGpadfDYw 2PYzCiKZkYQ/ZXTegB0QKyA3etCvck5ZGEY7U20cXhhGUl6xsFL5tm5jhAoAeEb4BBTr VZ3Q== X-Gm-Message-State: AMke39k7CnfQkQyC1Xi09ZROjLW7ylfMU98p1HEE6DeMfrshkJ8SOaio3FIuZH8vuOJPpg== X-Received: by 10.129.177.197 with SMTP id p188mr7492288ywh.183.1486752329770; Fri, 10 Feb 2017 10:45:29 -0800 (PST) From: Pranith Kumar To: Paolo Bonzini , Peter Crosthwaite , Richard Henderson , qemu-devel@nongnu.org (open list:Overall) Date: Fri, 10 Feb 2017 13:45:25 -0500 Message-Id: <20170210184525.10966-3-bobby.prani@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170210184525.10966-1-bobby.prani@gmail.com> References: <20170210184525.10966-1-bobby.prani@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4002:c05::242 Subject: [Qemu-devel] [PATCH v2 2/2] tcg: Set jmp_env for exceptions from atomic execution 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 The current method of executing atomic code in a guest uses cpu_exec_step_atomic() from the outermost loop. This causes an abort() when single stepping over atomic code since debug exception longjmp will point to the the setlongjmp in cpu_exec(). Properly set jmp_env so that it jumps back here on an exception. CC: Alex Benn=C3=A9e CC: Richard Henderson CC: Paolo Bonzini Signed-off-by: Pranith Kumar --- cpu-exec.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index 9200c643c2..e61f5747c8 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -242,9 +242,12 @@ static void cpu_exec_step(CPUState *cpu) tb_unlock(); =20 cc->cpu_exec_enter(cpu); - /* execute the generated code */ - trace_exec_tb_nocache(tb, pc); - cpu_tb_exec(cpu, tb); + + if (sigsetjmp(cpu->jmp_env, 0) =3D=3D 0) { + /* execute the generated code */ + trace_exec_tb_nocache(tb, pc); + cpu_tb_exec(cpu, tb); + } =20 cc->cpu_exec_exit(cpu); tb_lock(); --=20 2.11.0