From patchwork Wed Mar 1 02:47:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 657730 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp3266973wrb; Tue, 28 Feb 2023 18:48:47 -0800 (PST) X-Google-Smtp-Source: AK7set/6jL5oecmfJxlfdRWVdr8/8sLvUL5Kd6u2WovQw/YxaVoWTjexNp1sxMkAN7/C2U6eOXX4 X-Received: by 2002:ac8:5f4d:0:b0:3b9:b7c9:f0d1 with SMTP id y13-20020ac85f4d000000b003b9b7c9f0d1mr9684538qta.39.1677638926862; Tue, 28 Feb 2023 18:48:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677638926; cv=none; d=google.com; s=arc-20160816; b=mE5ACMfBAGbQbE+iOj4hutFHAeRK+Sh2RC3Pv3480noIZCdslEv+VXtkgVvPCyKVYS G6Qri6KXVV885Xcu47JwJkNpgZ9jp1G3U1tcwCuP8XdWhtRpEvnYSHfVyWNYfi39xNSj /3J6HJ/IhrHK1bAM3xo0T+s5wJmpGbmJ01KCaXmH3SoWYj5rdQNtOgMd16nZuxft73hk F6gvuEfgtYGEssqvLHBl3oCqg/myWWsmu6jnQr74c6UzFrB5ragN6KxRpYxT0BaKk7LZ O1Ed6SvTB+ocsvYq0jdP5lANoepf2d/r2SFs87ErFaWxX7igJJdfbZ4i+m/Z7lyQI5UA K/tg== 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=klkoOEYiLjCwPEMw+PE6EXEPDAYCAUIdZ4jSX5n/V7M=; b=YYwKzkO7KQYiGFyBYKeJUcxWr1ROjm4lSkdGT8yWkkIpSqT8lvIRJc1lCsoTd+zEWg sIHI5wmLk622pThGhyI4GE6jz2bTWSaNC2oMd/7JtHofur5IBYquVe27rUpFJH14YxvZ sixHx/3rszYAfs+7LfoPaYqYuk12+3IRm/7Yn1Zs87TaS3GbFjhzbCMSZc2BNv9tT14M pJ/KZv1hNVQmkKUKv5tmsZ9wVS7Xyc2JGtM4FotP1nv1fWIUOBYIux8iAuBxURd6dnNn UAMJjL+adUt6dDumsxJgjlpL4r0mDc0jpVEdKG02UyO70g9tqxjZbXhnPb7yURf+PHiU WFmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hzqa86M9; 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 n18-20020a05622a041200b003bd165ffc87si10452448qtx.569.2023.02.28.18.48.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 Feb 2023 18:48:46 -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=hzqa86M9; 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 1pXCVP-0005Vj-NE; Tue, 28 Feb 2023 21:47:47 -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 1pXCVO-0005VL-PR for qemu-devel@nongnu.org; Tue, 28 Feb 2023 21:47:46 -0500 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXCVM-0000gU-Nn for qemu-devel@nongnu.org; Tue, 28 Feb 2023 21:47:46 -0500 Received: by mail-pj1-x1044.google.com with SMTP id kb15so11916012pjb.1 for ; Tue, 28 Feb 2023 18:47:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=klkoOEYiLjCwPEMw+PE6EXEPDAYCAUIdZ4jSX5n/V7M=; b=hzqa86M9GD8xKXJNevf8CmTN2vV9ErIVGW/qHgGJd8aiz7ipG2ipduMEsnmfLlfCOt kzsMjNLa3vPALmbvXQi4Il7FhP1at6M9B7uhx0oAkgmBiab41yc8foTnuUDhRSWZObs2 43MfEi5UfcoaRvMkeW+U4l/0IPU605ZSQGu4wDKm/SLhA2j9YIlqEMekpItZwmhZvhS9 rn22dO/UsP5RO3n+XpvTPLIz/wgz0vki1H9b66ifBS0R9mb3sfKhwBMr2tqXUvl/mPiK HGstcRtMK9gXZy1h8vRcRHR5IBpkApFFgZdn0xYBfW1H9vPdnVLDOWbsEuFY1nruAiFO deEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=klkoOEYiLjCwPEMw+PE6EXEPDAYCAUIdZ4jSX5n/V7M=; b=3bD09FU+f/O1t/++uDnz/snGriFl8tLeyUGKzhl5uAGQNIMjLGZQnybIDPPox9RCGo bsfu0QaPqNwzOmTG6iJgeHMhOsUWVqXCl6RMEUsycCzqCJgMnAyQJoX52g69JOvcQ80k dWqs8JeM/Nh2u66VhKkAI2yFGaXa5AKjv1hERvc1bMc32RiIDp2lBv1Q8Bxefa4NiUQZ /if0MOZRvsCF7p5JCT0HI6p+VAGaDXluaNOrNmsWDqTjmisyUOm8vQu1pc5g9VhKJDs3 kI9gWxem/+ejpbJcusoNyo3tMXCMXUguCvOszfj5o17qMSmfnddXvPfr/w4RxEbJXRHG 2qAQ== X-Gm-Message-State: AO0yUKWnM1PyiSvlpT/sLndvYXL3vJAnEbHi/ivVo/JN+6GEFLijAFd0 KdpylPg2W7ugpW2e/yuUymjQrh/KP/eo0plfpx76TQ== X-Received: by 2002:a05:6a20:3ca2:b0:cc:e0fb:a835 with SMTP id b34-20020a056a203ca200b000cce0fba835mr7389502pzj.47.1677638863129; Tue, 28 Feb 2023 18:47:43 -0800 (PST) Received: from stoup.. (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id y18-20020aa78052000000b005a8aab9ae7esm6708449pfm.216.2023.02.28.18.47.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 18:47:42 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: cota@braap.org, alex.bennee@linaro.org, aaron@os.amperecomputing.com, frederic.petrot@univ-grenoble-alpes.fr Subject: [PATCH 1/2] tcg: Clear plugin_mem_cbs on TB exit Date: Tue, 28 Feb 2023 16:47:36 -1000 Message-Id: <20230301024737.1210851-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230301024737.1210851-1-richard.henderson@linaro.org> References: <20230301024737.1210851-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1044; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1044.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 | 4 ++++ accel/tcg/cpu-exec.c | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c index c7bc8c6efa..e136b0843c 100644 --- a/accel/tcg/cpu-exec-common.c +++ b/accel/tcg/cpu-exec-common.c @@ -65,6 +65,10 @@ void cpu_loop_exit(CPUState *cpu) { /* Undo the setting in cpu_tb_exec. */ cpu->can_do_io = 1; +#ifdef CONFIG_PLUGIN + /* Undo any setting in generated code. */ + cpu->plugin_mem_cbs = NULL; +#endif siglongjmp(cpu->jmp_env, 1); } diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 56aaf58b9d..2831fcafee 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -459,6 +459,9 @@ 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; +#ifdef CONFIG_PLUGIN + cpu->plugin_mem_cbs = NULL; +#endif /* * 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 +529,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 +1006,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);