From nobody Tue Nov 26 13:28:21 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=1707211648; cv=none; d=zohomail.com; s=zohoarc; b=GhHZg7H6PTXjhK+VgiHuAmUppkgV1aYYrrXcj23Sl6fNUBoHE+2YxCte8OQoyvvLYDr3XxkG/ZX+sNpZ2WqGuNb0DpFw7iEU/WQWokAfzuMgYqLhOl7Dnt6OMGWz1Nqu8L90u9gLLIy/BnCKF0pvmM8maT7kJ+UdkLa5zD8xl9s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707211648; 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=HXH7ocyncB0lY9SgnkHxBEuiEnRgV5eLtUY0jbLrGRM=; b=UA1cz1dDI31Jdc4+YeNG9QS60np6x2sZgXc+BSnkVyWo8CaVXAoBwj94736RgCA3QznzL+5q98P0oUuAc6/cpvafOvVUeBsCbErt2dxO+d1LWyPuGkeMncbOQad+PEDefU4ds+aGYVZjn8GrvmHSEt9liRDXD8Ldo9wZtk1nRz8= 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 1707211648977623.2510286328583; Tue, 6 Feb 2024 01:27:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXHh5-0004cx-AM; Tue, 06 Feb 2024 04:24:43 -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 1rXHh3-0004bb-02 for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:24:41 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXHh1-0004kX-6s for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:24:40 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40fe2d3d5cbso3069555e9.2 for ; Tue, 06 Feb 2024 01:24:38 -0800 (PST) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c211100b0040fc5460109sm1312756wml.35.2024.02.06.01.24.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:24:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707211477; x=1707816277; 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=HXH7ocyncB0lY9SgnkHxBEuiEnRgV5eLtUY0jbLrGRM=; b=slicdj46WLpzASEsqejrWUXQEBz7dohFkXSJw8KsUdc5EGVRXARLBs9Sls/IoKlFLe 2EwvPi3xCay63wK5ZCw7jHXulMyiUkgsS6AHjKskSF6wiS0O/Xicrd5t9pxKYn+BBc0H KqjIdMfxXMjFBTd7dwPyOmhbMU+m/WFt1y8LD6XvFn8i455OqMoDw0VRd04nODUVzk+l M+6cWsXVO9X5eXM2N6cVd4gPTGM8k1tVxkCe2ux2WVybKX7e8owep+IctpahewIPCXrB VMtvAUvz6QbVaCwbKZ2oIYVOi8DEDDbnYZ2xO5dQXo+X3A4+VJ18/vwhCd1Rd0O0qSvP zHbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707211477; x=1707816277; 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=HXH7ocyncB0lY9SgnkHxBEuiEnRgV5eLtUY0jbLrGRM=; b=I9QcKV2koWvA+YFLoSmxEWjgRaAriOyMJ1j7+5KbNcpLIBCAhpRCRkK7DKiIx2J6WA Or8JWfhsvC4fe9Bg50QFiONjptyZw4jTCf+hWPGYJSDTt7SmoCYCpfDSKlRQEmuUPd9R fIxsZ7f8022elq//SU3VtoPT24QJRVHh3KzkVjvoqbQ7SVTBIsvfhh6jtYicu7BsZTnK 5Pkzc83fgWt8/AUQiF2XJXpE3YbS/GP5c1GQi+L+Xp3fvivQ4gOnrcNSOXfGi16QGcly MsR2CWAlzGbBLW+snpnAZfAnIpr4GCt2q9Lp+GaACP/aCCLJlvF/jkRISFqQapXltkyL 424A== X-Gm-Message-State: AOJu0YyZ5kURfa48DlR5mu0AYIYJfIDd9pqqx6ok1vVO/D2GAvztXeKs gSX/Kb8TEIlgb95CoQG+ZB7QsXKrFzl7gjjws/h7gzsP2TSi1+WuOZiCw6fo+PLArOh5Otx9Hsp s5as= X-Google-Smtp-Source: AGHT+IF0GQ7WicCNpQtI0lDnNMO3dkTibxN9ma/0Vs3RzRG0cUiK6Kw2I6ViIjq5iRB1KX/A5rE9eg== X-Received: by 2002:a05:600c:4fcd:b0:40e:d2da:fc6b with SMTP id o13-20020a05600c4fcd00b0040ed2dafc6bmr1719988wmq.38.1707211477459; Tue, 06 Feb 2024 01:24:37 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXBnk1SOLUSowyBb+G/8ptWtFV0dXinU/A9ascoqNxK09UtRIN6La8DR57nYr6numsiNm1ApPzzRDgjcR28P17TXsAOkV5/Y6t+SpjcrYtuQR8wPpYAqT8IuvtcMVJf7qluQTDiGsFK6FHodR4/W3oFd4L5nSvXOXZn0BvjS/+WdTKKbG8i2Q8GaTNtnkufC2N4OdIpEBQpKMX8pfbYuG3VHaHjVQFXWoAxDMyypIagdEaUTNz4h3P2CUTRlQNtL5carar5BKahIWiZ9r56JtfgkS0nWTRXl17KWh6hn6pzn7mIAa58+urwMvY93F5taQz89/OMhD1F6nTmrAhTeZ2gHZESDGk/bg== From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Alexandre Iooss , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mahmoud Mandour , Marcel Apfelbaum , Yanan Wang , Pierrick Bouvier , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 01/17] plugins: remove previous n_vcpus functions from API Date: Tue, 6 Feb 2024 13:24:06 +0400 Message-ID: <20240206092423.3005995-2-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> References: <20240206092423.3005995-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::32b; envelope-from=pierrick.bouvier@linaro.org; helo=mail-wm1-x32b.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: 1707211649939100001 Content-Type: text/plain; charset="utf-8" This information is already accessible using qemu_info_t during plugin install. We will introduce another function (qemu_plugin_num_vcpus) which represent how many cpus were enabled, by tracking new cpu indexes. It's a breaking change, so we bump API version. Signed-off-by: Pierrick Bouvier --- include/qemu/qemu-plugin.h | 10 +++------- plugins/plugin.h | 2 +- contrib/plugins/cache.c | 2 +- plugins/api.c | 30 ------------------------------ plugins/qemu-plugins.symbols | 2 -- 5 files changed, 5 insertions(+), 41 deletions(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 2c1930e7e45..0e506ee644d 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -51,11 +51,13 @@ typedef uint64_t qemu_plugin_id_t; * * The plugins export the API they were built against by exposing the * symbol qemu_plugin_version which can be checked. + * + * version 2: removed qemu_plugin_n_vcpus and qemu_plugin_n_max_vcpus */ =20 extern QEMU_PLUGIN_EXPORT int qemu_plugin_version; =20 -#define QEMU_PLUGIN_VERSION 1 +#define QEMU_PLUGIN_VERSION 2 =20 /** * struct qemu_info_t - system information for plugins @@ -644,12 +646,6 @@ QEMU_PLUGIN_API void qemu_plugin_register_atexit_cb(qemu_plugin_id_t id, qemu_plugin_udata_cb_t cb, void *userd= ata); =20 -/* returns -1 in user-mode */ -int qemu_plugin_n_vcpus(void); - -/* returns -1 in user-mode */ -int qemu_plugin_n_max_vcpus(void); - /** * qemu_plugin_outs() - output string via QEMU's logging system * @string: a string diff --git a/plugins/plugin.h b/plugins/plugin.h index 5eb2fdbc85e..90f3f324ab6 100644 --- a/plugins/plugin.h +++ b/plugins/plugin.h @@ -15,7 +15,7 @@ #include #include "qemu/qht.h" =20 -#define QEMU_PLUGIN_MIN_VERSION 0 +#define QEMU_PLUGIN_MIN_VERSION 2 =20 /* global state */ struct qemu_plugin_state { diff --git a/contrib/plugins/cache.c b/contrib/plugins/cache.c index 9e7ade3b374..c5c8ac75a9c 100644 --- a/contrib/plugins/cache.c +++ b/contrib/plugins/cache.c @@ -767,7 +767,7 @@ int qemu_plugin_install(qemu_plugin_id_t id, const qemu= _info_t *info, =20 policy =3D LRU; =20 - cores =3D sys ? qemu_plugin_n_vcpus() : 1; + cores =3D sys ? info->system.smp_vcpus : 1; =20 for (i =3D 0; i < argc; i++) { char *opt =3D argv[i]; diff --git a/plugins/api.c b/plugins/api.c index 8d5cca53295..2aaae4e47f3 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -353,36 +353,6 @@ const char *qemu_plugin_hwaddr_device_name(const struc= t qemu_plugin_hwaddr *h) #endif } =20 -/* - * Queries to the number and potential maximum number of vCPUs there - * will be. This helps the plugin dimension per-vcpu arrays. - */ - -#ifndef CONFIG_USER_ONLY -static MachineState * get_ms(void) -{ - return MACHINE(qdev_get_machine()); -} -#endif - -int qemu_plugin_n_vcpus(void) -{ -#ifdef CONFIG_USER_ONLY - return -1; -#else - return get_ms()->smp.cpus; -#endif -} - -int qemu_plugin_n_max_vcpus(void) -{ -#ifdef CONFIG_USER_ONLY - return -1; -#else - return get_ms()->smp.max_cpus; -#endif -} - /* * Plugin output */ diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols index 6963585c1ea..6088dd3714a 100644 --- a/plugins/qemu-plugins.symbols +++ b/plugins/qemu-plugins.symbols @@ -17,8 +17,6 @@ qemu_plugin_mem_is_sign_extended; qemu_plugin_mem_is_store; qemu_plugin_mem_size_shift; - qemu_plugin_n_max_vcpus; - qemu_plugin_n_vcpus; qemu_plugin_outs; qemu_plugin_path_to_binary; qemu_plugin_read_register; --=20 2.43.0 From nobody Tue Nov 26 13:28:21 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=1707211523; cv=none; d=zohomail.com; s=zohoarc; b=A6pP9GJDC5HDPG+JjzyCdqQK3LqwHmQnTUcuPLx4GApW4HJkaRs9AwwuIwyLCeqkwQ+oFvSlBUmirC76gDh81zmlhxhGViVUqQ5X/yWv2YjyEqDOUJaYrnOvkGiN2qZ9Z6+3NMIPVhBrWjDz0Cf1jcFbP6BhE/PYfYSC2VlOXEQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707211523; 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=tr3Be+F/pb6UoTGk/xigsw32PICcW54rqyyS4zJsi9I=; b=S0V0CqsIWwnyzqYL68jUVNudF8xOdTLy+3Jt+EjN1Mcog3YnsakTjFzhwwu8XC3/syO40gignvdNULQTqwyUiNqFslXxsylCmKIsykkkpEppgb6Xw+/pfFh8P4c7xs8YNYqwOXWUHtF9cWBq5tY0qe/NdJTDnIiWmEbs6r0D3xY= 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 1707211523935151.8437588086466; Tue, 6 Feb 2024 01:25:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXHh8-0004ds-67; Tue, 06 Feb 2024 04:24:46 -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 1rXHh7-0004dE-4r for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:24:45 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXHh5-0004kw-En for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:24:44 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40fe282b8e2so3433825e9.2 for ; Tue, 06 Feb 2024 01:24:42 -0800 (PST) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c211100b0040fc5460109sm1312756wml.35.2024.02.06.01.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:24:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707211481; x=1707816281; 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=tr3Be+F/pb6UoTGk/xigsw32PICcW54rqyyS4zJsi9I=; b=Tg3htUDo9r92+5gZeugfoI+R2AauBsIDVelezMWLoZSPQZ0ubQ5vTVikE8fWadclLf lPlYFNtlxfbwTAsCfT6LEetsPzkfqa3BN3qwfRejqLB4HTa+BKzbJwPbkmgPExk2sfWk DJYGYWKNmZM6uflP7HKwq/f6mhc4hDZIQsfjAuRWmFE0kygQkQS8gOfvXO4/b5fWFVbH 0PBXU7bVOCXsekqUxgt/mh/gQTfRvRzHs97Zp2Ue+YJ8JhyPPjg1cnPwW2eCkPgBDzEv +BSXsGp24w02LS83B2o9+88Bm9cpze1dP7Xwq9L/s8n1K7GEbyINNH1ssU957cG/oTGS CGCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707211481; x=1707816281; 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=tr3Be+F/pb6UoTGk/xigsw32PICcW54rqyyS4zJsi9I=; b=Comb/bjAOrx1OWzwZwXqzsXV24XmnE2Q0AdK5IdWiJ7Kgaq0lXFPwNyx17m1oVpoaO 1xPpLjQATLfl/044Yqwr8DJkto2dCW85/bL1UGiaBEz346P4hanAfFFQ9r+3mJfdUUyR lHhIxyVuiooHJoib4IDrdRRbzDAGhlZfvlBSGOXx5Xity0gcHa7OHPIS7O8u78QiCvxd fj4PK5sfp9kvew3joNfB+SAhS7ACGyWFZpciWQKkxHpbPVSGQozm6PtsOLpx2NS1XETq XYsN/2abaQIHEJgDcsmjNtFazBAoWLcfSb46v4bCg0DZE+v8yRaNzFk8yH6Ru6IvmItH DyAQ== X-Gm-Message-State: AOJu0YzQ3J+zxb4UDgav12M820ZZrNvHgUs1zLDe9r4XeCf6QWMG/WfY Tz7JlAb5heeUJd1/oDB2kx65WP0pVzAr9tDPY0x8AnWv5FtnuUo4j6iM/XWrKQnFiBn7JVDMz5S R4lg= X-Google-Smtp-Source: AGHT+IEvFY2zRx+smBpQ/P27gN4KA+fQ1gR/ptPtwnOAeaAssLvOqwLUWnppgqKs8nVLuK7OGyCWFQ== X-Received: by 2002:a05:600c:3b11:b0:40e:fb8f:76b2 with SMTP id m17-20020a05600c3b1100b0040efb8f76b2mr1227643wms.12.1707211481006; Tue, 06 Feb 2024 01:24:41 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWAdSywLF8zYD6TJZg28zqfmrAJ/ySRwUTjBTDZTJtNtCSoKxH2rEmjDqha6JfHGZ2evLeoPZxSjnd4dMnOTLQgu0czccd2qTX6nluMML0q/PBvZEAnQSBEgUKFuqnQ5rz8LDik4gLkw0ErFL9VkNWUzq6ZK455w3ueRZ1zOQZYGJUEvGdWPaCbqS0LNxGuhxauYhaSYkRVDdvCJ2w5gUv/FErVeWgrtoS0afbfsBASdfl3A9rzICOowTjd6BtOKbzpTMwOhRzNpidG34KP4k2aTShyBETcpafBA4lRnSsJFrEuYPAMrwB8D76wkCldqxkQFTS4oyp+IBaxp761ysMs9WIg/lcXcw== From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Alexandre Iooss , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mahmoud Mandour , Marcel Apfelbaum , Yanan Wang , Pierrick Bouvier , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 02/17] plugins: add qemu_plugin_num_vcpus function Date: Tue, 6 Feb 2024 13:24:07 +0400 Message-ID: <20240206092423.3005995-3-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> References: <20240206092423.3005995-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::32a; envelope-from=pierrick.bouvier@linaro.org; helo=mail-wm1-x32a.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: 1707211524685100001 Content-Type: text/plain; charset="utf-8" We now keep track of how many vcpus were started. This way, a plugin can easily query number of any vcpus at any point of execution, which unifies user and system mode workflows. Signed-off-by: Pierrick Bouvier --- include/qemu/qemu-plugin.h | 3 +++ plugins/plugin.h | 4 ++++ plugins/api.c | 5 +++++ plugins/core.c | 6 ++++++ plugins/qemu-plugins.symbols | 1 + 5 files changed, 19 insertions(+) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 0e506ee644d..e94ae4d2abb 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -646,6 +646,9 @@ QEMU_PLUGIN_API void qemu_plugin_register_atexit_cb(qemu_plugin_id_t id, qemu_plugin_udata_cb_t cb, void *userd= ata); =20 +/* returns how many vcpus were started at this point */ +int qemu_plugin_num_vcpus(void); + /** * qemu_plugin_outs() - output string via QEMU's logging system * @string: a string diff --git a/plugins/plugin.h b/plugins/plugin.h index 90f3f324ab6..00b3509f708 100644 --- a/plugins/plugin.h +++ b/plugins/plugin.h @@ -44,6 +44,8 @@ struct qemu_plugin_state { * the code cache is flushed. */ struct qht dyn_cb_arr_ht; + /* How many vcpus were started */ + int num_vcpus; }; =20 =20 @@ -97,4 +99,6 @@ void plugin_register_vcpu_mem_cb(GArray **arr, =20 void exec_inline_op(struct qemu_plugin_dyn_cb *cb); =20 +int plugin_num_vcpus(void); + #endif /* PLUGIN_H */ diff --git a/plugins/api.c b/plugins/api.c index 2aaae4e47f3..dbfc5e83729 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -353,6 +353,11 @@ const char *qemu_plugin_hwaddr_device_name(const struc= t qemu_plugin_hwaddr *h) #endif } =20 +int qemu_plugin_num_vcpus(void) +{ + return plugin_num_vcpus(); +} + /* * Plugin output */ diff --git a/plugins/core.c b/plugins/core.c index 49588285dd0..9e64820ad02 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -214,6 +214,7 @@ void qemu_plugin_vcpu_init_hook(CPUState *cpu) bool success; =20 qemu_rec_mutex_lock(&plugin.lock); + plugin.num_vcpus =3D MAX(plugin.num_vcpus, cpu->cpu_index + 1); plugin_cpu_update__locked(&cpu->cpu_index, NULL, NULL); success =3D g_hash_table_insert(plugin.cpu_ht, &cpu->cpu_index, &cpu->cpu_index); @@ -571,3 +572,8 @@ static void __attribute__((__constructor__)) plugin_ini= t(void) QHT_MODE_AUTO_RESIZE); atexit(qemu_plugin_atexit_cb); } + +int plugin_num_vcpus(void) +{ + return plugin.num_vcpus; +} diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols index 6088dd3714a..27fe97239be 100644 --- a/plugins/qemu-plugins.symbols +++ b/plugins/qemu-plugins.symbols @@ -17,6 +17,7 @@ qemu_plugin_mem_is_sign_extended; qemu_plugin_mem_is_store; qemu_plugin_mem_size_shift; + qemu_plugin_num_vcpus; qemu_plugin_outs; qemu_plugin_path_to_binary; qemu_plugin_read_register; --=20 2.43.0 From nobody Tue Nov 26 13:28:21 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=1707211532; cv=none; d=zohomail.com; s=zohoarc; b=QEpvMPqkmHk3UvgU3s19G3uHYiYNwP6eQg59oOFe/fClkdyrKQxYMy5zHzEmY1HwSkNTeFop/fHtkAxROFV/L5xH1VrZJ1wj5wqOpODGVo3ib8MyAPH7Pgqm4G2XflVTXmnNwTmqiT2KVWFsYJiqsci08o+DVMqvXsVU2gWJhe0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707211532; 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=OOjCHa75MANot4L1VfuMEJ5mVel7QNiDk7VkpGP0Ccw=; b=H4gy4otZaf1JLcSxbQuVZmoDsQlZHsEn+7ncSQZ3X9LMX1+WPyyEOoeMebtFElTwwKC6fTjsL8H9x9KFMi0FbqL3Zl0BZ0tarrxwwlvE7tqSVwdH6EjMcmO4d/VrQsUWrrpNJTM30Czp1nWE2WovXE61mIk9dxIQwF96f01lQlo= 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 1707211532807705.0916281372828; Tue, 6 Feb 2024 01:25:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXHhB-0004ee-S1; Tue, 06 Feb 2024 04:24:49 -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 1rXHhA-0004eO-9y for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:24:48 -0500 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXHh8-0004lR-OT for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:24:48 -0500 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-51117bfd452so9043676e87.3 for ; Tue, 06 Feb 2024 01:24:46 -0800 (PST) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c211100b0040fc5460109sm1312756wml.35.2024.02.06.01.24.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:24:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707211484; x=1707816284; 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=OOjCHa75MANot4L1VfuMEJ5mVel7QNiDk7VkpGP0Ccw=; b=SGmSTl5sB4hQSkBo/ODYgfltAy6KXXmSjomiI6meGAY/rFT9fRs0vu1jzUEDIKgQVp 5SxbFBvaXFqTJuGymzZzDdM4JqrNtKIcUHhJSx++nyKDVmLCkdkEyjfTV744f2sTRPSJ hRCjZTCjDZ11987CnZ1E9/1/l/kRGDWuKBJJvHDYFiZWxZhX+0Aua8SIFgV7zz0Oe3Iy zUa+wAksjqZq8eb0hInyB5881AH4o2T49Z0ZQqG48qIkpjcyigFNwgz4gBDP0tCHlF84 +QeC4/kyINnU7SDYTixq4LvXD3aeJJa89PaBGpVbBYTtHdAxC8uTo+cxud1fQsMkmJUH 3A8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707211484; x=1707816284; 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=OOjCHa75MANot4L1VfuMEJ5mVel7QNiDk7VkpGP0Ccw=; b=TsYQHak5XOUjh9X3ET+Ui3I+Sl+Bo2nFRlL7B55JwgHqdYZo9Oqbzo937o4EOvUOdo cLIVbQX9ZhY7Q6011wwKjoVHvPdCSVvX03xQ549Cil4rh3BcUiZrpa0PKiwCppZ9D+za BIQLBsieYYKPVHxYf47lbX4CC8hDeF/z6xfS4UM/2bhK6a9WJai2J6jvV1pQupmFQms1 Q4Q+TWmcz7ypfOkpHuCU69m/RXgLvwgpRgGSpk4195qgVN+KF7/mDyzkcHR7bmauHZC3 yQ6WOAqUgxAQN6onnfZCsF7vInnZbzaXzWe/Aoh1/zXzS5iBudLxhbWk7WyPHyOjca8C 0AMQ== X-Gm-Message-State: AOJu0YywUTJqq6IbZkvCQHL6SdFzZjE/Y25BgApzkAEe12wSWOEZTdiX b/OuhzTXBkllZyBcOa1P/0ogyBnN+nr3DRte8xPT36tDqJDqBEUjEM2Whe6tkL0KIFvMfArnYD0 DJI4= X-Google-Smtp-Source: AGHT+IHRrhFmOoj49bMXFAIhNiIXp5ARXqz3iC+RVRJquV6suAi1RrylVGRv6hdTSHnjCneekJfmXw== X-Received: by 2002:a05:6512:2354:b0:511:5e6c:c021 with SMTP id p20-20020a056512235400b005115e6cc021mr934899lfu.36.1707211484482; Tue, 06 Feb 2024 01:24:44 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVZ8XsdngNyJzoHXkiKTJsXFuDTeOcZ8IzLx+j3Yq4L7E7SYmOfiEy+7Ea9tR+kBft088hsB3P2KfpUgjO4doJjwVnhrBlrqUWudJwOmbMrBeAz9pTZc0u4Anfs4zj3PyR36uXBMH4RluO2J1vG0RfKwaXdA96L/NcUir7O5U3S2UjkY7Zcxfp6zfuTtRmr6jlZGNcFGzGVUszXJ1rm8nRmGy6y6+bcaSHuA9mYnrzqQqfusvQ8KmgaB8Lo47Hm1rVQncJ9yb26Ob4dKZtYZbAQCgPjK8cofei/rkQf+Yry2v0+iKOCpwX+TSgHUKttRvXeEf6zSQ6LChDcSrh6fN5OU/S5VmN5Lg== From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Alexandre Iooss , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mahmoud Mandour , Marcel Apfelbaum , Yanan Wang , Pierrick Bouvier , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 03/17] plugins: fix order of init/idle/resume callback Date: Tue, 6 Feb 2024 13:24:08 +0400 Message-ID: <20240206092423.3005995-4-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> References: <20240206092423.3005995-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::133; envelope-from=pierrick.bouvier@linaro.org; helo=mail-lf1-x133.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: 1707211533397100001 Content-Type: text/plain; charset="utf-8" We found that vcpu_init_hook was called *after* idle callback. vcpu_init is called from cpu_realize_fn, while idle/resume cb are called from qemu_wait_io_event (in vcpu thread). This change ensures we only call idle and resume cb only once a plugin was init for a given vcpu. Next change in the series will run vcpu_init asynchronously, which will make it run *after* resume callback as well. So we fix this now. Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson --- plugins/core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/core.c b/plugins/core.c index 9e64820ad02..609d9d5c184 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -392,12 +392,17 @@ void qemu_plugin_vcpu_syscall_ret(CPUState *cpu, int6= 4_t num, int64_t ret) =20 void qemu_plugin_vcpu_idle_cb(CPUState *cpu) { - plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_IDLE); + /* idle and resume cb may be called before init, ignore in this case */ + if (cpu->cpu_index < plugin.num_vcpus) { + plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_IDLE); + } } =20 void qemu_plugin_vcpu_resume_cb(CPUState *cpu) { - plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_RESUME); + if (cpu->cpu_index < plugin.num_vcpus) { + plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_RESUME); + } } =20 void qemu_plugin_register_vcpu_idle_cb(qemu_plugin_id_t id, --=20 2.43.0 From nobody Tue Nov 26 13:28:21 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=1707211586; cv=none; d=zohomail.com; s=zohoarc; b=co1qKH5QADX6fm6CIb/oxRwskGFkZF/HnYvALI6IiII8R1YeUUtlX1Y7mrQdGsJq8ynb4HolmaNiQcr8/Ii+LZmjk6L4YzYwq4/kAtfwd2IyVFeRQboZA/8a3cVvQT8wgiR1i2/uEXGGVOwpoiTEHt/h3oUcnRHI6Ax5rwiRVRI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707211586; 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=URZi/NmqB9fEf7SSooAoQ9VbUa1hGL9MClMwYN/jkYI=; b=ldEt9WkKmYIhg6pGHzxXfCovNI6ZyfnT+7SxmYoL400P8+ZJ/WKoJPssg6SEeFKHgGqFYgdNjOn6C6zShJ9mAMsBtETB8t8IUkaP/s0Z2rMTacv3F3UQ95zf7FakliipauJQ0njHEmg4JnBZH5s9UPFpSPqSn6FYILTmR/tu8v0= 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 1707211586814945.9172905405213; Tue, 6 Feb 2024 01:26:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXHhE-0004fE-D0; Tue, 06 Feb 2024 04:24:52 -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 1rXHhD-0004f3-Kj for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:24:51 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXHhC-0004lm-5B for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:24:51 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40efcb37373so5295055e9.2 for ; Tue, 06 Feb 2024 01:24:49 -0800 (PST) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c211100b0040fc5460109sm1312756wml.35.2024.02.06.01.24.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:24:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707211488; x=1707816288; 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=URZi/NmqB9fEf7SSooAoQ9VbUa1hGL9MClMwYN/jkYI=; b=BAobvPOrSVLCqzZs9YIojdLcNYEo4qrpzC+1ku9rr5vEv/VyPztINsnBqwzPE2hnDl 7JBoltfa6MYoD2hOiGruNUFVFPGl1bdNPQVpcaMdmBKS61nCGo4FeDLDzUGIH9PBxr6x CnY47modg9aYM0+KRKbFfIw+ywp3/NdK/v13tO8GV8Twsk7lVhrOcMxLdvlzCbDsILQa EK65ZuOu/bsw9qaXi5amyPVc0sOsDtbXyHyt5pIH43GbofN8jzTl7IrLOjT0e2oQoBul Ji6oBJJsuW4i8ZpZ/HBuHZISUWQgPBqjUyC76YYvB1ib/m3Q9yFyQArfQFpqhye0V/zt V3AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707211488; x=1707816288; 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=URZi/NmqB9fEf7SSooAoQ9VbUa1hGL9MClMwYN/jkYI=; b=icJAvQkU3ZMNzZXC7Beu/dojVJbjkg1PXTSvtP3DMEk3EglMkRurjLk/6A5uLKi5tJ FSfhro5u26yDvpQ49ywtDXccdKjO4vCLH3Ga6VoYZMXQsUTWG2YR8HBfW3ljlgHc+Eli CLNljiBxY/QKRXyxPi8PQfoHHqjcqURAHbahoT4l0VbHEM5BPD4kNFxNXAFeMn5TeCIm UPNLl7B+2RuLDaF9MGfpY0DwVW/ELZI9haitcuKLkzB0KY/rYauTD810iBLQc8cRwwdc Em4Qj3ijHHaHR6qlJyqsr4Vo1o1KuQ5eoX6UbvaQt9jEOIeCFvmjK/PX39ViFnSJkiaf 72qw== X-Gm-Message-State: AOJu0YznanoPqxRNE6jNrK5iFBPr0fTNHTwWjqsJ5NOELAXWqWz8QkE8 vPvY+LQKg9MyRfeOARXoQwKOTaIquM957WFVblh0yTTHWvL9Sj6btTx4adpMpS22LaWo4P1TqFv yysI= X-Google-Smtp-Source: AGHT+IHdjdiPX7gRlYvdxF1WKacSlhjLJVto4VvtFlbgY9e7fwAqAZqWRGdDTiYXghBnPqay50mHaA== X-Received: by 2002:a05:600c:3581:b0:40f:de6a:2a27 with SMTP id p1-20020a05600c358100b0040fde6a2a27mr1649274wmq.40.1707211488060; Tue, 06 Feb 2024 01:24:48 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWBDcU1Ik2599Slt5Dh5fJWg9XnNYFiseY8sQ7UJfX+CKhPEA6t1dMS5F/7D4DTVDxSf+6dqhEOhmqHfu9BzZMD7pJMmmSjop9BAll3gYvMTd03XlgRoYvzLo2nqfTZpF73AYfO8lwlCRSdNSfDq3thmlqyQCXukMRWuHjbp6QDZxbQNd56sJGKm0YP/ciD2Z48VqOdmfRWHClC3Z5BJVfpvbR3+XeURcRFHKXG8SL3Xj8A3r8KadR8TqlIXV7sH3AcPb0g51DCfVx+BiL6zSjNEZlndvTjC1VVey5WtTlnyhIkjCM5Hj+O61liJl8t13rYDbcZJbXYwqictDEy2GNvWaJeKbZIJQ== From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Alexandre Iooss , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mahmoud Mandour , Marcel Apfelbaum , Yanan Wang , Pierrick Bouvier , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 04/17] cpu: call plugin init hook asynchronously Date: Tue, 6 Feb 2024 13:24:09 +0400 Message-ID: <20240206092423.3005995-5-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> References: <20240206092423.3005995-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::32a; envelope-from=pierrick.bouvier@linaro.org; helo=mail-wm1-x32a.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: 1707211587628100005 Content-Type: text/plain; charset="utf-8" This ensures we run during a cpu_exec, which allows to call start/end exclusive from this init hook (needed for new scoreboard API introduced later). async work is run before any tb is translated/executed, so we can guarantee plugin init will be called before any other hook. The previous change made sure that any idle/resume cb call will not be done before initializing plugin for a given vcpu. Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson --- hw/core/cpu-common.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index fe16d0d9df8..68786360ea5 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -194,6 +194,11 @@ static void cpu_common_parse_features(const char *type= name, char *features, } } =20 +static void qemu_plugin_vcpu_init__async(CPUState *cpu, run_on_cpu_data un= used) +{ + qemu_plugin_vcpu_init_hook(cpu); +} + static void cpu_common_realizefn(DeviceState *dev, Error **errp) { CPUState *cpu =3D CPU(dev); @@ -217,9 +222,9 @@ static void cpu_common_realizefn(DeviceState *dev, Erro= r **errp) cpu_resume(cpu); } =20 - /* Plugin initialization must wait until the cpu is fully realized. */ + /* Plugin initialization must wait until the cpu start executing code = */ if (tcg_enabled()) { - qemu_plugin_vcpu_init_hook(cpu); + async_run_on_cpu(cpu, qemu_plugin_vcpu_init__async, RUN_ON_CPU_NUL= L); } =20 /* NOTE: latest generic point where the cpu is fully realized */ --=20 2.43.0 From nobody Tue Nov 26 13:28:21 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=1707211571; cv=none; d=zohomail.com; s=zohoarc; b=XAIa2w89iZG2NmXNm/zh97qEkgbwo6fPM1KahjodGCGadLfMmtrq/M/XmdoPjr4RxI5eBnUCoiitNaiYy9H7jyPSaygDc3Fy9gckSTKDZCBOuirzyiE0W6BBDeciPz4QETJ2bWPlLBG4opXpz3+AR7Gy/0u92U5fg771jZ26jcs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707211571; 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=RqcOdG+TO25rW2RA/w0FgjbgxpUpC13Aauz7MMRyDks=; b=bO5SiMN53PbZjjEiWBTqV6gczJawBw1ILAaxXNJHUWwJuFI3QBhjjIgNCFSc/DzOmedAwnOoJfgW4cATa96gKDfy34qnTiQ7aj3jOkVsUB9UcRqTn9u7w5uv/nbubCXdkEL7uKhxHM4RCtihdLrql74IsKBP8xgAqxIW6M+zi+w= 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 1707211570950625.6709828176882; Tue, 6 Feb 2024 01:26:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXHhJ-0004fz-TL; Tue, 06 Feb 2024 04:24:57 -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 1rXHhI-0004fn-1i for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:24:56 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXHhF-0004mA-So for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:24:55 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40fdd65a9bdso12809285e9.2 for ; Tue, 06 Feb 2024 01:24:53 -0800 (PST) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c211100b0040fc5460109sm1312756wml.35.2024.02.06.01.24.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:24:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707211491; x=1707816291; 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=RqcOdG+TO25rW2RA/w0FgjbgxpUpC13Aauz7MMRyDks=; b=tnqsRDBOErl9j4NhdnKbDMQmZVf4M+scgI3qYxbd6kiZL5GvOrnWv05FCzKFF4ZF31 acEWj4h6mmaF13xR9MZVVu5LSdrAJ40tcKpH+peAqWJKZiBi696vG1AkI8GBy/UHBBRn GiqE/HpSZAugg/pEAtOWO2glvpat6LC9IAbbxnRdLzc8uZO+VETONdBF+xNhE98zzEPT YP41QTn8XRXQnar/b4UXr6WxI8h9s0Aj2MApL7MAi4dfGlFmTgGeIAslyoSwzuckkOjJ 8Z/bCtH1lSY00b8r8ggpiBoNMizWvw2QdsTAwvhgXGTHTtzFn2N42ghWrRXN9slUjPLN EY+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707211491; x=1707816291; 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=RqcOdG+TO25rW2RA/w0FgjbgxpUpC13Aauz7MMRyDks=; b=cIuqdKwR3trOQPLzwCnYxJuG+xPwYKAFNBn1gPL+eEqQSkcuiYYusipyLAN4Xms4A5 e8Yyl77kS7XZ9auOJ7+FHuBVkGicvxV+Nlbu81UIFeOqqRIGLn5a1sY9SeEVTvCKBw7A znxh7kWgA23T9SdZE5IqzBxqALUCYYpZdTy9tPVhv+HpGBy255PKU7BYjg+B6GBqcqla azmyc7aZXuNmevmyuMKNBzbtnYAfNdxxsckTAiASu9dXcLc31RkxDf0ZdrFebuRYOxA1 J1wJOOYXuXV15MuU4HuuV20iRMgxeCTE56hynQ9MpaoHdcr6444DrGYUY5gi69MVzQHn w4Ug== X-Gm-Message-State: AOJu0Yxuc6b5oIR8dIReQTntdH3u98BZ5LwixR3urtp6GdX0u2+3ENIb 2duBHNWI98gMMwYusVPXOzpC9fozkiDg3+SN/zFq+P3JS0t/zpMNukh+k1+yhETp6d5OocDs2Ke t5Vo= X-Google-Smtp-Source: AGHT+IEpfg6UGMrEpAVi3iALrURHodRnSPL89mTtgahZPSDFZ5mGdT985Ml9AeFAkAL1T6u1/8KlRA== X-Received: by 2002:a05:600c:4691:b0:40f:d84c:ac68 with SMTP id p17-20020a05600c469100b0040fd84cac68mr1619120wmo.11.1707211491624; Tue, 06 Feb 2024 01:24:51 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCV/H74HIjJSo4WTZq6L0iCE1vPRUOeJQ1J/eEBVP2871sIhpnuDTp5j2MLRQmSA9+dzYvtc+PBD9WqsO6psDKkWaG0di6iRMbHp1/RfAdRFKOy9oBfh00XatSclZC0PyD1Plvrf88tiqTT+XelBD7qaTGR6yDt3ahdlVu5yJoe0MNM7wcnvL9L2Xp2hWkK1/E1cNoXW0Zdwvc4ro3lypHsSWZwoLsu9UoXe0eI4D23lGACxu/WxM50Bhf1tVg9IeMd68yOGn2Os+9VUOft96U+cTt7E2oojUdGbMx3hOJTHziDA4FQR9NpsRaPdZWCs313UPAGrUYLz0zijpVlwzmz7rPkdI13K2Q== From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Alexandre Iooss , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mahmoud Mandour , Marcel Apfelbaum , Yanan Wang , Pierrick Bouvier , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 05/17] plugins: scoreboard API Date: Tue, 6 Feb 2024 13:24:10 +0400 Message-ID: <20240206092423.3005995-6-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> References: <20240206092423.3005995-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::332; envelope-from=pierrick.bouvier@linaro.org; helo=mail-wm1-x332.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: 1707211571694100009 Content-Type: text/plain; charset="utf-8" We introduce a cpu local storage, automatically managed (and extended) by QEMU itself. Plugin allocate a scoreboard, and don't have to deal with how many cpus are launched. This API will be used by new inline functions but callbacks can benefit from this as well. This way, they can operate without a global lock for simple operations. At any point during execution, any scoreboard will be dimensioned with at least qemu_plugin_num_vcpus entries. New functions: - qemu_plugin_scoreboard_find - qemu_plugin_scoreboard_free - qemu_plugin_scoreboard_new In more, we define a qemu_plugin_u64, which is a simple struct holding a pointer to a scoreboard, and a given offset. This allows to have a scoreboard containing structs, without having to bring offset for all operations on a specific field. Since most of the plugins are simply collecting a sum of per-cpu values, qemu_plugin_u64 directly support this operation as well. New functions: - qemu_plugin_u64_add - qemu_plugin_u64_get - qemu_plugin_u64_set - qemu_plugin_u64_sum New macros: - qemu_plugin_scoreboard_u64 - qemu_plugin_scoreboard_u64_in_struct Signed-off-by: Pierrick Bouvier --- include/qemu/plugin.h | 5 +++ include/qemu/qemu-plugin.h | 83 ++++++++++++++++++++++++++++++++++++ plugins/plugin.h | 7 +++ plugins/api.c | 53 +++++++++++++++++++++++ plugins/core.c | 67 +++++++++++++++++++++++++++++ plugins/qemu-plugins.symbols | 7 +++ 6 files changed, 222 insertions(+) diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index b0c5ac68293..af4aeef4d78 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -112,6 +112,11 @@ struct qemu_plugin_insn { bool mem_only; }; =20 +/* A scoreboard is an array of values, indexed by vcpu_index */ +struct qemu_plugin_scoreboard { + GArray *data; +}; + /* * qemu_plugin_insn allocate and cleanup functions. We don't expect to * cleanup many of these structures. They are reused for each fresh diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index e94ae4d2abb..a48586ef0c1 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -222,6 +222,19 @@ void qemu_plugin_register_vcpu_resume_cb(qemu_plugin_i= d_t id, struct qemu_plugin_tb; /** struct qemu_plugin_insn - Opaque handle for a translated instruction */ struct qemu_plugin_insn; +/** struct qemu_plugin_scoreboard - Opaque handle for a scoreboard */ +struct qemu_plugin_scoreboard; + +/** + * typedef qemu_plugin_u64 - uint64_t member of an entry in a scoreboard + * + * This field allows to access a specific uint64_t member in one given ent= ry, + * located at a specified offset. Inline operations expect this as entry. + */ +typedef struct { + struct qemu_plugin_scoreboard *score; + size_t offset; +} qemu_plugin_u64; =20 /** * enum qemu_plugin_cb_flags - type of callback @@ -753,5 +766,75 @@ int qemu_plugin_read_register(unsigned int vcpu, struct qemu_plugin_register *handle, GByteArray *buf); =20 +/** + * qemu_plugin_scoreboard_new() - alloc a new scoreboard + * + * @element_size: size (in bytes) for one entry + * + * Returns a pointer to a new scoreboard. It must be freed using + * qemu_plugin_scoreboard_free. + */ +QEMU_PLUGIN_API +struct qemu_plugin_scoreboard *qemu_plugin_scoreboard_new(size_t element_s= ize); + +/** + * qemu_plugin_scoreboard_free() - free a scoreboard + * @score: scoreboard to free + */ +QEMU_PLUGIN_API +void qemu_plugin_scoreboard_free(struct qemu_plugin_scoreboard *score); + +/** + * qemu_plugin_scoreboard_find() - get pointer to an entry of a scoreboard + * @score: scoreboard to query + * @vcpu_index: entry index + * + * Returns address of entry of a scoreboard matching a given vcpu_index. T= his + * address can be modified later if scoreboard is resized. + */ +QEMU_PLUGIN_API +void *qemu_plugin_scoreboard_find(struct qemu_plugin_scoreboard *score, + unsigned int vcpu_index); + +/* Macros to define a qemu_plugin_u64 */ +#define qemu_plugin_scoreboard_u64(score) \ + (qemu_plugin_u64) {score, 0} +#define qemu_plugin_scoreboard_u64_in_struct(score, type, member) \ + (qemu_plugin_u64) {score, offsetof(type, member)} + +/** + * qemu_plugin_u64_add() - add a value to a qemu_plugin_u64 for a given vc= pu + * @entry: entry to query + * @vcpu_index: entry index + * @added: value to add + */ +QEMU_PLUGIN_API +void qemu_plugin_u64_add(qemu_plugin_u64 entry, unsigned int vcpu_index, + uint64_t added); + +/** + * qemu_plugin_u64_get() - get value of a qemu_plugin_u64 for a given vcpu + * @entry: entry to query + * @vcpu_index: entry index + */ +QEMU_PLUGIN_API +uint64_t qemu_plugin_u64_get(qemu_plugin_u64 entry, unsigned int vcpu_inde= x); + +/** + * qemu_plugin_u64_set() - set value of a qemu_plugin_u64 for a given vcpu + * @entry: entry to query + * @vcpu_index: entry index + * @val: new value + */ +QEMU_PLUGIN_API +void qemu_plugin_u64_set(qemu_plugin_u64 entry, unsigned int vcpu_index, + uint64_t val); + +/** + * qemu_plugin_u64_sum() - return sum of all vcpu entries in a scoreboard + * @entry: entry to sum + */ +QEMU_PLUGIN_API +uint64_t qemu_plugin_u64_sum(qemu_plugin_u64 entry); =20 #endif /* QEMU_QEMU_PLUGIN_H */ diff --git a/plugins/plugin.h b/plugins/plugin.h index 00b3509f708..fd93a372803 100644 --- a/plugins/plugin.h +++ b/plugins/plugin.h @@ -31,6 +31,9 @@ struct qemu_plugin_state { * but with the HT we avoid adding a field to CPUState. */ GHashTable *cpu_ht; + /* Scoreboards, indexed by their addresses. */ + GHashTable *scoreboards; + size_t scoreboard_alloc_size; DECLARE_BITMAP(mask, QEMU_PLUGIN_EV_MAX); /* * @lock protects the struct as well as ctx->uninstalling. @@ -101,4 +104,8 @@ void exec_inline_op(struct qemu_plugin_dyn_cb *cb); =20 int plugin_num_vcpus(void); =20 +struct qemu_plugin_scoreboard *plugin_scoreboard_new(size_t element_size); + +void plugin_scoreboard_free(struct qemu_plugin_scoreboard *score); + #endif /* PLUGIN_H */ diff --git a/plugins/api.c b/plugins/api.c index dbfc5e83729..15edad6769b 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -521,3 +521,56 @@ static void __attribute__((__constructor__)) qemu_api_= init(void) qemu_mutex_init(®_handle_lock); =20 } + +struct qemu_plugin_scoreboard *qemu_plugin_scoreboard_new(size_t element_s= ize) +{ + return plugin_scoreboard_new(element_size); +} + +void qemu_plugin_scoreboard_free(struct qemu_plugin_scoreboard *score) +{ + plugin_scoreboard_free(score); +} + +void *qemu_plugin_scoreboard_find(struct qemu_plugin_scoreboard *score, + unsigned int vcpu_index) +{ + g_assert(vcpu_index < qemu_plugin_num_vcpus()); + /* we can't use g_array_index since entry size is not statically known= */ + char *base_ptr =3D score->data->data; + return base_ptr + vcpu_index * g_array_get_element_size(score->data); +} + +static uint64_t *plugin_u64_address(qemu_plugin_u64 entry, + unsigned int vcpu_index) +{ + char *ptr =3D qemu_plugin_scoreboard_find(entry.score, vcpu_index); + return (uint64_t *)(ptr + entry.offset); +} + +void qemu_plugin_u64_add(qemu_plugin_u64 entry, unsigned int vcpu_index, + uint64_t added) +{ + *plugin_u64_address(entry, vcpu_index) +=3D added; +} + +uint64_t qemu_plugin_u64_get(qemu_plugin_u64 entry, + unsigned int vcpu_index) +{ + return *plugin_u64_address(entry, vcpu_index); +} + +void qemu_plugin_u64_set(qemu_plugin_u64 entry, unsigned int vcpu_index, + uint64_t val) +{ + *plugin_u64_address(entry, vcpu_index) =3D val; +} + +uint64_t qemu_plugin_u64_sum(qemu_plugin_u64 entry) +{ + uint64_t total =3D 0; + for (int i =3D 0; i < qemu_plugin_num_vcpus(); ++i) { + total +=3D qemu_plugin_u64_get(entry, i); + } + return total; +} diff --git a/plugins/core.c b/plugins/core.c index 609d9d5c184..fd8604bcb79 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -209,6 +209,44 @@ plugin_register_cb_udata(qemu_plugin_id_t id, enum qem= u_plugin_event ev, do_plugin_register_cb(id, ev, func, udata); } =20 +static void plugin_resize_one_scoreboard(gpointer key, + gpointer value, + gpointer user_data) +{ + struct qemu_plugin_scoreboard *score =3D + (struct qemu_plugin_scoreboard *) value; + size_t new_alloc_size =3D (size_t) user_data; + g_array_set_size(score->data, new_alloc_size); +} + +static void plugin_grow_scoreboards__locked(CPUState *cpu) +{ + if (cpu->cpu_index < plugin.scoreboard_alloc_size) { + return; + } + + bool need_realloc =3D FALSE; + while (cpu->cpu_index >=3D plugin.scoreboard_alloc_size) { + plugin.scoreboard_alloc_size *=3D 2; + need_realloc =3D TRUE; + } + + + if (!need_realloc || g_hash_table_size(plugin.scoreboards) =3D=3D 0) { + /* nothing to do, we just updated sizes for future scoreboards */ + return; + } + + /* cpus must be stopped, as tb might still use an existing scoreboard.= */ + start_exclusive(); + g_hash_table_foreach(plugin.scoreboards, + &plugin_resize_one_scoreboard, + GSIZE_TO_POINTER(plugin.scoreboard_alloc_size)); + /* force all tb to be flushed, as scoreboard pointers were changed. */ + tb_flush(cpu); + end_exclusive(); +} + void qemu_plugin_vcpu_init_hook(CPUState *cpu) { bool success; @@ -219,6 +257,7 @@ void qemu_plugin_vcpu_init_hook(CPUState *cpu) success =3D g_hash_table_insert(plugin.cpu_ht, &cpu->cpu_index, &cpu->cpu_index); g_assert(success); + plugin_grow_scoreboards__locked(cpu); qemu_rec_mutex_unlock(&plugin.lock); =20 plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_INIT); @@ -572,6 +611,8 @@ static void __attribute__((__constructor__)) plugin_ini= t(void) qemu_rec_mutex_init(&plugin.lock); plugin.id_ht =3D g_hash_table_new(g_int64_hash, g_int64_equal); plugin.cpu_ht =3D g_hash_table_new(g_int_hash, g_int_equal); + plugin.scoreboards =3D g_hash_table_new(g_int64_hash, g_int64_equal); + plugin.scoreboard_alloc_size =3D 16; /* avoid frequent reallocation */ QTAILQ_INIT(&plugin.ctxs); qht_init(&plugin.dyn_cb_arr_ht, plugin_dyn_cb_arr_cmp, 16, QHT_MODE_AUTO_RESIZE); @@ -582,3 +623,29 @@ int plugin_num_vcpus(void) { return plugin.num_vcpus; } + +struct qemu_plugin_scoreboard *plugin_scoreboard_new(size_t element_size) +{ + struct qemu_plugin_scoreboard *score =3D + g_malloc0(sizeof(struct qemu_plugin_scoreboard)); + score->data =3D g_array_new(FALSE, TRUE, element_size); + g_array_set_size(score->data, plugin.scoreboard_alloc_size); + + qemu_rec_mutex_lock(&plugin.lock); + bool inserted =3D g_hash_table_insert(plugin.scoreboards, score, score= ); + g_assert(inserted); + qemu_rec_mutex_unlock(&plugin.lock); + + return score; +} + +void plugin_scoreboard_free(struct qemu_plugin_scoreboard *score) +{ + qemu_rec_mutex_lock(&plugin.lock); + bool removed =3D g_hash_table_remove(plugin.scoreboards, score); + g_assert(removed); + qemu_rec_mutex_unlock(&plugin.lock); + + g_array_free(score->data, TRUE); + g_free(score); +} diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols index 27fe97239be..6204453d0fd 100644 --- a/plugins/qemu-plugins.symbols +++ b/plugins/qemu-plugins.symbols @@ -37,10 +37,17 @@ qemu_plugin_register_vcpu_tb_exec_inline; qemu_plugin_register_vcpu_tb_trans_cb; qemu_plugin_reset; + qemu_plugin_scoreboard_free; + qemu_plugin_scoreboard_find; + qemu_plugin_scoreboard_new; qemu_plugin_start_code; qemu_plugin_tb_get_insn; qemu_plugin_tb_n_insns; qemu_plugin_tb_vaddr; + qemu_plugin_u64_add; + qemu_plugin_u64_get; + qemu_plugin_u64_set; + qemu_plugin_u64_sum; qemu_plugin_uninstall; qemu_plugin_vcpu_for_each; }; --=20 2.43.0 From nobody Tue Nov 26 13:28:21 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=1707211632; cv=none; d=zohomail.com; s=zohoarc; b=hLahIcMmpsYUBZc90RbGJXZ/9uXQ2zgnLpJiUE2oR/Te/LMPBjqqJ2hS/acUzK4HjA0jJyzWGQ02teK8QZ6sLrWQ1lQfj4dTDfqEEk0rIbjAeMnn/m3/5HM45cnuc68VVPjsBxmHwPqApG9AN+f/qkEcdLcT+T/NG3Z+2rawYBU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707211632; 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=OCiv7Y34jUunl2R1CBjG/RVHjCXAnByZwR7nxj0vfkc=; b=jhxE5LTy0/eUdYms0MrfrLM5lgd33Ld3PqdoyfCGu+9GdfDiPUCh3BMl66ml3UOehZfimiR6uwDs7i2jWp5/J+Pu4QjIJTqKOS3/fik55J+xR6A7agfY49Y5X0+u6/yiFjeRFVOOAF9xHe/41nSrjXGphC2QrzfEGCSI0gGFwWs= 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 1707211632954372.66859435639753; Tue, 6 Feb 2024 01:27:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXHhQ-0004h1-H0; Tue, 06 Feb 2024 04:25:04 -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 1rXHhO-0004gR-I0 for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:02 -0500 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXHhJ-0004mH-ML for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:02 -0500 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-511538be947so1844314e87.3 for ; Tue, 06 Feb 2024 01:24:56 -0800 (PST) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c211100b0040fc5460109sm1312756wml.35.2024.02.06.01.24.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:24:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707211495; x=1707816295; 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=OCiv7Y34jUunl2R1CBjG/RVHjCXAnByZwR7nxj0vfkc=; b=eB6fOi2URhg44M0HI9Yb9X1g0YP5Xiw67+PJ3wDKBlgcyNOVkdwyeWU96BDWULCzjv v8q63Uq24BTj6sY8yd0hMhOmFJ6F7shTm0TH/qBZbUpgtDZNtk31K6FvspRolWL2ONAT duoL7l0LIW3zV/l5Zasw2kjv7TcrIkgGWiQRYazVjn90WtcKsD5XfpaBNWue0kMfJUjK ybWIx7IKE4G+Jhm+V1LPubwuGG7vk60uBu6opJZqbhgsKxYInCpVgfi1vt/AEbryRsQk GsTIDShGaKaTVC2goj0ik8AvF2qCDSTfwJjuduZeJ4S/F/tgKzAwXjy+lFMkAB2m2YOI xcZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707211495; x=1707816295; 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=OCiv7Y34jUunl2R1CBjG/RVHjCXAnByZwR7nxj0vfkc=; b=Th7KywdTXFdRsRbfMjfo1HtiUhuycSUv12nB0o5vBYOMQwqqcGEXeD0eoSvKxM7f/V tuT1ijleOhvztxn3ZH2wDLHY0cPn76CBKwxjqXDmc4cbyPphhhAwIIMRUBqKbRMS35NW k/QGICFW/3gjsX3B0ZzNi3S6nhUFRRMz6ahZLvdvZVqmSUXtAvFayLQkJYBE8Xn9tYRg 2uZdgOKDqeQ6GQxB0aPQTOq3Vgt5zo0xBxjyhej+W1pgSad0GVTx3Om0FvtCG4KxKBAV vPDXe5vGVAAR6DwhfbTExHzPOJ/gV8SsUGx+eYwvKm9+Dwqbq5NNWg63m7HjUfAGDetn j08A== X-Gm-Message-State: AOJu0YztsKjWAGWbqUIMkFpoKjLkAzXWfmdOojTKCgPdyjj5UP4chPiQ HhzGCNIHMU80h48OPgRLhvTokR5cALEiUMskkG0izTjpRGHZ1aVfaHAxgzJ+gZrVTVXw3njf4sV qZ1g= X-Google-Smtp-Source: AGHT+IHru52oWdP93tWsXl7pJhE4vv0aQuGEIHUeL8plRIN+OUbrX/PQSYn8oGpMnc4hRBI5GSwikg== X-Received: by 2002:ac2:5e30:0:b0:511:1a26:daab with SMTP id o16-20020ac25e30000000b005111a26daabmr1248917lfg.2.1707211495128; Tue, 06 Feb 2024 01:24:55 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVl9T0xIJP6DKHUNs/jNndvkCf+w52YW0d6cumA8Wd9XllQgkSvbwavYMknmpeUqb9jFBk1sfgkKlXZQufdoPn36uGA8s6gP07eUCfmmXozc9D6ba1xunH6aPzLjowwQTS4//APpRX54l/CSzR7LifsV3kJtNEaPUY4EI0UPXD9fqRmGNqM+7ZBXqLI2sPXvfpq3URFnqMUZ82pNkKuHajwdhk5Q/h7m6QYudGd7HdDoFTisa+mv/9RpPl+gZ5gw/LfbqXVVt/ZIq0YKtqRljSoYxFDk8NEk+8UGBMiMyVvA1HRw1T806PSREhGFxoTots8/W3TtKbngDTgSxo1jVgqrZ36TpMNoA== From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Alexandre Iooss , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mahmoud Mandour , Marcel Apfelbaum , Yanan Wang , Pierrick Bouvier , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 06/17] docs/devel: plugins can trigger a tb flush Date: Tue, 6 Feb 2024 13:24:11 +0400 Message-ID: <20240206092423.3005995-7-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> References: <20240206092423.3005995-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::12f; envelope-from=pierrick.bouvier@linaro.org; helo=mail-lf1-x12f.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=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: 1707211633910100005 Content-Type: text/plain; charset="utf-8" When scoreboards need to be reallocated. Signed-off-by: Pierrick Bouvier --- docs/devel/multi-thread-tcg.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/devel/multi-thread-tcg.rst b/docs/devel/multi-thread-tcg.= rst index 7302c3bf534..1420789fff3 100644 --- a/docs/devel/multi-thread-tcg.rst +++ b/docs/devel/multi-thread-tcg.rst @@ -109,6 +109,7 @@ including: - debugging operations (breakpoint insertion/removal) - some CPU helper functions - linux-user spawning its first thread + - operations related to TCG Plugins =20 This is done with the async_safe_run_on_cpu() mechanism to ensure all vCPUs are quiescent when changes are being made to shared global --=20 2.43.0 From nobody Tue Nov 26 13:28:21 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=1707211567; cv=none; d=zohomail.com; s=zohoarc; b=SVVdojvA+SN47xOtrqmEpsSx3UXuGIAhxD/HArcXDbw9YUzmRUQIeJxcK2nj+79TuwQyLCFsYWgJSI32w4fzmsak84wN4rLczZkTrJnTZyGt5/zteSyooQvS0zN8+CKPbHZP5IJ4uFyPxS40kpfYWQ+vY87PdlHw/PTnRShdgdM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707211567; 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=b/g0mzC04szOUnabir1iLLohCVaDKcAp4uQzKj4Dxwg=; b=XfNl/SvhrdsBM+7aPmbwoeWEQrka2MZH2v6iiqNWRKZOhn+3HOMLIzBmvPvJXZDT8t6U2prJWJU3EGYa26sQNl2DpXHfV9BPRtikhiEHDAt2J9WbUaPzS36TFYxpJXPFpxHT4Vscldge3+PCmMRBFVJ5zVp3Txhf8JetqHiS0Y8= 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 1707211567463323.1462181019117; Tue, 6 Feb 2024 01:26:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXHhS-0004hK-61; Tue, 06 Feb 2024 04:25:06 -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 1rXHhP-0004gt-Qj for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:03 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXHhN-0004ma-RG for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:03 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40fdb18ffc7so17284465e9.1 for ; Tue, 06 Feb 2024 01:25:01 -0800 (PST) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c211100b0040fc5460109sm1312756wml.35.2024.02.06.01.24.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:24:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707211498; x=1707816298; 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=b/g0mzC04szOUnabir1iLLohCVaDKcAp4uQzKj4Dxwg=; b=WqhZPq20rTP/4q7aSjt+/8odZ6p6q/mJAGXw1KAfYNrOxgzNwSbKutPk3UDbE4mXt0 jMXlMnA2RM/5qPVvZ1Ho5mOoGsAg51/LJEDNOldv5N8N9VtwieGZEFhyTn+POXL11InQ muE7JEwq1ZyPPWr6tAnNi6d62UzVBZ6e3Crue5zjVjPNYebUmE6vVAfRK/QCzAz7XJyl 5lHexawIi70xl2cjiOtu2kkFSUMLbFfYA3YIwvti9mvse9zLYsPJ2jkWtekTapA6jfKc E1KVh+OB6OUs6AQLijVyUBUd4+XdKlZxd7OqFQtKn45RfSPPT/s87xDcok6LmCAgEQNR O4Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707211498; x=1707816298; 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=b/g0mzC04szOUnabir1iLLohCVaDKcAp4uQzKj4Dxwg=; b=vuAxKIVIiiIjvtXKHNdHhfAiv9b6+LB+qvMATOaBYMOC4KRR3DX4dOOGgkobUg8kg0 zz/VM0NQsypOzzb2bmEF+ibYpN1ymWUswSuxYLa1qaqCOzRGhQug/W3DKVJAXGkKolTt GWvXGA+auyjxgNfuXGst3ZPF3c7ewkV3T5lYtmdL5oEZTzHAnd6Biw89ve2kwPSrrokO xCfMdpAwRlyyAukwo9qWTpI6VxKC0zkekL2xOHJ1cUt0z4skEliWJqwqSTTHlRPMuplr 6fjUuC0flzltP4u/WGChrk2+JltzYtO5DZzeo0QvT0uuITetg1USyIO3CHWPULFJVPlt loag== X-Gm-Message-State: AOJu0YyJnABf4fnImQQ9Lu6Z1WeckSb+5r22BO7ivukGAjHNOMwjueRI +YN7EKvnIncoRNu9no8XDH5nBlu8lr1AOVbK/34iu/lpRUMgSkoYNVeM04cavjL8o7l5YYGvWEk lxJM= X-Google-Smtp-Source: AGHT+IH+8nT9xcnw94BA8stxbQa5xKFKrAuaY+V9Kp/tazUjFz7EkOk4Jru+sqD+K6ymiOxt+jl0jg== X-Received: by 2002:a05:600c:3b8b:b0:40f:df20:170e with SMTP id n11-20020a05600c3b8b00b0040fdf20170emr1176154wms.28.1707211498653; Tue, 06 Feb 2024 01:24:58 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVkUoJtjxsYrrru7l6Q7fWujJ6IhxOQmpENemZpNSzhbD/MpcgbSBISnecs9TbnzgvStjswP8UBxvXneF3P3m8+vsuwgOAI4ynJcd3mn6VukHWzNAcsKzI8fDdWeaDl24vtzFZKllL6iFe2Jo2gBkWBxnJGnR8JSUpMXSkyMeOOTPlQDCIT/mEnXAkp4JbMRjdpt/sihwyJiqFejoACQDpDFsGMEAnVNHcKwspoIrqj1KI5vGnomL4qI1ovPq+qYDTh13wACY0unIqquP3pMX845aYrH+9D3kRCGpJXb4dPyxYq6VV4D70WiJPYpz1AN6MxKq0/ajGwWC8f+Qq+m4J1Nug++rjRfQ== From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Alexandre Iooss , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mahmoud Mandour , Marcel Apfelbaum , Yanan Wang , Pierrick Bouvier , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 07/17] plugins: implement inline operation relative to cpu_index Date: Tue, 6 Feb 2024 13:24:12 +0400 Message-ID: <20240206092423.3005995-8-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> References: <20240206092423.3005995-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::331; envelope-from=pierrick.bouvier@linaro.org; helo=mail-wm1-x331.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: 1707211569545100003 Content-Type: text/plain; charset="utf-8" Instead of working on a fixed memory location, allow to address it based on cpu_index, an element size and a given offset. Result address: ptr + offset + cpu_index * element_size. With this, we can target a member in a struct array from a base pointer. Current semantic is not modified, thus inline operation still targets always the same memory location. Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson --- plugins/plugin.h | 2 +- accel/tcg/plugin-gen.c | 65 +++++++++++++++++++++++++++++++++++------- plugins/api.c | 3 +- plugins/core.c | 12 +++++--- 4 files changed, 65 insertions(+), 17 deletions(-) diff --git a/plugins/plugin.h b/plugins/plugin.h index fd93a372803..77ed10689ca 100644 --- a/plugins/plugin.h +++ b/plugins/plugin.h @@ -100,7 +100,7 @@ void plugin_register_vcpu_mem_cb(GArray **arr, enum qemu_plugin_mem_rw rw, void *udata); =20 -void exec_inline_op(struct qemu_plugin_dyn_cb *cb); +void exec_inline_op(struct qemu_plugin_dyn_cb *cb, int cpu_index); =20 int plugin_num_vcpus(void); =20 diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index b37ce7683e6..68dee4c68d3 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -132,16 +132,28 @@ static void gen_empty_udata_cb_no_rwg(void) */ static void gen_empty_inline_cb(void) { + TCGv_i32 cpu_index =3D tcg_temp_ebb_new_i32(); + TCGv_ptr cpu_index_as_ptr =3D tcg_temp_ebb_new_ptr(); TCGv_i64 val =3D tcg_temp_ebb_new_i64(); TCGv_ptr ptr =3D tcg_temp_ebb_new_ptr(); =20 + tcg_gen_ld_i32(cpu_index, tcg_env, + -offsetof(ArchCPU, env) + offsetof(CPUState, cpu_index)= ); + /* pass an immediate !=3D 0 so that it doesn't get optimized away */ + tcg_gen_muli_i32(cpu_index, cpu_index, 0xdeadbeef); + tcg_gen_ext_i32_ptr(cpu_index_as_ptr, cpu_index); + tcg_gen_movi_ptr(ptr, 0); + tcg_gen_add_ptr(ptr, ptr, cpu_index_as_ptr); tcg_gen_ld_i64(val, ptr, 0); /* pass an immediate !=3D 0 so that it doesn't get optimized away */ tcg_gen_addi_i64(val, val, 0xdeadface); + tcg_gen_st_i64(val, ptr, 0); tcg_temp_free_ptr(ptr); tcg_temp_free_i64(val); + tcg_temp_free_ptr(cpu_index_as_ptr); + tcg_temp_free_i32(cpu_index); } =20 static void gen_empty_mem_cb(TCGv_i64 addr, uint32_t info) @@ -289,12 +301,37 @@ static TCGOp *copy_const_ptr(TCGOp **begin_op, TCGOp = *op, void *ptr) return op; } =20 +static TCGOp *copy_ld_i32(TCGOp **begin_op, TCGOp *op) +{ + return copy_op(begin_op, op, INDEX_op_ld_i32); +} + +static TCGOp *copy_ext_i32_ptr(TCGOp **begin_op, TCGOp *op) +{ + if (UINTPTR_MAX =3D=3D UINT32_MAX) { + op =3D copy_op(begin_op, op, INDEX_op_mov_i32); + } else { + op =3D copy_op(begin_op, op, INDEX_op_ext_i32_i64); + } + return op; +} + +static TCGOp *copy_add_ptr(TCGOp **begin_op, TCGOp *op) +{ + if (UINTPTR_MAX =3D=3D UINT32_MAX) { + op =3D copy_op(begin_op, op, INDEX_op_add_i32); + } else { + op =3D copy_op(begin_op, op, INDEX_op_add_i64); + } + return op; +} + static TCGOp *copy_ld_i64(TCGOp **begin_op, TCGOp *op) { if (TCG_TARGET_REG_BITS =3D=3D 32) { /* 2x ld_i32 */ - op =3D copy_op(begin_op, op, INDEX_op_ld_i32); - op =3D copy_op(begin_op, op, INDEX_op_ld_i32); + op =3D copy_ld_i32(begin_op, op); + op =3D copy_ld_i32(begin_op, op); } else { /* ld_i64 */ op =3D copy_op(begin_op, op, INDEX_op_ld_i64); @@ -330,6 +367,13 @@ static TCGOp *copy_add_i64(TCGOp **begin_op, TCGOp *op= , uint64_t v) return op; } =20 +static TCGOp *copy_mul_i32(TCGOp **begin_op, TCGOp *op, uint32_t v) +{ + op =3D copy_op(begin_op, op, INDEX_op_mul_i32); + op->args[2] =3D tcgv_i32_arg(tcg_constant_i32(v)); + return op; +} + static TCGOp *copy_st_ptr(TCGOp **begin_op, TCGOp *op) { if (UINTPTR_MAX =3D=3D UINT32_MAX) { @@ -395,18 +439,17 @@ static TCGOp *append_inline_cb(const struct qemu_plug= in_dyn_cb *cb, TCGOp *begin_op, TCGOp *op, int *unused) { - /* const_ptr */ - op =3D copy_const_ptr(&begin_op, op, cb->userp); - - /* ld_i64 */ + char *ptr =3D cb->userp; + size_t elem_size =3D 0; + size_t offset =3D 0; + op =3D copy_ld_i32(&begin_op, op); + op =3D copy_mul_i32(&begin_op, op, elem_size); + op =3D copy_ext_i32_ptr(&begin_op, op); + op =3D copy_const_ptr(&begin_op, op, ptr + offset); + op =3D copy_add_ptr(&begin_op, op); op =3D copy_ld_i64(&begin_op, op); - - /* add_i64 */ op =3D copy_add_i64(&begin_op, op, cb->inline_insn.imm); - - /* st_i64 */ op =3D copy_st_i64(&begin_op, op); - return op; } =20 diff --git a/plugins/api.c b/plugins/api.c index 15edad6769b..dedcbdfd30d 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -106,7 +106,8 @@ void qemu_plugin_register_vcpu_tb_exec_inline(struct qe= mu_plugin_tb *tb, void *ptr, uint64_t imm) { if (!tb->mem_only) { - plugin_register_inline_op(&tb->cbs[PLUGIN_CB_INLINE], 0, op, ptr, = imm); + plugin_register_inline_op(&tb->cbs[PLUGIN_CB_INLINE], + 0, op, ptr, imm); } } =20 diff --git a/plugins/core.c b/plugins/core.c index fd8604bcb79..863c2e64217 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -320,7 +320,8 @@ static struct qemu_plugin_dyn_cb *plugin_get_dyn_cb(GAr= ray **arr) =20 void plugin_register_inline_op(GArray **arr, enum qemu_plugin_mem_rw rw, - enum qemu_plugin_op op, void *ptr, + enum qemu_plugin_op op, + void *ptr, uint64_t imm) { struct qemu_plugin_dyn_cb *dyn_cb; @@ -476,9 +477,12 @@ void qemu_plugin_flush_cb(void) plugin_cb__simple(QEMU_PLUGIN_EV_FLUSH); } =20 -void exec_inline_op(struct qemu_plugin_dyn_cb *cb) +void exec_inline_op(struct qemu_plugin_dyn_cb *cb, int cpu_index) { - uint64_t *val =3D cb->userp; + char *ptr =3D cb->userp; + size_t elem_size =3D 0; + size_t offset =3D 0; + uint64_t *val =3D (uint64_t *)(ptr + offset + cpu_index * elem_size); =20 switch (cb->inline_insn.op) { case QEMU_PLUGIN_INLINE_ADD_U64: @@ -511,7 +515,7 @@ void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t va= ddr, vaddr, cb->userp); break; case PLUGIN_CB_INLINE: - exec_inline_op(cb); + exec_inline_op(cb, cpu->cpu_index); break; default: g_assert_not_reached(); --=20 2.43.0 From nobody Tue Nov 26 13:28:21 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=1707211584; cv=none; d=zohomail.com; s=zohoarc; b=RRIIcWeBGYVsOb6dO1ed02LXYlR9blePQUXaH8YNkRd/sbNPxgtb5tmqFfH87k/56srTDW1ALSSzPnI4Y9P9UNfSDkWChVyWKLBh0A4PZzmFtg2woknxpdFvSesoz0xnci7xWVnNPpkY0uxSONBZQR3QWOauEa32qtGLzuKt+yU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707211584; h=Content-Type: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=Jy1rbHGzFBtEHIrb0UzJIVl/3vebd/Q3PmRd1pnc7wk=; b=PRNLo4Vg0DoPlUFSbXyNomkOF50/djOp2DzQPO/65wrb9vyenSUPVgtSr/1iqsyKhirkpRPW1kY9eiFTniz3rlid6R4xl/chAm2zb9iAiv829DDVkixh69UTzLwHDRAs91jtV83bqw4PA/ZqFBnpOq1E/5fs4l/4iTlTwZ++v2g= 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 1707211584061171.1867099691592; Tue, 6 Feb 2024 01:26:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXHhy-00056r-AV; Tue, 06 Feb 2024 04:25:41 -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 1rXHhY-0004pT-Cl for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:13 -0500 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXHhQ-0004qa-NO for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:11 -0500 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-5112d5ab492so7430835e87.0 for ; Tue, 06 Feb 2024 01:25:03 -0800 (PST) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c211100b0040fc5460109sm1312756wml.35.2024.02.06.01.24.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:25:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707211502; x=1707816302; 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=Jy1rbHGzFBtEHIrb0UzJIVl/3vebd/Q3PmRd1pnc7wk=; b=Y5ybvpuQ8VfabNi0Wf1awIleMgXCK1eLBJDW5Eh12dHrIVQrAH1oXS8SpqwjiiKcBU ptJD1vjz7RzUK+AABWge2ccTzAQB32LUWNlIQMxeZN5gAkhvJxUgBLxK1wPDVLzBpRqI Etv1ypKXdPsvLcSh3/ethg59wkf/GwIduglhzPWEN9C2EtXBS3+rNpYyA5/FOr5kC73l lFzOmrRR7Mc8Tp1jz3XEUC0G69EJChgzLOYDXLfD07RRjDqt4e65zj+4VhmOjVr4WK4X g7Laz0rEK9ZAmL6H+CUfo9L+knserqsSHBP9GPGQqQsysf4u0HYYDUoPZGAZ37ywbzlD q3zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707211502; x=1707816302; 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=Jy1rbHGzFBtEHIrb0UzJIVl/3vebd/Q3PmRd1pnc7wk=; b=XFZP0wkPfThGIcRlmq7ve5o0OsBGdSYufS8AeRr8Ho5nnvr6Y63HBnc+8dFT0MNqcN r+b4OW1UeM7I5ZFoEFTVMIhOcOzu4yg8UXaB5Cww6pD0jl2h/Ysr94KNw+2tQrw0zVlK ZyZTun8lk6wm2Z/lmWbfVCElwZA6fZZC+H3HpyEe2AnqUqHdiKieZXFUQzXwEN3HaP0e UaZGGKzvo7hcsZck7RCAxoOiC0wM9FRCwI1W2ULbC+LZVR6t4K9D7gS1IFRawoiL9GDK NhRXoDG20aqRVwOIrnJFh/ZuyimCpl99V/ZQpNcTilUd3W6bdAyQonpIseKQ7sXuBmaR oiyw== X-Gm-Message-State: AOJu0YzD5wjnECw7uGMPBZDCcrjOhOpbNwuDS0K4dh45ltCpTK2UeOwi AI1mlwL0kLv4xzYD1ieLAGnku+Xs2frDtFLxpxTffE5DnhZf0p76YLpkNItdojxCuqvB//wYjA0 Wtz8= X-Google-Smtp-Source: AGHT+IFpUBYnXnP+z2bvT6GQL7mbjJ29+guU+SzxDlvyOKs/hpOaaF6GQ5EAKtCIZ/EDS46UmmCMrA== X-Received: by 2002:ac2:495a:0:b0:511:4ba4:dc2b with SMTP id o26-20020ac2495a000000b005114ba4dc2bmr1404101lfi.21.1707211502228; Tue, 06 Feb 2024 01:25:02 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWmFm9+NTdSrz9f1Z1xMd8TBX9XkaekBYSKiTACYZ2ocgZfvG2xPTieZazMr5zBauVUzuDQUZUwu/cC5xv5DKPpXsgCwQtQN/TJduftzk8hrL96B/XQqMgChvsXMz7uuaHzcEAWoB0aPNA8i1MBn00K8jcAv/PWHws7sKZ252/nLaD70ESMUc0T9d8dbufBHittckE1yyudJ/440ERXQrYTN0jI7jal2OZbP4p3HeCzmSs5OvuptmKPOQ+gkPkNsHnHWxD3XovloFA2yN7HarZ3yv3xNqnC48aIjzmKh8hdKmzgkn6fItbfJEI+Cj6rScO+EwnzCArKHWYo1Ew5cpJRHtpHcbMyQg== From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Alexandre Iooss , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mahmoud Mandour , Marcel Apfelbaum , Yanan Wang , Pierrick Bouvier , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 08/17] plugins: add inline operation per vcpu Date: Tue, 6 Feb 2024 13:24:13 +0400 Message-ID: <20240206092423.3005995-9-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> References: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::136; envelope-from=pierrick.bouvier@linaro.org; helo=mail-lf1-x136.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: 1707211585714100002 Extends API with three new functions: qemu_plugin_register_vcpu_{tb, insn, mem}_exec_inline_per_vcpu(). Those functions takes a qemu_plugin_u64_t as input. This allows to have a thread-safe and type-safe version of inline operations. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Pierrick Bouvier --- include/qemu/plugin.h | 1 + include/qemu/qemu-plugin.h | 51 +++++++++++++++++++++++++++++++++++- plugins/plugin.h | 6 +++++ accel/tcg/plugin-gen.c | 7 +++++ plugins/api.c | 37 +++++++++++++++++++++++++- plugins/core.c | 23 ++++++++++++++++ plugins/qemu-plugins.symbols | 3 +++ 7 files changed, 126 insertions(+), 2 deletions(-) diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index af4aeef4d78..0fd72544615 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -92,6 +92,7 @@ struct qemu_plugin_dyn_cb { /* fields specific to each dyn_cb type go here */ union { struct { + qemu_plugin_u64 entry; enum qemu_plugin_op op; uint64_t imm; } inline_insn; diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index a48586ef0c1..cdf1266d724 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -328,6 +328,22 @@ void qemu_plugin_register_vcpu_tb_exec_inline(struct q= emu_plugin_tb *tb, enum qemu_plugin_op op, void *ptr, uint64_t imm); =20 +/** + * qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu() - execution inline = op + * @tb: the opaque qemu_plugin_tb handle for the translation + * @op: the type of qemu_plugin_op (e.g. ADD_U64) + * @entry: entry to run op + * @imm: the op data (e.g. 1) + * + * Insert an inline op on a given scoreboard entry. + */ +QEMU_PLUGIN_API +void qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu( + struct qemu_plugin_tb *tb, + enum qemu_plugin_op op, + qemu_plugin_u64 entry, + uint64_t imm); + /** * qemu_plugin_register_vcpu_insn_exec_cb() - register insn execution cb * @insn: the opaque qemu_plugin_insn handle for an instruction @@ -358,6 +374,22 @@ void qemu_plugin_register_vcpu_insn_exec_inline(struct= qemu_plugin_insn *insn, enum qemu_plugin_op op, void *ptr, uint64_t imm); =20 +/** + * qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu() - insn exec inlin= e op + * @insn: the opaque qemu_plugin_insn handle for an instruction + * @op: the type of qemu_plugin_op (e.g. ADD_U64) + * @entry: entry to run op + * @imm: the op data (e.g. 1) + * + * Insert an inline op to every time an instruction executes. + */ +QEMU_PLUGIN_API +void qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu( + struct qemu_plugin_insn *insn, + enum qemu_plugin_op op, + qemu_plugin_u64 entry, + uint64_t imm); + /** * qemu_plugin_tb_n_insns() - query helper for number of insns in TB * @tb: opaque handle to TB passed to callback @@ -583,7 +615,24 @@ void qemu_plugin_register_vcpu_mem_inline(struct qemu_= plugin_insn *insn, enum qemu_plugin_op op, void *pt= r, uint64_t imm); =20 - +/** + * qemu_plugin_register_vcpu_mem_inline_per_vcpu() - inline op for mem acc= ess + * @insn: handle for instruction to instrument + * @rw: apply to reads, writes or both + * @op: the op, of type qemu_plugin_op + * @entry: entry to run op + * @imm: immediate data for @op + * + * This registers a inline op every memory access generated by the + * instruction. + */ +QEMU_PLUGIN_API +void qemu_plugin_register_vcpu_mem_inline_per_vcpu( + struct qemu_plugin_insn *insn, + enum qemu_plugin_mem_rw rw, + enum qemu_plugin_op op, + qemu_plugin_u64 entry, + uint64_t imm); =20 typedef void (*qemu_plugin_vcpu_syscall_cb_t)(qemu_plugin_id_t id, unsigned int vcpu_in= dex, diff --git a/plugins/plugin.h b/plugins/plugin.h index 77ed10689ca..1ece1b6707a 100644 --- a/plugins/plugin.h +++ b/plugins/plugin.h @@ -74,6 +74,12 @@ void plugin_register_inline_op(GArray **arr, enum qemu_plugin_op op, void *ptr, uint64_t imm); =20 +void plugin_register_inline_op_on_entry(GArray **arr, + enum qemu_plugin_mem_rw rw, + enum qemu_plugin_op op, + qemu_plugin_u64 entry, + uint64_t imm); + void plugin_reset_uninstall(qemu_plugin_id_t id, qemu_plugin_simple_cb_t cb, bool reset); diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 68dee4c68d3..4930e674c7d 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -442,6 +442,13 @@ static TCGOp *append_inline_cb(const struct qemu_plugi= n_dyn_cb *cb, char *ptr =3D cb->userp; size_t elem_size =3D 0; size_t offset =3D 0; + if (!ptr) { + /* use inline entry */ + ptr =3D cb->inline_insn.entry.score->data->data; + elem_size =3D g_array_get_element_size(cb->inline_insn.entry.score= ->data); + offset =3D cb->inline_insn.entry.offset; + } + op =3D copy_ld_i32(&begin_op, op); op =3D copy_mul_i32(&begin_op, op, elem_size); op =3D copy_ext_i32_ptr(&begin_op, op); diff --git a/plugins/api.c b/plugins/api.c index dedcbdfd30d..be2badda9fa 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -111,6 +111,18 @@ void qemu_plugin_register_vcpu_tb_exec_inline(struct q= emu_plugin_tb *tb, } } =20 +void qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu( + struct qemu_plugin_tb *tb, + enum qemu_plugin_op op, + qemu_plugin_u64 entry, + uint64_t imm) +{ + if (!tb->mem_only) { + plugin_register_inline_op_on_entry( + &tb->cbs[PLUGIN_CB_INLINE], 0, op, entry, imm); + } +} + void qemu_plugin_register_vcpu_insn_exec_cb(struct qemu_plugin_insn *insn, qemu_plugin_vcpu_udata_cb_t cb, enum qemu_plugin_cb_flags flag= s, @@ -136,6 +148,18 @@ void qemu_plugin_register_vcpu_insn_exec_inline(struct= qemu_plugin_insn *insn, } } =20 +void qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu( + struct qemu_plugin_insn *insn, + enum qemu_plugin_op op, + qemu_plugin_u64 entry, + uint64_t imm) +{ + if (!insn->mem_only) { + plugin_register_inline_op_on_entry( + &insn->cbs[PLUGIN_CB_INSN][PLUGIN_CB_INLINE], 0, op, entry, im= m); + } +} + =20 /* * We always plant memory instrumentation because they don't finalise until @@ -148,7 +172,7 @@ void qemu_plugin_register_vcpu_mem_cb(struct qemu_plugi= n_insn *insn, void *udata) { plugin_register_vcpu_mem_cb(&insn->cbs[PLUGIN_CB_MEM][PLUGIN_CB_REGULA= R], - cb, flags, rw, udata); + cb, flags, rw, udata); } =20 void qemu_plugin_register_vcpu_mem_inline(struct qemu_plugin_insn *insn, @@ -160,6 +184,17 @@ void qemu_plugin_register_vcpu_mem_inline(struct qemu_= plugin_insn *insn, rw, op, ptr, imm); } =20 +void qemu_plugin_register_vcpu_mem_inline_per_vcpu( + struct qemu_plugin_insn *insn, + enum qemu_plugin_mem_rw rw, + enum qemu_plugin_op op, + qemu_plugin_u64 entry, + uint64_t imm) +{ + plugin_register_inline_op_on_entry( + &insn->cbs[PLUGIN_CB_MEM][PLUGIN_CB_INLINE], rw, op, entry, imm); +} + void qemu_plugin_register_vcpu_tb_trans_cb(qemu_plugin_id_t id, qemu_plugin_vcpu_tb_trans_cb_t = cb) { diff --git a/plugins/core.c b/plugins/core.c index 863c2e64217..48e351d7631 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -334,6 +334,23 @@ void plugin_register_inline_op(GArray **arr, dyn_cb->inline_insn.imm =3D imm; } =20 +void plugin_register_inline_op_on_entry(GArray **arr, + enum qemu_plugin_mem_rw rw, + enum qemu_plugin_op op, + qemu_plugin_u64 entry, + uint64_t imm) +{ + struct qemu_plugin_dyn_cb *dyn_cb; + + dyn_cb =3D plugin_get_dyn_cb(arr); + dyn_cb->userp =3D NULL; + dyn_cb->type =3D PLUGIN_CB_INLINE; + dyn_cb->rw =3D rw; + dyn_cb->inline_insn.entry =3D entry; + dyn_cb->inline_insn.op =3D op; + dyn_cb->inline_insn.imm =3D imm; +} + void plugin_register_dyn_cb__udata(GArray **arr, qemu_plugin_vcpu_udata_cb_t cb, enum qemu_plugin_cb_flags flags, @@ -482,6 +499,12 @@ void exec_inline_op(struct qemu_plugin_dyn_cb *cb, int= cpu_index) char *ptr =3D cb->userp; size_t elem_size =3D 0; size_t offset =3D 0; + if (!ptr) { + /* use inline entry */ + ptr =3D cb->inline_insn.entry.score->data->data; + elem_size =3D g_array_get_element_size(cb->inline_insn.entry.score= ->data); + offset =3D cb->inline_insn.entry.offset; + } uint64_t *val =3D (uint64_t *)(ptr + offset + cpu_index * elem_size); =20 switch (cb->inline_insn.op) { diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols index 6204453d0fd..0d8141b85f1 100644 --- a/plugins/qemu-plugins.symbols +++ b/plugins/qemu-plugins.symbols @@ -28,13 +28,16 @@ qemu_plugin_register_vcpu_init_cb; qemu_plugin_register_vcpu_insn_exec_cb; qemu_plugin_register_vcpu_insn_exec_inline; + qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu; qemu_plugin_register_vcpu_mem_cb; qemu_plugin_register_vcpu_mem_inline; + qemu_plugin_register_vcpu_mem_inline_per_vcpu; qemu_plugin_register_vcpu_resume_cb; qemu_plugin_register_vcpu_syscall_cb; qemu_plugin_register_vcpu_syscall_ret_cb; qemu_plugin_register_vcpu_tb_exec_cb; qemu_plugin_register_vcpu_tb_exec_inline; + qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu; qemu_plugin_register_vcpu_tb_trans_cb; qemu_plugin_reset; qemu_plugin_scoreboard_free; --=20 2.43.0 From nobody Tue Nov 26 13:28:21 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=1707211629; cv=none; d=zohomail.com; s=zohoarc; b=oKO+ArDWyTPoCj5BpOzpvrvpG9oQMCNUsUaoDKaVCyCl2v/9KATFjxbPTiJhFyMygOg1kOHk48m9pk7spyvdBzi+DoviTuZdFdHVA9gU5Mm5TSSoN1CAgGJUpuN+eF7UMDhPf3TYU+Zl2mFhBxkibQdeF4T0BmlB7xW8QkK5Oww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707211629; h=Content-Type: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=4WWaJPsclEFPyc9s7y8yPMs7GjvBirSud+8vEqilY/w=; b=TA0YytO3O5u1XjEzYDtVzAsCVb6qMUaopx07dk4RaZD1cc8Obc83eRpYrGVxmHRKJG/zdKhAnTdnUY/PkVUuZ9HV1YqXnzDy/Ua4iUMUVeomCWzFEXMunWupQ+LeCP9gTwvg4e/vW7ZBdMISKDr1TnHTnzWmunhMJqiqCnZNMho= 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 1707211629187630.9835078967849; Tue, 6 Feb 2024 01:27:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXHhe-0004u4-W8; Tue, 06 Feb 2024 04:25:19 -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 1rXHhX-0004oa-7e for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:11 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXHhV-0004xl-5c for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:10 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-40fd72f7125so19582025e9.1 for ; Tue, 06 Feb 2024 01:25:07 -0800 (PST) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c211100b0040fc5460109sm1312756wml.35.2024.02.06.01.25.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:25:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707211506; x=1707816306; 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=4WWaJPsclEFPyc9s7y8yPMs7GjvBirSud+8vEqilY/w=; b=pd73tkoKmArkQnGAWs9cIn+9N89RpFG1iXDD0cUBxsZTOse3CnOpwib+L7fKFPrOzL YqTFVhKGOcTAqLN3qwDKEIkcmrO0bkumXM+ZfHigazfEew2Li5CouwjY16avhc3xhyq5 T4gtkq3DnAKDciF9uNQQTKGxLItrR3HeRapDUn1zE2k8nw0ZnjA9gcToad8iwJvBmaeM xWWLSE+5Zm6MyxNH+J0qVP3Otg+TB2dgGkHYt1FNxZaTaye0QeFrDnJithGfntKjZWoi E8GHv8YFEpqZ9kaKHaFC1evofg57aUkLvKSAYGBCsBVHhnknOEQJ9IhlsEgPucx0nRsx WGug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707211506; x=1707816306; 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=4WWaJPsclEFPyc9s7y8yPMs7GjvBirSud+8vEqilY/w=; b=cNeYcoNbwYZe/PmzCcYLMd585zPaPVCkdpkM4Ht9bn5pvpmr+hakaevUCwRFiyZfr0 iCTlrRjPYJj78By6xgK9B2pAoUGRZCJbHp/x4rPMgrm5CBStyh4k7NCoCbPnw/nKtr7M ws8nBZ17eAxX2k+6WavZVTHrRvv/MvQmGjB5lphMQ9FskkBz6D4Q9lrIizDwrzzKjh0N qNnNYsjVhODezc/kq92H6kdZFWyi7BM+/b2fTNQe1hNelTDwqPjwQEM0I/lBOKLZIYcr cgwvCkPeJl15j7iJrzODqLG9Cn8MI8qLduBiCb7dvdsmi7QD066/RhtzFiIcQc+Qs5vx WT6w== X-Gm-Message-State: AOJu0YxTR7IRTZKc5Z6KYwR0HoFQ4XWNiX7YiK7Gy04JfL25McyRj0VB R+fcucFel8DBi3OCbbeABXpJzfM664MONwkfTmqvWjC3FjLH+iZ9+ECOQEh9hYVxLN+WYohSL8O h5tU= X-Google-Smtp-Source: AGHT+IFu9pc8u5pS0L7QIQy3dE1jkD7ugNjshLpQB4RY6KBxqqPDLzow5zk6p33Bm5VNF/v4cJ4Jbw== X-Received: by 2002:a05:600c:1c21:b0:40d:3fee:97f6 with SMTP id j33-20020a05600c1c2100b0040d3fee97f6mr1681410wms.34.1707211505758; Tue, 06 Feb 2024 01:25:05 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXGPuqgaCqXDWYVwZHA9Yvi/rzYX4GLilyeC85kBJDh3DI4Jbj7K7ZlYtxg4Wz5Ubvrl2zAzi2YSkIiwrO/f5egWYO+lVICXY9ij3Juv5/CMm7YjBmvO12HKnL6bpfXt8COnW1I4JbhcaIORcp7LaBuG/PW4jMRv+ra0QC0P5Zbt40JR37qNZAN3BZm8TI1or3AUadUwonsadBbaC2l90tVc1nW7QSwTffKtYRNuafMcddQMP05bksZYuyqqJ+DdaBeKqwuuL2Xj7fiMhoaGHD12oPPBkAXbnq4Nv9X+u1PzsKw6roQRSYmdfpxI0jiXrt/qcQHdv1hg04/LQPD6Jj2+yKKEvuWPg== From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Alexandre Iooss , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mahmoud Mandour , Marcel Apfelbaum , Yanan Wang , Pierrick Bouvier , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 09/17] tests/plugin: add test plugin for inline operations Date: Tue, 6 Feb 2024 13:24:14 +0400 Message-ID: <20240206092423.3005995-10-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> References: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::329; envelope-from=pierrick.bouvier@linaro.org; helo=mail-wm1-x329.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: 1707211629823100002 For now, it simply performs instruction, bb and mem count, and ensure that inline vs callback versions have the same result. Later, we'll extend it when new inline operations are added. Use existing plugins to test everything works is a bit cumbersome, as different events are treated in different plugins. Thus, this new one. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Pierrick Bouvier --- tests/plugin/inline.c | 186 +++++++++++++++++++++++++++++++++++++++ tests/plugin/meson.build | 2 +- 2 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 tests/plugin/inline.c diff --git a/tests/plugin/inline.c b/tests/plugin/inline.c new file mode 100644 index 00000000000..0163e9b51c5 --- /dev/null +++ b/tests/plugin/inline.c @@ -0,0 +1,186 @@ +/* + * Copyright (C) 2023, Pierrick Bouvier + * + * Demonstrates and tests usage of inline ops. + * + * License: GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include +#include +#include + +#include + +typedef struct { + uint64_t count_tb; + uint64_t count_tb_inline; + uint64_t count_insn; + uint64_t count_insn_inline; + uint64_t count_mem; + uint64_t count_mem_inline; +} CPUCount; + +static struct qemu_plugin_scoreboard *counts; +static qemu_plugin_u64 count_tb; +static qemu_plugin_u64 count_tb_inline; +static qemu_plugin_u64 count_insn; +static qemu_plugin_u64 count_insn_inline; +static qemu_plugin_u64 count_mem; +static qemu_plugin_u64 count_mem_inline; + +static uint64_t global_count_tb; +static uint64_t global_count_insn; +static uint64_t global_count_mem; +static unsigned int max_cpu_index; +static GMutex tb_lock; +static GMutex insn_lock; +static GMutex mem_lock; + +QEMU_PLUGIN_EXPORT int qemu_plugin_version =3D QEMU_PLUGIN_VERSION; + +static void stats_insn(void) +{ + const uint64_t expected =3D global_count_insn; + const uint64_t per_vcpu =3D qemu_plugin_u64_sum(count_insn); + const uint64_t inl_per_vcpu =3D + qemu_plugin_u64_sum(count_insn_inline); + printf("insn: %" PRIu64 "\n", expected); + printf("insn: %" PRIu64 " (per vcpu)\n", per_vcpu); + printf("insn: %" PRIu64 " (per vcpu inline)\n", inl_per_vcpu); + g_assert(expected > 0); + g_assert(per_vcpu =3D=3D expected); + g_assert(inl_per_vcpu =3D=3D expected); +} + +static void stats_tb(void) +{ + const uint64_t expected =3D global_count_tb; + const uint64_t per_vcpu =3D qemu_plugin_u64_sum(count_tb); + const uint64_t inl_per_vcpu =3D + qemu_plugin_u64_sum(count_tb_inline); + printf("tb: %" PRIu64 "\n", expected); + printf("tb: %" PRIu64 " (per vcpu)\n", per_vcpu); + printf("tb: %" PRIu64 " (per vcpu inline)\n", inl_per_vcpu); + g_assert(expected > 0); + g_assert(per_vcpu =3D=3D expected); + g_assert(inl_per_vcpu =3D=3D expected); +} + +static void stats_mem(void) +{ + const uint64_t expected =3D global_count_mem; + const uint64_t per_vcpu =3D qemu_plugin_u64_sum(count_mem); + const uint64_t inl_per_vcpu =3D + qemu_plugin_u64_sum(count_mem_inline); + printf("mem: %" PRIu64 "\n", expected); + printf("mem: %" PRIu64 " (per vcpu)\n", per_vcpu); + printf("mem: %" PRIu64 " (per vcpu inline)\n", inl_per_vcpu); + g_assert(expected > 0); + g_assert(per_vcpu =3D=3D expected); + g_assert(inl_per_vcpu =3D=3D expected); +} + +static void plugin_exit(qemu_plugin_id_t id, void *udata) +{ + const unsigned int num_cpus =3D qemu_plugin_num_vcpus(); + g_assert(num_cpus =3D=3D max_cpu_index + 1); + + for (int i =3D 0; i < num_cpus ; ++i) { + const uint64_t tb =3D qemu_plugin_u64_get(count_tb, i); + const uint64_t tb_inline =3D qemu_plugin_u64_get(count_tb_inline, = i); + const uint64_t insn =3D qemu_plugin_u64_get(count_insn, i); + const uint64_t insn_inline =3D qemu_plugin_u64_get(count_insn_inli= ne, i); + const uint64_t mem =3D qemu_plugin_u64_get(count_mem, i); + const uint64_t mem_inline =3D qemu_plugin_u64_get(count_mem_inline= , i); + printf("cpu %d: tb (%" PRIu64 ", %" PRIu64 ") | " + "insn (%" PRIu64 ", %" PRIu64 ") | " + "mem (%" PRIu64 ", %" PRIu64 ")" + "\n", + i, tb, tb_inline, insn, insn_inline, mem, mem_inline); + g_assert(tb =3D=3D tb_inline); + g_assert(insn =3D=3D insn_inline); + g_assert(mem =3D=3D mem_inline); + } + + stats_tb(); + stats_insn(); + stats_mem(); + + qemu_plugin_scoreboard_free(counts); +} + +static void vcpu_tb_exec(unsigned int cpu_index, void *udata) +{ + qemu_plugin_u64_add(count_tb, cpu_index, 1); + g_mutex_lock(&tb_lock); + max_cpu_index =3D MAX(max_cpu_index, cpu_index); + global_count_tb++; + g_mutex_unlock(&tb_lock); +} + +static void vcpu_insn_exec(unsigned int cpu_index, void *udata) +{ + qemu_plugin_u64_add(count_insn, cpu_index, 1); + g_mutex_lock(&insn_lock); + global_count_insn++; + g_mutex_unlock(&insn_lock); +} + +static void vcpu_mem_access(unsigned int cpu_index, + qemu_plugin_meminfo_t info, + uint64_t vaddr, + void *userdata) +{ + qemu_plugin_u64_add(count_mem, cpu_index, 1); + g_mutex_lock(&mem_lock); + global_count_mem++; + g_mutex_unlock(&mem_lock); +} + +static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) +{ + qemu_plugin_register_vcpu_tb_exec_cb( + tb, vcpu_tb_exec, QEMU_PLUGIN_CB_NO_REGS, 0); + qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu( + tb, QEMU_PLUGIN_INLINE_ADD_U64, count_tb_inline, 1); + + for (int idx =3D 0; idx < qemu_plugin_tb_n_insns(tb); ++idx) { + struct qemu_plugin_insn *insn =3D qemu_plugin_tb_get_insn(tb, idx); + qemu_plugin_register_vcpu_insn_exec_cb( + insn, vcpu_insn_exec, QEMU_PLUGIN_CB_NO_REGS, 0); + qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu( + insn, QEMU_PLUGIN_INLINE_ADD_U64, count_insn_inline, 1); + qemu_plugin_register_vcpu_mem_cb(insn, &vcpu_mem_access, + QEMU_PLUGIN_CB_NO_REGS, + QEMU_PLUGIN_MEM_RW, 0); + qemu_plugin_register_vcpu_mem_inline_per_vcpu( + insn, QEMU_PLUGIN_MEM_RW, + QEMU_PLUGIN_INLINE_ADD_U64, + count_mem_inline, 1); + } +} + +QEMU_PLUGIN_EXPORT +int qemu_plugin_install(qemu_plugin_id_t id, const qemu_info_t *info, + int argc, char **argv) +{ + counts =3D qemu_plugin_scoreboard_new(sizeof(CPUCount)); + count_tb =3D qemu_plugin_scoreboard_u64_in_struct( + counts, CPUCount, count_tb); + count_insn =3D qemu_plugin_scoreboard_u64_in_struct( + counts, CPUCount, count_insn); + count_mem =3D qemu_plugin_scoreboard_u64_in_struct( + counts, CPUCount, count_mem); + count_tb_inline =3D qemu_plugin_scoreboard_u64_in_struct( + counts, CPUCount, count_tb_inline); + count_insn_inline =3D qemu_plugin_scoreboard_u64_in_struct( + counts, CPUCount, count_insn_inline); + count_mem_inline =3D qemu_plugin_scoreboard_u64_in_struct( + counts, CPUCount, count_mem_inline); + qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans); + qemu_plugin_register_atexit_cb(id, plugin_exit, NULL); + + return 0; +} diff --git a/tests/plugin/meson.build b/tests/plugin/meson.build index e18183aaeda..9eece5bab51 100644 --- a/tests/plugin/meson.build +++ b/tests/plugin/meson.build @@ -1,6 +1,6 @@ t =3D [] if get_option('plugins') - foreach i : ['bb', 'empty', 'insn', 'mem', 'syscall'] + foreach i : ['bb', 'empty', 'inline', 'insn', 'mem', 'syscall'] if host_os =3D=3D 'windows' t +=3D shared_module(i, files(i + '.c') + '../../contrib/plugins/win= 32_linker.c', include_directories: '../../include/qemu', --=20 2.43.0 From nobody Tue Nov 26 13:28:22 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=1707211641; cv=none; d=zohomail.com; s=zohoarc; b=AQ9rExq7qQ0TgZmiWmY2Yh39maGmcjOAXHo4SAFHCZDwdGfG3DTtW8OJTZAz/iZC1x0xYkrjqHUtosixvTWZcScJEjtnJ4Ij+Rrj2ysJpG+U7awlHFKbN1aDgDpnKEXKm7x2PnEsaY2MnWXr+A6BOT8PBKdkTzeaQaxnE5qipgk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707211641; 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=HgTl20rCSJYbUu3H7bqnk8bx/uKJfuAIG49cFMEfy7s=; b=NmY+/5hhNDkRqM4TQCQmke5L8/kA9B5SwTPof41HulgIOTI8kyHztHvek9uk52dxrGMxnjXg6sxd0WojVcB5UMBCgHBdgZKySMyEuGGJHRGQPukvsH0yzRF/SxSLCJ4dJVdIfYpJWyRn+qvHBvPO6EXGvK57DCRNjUpxV4Wgfus= 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 1707211641337471.45991423232545; Tue, 6 Feb 2024 01:27:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXHhg-0004xR-08; Tue, 06 Feb 2024 04:25:20 -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 1rXHha-0004rN-0I for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:14 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXHhY-0004xw-64 for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:13 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40fe6c66c3fso2001095e9.2 for ; Tue, 06 Feb 2024 01:25:10 -0800 (PST) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c211100b0040fc5460109sm1312756wml.35.2024.02.06.01.25.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:25:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707211509; x=1707816309; 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=HgTl20rCSJYbUu3H7bqnk8bx/uKJfuAIG49cFMEfy7s=; b=QNf3aFXACLNwrO8xs8mW3pgvkcVnXsxaJM4k+bnbzUQRWaHjYsiKJEpiu2el1J/L2i ZQmo7wnshoX7qQX1uy5Y/6avfQG1RynID6c8vEPXjcwtj11wZt0mMmRxIWp6uCkXZbRT 2LU2Y0OdIR+kguqiHGLwpwGBv/oCFiUs0/89LVa0DVjqaMzanKAO2o6+DbMiKpthYH+J GWp5WkPBSEZf0k9E0E1BeZKoO0JrDLq9QKvej+AWUftrYL3BvMz7hIQnfWDJ51kozPad HAB/bWY3G2XPyjbHrRj/jvu3ADnMmbEeHYDftwYtcVX5VO8NzPSNk4MdxrWXPbmGtAJq MXWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707211509; x=1707816309; 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=HgTl20rCSJYbUu3H7bqnk8bx/uKJfuAIG49cFMEfy7s=; b=LHtZJ+msmx3LycJiRDTRLx2erQ7pmXZ1ahUSbUMCaMhNEDFSCi7Z/tHih5d8Xkf/Fh 84rxfnEd1rrw4Wf6wPMcHAJjTBSsNXHOwBvl3GfHISOfn3brPH/XmQDuVqoGGLRF1Tk5 9UI5TzTPAFGc0gCWBQrnKptBJ7/2/fVnNnGYdRr2arDTVi/WPjXAmVxLXfZy4CBiJ2Nn Kb/yzfYnG8W7xPjPGjxW8slUgIVGKNbgxMfRM+VupA+ncFIbRPQZpoCmgwh+kUU8Hj8X JaswNxGfUA591LwVtAgZ3vQWfoI3WNHIJvGzxS9HJ8lOpJCEiQEakXAbHo0r4xCwbe17 TI5g== X-Gm-Message-State: AOJu0YxUQKyNVJBs4+ai6RdhCQ6wDjutDKq8cmvCPmuZjlqjfmRgSlH5 vOoEXY0uv8hFQXSkK9GYTJx6BQaJxwRTHO432d16+cSJukfCEH+dEM9daJnnIsmCPV320UUeAqD NcSM= X-Google-Smtp-Source: AGHT+IH2k1AJL9jMn/j4al6rq5fhyUpKh8w3Q5k6ATBWAwxqjhP7710gp20IUJLqo6JuhoTvqVT6lA== X-Received: by 2002:a05:600c:1551:b0:40e:f626:483d with SMTP id f17-20020a05600c155100b0040ef626483dmr1111760wmg.13.1707211509281; Tue, 06 Feb 2024 01:25:09 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXvxRllywUspVpYBmmU355BN8xDwFZHEB3DADkV4LFearbp5gSsJLNr21mt2pbLgp0STeO/2GkxehadlxIsUxSV1zsqbmnnrsaqnD8eFcPemSlbOnmUn/hVQbWdZ3n/0Vn35DKf2iUAdDnqLMIAm+D8o7eRAR4F5LtfWZRVAvwiioZzdBK7xOUm9Uo9qvDK2gb/e2HwtokIt+8QS1j4CIGAHcKxFVK8aKyEEMYzSVTj98tub+/KvwatcoVXOGdBZh/k+O+WgYFQP2rLI6cUVPYfi9jhrO4C2oLDPDmoq6yHVfUSo+TtNJpRUkgOogrGTUwfuyWI0lIytDbS6yXX0E9XRgIuBAfu0w== From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Alexandre Iooss , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mahmoud Mandour , Marcel Apfelbaum , Yanan Wang , Pierrick Bouvier , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 10/17] tests/plugin/mem: migrate to new per_vcpu API Date: Tue, 6 Feb 2024 13:24:15 +0400 Message-ID: <20240206092423.3005995-11-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> References: <20240206092423.3005995-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::32c; envelope-from=pierrick.bouvier@linaro.org; helo=mail-wm1-x32c.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: 1707211641925100002 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pierrick Bouvier --- tests/plugin/mem.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/tests/plugin/mem.c b/tests/plugin/mem.c index 44e91065ba7..d4729f5e015 100644 --- a/tests/plugin/mem.c +++ b/tests/plugin/mem.c @@ -16,9 +16,14 @@ =20 QEMU_PLUGIN_EXPORT int qemu_plugin_version =3D QEMU_PLUGIN_VERSION; =20 -static uint64_t inline_mem_count; -static uint64_t cb_mem_count; -static uint64_t io_count; +typedef struct { + uint64_t mem_count; + uint64_t io_count; +} CPUCount; + +static struct qemu_plugin_scoreboard *counts; +static qemu_plugin_u64 mem_count; +static qemu_plugin_u64 io_count; static bool do_inline, do_callback; static bool do_haddr; static enum qemu_plugin_mem_rw rw =3D QEMU_PLUGIN_MEM_RW; @@ -27,16 +32,16 @@ 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); - } - if (do_callback) { - g_string_append_printf(out, "callback mem accesses: %" PRIu64 "\n"= , cb_mem_count); + if (do_inline || do_callback) { + g_string_printf(out, "mem accesses: %" PRIu64 "\n", + qemu_plugin_u64_sum(mem_count)); } if (do_haddr) { - g_string_append_printf(out, "io accesses: %" PRIu64 "\n", io_count= ); + g_string_append_printf(out, "io accesses: %" PRIu64 "\n", + qemu_plugin_u64_sum(io_count)); } qemu_plugin_outs(out->str); + qemu_plugin_scoreboard_free(counts); } =20 static void vcpu_mem(unsigned int cpu_index, qemu_plugin_meminfo_t meminfo, @@ -46,12 +51,12 @@ static void vcpu_mem(unsigned int cpu_index, qemu_plugi= n_meminfo_t meminfo, struct qemu_plugin_hwaddr *hwaddr; hwaddr =3D qemu_plugin_get_hwaddr(meminfo, vaddr); if (qemu_plugin_hwaddr_is_io(hwaddr)) { - io_count++; + qemu_plugin_u64_add(io_count, cpu_index, 1); } else { - cb_mem_count++; + qemu_plugin_u64_add(mem_count, cpu_index, 1); } } else { - cb_mem_count++; + qemu_plugin_u64_add(mem_count, cpu_index, 1); } } =20 @@ -64,9 +69,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, + mem_count, 1); } if (do_callback) { qemu_plugin_register_vcpu_mem_cb(insn, vcpu_mem, @@ -117,6 +123,10 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin= _id_t id, } } =20 + counts =3D qemu_plugin_scoreboard_new(sizeof(CPUCount)); + mem_count =3D qemu_plugin_scoreboard_u64_in_struct( + counts, CPUCount, mem_count); + io_count =3D qemu_plugin_scoreboard_u64_in_struct(counts, CPUCount, io= _count); qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans); qemu_plugin_register_atexit_cb(id, plugin_exit, NULL); return 0; --=20 2.43.0 From nobody Tue Nov 26 13:28:22 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=1707211572; cv=none; d=zohomail.com; s=zohoarc; b=e48XKHo+DgODOQK61XaaM8/PdERdfFkKNUlFbD4+HmT+V2/K8C/Cx5rW20c0JmY5V+wvRK9jl/OnMyo/UCWtWX4jI2004EjgGLR7caVzGx+Y3PpE834tcY8mIzs01U+gZVqI0DjOYWh+fqb8n981uwZ8rKnSc6mGebefl2qBIl8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707211572; h=Content-Type: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=jIM1lNqnf5XAacffBXN4ljIlTpT3DH/ZoqvjHNJUJG4=; b=ejFlygH4Phc680679PUQ4ioAbQi3qirILpcu5zGKKT7yczwOt0klCcGuMSde6HOrq2VNPG9dFtL9oX0iDPlG9dRoQtoKXR30VLEe+ZwO9rUEg+j0Tv8wAsDhUwrGFDVbu0A86eYLVqWsjJmH2Z+Eyk4y91wKi6xgye4HgA1dEp8= 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 1707211572828827.8566721095799; Tue, 6 Feb 2024 01:26:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXHhy-00056o-Ad; Tue, 06 Feb 2024 04:25:41 -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 1rXHhc-0004u5-V6 for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:17 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXHhb-0004yU-4q for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:16 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40fc654a718so34402175e9.2 for ; Tue, 06 Feb 2024 01:25:14 -0800 (PST) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c211100b0040fc5460109sm1312756wml.35.2024.02.06.01.25.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:25:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707211513; x=1707816313; 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=jIM1lNqnf5XAacffBXN4ljIlTpT3DH/ZoqvjHNJUJG4=; b=oRmcvAW5mtt31dbVvQKkS1FyobZlWH5GNipyeZspcIVKc8YqS/r23dk0oNV8hchRwR rQ56GRSqaXulHNfOs+IHLnVdScGo4Ui0XJnGK2zJuragDnwBxA+zWiKgMjMAzCkDmpXW zy9InmMsV5vQQz6iC6uGRvnf1kdQDxSe44VhfiV0uS0wkkt2lAgSQFivaLOBUOGMNyYk t7PTFsu6r0e+KU5XWXTSBLrME5V8D3x86SeR1HEFNTCnKLOX14E/Y9VhbYlqRO/OdWzd fPjY8kSgoMHj0xlyqh221KkE0y1IFO6RzmDnUm5eEvf7Z0D1R5MZNR8X9r90gSlgAmz8 ER/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707211513; x=1707816313; 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=jIM1lNqnf5XAacffBXN4ljIlTpT3DH/ZoqvjHNJUJG4=; b=PKYqMumFoF2I7yniMHqFAysDRmp8/gUjjJCm2BHqguYBtZyhkX8gAUbY36BNa2i9gO Sh33EH574TIjYtfppkJAdUYKXhB9J+I3PlOIYX1g4Js/cXaFqgFN2tAswVbyQsyLbenP Sr37/Ozgg/rH0SagCx8QG5HX6YcoBHmAjOid3YJ+CNIO+M67wmADZckWWZRguKuxLdPX dinoYW1G8EfM2o33ImZen+fZDzh92D8NoxxQYjqGrbot/pwBOJ1zphqIIFcEoGHtd4VO 9QR+KWmfxfHBcX+iUAIIFqnUHL3j1MZotMBMwQW/vBn3hElx75FLdp/sU5FnQSMnzJUR MosA== X-Gm-Message-State: AOJu0YwPYTO070oNiqRUPe+RUa63fEA1TPfcdJBsPrCp4PQXjBaj+ZvJ jM7OOBmUsbeLPz9smif8LrVp2V6NjM9ZgEHLviqlAZP2oaLqjYwtykal2ds1b+0uphdIlHpU+zI 69dk= X-Google-Smtp-Source: AGHT+IGfzL2qFIoVR1TI1sqiNkIsK+rV33OBKd5h4Og7CD2zH6V7ZOpof41PzB/OcZ9Cxm1O7F95XA== X-Received: by 2002:a05:600c:470b:b0:40e:b93e:4a0f with SMTP id v11-20020a05600c470b00b0040eb93e4a0fmr1850701wmo.19.1707211512798; Tue, 06 Feb 2024 01:25:12 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUtVWrdbotELh7Qs0BaH/u1pQwm0ogtBS6Y8QLdlvhDw1DNAWIt/YfgUGrt1OdvDNa7IvhLTx8cBkddlSmygUsnCDn7uTRb180nQIfiUZ5rAsSJ3FJ0hFiyo1OjYAyg+XSZ2XlP/8XcU564cxwckQtan/7H2sOn89kHcjc1pq1uA3UkMf167P0WfuZuPRVsBrOfg4BacHP5ataRifUjdF4PXU7A26X9Tk9QVr4UrOhlUUqVAL2iBaVQw3XdWsKZZ5N3fSWQo5fi6MdT4bZmAARlqIU8bwLj2mGqmulqPpp1R+a7RbDos6w39DQcbhNzhJTHaSVObf/HFLbhpR70t5QIOVIbsKkRSA== From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Alexandre Iooss , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mahmoud Mandour , Marcel Apfelbaum , Yanan Wang , Pierrick Bouvier , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 11/17] tests/plugin/insn: migrate to new per_vcpu API Date: Tue, 6 Feb 2024 13:24:16 +0400 Message-ID: <20240206092423.3005995-12-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> References: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::32d; envelope-from=pierrick.bouvier@linaro.org; helo=mail-wm1-x32d.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: 1707211573623100014 Signed-off-by: Pierrick Bouvier --- tests/plugin/insn.c | 106 +++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 56 deletions(-) diff --git a/tests/plugin/insn.c b/tests/plugin/insn.c index 5fd3017c2b3..0d0a4cd1c34 100644 --- a/tests/plugin/insn.c +++ b/tests/plugin/insn.c @@ -16,25 +16,21 @@ =20 QEMU_PLUGIN_EXPORT int qemu_plugin_version =3D QEMU_PLUGIN_VERSION; =20 -#define MAX_CPUS 8 /* lets not go nuts */ - -typedef struct { - uint64_t insn_count; -} InstructionCount; - -static InstructionCount counts[MAX_CPUS]; -static uint64_t inline_insn_count; +static qemu_plugin_u64 insn_count; =20 static bool do_inline; static bool do_size; static GArray *sizes; =20 +typedef struct { + uint64_t hits; + uint64_t last_hit; + uint64_t total_delta; +} MatchCount; + typedef struct { char *match_string; - uint64_t hits[MAX_CPUS]; - uint64_t last_hit[MAX_CPUS]; - uint64_t total_delta[MAX_CPUS]; - GPtrArray *history[MAX_CPUS]; + struct qemu_plugin_scoreboard *counts; /* MatchCount */ } Match; =20 static GArray *matches; @@ -48,41 +44,40 @@ typedef struct { =20 static void vcpu_insn_exec_before(unsigned int cpu_index, void *udata) { - unsigned int i =3D cpu_index % MAX_CPUS; - InstructionCount *c =3D &counts[i]; - - c->insn_count++; + qemu_plugin_u64_add(insn_count, cpu_index, 1); } =20 static void vcpu_insn_matched_exec_before(unsigned int cpu_index, void *ud= ata) { - unsigned int i =3D cpu_index % MAX_CPUS; Instruction *insn =3D (Instruction *) udata; - Match *match =3D insn->match; + Match *insn_match =3D insn->match; + MatchCount *match =3D qemu_plugin_scoreboard_find(insn_match->counts, + cpu_index); + g_autoptr(GString) ts =3D g_string_new(""); =20 insn->hits++; g_string_append_printf(ts, "0x%" PRIx64 ", '%s', %"PRId64 " hits", insn->vaddr, insn->disas, insn->hits); =20 - uint64_t icount =3D counts[i].insn_count; - uint64_t delta =3D icount - match->last_hit[i]; + uint64_t icount =3D qemu_plugin_u64_get(insn_count, cpu_index); + uint64_t delta =3D icount - match->last_hit; =20 - match->hits[i]++; - match->total_delta[i] +=3D delta; + match->hits++; + match->total_delta +=3D delta; =20 g_string_append_printf(ts, - ", %"PRId64" match hits, " - "=CE=94+%"PRId64 " since last match," + " , cpu %u," + " %"PRId64" match hits," + " =CE=94+%"PRId64 " since last match," " %"PRId64 " avg insns/match\n", - match->hits[i], delta, - match->total_delta[i] / match->hits[i]); + cpu_index, + match->hits, delta, + match->total_delta / match->hits); =20 - match->last_hit[i] =3D icount; + match->last_hit =3D icount; =20 qemu_plugin_outs(ts->str); - - g_ptr_array_add(match->history[i], insn); } =20 static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) @@ -94,8 +89,8 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qem= u_plugin_tb *tb) struct qemu_plugin_insn *insn =3D qemu_plugin_tb_get_insn(tb, i); =20 if (do_inline) { - qemu_plugin_register_vcpu_insn_exec_inline( - insn, QEMU_PLUGIN_INLINE_ADD_U64, &inline_insn_count, 1); + qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu( + insn, QEMU_PLUGIN_INLINE_ADD_U64, insn_count, 1); } else { uint64_t vaddr =3D qemu_plugin_insn_vaddr(insn); qemu_plugin_register_vcpu_insn_exec_cb( @@ -117,10 +112,9 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct = qemu_plugin_tb *tb) * information about the instruction which we also need to * save if there is a hit. */ - if (matches) { + if (matches->len) { char *insn_disas =3D qemu_plugin_insn_disas(insn); - int j; - for (j =3D 0; j < matches->len; j++) { + for (int j =3D 0; j < matches->len; j++) { Match *m =3D &g_array_index(matches, Match, j); if (g_str_has_prefix(insn_disas, m->match_string)) { Instruction *rec =3D g_new0(Instruction, 1); @@ -150,36 +144,33 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) "len %d bytes: %ld insns\n", i, *cn= t); } } - } else if (do_inline) { - g_string_append_printf(out, "insns: %" PRIu64 "\n", inline_insn_co= unt); } else { - uint64_t total_insns =3D 0; - for (i =3D 0; i < MAX_CPUS; i++) { - InstructionCount *c =3D &counts[i]; - if (c->insn_count) { - g_string_append_printf(out, "cpu %d insns: %" PRIu64 "\n", - i, c->insn_count); - total_insns +=3D c->insn_count; - } + for (i =3D 0; i < qemu_plugin_num_vcpus(); i++) { + g_string_append_printf(out, "cpu %d insns: %" PRIu64 "\n", + i, qemu_plugin_u64_get(insn_count, i)); } g_string_append_printf(out, "total insns: %" PRIu64 "\n", - total_insns); + qemu_plugin_u64_sum(insn_count)); } qemu_plugin_outs(out->str); + + qemu_plugin_scoreboard_free(insn_count.score); + for (i =3D 0; i < matches->len; ++i) { + Match *m =3D &g_array_index(matches, Match, i); + g_free(m->match_string); + qemu_plugin_scoreboard_free(m->counts); + } + g_array_free(matches, TRUE); + g_array_free(sizes, TRUE); } =20 =20 /* Add a match to the array of matches */ static void parse_match(char *match) { - Match new_match =3D { .match_string =3D match }; - int i; - for (i =3D 0; i < MAX_CPUS; i++) { - new_match.history[i] =3D g_ptr_array_new(); - } - if (!matches) { - matches =3D g_array_new(false, true, sizeof(Match)); - } + Match new_match =3D { + .match_string =3D g_strdup(match), + .counts =3D qemu_plugin_scoreboard_new(sizeof(MatchCount)) }; g_array_append_val(matches, new_match); } =20 @@ -187,6 +178,10 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin= _id_t id, const qemu_info_t *info, int argc, char **argv) { + matches =3D g_array_new(false, true, sizeof(Match)); + /* null terminated so 0 is not a special case */ + sizes =3D g_array_new(true, true, sizeof(unsigned long)); + for (int i =3D 0; i < argc; i++) { char *opt =3D argv[i]; g_auto(GStrv) tokens =3D g_strsplit(opt, "=3D", 2); @@ -208,9 +203,8 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_= id_t id, } } =20 - if (do_size) { - sizes =3D g_array_new(true, true, sizeof(unsigned long)); - } + insn_count =3D qemu_plugin_scoreboard_u64( + qemu_plugin_scoreboard_new(sizeof(uint64_t))); =20 qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans); qemu_plugin_register_atexit_cb(id, plugin_exit, NULL); --=20 2.43.0 From nobody Tue Nov 26 13:28:22 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=1707211570; cv=none; d=zohomail.com; s=zohoarc; b=FzSR+KfoKcZwWeAOCN3MCFdSadwiURz7oHaYDtmSOdt2klamjueyaDmp+36Oz/OXJKW3XzXuWxjTffJo6YBhOzqjSdLQrFHYQt1x1ro++mZglkIyIFfGxq8JBmWBBtzwOEYfm1M+zalw7DYmhDKX2ud6I6EgCCVzpbPN+PazgwE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707211570; 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=vpn7ZrX++QOMXIPnhSOuAzbdhuGwGNkpxbx03u36x+U=; b=mmHJVSXWudkuGadIk6eY7CBEnAjE43GTmnrRz4xvfry6RxQXKrpWvBSE4oo6UXQya29uV1Spxy78QR1yJEdArLGDHITYYFOJFsLzjr/mEdPvU4uTPQ0I7jYhYsIm4vgZLUdZrDL4d7aXo+OlcB5P7BD5XBVyAPvxqfp2YwfaKyQ= 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 1707211570798218.8120153437534; Tue, 6 Feb 2024 01:26:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXHiP-0005tI-5x; Tue, 06 Feb 2024 04:26:05 -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 1rXHhr-0005GG-Vy for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:36 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXHhe-0004zW-LJ for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:20 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40fc6578423so35407185e9.0 for ; Tue, 06 Feb 2024 01:25:17 -0800 (PST) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c211100b0040fc5460109sm1312756wml.35.2024.02.06.01.25.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:25:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707211516; x=1707816316; 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=vpn7ZrX++QOMXIPnhSOuAzbdhuGwGNkpxbx03u36x+U=; b=s2nBvNaw14+vObWdOIheMf7F9dXwtU/xW/6xQci2kw64rKVG4aWY5mUKahLtc5dggJ UXOeAqlqZyyyleNyvom21f5MroYRClDescBCT3jr5rntmHuAvBxWfNbbY1oY4tPLBxe/ NPsobT+NamQgHTYR8h5ve3AdlLx6OBENZg9gpFb07xPT//qUU39lTdhgY2OnH4S9oq56 B1LYuQNgkrH0vidLapYUhYyOEUk6fnJop60c4H9FJMqzgypcEEQptGZ0AedwQ/q999JC mdQwwDGHDlGxynu2JF3YxJFcluCSzvuh0vItBaS+HmzFN0FXUOFNeie6lebI/e/z1obS Pj/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707211516; x=1707816316; 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=vpn7ZrX++QOMXIPnhSOuAzbdhuGwGNkpxbx03u36x+U=; b=V/sUoUkPfjMyr6zWke22TxleMYphF9k5325glOQcU39dCag7wlbM8Az7mBNJsTBSQp 5y1NMYWA5EVbY+2vUhPyUm+8+jBUIu6h++psOvQ7n/MlRexhOF2NaH/qDKi6SquxpUqB HJWVm134WZcX7jQR0Yuu2u6V+OAq9oL0MEWUpYQj++9EUmqvYynGSaNk+KaNZyjt7Hrh pXl4R2G1YZPhDta4bu/ULFnFdEZnHFRSP5ZPNINNWD90JEEdBxKxRxj4Q6CoA0XnWiYj DghSO0GXD7elBMhVw+i5nRhV1Q39OmYwB5RHU7uL6u/oeI+/kgOrmj+VxPdSGUVxkfn/ kQ5A== X-Gm-Message-State: AOJu0YwbBrOdf7m8ONhTJDdvCXu2ETILDfyi8YSSZWYUD4MnXMBkWVPT Jm7YjpQXW0thv7Acc1nvJ0VQFxyIldQbTGQIUJxbeaXqf5Ggiql5nILbi9omuPL4E1bX3PMzb0y z8Tc= X-Google-Smtp-Source: AGHT+IFSMJuVJV5wAejP+kHXQzrJT7bnIWj8fcaBoQ2F/RTJjiX9Tbjq9ufkpgD8iXNEGS6rXJF3Xw== X-Received: by 2002:a05:600c:3b11:b0:40e:fb8f:76b2 with SMTP id m17-20020a05600c3b1100b0040efb8f76b2mr1228668wms.12.1707211516270; Tue, 06 Feb 2024 01:25:16 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCW0jfc3MbXKY5AB/3k2PfJ3xXJUnv/eWGALsxO710J4S4tyGv+l55z8CtL0fZAS+bB6ni1Wptbxwp5piXKGRtLBBzu/hTPO5C5ucc3+2BRg8S3uctNqBVWeV1N2v8yMB/LnKFcBLtBYy5EG2OIT7WcF7HSVA7RLu9FiphPLHEz6Mv+82h7CRP7vHKznLMpvzVw1xyzZ0+Sh5zFyxd+ep7jOPhNthZhYiTTUyHwLKtDWHFubtnY8j1YE7Jf+tqHIERuTv7r0O9ED1FU+NZL3XAoOIQvaaRECbXiTL/ievlOtS7iWh7m9vOyJP+bNNtiFQbRCnx435BpRQLkFJJv2dE3kWly/t2F10g== From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Alexandre Iooss , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mahmoud Mandour , Marcel Apfelbaum , Yanan Wang , Pierrick Bouvier , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 12/17] tests/plugin/bb: migrate to new per_vcpu API Date: Tue, 6 Feb 2024 13:24:17 +0400 Message-ID: <20240206092423.3005995-13-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> References: <20240206092423.3005995-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::332; envelope-from=pierrick.bouvier@linaro.org; helo=mail-wm1-x332.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: 1707211571639100008 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pierrick Bouvier --- tests/plugin/bb.c | 63 +++++++++++++++++++---------------------------- 1 file changed, 26 insertions(+), 37 deletions(-) diff --git a/tests/plugin/bb.c b/tests/plugin/bb.c index df50d1fd3bc..36776dee1e1 100644 --- a/tests/plugin/bb.c +++ b/tests/plugin/bb.c @@ -17,27 +17,25 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_version =3D QEMU_PLUGIN_VERSION; =20 typedef struct { - GMutex lock; - int index; uint64_t bb_count; uint64_t insn_count; } CPUCount; =20 -/* Used by the inline & linux-user counts */ +static struct qemu_plugin_scoreboard *counts; +static qemu_plugin_u64 bb_count; +static qemu_plugin_u64 insn_count; + static bool do_inline; -static CPUCount inline_count; - /* Dump running CPU total on idle? */ static bool idle_report; -static GPtrArray *counts; -static int max_cpus; =20 -static void gen_one_cpu_report(CPUCount *count, GString *report) +static void gen_one_cpu_report(CPUCount *count, GString *report, + unsigned int cpu_index) { if (count->bb_count) { g_string_append_printf(report, "CPU%d: " "bb's: %" PRIu64", insns: %" PRIu64 "\n", - count->index, + cpu_index, count->bb_count, count->insn_count); } } @@ -46,20 +44,23 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) { g_autoptr(GString) report =3D g_string_new(""); =20 - if (do_inline || !max_cpus) { - g_string_printf(report, "bb's: %" PRIu64", insns: %" PRIu64 "\n", - inline_count.bb_count, inline_count.insn_count); - } else { - g_ptr_array_foreach(counts, (GFunc) gen_one_cpu_report, report); + for (int i =3D 0; i < qemu_plugin_num_vcpus(); ++i) { + CPUCount *count =3D qemu_plugin_scoreboard_find(counts, i); + gen_one_cpu_report(count, report, i); } + g_string_append_printf(report, "Total: " + "bb's: %" PRIu64", insns: %" PRIu64 "\n", + qemu_plugin_u64_sum(bb_count), + qemu_plugin_u64_sum(insn_count)); qemu_plugin_outs(report->str); + qemu_plugin_scoreboard_free(counts); } =20 static void vcpu_idle(qemu_plugin_id_t id, unsigned int cpu_index) { - CPUCount *count =3D g_ptr_array_index(counts, cpu_index); + CPUCount *count =3D qemu_plugin_scoreboard_find(counts, cpu_index); g_autoptr(GString) report =3D g_string_new(""); - gen_one_cpu_report(count, report); + gen_one_cpu_report(count, report, cpu_index); =20 if (report->len > 0) { g_string_prepend(report, "Idling "); @@ -69,14 +70,11 @@ static void vcpu_idle(qemu_plugin_id_t id, unsigned int= cpu_index) =20 static void vcpu_tb_exec(unsigned int cpu_index, void *udata) { - CPUCount *count =3D max_cpus ? - g_ptr_array_index(counts, cpu_index) : &inline_count; + CPUCount *count =3D qemu_plugin_scoreboard_find(counts, cpu_index); =20 uintptr_t n_insns =3D (uintptr_t)udata; - g_mutex_lock(&count->lock); count->insn_count +=3D n_insns; count->bb_count++; - g_mutex_unlock(&count->lock); } =20 static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) @@ -84,11 +82,10 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct q= emu_plugin_tb *tb) size_t n_insns =3D qemu_plugin_tb_n_insns(tb); =20 if (do_inline) { - qemu_plugin_register_vcpu_tb_exec_inline(tb, QEMU_PLUGIN_INLINE_AD= D_U64, - &inline_count.bb_count, 1= ); - qemu_plugin_register_vcpu_tb_exec_inline(tb, QEMU_PLUGIN_INLINE_AD= D_U64, - &inline_count.insn_count, - n_insns); + qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu( + tb, QEMU_PLUGIN_INLINE_ADD_U64, bb_count, 1); + qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu( + tb, QEMU_PLUGIN_INLINE_ADD_U64, insn_count, n_insns); } else { qemu_plugin_register_vcpu_tb_exec_cb(tb, vcpu_tb_exec, QEMU_PLUGIN_CB_NO_REGS, @@ -121,18 +118,10 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugi= n_id_t id, } } =20 - if (info->system_emulation && !do_inline) { - max_cpus =3D info->system.max_vcpus; - counts =3D g_ptr_array_new(); - for (i =3D 0; i < max_cpus; i++) { - CPUCount *count =3D g_new0(CPUCount, 1); - g_mutex_init(&count->lock); - count->index =3D i; - g_ptr_array_add(counts, count); - } - } else if (!do_inline) { - g_mutex_init(&inline_count.lock); - } + counts =3D qemu_plugin_scoreboard_new(sizeof(CPUCount)); + bb_count =3D qemu_plugin_scoreboard_u64_in_struct(counts, CPUCount, bb= _count); + insn_count =3D qemu_plugin_scoreboard_u64_in_struct( + counts, CPUCount, insn_count); =20 if (idle_report) { qemu_plugin_register_vcpu_idle_cb(id, vcpu_idle); --=20 2.43.0 From nobody Tue Nov 26 13:28:22 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=1707211632; cv=none; d=zohomail.com; s=zohoarc; b=CznH6lMfsBpPcSQwkG38eEHFMblCeIYAy/4Bv9twIJP9gO3NgPOiOvlREw4w25Ge4SivdDc3IZP3AA8nxeQpmGJCWOtdBjUHFUuQh5IHyoQ4sf5SqWsLh8ixM0jRJaqofAjeaBsVEoxM8W7rg0jgX+gTLFCI8J4+nYi3N85VpOo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707211632; 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=RwJ8e6wUH7fqyic9sqG77ZVCFxcpo7vgFJo8+jFAkz0=; b=JMQfyKBO8CPzxUsGmMVIsdqCQK+cmG0DaOHGCA9NrYNEdIDCNuvxZhWtshzsIKl0k1EW6TjKqj/MIiYzCN2LbycKF/SgX5YFqTevgxkP6La56G2nhv8pQQfGbPM3CjOTI1o9tCjnS7Pk/1iKrpL1Vs8qACkocX/2wK6R2BZrFlY= 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 1707211632850675.6157223020435; Tue, 6 Feb 2024 01:27:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXHiO-0005eo-8V; Tue, 06 Feb 2024 04:26:04 -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 1rXHhv-0005Hy-Uh for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:37 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXHhp-00051M-2M for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:32 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40fe2d3d5cbso3073735e9.2 for ; Tue, 06 Feb 2024 01:25:21 -0800 (PST) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c211100b0040fc5460109sm1312756wml.35.2024.02.06.01.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:25:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707211520; x=1707816320; 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=RwJ8e6wUH7fqyic9sqG77ZVCFxcpo7vgFJo8+jFAkz0=; b=YRGmORrTHiLOENx0aCM7WPMQr0BoL+VC7H4YW1RfTyufQK51XxtIjNFhlJgG5Can7/ KM2www3oAoPux+qlfwoTKpn0fLlBYaonfq1q3XKd26jtBMSI2C8bCp69AOC13nhIXLFp vXa0dAO2hh57IaVPJHTZN6VuX0dwU0/FUc7gHMxTQfkwBbfEOKGZIxRA7qtsMR7CCMZ8 Pj/66l7jV/N8+k/4/V+GS5mdSBwSEwfs0AaKK9NBdhB6xcx0jEzxRMK1Susv1bmB7Ba+ xZUzwpGUxUP0oNvIC6J4wmC9tVyfP29nrjn3rqv2dSXbyUmZMn9H/WC6zuXF/G6LZ+aj BgUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707211520; x=1707816320; 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=RwJ8e6wUH7fqyic9sqG77ZVCFxcpo7vgFJo8+jFAkz0=; b=ruJ63beozt51y4wRBF9HzAakTsgtArknk3dvqP9u8J0R0MT60bUBqlvzEW8jPteHtk dHBBttumogs41Lc2vSfig1wi/gn2EFzwEWE8N4Wjz0J9UILL1+z9W3An3+1zmOJL4hfz HoCZ52J1qlJAoRGVmmvbuFxamycURkPoja0zTl3HZkAFLskziNxv1BCDFoN7Cv6zNt+L NNxap+OLhdsaicFrQVFSQddOBo9/ygFPkd7TPVZuyN7fXafPg4uvkKkcw3nt9mEFov2l sY0zdUZIDH4uGzUqyznHUbG0+fjdRMqA8xmldvcbU/ByBkqw2TE6V+s35SjvbsFGc7hJ URwA== X-Gm-Message-State: AOJu0YxaNIfo3qgrn9Tlnz672gmpmIObJHdXhEtU3166D5OLvJMvbPoS MN5dqg+JXFG+LLhSEAmV46KoLE4X5YXDSNybO/XntKLg4jAu6Ac4yjnMLyDv/6/TaqhBjjRXIoR wM6c= X-Google-Smtp-Source: AGHT+IFcCTk2RM2qW3ihoEvPNsFYwZPdMl2MkvdVmbrQ6DNu5NgkrdJO+Lp8Co3uvK24JnRNMskbNw== X-Received: by 2002:a05:600c:5491:b0:40f:c5cc:e756 with SMTP id iv17-20020a05600c549100b0040fc5cce756mr1632415wmb.32.1707211519787; Tue, 06 Feb 2024 01:25:19 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUYNq+56G9LiYdkKWk5PJs0ecb2uMS0vMn7bCVZoG3bPbuqG77fe6Q2elGy2QGGCKxoz+uFizB3mG9zibVa/3J2otP3ay01XWLkIH19XNWZxpDda8Sacl+DkN1EDVcxvHm7No33rci0V5M3a9O0k+0bhxgIreA0YPwAHid4lXvCQNhs/Hd3YitNipOie49BfkmqR4eAi5vr3wzSSQ/ybBali/4zl/Fej+oZZpSGkF0XMumJN9YfnFPXI6H2uN7kT/gHWcf5ljRQ6bhjbLKTaeInUHo6SVqjwQN7YElThFugFzg1HmEl/47pt19euMxq4x/6mZYxp1zWD5gwi/LDGblQeKegfKLkYg== From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Alexandre Iooss , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mahmoud Mandour , Marcel Apfelbaum , Yanan Wang , Pierrick Bouvier , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 13/17] contrib/plugins/hotblocks: migrate to new per_vcpu API Date: Tue, 6 Feb 2024 13:24:18 +0400 Message-ID: <20240206092423.3005995-14-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> References: <20240206092423.3005995-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::330; envelope-from=pierrick.bouvier@linaro.org; helo=mail-wm1-x330.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: 1707211633896100004 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pierrick Bouvier --- contrib/plugins/hotblocks.c | 50 ++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c index 4de1b134944..02bc5078bdd 100644 --- a/contrib/plugins/hotblocks.c +++ b/contrib/plugins/hotblocks.c @@ -34,8 +34,8 @@ static guint64 limit =3D 20; */ typedef struct { uint64_t start_addr; - uint64_t exec_count; - int trans_count; + struct qemu_plugin_scoreboard *exec_count; + int trans_count; unsigned long insns; } ExecCount; =20 @@ -43,7 +43,17 @@ static gint cmp_exec_count(gconstpointer a, gconstpointe= r b) { ExecCount *ea =3D (ExecCount *) a; ExecCount *eb =3D (ExecCount *) b; - return ea->exec_count > eb->exec_count ? -1 : 1; + uint64_t count_a =3D + qemu_plugin_u64_sum(qemu_plugin_scoreboard_u64(ea->exec_count)); + uint64_t count_b =3D + qemu_plugin_u64_sum(qemu_plugin_scoreboard_u64(eb->exec_count)); + return count_a > count_b ? -1 : 1; +} + +static void exec_count_free(gpointer key, gpointer value, gpointer user_da= ta) +{ + ExecCount *cnt =3D value; + qemu_plugin_scoreboard_free(cnt->exec_count); } =20 static void plugin_exit(qemu_plugin_id_t id, void *p) @@ -52,7 +62,6 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) GList *counts, *it; int i; =20 - g_mutex_lock(&lock); g_string_append_printf(report, "%d entries in the hash table\n", g_hash_table_size(hotblocks)); counts =3D g_hash_table_get_values(hotblocks); @@ -63,16 +72,21 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) =20 for (i =3D 0; i < limit && it->next; i++, it =3D it->next) { ExecCount *rec =3D (ExecCount *) it->data; - g_string_append_printf(report, "0x%016"PRIx64", %d, %ld, %"PRI= d64"\n", - rec->start_addr, rec->trans_count, - rec->insns, rec->exec_count); + g_string_append_printf( + report, "0x%016"PRIx64", %d, %ld, %"PRId64"\n", + rec->start_addr, rec->trans_count, + rec->insns, + qemu_plugin_u64_sum( + qemu_plugin_scoreboard_u64(rec->exec_count))); } =20 g_list_free(it); } - g_mutex_unlock(&lock); =20 qemu_plugin_outs(report->str); + + g_hash_table_foreach(hotblocks, exec_count_free, NULL); + g_hash_table_destroy(hotblocks); } =20 static void plugin_init(void) @@ -82,15 +96,9 @@ static void plugin_init(void) =20 static void vcpu_tb_exec(unsigned int cpu_index, void *udata) { - ExecCount *cnt; - uint64_t hash =3D (uint64_t) udata; - - g_mutex_lock(&lock); - cnt =3D (ExecCount *) g_hash_table_lookup(hotblocks, (gconstpointer) h= ash); - /* should always succeed */ - g_assert(cnt); - cnt->exec_count++; - g_mutex_unlock(&lock); + ExecCount *cnt =3D (ExecCount *)udata; + qemu_plugin_u64_add(qemu_plugin_scoreboard_u64(cnt->exec_count), + cpu_index, 1); } =20 /* @@ -114,18 +122,20 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct= qemu_plugin_tb *tb) cnt->start_addr =3D pc; cnt->trans_count =3D 1; cnt->insns =3D insns; + cnt->exec_count =3D qemu_plugin_scoreboard_new(sizeof(uint64_t)); g_hash_table_insert(hotblocks, (gpointer) hash, (gpointer) cnt); } =20 g_mutex_unlock(&lock); =20 if (do_inline) { - qemu_plugin_register_vcpu_tb_exec_inline(tb, QEMU_PLUGIN_INLINE_AD= D_U64, - &cnt->exec_count, 1); + qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu( + tb, QEMU_PLUGIN_INLINE_ADD_U64, + qemu_plugin_scoreboard_u64(cnt->exec_count), 1); } else { qemu_plugin_register_vcpu_tb_exec_cb(tb, vcpu_tb_exec, QEMU_PLUGIN_CB_NO_REGS, - (void *)hash); + (void *)cnt); } } =20 --=20 2.43.0 From nobody Tue Nov 26 13:28:22 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=1707211594; cv=none; d=zohomail.com; s=zohoarc; b=UvMQqO9gh3dRu0BWK0yuA+YhDowRZNO7IHnLNsReza59I9V1YpaKUGQ0q3HIPtWnOcIhyh9Ef3h/LCa41irxRIY7mlsk6OzDH4dx6x1h4VyBz+q/iaW4xhZryswlZiuqT57OcxhkQQLQKzUyInWZuy1102ar6Z1SYGs5tmdgHNw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707211594; 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=KLrDeSzxAfz0BkmoOA2bd0HrCpMytbURUXRn/P+Vjdc=; b=eDwzlnNoh4bi0ovESbggbicJwtIRgiH+lbVVHD0X+xBuKflOGTTyWI31WTeELnc1MdX9y3U8PmGrpvAeAdIOV9TyPDki7WS3Ji7vwZ8L1jGKl2AxtXphlshYPbibKSTuTb3DuqlKcICUEQbpmdIV0dt1Xmml/WeElt7QzgvP2xA= 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 1707211594841587.6349087601824; Tue, 6 Feb 2024 01:26:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXHiS-0006Mk-7u; Tue, 06 Feb 2024 04:26:08 -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 1rXHi2-0005Nd-Lz for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:47 -0500 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXHhs-00051Z-Qq for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:35 -0500 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-5111c7d40deso8979319e87.1 for ; Tue, 06 Feb 2024 01:25:25 -0800 (PST) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c211100b0040fc5460109sm1312756wml.35.2024.02.06.01.25.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:25:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707211523; x=1707816323; 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=KLrDeSzxAfz0BkmoOA2bd0HrCpMytbURUXRn/P+Vjdc=; b=lv3hy1VzIgjmQv+7yfG2fq4vQ8dVsD1edtOr/QRCSueL3lNxQnDi/ZejjqQZbsI7Y2 izpHQlJh91Sjbif6A/uP7UgM29gWKNcZhpYCCWZgCr/n3kTQbwo9SGFNcI5suOz4I6oH rPI24Faci809lwqRJvpdb/LhKJrydRdip3oddb0LJsEmJKYH+/tgXxRfD44Y3ZvNOr3G 15Zc/abDlEo+ZyyuTTRG0wHWXhcZhEBLo0qaYC9+WVlO/iY8sPgHrZoK0y/Bzt7qD0iK hhc41bm6Rwff66jqmCuyf5me0171mTdsrFcSkE4m4jyY0jmygUW5xa1/e3H6vffT/EnB ZNwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707211523; x=1707816323; 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=KLrDeSzxAfz0BkmoOA2bd0HrCpMytbURUXRn/P+Vjdc=; b=uqUG0jJRn0qYvUyrSk6GodZLpT+gSPQOq/AtlsGWhVJ43H99nPjV1WR3Nq3c6Ah1Bl /QEqMcVD8FMmR/3tCMm5oN9th1k8b/4szp9ktW96M0dmJwaGNufJLDfV282DFXkMBOoR 4UnsTWDEPopZNI5szUV3e4yQWjm3nPQHA2gPxJyX5xQRqKFH299aN1bffSpQwWX5coso W+0+vtk+sn0uCHNh5OpT2jbqJcKD796sIuzRSAZ6veTR33u7tRIPsn1eIIimCRK8tmeD g6XyTTHED19yhoo6IHaBlJltzA3tC+IzURMBcda6RaYZdGgtOYELkW3W0wqBuA+z17yH Oz3Q== X-Gm-Message-State: AOJu0Yz1/+mJJTtan6uU/Bxh4M3fCJZ18GJdfs7fpGkHurOyndTjzmDG foY//xMqrByR5xDy0wKemBn50ONOmYxORbJ0BLDnL/HwuIl3rc94S57EvotZn0LOIfJW0L8WTy8 qETs= X-Google-Smtp-Source: AGHT+IEVcEL8Qzx+RvD0GEUNcspzWHuJpy5ti3rgqetJ9Bz1PdKz5xP1xFvFLENufRNu7kNV5DhFtA== X-Received: by 2002:a05:6512:158e:b0:511:490e:b8fd with SMTP id bp14-20020a056512158e00b00511490eb8fdmr1569886lfb.45.1707211523343; Tue, 06 Feb 2024 01:25:23 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXBsoezeJO4H0d58Vex3/j1KtjMbMpYl8UuxxUrzpYHOMTAXDUcZKHlijnpGScRE/leshDKdjtlQbwYb7ThUjgJu5QKoYnVfizfdNRhVGQN4gL65YLZ5NcF/pvfLV7FJ2af1J49DZWJMYVDHaGmn1I6Zjp0pTtFjtL++i5996f+orH3fDfN3SyeVbFMItn+Cg32LFGTNTjB1og7oEQQilGl6n59gxGXGhz4UpRIiiUv+vnyEkJhl3AmSq7jzqeDZWg8EwtEVX8wrobbO9SX9xkSB0w9wWcIObzcSvZmcmT7ukWMUrkvN6JYoB3aP280wRsqmNKItKRgAHh+7gvDbcKTYHhZ3hbA0Q== From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Alexandre Iooss , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mahmoud Mandour , Marcel Apfelbaum , Yanan Wang , Pierrick Bouvier , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 14/17] contrib/plugins/howvec: migrate to new per_vcpu API Date: Tue, 6 Feb 2024 13:24:19 +0400 Message-ID: <20240206092423.3005995-15-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> References: <20240206092423.3005995-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::133; envelope-from=pierrick.bouvier@linaro.org; helo=mail-lf1-x133.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: 1707211595747100002 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pierrick Bouvier --- contrib/plugins/howvec.c | 53 ++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/contrib/plugins/howvec.c b/contrib/plugins/howvec.c index 644a7856bb2..2d10c87e0fb 100644 --- a/contrib/plugins/howvec.c +++ b/contrib/plugins/howvec.c @@ -43,13 +43,13 @@ typedef struct { uint32_t mask; uint32_t pattern; CountType what; - uint64_t count; + qemu_plugin_u64 count; } InsnClassExecCount; =20 typedef struct { char *insn; uint32_t opcode; - uint64_t count; + qemu_plugin_u64 count; InsnClassExecCount *class; } InsnExecCount; =20 @@ -159,7 +159,9 @@ static gint cmp_exec_count(gconstpointer a, gconstpoint= er b) { InsnExecCount *ea =3D (InsnExecCount *) a; InsnExecCount *eb =3D (InsnExecCount *) b; - return ea->count > eb->count ? -1 : 1; + uint64_t count_a =3D qemu_plugin_u64_sum(ea->count); + uint64_t count_b =3D qemu_plugin_u64_sum(eb->count); + return count_a > count_b ? -1 : 1; } =20 static void free_record(gpointer data) @@ -167,12 +169,14 @@ static void free_record(gpointer data) InsnExecCount *rec =3D (InsnExecCount *) data; g_free(rec->insn); g_free(rec); + qemu_plugin_scoreboard_free(rec->count.score); } =20 static void plugin_exit(qemu_plugin_id_t id, void *p) { g_autoptr(GString) report =3D g_string_new("Instruction Classes:\n"); int i; + uint64_t total_count; GList *counts; InsnClassExecCount *class =3D NULL; =20 @@ -180,11 +184,12 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) class =3D &class_table[i]; switch (class->what) { case COUNT_CLASS: - if (class->count || verbose) { + total_count =3D qemu_plugin_u64_sum(class->count); + if (total_count || verbose) { g_string_append_printf(report, "Class: %-24s\t(%" PRId64 " hits)\n= ", class->class, - class->count); + total_count); } break; case COUNT_INDIVIDUAL: @@ -212,7 +217,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) "Instr: %-24s\t(%" PRId64 " hits)" "\t(op=3D0x%08x/%s)\n", rec->insn, - rec->count, + qemu_plugin_u64_sum(rec->count), rec->opcode, rec->class ? rec->class->class : "un-categorised"); @@ -221,6 +226,12 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) } =20 g_hash_table_destroy(insns); + for (i =3D 0; i < ARRAY_SIZE(class_tables); i++) { + for (int j =3D 0; j < class_tables[i].table_sz; ++j) { + qemu_plugin_scoreboard_free(class_tables[i].table[j].count.sco= re); + } + } + =20 qemu_plugin_outs(report->str); } @@ -232,11 +243,12 @@ static void plugin_init(void) =20 static void vcpu_insn_exec_before(unsigned int cpu_index, void *udata) { - uint64_t *count =3D (uint64_t *) udata; - (*count)++; + struct qemu_plugin_scoreboard *score =3D udata; + qemu_plugin_u64_add(qemu_plugin_scoreboard_u64(score), cpu_index, 1); } =20 -static uint64_t *find_counter(struct qemu_plugin_insn *insn) +static struct qemu_plugin_scoreboard *find_counter( + struct qemu_plugin_insn *insn) { int i; uint64_t *cnt =3D NULL; @@ -265,7 +277,7 @@ static uint64_t *find_counter(struct qemu_plugin_insn *= insn) case COUNT_NONE: return NULL; case COUNT_CLASS: - return &class->count; + return class->count.score; case COUNT_INDIVIDUAL: { InsnExecCount *icount; @@ -279,13 +291,16 @@ static uint64_t *find_counter(struct qemu_plugin_insn= *insn) icount->opcode =3D opcode; icount->insn =3D qemu_plugin_insn_disas(insn); icount->class =3D class; + struct qemu_plugin_scoreboard *score =3D + qemu_plugin_scoreboard_new(sizeof(uint64_t)); + icount->count =3D qemu_plugin_scoreboard_u64(score); =20 g_hash_table_insert(insns, GUINT_TO_POINTER(opcode), (gpointer) icount); } g_mutex_unlock(&lock); =20 - return &icount->count; + return icount->count.score; } default: g_assert_not_reached(); @@ -300,14 +315,14 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct= qemu_plugin_tb *tb) size_t i; =20 for (i =3D 0; i < n; i++) { - uint64_t *cnt; struct qemu_plugin_insn *insn =3D qemu_plugin_tb_get_insn(tb, i); - cnt =3D find_counter(insn); + struct qemu_plugin_scoreboard *cnt =3D find_counter(insn); =20 if (cnt) { if (do_inline) { - qemu_plugin_register_vcpu_insn_exec_inline( - insn, QEMU_PLUGIN_INLINE_ADD_U64, cnt, 1); + qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu( + insn, QEMU_PLUGIN_INLINE_ADD_U64, + qemu_plugin_scoreboard_u64(cnt), 1); } else { qemu_plugin_register_vcpu_insn_exec_cb( insn, vcpu_insn_exec_before, QEMU_PLUGIN_CB_NO_REGS, c= nt); @@ -322,6 +337,14 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin= _id_t id, { int i; =20 + for (i =3D 0; i < ARRAY_SIZE(class_tables); i++) { + for (int j =3D 0; j < class_tables[i].table_sz; ++j) { + struct qemu_plugin_scoreboard *score =3D + qemu_plugin_scoreboard_new(sizeof(uint64_t)); + class_tables[i].table[j].count =3D qemu_plugin_scoreboard_u64(= score); + } + } + /* Select a class table appropriate to the guest architecture */ for (i =3D 0; i < ARRAY_SIZE(class_tables); i++) { ClassSelector *entry =3D &class_tables[i]; --=20 2.43.0 From nobody Tue Nov 26 13:28:22 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=1707211571; cv=none; d=zohomail.com; s=zohoarc; b=fJJ3JUKYaDsn+4iJkZmAqesYuLr+xyIU64duzLwnbapQxF26y9+ZqgfrrH1it2Me0Hb2RarAfvfhxsV0JPMQyZwBbfNhYvJy9/EI7SPZZfN+UdGdV7zqzHctxn8LCpSkE8iZs2TcH08d3vIKS6rnxmCUnsMvtt9ZxE1g9ajyUYg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707211571; 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=8IEJoDesP8nm9OgL6hvSjnZOHqeRCmr5Jj59Tquond4=; b=L/U5MDWb6bl6mD92VuOu/YBw9ahJXhNOovjeHxJNLhGf30o7Ue2BjNcKlbA1EyJ8m5qJyjXA6wES0iu5BZlmJg/I85QqVXdWGELvO+pY76KJhRCsnLBtgeipjPNr+4e+BYsF6j8PgD/lbiQswBaRSazhUQgQOIWeDzlp5fwtjIw= 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 1707211571940840.5649507658364; Tue, 6 Feb 2024 01:26:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXHiQ-00064Y-5D; Tue, 06 Feb 2024 04:26:06 -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 1rXHi2-0005Ne-PH for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:47 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXHht-00051p-LG for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:38 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40fc52c2ae4so36834745e9.3 for ; Tue, 06 Feb 2024 01:25:28 -0800 (PST) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c211100b0040fc5460109sm1312756wml.35.2024.02.06.01.25.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:25:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707211527; x=1707816327; 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=8IEJoDesP8nm9OgL6hvSjnZOHqeRCmr5Jj59Tquond4=; b=GM5ZTWIjOFYg+jG+LqFx9l5tOvq54ICU9InPNrPB5m+Z8EcMkLOQVXFB8MAo/ZDPPB ZL9ReBgrPc90hCR9oNk+oNbokBgvbe5v9hNyP64WnHOXnlq7Ec9MuCzZPqwn7vCShHcw DlicbicqP2rZuR8bOQIDw4JogZDu/pI/aXolFMI7RXkJYeaLk8Mhu93YRqytE6P/w1Jy RThq1MvoB7gWzOl9AUKHgH/kkvLYFa37Fiw+Qqt6+XpEGW3y3oLzTKF556RPmDeJ64Hh A6jOKmRxIad5j3j4MlvxFME5jLV5On4QxSgTkMVuDgJa5PZ0C/EfEOWtqOJKydcbbDrH 3MzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707211527; x=1707816327; 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=8IEJoDesP8nm9OgL6hvSjnZOHqeRCmr5Jj59Tquond4=; b=Ifvshbk6b25o4SKDqKAfn01eu+Omh4fqkdIGHrNxMHyls0raWwrXUpRKpY78LBH29D YvJWOQEwO10SSeHVxk4DB2DIhsiQvP+FF6IovGi/1dGGWQLqf9f0BS0r1+AqDo2qHM/E aHmPt2iOZb0ldmYC1fAmBmui83eQFo2U47YHqpOPjaI9u0Xs91TxJsckjiwfI531DwA+ Wa43y6a7DUkyjcn/k5hdh7gsVMaey6D+kLzf3yO+FnEEqZ66giVPNLcZVqxTpnqXw0rZ fvF653fdhQrA0eImdIUZhT0if0A67booxxGwsG0FjTFvm95KF7toqfg4MS9Y0bVUxll3 zRUw== X-Gm-Message-State: AOJu0Yzi9XGud1VJrS+JLYNdCkr3JHlaNWNex6ZdURZLkdU0Gkf1s2aO lY4XZtx+jwQWUYzQlCHfjnIzJ/rjaMSjbhsuXowfqjYyL1AOguFwImFdg67MWyhYAwF/Zfgpg78 onHY= X-Google-Smtp-Source: AGHT+IHf0oGKESlQcE4F/OJ1Nq0zVBckXa50+gTBVT7RGM3zCkLNpVNrBZLw0Rl9WJzuAp4lS2vHIw== X-Received: by 2002:a05:600c:519b:b0:40f:eb8c:71b9 with SMTP id fa27-20020a05600c519b00b0040feb8c71b9mr308421wmb.12.1707211526865; Tue, 06 Feb 2024 01:25:26 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCX0zTsGefe1zVYGps7wgdLgMj0fTlG8C/qtC7cgTn40hm/xwGgr3GAMcD8KkrcQgxPomaF1NvLdE4d+OVi3swgm6bZJwqFp6CTCB1yO0Tc+0602AVvBoamFbI7z/J6eJ/cGgCXySLnDYNJoRFZMS4oWAALZ3WtC15lIl0XWIOUQLGur0FbHZEEpvZ0rhSTmlFXdJ8JYjX3e23sD+wtBlz7IdGIKXP2YtnbxKAzDQCKCh09MxL626I1SLbtjPBgeb1vQ/CpFvKjpfWNhCVp9H3VF6CwMc9fvDnVNijdQcX2mESf9y/TOMpRq6Ot3xSB4K0q17eYgC3o3UP0cKWXb2y4UE+qfcUSxkg== From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Alexandre Iooss , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mahmoud Mandour , Marcel Apfelbaum , Yanan Wang , Pierrick Bouvier , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 15/17] plugins: remove non per_vcpu inline operation from API Date: Tue, 6 Feb 2024 13:24:20 +0400 Message-ID: <20240206092423.3005995-16-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> References: <20240206092423.3005995-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::335; envelope-from=pierrick.bouvier@linaro.org; helo=mail-wm1-x335.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: 1707211573607100013 Content-Type: text/plain; charset="utf-8" Now we have a thread-safe equivalent of inline operation, and that all plugins were changed to use it, there is no point to keep the old API. In more, it will help when we implement more functionality (conditional callbacks), as we can assume that we operate on a scoreboard. Bump API version as it's a breaking change for existing plugins. Bump min API version too, as we removed some functions. Signed-off-by: Pierrick Bouvier --- include/qemu/qemu-plugin.h | 58 ++++-------------------------------- plugins/plugin.h | 2 +- plugins/api.c | 29 ------------------ plugins/qemu-plugins.symbols | 3 -- 4 files changed, 6 insertions(+), 86 deletions(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index cdf1266d724..9b11098ff82 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -53,11 +53,15 @@ typedef uint64_t qemu_plugin_id_t; * symbol qemu_plugin_version which can be checked. * * version 2: removed qemu_plugin_n_vcpus and qemu_plugin_n_max_vcpus + * version 3: + * Remove qemu_plugin_register_vcpu_{tb, insn, mem}_exec_inline. + * Those functions are replaced by *_per_vcpu variants, which guarantees + * thread-safety for operations. */ =20 extern QEMU_PLUGIN_EXPORT int qemu_plugin_version; =20 -#define QEMU_PLUGIN_VERSION 2 +#define QEMU_PLUGIN_VERSION 3 =20 /** * struct qemu_info_t - system information for plugins @@ -309,25 +313,6 @@ enum qemu_plugin_op { QEMU_PLUGIN_INLINE_ADD_U64, }; =20 -/** - * qemu_plugin_register_vcpu_tb_exec_inline() - execution inline op - * @tb: the opaque qemu_plugin_tb handle for the translation - * @op: the type of qemu_plugin_op (e.g. ADD_U64) - * @ptr: the target memory location for the op - * @imm: the op data (e.g. 1) - * - * Insert an inline op to every time a translated unit executes. - * Useful if you just want to increment a single counter somewhere in - * memory. - * - * Note: ops are not atomic so in multi-threaded/multi-smp situations - * you will get inexact results. - */ -QEMU_PLUGIN_API -void qemu_plugin_register_vcpu_tb_exec_inline(struct qemu_plugin_tb *tb, - enum qemu_plugin_op op, - void *ptr, uint64_t imm); - /** * qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu() - execution inline = op * @tb: the opaque qemu_plugin_tb handle for the translation @@ -359,21 +344,6 @@ void qemu_plugin_register_vcpu_insn_exec_cb(struct qem= u_plugin_insn *insn, enum qemu_plugin_cb_flags flag= s, void *userdata); =20 -/** - * qemu_plugin_register_vcpu_insn_exec_inline() - insn execution inline op - * @insn: the opaque qemu_plugin_insn handle for an instruction - * @op: the type of qemu_plugin_op (e.g. ADD_U64) - * @ptr: the target memory location for the op - * @imm: the op data (e.g. 1) - * - * Insert an inline op to every time an instruction executes. Useful - * if you just want to increment a single counter somewhere in memory. - */ -QEMU_PLUGIN_API -void qemu_plugin_register_vcpu_insn_exec_inline(struct qemu_plugin_insn *i= nsn, - enum qemu_plugin_op op, - void *ptr, uint64_t imm); - /** * qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu() - insn exec inlin= e op * @insn: the opaque qemu_plugin_insn handle for an instruction @@ -597,24 +567,6 @@ void qemu_plugin_register_vcpu_mem_cb(struct qemu_plug= in_insn *insn, enum qemu_plugin_mem_rw rw, void *userdata); =20 -/** - * qemu_plugin_register_vcpu_mem_inline() - register an inline op to any m= emory access - * @insn: handle for instruction to instrument - * @rw: apply to reads, writes or both - * @op: the op, of type qemu_plugin_op - * @ptr: pointer memory for the op - * @imm: immediate data for @op - * - * This registers a inline op every memory access generated by the - * instruction. This provides for a lightweight but not thread-safe - * way of counting the number of operations done. - */ -QEMU_PLUGIN_API -void qemu_plugin_register_vcpu_mem_inline(struct qemu_plugin_insn *insn, - enum qemu_plugin_mem_rw rw, - enum qemu_plugin_op op, void *pt= r, - uint64_t imm); - /** * qemu_plugin_register_vcpu_mem_inline_per_vcpu() - inline op for mem acc= ess * @insn: handle for instruction to instrument diff --git a/plugins/plugin.h b/plugins/plugin.h index 1ece1b6707a..8e485cfbd58 100644 --- a/plugins/plugin.h +++ b/plugins/plugin.h @@ -15,7 +15,7 @@ #include #include "qemu/qht.h" =20 -#define QEMU_PLUGIN_MIN_VERSION 2 +#define QEMU_PLUGIN_MIN_VERSION 3 =20 /* global state */ struct qemu_plugin_state { diff --git a/plugins/api.c b/plugins/api.c index be2badda9fa..45eabab8686 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -101,16 +101,6 @@ void qemu_plugin_register_vcpu_tb_exec_cb(struct qemu_= plugin_tb *tb, } } =20 -void qemu_plugin_register_vcpu_tb_exec_inline(struct qemu_plugin_tb *tb, - enum qemu_plugin_op op, - void *ptr, uint64_t imm) -{ - if (!tb->mem_only) { - plugin_register_inline_op(&tb->cbs[PLUGIN_CB_INLINE], - 0, op, ptr, imm); - } -} - void qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu( struct qemu_plugin_tb *tb, enum qemu_plugin_op op, @@ -138,16 +128,6 @@ void qemu_plugin_register_vcpu_insn_exec_cb(struct qem= u_plugin_insn *insn, } } =20 -void qemu_plugin_register_vcpu_insn_exec_inline(struct qemu_plugin_insn *i= nsn, - enum qemu_plugin_op op, - void *ptr, uint64_t imm) -{ - if (!insn->mem_only) { - plugin_register_inline_op(&insn->cbs[PLUGIN_CB_INSN][PLUGIN_CB_INL= INE], - 0, op, ptr, imm); - } -} - void qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu( struct qemu_plugin_insn *insn, enum qemu_plugin_op op, @@ -175,15 +155,6 @@ void qemu_plugin_register_vcpu_mem_cb(struct qemu_plug= in_insn *insn, cb, flags, rw, udata); } =20 -void qemu_plugin_register_vcpu_mem_inline(struct qemu_plugin_insn *insn, - enum qemu_plugin_mem_rw rw, - enum qemu_plugin_op op, void *pt= r, - uint64_t imm) -{ - plugin_register_inline_op(&insn->cbs[PLUGIN_CB_MEM][PLUGIN_CB_INLINE], - rw, op, ptr, imm); -} - void qemu_plugin_register_vcpu_mem_inline_per_vcpu( struct qemu_plugin_insn *insn, enum qemu_plugin_mem_rw rw, diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols index 0d8141b85f1..a9fac056c7f 100644 --- a/plugins/qemu-plugins.symbols +++ b/plugins/qemu-plugins.symbols @@ -27,16 +27,13 @@ qemu_plugin_register_vcpu_idle_cb; qemu_plugin_register_vcpu_init_cb; qemu_plugin_register_vcpu_insn_exec_cb; - qemu_plugin_register_vcpu_insn_exec_inline; qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu; qemu_plugin_register_vcpu_mem_cb; - qemu_plugin_register_vcpu_mem_inline; qemu_plugin_register_vcpu_mem_inline_per_vcpu; qemu_plugin_register_vcpu_resume_cb; qemu_plugin_register_vcpu_syscall_cb; qemu_plugin_register_vcpu_syscall_ret_cb; qemu_plugin_register_vcpu_tb_exec_cb; - qemu_plugin_register_vcpu_tb_exec_inline; qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu; qemu_plugin_register_vcpu_tb_trans_cb; qemu_plugin_reset; --=20 2.43.0 From nobody Tue Nov 26 13:28:22 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=1707211598; cv=none; d=zohomail.com; s=zohoarc; b=ZugBLT7/vIV/LXYXFyuyLoM80XmBQGhUeuklv7f0Bp0H4rqfK+zEZEmWHsfZJcm5qtZ6kEqPuy8BYzFjGXWzHRMMIjkm0NekBK4aub7ubDM5xxsZptiPJlZu98wP2/VP1++jqagXOfj/Xf5ZBOCucrfE9MjO1u3KqSMubC/cr8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707211598; 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=yU4raDcKf+FPYuHZq7bZi5tZwN3XViuFGVvnL6vOuMc=; b=f76WbeWLZrcz7u+ICzl5v8Ytg6j56DcueTPzx0XHUDSboUafeYVU8X6MFft79z3FWuT9LHKQSUZFaEhyPYCFi5KhrGei0LIc2vrsjTPMUPTfYPFiiPDNwFCMN5bdT/KG2a4el9Zc0UczhK5ZQMN2jHGwu6k99ffSjKE7+wOb+Ak= 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 1707211598645642.5938786652742; Tue, 6 Feb 2024 01:26:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXHiO-0005bx-0m; Tue, 06 Feb 2024 04:26:04 -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 1rXHi2-0005NY-CL for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:47 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXHht-000521-DD for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:35 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-40fdc63f4feso14544105e9.3 for ; Tue, 06 Feb 2024 01:25:31 -0800 (PST) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c211100b0040fc5460109sm1312756wml.35.2024.02.06.01.25.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:25:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707211530; x=1707816330; 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=yU4raDcKf+FPYuHZq7bZi5tZwN3XViuFGVvnL6vOuMc=; b=rL21EtXtRvTG12D7JP2/bkNX7BdHvVty/jm5A7WRN9i7Ktxz3NnRKwDlP/Z+MRq0+b SklOC/y1d5R51Q4fD6OQSb4x6Vga7bgTF0c5UWiJNCaYsE/pjMDNzc5Y7KaBXcg4Fqvx z4jHHfqfKdExKbUM4ehAsiDHy6RiN3nDRxn8OWhOjFclQ0PMWdhtsFSZ06TL/dTU+liJ dqO1wgBu3Bqa+K/hg1DpNXOSi9llWCrwy7cd+cAb1agcnN63ElXRik6/cxoCFpqTAO4Y Q8QaWBOFGg/dVuZoIWKcp0cKxPb3Zp52tmLX1VPN3sn+jmLcPEgf5rpP93fOboeuPnjH jsnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707211530; x=1707816330; 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=yU4raDcKf+FPYuHZq7bZi5tZwN3XViuFGVvnL6vOuMc=; b=X4yArsT0NnA8NzNz/qq92BILC5rcSc7BV5f7SYpToD82ofgAFpmJpfdDrlJ0hgs1BK l3uB4aFRrz+YRXtKID6BQ94/zz2YBvNWP9MPi6Ct2AoiNTk49MUdTgdr3XUZ71/gsT0y 4sQAW2PFyZz/FhBzPnNnBZu2s1MxiZkUKjdH/QVWdAWCXrtnUTzFkGs2IKlbOMNzmdYp Q89+r75YB6K9MNrv9tzpgZe+PPTWR5wLCpcN0/bAKVMgDJYn2bqIkdxkNMOB7576jdW+ YUZ/VnBzzhRYNifw9Rz9Y7PkoW9hTxxeaDCbDdSyYF8rp7oHVYptWtHSj29VpNpE0ryc F9Sw== X-Gm-Message-State: AOJu0YyshJwnHqBgxFeqyxdMd17rAgw6dMRCBSlOWCQ9suxb6+65GqED NWaakwJKQPt0/DQthuDPIRqg6TdcedZu1CKI1B7Q74p8vDLgPChA02WFizw3IYRdhDJFrU2Zv3f 3RtY= X-Google-Smtp-Source: AGHT+IFlMp9UENKAEE/MOJJ72baQPZYIWrWX3nTpaR2WntLlPj7FQdIqLourKp/25Ccw8ntU8BCR9Q== X-Received: by 2002:a05:600c:4f8f:b0:40e:c722:2b9a with SMTP id n15-20020a05600c4f8f00b0040ec7222b9amr1638513wmq.32.1707211530349; Tue, 06 Feb 2024 01:25:30 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXf37gLZdIh419UqJnatI3dsluiwTIa8GlNYnfbK3uWuKiFCZZXtHeZQsWUmm0pbzdUDhH3ignaunToqvluglvCE+iKBPOWOZ2GQDnhYizyrUw3joN0tnkYq98SpDp9EqththJbnuQ3P0q1QFiywaOkJPXDhFx5A7NnXumFiplcTSvLNCsX2ARTPJOh3GPkmzfpZ0KHhHyY0WoA0FWMcy+HfxZAA32pF4z4jhvTIWTj4bzR58w775IQmkFDmaz8SgUsUvft1H4SdxR0KbapG5rgh3EbKTJFXv1fz+I5nCXuqb/xyjcGv58kkXJpYyBs1TO0l31mO3aa4ANKIXA7/m0P2ka+BMTR5w== From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Alexandre Iooss , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mahmoud Mandour , Marcel Apfelbaum , Yanan Wang , Pierrick Bouvier , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 16/17] plugins: cleanup codepath for previous inline operation Date: Tue, 6 Feb 2024 13:24:21 +0400 Message-ID: <20240206092423.3005995-17-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> References: <20240206092423.3005995-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::329; envelope-from=pierrick.bouvier@linaro.org; helo=mail-wm1-x329.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: 1707211599746100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pierrick Bouvier --- plugins/plugin.h | 5 ----- accel/tcg/plugin-gen.c | 13 ++++--------- plugins/core.c | 29 ++++------------------------- 3 files changed, 8 insertions(+), 39 deletions(-) diff --git a/plugins/plugin.h b/plugins/plugin.h index 8e485cfbd58..ba52a5995db 100644 --- a/plugins/plugin.h +++ b/plugins/plugin.h @@ -69,11 +69,6 @@ struct qemu_plugin_ctx { =20 struct qemu_plugin_ctx *plugin_id_to_ctx_locked(qemu_plugin_id_t id); =20 -void plugin_register_inline_op(GArray **arr, - enum qemu_plugin_mem_rw rw, - enum qemu_plugin_op op, void *ptr, - uint64_t imm); - void plugin_register_inline_op_on_entry(GArray **arr, enum qemu_plugin_mem_rw rw, enum qemu_plugin_op op, diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 4930e674c7d..0d613956734 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -439,15 +439,10 @@ static TCGOp *append_inline_cb(const struct qemu_plug= in_dyn_cb *cb, TCGOp *begin_op, TCGOp *op, int *unused) { - char *ptr =3D cb->userp; - size_t elem_size =3D 0; - size_t offset =3D 0; - if (!ptr) { - /* use inline entry */ - ptr =3D cb->inline_insn.entry.score->data->data; - elem_size =3D g_array_get_element_size(cb->inline_insn.entry.score= ->data); - offset =3D cb->inline_insn.entry.offset; - } + char *ptr =3D cb->inline_insn.entry.score->data->data; + size_t elem_size =3D g_array_get_element_size( + cb->inline_insn.entry.score->data); + size_t offset =3D cb->inline_insn.entry.offset; =20 op =3D copy_ld_i32(&begin_op, op); op =3D copy_mul_i32(&begin_op, op, elem_size); diff --git a/plugins/core.c b/plugins/core.c index 48e351d7631..7f1b8dbfd00 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -318,22 +318,6 @@ static struct qemu_plugin_dyn_cb *plugin_get_dyn_cb(GA= rray **arr) return &g_array_index(cbs, struct qemu_plugin_dyn_cb, cbs->len - 1); } =20 -void plugin_register_inline_op(GArray **arr, - enum qemu_plugin_mem_rw rw, - enum qemu_plugin_op op, - void *ptr, - uint64_t imm) -{ - struct qemu_plugin_dyn_cb *dyn_cb; - - dyn_cb =3D plugin_get_dyn_cb(arr); - dyn_cb->userp =3D ptr; - dyn_cb->type =3D PLUGIN_CB_INLINE; - dyn_cb->rw =3D rw; - dyn_cb->inline_insn.op =3D op; - dyn_cb->inline_insn.imm =3D imm; -} - void plugin_register_inline_op_on_entry(GArray **arr, enum qemu_plugin_mem_rw rw, enum qemu_plugin_op op, @@ -496,15 +480,10 @@ void qemu_plugin_flush_cb(void) =20 void exec_inline_op(struct qemu_plugin_dyn_cb *cb, int cpu_index) { - char *ptr =3D cb->userp; - size_t elem_size =3D 0; - size_t offset =3D 0; - if (!ptr) { - /* use inline entry */ - ptr =3D cb->inline_insn.entry.score->data->data; - elem_size =3D g_array_get_element_size(cb->inline_insn.entry.score= ->data); - offset =3D cb->inline_insn.entry.offset; - } + char *ptr =3D cb->inline_insn.entry.score->data->data; + size_t elem_size =3D g_array_get_element_size( + cb->inline_insn.entry.score->data); + size_t offset =3D cb->inline_insn.entry.offset; uint64_t *val =3D (uint64_t *)(ptr + offset + cpu_index * elem_size); =20 switch (cb->inline_insn.op) { --=20 2.43.0 From nobody Tue Nov 26 13:28:22 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=1707211611; cv=none; d=zohomail.com; s=zohoarc; b=THrj6AjCuSP8F+0c9FNDkXxATHtsx3aXtjhVeDcY9VcQW8kl8VELPiBu/3Bc7tOmFWF2v1R59qbSuiz973PoLk/+8eV3svtoX/fselTlT9LZMmL5Lih3P/9Qtl+wtG0vIUh0atFQbDiflOskOBDv9fdbuOuBWNmZ3t+yn5Ij78Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707211611; h=Content-Type: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=9D4k6QS4DbxEf/czoo6ZOLuGzDbZtd2vzfrrW34BdNw=; b=FFIwQv1iEYzP7kjMvJoJECfGQB9tG9md5IzktXraxhN4wAKiTTlTZxgxysXrFaJedEs9WzVnqe9lSw1acjWPFS0BvGkFgaevA4huulqQSG+XsgeBRb5PXmFAebOew+1twBB58AU6mAZ16QsrHPw3EwrU0oL192EN1PXd7mupfuI= 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 1707211611875144.56392163297994; Tue, 6 Feb 2024 01:26:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXHiQ-00064H-3W; Tue, 06 Feb 2024 04:26:06 -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 1rXHi3-0005Pr-RQ for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:49 -0500 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXHhw-00052F-CP for qemu-devel@nongnu.org; Tue, 06 Feb 2024 04:25:43 -0500 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-5115fcef9e9so348185e87.3 for ; Tue, 06 Feb 2024 01:25:35 -0800 (PST) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c211100b0040fc5460109sm1312756wml.35.2024.02.06.01.25.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:25:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707211533; x=1707816333; 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=9D4k6QS4DbxEf/czoo6ZOLuGzDbZtd2vzfrrW34BdNw=; b=rh1ljblFzFmNRzDd2sGA18k6wKO4fnqgUK9g5LlJZajgBlIORz8OiL1NTsrRUbTRbQ 5DJB8TC1sHu5qwCip4rCUnOsywZhBkQ2635F1pcvi9JfV+vf5J72RLRozYLw+8VtF4M4 T3TB2j78BTctBFnCWC257D8o7uReryTO8BWvd5HGwUbAqKf2w+uEPm36jrq0miACvaS+ 6qgm9LlSt1/pziC3r7HtbMv1Y9Bb7Vi3Tit8oUZ62QMZhx/7upZf4YVpIYALJIsm11uc 32H5uVoVzMa0azzSY34l0u1bgVJvTaNC35cLBLOHRWACVDUGGZaHHf1fkHIyZhpqq7OO kWJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707211534; x=1707816334; 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=9D4k6QS4DbxEf/czoo6ZOLuGzDbZtd2vzfrrW34BdNw=; b=Lkdx5UQyy50PRTygXqQD4izZ7ao974jEAahz76CwGdzJI6O3BNb96T0KsbS3LEOEie uzBpS26gD6wyO2WuiLfuEDLLNQmDnSS9aTlYu++PVtq7jcj8QPjqCLl/H8nxZypY0Ce2 3/SRJKiadZ7ikUTdrq3P//BPtBKriLxgueGCANW6J39qXARBQHHyvH4MMXIB/lqKwjL2 Sae87tBtLBpAEQQqS53+310NnzHGa6MNPAFN22PjJ3anQ2NAzCT2dXWNQq0BQlvU9ona +7/GJW0Z4lsnjWcGkx6mFF5k2+lnvCwrPq/mBTSHLXt6irDNMyBmPcMQ1hXbItyOgNAX 8oXA== X-Gm-Message-State: AOJu0Yx1VdBTvk9INIriueG/oNZz8kv1tX6MR0/fhohtAMJtrzm0psSM BYjqB/fuwYpCB1ALt/mIh/sVPGn634OkYy7Ek8PvqMf7B8onZu71gRaJWJ0V0rAWkLf746b9HlY lX20= X-Google-Smtp-Source: AGHT+IHl3Xub1o/veHBAV0LHzKzN4/nI5Rqmmo+hYRuI0TrdsKzruurz8QyJXai32V2e1F6qwSDtrA== X-Received: by 2002:a05:6512:402a:b0:511:60ca:d4eb with SMTP id br42-20020a056512402a00b0051160cad4ebmr322152lfb.28.1707211533808; Tue, 06 Feb 2024 01:25:33 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCU28NjH2CMq7BMcXqdGqUi44UODq9JP5K0hMCtXLzPod2XqtPx6X6l7dlvVPtYI4L8bazVn29mUgzxnthCYJMUJlC9QyQSwKDvOWZ0TpUSMwYgAgfjISZfMpPMMm1Fuao4yzYN1GsHZ0wWg0r8ui3Gw+3jwXHpIrLsAeRGt4Snr+D7E0Z9gK33bg4oAi+mh/KHkPUyaTI55r81hi8c0AKjCszugXnKcdF0YKEIGNLvW4aIUQ2w3EHPUFK78ra0FMALz9A57zPNWDM3R6otnII9P+MDvK0RsqbxYrGQbGZC7OMLluBKHJrHnOFVTQpMitOpiHYk4ZzC/hQZNfyQegPJfXFQb6AOiYw== From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Alexandre Iooss , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mahmoud Mandour , Marcel Apfelbaum , Yanan Wang , Pierrick Bouvier , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 17/17] MAINTAINERS: Add myself as reviewer for TCG Plugins Date: Tue, 6 Feb 2024 13:24:22 +0400 Message-ID: <20240206092423.3005995-18-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> References: <20240206092423.3005995-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::132; envelope-from=pierrick.bouvier@linaro.org; helo=mail-lf1-x132.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: 1707211613755100002 Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Pierrick Bouvier --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index dfaca8323e9..80528d3dc63 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3676,6 +3676,7 @@ TCG Plugins M: Alex Benn=C3=A9e R: Alexandre Iooss R: Mahmoud Mandour +R: Pierrick Bouvier S: Maintained F: docs/devel/tcg-plugins.rst F: plugins/ --=20 2.43.0