From patchwork Fri Jun 14 17:11:30 2019 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: 166907 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2360816ilk; Fri, 14 Jun 2019 11:03:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqxS1e0zdJeKAh+Y+tzrcZ0Cuygk43FAmGP3X9APux3gidKcl9xVayhRkVat4DUSCKoLOzwy X-Received: by 2002:a0c:8af0:: with SMTP id 45mr9757572qvw.111.1560535381403; Fri, 14 Jun 2019 11:03:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560535381; cv=none; d=google.com; s=arc-20160816; b=i4rnGztKphw07nqj+4msZYACGyEZX8G7kUQgJ2Ap1XKIFOJk6r4F1grpDeuAwzP4m7 NzFRHQmfwcL/1i7vKmw9tOPyj9sKzxN8e/jPhRLysDh4EmAbzwn/uEovy2iHBI8pGp86 eVFHByHgNo5wHCsPh274CkzkY7fuEeyjLMJX4CfpxCZcksbzvPJ2HoJt/b2b5s2Udd1T zALbziysiGEvqxPGLEOzw13B0QSuCEPui7P422qYO9DTFrEJUeGxmBJb/yAugR3cxCCn ZsIxh9NEyfE/gMxAhxc8WIBk1/lXMCzRn2NpuO3GWLOO/UHNL8/wxC2Ea8cVeqSoI6Eg LtxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=w9UhEo/iibTeYQ0N86neImewJmC3U4nMBYOWRfST9lI=; b=WbFAgWLiHohet7p+pN1kwv+UMXXX63hIk/o4RQfCdUXVngRj+2gIy/IlVUinD5aRVz 0rCVPe4c7lLk+LqKnvCfmWcxWeDJbnQXNPaczLTR5CutI9Dwh56Efzc8q1zl/gfJJBD7 AJRirj6tSQmr9j4xMjDRXK7B1tWJdY5KtsB7FORBSZExqpEWyeU5RB/ItQkgf+ll4pzv xly4rQzdZ9mcEdv5lXeKScuN2dlKNv1KlVLX6LH4qIHwpec4QdksQsyEiczYY7DzVC2h pV7zDRwBXmOZB47qzb+17sgEGTXe6HbmoqU0YVLvd47jp9g1R4co1JKgKk+QDDBWQpDJ 7J5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=vYeoyf+J; 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=fail (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 s20si88750qve.153.2019.06.14.11.03.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Jun 2019 11:03:01 -0700 (PDT) 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=fail header.i=@linaro.org header.s=google header.b=vYeoyf+J; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53954 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbqXS-0005RX-No for patch@linaro.org; Fri, 14 Jun 2019 14:02:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58616) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbpqh-0005ax-J0 for qemu-devel@nongnu.org; Fri, 14 Jun 2019 13:18:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbpqe-00077O-Cd for qemu-devel@nongnu.org; Fri, 14 Jun 2019 13:18:46 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:38767) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hbpqe-0006g1-0C for qemu-devel@nongnu.org; Fri, 14 Jun 2019 13:18:44 -0400 Received: by mail-wm1-x343.google.com with SMTP id s15so3063479wmj.3 for ; Fri, 14 Jun 2019 10:18:31 -0700 (PDT) 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=w9UhEo/iibTeYQ0N86neImewJmC3U4nMBYOWRfST9lI=; b=vYeoyf+Je3L/hoDRbK+6a+zHYFaxfxlOCubTW1gqxQCM7Lgu0kvyfx0v9JrKQJukvy BieKGTy7d84Yx0WzI0aSUoLXXlLH75l9bdaXlaOqVvUkETvcLx5z1yqMTBTl+Kl2fdkZ PDb1xdrCPNleYCpNQYbM5+HYqe0j8Wn+XN2g7fZq2FTpRU/+jH6mglBNABD8ii4yMtHn q+c57Jl/Si3TAmx6Z/WSoXBD6E3tZSnjYbvu7Yw+77bLdhzbvDkDCj6ukfG4J7nwq3pe uZu/EdwylWeQgHZhx7BTZSckumFP4oLXuYJ3jF+cLGDk41Bj0nVbUrCH3KLF435AdeVg 82Vg== 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=w9UhEo/iibTeYQ0N86neImewJmC3U4nMBYOWRfST9lI=; b=RlCBRLl+bcrE5PW6YA9EhTy3kdkwPX74m3pGA7Jr0z98+nY++CdSWlVRcjcExfM2Sk SMQmw8A75Crgu83BbCS2nGq08gQOndbnWgYFkCpQ0ygaIrlQ1OaZlM2MqDnjwRFQQlf6 N3XYEvQO+dByfO5b63YwXvgLU5332M74KtVWEG8R14XCXNhBqo+n1A2cMQh69P1lFjLw 7Y0f+IKsy/XIrsOU9azdRiIK/JxlbScYZsECagl2gVk89alx12O/zuO7CjJiDQGBNpZk bQZ42BLAI6c7qHqrHcid5uYbi4RN5u6BC8DgAmDoZZoWrTgpKVOa+er+/2tGrYsWMOlD v9yw== X-Gm-Message-State: APjAAAU2U9dI2Z8jP/H0m0ig41LnVFewyFgBbBqli3ZcHdpSk5a1rZ2L kN2bkvcK5UwPizejwgaHB5/qRw== X-Received: by 2002:a1c:f001:: with SMTP id a1mr9225447wmb.130.1560532710399; Fri, 14 Jun 2019 10:18:30 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id t12sm1926433wrw.53.2019.06.14.10.18.27 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 10:18:29 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 5761C1FF87; Fri, 14 Jun 2019 18:12:02 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Fri, 14 Jun 2019 18:11:30 +0100 Message-Id: <20190614171200.21078-21-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614171200.21078-1-alex.bennee@linaro.org> References: <20190614171200.21078-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 Subject: [Qemu-devel] [PATCH v3 20/50] translate-all: notify plugin code of tb_flush 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: Paolo Bonzini , "Emilio G. Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Signed-off-by: Emilio G. Cota --- accel/tcg/translate-all.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.20.1 Reviewed-by: Richard Henderson diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 54998e39c6..28a92e6d8b 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, gpointer 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 = 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_data tb_flush_count) if (tb_ctx.tb_flush_count != tb_flush_count.host_int) { goto done; } + did_flush = true; if (DEBUG_TB_FLUSH_GATE) { size_t nb_tbs = tcg_nb_tbs(); @@ -1262,6 +1265,9 @@ static void do_tb_flush(CPUState *cpu, run_on_cpu_data tb_flush_count) done: mmap_unlock(); + if (did_flush) { + qemu_plugin_flush_cb(); + } } void tb_flush(CPUState *cpu)