From nobody Mon Feb 9 09:33:23 2026 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.zohomail.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 1500520935548415.44915085903915; Wed, 19 Jul 2017 20:22:15 -0700 (PDT) Received: from localhost ([::1]:35849 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dY22X-0004ri-Q2 for importer@patchew.org; Wed, 19 Jul 2017 23:22:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dY1qO-00016Y-AP for qemu-devel@nongnu.org; Wed, 19 Jul 2017 23:09:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dY1qJ-0005r4-Sx for qemu-devel@nongnu.org; Wed, 19 Jul 2017 23:09:40 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:33885) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dY1qJ-0005pk-Nv for qemu-devel@nongnu.org; Wed, 19 Jul 2017 23:09:35 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 5793120B52; Wed, 19 Jul 2017 23:09:35 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Wed, 19 Jul 2017 23:09:35 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 1B604241E0; Wed, 19 Jul 2017 23:09:35 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=k+b TzhZBey2LiM9kFswUkkZ8GYJVyHRbUTIpeuPQ5kc=; b=jQiYA01ME6j9mHtLO0+ eSKSAaLzW+jr9iUKgRSFoPbSbttgNdYcNc6+syqzOxv6sgkTBrWeZhlurNF8mrXm 1gPeCNbNOO83IinB2qpiUz5dMK20uVuiRNqII3IPRfFVlq0Ll6fIfr1pa2zbin+B 9/o22n+GfFtee1CYWiXsTDCE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=k+bTzhZBey2LiM9kFswUkkZ8GYJVyHRbUTIpeuPQ5 kc=; b=TWvOfgJRAlZa0W9OQvkHPdd9MWYTbo2RCPiirIu9NTGGQcm88z9lZjSBZ kuXKgLieCPZzGLz4ZhsnvcHo3NtFoRM2h69Cpqcity2pos6dd9IkUAyesP7zkF/0 RNZRGrujLnD1zIkzxEgnwukKbEEJ2pdn921ch4K9dVI8OkTcGc9jOGn1Oz9GOUPR 4oTxsnCPFUJTfxNO1VQeM/npzgvum+54foG91qGuf15JhDmsLVw7ShOe6YMliscU bX9tKL23405WK3zcVR5rWUwQvHM/T/R2p3MGwlO49bOaPKtg6q2y8fHxzj3JN9Ew CSNgSRVmp1/5Dj4tizTuXuIy+o3BQ== X-ME-Sender: X-Sasl-enc: 92pBxn/aufqbBEVKI0RItYbRtUP9JetTkbvaXY2bZn9p 1500520175 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Wed, 19 Jul 2017 23:09:07 -0400 Message-Id: <1500520169-23367-22-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500520169-23367-1-git-send-email-cota@braap.org> References: <1500520169-23367-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.25 Subject: [Qemu-devel] [PATCH v3 21/43] cpu-exec: lookup/generate TB outside exclusive region during step_atomic 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: Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Now that all code generation has been converted to check CF_PARALLEL, we can generate !CF_PARALLEL code without having yet set !parallel_cpus -- and therefore without having to be in the exclusive region during cpu_exec_step_atomic. While at it, merge cpu_exec_step into cpu_exec_step_atomic. Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota --- accel/tcg/cpu-exec.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index b71e015..526cab3 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -223,30 +223,40 @@ static void cpu_exec_nocache(CPUState *cpu, int max_c= ycles, } #endif =20 -static void cpu_exec_step(CPUState *cpu) +void cpu_exec_step_atomic(CPUState *cpu) { CPUClass *cc =3D CPU_GET_CLASS(cpu); TranslationBlock *tb; target_ulong cs_base, pc; uint32_t flags; uint32_t cflags =3D 1 | CF_IGNORE_ICOUNT; + uint32_t cf_mask =3D cflags & CF_HASH_MASK; =20 if (sigsetjmp(cpu->jmp_env, 0) =3D=3D 0) { - tb =3D tb_lookup__cpu_state(cpu, &pc, &cs_base, &flags, - cflags & CF_HASH_MASK); + tb =3D tb_lookup__cpu_state(cpu, &pc, &cs_base, &flags, cf_mask); if (tb =3D=3D NULL) { mmap_lock(); tb_lock(); - tb =3D tb_gen_code(cpu, pc, cs_base, flags, cflags); + tb =3D tb_htable_lookup(cpu, pc, cs_base, flags, cf_mask); + if (likely(tb =3D=3D NULL)) { + tb =3D tb_gen_code(cpu, pc, cs_base, flags, cflags); + } tb_unlock(); mmap_unlock(); } =20 + start_exclusive(); + + /* Since we got here, we know that parallel_cpus must be true. */ + parallel_cpus =3D false; cc->cpu_exec_enter(cpu); /* execute the generated code */ trace_exec_tb(tb, pc); cpu_tb_exec(cpu, tb); cc->cpu_exec_exit(cpu); + parallel_cpus =3D true; + + end_exclusive(); } else { /* We may have exited due to another problem here, so we need * to reset any tb_locks we may have taken but didn't release. @@ -260,18 +270,6 @@ static void cpu_exec_step(CPUState *cpu) } } =20 -void cpu_exec_step_atomic(CPUState *cpu) -{ - start_exclusive(); - - /* Since we got here, we know that parallel_cpus must be true. */ - parallel_cpus =3D false; - cpu_exec_step(cpu); - parallel_cpus =3D true; - - end_exclusive(); -} - struct tb_desc { target_ulong pc; target_ulong cs_base; --=20 2.7.4