From patchwork Wed Mar 6 14:40:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 778298 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:47:b0:33e:474f:8c56 with SMTP id k7csp324902wrx; Wed, 6 Mar 2024 06:41:51 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUodMqP3pf0gEEECRpubPv2HCldPR72/M18mfUif26jzO1yhKAtBbH46GwyzIAzNN+DxE+OrDYXn6jgKErJDeGM X-Google-Smtp-Source: AGHT+IF5/STRFWOHbEYbuZFeyS0/S4iUf1tt3HOgMkRDKkgJkFukpbeirwguVQPVop2cFhod18pC X-Received: by 2002:a05:6102:5492:b0:472:60b3:d4a4 with SMTP id bk18-20020a056102549200b0047260b3d4a4mr6113017vsb.27.1709736110912; Wed, 06 Mar 2024 06:41:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709736110; cv=none; d=google.com; s=arc-20160816; b=HuCUoJjrawSDQ39KgcndtoWBrQcHT5dAzQAMEPuzsmJVWkok7VpiISnXoshX90CyXd F1tt4QBp4XH9BJdA0g9PyaO4icasSRs+3+RIX/qkr4otR4MU+RQqjNNVzAsPZg2Lr7fj aQ66n63fsfuSq+ga8BaMh6Hlg+dOkBZCa0dBK7T1dIiTN4mVfWpnn4N4uJB2rfxsOZ/B xZ2AGF9IjcILrQBP/tVg63asIKxpj2qgY0AA+G1sEbkRbR3xNgpfW05Pm6ydxsl1e8uA wq/iAnQJ5eSyNqB7VtN6z3/YgjsbKnvu7vPpe11Ph4Ut+zmSkYQzwZ+3O7NzMOmkuO8q YMAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YEf14uJYxbgFMCoXRLS0Jki4pRXZFLa5uR3yiXxdk30=; fh=yu0InTeBwSZcLajIY49SmB6DXvx9wTO9ThO8p5pbR7k=; b=TJGXn+JsgB0u2wprncUx2wd6SVvP78IiKQArhSAxH9WAr/ykJUozNlma+s70Av4BKj oyB4/CIYDOXZBCYQ+9+QCqgPmsVCBoa/zVW0ibxLjyhWe1unCQYSmbfATH3NVw7EIDSk Xzobvh97caZCqbOyJRPe+YDolmyoWg6qPKUvNeDL9JUhOhrjLGlIO3tvvlWF6tQzLJCu YvaN4okq8bkgygM9/ExMG0F/9+ePPvDHcn+YZDqG3cysqFA3RMBTNNi/cmXlH5nIDzQa iNjRS0O7eDyNHihOFdftYvZhWh7Ebqt7AZTljuxAQNPLhH5QoGePihYnpnKaNgkuOspu TIcg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B+k1MVf5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j8-20020a67f3c8000000b00466dfa76cacsi1904796vsn.91.2024.03.06.06.41.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Mar 2024 06:41:50 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B+k1MVf5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhsSJ-0008Qq-9q; Wed, 06 Mar 2024 09:41:15 -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 1rhsSC-0007tV-Ah for qemu-devel@nongnu.org; Wed, 06 Mar 2024 09:41:08 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rhsS6-0001Vq-AK for qemu-devel@nongnu.org; Wed, 06 Mar 2024 09:41:07 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-33d146737e6so5398563f8f.0 for ; Wed, 06 Mar 2024 06:41:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709736059; x=1710340859; 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=YEf14uJYxbgFMCoXRLS0Jki4pRXZFLa5uR3yiXxdk30=; b=B+k1MVf5wxQZR74Q36tRW2SIx8TPREdsxuP63ESt79CzCWLMK12cp1ov8hIY2lar0g tK8U5qTR2enQmF7++tyWyD6UDc2quUzdWnkmC6sshReqj5QhjRy9QD2FRFmeYdeHusvs Kiz2Kk32JdnBQPQNCZzp79q4fq7nunwdYKpmwOQPVr9yph/YdFKzZ+YnDRzPDydNM4du ydEPEOLWeZl3P1haUjtpeZdYkemDvsUL6+ah+FsZwtxN1KbS7+rqKfSDNvb1E4Ol2+rF s8rAgDl+OXAxfyU18K/P2JvgxDLmDXQ2ag+3CoSoFKuSY5oxjfcElTQGOvCsb1zssC90 Ildw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709736059; x=1710340859; 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=YEf14uJYxbgFMCoXRLS0Jki4pRXZFLa5uR3yiXxdk30=; b=I/ueC7BNib0UZg2vmgY9ZY98N3ki12S6cWgWLwBbPHhR2HPFlMRxU+6+ITt6I9OdTC l762mRZ2AQHqzVgSLB2/6wx190MIL02OY/chVbXxBCVxUyzwv3qpylGnD/y+NgKvkPDW pqMlE+tX8ZpyxOLSmjaedwFfHKkFFYiVEhN++ifwkLhR9LOk8Bno1IXTbTBw46v2orqW Bso95l2roEMjPAB4K4HXie63QzFI81nBJBBEQvS+CN4ZauPG2t5HfYmmV3gN5gwi5g4A iFshudlvbU6Riiy59WbcBYHkUoJB21bp+1THN6LBFxSY6B7dcK7BAAqc6rIPihkhi4H9 lWLg== X-Gm-Message-State: AOJu0Yy4ghxGG5As7DF+sHGGk+G4FOqt3tCVdOULR/uh8/2mtzSXHcmZ IDb5AhuIHXCiGdUFiYg+F3LQrotYvLZuBii9LBq7aeur8B3+PFnNxq2jMqcNIKo= X-Received: by 2002:adf:e44d:0:b0:33e:1629:651d with SMTP id t13-20020adfe44d000000b0033e1629651dmr10244734wrm.15.1709736058915; Wed, 06 Mar 2024 06:40:58 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id g1-20020adfd1e1000000b0033e3a24f17esm9242234wrd.76.2024.03.06.06.40.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 06:40:56 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id BBE4A5F9EB; Wed, 6 Mar 2024 14:40:43 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Richard Henderson , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Alexandre Iooss , Mahmoud Mandour Subject: [PULL 24/29] plugins: remove non per_vcpu inline operation from API Date: Wed, 6 Mar 2024 14:40:36 +0000 Message-Id: <20240306144041.3787188-25-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240306144041.3787188-1-alex.bennee@linaro.org> References: <20240306144041.3787188-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Pierrick Bouvier 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. API version bump was already done as part of this series. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Pierrick Bouvier Message-Id: <20240304130036.124418-12-pierrick.bouvier@linaro.org> Signed-off-by: Alex Bennée Message-Id: <20240305121005.3528075-25-alex.bennee@linaro.org> diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 6bbad068c01..4fc6c3739b2 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -52,7 +52,11 @@ 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 + * version 2: + * - removed qemu_plugin_n_vcpus and qemu_plugin_n_max_vcpus + * - Remove qemu_plugin_register_vcpu_{tb, insn, mem}_exec_inline. + * Those functions are replaced by *_per_vcpu variants, which guarantee + * thread-safety for operations. */ extern QEMU_PLUGIN_EXPORT int qemu_plugin_version; @@ -309,25 +313,6 @@ enum qemu_plugin_op { QEMU_PLUGIN_INLINE_ADD_U64, }; -/** - * 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 qemu_plugin_insn *insn, enum qemu_plugin_cb_flags flags, void *userdata); -/** - * 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 *insn, - enum qemu_plugin_op op, - void *ptr, uint64_t imm); - /** * qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu() - insn exec inline op * @insn: the opaque qemu_plugin_insn handle for an instruction @@ -597,24 +567,6 @@ void qemu_plugin_register_vcpu_mem_cb(struct qemu_plugin_insn *insn, enum qemu_plugin_mem_rw rw, void *userdata); -/** - * qemu_plugin_register_vcpu_mem_inline() - register an inline op to any memory 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 *ptr, - uint64_t imm); - /** * qemu_plugin_register_vcpu_mem_inline_per_vcpu() - inline op for mem access * @insn: handle for instruction to instrument diff --git a/plugins/api.c b/plugins/api.c index 6470f1dc0f2..8fa5a600ac3 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, } } -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 qemu_plugin_insn *insn, } } -void qemu_plugin_register_vcpu_insn_exec_inline(struct qemu_plugin_insn *insn, - 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_INLINE], - 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_plugin_insn *insn, cb, flags, rw, udata); } -void qemu_plugin_register_vcpu_mem_inline(struct qemu_plugin_insn *insn, - enum qemu_plugin_mem_rw rw, - enum qemu_plugin_op op, void *ptr, - 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;