From nobody Sat Sep 21 07:53:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1704983111; cv=none; d=zohomail.com; s=zohoarc; b=h/aB3ZRtRL5xUubhwXJFUaZWdiuipZH0Kp5W9DihyiJmc0SWH9i1fENFlyzvor6q5NPEWgu492b4hpBa7CwR7JxgklgTuCme79Gg3eos9C3v+ulThba7LssGk8lSo08IJJgwZaBBegNipy4kG1O9//OL68f3jWdWZj8uMCb3UOg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704983111; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Aq5DjSOiw7b/OxzS4nPd0JW8zSf3ntDpqvE/K8se7oQ=; b=ExgDX1OjR54vLJCFmL5wosYKQzA2lIoialOKhhAj5917waxylLmDq8i6eQ/m+gz+Z7e89poqvdWVCfMIv3nFENt22Q+4ZN5E+gNrdqDSP1cSFIQYbPyzitbewoBQBR0ZR2jHdjSfn73DQOgyi+HZRUVvo4cAqHQb2mqEqV5b1zo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704983111625436.55110565119696; Thu, 11 Jan 2024 06:25:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNvyo-0004QZ-Fq; Thu, 11 Jan 2024 09:24:22 -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 1rNvyV-0004MO-8C for qemu-devel@nongnu.org; Thu, 11 Jan 2024 09:24:03 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNvyT-0002Ye-8S for qemu-devel@nongnu.org; Thu, 11 Jan 2024 09:24:02 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40e60e137aaso5433935e9.0 for ; Thu, 11 Jan 2024 06:24:00 -0800 (PST) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id h7-20020adff4c7000000b0033677aae2e2sm1349000wrp.107.2024.01.11.06.23.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 06:23:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704983039; x=1705587839; darn=nongnu.org; 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=Aq5DjSOiw7b/OxzS4nPd0JW8zSf3ntDpqvE/K8se7oQ=; b=eSPgyD8CXHMRwKAEQhTj6eIVTxjd7eOkOTniWJcBVsBmGrEqD33/QSoxv1yOz4G8RE EBEI8p8/Ei8LKjL9OmQuJbbItZHEGcnGIHeZgO8tRtzahFd5l4DQq4PI0GQXMrr3cVpG INNtoywVk9lCEAqWtFruB8U6sODXQsJp2HMno+gdMhVHGasanzldcsX5D9jU5lXP66r8 wgLUO9xQ1FPNc38adyb7DscS6PYvV6yCXcr6p26AREL464a2y9tpNp5gI4j22BCwYWMU 05OTn/SMuRzh0fDb59ylryu/FHjkb11/ow0cyTXfW65TX2V8JXkV5i7cPyXS1Z91Ep/F gZHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704983039; x=1705587839; 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=Aq5DjSOiw7b/OxzS4nPd0JW8zSf3ntDpqvE/K8se7oQ=; b=mLPX3fmed+XsUOFxmNRL+PI/XHQuWuCvLHbp0yM/C7ah0F8l819zJqXnCI2WXJhkXO 4g1oqUBetzAiyXEuzuLwKnRZWtM/fyPTOFD42Tj582p4s9s4EG0TFZuyZlA657rhL+DE ziunCBggZCtEJGveOIi/DWnttl9h6obBwzXW6cODuMEUGEK4yINhWgsHe2yG55YgmuB4 OexUdISku+s5HinSGi2CzCIjLRXZCTrQogvxzWviz+Z75ak9l5sNB8hTXKXNzdJ6OgKz WPqtlZE3LNUFIt6ofvS1ciW33jb1qZjUL8GxDI7IBBU9rrFla8hI9FhtCIMOo0K1vhnb Ydwg== X-Gm-Message-State: AOJu0Yzm78LjoqoyqEiDfnAUAEVUzB/pEnSdycsXFaZaEa50QnWLSHD0 8BukgB7IdniA7ZHI87dUV+mGK0u2cIsiJL0ppHMjJz+hTGr8TA== X-Google-Smtp-Source: AGHT+IGw/9BoY+T5Rx/XF42N3stGpW3rFROeoDBtVIpfUoQhBWCOEsNGA90C/tcBDp2s3NhRCrg5nA== X-Received: by 2002:a05:600c:54ed:b0:40e:5996:2291 with SMTP id jb13-20020a05600c54ed00b0040e59962291mr511531wmb.138.1704983038931; Thu, 11 Jan 2024 06:23:58 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mahmoud Mandour , Richard Henderson , Paolo Bonzini , Alexandre Iooss Subject: [PATCH 06/12] tests/plugin/mem: migrate to new per_vcpu API Date: Thu, 11 Jan 2024 18:23:19 +0400 Message-ID: <20240111142326.1743444-7-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240111142326.1743444-1-pierrick.bouvier@linaro.org> References: <20240111142326.1743444-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=pierrick.bouvier@linaro.org; helo=mail-wm1-x32e.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, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1704983111958100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pierrick Bouvier --- tests/plugin/mem.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/plugin/mem.c b/tests/plugin/mem.c index beca8232342..06f2d80d0ec 100644 --- a/tests/plugin/mem.c +++ b/tests/plugin/mem.c @@ -16,7 +16,9 @@ =20 QEMU_PLUGIN_EXPORT int qemu_plugin_version =3D QEMU_PLUGIN_VERSION; =20 -static uint64_t inline_mem_count; +#define MAX_CPUS 8 + +static uint64_t inline_mem_count[MAX_CPUS]; static uint64_t cb_mem_count; static uint64_t io_count; static bool do_inline, do_callback; @@ -29,7 +31,11 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) g_autoptr(GString) out =3D g_string_new(""); =20 if (do_inline) { - g_string_printf(out, "inline mem accesses: %" PRIu64 "\n", inline_= mem_count); + uint64_t total =3D 0; + for (int i =3D 0; i < MAX_CPUS; ++i) { + total +=3D inline_mem_count[i]; + } + g_string_printf(out, "inline mem accesses: %" PRIu64 "\n", total); } if (do_callback) { g_string_append_printf(out, "callback mem accesses: %" PRIu64 "\n"= , cb_mem_count); @@ -67,9 +73,10 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qe= mu_plugin_tb *tb) struct qemu_plugin_insn *insn =3D qemu_plugin_tb_get_insn(tb, i); =20 if (do_inline) { - qemu_plugin_register_vcpu_mem_inline(insn, rw, - QEMU_PLUGIN_INLINE_ADD_U6= 4, - &inline_mem_count, 1); + qemu_plugin_register_vcpu_mem_inline_per_vcpu( + insn, rw, + QEMU_PLUGIN_INLINE_ADD_U64, + inline_mem_count, sizeof(uint64_t), 1); } if (do_callback) { qemu_plugin_register_vcpu_mem_cb(insn, vcpu_mem, @@ -109,6 +116,7 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_= id_t id, fprintf(stderr, "boolean argument parsing failed: %s\n", o= pt); return -1; } + g_assert(info->system.smp_vcpus <=3D MAX_CPUS); } else if (g_strcmp0(tokens[0], "callback") =3D=3D 0) { if (!qemu_plugin_bool_parse(tokens[0], tokens[1], &do_callback= )) { fprintf(stderr, "boolean argument parsing failed: %s\n", o= pt); --=20 2.43.0