From patchwork Tue Jan 10 17:39:22 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: 640883 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2872850pvb; Tue, 10 Jan 2023 11:07:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXtlYpIsvq02q7O/FJw4Z/0VzcPq9AjdPHhhZTth/JDXv6A2vxWhg97o3wMdj6zKf8hdV3XM X-Received: by 2002:a05:7508:4388:b0:49:20de:9a98 with SMTP id y8-20020a057508438800b0004920de9a98mr1539157gby.12.1673377628273; Tue, 10 Jan 2023 11:07:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673377628; cv=none; d=google.com; s=arc-20160816; b=VHoIs3LgvICUVNtx2fQ8ZHeSTgEAm2KASjqE809/xiR2KhnhIiqLsBKrS0q+HCtWkH v2N5nPBmn3VChL22Bw7EraVMbGtN4qh4STeruWzo9OK22ZsNL4D83rqR1HbvblQkMWxI QQdadVSWWt8je+nt0TRBNXG2tW07JhiRYZaX/9DC+BBkAm63fxy4ExtS71EyBOp3m+8v GI53Xx2oBTbVqx0SUTLlBE2Hm3qqeYXEokloCM6btT21O6dxbsHsG86ml+EYKDZpFX/U g2dv6CrbXZxZkKvaXu9T3jIqTSMjJoJBg4k05yz0eNrRNdKJvWsSbDPUvtPqIV1YaqRh MW0A== 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=SFp5fLykrTmSrzOYijtFAOoQNLwJRutVy2bxJGeiOow=; b=poV8hMbYNhOD8QHargYayx5QcBm2ZJ+QAlTZSnu8OMuJQaheaprNvtMAuw0VJgMST1 vj0y+e4YpNtcmSvRdcnOjRru0/7vzCyENTcF3aPzdGWMDzDhCiRo4J4qaSSNNWFtYCsq fxwX3JS8S4Pfe9XXyDjhjGhHBOtENkXf7eE7lXSFbp1PMPTeLF1DCe4i1bnmTotFkFgl +SpA0kCF1rZ7el4lesxv5cWdsnBvV1ZSGPIlhz2LibgXSFcSkkX5FouXTGHAL3MXQ6QF J4mISU44zWzOZFY/1qWh94r4H1r3Rl4SizkA/ccT1nki6Z1idDJwGGrqqT0J1Aaj25Na xjXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qgXIUn96; 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 e15-20020ab0314f000000b0047652743be2si2785221uam.94.2023.01.10.11.07.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Jan 2023 11:07:08 -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=qgXIUn96; 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 1pFIiH-000760-3t; Tue, 10 Jan 2023 12:47:05 -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 1pFIiE-00072N-8v for qemu-devel@nongnu.org; Tue, 10 Jan 2023 12:47:02 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFIiC-0003aS-JM for qemu-devel@nongnu.org; Tue, 10 Jan 2023 12:47:01 -0500 Received: by mail-wr1-x42a.google.com with SMTP id bs20so12610928wrb.3 for ; Tue, 10 Jan 2023 09:47:00 -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=SFp5fLykrTmSrzOYijtFAOoQNLwJRutVy2bxJGeiOow=; b=qgXIUn96/XpkFKbF8mC+27Idw4WpE34vO5zxCuMhIeV18k0x8CLEXePY1w1j2j+GqN hmC63EGoL18CFoOdXuvBSzQ10uGedVmMbY/Wrg+shxs8T6IFtAekZgFhh5v27UxkEJNB S8pdE+5lQj3NkPlLNo/VehZGJEIMW8IoczmbKGXDWBaue6PPuUWjlhajkNL47eXqgxF4 no1dRRFGyf+sf5Fu+scLzGq7KOnLh7GTG7wvsH2ABxbRzf0GCoBxa2TUBTdY8LUirGwM 3vAIBv4w8tzbM1LUd+CTJuYa5oFITtkcoZJ/wc68Meq9iOgjGCmuxylyGzZND8yJXyxh Q1+A== 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=SFp5fLykrTmSrzOYijtFAOoQNLwJRutVy2bxJGeiOow=; b=QF5hMmfTr0Vly3WpI4swrd4cQ/7TZcJPQbzOnpydEAkVh/GM3DA8ATEAmVPeKbO0m2 dshHFkbMjxtyPhYVY4yl10rPO7q3UzPXKC3K79OI/7naIXkuwV5z1BXEDgdh2Dhm2RLo 6iWgt0SCqSkIrgzY3T+W72rnVd62+NIOV5/H7QQNMejCq0Q2YncZJl9IMsAuuLEtXEag kRhBsaZgiVMW5ZUNaUHlbm8Dg7nVtU0//2VlVhm1LvFHe1mNgExB6zEajRRNr5E0aOwt D4EZyfY1AYaQb2Z3E+s9IWiHnBc0suUDyDEDvyJU0sxi4KOlM9fboX98ulrQGn4CgJcq +8Eg== X-Gm-Message-State: AFqh2kpOxHNfI8fyzbZjg0Xx+EImYMIqP62Je/qRfxsda2i/0CEfq9sS Cm4mqPAiB4McmDMEfKqp9iYudg== X-Received: by 2002:a5d:6145:0:b0:2bb:6b92:d4cc with SMTP id y5-20020a5d6145000000b002bb6b92d4ccmr8176826wrt.53.1673372818709; Tue, 10 Jan 2023 09:46:58 -0800 (PST) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id z2-20020a5d6402000000b00297dcfdc90fsm11713916wru.24.2023.01.10.09.46.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 09:46:58 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 249D91FFCF; Tue, 10 Jan 2023 17:39:26 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Alexandre Iooss , Beraldo Leal , Thomas Huth , John Snow , Eduardo Habkost , Elena Ufimtseva , Ed Maste , Yanan Wang , Cleber Rosa , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Li-Wen Hsu , Markus Armbruster , Jagannathan Raman , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?q?=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Michael Roth , Wainer dos Santos Moschetta , =?utf-8?q?Alex_Benn?= =?utf-8?q?=C3=A9e?= , qemu-arm@nongnu.org, Marcel Apfelbaum , Peter Maydell , Paolo Bonzini , Mahmoud Mandour , John G Johnson , Emilio Cota Subject: [PATCH 26/26] cpu-exec: assert that plugin_mem_cbs is NULL after execution Date: Tue, 10 Jan 2023 17:39:22 +0000 Message-Id: <20230110173922.265055-27-alex.bennee@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230110173922.265055-1-alex.bennee@linaro.org> References: <20230110173922.265055-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42a.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 From: Emilio Cota Fixes: #1381 Signed-off-by: Emilio Cota Message-Id: <20230108165107.62488-1-cota@braap.org> [AJB: manually applied follow-up fix] Signed-off-by: Alex Bennée --- include/qemu/plugin.h | 4 ++++ accel/tcg/cpu-exec.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index e0ebedef84..fb338ba576 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -59,6 +59,8 @@ get_plugin_meminfo_rw(qemu_plugin_meminfo_t i) #ifdef CONFIG_PLUGIN extern QemuOptsList qemu_plugin_opts; +#define QEMU_PLUGIN_ASSERT(cond) g_assert(cond) + static inline void qemu_plugin_add_opts(void) { qemu_add_opts(&qemu_plugin_opts); @@ -250,6 +252,8 @@ void qemu_plugin_user_postfork(bool is_child); #else /* !CONFIG_PLUGIN */ +#define QEMU_PLUGIN_ASSERT(cond) + static inline void qemu_plugin_add_opts(void) { } diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 6bd29227f3..f272504611 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -504,6 +504,7 @@ 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) @@ -1031,6 +1032,7 @@ int cpu_exec(CPUState *cpu) 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);