From patchwork Thu Jan 11 14:23:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 761847 Delivered-To: patch@linaro.org Received: by 2002:a5d:6e02:0:b0:337:62d3:c6d5 with SMTP id h2csp2422538wrz; Thu, 11 Jan 2024 06:25:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IFe6cVLfWg/v2Tv0n81f7WUF23wF7X7xhXLdiyA050hUJbfKisuGAFveJHvWz1TJumVXLS+ X-Received: by 2002:a05:6214:29cb:b0:67f:70f1:e57 with SMTP id gh11-20020a05621429cb00b0067f70f10e57mr1250027qvb.24.1704983111284; Thu, 11 Jan 2024 06:25:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704983111; cv=none; d=google.com; s=arc-20160816; b=j5nrC2gf8lsO0+K6PVVaHp/cjn6YdP42nY2inVAP83nDYyQ4usCK/W8Oou89A1O6vc vkAjlPucD/X4ps+EWEXzF49M6Lprysqs+swmrwuFBrxn8jmMITaIQJxyg8A4wEtO7b6+ qbdxN/6pb6Glh3zfvBwq3b/fBDZD+lDjpd64B5FbSjcy3IBbTMefxf+aK61luoA580x4 /31m5s5zQGJugp2or3gTKaJ0V3oZkLef8O7h5I55/XL/pCkxJEF/+sJfTRPHHMr90AOz CwRKjzfleH+VnQ81nlGmQKhcszGr5MsjpCdVX21ulOZ7rDPnpMfWX9g6AuCVTPQVkqv6 VYuQ== 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=Aq5DjSOiw7b/OxzS4nPd0JW8zSf3ntDpqvE/K8se7oQ=; fh=4xQMyYYtmbynAmJxwWPpZ6ivTwZNkSfAt6fhFI9aNBQ=; b=1Ecnd9Tcm0wIyRakFKL1aDZmJ7ZcICkk2iXyoBpxIioB//qOf+YFfnU22Xkaj9GD50 C8+qf6GJ67enlyTFVFj/IXwz2Wv/278u4Slkp8oqNYwBkENY3kPRZAomvH9q/SOJZ0+T KHHEA22sV4o28VMcql99lEt3BAj1DXw8XefTKB8heFw2U6Gg1zaYVObKdTos3xFTRllx 2l5uJhLK2I/J8mdOfuFMTA+vUzJXp1dKZgW0T6mZMvZUE7mfuz28EtdZPDwuWUhNO3z3 rSH9EIImg/s5XjSKcosqowJ6V4UGxLP1XZiO+01GcpRrvcq4RAGW2GtCb4o8NHVbDVOF tOqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eSPgyD8C; 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 m19-20020a05622a119300b00429c95922cfsi286577qtk.641.2024.01.11.06.25.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Jan 2024 06:25:11 -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=eSPgyD8C; 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 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) 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-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) 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) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , =?utf-8?q?Alex_Benn?= =?utf-8?q?=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION; -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 = g_string_new(""); if (do_inline) { - g_string_printf(out, "inline mem accesses: %" PRIu64 "\n", inline_mem_count); + uint64_t total = 0; + for (int i = 0; i < MAX_CPUS; ++i) { + total += 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 qemu_plugin_tb *tb) struct qemu_plugin_insn *insn = qemu_plugin_tb_get_insn(tb, i); if (do_inline) { - qemu_plugin_register_vcpu_mem_inline(insn, rw, - QEMU_PLUGIN_INLINE_ADD_U64, - &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", opt); return -1; } + g_assert(info->system.smp_vcpus <= MAX_CPUS); } else if (g_strcmp0(tokens[0], "callback") == 0) { if (!qemu_plugin_bool_parse(tokens[0], tokens[1], &do_callback)) { fprintf(stderr, "boolean argument parsing failed: %s\n", opt);