From patchwork Fri Mar 10 19:52:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 661647 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp1033493wrb; Fri, 10 Mar 2023 11:54:21 -0800 (PST) X-Google-Smtp-Source: AK7set8ZjblAjbwLXT39sPzZ84rYFZYVWbbpVmNmuVqFQriO3ttUmnWVk7Lu+3bA6h5sJwYBNyqK X-Received: by 2002:a05:6214:c61:b0:56e:9ef7:e760 with SMTP id t1-20020a0562140c6100b0056e9ef7e760mr344869qvj.12.1678478061543; Fri, 10 Mar 2023 11:54:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678478061; cv=none; d=google.com; s=arc-20160816; b=PUgmKyfcx1QPW8A9eQNpmZ70xr+itl+P3faZhcM6O/deHJXAEPG8QUnqouAFAdMQsG zfLrNXOJxOTFHHkqZL8d06xoIN57A6zIBdRl/RCLeNckNLDsVekY27gltLMB4N3TxmA8 dGvgQm25IYJv5TYVvzHNdAoC2LNGLZ5SRbmZNiC5t/n/nXxdb4nO2wuUtx6ex4Rp6ljh glgJM+aM8pgs86gIrd47NVIWVv/njXDlVKWWzCBRYhXaxT9FaFZN0N2vknVyvNrLhrKS ujqVfykJ1CSIlJzpC6TPdw+1zxNlDZlDCsW82QDmaZz7CoUefgsEqJUn55OEQid93IuN 4uog== 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=VinaJbb8DVp1aqRzxC41hI4XOXtUHZDUYlixLfYKlTE=; b=Lw4jmlPT30w2nqTWfVstkF4/6Fmy0UaUaGuxiH586bXw0o2+Jeimi9vwTqNFX22o65 vAsoo/Ai6Hzjw8+p/j7DPOFWz4O/FrFMGuuJ8PWHKZl38VKaljLxBnKW0HSrE4mHj3T5 JgDWoasUogbLge6V6jvAMtbdXTCmGTZi4Upl0zbt+0I73A3tevJmlBddFOjM3lMfN9Ox YvdYg4zaBzFp7iGh5DJ0/ju5YXqhlTnENfRXpeEJh4p+zUq4FKF63Z3JVv+so2aQM8va QjyuUcBn5vtS36gLa6NoZCwzGk7lrkXcOfbG9T2ByF8fmFClBamm4YU2OOtUhIuzIIOy YL6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="QVgDh/oG"; 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 l3-20020a0ce083000000b0053b4ca430bbsi337467qvk.406.2023.03.10.11.54.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Mar 2023 11:54:21 -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="QVgDh/oG"; 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 1painU-0001Fc-BB; Fri, 10 Mar 2023 14:53:00 -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 1painR-0001Eh-P9 for qemu-devel@nongnu.org; Fri, 10 Mar 2023 14:52:57 -0500 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1painQ-0004eO-3k for qemu-devel@nongnu.org; Fri, 10 Mar 2023 14:52:57 -0500 Received: by mail-pj1-x1035.google.com with SMTP id me6-20020a17090b17c600b0023816b0c7ceso10997829pjb.2 for ; Fri, 10 Mar 2023 11:52:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678477974; 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=VinaJbb8DVp1aqRzxC41hI4XOXtUHZDUYlixLfYKlTE=; b=QVgDh/oG7rju73BZIwWWatnasdnyMMg2uy1Q0BGBudUyW8znYFapWoZ+BdGdxebsPo qrTQL4PQ2BrikqFXmpGDf+udozzflkgLBTlFs1OOac0AQbIaxt1uUhp3MS9/3/s42glQ MfnTDbTsHOBFhM409sHZkxABhu1ARjMxu2SUd6gjXHAaQ62UIep/+sP1iEOJPH8G6JYB MG3/tpNU7oqNLs6EW0zv3QlyYfUW9sQRvu7fjAXDXjVi7wZHNvDWV3I7oqTsAbo7IbU3 jd09Swhk6FIOcmcRrxGwQD9+nj1pW8MZjQg49DuPyios8hZbLFZ1fkBzr+bAqHJhkH6i 1hxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678477974; 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=VinaJbb8DVp1aqRzxC41hI4XOXtUHZDUYlixLfYKlTE=; b=gMJccwcb8koSqmEYR/PvdJo886hxpITKxcMfhIzNv7b8Fxt2ca/rQAeMBybklBDKp1 0hnfMZ5yeCVnEVFy9mPv6O/eHgOby34waM22rzWp7NByXfRo73Ar1x3oyQU1EQKvwfqp KEtiYyeKbo5DJD8WhYulydo4vo4L9HtC3JS4HeHsCCgkHUsmUcp8ZF2u2/RzH4xHvgX5 GIAIuEfV/Y5XSqbJb/kbugXIrffz4wjLQcBDC0SuTuJx8RS4u3IiyZOzcVoldGwxGuj+ qwSNShceLSBci059podo/KGeXEd0iMFCiW6WuJ/9AawfhcJjg7BlpCZrLZbsJZ9tKhMj 1BFg== X-Gm-Message-State: AO0yUKW9gMg62ijh0XwreKlp/hErO/f4i8VhqpekDzkoIa0BTU0BfQvj 2w5z0u4rC9kJs9f31FugrD9iVYZdKf17UwEYf/0= X-Received: by 2002:a17:903:11c8:b0:19f:1bd9:505 with SMTP id q8-20020a17090311c800b0019f1bd90505mr1139716plh.36.1678477974401; Fri, 10 Mar 2023 11:52:54 -0800 (PST) Received: from stoup.. ([2602:ae:154a:9f01:cc1c:ced1:1ec5:bd62]) by smtp.gmail.com with ESMTPSA id l1-20020a170903244100b001991d6c6c64sm351465pls.185.2023.03.10.11.52.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 11:52:54 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: cota@braap.org, alex.bennee@linaro.org Subject: [PATCH v2 1/7] tcg: Clear plugin_mem_cbs on TB exit Date: Fri, 10 Mar 2023 11:52:46 -0800 Message-Id: <20230310195252.210956-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230310195252.210956-1-richard.henderson@linaro.org> References: <20230310195252.210956-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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=ham 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 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 --- 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(); }