From patchwork Wed Mar 15 17:43:10 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: 663394 Delivered-To: patch@linaro.org Received: by 2002:a5d:5602:0:0:0:0:0 with SMTP id l2csp1720386wrv; Wed, 15 Mar 2023 11:00:40 -0700 (PDT) X-Google-Smtp-Source: AK7set9B+oLFCC+uKjH/GaxNPHrAvHX5f5jNsaYedFoHaPrAU6nh8RQGbShHrvoU5dA71qb/LiUG X-Received: by 2002:a05:6214:da5:b0:5a6:1571:1eb with SMTP id h5-20020a0562140da500b005a6157101ebmr21248414qvh.27.1678903240198; Wed, 15 Mar 2023 11:00:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678903240; cv=none; d=google.com; s=arc-20160816; b=QXLw4DTQIaY+lJvj7kx1lYMkp3QoIrhDsFS+ukhTapZddFTqMjCEsbHgAFn2fqM1fI ijNhtetU+hsWkN7KLHd8jQC6K5QIYn9UeNuZ2+qCb3OFbhhVTjBFuD2aXBkU968dRsFZ wuNMUzttfN5xCPZm1ecK6Tj7dn43470SEYoS54j+2PGbuKIw8F63oAQc8EUqNtreA5Hi KIJIZO24pLkMMNEoqhvgB4TOUy5oNMyBwQE1+6C9Pxkm5NyLGllPiQu3dZSfVRkFUNky S13jwPMmE7vYTRGKZ3USkPj0XMqCYxZ/3Ly6jS+DqtUY65b5yXQAPPqltLq66k0O2o3N 0dSA== 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=wSr7AA9LUspzqEIDUMrwS93tNfDBE7VaQHLkhTtwqQI=; b=BIydjbErmxjEmZeD2G0lY0zCqv2HmpW0vdKFZuPdl2vjxSn/CmxDYLq/De1fgle/vd kZzqwex7lksxXFEN6wW86TZvyT0zK79fAv+PyzARsr1mJi3s1JFLjXTIFthiTGEawBi/ 9sVZC8XsBXOpr22aooHm5ZHK8U8P02UZRKHQDRoreTshSXbf00rXZrAaY/BPTsQgni1k PLcbbs8rHnFu3d4gc/ukW+JZlCpH+mmVX5WC4iP8kUrI/c54lt9YE5j4gpQwv/63GzKA NEGJevEdAVWVcagYhauaLY6NJYDY5/WII1kuctcsbV4JHLl5nvVfX7dzA1wKtDJdCiWZ rFzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CA3aWzQK; 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 x7-20020a0cb207000000b0056a56c8a569si4567303qvd.179.2023.03.15.11.00.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Mar 2023 11:00:40 -0700 (PDT) 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=CA3aWzQK; 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 1pcVPQ-0005t5-3Q; Wed, 15 Mar 2023 13:59:32 -0400 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 1pcVPN-0005p6-Ep for qemu-devel@nongnu.org; Wed, 15 Mar 2023 13:59:29 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pcVPG-0004BF-Ms for qemu-devel@nongnu.org; Wed, 15 Mar 2023 13:59:28 -0400 Received: by mail-wm1-x329.google.com with SMTP id fm20-20020a05600c0c1400b003ead37e6588so1591569wmb.5 for ; Wed, 15 Mar 2023 10:59:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678903161; 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=wSr7AA9LUspzqEIDUMrwS93tNfDBE7VaQHLkhTtwqQI=; b=CA3aWzQKDfY0/tjI5SY4VdvE6Ht0CUlxoIZOVbH9pm1rUFjMkq+Y8v/Jbz5QlmbecT T756Xly0DeGbnrH2gh7vRdsqxDWl1tHcUxZlsZRpTuPsX5ssL++DA8GCkY2mRzPZX34q F2Z+elwhIPVMmQwDQUzSZuBR0hl8pZVwCK9E1HXKgXin59IKuADvQdJZwwuZ7b17fzfl qC7MgSFK0cIZvDdDKwTRs5gEwCq9VnN9VoI1/YlguUOD6BoAWCdJPZcNImZpNOBTR/vX /rm6QKzyU/dXyyNSw55pFYqEoEti+mRdN6Wt72rc68F6KgS1eUBp1yyhMH36PoOMJTWK H9LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678903161; 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=wSr7AA9LUspzqEIDUMrwS93tNfDBE7VaQHLkhTtwqQI=; b=GAq/w05auEQCFAo7KwIpn2rKEvK7IfZ8RVD7f4J0s9zBzjhWYGwfCtsfgMxi2nn+dS 1AznM5TtPkyNE5YGc96QZFuOjf4fLyvsAFrXjbz9wthedlrBNYNorDnwTQsA2gh0muLl hf1+9fwImdYCZ5M1A+I49RML7lm0GIWBZsxbDSKnISEG58c7WdIwOPU8xQ2ZwVxBAam6 e266eIefwoA5G4EKyp6rp5P4BFPjcFfd16FrHQO6GmosU5IYX0l0Kj+NtNqm/tcifkd1 gTDstx+kMBAYuHYhqDQWQHeOmu47uypFT16wFX3083o2PO/tqDk0+71iXIw+SAPxQs1S h5wg== X-Gm-Message-State: AO0yUKV+o3javLsaA5IzYN5wsnL1+nRhXcvsB8sDCkzHz/R3LWiCSGiY rux8rTSTkWU5Qz+xSt42GSWJhw== X-Received: by 2002:a05:600c:4f91:b0:3eb:3908:8541 with SMTP id n17-20020a05600c4f9100b003eb39088541mr19279346wmq.2.1678903160774; Wed, 15 Mar 2023 10:59:20 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id p15-20020a7bcdef000000b003dc4480df80sm2467357wmj.34.2023.03.15.10.59.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 10:59:20 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 80FD31FFC2; Wed, 15 Mar 2023 17:43:32 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , =?utf-8?q?Marc-Andr=C3=A9_Lurea?= =?utf-8?q?u?= , qemu-riscv@nongnu.org, Riku Voipio , Igor Mammedov , Xiao Guangrong , Thomas Huth , Wainer dos Santos Moschetta , "Dr. David Alan Gilbert" , Alex Williamson , Hao Wu , Cleber Rosa , Daniel Henrique Barboza , Jan Kiszka , Aurelien Jarno , qemu-arm@nongnu.org, Marcelo Tosatti , Eduardo Habkost , Alexandre Iooss , Gerd Hoffmann , Palmer Dabbelt , Ilya Leoshkevich , qemu-ppc@nongnu.org, Juan Quintela , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Darren Kenny , kvm@vger.kernel.org, Marcel Apfelbaum , Peter Maydell , Richard Henderson , Stafford Horne , Weiwei Li , Sunil V L , Stefan Hajnoczi , Thomas Huth , Vijai Kumar K , Liu Zhiwei , David Gibson , Song Gao , Paolo Bonzini , "Michael S. Tsirkin" , Niek Linnenbank , Greg Kurz , Laurent Vivier , Qiuhao Li , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Xiaojuan Yang , Mahmoud Mandour , Alexander Bulekov , Jiaxun Yang , qemu-block@nongnu.org, Yanan Wang , David Woodhouse , qemu-s390x@nongnu.org, Strahinja Jankovic , Bandan Das , Alistair Francis , Aleksandar Rikalo , Tyrone Ting , Kevin Wolf , David Hildenbrand , Beraldo Leal , Beniamino Galvani , Paul Durrant , Bin Meng , Sunil Muthuswamy , Hanna Reitz , Peter Xu , =?utf-8?q?Al?= =?utf-8?q?ex_Benn=C3=A9e?= Subject: [PATCH v2 11/32] tcg: Clear plugin_mem_cbs on TB exit Date: Wed, 15 Mar 2023 17:43:10 +0000 Message-Id: <20230315174331.2959-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230315174331.2959-1-alex.bennee@linaro.org> References: <20230315174331.2959-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x329.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: <20230310195252.210956-2-richard.henderson@linaro.org> Signed-off-by: Alex Bennée --- accel/tcg/cpu-exec-common.c | 2 ++ accel/tcg/cpu-exec.c | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c index c7bc8c6efa..176ea57281 100644 --- a/accel/tcg/cpu-exec-common.c +++ b/accel/tcg/cpu-exec-common.c @@ -65,6 +65,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. */ + qemu_plugin_disable_mem_helpers(cpu); siglongjmp(cpu->jmp_env, 1); } diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 56aaf58b9d..c815f2dbfd 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -459,6 +459,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; + qemu_plugin_disable_mem_helpers(cpu); /* * 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 +527,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) @@ -580,7 +580,6 @@ void cpu_exec_step_atomic(CPUState *cpu) qemu_mutex_unlock_iothread(); } assert_no_pages_locked(); - qemu_plugin_disable_mem_helpers(cpu); } /* @@ -1004,7 +1003,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); @@ -1029,7 +1027,6 @@ static int cpu_exec_setjmp(CPUState *cpu, SyncClocks *sc) if (qemu_mutex_iothread_locked()) { qemu_mutex_unlock_iothread(); } - qemu_plugin_disable_mem_helpers(cpu); assert_no_pages_locked(); }