From patchwork Tue Feb 13 09:40:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 772285 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp169467wre; Tue, 13 Feb 2024 01:42:57 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU2RzgtebflXQ0//Gjffk2Hd0yKypNkxIC210rDyWI20pnTGn/M49sp3gz410V8FCl2tEao4G+/OClsR4+ejNj/ X-Google-Smtp-Source: AGHT+IF73RbcOYG5C5Uospp8e17cJB6nUkLX3EGzY93yqllL2usiZkdzjxGnjis5SJbs2SE5xRGu X-Received: by 2002:a05:620a:5621:b0:787:1652:bdd4 with SMTP id vv1-20020a05620a562100b007871652bdd4mr2397259qkn.47.1707817377413; Tue, 13 Feb 2024 01:42:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707817377; cv=none; d=google.com; s=arc-20160816; b=yhDZ7Yp4RnklRpPMj/AlyS8QS6+XeDb03lBbRc2JhaUaBEvSvZNaz3DlTKs7pPJEEC HoI9isQJlpiiq34XscnqpC0nHAlCuWWJY7hbSWHwyE7Ho7J/1dq5A1nyNLEY39vyzAdi IBYMO6IO6Fj9owXbjL0VUWq7QYxj4eXAQLjRlx5SVsSTXXnBklFR0dlx1xj/Fsbq1gNX PjEjTxYBgI4JSb3sCdZaqlxkcyBGt6Cmtw8xI6na6WoDc1QbpFXaNmcM8BjtZjdx8lbL BFceWI2ENOkL9AO9d8F9RerY6zXuOq/f1CTYQeNY75QF20cZPLZjqdw+q+vB9W2kuJZ7 7RTA== 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=FtKR50om3lz2f67CJh+jhse66BPOqMojGHQCZZJ40RI=; fh=t+mu3RkQnV4ZSsdaRHXt9lmD/dtCXxlZRy6cYgZsCXM=; b=rhch+SuriVcl8Duab3egD0CwDdWmlxhrXQOQTb7E7fA+KvhOyMA3N0ykNV5/3Yoo8d 7Ddn8ApVpMErCJ9xAWQSqnmRDuqs2R90D57ApVLQ6pf4jKfuHPN8Jmzx8PiGXmudbS6x OwNu71ZW3i/+a5dV4LOa36F3DEhEUYYdVv5o3Ff4uoI3nduVJ5xNOQN63Ym1r+eHdsd0 ST7+kpuutn4Hl797Iq95b+85O7lbIEKpgmgQNnYoqfRNBsVx2m0fjZjoWvx9Z46MncGB RrECBtKzY3ilR7o+UWMuWSTr0hUkkwDPLGbYUELH9qbWx27IZeyMspm/cApF5v03lA7c qTNw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tGpsDd0X; 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 X-Forwarded-Encrypted: i=1; AJvYcCUHiATtGJ0V0SFbFo48vuISsmy/af/vAmYpYZqD3mPCNaolkoH4Ll8PYcBqWhqfxSewkc8Oi7eTRD1JN3UG0+zC Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id vr24-20020a05620a55b800b007871b460c08si1140478qkn.282.2024.02.13.01.42.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Feb 2024 01:42:57 -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=tGpsDd0X; 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 1rZpIK-0001xF-Ah; Tue, 13 Feb 2024 04:41:40 -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 1rZpIF-0001fp-BQ for qemu-devel@nongnu.org; Tue, 13 Feb 2024 04:41:35 -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 1rZpIC-0000J0-7z for qemu-devel@nongnu.org; Tue, 13 Feb 2024 04:41:35 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-33ce0802f17so95049f8f.0 for ; Tue, 13 Feb 2024 01:41:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707817290; x=1708422090; 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=FtKR50om3lz2f67CJh+jhse66BPOqMojGHQCZZJ40RI=; b=tGpsDd0XMuxcbaNyKMoFmMJZUbM+ejni7rejQ8U5i7shL/Fn+kgt78mGQYnv8oHqKy LYQCGQamHVJvBJqunKbQFjnY0efHGE0DVPMPlVa/jZ2bJnJvdDtB89K6t990bwG+2tDV JU8m7OwmvQ7o0Q84ksxaiChhahs9/7t7uDSG1OsICgHZG8LKZm1U3UjCpjeKZuU1Iq4I cvr7AqTye9oRNFO5DU664CJcVmMY6wBIvKENYj0ox5JBI9DfFktGguALUuwWbQPeaKfF qWXjwYPScSVh/I8sVxnAVCcd04YaLE9cDxwS21bI/7ZWsCZJRiADsNzSzXBEJk3bhKwP ea4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707817291; x=1708422091; 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=FtKR50om3lz2f67CJh+jhse66BPOqMojGHQCZZJ40RI=; b=jrKpNaA1uGOgU8Gsy3ExZKsfhequKBaOaKCBLgQn518wZeFys4NcY8E2fu7FD+1/P5 Df4494EDuZALEuAOP6t/1RPYK4J91lDI7vWD7k7TzTOq8UelxezTBNA/vywStR4DAxtU jVtP5svUts23QLanvK60yWJpzqRRJgIT6x8K8zB3ae1OT7Tl8jS2+pjXm4bi3pG2DCai HRqNk+AzB9pqBp2odrN46jMPvpEMhcPsiIhmkCzfU9uCDjQyiP1GfG9cWMdq/5XTVYHA NWQrG0Q1APcKyRkbk9B5Lw1Twu706mzhC0+ROD7KhRkz8MtdbvU7Jdv6i0VvlzwOhYC3 t1KQ== X-Gm-Message-State: AOJu0YxV6iCWCOTUa/nTR6PIrE03YvfP43iWyvL7spcwA2PsdPKPdMjJ oPPpqszVDMUcUYsSASlgjqpTGJBAqd4bEPKoEtu3QoUq2b3/+n9wNTQeg4uugXQMRgZTrLcGHEE z X-Received: by 2002:a05:6000:108a:b0:33b:25cd:ba9 with SMTP id y10-20020a056000108a00b0033b25cd0ba9mr5196920wrw.70.1707817290762; Tue, 13 Feb 2024 01:41:30 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVIFr3bKkOm/GqsCsb4PUDcBYvPrjlC5NO1dN3lhld/63qalz/asPo9nM6+nyaJhgod3l7xp8vNWYUrFKSlT/PTxBYRvH0pi0acsfd59MhHpn2w9zcnADXwGrxd9ePwTHYvtUgStOEseUdUvHFc8fTtNtO1kUQ4t2EN4Fr/hs2vKL2eAoP1YATlIYTj72q6MS1JOyvk155kgMWoGYWMuyTrXhPL6iQqFDyi/iWsz1Bt1OWuxLwkdd+N5bYCapaoV+dhFfFwMdNUZfvST/92jP3SWM+CknjjiIYCIQDSbIk1JCAPyk9vh960zoXcPC+/7MaQnJ3//+S4Lk+WpRPPAe7fxVNWRQ== Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id cc19-20020a5d5c13000000b0033b728190c1sm8550261wrb.79.2024.02.13.01.41.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 01:41:30 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Yanan Wang , Marcel Apfelbaum , Paolo Bonzini , Mahmoud Mandour , Pierrick Bouvier , Alexandre Iooss , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost , Richard Henderson Subject: [PATCH v4 17/18] plugins: cleanup codepath for previous inline operation Date: Tue, 13 Feb 2024 13:40:07 +0400 Message-ID: <20240213094009.150349-18-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240213094009.150349-1-pierrick.bouvier@linaro.org> References: <20240213094009.150349-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=pierrick.bouvier@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 Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson --- 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 c547c5c83ea..7f391329bdc 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 25915a93242..3d8943cef2f 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_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 10ffdf6d938..4b2b030d76e 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -310,22 +310,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, @@ -488,15 +472,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) {