From nobody Mon Feb 9 00:54:38 2026 Received: from mail-dy1-f202.google.com (mail-dy1-f202.google.com [74.125.82.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 541D33C1FED for ; Thu, 22 Jan 2026 21:35:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769117752; cv=none; b=Le8mG88wJidWQ3DpotOa9pudOQ7h16lYw8gwfPkTqwgp11qFx9e6Q8rJNoWnRbLkpwovtgLR6gsmXBTgipQGMLwZGOzfPKmTXsLrBWr1x2m/5M/M+n+DUWIndi/OQB27eYzhwmGcstmiarvciT3AgZHU3MVr+TbJPqqM760Hx5A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769117752; c=relaxed/simple; bh=/4t52AvyWDIvlIx3zdnelq0uOogrQvoAgZggoWjNLIQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=QO4SFS0k6JSTkILwzJOwInLgCcQDW85cAlW1WkEblAETZZcKdjlc12uoDhLOLUVa5kjdzxgvlyDmIYCXvjI8ylANDUZe10lUPIDq+sSKwhUbix0mWouRTu1GqFzmRYRWYrZI8UMGSsZV2pMecPQks7+xb7MFlP6EsfKKHLg/P7E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=K5X30jG6; arc=none smtp.client-ip=74.125.82.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="K5X30jG6" Received: by mail-dy1-f202.google.com with SMTP id 5a478bee46e88-2b708fa4093so4324921eec.0 for ; Thu, 22 Jan 2026 13:35:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769117741; x=1769722541; darn=vger.kernel.org; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=Xlxy7gGNB7fnsuI8qX0WFdpap2bNeW5xmXABoxpIzho=; b=K5X30jG6zcPq+d8xQn4tUPtcYCXPCiWMyKIuIMN0F0vRqs3PL3F4tXC4W/UjKib34I VJD6KVgHhaGq13IYvxk7i5kgFdUaER47vwbYS2V7fhLadKI3EB1q4xv/20W4btJxsejL zGe4bv+5Y6MhcAVYR+VAWfi774hcowZmQcGyNL3bI5S7+uVLrGJ2MCClOYmXXWm78d30 WwC2n8b9FagDgjmO4KMcJcKB8hgVnEov7FyxXF7hbsQgLSE2gDGFW2Qt8buQBbAfColw JyYyDisdAYVKV37iSY2dERtDNyrCiK18EhH7zkYbgaIYk3dIO35HRtKgvwt0UJz0b2gs TUTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769117741; x=1769722541; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Xlxy7gGNB7fnsuI8qX0WFdpap2bNeW5xmXABoxpIzho=; b=dcL0BQgIEprOHxNb0tutGg5K64GBLREsRe6MM5Sxr1809Gh1Xc+I4vNVT8Yt0+JgGQ t8yYZQVLZq9qd8JEIeK6bbaz0Jn7spkOGj1XFBT798rkMalL+X+/DyLDuX6+683mpEJU sYW5XmjbeYjRWvmRioFGM6T2ar4jgj0JaNzbuGfkOJ1rEfv1SMcDirQhGzO7pR7T/+BD 9d6PoV1bdVrXhzk8tcFTv5KysoiGkQJaF4n+P8ERKqmiOezNEfXEAug32xAKcDEW2v9p 6i9aqYea3BZUae4o+FBHZgXtZx95oTQ8sdPsliU023Jg4bQ/Wiisgksrr+EWl39aSAFM 926w== X-Forwarded-Encrypted: i=1; AJvYcCUYIYqDgXYMiKckjSl34aeuB23FpKwlWMbaOI2KJ0gPF3Al7yCtyRFxPXCq4qqgScwcLOOsEiCjPZ96nIA=@vger.kernel.org X-Gm-Message-State: AOJu0Yxq0BkROKr3ch4F6gfEKVAmpnrheJ4cXoBIFMTf04Y1EO4cEyua Vf0zn+t0UTfpu7hKU34aE8znc7gXui9OI6bCF7w1i5CmXW9U/jp8JB5XwNv/SOK5gqQF1I5KChX Qx5GLPg9ing== X-Received: from dybqo12.prod.google.com ([2002:a05:7301:678c:b0:2b6:b6b8:7fee]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7301:578e:b0:2ae:53da:9787 with SMTP id 5a478bee46e88-2b739beb0bamr355131eec.40.1769117740757; Thu, 22 Jan 2026 13:35:40 -0800 (PST) Date: Thu, 22 Jan 2026 13:35:13 -0800 In-Reply-To: <20260122213516.671089-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260122213516.671089-1-irogers@google.com> X-Mailer: git-send-email 2.52.0.457.g6b5491de43-goog Message-ID: <20260122213516.671089-10-irogers@google.com> Subject: [PATCH v3 09/12] perf disasm: Refactor ins__is_call/jump to avoid exposing arch ins_ops From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , John Garry , Will Deacon , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Zecheng Li , Tianyou Li , Thomas Falcon , Julia Lawall , Suchit Karunakaran , Athira Rajeev , Aditya Bodkhe , Howard Chu , "=?UTF-8?q?Krzysztof=20=C5=81opatowski?=" , "Dr. David Alan Gilbert" , Shimin Guo , Sergei Trofimovich , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add booleans indicating whether and ins_ops are call or jump and return it. This avoids exposing loongarch and s390 ins_ops for the sake of matching. Signed-off-by: Ian Rogers --- tools/perf/util/annotate-arch/annotate-loongarch.c | 6 ++++-- tools/perf/util/annotate-arch/annotate-s390.c | 3 ++- tools/perf/util/disasm.c | 6 ++++-- tools/perf/util/disasm.h | 5 ++--- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/tools/perf/util/annotate-arch/annotate-loongarch.c b/tools/per= f/util/annotate-arch/annotate-loongarch.c index 32df10f6fed5..79dc116ade2f 100644 --- a/tools/perf/util/annotate-arch/annotate-loongarch.c +++ b/tools/perf/util/annotate-arch/annotate-loongarch.c @@ -57,9 +57,10 @@ static int loongarch_call__parse(const struct arch *arch= , struct ins_operands *o return 0; } =20 -const struct ins_ops loongarch_call_ops =3D { +static const struct ins_ops loongarch_call_ops =3D { .parse =3D loongarch_call__parse, .scnprintf =3D call__scnprintf, + .is_call =3D true, }; =20 static int loongarch_jump__parse(const struct arch *arch, struct ins_opera= nds *ops, @@ -106,9 +107,10 @@ static int loongarch_jump__parse(const struct arch *ar= ch, struct ins_operands *o return 0; } =20 -const struct ins_ops loongarch_jump_ops =3D { +static const struct ins_ops loongarch_jump_ops =3D { .parse =3D loongarch_jump__parse, .scnprintf =3D jump__scnprintf, + .is_jump =3D true, }; =20 static diff --git a/tools/perf/util/annotate-arch/annotate-s390.c b/tools/perf/uti= l/annotate-arch/annotate-s390.c index 81db102b3e15..7b2d27b62e6b 100644 --- a/tools/perf/util/annotate-arch/annotate-s390.c +++ b/tools/perf/util/annotate-arch/annotate-s390.c @@ -57,9 +57,10 @@ static int s390_call__parse(const struct arch *arch, str= uct ins_operands *ops, return 0; } =20 -const struct ins_ops s390_call_ops =3D { +static const struct ins_ops s390_call_ops =3D { .parse =3D s390_call__parse, .scnprintf =3D call__scnprintf, + .is_call =3D true, }; =20 static int s390_mov__parse(const struct arch *arch __maybe_unused, diff --git a/tools/perf/util/disasm.c b/tools/perf/util/disasm.c index 845c2d0f39b1..8c3e9094600a 100644 --- a/tools/perf/util/disasm.c +++ b/tools/perf/util/disasm.c @@ -315,11 +315,12 @@ int call__scnprintf(const struct ins *ins, char *bf, = size_t size, const struct ins_ops call_ops =3D { .parse =3D call__parse, .scnprintf =3D call__scnprintf, + .is_call =3D true, }; =20 bool ins__is_call(const struct ins *ins) { - return ins->ops =3D=3D &call_ops || ins->ops =3D=3D &s390_call_ops || ins= ->ops =3D=3D &loongarch_call_ops; + return ins->ops && ins->ops->is_call; } =20 /* @@ -469,11 +470,12 @@ const struct ins_ops jump_ops =3D { .free =3D jump__delete, .parse =3D jump__parse, .scnprintf =3D jump__scnprintf, + .is_jump =3D true, }; =20 bool ins__is_jump(const struct ins *ins) { - return ins->ops =3D=3D &jump_ops || ins->ops =3D=3D &loongarch_jump_ops; + return ins->ops && ins->ops->is_jump; } =20 static int comment__symbol(char *raw, char *comment, u64 *addrp, char **na= mep) diff --git a/tools/perf/util/disasm.h b/tools/perf/util/disasm.h index 83503c5075f9..b6a2a30fdf27 100644 --- a/tools/perf/util/disasm.h +++ b/tools/perf/util/disasm.h @@ -93,6 +93,8 @@ struct ins_ops { struct disasm_line *dl); int (*scnprintf)(const struct ins *ins, char *bf, size_t size, struct ins_operands *ops, int max_ins_name); + bool is_jump; + bool is_call; }; =20 struct annotate_args { @@ -139,9 +141,6 @@ bool ins__is_fused(const struct arch *arch, const char = *ins1, const char *ins2); bool ins__is_ret(const struct ins *ins); bool ins__is_lock(const struct ins *ins); =20 -extern const struct ins_ops s390_call_ops; -extern const struct ins_ops loongarch_call_ops; -extern const struct ins_ops loongarch_jump_ops; const struct ins_ops *check_ppc_insn(struct disasm_line *dl); =20 struct disasm_line *disasm_line__new(struct annotate_args *args); --=20 2.52.0.457.g6b5491de43-goog