From patchwork Thu Jan 26 11:22:49 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: 647105 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp188243pvb; Thu, 26 Jan 2023 03:30:54 -0800 (PST) X-Google-Smtp-Source: AMrXdXtzbXzXsbdA+CRYva4aQEVokET1MlcoaJWZ9m18MFzkk5wPiDla30EWbCmi8yyFABuOHfFG X-Received: by 2002:ac8:5a95:0:b0:3b6:2f0d:1924 with SMTP id c21-20020ac85a95000000b003b62f0d1924mr68381130qtc.32.1674732653817; Thu, 26 Jan 2023 03:30:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674732653; cv=none; d=google.com; s=arc-20160816; b=l0SkU73g6gGz4mYetyNEttqc6zG4S2kaNK9W7Rji76FXb8+FgZM5zRKtEx5DDQHg+5 +CvlgGZmwWH3mwid/IFyQmnMgeD8pRdklKAsb3mJAzN2gzERUmRBZaaFBnSOLYZiuQpi Aaqcxs9XW03Q0+HBu0ACBH3xDRxDGdPKi+UQ7wh6Femwx3xCDX49cujhEZKq3Tvcw4R+ rtkMLEI9Sd0jPshS2MNlcXbZD5xzQnjbOnzmCi24L15mSlVZyuegxvNVvf606iF9iDLg 5dKPUOKX4TPDFjpy961CGNJ9KrLJeTgBFNYTIBuzhwpbVFqQpwzn+Du1krIJ5Jw7gGAx XvWQ== 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=f9f+VLtMfEl0g+TsyrZ76kRHyOpYPXOzBzVbN5p8WhM=; b=PCss7sNWzIw2xyl4d6+E3ctaj26g6TznbeBaTent3XXBtJZquXDRGMU5yL9KR/73eD kcm931/5TFUwQ/EPNhSq3T3N0AGdDwNNQYNutZAyWRkxQGkGj+Pr0m4GCl7NE6Al6VWd DZlOrQpX0MHU2TZ3hh5iRNzKPeccYxRk5qE1Z/zA1vV81NU4C3C9BdjHSOg0DXzhm8Xg GXSpJ/GKh7DCsdwX7gQCMe+hTXTIIvNzD0IHOoMSpc/WLGXJeYAjvktu0HhenvVvaZ1P 360CDiRf46GVGiLwuyH/nEeNB8P4ZFHfh1Po2+pFuBt79cUh1S3puEtiTCFYBskaKsHD 1ibA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="WVJIE/eG"; 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 f19-20020ac859d3000000b003b7fba06da8si555219qtf.380.2023.01.26.03.30.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Jan 2023 03:30:53 -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="WVJIE/eG"; 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 1pL0Lc-0003fm-91; Thu, 26 Jan 2023 06:23:16 -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 1pL0LW-000335-In for qemu-devel@nongnu.org; Thu, 26 Jan 2023 06:23:10 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pL0LU-0004Ne-Iu for qemu-devel@nongnu.org; Thu, 26 Jan 2023 06:23:10 -0500 Received: by mail-wr1-x431.google.com with SMTP id m7so1417154wru.8 for ; Thu, 26 Jan 2023 03:23:08 -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=f9f+VLtMfEl0g+TsyrZ76kRHyOpYPXOzBzVbN5p8WhM=; b=WVJIE/eGbJWNVm1lg0Lqr5C59YO82ZGtiKH5D0e6JBKFrHrufXoevHQfOVw+M0SRZL aDULhBSdyG1hXnkQtgf8elfKCOtvYxsBr3zzzG2wi7XgoAesbtjj1WvkP6H0JsmVCNSe nC5HiQmoYnTUWyiqH9+mIOTby2z41hAPLmYnTnkO6ICLzWOFj+tNKrM6Ko/P4E4WbpI7 69Mz98TwEWDYHg0UvKS6OH3kMW196RbNWK0wrSk46kEnS7csQ+JVh/zlFOYsIWBeVCWL bf6/7F9qsgktTzJ+Ll2l5pP2+HwEpUFu0ULyXLBG+/JlerApZd52Pl81W9xQuLurkccP BGSw== 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=f9f+VLtMfEl0g+TsyrZ76kRHyOpYPXOzBzVbN5p8WhM=; b=xmIbyjqrg1BH84YLrj9gty1522wHDUBg1+xs1QHGPprn7QLHMs0gF2kawqx2fU4gX7 9lERS7m963eX55ipBlYzdnBv0g9HVDM5J5P8btIyOmAxMn69MxosgrX11Z7ZAvvwz566 0nSo/Wdhnkg1b4nyLvxA9dGoGx8G+MCwp88YzCz3j55/CzgNODz8cE3fcon7P1GkIuGO u4Y7qnzfFt1tqPS+lmEeHjCbyPQq80vXIz0CcdQOnn+c64q7C+S/S+Nsi7ElGcn2xTTI EHMGEFf6v+4TuuB+YgHT6r7JnEfWoq/DYjOgrqH1UQlm6AmzxRD01M3CXa3V7bRa8mt+ Pyrg== X-Gm-Message-State: AFqh2koyjJuNFXz36uxlr2kE6ev+Ylhb4hTuYgd2LKe6E7mcySXV2oll gNLiV2KmLQNkEL2D5kfY/pHGuA== X-Received: by 2002:a05:6000:689:b0:2bd:ffad:1bce with SMTP id bo9-20020a056000068900b002bdffad1bcemr34239101wrb.59.1674732186960; Thu, 26 Jan 2023 03:23:06 -0800 (PST) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id x13-20020adfdccd000000b002bbddb89c71sm1049761wrm.67.2023.01.26.03.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 03:23:02 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 308BA1FFC1; Thu, 26 Jan 2023 11:23:00 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Emilio Cota , =?utf-8?q?Alex_B?= =?utf-8?q?enn=C3=A9e?= , =?utf-8?q?Philippe_Mathieu?= =?utf-8?q?-Daud=C3=A9?= , Richard Henderson , Paolo Bonzini Subject: [PULL 34/35] cpu-exec: assert that plugin_mem_cbs is NULL after execution Date: Thu, 26 Jan 2023 11:22:49 +0000 Message-Id: <20230126112250.2584701-35-alex.bennee@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230126112250.2584701-1-alex.bennee@linaro.org> References: <20230126112250.2584701-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x431.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 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20230124180127.1881110-35-alex.bennee@linaro.org> 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 25ec73ef9a..9c857eeb07 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) @@ -980,6 +981,7 @@ 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);