From patchwork Fri Mar 10 10:31:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 661620 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp772077wrb; Fri, 10 Mar 2023 02:35:16 -0800 (PST) X-Google-Smtp-Source: AK7set9QAD9gJeBNhg+wFUhrDuhdv3tg4ODRi0havNgISZHyChUu1O1c4XJuYLqb70EJGBekVsK/ X-Received: by 2002:a05:6214:519a:b0:56e:f1fd:f177 with SMTP id kl26-20020a056214519a00b0056ef1fdf177mr7782203qvb.42.1678444516747; Fri, 10 Mar 2023 02:35:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678444516; cv=none; d=google.com; s=arc-20160816; b=YlPyRFWED83j8JP3bp/+PjYvmxD8PLpnYg5y+jpwzx3MhUKbpPYN3XgE5Cq2E4iTmj 9tro9zqIv9VKQSWsfQfs0KYy208SLegZale6aa0sojQlt23eQcPeIb2pi1acK3CE69UJ 2aDT9E3IbsXnxkA2h4NCXIqju5WRgeHVRoQLa1XsUGB6PC+DjlNBfRifVqkXsMgZrZmx DpTYwxhpVieXPPesNFnPg0Ei2eCvfieFPHlBAWqjvOwNqQxgsCBDyQZZPkPlQi8gQU9t nvW6BncfbD6GR1aRcDhHY3fBEyr+ozOTGuXf9kCH4g6a9ne9aTPV2AJQ9C3TGUsoUejc EENg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BZ6HFIIZGYyqYaj8Vony/3+KKuP79LxepubYtEH6JNY=; b=pVicjLQcnUNj4Q0Itlqj7ntsr2OOd5kFsvFP+kk7+xaGRE9dTh5+75sRQl345dhh2s gB0jf3JZepZGsjoYUvgeD3c9qSrw1P/N6MWMgmHjh84UA7L6wQ2gx7IkGq0kP5yJwmV3 TtMnPJXJvkMalwgR7CB0PwwX6NYKL5/pkHZ6Yy1bISncelZuJUqDzMHd42N2olYsQEBa 1ku6L7NLFM842bUBYGzFyqCiRbbQ3vOIspMx6qQz1k7sWzFyTR6Zmv5QaykRRJD3EO2/ YPRREb0a/sDf4NhpL99coNfhuwQWOOhBeSOfSKoIuEtZZcd3lYjs8qNDxgswsks3e3K8 QT5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kbeGCVUP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d16-20020a0cdb10000000b005836af2bd6esi1291844qvk.436.2023.03.10.02.35.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Mar 2023 02:35:16 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kbeGCVUP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1paa2D-0007fC-3U; Fri, 10 Mar 2023 05:31:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1paa29-0007aQ-F5 for qemu-devel@nongnu.org; Fri, 10 Mar 2023 05:31:33 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1paa25-0004HP-95 for qemu-devel@nongnu.org; Fri, 10 Mar 2023 05:31:33 -0500 Received: by mail-wm1-x32a.google.com with SMTP id j19-20020a05600c191300b003eb3e1eb0caso5649460wmq.1 for ; Fri, 10 Mar 2023 02:31:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678444287; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BZ6HFIIZGYyqYaj8Vony/3+KKuP79LxepubYtEH6JNY=; b=kbeGCVUP7qNEetV5PYIqxJXznSX7ynlMAv7ikxsgxTmiP/tZl7/FjsFMKePy/uVQOt ut4h2DfB9VxArsPBObBxjnRL7LhySNAGFn8NZBLPnZ+YefiQqF8bL/zSsNxj432QKo4+ rmjT8ZG1Oiv3gLkmXvtdcQNFOVGQP7UGNtzaZ+gYfNxMSZ0pTgIGEUls3aUJy/XYo1oL o6s0nrCc4gkdNsMSu5z7ylJlm+2npVBHcyZjtxi/UmXCAa0Urscd8tzszDvrpT4zMt17 TFSu6sUEkqDSCmp9cGPewCyd3zU08hmCwgKI+26TOpYRqLJbzmGmMkcHeC4gULC89Dfu FN4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678444287; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BZ6HFIIZGYyqYaj8Vony/3+KKuP79LxepubYtEH6JNY=; b=uEEwipw6UX63SZfHX5822mAPqxqS4/DvERjKC5sEAsd5VlyIziHT3hUkTqlz6Z3khp FHCEvwVaBkWozQUj89YkN2qg03DRlkmDq+iaXV0/4OR38zIWFYllRFhkdu8NMCRuwqQy B9FUeY4ZHeJM+tllT580GR5OnJsvlc3QTe7328nP0KPOX6oqi1s0vBo7lD8nFl3SFdqz b/ksQlrZ6euk6psX9bpY0BDVmD9Qwnipf1IEw3zvjAPHdP2AyR8wxdJcPLe4qcMMsdDk RXfqmproFaCbe5R0hp7qpD05GRqa8X62BzUuUDtuOGlmpjSEUJe/V8uFwnFVLK/pQcuN ao7g== X-Gm-Message-State: AO0yUKW8wcMUFpjsuJMBnt7Yg/5oe/yJ1upQUgY6Eidh+++ifIRdycyT cKtxq+aQuLeR6T6sKt0zS/KmNz0VT0R+4E+Syps= X-Received: by 2002:a05:600c:190e:b0:3df:e4b4:de69 with SMTP id j14-20020a05600c190e00b003dfe4b4de69mr2190618wmq.27.1678444287666; Fri, 10 Mar 2023 02:31:27 -0800 (PST) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id ja4-20020a05600c556400b003ebff290a40sm1701125wmb.21.2023.03.10.02.31.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 02:31:25 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 3CAE61FFBF; Fri, 10 Mar 2023 10:31:24 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: David Hildenbrand , Wainer dos Santos Moschetta , Richard Henderson , qemu-arm@nongnu.org, Peter Xu , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell , Cleber Rosa , Thomas Huth , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Beraldo Leal Subject: [PATCH 07/11] tcg: Clear plugin_mem_cbs on TB exit Date: Fri, 10 Mar 2023 10:31:19 +0000 Message-Id: <20230310103123.2118519-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310103123.2118519-1-alex.bennee@linaro.org> References: <20230310103123.2118519-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Do this in cpu_tb_exec (normal exit) and cpu_loop_exit (exception), adjacent to where we reset can_do_io. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1381 Signed-off-by: Richard Henderson Message-Id: <20230301024737.1210851-2-richard.henderson@linaro.org> [AJB: use plugin_gen_disable_mem_helpers()] Signed-off-by: Alex Bennée --- accel/tcg/cpu-exec-common.c | 3 +++ accel/tcg/cpu-exec.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c index c7bc8c6efa..e5847e9731 100644 --- a/accel/tcg/cpu-exec-common.c +++ b/accel/tcg/cpu-exec-common.c @@ -21,6 +21,7 @@ #include "sysemu/cpus.h" #include "sysemu/tcg.h" #include "exec/exec-all.h" +#include "exec/plugin-gen.h" bool tcg_allowed; @@ -65,6 +66,8 @@ void cpu_loop_exit(CPUState *cpu) { /* Undo the setting in cpu_tb_exec. */ cpu->can_do_io = 1; + /* Undo any setting in generated code. */ + plugin_gen_disable_mem_helpers(); siglongjmp(cpu->jmp_env, 1); } diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 56aaf58b9d..e8a48dbd93 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -39,6 +39,7 @@ #include "exec/replay-core.h" #include "sysemu/tcg.h" #include "exec/helper-proto.h" +#include "exec/plugin-gen.h" #include "tb-jmp-cache.h" #include "tb-hash.h" #include "tb-context.h" @@ -459,6 +460,7 @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit) qemu_thread_jit_execute(); ret = tcg_qemu_tb_exec(env, tb_ptr); cpu->can_do_io = 1; + plugin_gen_disable_mem_helpers(); /* * TODO: Delay swapping back to the read-write region of the TB * until we actually need to modify the TB. The read-only copy, @@ -526,7 +528,6 @@ static void cpu_exec_exit(CPUState *cpu) if (cc->tcg_ops->cpu_exec_exit) { cc->tcg_ops->cpu_exec_exit(cpu); } - QEMU_PLUGIN_ASSERT(cpu->plugin_mem_cbs == NULL); } void cpu_exec_step_atomic(CPUState *cpu) @@ -1004,7 +1005,6 @@ cpu_exec_loop(CPUState *cpu, SyncClocks *sc) cpu_loop_exec_tb(cpu, tb, pc, &last_tb, &tb_exit); - QEMU_PLUGIN_ASSERT(cpu->plugin_mem_cbs == NULL); /* Try to align the host and virtual clocks if the guest is in advance */ align_clocks(sc, cpu);