From patchwork Mon Feb 26 09:14:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 775843 Delivered-To: patch@linaro.org Received: by 2002:a5d:6103:0:b0:33d:da16:65b6 with SMTP id v3csp233899wrt; Mon, 26 Feb 2024 01:16:29 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU3yjckaM4DxYW7fal/g23Mkvjhf7tF73W4m8k6kPb0f9LRTS1333aWb0s21YN+TWj75cqKpUXKCKYbJjYMr1Lu X-Google-Smtp-Source: AGHT+IGJh8SkbGRGmnuKLc6yPwIzd91U6pp7WLCSjaOILhmiZ5GqQ8oBkRPlI7XMe5hPm3gwRTl/ X-Received: by 2002:a05:6214:20a7:b0:68f:e35e:da68 with SMTP id 7-20020a05621420a700b0068fe35eda68mr9212141qvd.1.1708938989131; Mon, 26 Feb 2024 01:16:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708938989; cv=none; d=google.com; s=arc-20160816; b=Y6BYEeR/DXKEbIrj9517Y2D3q8iamWCVtSa1ToHy/keUPi5IZoSWvD/RmecF0eOtY5 c49S+OaQtOxCKKGA59QdSWrMzO/h49DxA64Ys+8uiBQyXWy1RFJZ1yzPCPlLFrI11bV0 YG61j1X5HltPvY1cYGk13xDP04aj8agNx9nP8DJpMhgRfm0V0V55Q79XwBENr6HJNawt 1CitvDmcoNzUaeqB7CwQNVp1JxNw8GV8VLvTNBLnaQ8WTMNqR2YJkFNxn2G8kY883owT QHCyvZZPBxkA8AT8J2lEFg6JeicsPg96isxYOXXkUU5pyTXiORtzEtaLWFkGrWAe9PiE dk9A== 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=X2JL0lvPjHTbqYBDEnpbpZDHGDP1jZ/xznh+r/K8/d0=; fh=l9WWdDUrM2GgKqlI4LjrMx7cGq7hKMPQ4FaYC0/RjNA=; b=edkaQH49QzbnnOS6M1qK5iVWycwKcxUCNQLbOo/fcJM1roRGhxEyrhHg7Fa1ePx5gG XtA9//mdzkWFO20auTWDispymF3BaFecuHrX4JPV09C+cocn9HwgIbzO/Zf5/3o3uFTQ J/oBIvtdriJh5qg2BAqDgVE1RtiSQVtN26HpuKMPFQwj2sRP53abZ+Sata6e6x2SiX8a cVZrwKf0WT6Mso9wudDEQoIr1vtd+WTGMfcEDknxzSdGZhGvNmlQQZaHI8mUPkqYik1K 9CWu4MpR+yClXWlGYrBFQyHOq8UgYRy4KtcL3MrKhOnN9xypn9fKU1bIIyZ/HqUecydi Oxww==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AVADNh4G; 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 jr2-20020a0562142a8200b0068fa4b5ec4asi4659438qvb.350.2024.02.26.01.16.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Feb 2024 01:16:29 -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=AVADNh4G; 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 1reX5S-0004c1-Pa; Mon, 26 Feb 2024 04:15:50 -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 1reX5R-0004bV-KC for qemu-devel@nongnu.org; Mon, 26 Feb 2024 04:15:49 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1reX5J-0005Dj-D3 for qemu-devel@nongnu.org; Mon, 26 Feb 2024 04:15:49 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-33dcd8dec88so654933f8f.1 for ; Mon, 26 Feb 2024 01:15:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708938939; x=1709543739; 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=X2JL0lvPjHTbqYBDEnpbpZDHGDP1jZ/xznh+r/K8/d0=; b=AVADNh4GfA+Ax15dyNFHnDuxHBCYZcNjUgUfWZUvcFKytXa9VjOluygN2L+uN1vXVa 7/ZUec01JI0ErVCIxeeRD/PGwewZUHpDeVml8co1zD1UiV3uFj5KewSZwa5hQgZEdmCB AEQoSspNqumPUPBj6gNByNdDF59IiTcVk5EOh6OuSaE3e1NGd2X8kwRTFQgXB3DQrXYt 3eCYyU1lap8KtktBjKLKH8Cdb6oAc6XJNlVwRrgsTN9KVXrAquTud7LfMmYuCWc7AjwY +xfUy4QNGICJqmbpeKEfqUFhqsTPSMjW8rkx+ZYZS+qIutHnUDdIv1XKem2CwIZgtMyv /dwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708938939; x=1709543739; 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=X2JL0lvPjHTbqYBDEnpbpZDHGDP1jZ/xznh+r/K8/d0=; b=cUS/x1HaLlxXUQNuloVEmowgXoOkMJ9ZXP4wDr03JLIzeYA6LI2xzrQFRDRyG3Hyp4 iMnLts1YWckKhblt/8xpW76kbenO8js41EFkzXnYGIfN1pXzZAZ/gCsD7o/VV7BE55at u4FOfAR25pYb5HXmHemxLJwqMLJAQTJsxWJOywHl3OkqUGTqjFTABCeW9TabiEJ1t4FA pPQ6a8Yq3gM8bU5gLj+kHp1hBPBnc1TCb0zNSpgUKAiqaT0pqwAKHG7AAl/WRS5ninXj fTvAHf8e0wflCfHu00sHHT0G+q7QcM5Uqlh3LL3xkk0N80RY2i7G8mCbSyUf/FRX7FI3 k74w== X-Gm-Message-State: AOJu0Yzm64ZubbQVvBruHLcr5hIkmN6LDp6ozkaxHU+ZgSJRn3gQ814+ xKpPqCQS2BxltAzridv4dPEh8niNUATISzoelZTEEmHlOYKN3UEBA2a/+09cQTRmBugl80LIWYy yk93sfg== X-Received: by 2002:adf:e78f:0:b0:33d:38cf:aa76 with SMTP id n15-20020adfe78f000000b0033d38cfaa76mr4572454wrm.46.1708938939398; Mon, 26 Feb 2024 01:15:39 -0800 (PST) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id g7-20020adfe407000000b0033d2ae84fafsm7578814wrm.52.2024.02.26.01.15.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 01:15:39 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Marcel Apfelbaum , Pierrick Bouvier , Yanan Wang , Paolo Bonzini , Mahmoud Mandour , Alexandre Iooss , =?utf-8?q?Alex_Benn=C3=A9e?= , Eduardo Habkost Subject: [PATCH v5 12/12] plugins: cleanup codepath for previous inline operation Date: Mon, 26 Feb 2024 13:14:44 +0400 Message-ID: <20240226091446.479436-13-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240226091446.479436-1-pierrick.bouvier@linaro.org> References: <20240226091446.479436-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=pierrick.bouvier@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=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=no 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 Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier Reviewed-by: Alex Bennée --- 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 f6fa10a0f56..7c34f23cfcb 100644 --- a/plugins/plugin.h +++ b/plugins/plugin.h @@ -68,11 +68,6 @@ struct qemu_plugin_ctx { struct qemu_plugin_ctx *plugin_id_to_ctx_locked(qemu_plugin_id_t id); -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 47e05ec6347..8028786c7bb 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -440,15 +440,10 @@ static TCGOp *append_inline_cb(const struct qemu_plugin_dyn_cb *cb, TCGOp *begin_op, TCGOp *op, int *unused) { - char *ptr = cb->userp; - size_t elem_size = 0; - size_t offset = 0; - if (!ptr) { - /* use inline entry */ - ptr = cb->inline_insn.entry.score->data->data; - elem_size = g_array_get_element_size(cb->inline_insn.entry.score->data); - offset = cb->inline_insn.entry.offset; - } + char *ptr = cb->inline_insn.entry.score->data->data; + size_t elem_size = g_array_get_element_size( + cb->inline_insn.entry.score->data); + size_t offset = cb->inline_insn.entry.offset; op = copy_ld_i32(&begin_op, op); op = copy_mul_i32(&begin_op, op, elem_size); diff --git a/plugins/core.c b/plugins/core.c index 4b428dc25b1..c0f06d6bcf9 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -315,22 +315,6 @@ static struct qemu_plugin_dyn_cb *plugin_get_dyn_cb(GArray **arr) return &g_array_index(cbs, struct qemu_plugin_dyn_cb, cbs->len - 1); } -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 = plugin_get_dyn_cb(arr); - dyn_cb->userp = ptr; - dyn_cb->type = PLUGIN_CB_INLINE; - dyn_cb->rw = rw; - dyn_cb->inline_insn.op = op; - dyn_cb->inline_insn.imm = imm; -} - void plugin_register_inline_op_on_entry(GArray **arr, enum qemu_plugin_mem_rw rw, enum qemu_plugin_op op, @@ -493,15 +477,10 @@ void qemu_plugin_flush_cb(void) void exec_inline_op(struct qemu_plugin_dyn_cb *cb, int cpu_index) { - char *ptr = cb->userp; - size_t elem_size = 0; - size_t offset = 0; - if (!ptr) { - /* use inline entry */ - ptr = cb->inline_insn.entry.score->data->data; - elem_size = g_array_get_element_size(cb->inline_insn.entry.score->data); - offset = cb->inline_insn.entry.offset; - } + char *ptr = cb->inline_insn.entry.score->data->data; + size_t elem_size = g_array_get_element_size( + cb->inline_insn.entry.score->data); + size_t offset = cb->inline_insn.entry.offset; uint64_t *val = (uint64_t *)(ptr + offset + cpu_index * elem_size); switch (cb->inline_insn.op) {