From nobody Wed Feb 11 02:09:44 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1678478061; cv=none; d=zohomail.com; s=zohoarc; b=kyEUl/5dL5PilijXH+RNyiFN2+rZ0m8Q5wo6zmKhdhVadbzC45KCwmmUe3R6SQgkFgHKJTsLL+w5eAjnQm7q1HJ2utcx7J/VQSrDWJrzSacvuNTr6FXYBIq0oBNqiJjbHiCv5uy+DyNj0YD+pNdCdvQXM1uYG3YiO5CEztspzbQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678478061; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VinaJbb8DVp1aqRzxC41hI4XOXtUHZDUYlixLfYKlTE=; b=b36xiuUa14B8HZY329tQAHNFjTTVHNlpC8CTs9yaow54BJIz6wMtU4XotafpR6NCj60FylLa1bYn3jB+Rg0b8SQixMll4YNV4aw0RtJk2KZEQFvzeLEBveqavhBMTllGhiymE9hx7KDIvx6hbOoJVPZkjjz2DOj/ASVM9wy1MFM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1678478061909754.7432502723092; Fri, 10 Mar 2023 11:54:21 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set873ur+bw8nN1ZBjRREo9cm3PArc2QHFgY+AeqajRZFTD4GlYfoygcHViVAUHzRcAYaPUo2Tw== 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) 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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1678478062410100021 Content-Type: text/plain; charset="utf-8" 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 =3D 1; + /* Undo any setting in generated code. */ + qemu_plugin_disable_mem_helpers(cpu); siglongjmp(cpu->jmp_env, 1); } =20 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 =3D tcg_qemu_tb_exec(env, tb_ptr); cpu->can_do_io =3D 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 =3D=3D NULL); } =20 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); } =20 /* @@ -1004,7 +1003,6 @@ cpu_exec_loop(CPUState *cpu, SyncClocks *sc) =20 cpu_loop_exec_tb(cpu, tb, pc, &last_tb, &tb_exit); =20 - QEMU_PLUGIN_ASSERT(cpu->plugin_mem_cbs =3D=3D 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); =20 assert_no_pages_locked(); } --=20 2.34.1