From nobody Tue Feb 10 06:26:37 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1571323828; cv=none; d=zoho.com; s=zohoarc; b=Upk+tLbm5WNdAe8KQKoxbKRBX2b4vG+RUC1UQTH001DD5BKhvsNwDFSBLwt4mXKgUxGNZbwxd4lZFPgcRU/orGAyq9/ZkFW2V6AwCyy7CbLgLd6Ut6IBONf/47nZeFlUCpI6VS8nbgBUpaen2ArA+i7mEw7WPnMKoOOHqy4jobk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571323828; h=Content-Type: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=P3Npp9kH1WEA99RC652KClnJyNjkx/khNWALo0be13M=; b=lZMLJTElUlkEQSM20G8AfZrICWJjFZYES8etqEnVR6sL3i12wqZzzvhbxVt1n2BEpLh/xDTBhLkkGZ0sVvtqhTwATAnODfNMM/w1Ho0Tm2ca+AWFWZfJH9Db36QrgizwwaJTuJfstYXrJupnMkONiUuOH+drUxfdy0iA/NOZBbI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571323828311145.1120860873483; Thu, 17 Oct 2019 07:50:28 -0700 (PDT) Received: from localhost ([::1]:49714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL76e-0003kH-HF for importer@patchew.org; Thu, 17 Oct 2019 10:50:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37686) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL5wJ-00064d-5e for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:35:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iL5wH-0004aR-3L for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:35:39 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:34366) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iL5wF-0004XW-1G for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:35:36 -0400 Received: by mail-wm1-x342.google.com with SMTP id y135so7060148wmc.1 for ; Thu, 17 Oct 2019 06:35:33 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id t13sm2573167wra.70.2019.10.17.06.35.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 06:35:31 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 8AA251FFA3; Thu, 17 Oct 2019 14:16:17 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=P3Npp9kH1WEA99RC652KClnJyNjkx/khNWALo0be13M=; b=oAEcbGqYG6oxYP68i32TzoR4Erhb3LaCyXOWnKK8XBW94sX+eHcY87oFcYUCMyxQaP Dj2i58Do/ZsjlK7YGyR/H7/PX72sMA5VFIgxiA/S+H+Ja+vuEPj4G3MeTlzShIRfLo2c bhbCYObE9qYIQfpLcetLgHEv8pzN6PrBzP1AGTYXWtwU3G2qM5yNvfAmepEp+GjSpQ55 BDbnwU4/7wL2LLtExcT1jwsStlKSo2rzjwKpvwGiri2KJsLmFJcQSXZYxeFSedxRdVPI B/7mk7O45r+wIKgXfGiDMDmad4fx9kStYpgztef8OGhgRpbCxCp24Hs0ePEtFgkvlahI dTTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=P3Npp9kH1WEA99RC652KClnJyNjkx/khNWALo0be13M=; b=s5xCHCZ0uRzJfFHADehy9lZhRPpYwM5SdmCdgEPWaimbES48MQZCCGL3rb2DqKwckL hvxsXGNntIHEGGZ+HHLp/SgyOHWQmR/IrD3dhVqRRRoBtsINSN/ekPb7jIfFT2n+CXwB RDuOCw9Lh1uF2QTdJA9Szni6KdfJt6cuQwA5cX0OVrMtHcjQP9/FWsGrXW1aZnL08tox Wptv91K51agFbM9AWsWHRkUTYenx6l8iG2QpZJKsRFe+4ZcLlRhxn6rj1iQu64R5QWmm Tl35PqXwYfjpmvgDwDsNOQVHRa1A14COdIUYnU49wox06ghPoFRUSxFyuWgyfVKya44V 5cSA== X-Gm-Message-State: APjAAAVdhs357W7C0qB6GHFfUDq1FLU8oop1pyVQmCTqWhL6P1C27tYU UU9wMwK0DBYFRQ4gC9dKiDcRCg== X-Google-Smtp-Source: APXvYqwwG8c6BZ1mAUEP3xnxs91n9I40k1hGkg86vhdLUA/NC/8FYng3NEJ8Prqbii8gRnikrhktXw== X-Received: by 2002:a1c:7401:: with SMTP id p1mr2843267wmc.144.1571319332534; Thu, 17 Oct 2019 06:35:32 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v6 17/54] translate-all: notify plugin code of tb_flush Date: Thu, 17 Oct 2019 14:15:38 +0100 Message-Id: <20191017131615.19660-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191017131615.19660-1-alex.bennee@linaro.org> References: <20191017131615.19660-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@futurewei.com, Richard Henderson , peter.puhov@futurewei.com, aaron@os.amperecomputing.com, cota@braap.org, Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: "Emilio G. Cota" Plugins might allocate per-TB data that then they get passed each time a TB is executed (via the *userdata pointer). Notify plugin code every time a code cache flush occurs, so that plugins can then reclaim the memory of the per-TB data. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- accel/tcg/translate-all.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 0a08fcda3e..6d1b0ecd69 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1231,6 +1231,8 @@ static gboolean tb_host_size_iter(gpointer key, gpoin= ter value, gpointer data) /* flush all the translation blocks */ static void do_tb_flush(CPUState *cpu, run_on_cpu_data tb_flush_count) { + bool did_flush =3D false; + mmap_lock(); /* If it is already been done on request of another CPU, * just retry. @@ -1238,6 +1240,7 @@ static void do_tb_flush(CPUState *cpu, run_on_cpu_dat= a tb_flush_count) if (tb_ctx.tb_flush_count !=3D tb_flush_count.host_int) { goto done; } + did_flush =3D true; =20 if (DEBUG_TB_FLUSH_GATE) { size_t nb_tbs =3D tcg_nb_tbs(); @@ -1262,6 +1265,9 @@ static void do_tb_flush(CPUState *cpu, run_on_cpu_dat= a tb_flush_count) =20 done: mmap_unlock(); + if (did_flush) { + qemu_plugin_flush_cb(); + } } =20 void tb_flush(CPUState *cpu) --=20 2.20.1