From nobody Tue Nov 26 15:41:46 2024 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.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 4D4A1B660 for ; Thu, 17 Oct 2024 00:25:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124732; cv=none; b=ad2rgnieRj9N8d/qpm9wy9hXerVi1DMqSAnNm4Ileg5NgWhSA7/ylnKBJzSlPT1UlnXoaIpsRJjh7125jIlF9E4Ry8U2GZwo3KspIOSGdg4J8wSZHsP8Hw991Sa706QeHE+FGBTki5AjqRio29kMLG5qP4IwQszGLrWtkgciqS0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124732; c=relaxed/simple; bh=A0HGbonvRUijYxz4QecnqBWvuj6TXKdy2v5D53nEWTY=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=U4HVV2iz83oBNw7J1G9nQbt+a//cZV7+6cGD/OpUsgvabfHuuoeYttRonZxf0vFQEpIG1feOFJMO3t3ZepGDfdyxRXNfHhaqxTzf8liyRE8fjlcTVpcS77gquBtIXbEYbSjsx2veahk+72nitr8T2FNx6qCl6F7eiCf2+69LpVY= 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=IJBV1mmR; arc=none smtp.client-ip=209.85.219.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="IJBV1mmR" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e2a8355786dso663395276.2 for ; Wed, 16 Oct 2024 17:25:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124730; x=1729729530; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=mFoNBRLqrUgqoIcVjkPQD2Pr1/YcjMFPTvmF3zk2fK4=; b=IJBV1mmRbXwq/81wfFaBTzWI5361cww8jZ7+vLKT8Vm63Ysijbs+P06OfgkYuf4Lvs efNspy+yzjddlcyGDg2WUyv6qUmVTSPC0nLHtsOC+tQO9ETZTEUHli9dqf2F5XDh9Eov 5liCRIarBvF1alCl6OxmMBUTzH4T0J2fEcDczXC081cIUUWllI+oat3QX8Q/R0cpekFh 7co2KjnLatg00R4VVq/gfBOOhP6fEXzQGPoW2gfTHkF0Csl6leLxuiZiqWPQUV8pKzDc 3GOlEGkGwdKKuRfhCYGfIeNI4wGfLCMmkCFHVFzltPnvE6EKualmOIwH7ckOVBkIBQuH UGgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124730; x=1729729530; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mFoNBRLqrUgqoIcVjkPQD2Pr1/YcjMFPTvmF3zk2fK4=; b=Rv+X/++ezfFGwe/WTk/3DPq1s3ntmHcaIAlFgAejj+rt/qjjB/kLkUowOnX6AXC7Ak 2AUFQIR5qac/MNw7b4jYJwU9dqRTUiiO2nQBfun7EFJi7KmZi5XtqIxZ+TCECbbcKBT9 601x/yxvr2U0KJcrpf9GsaxJYjwrNNWUgV2Jj5ORIeElflaQ//v4xTeIvLYdwwy8Z+6/ fMpCPpcpOVyKb7WTBJUc3giQ17amp+gYOHfudnIXjm1uuViS+SHzK4x3IMITFaa0GZ5N U0J14DS7fB04OhpwtgLCS+V90pLASfzzlH3vRQGfXdS2e6xTqXvgNY6O8yLghIbui1J1 zYrA== X-Forwarded-Encrypted: i=1; AJvYcCVowGUba56rYDPvj+fmjYfxnfp4ufGk6OLYcQiZ8wzkPrxLhBrFNsz21xKikXj/su8Wy7gj0FxbQPuRIZ0=@vger.kernel.org X-Gm-Message-State: AOJu0YzaHRVTyB5xhTSgq7TGD4C+PWpJMAuejP7ic7SvDy/RdQzfI3rm jt5marLCIYak6aURHGuK53AWJ06Hb96EVuAzJdzwffA2QKXySGJdCA3DQ2kU/g4qb2stjcCj9rq hHA15qw== X-Google-Smtp-Source: AGHT+IH7A47NlLkmI7JyY+lLOU6RNU024zTixWHwEAwzVgMoGJoUi31CPQwu7Zqb3utm3XVl/ZEc2m8pfELj X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a05:6902:50d:b0:e28:eee0:aaa1 with SMTP id 3f1490d57ef6-e29782e9f6fmr3106276.4.1729124729872; Wed, 16 Oct 2024 17:25:29 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:01 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-2-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 01/20] perf bpf-prologue: Remove unused file From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , 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" Commit 4a73fca22692 ("perf bpf-prologue: Remove unused file") missed cleaning up the header file. The code was unnecessary as Commit 3d6dfae88917 ("perf parse-events: Remove BPF event support") removed building bpf-prologue.c. Fixes: 4a73fca22692 ("perf bpf-prologue: Remove unused file") Signed-off-by: Ian Rogers Reviewed-by: Masami Hiramatsu (Google) --- tools/perf/util/bpf-prologue.h | 37 ---------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 tools/perf/util/bpf-prologue.h diff --git a/tools/perf/util/bpf-prologue.h b/tools/perf/util/bpf-prologue.h deleted file mode 100644 index 66dcf751ef65..000000000000 --- a/tools/perf/util/bpf-prologue.h +++ /dev/null @@ -1,37 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Copyright (C) 2015, He Kuang - * Copyright (C) 2015, Huawei Inc. - */ -#ifndef __BPF_PROLOGUE_H -#define __BPF_PROLOGUE_H - -struct probe_trace_arg; -struct bpf_insn; - -#define BPF_PROLOGUE_MAX_ARGS 3 -#define BPF_PROLOGUE_START_ARG_REG BPF_REG_3 -#define BPF_PROLOGUE_FETCH_RESULT_REG BPF_REG_2 - -#ifdef HAVE_BPF_PROLOGUE -int bpf__gen_prologue(struct probe_trace_arg *args, int nargs, - struct bpf_insn *new_prog, size_t *new_cnt, - size_t cnt_space); -#else -#include -#include - -static inline int -bpf__gen_prologue(struct probe_trace_arg *args __maybe_unused, - int nargs __maybe_unused, - struct bpf_insn *new_prog __maybe_unused, - size_t *new_cnt, - size_t cnt_space __maybe_unused) -{ - if (!new_cnt) - return -EINVAL; - *new_cnt =3D 0; - return -ENOTSUP; -} -#endif -#endif /* __BPF_PROLOGUE_H */ --=20 2.47.0.105.g07ac214952-goog From nobody Tue Nov 26 15:41:46 2024 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.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 CBB921E498 for ; Thu, 17 Oct 2024 00:25:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124736; cv=none; b=Igl/bzin9wEXI3sCkAvIgGUaLtbITV/0PvtMaQ57OksKapyWnEGaWwK/BX2rjAJijJ8Td13s/RVgXYiRZANgjBKu9uXmELQh95s8wLy/dn7BcIItysgePYue+CSsCL/1tvLzCJx2jd5Xgqjr5ruZ43vPrwH4H9T6J2VAJUqjtSI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124736; c=relaxed/simple; bh=RXHl40JBthAQkhSPp00Rrv1IKF2asm6rRGu2vt5jJgE=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=iDhxqed8P0CDDeT/U8lAKuJ+aEUiJT8Q2dyj7aDCRRkH1du42kTUXyrR7hBCwLbo9PvcjfQCq/ZJy4hrG2vzAYuI078rbGvQkPRfJU1fLWV8ZLEk6LWGWJ5rML1XOnsy1DYvvveJoIbYoSgTv2jklsyVwCvp/1YIxMbkS78VPwQ= 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=x7o3/Wt/; arc=none smtp.client-ip=209.85.128.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="x7o3/Wt/" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6e3529d80e5so8568087b3.0 for ; Wed, 16 Oct 2024 17:25:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124733; x=1729729533; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=3NsEr7msd173iKSV9/VCmecavKBITUiPRN43mS0QcMU=; b=x7o3/Wt/jXzzc3xJ+2WGMHY2XqLP/CvxczY1S7XsuYCjhFh0MFS9z1ocRpE8OaUtXN 0KbIXoEBjmK9dOv/FmThRYFG2tPj73z/iMwuNzLcAkgNsg1Rsb1Au9G/LDAsqjjBRhTX I6PiMUZBafGqrdiyKEHgI9WW4+ynS+42SMCjbOMThBZU1hXYhIlgUWx2hFUdRiwLnseV 3UHivSdvgcT1kgowFoll6/EfldG9qjbBBP50/caeOycveZNJjxX1F9mN7SvGy4sDt7C6 uFULXbtVvSfsp4U7HYEBkrt3lE/ztmCF4QCrMzFMzEYAIUQutL+ME6J6J+nFHIx1yDdI yXbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124733; x=1729729533; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3NsEr7msd173iKSV9/VCmecavKBITUiPRN43mS0QcMU=; b=Kzr0PPZWZCI+84u589KBKd7/gEtvgON2/MjYsYwZvEBLQ1pUAbvyzG7mjCaGzPFgOG IcA9ED/3XfuqHA43z1eQwF2cWH4NftEgmZKKfDwFx4Hybhjw9B3cF11pLOLV8oFfgE5W zeDMyuqSQDyVydLx/Q67E/GLuz/h8Qg4wFv0C/n5O1Y+JeSA2m8BV9EOIdD5rKVuKjri FZtD7iFwZMOzYNNvRoU4TeCNlK6eOLGUJeG2q2RzHBvvuNRNrLx7cscL4UgGuZBwWq26 T612iYKMOMf8xHMspqt0QMKTyeo98U1vUFu95vznlrG9RjDSdbxI2jOHpoD1as/waew0 slPw== X-Forwarded-Encrypted: i=1; AJvYcCWEyKeIhSwRD8RiljmwGwilcx3RFWsyac1tMHt57qCxuMKx2tQPl0Ls+vGqRECuQqhtpWJrE0aB/gF48t4=@vger.kernel.org X-Gm-Message-State: AOJu0YxS4aaZ9tn93khWTZV5TGxzeu6T9zxb9/4Qj9yKZCDQGm4spWBC jVfNVGchWuWMGUEmqCFM4iyZHgP1juG+TAHkYG+x+NIFWzRF2szOR6lkZkVxMDren/1EFr55jhy aiUC9Lw== X-Google-Smtp-Source: AGHT+IGgUPEeAoj0GCHJRw0hDSDrqo6vL+2D8u0aKVLNqtcDlviAMIAP2xZin6A4jNkd/xtNmfp3B0Sj1e8R X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a05:690c:6993:b0:6e2:1b8c:39bf with SMTP id 00721157ae682-6e3d3f7f6fdmr1369657b3.2.1729124732661; Wed, 16 Oct 2024 17:25:32 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:02 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-3-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 02/20] perf dwarf-regs: Remove PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , 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" PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET was used for BPF prologue support which was removed in Commit 3d6dfae88917 ("perf parse-events: Remove BPF event support"). The code is no longer used so remove. Remove the offset from various dwarf-regs.c tables and the dependence on ptrace.h. Rename structs starting pt_ as the ptrace derived offset is now removed. Signed-off-by: Ian Rogers Reviewed-by: Masami Hiramatsu (Google) --- tools/perf/Makefile.config | 4 - tools/perf/arch/arm64/Makefile | 1 - tools/perf/arch/arm64/util/dwarf-regs.c | 20 +--- tools/perf/arch/loongarch/Makefile | 1 - tools/perf/arch/loongarch/util/dwarf-regs.c | 10 -- tools/perf/arch/powerpc/Makefile | 1 - tools/perf/arch/powerpc/util/dwarf-regs.c | 26 ++--- tools/perf/arch/riscv/Makefile | 1 - tools/perf/arch/riscv/util/dwarf-regs.c | 14 +-- tools/perf/arch/s390/Makefile | 1 - tools/perf/arch/s390/util/dwarf-regs.c | 27 ----- tools/perf/arch/x86/Makefile | 1 - tools/perf/arch/x86/util/dwarf-regs.c | 109 +++----------------- tools/perf/util/include/dwarf-regs.h | 8 -- 14 files changed, 27 insertions(+), 197 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index b93ed2b7623f..1d3f7dcc6b66 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -203,10 +203,6 @@ FEATURE_CHECK_CFLAGS-bpf =3D -I. -I$(srctree)/tools/in= clude -I$(srctree)/tools/arc # include ARCH specific config -include $(src-perf)/arch/$(SRCARCH)/Makefile =20 -ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET - CFLAGS +=3D -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET -endif - include $(srctree)/tools/scripts/utilities.mak =20 ifeq ($(call get-executable,$(FLEX)),) diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile index 8a5ffbfe809f..ca2e35961287 100644 --- a/tools/perf/arch/arm64/Makefile +++ b/tools/perf/arch/arm64/Makefile @@ -3,7 +3,6 @@ ifndef NO_LIBDW PERF_HAVE_DWARF_REGS :=3D 1 endif PERF_HAVE_JITDUMP :=3D 1 -PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET :=3D 1 HAVE_KVM_STAT_SUPPORT :=3D 1 =20 # diff --git a/tools/perf/arch/arm64/util/dwarf-regs.c b/tools/perf/arch/arm6= 4/util/dwarf-regs.c index 917b97d7c5d3..343a62fa4199 100644 --- a/tools/perf/arch/arm64/util/dwarf-regs.c +++ b/tools/perf/arch/arm64/util/dwarf-regs.c @@ -9,10 +9,9 @@ #include #include #include -#include /* for struct user_pt_regs */ #include =20 -struct pt_regs_dwarfnum { +struct regs_dwarfnum { const char *name; unsigned int dwarfnum; }; @@ -21,14 +20,12 @@ struct pt_regs_dwarfnum { #define GPR_DWARFNUM_NAME(num) \ {.name =3D __stringify(%x##num), .dwarfnum =3D num} #define REG_DWARFNUM_END {.name =3D NULL, .dwarfnum =3D 0} -#define DWARFNUM2OFFSET(index) \ - (index * sizeof((struct user_pt_regs *)0)->regs[0]) =20 /* * Reference: * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0057b/IHI0057B_aadw= arf64.pdf */ -static const struct pt_regs_dwarfnum regdwarfnum_table[] =3D { +static const struct regs_dwarfnum regdwarfnum_table[] =3D { GPR_DWARFNUM_NAME(0), GPR_DWARFNUM_NAME(1), GPR_DWARFNUM_NAME(2), @@ -74,19 +71,10 @@ static const struct pt_regs_dwarfnum regdwarfnum_table[= ] =3D { */ const char *get_arch_regstr(unsigned int n) { - const struct pt_regs_dwarfnum *roff; + const struct regs_dwarfnum *roff; + for (roff =3D regdwarfnum_table; roff->name !=3D NULL; roff++) if (roff->dwarfnum =3D=3D n) return roff->name; return NULL; } - -int regs_query_register_offset(const char *name) -{ - const struct pt_regs_dwarfnum *roff; - - for (roff =3D regdwarfnum_table; roff->name !=3D NULL; roff++) - if (!strcmp(roff->name, name)) - return DWARFNUM2OFFSET(roff->dwarfnum); - return -EINVAL; -} diff --git a/tools/perf/arch/loongarch/Makefile b/tools/perf/arch/loongarch= /Makefile index 1cc5eb01f32b..79b432744296 100644 --- a/tools/perf/arch/loongarch/Makefile +++ b/tools/perf/arch/loongarch/Makefile @@ -2,7 +2,6 @@ ifndef NO_LIBDW PERF_HAVE_DWARF_REGS :=3D 1 endif -PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET :=3D 1 PERF_HAVE_JITDUMP :=3D 1 HAVE_KVM_STAT_SUPPORT :=3D 1 =20 diff --git a/tools/perf/arch/loongarch/util/dwarf-regs.c b/tools/perf/arch/= loongarch/util/dwarf-regs.c index 0f6ebc387463..bee08fdcf2fd 100644 --- a/tools/perf/arch/loongarch/util/dwarf-regs.c +++ b/tools/perf/arch/loongarch/util/dwarf-regs.c @@ -32,13 +32,3 @@ const char *get_arch_regstr(unsigned int n) n %=3D 32; return loongarch_gpr_table[n].name; } - -int regs_query_register_offset(const char *name) -{ - const struct pt_regs_dwarfnum *roff; - - for (roff =3D loongarch_gpr_table; roff->name !=3D NULL; roff++) - if (!strcmp(roff->name, name)) - return roff->dwarfnum; - return -EINVAL; -} diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Mak= efile index 7672d555f6cd..ae05727835d8 100644 --- a/tools/perf/arch/powerpc/Makefile +++ b/tools/perf/arch/powerpc/Makefile @@ -4,7 +4,6 @@ PERF_HAVE_DWARF_REGS :=3D 1 endif =20 HAVE_KVM_STAT_SUPPORT :=3D 1 -PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET :=3D 1 PERF_HAVE_JITDUMP :=3D 1 =20 # diff --git a/tools/perf/arch/powerpc/util/dwarf-regs.c b/tools/perf/arch/po= werpc/util/dwarf-regs.c index 104c7ae5c433..23846c59a522 100644 --- a/tools/perf/arch/powerpc/util/dwarf-regs.c +++ b/tools/perf/arch/powerpc/util/dwarf-regs.c @@ -9,29 +9,25 @@ #include #include #include -#include #include #include =20 -struct pt_regs_dwarfnum { +struct regs_dwarfnum { const char *name; unsigned int dwarfnum; - unsigned int ptregs_offset; }; =20 #define REG_DWARFNUM_NAME(r, num) \ - {.name =3D __stringify(%)__stringify(r), .dwarfnum =3D num, \ - .ptregs_offset =3D offsetof(struct pt_regs, r)} + {.name =3D __stringify(%)__stringify(r), .dwarfnum =3D num} #define GPR_DWARFNUM_NAME(num) \ - {.name =3D __stringify(%gpr##num), .dwarfnum =3D num, \ - .ptregs_offset =3D offsetof(struct pt_regs, gpr[num])} -#define REG_DWARFNUM_END {.name =3D NULL, .dwarfnum =3D 0, .ptregs_offset = =3D 0} + {.name =3D __stringify(%gpr##num), .dwarfnum =3D num} +#define REG_DWARFNUM_END {.name =3D NULL, .dwarfnum =3D 0} =20 /* * Reference: * http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html */ -static const struct pt_regs_dwarfnum regdwarfnum_table[] =3D { +static const struct regs_dwarfnum regdwarfnum_table[] =3D { GPR_DWARFNUM_NAME(0), GPR_DWARFNUM_NAME(1), GPR_DWARFNUM_NAME(2), @@ -83,22 +79,14 @@ static const struct pt_regs_dwarfnum regdwarfnum_table[= ] =3D { */ const char *get_arch_regstr(unsigned int n) { - const struct pt_regs_dwarfnum *roff; + const struct regs_dwarfnum *roff; + for (roff =3D regdwarfnum_table; roff->name !=3D NULL; roff++) if (roff->dwarfnum =3D=3D n) return roff->name; return NULL; } =20 -int regs_query_register_offset(const char *name) -{ - const struct pt_regs_dwarfnum *roff; - for (roff =3D regdwarfnum_table; roff->name !=3D NULL; roff++) - if (!strcmp(roff->name, name)) - return roff->ptregs_offset; - return -EINVAL; -} - #define PPC_OP(op) (((op) >> 26) & 0x3F) #define PPC_RA(a) (((a) >> 16) & 0x1f) #define PPC_RT(t) (((t) >> 21) & 0x1f) diff --git a/tools/perf/arch/riscv/Makefile b/tools/perf/arch/riscv/Makefile index 4664a78a1afd..f01ab2171fd0 100644 --- a/tools/perf/arch/riscv/Makefile +++ b/tools/perf/arch/riscv/Makefile @@ -1,6 +1,5 @@ ifndef NO_LIBDW PERF_HAVE_DWARF_REGS :=3D 1 endif -PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET :=3D 1 PERF_HAVE_JITDUMP :=3D 1 HAVE_KVM_STAT_SUPPORT :=3D 1 diff --git a/tools/perf/arch/riscv/util/dwarf-regs.c b/tools/perf/arch/risc= v/util/dwarf-regs.c index cd0504c02e2e..a9c4402ae57e 100644 --- a/tools/perf/arch/riscv/util/dwarf-regs.c +++ b/tools/perf/arch/riscv/util/dwarf-regs.c @@ -9,7 +9,7 @@ #include /* for strcmp */ #include =20 -struct pt_regs_dwarfnum { +struct regs_dwarfnum { const char *name; unsigned int dwarfnum; }; @@ -17,7 +17,7 @@ struct pt_regs_dwarfnum { #define REG_DWARFNUM_NAME(r, num) {.name =3D r, .dwarfnum =3D num} #define REG_DWARFNUM_END {.name =3D NULL, .dwarfnum =3D 0} =20 -struct pt_regs_dwarfnum riscv_dwarf_regs_table[] =3D { +struct regs_dwarfnum riscv_dwarf_regs_table[] =3D { REG_DWARFNUM_NAME("%zero", 0), REG_DWARFNUM_NAME("%ra", 1), REG_DWARFNUM_NAME("%sp", 2), @@ -60,13 +60,3 @@ const char *get_arch_regstr(unsigned int n) { return (n < RISCV_MAX_REGS) ? riscv_dwarf_regs_table[n].name : NULL; } - -int regs_query_register_offset(const char *name) -{ - const struct pt_regs_dwarfnum *roff; - - for (roff =3D riscv_dwarf_regs_table; roff->name; roff++) - if (!strcmp(roff->name, name)) - return roff->dwarfnum; - return -EINVAL; -} diff --git a/tools/perf/arch/s390/Makefile b/tools/perf/arch/s390/Makefile index 3f66e2ede3f7..58e79f5b67a4 100644 --- a/tools/perf/arch/s390/Makefile +++ b/tools/perf/arch/s390/Makefile @@ -3,7 +3,6 @@ ifndef NO_LIBDW PERF_HAVE_DWARF_REGS :=3D 1 endif HAVE_KVM_STAT_SUPPORT :=3D 1 -PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET :=3D 1 PERF_HAVE_JITDUMP :=3D 1 =20 # diff --git a/tools/perf/arch/s390/util/dwarf-regs.c b/tools/perf/arch/s390/= util/dwarf-regs.c index dfddb3099bfa..5bcf3192623a 100644 --- a/tools/perf/arch/s390/util/dwarf-regs.c +++ b/tools/perf/arch/s390/util/dwarf-regs.c @@ -7,37 +7,10 @@ * */ =20 -#include -#include -#include #include -#include -#include -#include #include "dwarf-regs-table.h" =20 const char *get_arch_regstr(unsigned int n) { return (n >=3D ARRAY_SIZE(s390_dwarf_regs)) ? NULL : s390_dwarf_regs[n]; } - -/* - * Convert the register name into an offset to struct pt_regs (kernel). - * This is required by the BPF prologue generator. The BPF - * program is called in the BPF overflow handler in the perf - * core. - */ -int regs_query_register_offset(const char *name) -{ - unsigned long gpr; - - if (!name || strncmp(name, "%r", 2)) - return -EINVAL; - - errno =3D 0; - gpr =3D strtoul(name + 2, NULL, 10); - if (errno || gpr >=3D 16) - return -EINVAL; - - return offsetof(user_pt_regs, gprs) + 8 * gpr; -} diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile index 9aa58acb5564..51cf267f4d85 100644 --- a/tools/perf/arch/x86/Makefile +++ b/tools/perf/arch/x86/Makefile @@ -3,7 +3,6 @@ ifndef NO_LIBDW PERF_HAVE_DWARF_REGS :=3D 1 endif HAVE_KVM_STAT_SUPPORT :=3D 1 -PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET :=3D 1 PERF_HAVE_JITDUMP :=3D 1 =20 ### diff --git a/tools/perf/arch/x86/util/dwarf-regs.c b/tools/perf/arch/x86/ut= il/dwarf-regs.c index 399c4a0a29d8..530905118cd4 100644 --- a/tools/perf/arch/x86/util/dwarf-regs.c +++ b/tools/perf/arch/x86/util/dwarf-regs.c @@ -6,112 +6,31 @@ * Written by Masami Hiramatsu */ =20 -#include #include /* for EINVAL */ #include /* for strcmp */ -#include /* for struct pt_regs */ -#include /* for offsetof */ +#include /* for ARRAY_SIZE */ #include =20 -/* - * See arch/x86/kernel/ptrace.c. - * Different from it: - * - * - Since struct pt_regs is defined differently for user and kernel, - * but we want to use 'ax, bx' instead of 'rax, rbx' (which is struct - * field name of user's pt_regs), we make REG_OFFSET_NAME to accept - * both string name and reg field name. - * - * - Since accessing x86_32's pt_regs from x86_64 building is difficult - * and vise versa, we simply fill offset with -1, so - * get_arch_regstr() still works but regs_query_register_offset() - * returns error. - * The only inconvenience caused by it now is that we are not allowed - * to generate BPF prologue for a x86_64 kernel if perf is built for - * x86_32. This is really a rare usecase. - * - * - Order is different from kernel's ptrace.c for get_arch_regstr(). Use - * the order defined by dwarf. - */ +#define DEFINE_DWARF_REGSTR_TABLE 1 +#include "dwarf-regs-table.h" =20 -struct pt_regs_offset { - const char *name; - int offset; -}; - -#define REG_OFFSET_END {.name =3D NULL, .offset =3D 0} - -#ifdef __x86_64__ -# define REG_OFFSET_NAME_64(n, r) {.name =3D n, .offset =3D offsetof(struc= t pt_regs, r)} -# define REG_OFFSET_NAME_32(n, r) {.name =3D n, .offset =3D -1} +/* Return architecture dependent register string (for kprobe-tracer) */ +const char *get_arch_regstr(unsigned int n) +{ +#if defined(__i386__) + size_t len =3D ARRAY_SIZE(x86_32_regstr_tbl); #else -# define REG_OFFSET_NAME_64(n, r) {.name =3D n, .offset =3D -1} -# define REG_OFFSET_NAME_32(n, r) {.name =3D n, .offset =3D offsetof(struc= t pt_regs, r)} + size_t len =3D ARRAY_SIZE(x86_64_regstr_tbl); #endif =20 -/* TODO: switching by dwarf address size */ -#ifndef __x86_64__ -static const struct pt_regs_offset x86_32_regoffset_table[] =3D { - REG_OFFSET_NAME_32("%ax", eax), - REG_OFFSET_NAME_32("%cx", ecx), - REG_OFFSET_NAME_32("%dx", edx), - REG_OFFSET_NAME_32("%bx", ebx), - REG_OFFSET_NAME_32("$stack", esp), /* Stack address instead of %sp */ - REG_OFFSET_NAME_32("%bp", ebp), - REG_OFFSET_NAME_32("%si", esi), - REG_OFFSET_NAME_32("%di", edi), - REG_OFFSET_END, -}; + if (n >=3D len) + return NULL; =20 -#define regoffset_table x86_32_regoffset_table +#if defined(__i386__) + return x86_32_regstr_tbl[n]; #else -static const struct pt_regs_offset x86_64_regoffset_table[] =3D { - REG_OFFSET_NAME_64("%ax", rax), - REG_OFFSET_NAME_64("%dx", rdx), - REG_OFFSET_NAME_64("%cx", rcx), - REG_OFFSET_NAME_64("%bx", rbx), - REG_OFFSET_NAME_64("%si", rsi), - REG_OFFSET_NAME_64("%di", rdi), - REG_OFFSET_NAME_64("%bp", rbp), - REG_OFFSET_NAME_64("%sp", rsp), - REG_OFFSET_NAME_64("%r8", r8), - REG_OFFSET_NAME_64("%r9", r9), - REG_OFFSET_NAME_64("%r10", r10), - REG_OFFSET_NAME_64("%r11", r11), - REG_OFFSET_NAME_64("%r12", r12), - REG_OFFSET_NAME_64("%r13", r13), - REG_OFFSET_NAME_64("%r14", r14), - REG_OFFSET_NAME_64("%r15", r15), - REG_OFFSET_END, -}; - -#define regoffset_table x86_64_regoffset_table + return x86_64_regstr_tbl[n]; #endif - -/* Minus 1 for the ending REG_OFFSET_END */ -#define ARCH_MAX_REGS ((sizeof(regoffset_table) / sizeof(regoffset_table[0= ])) - 1) - -/* Return architecture dependent register string (for kprobe-tracer) */ -const char *get_arch_regstr(unsigned int n) -{ - return (n < ARCH_MAX_REGS) ? regoffset_table[n].name : NULL; -} - -/* Reuse code from arch/x86/kernel/ptrace.c */ -/** - * regs_query_register_offset() - query register offset from its name - * @name: the name of a register - * - * regs_query_register_offset() returns the offset of a register in struct - * pt_regs from its name. If the name is invalid, this returns -EINVAL; - */ -int regs_query_register_offset(const char *name) -{ - const struct pt_regs_offset *roff; - for (roff =3D regoffset_table; roff->name !=3D NULL; roff++) - if (!strcmp(roff->name, name)) - return roff->offset; - return -EINVAL; } =20 struct dwarf_regs_idx { diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include= /dwarf-regs.h index 29a7d0546b82..fbdd7307e0c2 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -42,12 +42,4 @@ static inline void get_powerpc_regs(u32 raw_insn __maybe= _unused, int is_source _ void get_powerpc_regs(u32 raw_insn, int is_source, struct annotated_op_loc= *op_loc); #endif =20 -#ifdef HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET -/* - * Arch should support fetching the offset of a register in pt_regs - * by its name. See kernel's regs_query_register_offset in - * arch/xxx/kernel/ptrace.c. - */ -int regs_query_register_offset(const char *name); -#endif #endif --=20 2.47.0.105.g07ac214952-goog From nobody Tue Nov 26 15:41:46 2024 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (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 571AB208A7 for ; Thu, 17 Oct 2024 00:25:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124737; cv=none; b=uPVdVKrTT+1T9qjBIrwC0v9BOyXxppSTSuM2v1vcbtrxrvxKrDKCIchBbvJh62Kov7YqhVjujjqvs4gNWmgGhSx2XwngQ2nawxW5PySyCh/i/quGTtzKRmnrjBztCRUIrVi+TFXyypQJFRTrsOHruy46Hz0k5MBnudXOVvGqtQE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124737; c=relaxed/simple; bh=QXxA9SYK3EN2y48SSr+iBdwYuUIiiVJnjpzRH9g/bXU=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=oAwzz0X/3UQLORoXR44rvgWDLylUuNOZQ8OVHLGGUv/KbxIdZAiN4oNWJJ2glCCUrgOs5olX5uNQLydSf9weEZkyZGopOcPjXTUvNihGHC5hb2WP3FdRZ3aKJ1MCjJVHy4jHr/07oaIpi+l1cxIjPP10rzAYOXd1Bmzw25SDv2A= 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=qU9zDy/A; arc=none smtp.client-ip=209.85.128.201 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="qU9zDy/A" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e2e5e376fcso10816337b3.2 for ; Wed, 16 Oct 2024 17:25:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124735; x=1729729535; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=zPuJy23SWmMfM/R7Lv+B/JUCmZ6weqPIHtsQlmnrHas=; b=qU9zDy/A3enYLcIaMadrTZIeoWItMw6xDYhEW8FHH8E0RzZ3S0bkIUft5aX9YNDt5T uAZRW7yh0jnpySvvZNv178IdgqUzkksNEp1PNj84SDiPtffwHkJn8t81PPNlX4zY2Hmv cMbv0LE0zLGHIpnRiMriNZ01bktaqSu+5Tzj9e8TQUhz+Fy/mHebGq8Ipf/eUwD+JuVx svEc1Udc8vZ2pPhOWvcPYFE21fUreUYLOB8MYjU4Qa+z7BwQE1h9JDOqu6si+3ByvF8l WDK7rD/uJwXPXuUHm/Y29OEaNO29rFJsCeiUKvGTI6UJqDnzN77ilFJuz5PHgMVCHj+S 7+MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124735; x=1729729535; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zPuJy23SWmMfM/R7Lv+B/JUCmZ6weqPIHtsQlmnrHas=; b=SRAwrFnacA8yF2frQHHjrJSm5mK9sIkttowNmE+9XvfIiBXDdIDQ/dg/kPXN6JQm9e JY6IW0vpcxW+ngaqbDp1epp7OZLSJt0RC0VwbrU+ePa+2RGxw847LIuK2bcbQ3rUF6Ky 8LTM6RHAbIiQi7NhrZcdoN1YbU6pU2ct5X+vYCYB7RAoNuzuWuXVeAJ+S2wLEBnY7dTC DqqDpSoG8GfwOjohvqikNAx+pS3R2NltupnccPX3g4TPabVgoB165QC3xVLh8HeCiFL/ MEyk3gQuT5g1XbFGtYqDTcOCp1DYu/slachiUJ9tL4YSthZ+4ZYkFItupkRhlWSwNiyb XReQ== X-Forwarded-Encrypted: i=1; AJvYcCWk7tIn9+UkfoGZL0qVlNJtrh+gAj+Kn4TnJifCvrniKkX2mBpxu98D42d2qV9Na53+qbgwX3b8nOcNIWg=@vger.kernel.org X-Gm-Message-State: AOJu0Yw5KthPtYz72nqx6A2ilxE8ywt7JgvNoKU3BzPAw8O6rjf4v7ZW 7K18llOIO/SwIhuik+xW4yYYs/fg0CjzoUg7FWMILCYt9CtqXTM5315SInVF5MuIVgbclkp7ULj VoBGjzQ== X-Google-Smtp-Source: AGHT+IGVbm7ifaHt/Fl/drq6Q4bQa5ufX0E3xNqrZof9j3qtFmTHHwBTTD4/diJBn39+kY+JKl2TpaixKpZq X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:aa09:0:b0:e29:74e3:616c with SMTP id 3f1490d57ef6-e29782e9e9cmr2959276.3.1729124735151; Wed, 16 Oct 2024 17:25:35 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:03 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-4-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 03/20] perf dwarf-regs: Add EM_HOST and EF_HOST defines From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , 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" Computed from the build architecture defines, EM_HOST and EF_HOST give values that can be used in dwarf register lookup. Place in dwarf-regs.h so the value can be shared. Move some dwarf-regs.c constants used for EM_HOST to dwarf-regs.h. Signed-off-by: Ian Rogers Reviewed-by: Masami Hiramatsu (Google) --- tools/perf/util/dwarf-regs.c | 8 ---- tools/perf/util/include/dwarf-regs.h | 72 ++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 8 deletions(-) diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 5b7f86c0063f..7c01bc4d7e5b 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -13,14 +13,6 @@ #include #include =20 -#ifndef EM_AARCH64 -#define EM_AARCH64 183 /* ARM 64 bit */ -#endif - -#ifndef EM_LOONGARCH -#define EM_LOONGARCH 258 /* LoongArch */ -#endif - /* Define const char * {arch}_register_tbl[] */ #define DEFINE_DWARF_REGSTR_TABLE #include "../arch/x86/include/dwarf-regs-table.h" diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include= /dwarf-regs.h index fbdd7307e0c2..f4f87ded5e3d 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -2,6 +2,78 @@ #ifndef _PERF_DWARF_REGS_H_ #define _PERF_DWARF_REGS_H_ #include "annotate.h" +#include + +#ifndef EM_AARCH64 +#define EM_AARCH64 183 /* ARM 64 bit */ +#endif + +#ifndef EM_LOONGARCH +#define EM_LOONGARCH 258 /* LoongArch */ +#endif + +/* EM_HOST gives the ELF machine for host, EF_HOST gives additional flags.= */ +#if defined(__x86_64__) + #define EM_HOST EM_X86_64 +#elif defined(__i386__) + #define EM_HOST EM_386 +#elif defined(__aarch64__) + #define EM_HOST EM_AARCH64 +#elif defined(__arm__) + #define EM_HOST EM_ARM +#elif defined(__alpha__) + #define EM_HOST EM_ALPHA +#elif defined(__arc__) + #define EM_HOST EM_ARC +#elif defined(__AVR__) + #define EM_HOST EM_AVR +#elif defined(__AVR32__) + #define EM_HOST EM_AVR32 +#elif defined(__bfin__) + #define EM_HOST EM_BLACKFIN +#elif defined(__csky__) + #define EM_HOST EM_CSKY + #if defined(__CSKYABIV2__) + #define EF_HOST EF_CSKY_ABIV2 + #else + #define EF_HOST EF_CSKY_ABIV1 + #endif +#elif defined(__cris__) + #define EM_HOST EM_CRIS +#elif defined(__hppa__) // HP PA-RISC + #define EM_HOST EM_PARISC +#elif defined(__loongarch__) + #define EM_HOST EM_LOONGARCH +#elif defined(__mips__) + #define EM_HOST EM_MIPS +#elif defined(__m32r__) + #define EM_HOST EM_M32R +#elif defined(__microblaze__) + #define EM_HOST EM_MICROBLAZE +#elif defined(__MSP430__) + #define EM_HOST EM_MSP430 +#elif defined(__powerpc64__) + #define EM_HOST EM_PPC64 +#elif defined(__powerpc__) + #define EM_HOST EM_PPC +#elif defined(__riscv) + #define EM_HOST EM_RISCV +#elif defined(__s390x__) + #define EM_HOST EM_S390 +#elif defined(__sh__) + #define EM_HOST EM_SH +#elif defined(__sparc64__) || defined(__sparc__) + #define EM_HOST EM_SPARC +#elif defined(__xtensa__) + #define EM_HOST EM_XTENSA +#else + /* Unknown host ELF machine type. */ + #define EM_HOST EM_NONE +#endif + +#if !defined(EF_HOST) + #define EF_HOST 0 +#endif =20 #define DWARF_REG_PC 0xd3af9c /* random number */ #define DWARF_REG_FB 0xd3affb /* random number */ --=20 2.47.0.105.g07ac214952-goog From nobody Tue Nov 26 15:41:46 2024 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (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 9A41822611 for ; Thu, 17 Oct 2024 00:25:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124740; cv=none; b=hUOPQ3hw3tNzpAtMEDdVYHkCfXtvKylLuqgqInEAgGvlK/Sp4LZjXulyO//uJoQ3ucA4vUeEv2SnOjntZkuwMqcP4ZvlVoIh4vAVtCsmxikJe9mFu07IxsfY+aW+oRZs/vBHS16Cy3w5BiX0Vi2iRjimzzBLm+FC+ab9JuJ15yY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124740; c=relaxed/simple; bh=Ub0eI8MquskH2tQc5oWIlYlsm4t9+UhJX2S2GNP7lKs=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=AyfjWW16/d3+mNmuHSX+5C3SZYInz9BVN3jMOkRMcJnKoNoFb1AL+yypWCOEvcpZWOymPUmuNk95LEmdyD+5QGskeo1/ATr0yfpZEjzID8fiCGZcVnQ4krOMeLAT5gT+17/6NCBOH2B5syDGi67FhfRScWF5Wru8qxgmCB5c/FU= 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=FjX4sBvy; arc=none smtp.client-ip=209.85.128.201 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="FjX4sBvy" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6dbbeee08f0so21877607b3.0 for ; Wed, 16 Oct 2024 17:25:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124738; x=1729729538; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=KMncvSxke+r4vucw8oUD2KkaxOVK5uFPUegLmuP56t0=; b=FjX4sBvyx9dHUHv3oEODwbZknSLwsqHN9gl6d7wtMk46fXgnPG4I37ran6P50eqHWg Z7DZJGM6WW9oJbynE4Xn/2XEwGBGKa3wOCAzNy1i65NH2Zhz1F2pWgAjJLLzDloKazbC m9NM7iyhKggKxdyu7BN8p+WLqKZjTCZ8LkPjaTr0V7xxfpw/fq05bbnlXAKLw1vuiJ3x e0YoclU85cvSJIf4l052Vt9w4xc49F176mrqs2H3mw+w2rSGCLv9PD5GQDZgQvxSBq0Q PNhhGRIO0Q9gnkjYWXwoQsZ5tfYfqQ3x6zebOlqmDTgmrsgSJKaRMrO7Z1NWcBklqkUA +BuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124738; x=1729729538; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KMncvSxke+r4vucw8oUD2KkaxOVK5uFPUegLmuP56t0=; b=lfNlsFjR6Bn2glyajpfxlfVaqfFeVBG3mmvX9m41s4XXkSd86bpCj+QQkPbR1Bi88v H+Zu78wJWq+zMJY0JOUcKmxtc2k98cZ5DKfRho/VLTAyp3g1W6pDLD9JRp7zaqvPaNbL /4aRaUML1N7Dmoo5KSUFXwABKQK0PMhtIW9O/kvOtvDtqMA3E8zuUKvEL70azSmPrIph HTP7DE0Vd1CCY6IBL7ABf71faGKLNutnOxRiJUhJ9Rk6zGtNVSc17b2YL4aru4vpwVge krhevnBg+R1raYw/TE/0D29zhdoRJCYqNkkDNg35ONq5HKwN5YkxoOB9d7RUU9g5bIMX zKaA== X-Forwarded-Encrypted: i=1; AJvYcCXY7EdxWukHn9y4JRVP8wvgxnM8HN86JwzbGwotSl/GJlGUC6sn2KsH42NbDUBEDDz0hCeL4kTV3JEDt74=@vger.kernel.org X-Gm-Message-State: AOJu0Ywelre0ZpVAW+PHqWIplDbiuRxVZoLLH9xhzjZFQkjhvO8WuwXs 7+zZ8qsi9XsulOcw33ZqM0ax7e+ktIa7j4VZBIwATvonszhRO6bcanesbTeG3L+PdDSyy/QsL8N se3Is3Q== X-Google-Smtp-Source: AGHT+IHnKt+0wOaTE7zUTQI2rphyZXnAK5a4MY8raKX1baBAVylSM1xTDZRcbIFg3cQETXVoUICk0Kp05Tww X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:aa0c:0:b0:e1c:ffab:a801 with SMTP id 3f1490d57ef6-e2b9ce000a9mr1691276.2.1729124737505; Wed, 16 Oct 2024 17:25:37 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:04 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-5-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 04/20] perf disasm: Add e_machine/e_flags to struct arch From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , 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" Currently functions like get_dwarf_regnum only work with the host architecture. Carry the elf machine and flags in struct arch so that in disassembly these can be used to allow cross platform disassembly. Signed-off-by: Ian Rogers Reviewed-by: Masami Hiramatsu (Google) --- tools/perf/arch/arc/annotate/instructions.c | 2 ++ tools/perf/arch/arm/annotate/instructions.c | 2 ++ tools/perf/arch/arm64/annotate/instructions.c | 2 ++ tools/perf/arch/csky/annotate/instructions.c | 7 ++++++- tools/perf/arch/loongarch/annotate/instructions.c | 2 ++ tools/perf/arch/mips/annotate/instructions.c | 2 ++ tools/perf/arch/powerpc/annotate/instructions.c | 2 ++ tools/perf/arch/riscv64/annotate/instructions.c | 2 ++ tools/perf/arch/s390/annotate/instructions.c | 2 ++ tools/perf/arch/sparc/annotate/instructions.c | 2 ++ tools/perf/arch/x86/annotate/instructions.c | 3 ++- tools/perf/util/disasm.h | 4 ++++ 12 files changed, 30 insertions(+), 2 deletions(-) diff --git a/tools/perf/arch/arc/annotate/instructions.c b/tools/perf/arch/= arc/annotate/instructions.c index 2f00e995c7e3..e5619770a1af 100644 --- a/tools/perf/arch/arc/annotate/instructions.c +++ b/tools/perf/arch/arc/annotate/instructions.c @@ -5,5 +5,7 @@ static int arc__annotate_init(struct arch *arch, char *cpui= d __maybe_unused) { arch->initialized =3D true; arch->objdump.comment_char =3D ';'; + arch->e_machine =3D EM_ARC; + arch->e_flags =3D 0; return 0; } diff --git a/tools/perf/arch/arm/annotate/instructions.c b/tools/perf/arch/= arm/annotate/instructions.c index 2ff6cedeb9c5..cf91a43362b0 100644 --- a/tools/perf/arch/arm/annotate/instructions.c +++ b/tools/perf/arch/arm/annotate/instructions.c @@ -53,6 +53,8 @@ static int arm__annotate_init(struct arch *arch, char *cp= uid __maybe_unused) arch->associate_instruction_ops =3D arm__associate_instruction_ops; arch->objdump.comment_char =3D ';'; arch->objdump.skip_functions_char =3D '+'; + arch->e_machine =3D EM_ARM; + arch->e_flags =3D 0; return 0; =20 out_free_call: diff --git a/tools/perf/arch/arm64/annotate/instructions.c b/tools/perf/arc= h/arm64/annotate/instructions.c index f86d9f4798bd..d465d093e7eb 100644 --- a/tools/perf/arch/arm64/annotate/instructions.c +++ b/tools/perf/arch/arm64/annotate/instructions.c @@ -113,6 +113,8 @@ static int arm64__annotate_init(struct arch *arch, char= *cpuid __maybe_unused) arch->associate_instruction_ops =3D arm64__associate_instruction_ops; arch->objdump.comment_char =3D '/'; arch->objdump.skip_functions_char =3D '+'; + arch->e_machine =3D EM_AARCH64; + arch->e_flags =3D 0; return 0; =20 out_free_call: diff --git a/tools/perf/arch/csky/annotate/instructions.c b/tools/perf/arch= /csky/annotate/instructions.c index 5337bfb7d5fc..14270311d215 100644 --- a/tools/perf/arch/csky/annotate/instructions.c +++ b/tools/perf/arch/csky/annotate/instructions.c @@ -43,6 +43,11 @@ static int csky__annotate_init(struct arch *arch, char *= cpuid __maybe_unused) arch->initialized =3D true; arch->objdump.comment_char =3D '/'; arch->associate_instruction_ops =3D csky__associate_ins_ops; - + arch->e_machine =3D EM_CSKY; +#if defined(__CSKYABIV2__) + arch->e_flags =3D EF_CSKY_ABIV2; +#else + arch->e_flags =3D EF_CSKY_ABIV1; +#endif return 0; } diff --git a/tools/perf/arch/loongarch/annotate/instructions.c b/tools/perf= /arch/loongarch/annotate/instructions.c index ab43b1ab51e3..70262d5f1444 100644 --- a/tools/perf/arch/loongarch/annotate/instructions.c +++ b/tools/perf/arch/loongarch/annotate/instructions.c @@ -131,6 +131,8 @@ int loongarch__annotate_init(struct arch *arch, char *c= puid __maybe_unused) arch->associate_instruction_ops =3D loongarch__associate_ins_ops; arch->initialized =3D true; arch->objdump.comment_char =3D '#'; + arch->e_machine =3D EM_LOONGARCH; + arch->e_flags =3D 0; } =20 return 0; diff --git a/tools/perf/arch/mips/annotate/instructions.c b/tools/perf/arch= /mips/annotate/instructions.c index 340993f2a897..b50b46c613d6 100644 --- a/tools/perf/arch/mips/annotate/instructions.c +++ b/tools/perf/arch/mips/annotate/instructions.c @@ -40,6 +40,8 @@ int mips__annotate_init(struct arch *arch, char *cpuid __= maybe_unused) arch->associate_instruction_ops =3D mips__associate_ins_ops; arch->initialized =3D true; arch->objdump.comment_char =3D '#'; + arch->e_machine =3D EM_MIPS; + arch->e_flags =3D 0; } =20 return 0; diff --git a/tools/perf/arch/powerpc/annotate/instructions.c b/tools/perf/a= rch/powerpc/annotate/instructions.c index 54478cf5cccc..ca567cfdcbdb 100644 --- a/tools/perf/arch/powerpc/annotate/instructions.c +++ b/tools/perf/arch/powerpc/annotate/instructions.c @@ -309,6 +309,8 @@ static int powerpc__annotate_init(struct arch *arch, ch= ar *cpuid __maybe_unused) arch->associate_instruction_ops =3D powerpc__associate_instruction_ops; arch->objdump.comment_char =3D '#'; annotate_opts.show_asm_raw =3D true; + arch->e_machine =3D EM_PPC; + arch->e_flags =3D 0; } =20 return 0; diff --git a/tools/perf/arch/riscv64/annotate/instructions.c b/tools/perf/a= rch/riscv64/annotate/instructions.c index 869a0eb28953..55cf911633f8 100644 --- a/tools/perf/arch/riscv64/annotate/instructions.c +++ b/tools/perf/arch/riscv64/annotate/instructions.c @@ -28,6 +28,8 @@ int riscv64__annotate_init(struct arch *arch, char *cpuid= __maybe_unused) arch->associate_instruction_ops =3D riscv64__associate_ins_ops; arch->initialized =3D true; arch->objdump.comment_char =3D '#'; + arch->e_machine =3D EM_RISCV; + arch->e_flags =3D 0; } =20 return 0; diff --git a/tools/perf/arch/s390/annotate/instructions.c b/tools/perf/arch= /s390/annotate/instructions.c index eeac25cca699..c61193f1e096 100644 --- a/tools/perf/arch/s390/annotate/instructions.c +++ b/tools/perf/arch/s390/annotate/instructions.c @@ -166,6 +166,8 @@ static int s390__annotate_init(struct arch *arch, char = *cpuid __maybe_unused) if (s390__cpuid_parse(arch, cpuid)) err =3D SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING; } + arch->e_machine =3D EM_S390; + arch->e_flags =3D 0; } =20 return err; diff --git a/tools/perf/arch/sparc/annotate/instructions.c b/tools/perf/arc= h/sparc/annotate/instructions.c index 2614c010c235..68c31580ccfc 100644 --- a/tools/perf/arch/sparc/annotate/instructions.c +++ b/tools/perf/arch/sparc/annotate/instructions.c @@ -163,6 +163,8 @@ static int sparc__annotate_init(struct arch *arch, char= *cpuid __maybe_unused) arch->initialized =3D true; arch->associate_instruction_ops =3D sparc__associate_instruction_ops; arch->objdump.comment_char =3D '#'; + arch->e_machine =3D EM_SPARC; + arch->e_flags =3D 0; } =20 return 0; diff --git a/tools/perf/arch/x86/annotate/instructions.c b/tools/perf/arch/= x86/annotate/instructions.c index c869abe3c31d..ae94b1f0b9cc 100644 --- a/tools/perf/arch/x86/annotate/instructions.c +++ b/tools/perf/arch/x86/annotate/instructions.c @@ -202,7 +202,8 @@ static int x86__annotate_init(struct arch *arch, char *= cpuid) if (x86__cpuid_parse(arch, cpuid)) err =3D SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING; } - + arch->e_machine =3D EM_X86_64; + arch->e_flags =3D 0; arch->initialized =3D true; return err; } diff --git a/tools/perf/util/disasm.h b/tools/perf/util/disasm.h index 486c269b29ba..c135db2416b5 100644 --- a/tools/perf/util/disasm.h +++ b/tools/perf/util/disasm.h @@ -44,6 +44,10 @@ struct arch { struct data_loc_info *dloc, Dwarf_Die *cu_die, struct disasm_line *dl); #endif + /** @e_machine: ELF machine associated with arch. */ + unsigned int e_machine; + /** @e_flags: Optional ELF flags associated with arch. */ + unsigned int e_flags; }; =20 struct ins { --=20 2.47.0.105.g07ac214952-goog From nobody Tue Nov 26 15:41:46 2024 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (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 0DC1D8F6C for ; Thu, 17 Oct 2024 00:25:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124742; cv=none; b=Ml6MEGMI9dGtiAZFS/iSPPEqK0JiT/BWW4yvcYuRS/BtpCAImwEwThGL7UpZeQ0NbSBlyAG7vnXJ8oWj8V1IMpyi+k2X4z8h8XEZBmI/pWhOt7shxCbJApLSm78e7ApMtpNGmI/hoYcxJbtNn45xUKRf63xR0C2kpkrry8QBISk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124742; c=relaxed/simple; bh=pjIIA43SghEugoe0WZ1k1xzKHy+DAgbM7RilvHgchP8=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=I//rkl2oPBGmxzzoFQ1CIN4eRS9W05CW7U8eRcLuahgGuKXJzeLzkLWTXZp7xuR4p2ShN+xCfsptUbDYx6KLszQMKfZi+H9RKd2ryxxl7oYM2oInsl/wGAjB1WqvARpd6GUiLwbGDRiZvIetcG3mrOAr6SHr7oWbTN3LCEir26o= 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=dboPLXsz; arc=none smtp.client-ip=209.85.219.201 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="dboPLXsz" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e290222fde4so526894276.1 for ; Wed, 16 Oct 2024 17:25:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124740; x=1729729540; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=48mjrfomMuomFB22b093k885CPaCWm0H0utyyG5sq/o=; b=dboPLXsznIf04UTRmQcpZU5l6rbK6vkdftgtHgOsAcU7xR+TFbZU4ZunKJ358yRTvo Ce6kJ0lks43QHmxvsA9T1d1E3wEFrbErXC4P2O35aPBAKM4Zb0jz2wvxVh/BQscGCEyw 6816Pn2EZlO30fmMLqaYy7jUgQSRWyqMz06GdqZw2xC8gUbWmY/Mz9iAQx8GUgpbhNNs dSDtEvaO6a914vzwcHLIHE9r/NOfCBzIa7nRMZz1RP9R0CE1B4KsIZA6jSReQ0M9iKUY IpMawDvaNfQgL1Cnb+pjHRQZuh/VqsEF2zFpz4ICBN4tOTqsQ5qU4mIC358xoeDPrkHR ZQmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124740; x=1729729540; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=48mjrfomMuomFB22b093k885CPaCWm0H0utyyG5sq/o=; b=PUWy4RduUtDEN1SjDmEnh1OMIInMIpOnFi+JPHvJ74qJd5vbS0MdhYZxG/X4wmHZlt Ur7+DIAKslbQOfnX+NiOqAxRItpqRvJGf56l/F+FvXur0Smm+KvWMNPvfCkl3J5c7gnc pd1hKNa0JBPeATgNKy1HnmXYxmtFiGUS8edyG0jjooImhXcAuYGPs4gmI7VpP8zm5RK/ VOV1hzA/HR1ARiNYNiIiaXM/mIHSvKMQdrS3sYCBaxR02ulfwmc/cdt95Q076dmXqubS LHGn1dMJUWU7svHOnx7m8D2b9/otZH4NM8xwyG2KRi21MOfWjUx2Zn4TJZfRAb5FwLOK PZJQ== X-Forwarded-Encrypted: i=1; AJvYcCU5qBMUBqVqSjA6wjMO6lDBy5N6Kl1pKxNoLCZZ7wLRv8Q/19klnwMLwsLI7r/2l1kchFKoh+0f+Ergfk8=@vger.kernel.org X-Gm-Message-State: AOJu0Yz9IhAyOpo6Ly53doYDkinfuvxDTahEMBocVNOESMligq9ky0E2 07vonxKhEezHjgtXTMGLo/1DH5lumv34cLDblEJDyUI+kzsFTJE+12KpKsxoCs3zIX49BrwfmLD +h/0vtQ== X-Google-Smtp-Source: AGHT+IG8JiIQK8uXOvPdoaWI2mxht6B92+7n0NisCZoM8iJKAkzjyBLEa7nUOj+aZg/H9XU8lHqJJagHTx/j X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:dc4e:0:b0:e28:f231:1aa8 with SMTP id 3f1490d57ef6-e29782bbb03mr7731276.2.1729124739976; Wed, 16 Oct 2024 17:25:39 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:05 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-6-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 05/20] perf dwarf-regs: Pass accurate disassembly machine to get_dwarf_regnum From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , 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" Rather than pass 0/EM_NONE, use the value computed in the disasm struct arch. Switch the EM_NONE case to EM_HOST, rewriting EM_NONE if it were passed to get_dwarf_regnum. Pass a flags value as architectures like csky need the flags to determine the ABI variant. Signed-off-by: Ian Rogers Reviewed-by: Masami Hiramatsu (Google) --- tools/perf/util/annotate.c | 6 +++--- tools/perf/util/dwarf-regs.c | 8 ++++++-- tools/perf/util/include/dwarf-regs.h | 5 +++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 37ce43c4eb8f..b1d98da79be8 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -2292,7 +2292,7 @@ static int extract_reg_offset(struct arch *arch, cons= t char *str, if (regname =3D=3D NULL) return -1; =20 - op_loc->reg1 =3D get_dwarf_regnum(regname, 0); + op_loc->reg1 =3D get_dwarf_regnum(regname, arch->e_machine, arch->e_flags= ); free(regname); =20 /* Get the second register */ @@ -2305,7 +2305,7 @@ static int extract_reg_offset(struct arch *arch, cons= t char *str, if (regname =3D=3D NULL) return -1; =20 - op_loc->reg2 =3D get_dwarf_regnum(regname, 0); + op_loc->reg2 =3D get_dwarf_regnum(regname, arch->e_machine, arch->e_flag= s); free(regname); } return 0; @@ -2405,7 +2405,7 @@ int annotate_get_insn_location(struct arch *arch, str= uct disasm_line *dl, return -1; =20 if (*s =3D=3D arch->objdump.register_char) - op_loc->reg1 =3D get_dwarf_regnum(s, 0); + op_loc->reg1 =3D get_dwarf_regnum(s, arch->e_machine, arch->e_flags); else if (*s =3D=3D arch->objdump.imm_char) { op_loc->offset =3D strtol(s + 1, &p, 0); if (p && p !=3D s + 1) diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 7c01bc4d7e5b..1321387f6948 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -70,7 +70,7 @@ __weak int get_arch_regnum(const char *name __maybe_unuse= d) } =20 /* Return DWARF register number from architecture register name */ -int get_dwarf_regnum(const char *name, unsigned int machine) +int get_dwarf_regnum(const char *name, unsigned int machine, unsigned int = flags __maybe_unused) { char *regname =3D strdup(name); int reg =3D -1; @@ -84,8 +84,12 @@ int get_dwarf_regnum(const char *name, unsigned int mach= ine) if (p) *p =3D '\0'; =20 + if (machine =3D=3D EM_NONE) { + /* Generic arch - use host arch */ + machine =3D EM_HOST; + } switch (machine) { - case EM_NONE: /* Generic arch - use host arch */ + case EM_HOST: reg =3D get_arch_regnum(regname); break; default: diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include= /dwarf-regs.h index f4f87ded5e3d..ee0a734564c7 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -93,12 +93,13 @@ int get_arch_regnum(const char *name); * name: architecture register name * machine: ELF machine signature (EM_*) */ -int get_dwarf_regnum(const char *name, unsigned int machine); +int get_dwarf_regnum(const char *name, unsigned int machine, unsigned int = flags); =20 #else /* HAVE_LIBDW_SUPPORT */ =20 static inline int get_dwarf_regnum(const char *name __maybe_unused, - unsigned int machine __maybe_unused) + unsigned int machine __maybe_unused, + unsigned int flags __maybe_unused) { return -1; } --=20 2.47.0.105.g07ac214952-goog From nobody Tue Nov 26 15:41:46 2024 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.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 44C7938F82 for ; Thu, 17 Oct 2024 00:25:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124745; cv=none; b=lp5KZddua4/bMRRqBFeGBBGYg8dslUvhovqwYJxXFUMLZn9UvNzdxgeWcGvgwZS7gtgpvm9o4i6BGKLl3lWHT5E9N6SjGOKNYN/G2/M9rfK1xD3LZuQFHkD7kvCWj3kH1sAREDyVInkNJIo2rUWaYONIlMU0Ng5Uitw9Rn6ZBUc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124745; c=relaxed/simple; bh=jg0A+EsLd62EFrzbaEEO9QdKw/zYM2mFMhq9eemZy8A=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=ZHj/3TMe55h9wCMQrMLGIy6qZnWxIhefKi/m/HNbr4Gn5ycoxBgTb13trPFbGDKIkXxEeX+l2OgW4eCLVuEY68xVZTKUokKdf77UD5+uZCAh6tYRYagrdryZsMyyH/IxUxaN/t7Pn2XfiuWaF9PMiU5W0o8mImyPNdZhuU4V9yc= 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=H9qiTCx+; arc=none smtp.client-ip=209.85.219.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="H9qiTCx+" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e293150c2c6so814952276.1 for ; Wed, 16 Oct 2024 17:25:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124742; x=1729729542; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=izrYBPhm17udGFGkR4Iwcv4Dc//bGf094GyDIT7L4tU=; b=H9qiTCx+CS62mw2fs/L8dWumtiUlOLvNaZi2vksybB9Zea3ic8ncLbRJrOQP+xcnkE Whs7hYYQncEZGAF2bU9CwNOjYKjwJMH+VcyrpEkbAqfLv1AQzeiN18JWeYfLmOQbzT9S tifpNVZbTJfCBpIErEx7Nj8KwrQGMZldSbiIohrSv+Rbh6Y8Ky6j4CCqmkdzAI0PaNe/ G00WkRt9yVtUMuGtW39xso+BPDsZme1erbZuVdCk6/9WgujeYtmsbR9vBtBQBVgzzu0d aVeG1i1SVgKHDO6MQipN27MZW9R0SzYrJ0Rs+eo19K6LIlTo38j03/Wg60GCrx+VGnc9 AIaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124742; x=1729729542; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=izrYBPhm17udGFGkR4Iwcv4Dc//bGf094GyDIT7L4tU=; b=sgRedck94DR1R5Dta8WR7YqO0X5yXmtdLp716eJlmE6OTftWy/xObM62c9diLWZPkb +oAvrsz1a4f7lcbKIzNnY3WiClIBAaQ0z9D0yZQekzb3c8KXj4YGQU3wASnEZRD7urZa BcFiBPWyIYhfbkLSFHzPHA14PnAcwM2ymbF3Gxm4B3oggZB5o0pXiHpQnz+jULoWivuY ARhp6o8FKBaIh0SfWxCmkIoA33UY1g/5SW4YWMRlApXYdvF6QwN/Jz1FIWp3EORezss1 Z7Hlw3l8hpz5Y2g6rHYYL+FPPxX2TaXXKW2uBsj4KN28OpwAVRf0enre5dBbuV7Bwcxc jV4w== X-Forwarded-Encrypted: i=1; AJvYcCWkcxpxblOeTn0LAmsNVurmScZ+DWfMWKlXJ0MmBorZ7QR0wLpXklRjfbSEerQgDM2Ve0lqi5CK5DLzZxA=@vger.kernel.org X-Gm-Message-State: AOJu0YyCLcqAJKaqVPBlk6qoqMy/ivoO5TUXiGvsImW6oypiWlkK8Ot/ 9aWn9Oe7AXhmOhyzoX/jM+EMZbCZz4xeMTnybm2S+E1A9GXABob2gwUlFyRMcDtyj+Tc1IE15j8 T4nZZcA== X-Google-Smtp-Source: AGHT+IGe0qtX+nrFLCMypOG0orC3BMXFb6Kx9df1N+z/dKs05V2ms0PPErMRkoeQh6CQMoXF8+l+PYfUhcwf X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:aaa3:0:b0:e20:25f5:a889 with SMTP id 3f1490d57ef6-e29783030e0mr3217276.5.1729124742291; Wed, 16 Oct 2024 17:25:42 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:06 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-7-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 06/20] perf dwarf-regs: Pass ELF flags to get_dwarf_regstr From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , 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" Pass a flags value as architectures like csky need the flags to determine the ABI variant. Signed-off-by: Ian Rogers Reviewed-by: Masami Hiramatsu (Google) --- tools/perf/util/dwarf-regs.c | 3 ++- tools/perf/util/include/dwarf-regs.h | 11 ++++++----- tools/perf/util/probe-finder.c | 13 +++++++------ tools/perf/util/probe-finder.h | 3 ++- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 1321387f6948..86b3ef638fbb 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -29,7 +29,8 @@ #define __get_dwarf_regstr(tbl, n) (((n) < ARRAY_SIZE(tbl)) ? (tbl)[(n)] := NULL) =20 /* Return architecture dependent register string (for kprobe-tracer) */ -const char *get_dwarf_regstr(unsigned int n, unsigned int machine) +const char *get_dwarf_regstr(unsigned int n, unsigned int machine, + unsigned int flags __maybe_unused) { switch (machine) { case EM_NONE: /* Generic arch - use host arch */ diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include= /dwarf-regs.h index ee0a734564c7..925525405e2d 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -80,12 +80,13 @@ =20 #ifdef HAVE_LIBDW_SUPPORT const char *get_arch_regstr(unsigned int n); -/* - * get_dwarf_regstr - Returns ftrace register string from DWARF regnum - * n: DWARF register number - * machine: ELF machine signature (EM_*) +/** + * get_dwarf_regstr() - Returns ftrace register string from DWARF regnum. + * @n: DWARF register number. + * @machine: ELF machine signature (EM_*). + * @flags: ELF flags for things like ABI differences. */ -const char *get_dwarf_regstr(unsigned int n, unsigned int machine); +const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigne= d int flags); =20 int get_arch_regnum(const char *name); /* diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 8ea15a2a4397..8a932cc2f63d 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -56,7 +56,7 @@ static struct probe_trace_arg_ref *alloc_trace_arg_ref(lo= ng offs) */ static int convert_variable_location(Dwarf_Die *vr_die, Dwarf_Addr addr, Dwarf_Op *fb_ops, Dwarf_Die *sp_die, - unsigned int machine, + const struct probe_finder *pf, struct probe_trace_arg *tvar) { Dwarf_Attribute attr; @@ -166,7 +166,7 @@ static int convert_variable_location(Dwarf_Die *vr_die,= Dwarf_Addr addr, if (!tvar) return ret2; =20 - regs =3D get_dwarf_regstr(regn, machine); + regs =3D get_dwarf_regstr(regn, pf->e_machine, pf->e_flags); if (!regs) { /* This should be a bug in DWARF or this tool */ pr_warning("Mapping for the register number %u " @@ -451,7 +451,7 @@ static int convert_variable(Dwarf_Die *vr_die, struct p= robe_finder *pf) dwarf_diename(vr_die)); =20 ret =3D convert_variable_location(vr_die, pf->addr, pf->fb_ops, - &pf->sp_die, pf->machine, pf->tvar); + &pf->sp_die, pf, pf->tvar); if (ret =3D=3D -ENOENT && pf->skip_empty_arg) /* This can be found in other place. skip it */ return 0; @@ -1134,7 +1134,8 @@ static int debuginfo__find_probes(struct debuginfo *d= bg, if (gelf_getehdr(elf, &ehdr) =3D=3D NULL) return -EINVAL; =20 - pf->machine =3D ehdr.e_machine; + pf->e_machine =3D ehdr.e_machine; + pf->e_flags =3D ehdr.e_flags; =20 do { GElf_Shdr shdr; @@ -1171,7 +1172,7 @@ static int copy_variables_cb(Dwarf_Die *die_mem, void= *data) (tag =3D=3D DW_TAG_variable && vf->vars)) { if (convert_variable_location(die_mem, vf->pf->addr, vf->pf->fb_ops, &pf->sp_die, - pf->machine, NULL) =3D=3D 0) { + pf, /*tvar=3D*/NULL) =3D=3D 0) { vf->args[vf->nargs].var =3D (char *)dwarf_diename(die_mem); if (vf->args[vf->nargs].var =3D=3D NULL) { vf->ret =3D -ENOMEM; @@ -1402,7 +1403,7 @@ static int collect_variables_cb(Dwarf_Die *die_mem, v= oid *data) tag =3D=3D DW_TAG_variable) { ret =3D convert_variable_location(die_mem, af->pf.addr, af->pf.fb_ops, &af->pf.sp_die, - af->pf.machine, NULL); + &af->pf, /*tvar=3D*/NULL); if (ret =3D=3D 0 || ret =3D=3D -ERANGE) { int ret2; bool externs =3D !af->child; diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h index dfcf8cdd9e8d..be7b46ea2460 100644 --- a/tools/perf/util/probe-finder.h +++ b/tools/perf/util/probe-finder.h @@ -68,7 +68,8 @@ struct probe_finder { /* Call Frame Information from .debug_frame. Not owned. */ Dwarf_CFI *cfi_dbg; Dwarf_Op *fb_ops; /* Frame base attribute */ - unsigned int machine; /* Target machine arch */ + unsigned int e_machine; /* ELF target machine arch */ + unsigned int e_flags; /* ELF target machine flags */ struct perf_probe_arg *pvar; /* Current target variable */ struct probe_trace_arg *tvar; /* Current result variable */ bool skip_empty_arg; /* Skip non-exist args */ --=20 2.47.0.105.g07ac214952-goog From nobody Tue Nov 26 15:41:46 2024 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (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 C3CB6433A4 for ; Thu, 17 Oct 2024 00:25:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124747; cv=none; b=BN7d37SCrIM6jPhKlW+rVbPmHg5VaN3vqJ24Oyl/fSGfsKpsgrJ78IG7q8AACBuynamQyKTRPx0vL+hdHhR45HMOAM2TthDEcOTDaac9jp0oMHbVZULfhijyqyt677xc54Nx/QpkekG/VPI4ju9vgN/Atv2+CKpJYX4QxcTwwLg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124747; c=relaxed/simple; bh=cSnnzLtCUsybzckZ1r7qlceOaKrcnA6b3R9CwCRFJyY=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=FfPMLn3w6xlwPTikNqDhL/MANNMnvOKZdYJwpKN2WCI5q6Y8MQ0KwBgy+t/NdZfHrpA3oR47jpkQtnFuTJsMoXw6+Q43FT+yWDYH/4axc6vlGK+85D6g909jJEGIZMwcHbEkgfeUMEFH093+xIIsi8nLXz/5i4gV7mKx/J6MuoE= 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=2MSmBRz8; arc=none smtp.client-ip=209.85.219.201 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="2MSmBRz8" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e291ac8dcf3so625987276.3 for ; Wed, 16 Oct 2024 17:25:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124745; x=1729729545; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=XkIA/FyfXW8ws5sjRdf4oBh+1+aldg/GVrUyDFRat30=; b=2MSmBRz8uu62uY4Rz1bMOQa6x48qnYuJ5Q3qOKy+7lQv5LuHCt8UX/Ljmzsp42KqSV YacK9Bf09HjuJ+jkuVnP8+UeL0i2E8CbCZJsNSXeciy8piqLzvMXOdtY10ybMqV8CJLT 9/ZhFRbiB3R1/14hjUCgrufp4iRX7UFKxQMvdg13QHglL2sIiKcfmrQAZ1abPSZEK7eV WjkzJMt4fV9bDaV3GF/j+A63oIJTO9juLEiROSXNkAeRyw6Swp5dfFWoiy7nd6i4lljN 1r9ryCg0xeTdvlLjY0CVlpe9ysdB90yJiFydA3dozWxtCnEExtoGorivoRCcOO918QHI ZFQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124745; x=1729729545; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XkIA/FyfXW8ws5sjRdf4oBh+1+aldg/GVrUyDFRat30=; b=qzzlRsZVDbzVBs7gODwSZorIkgmfttr8Yflr9GWeIGxZzLf7gCiPg6BiUwari3hLQ4 TnWz4bI9nfQFYqiW8itSv0J/0FZAaFvi2VSnLynkAf8NVNJ8YoFISGsnqdacqosN9jOY d7YndcKfzO2q2CytFzYcr/zpaibRZmEm34HoVMvZWoHNrZpohaXYUiFL9AZS6f23TfD7 Wq3EXkh64QWOaklTR56YskicIth0c38m/7UYInMoiGyDDCY9FCR9e1zwptGEcKWpryxN PEx3prO6kEfGF9lrGvqTpcvNdLfRtA3Yjra5f5WoyIhWHIsIqLNwvOhaayprN0ySAlQk dNfQ== X-Forwarded-Encrypted: i=1; AJvYcCUXjr/vGG7mqAV+m8KLIer8FEGTJmhY1ydEunQtg53+iDXQoyqjP2XI9q01GyW3MZ7nqsTb++hSYTmseGI=@vger.kernel.org X-Gm-Message-State: AOJu0YzImOVZH/EI4ADRM13H6cfe1Z8hkr3c/1Sih8Z6DLvnULPyrqH4 fiqcWVfefOcTaLE1473jYeOjNLmEyM7/facW18iaW6ylEtUvO0PVzVt5Qn4/zz/ddcvJ05e0Fx+ ywEwiLg== X-Google-Smtp-Source: AGHT+IFe1Hb6lpRahuVZ4DDC/bHM6yCUrUEOQ+AJ0+tNqmO08JGP6ePh7fxc0X0rMoFvoFsezm94Q0V+zEE6 X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:a267:0:b0:e28:ec75:75ed with SMTP id 3f1490d57ef6-e29780ec57amr6223276.0.1729124744652; Wed, 16 Oct 2024 17:25:44 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:07 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-8-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 07/20] perf dwarf-regs: Move x86 dwarf-regs out of arch From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , 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" Move arch/x86/util/dwarf-regs.c to util/dwarf-regs-x86.c and compile in unconditionally. To avoid get_arch_regnum being duplicated, rename to get_x86_regnum and add to get_dwarf_regnum switch. For get_arch_regstr, this was unused on x86 unless the machine type was EM_NONE. Map that case to EM_HOST and remove get_arch_regstr from dwarf-regs-x86.c. Signed-off-by: Ian Rogers Reviewed-by: Masami Hiramatsu (Google) --- tools/perf/arch/x86/util/Build | 3 --- tools/perf/util/Build | 1 + .../dwarf-regs.c =3D> util/dwarf-regs-x86.c} | 24 +------------------ tools/perf/util/dwarf-regs.c | 17 +++++++++++++ tools/perf/util/include/dwarf-regs.h | 8 +++++++ 5 files changed, 27 insertions(+), 26 deletions(-) rename tools/perf/{arch/x86/util/dwarf-regs.c =3D> util/dwarf-regs-x86.c} = (77%) diff --git a/tools/perf/arch/x86/util/Build b/tools/perf/arch/x86/util/Build index 9705cda4f240..70af491a6dd7 100644 --- a/tools/perf/arch/x86/util/Build +++ b/tools/perf/arch/x86/util/Build @@ -12,9 +12,6 @@ perf-util-y +=3D evsel.o perf-util-y +=3D iostat.o perf-util-y +=3D env.o =20 -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o -perf-util-$(CONFIG_BPF_PROLOGUE) +=3D dwarf-regs.o - perf-util-$(CONFIG_LOCAL_LIBUNWIND) +=3D unwind-libunwind.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o =20 diff --git a/tools/perf/util/Build b/tools/perf/util/Build index 1eedead5f2f2..4c615611b9d7 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -203,6 +203,7 @@ endif perf-util-$(CONFIG_LIBDW) +=3D probe-finder.o perf-util-$(CONFIG_LIBDW) +=3D dwarf-aux.o perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o +perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs-x86.o perf-util-$(CONFIG_LIBDW) +=3D debuginfo.o perf-util-$(CONFIG_LIBDW) +=3D annotate-data.o =20 diff --git a/tools/perf/arch/x86/util/dwarf-regs.c b/tools/perf/util/dwarf-= regs-x86.c similarity index 77% rename from tools/perf/arch/x86/util/dwarf-regs.c rename to tools/perf/util/dwarf-regs-x86.c index 530905118cd4..7a55c65e8da6 100644 --- a/tools/perf/arch/x86/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs-x86.c @@ -11,28 +11,6 @@ #include /* for ARRAY_SIZE */ #include =20 -#define DEFINE_DWARF_REGSTR_TABLE 1 -#include "dwarf-regs-table.h" - -/* Return architecture dependent register string (for kprobe-tracer) */ -const char *get_arch_regstr(unsigned int n) -{ -#if defined(__i386__) - size_t len =3D ARRAY_SIZE(x86_32_regstr_tbl); -#else - size_t len =3D ARRAY_SIZE(x86_64_regstr_tbl); -#endif - - if (n >=3D len) - return NULL; - -#if defined(__i386__) - return x86_32_regstr_tbl[n]; -#else - return x86_64_regstr_tbl[n]; -#endif -} - struct dwarf_regs_idx { const char *name; int idx; @@ -58,7 +36,7 @@ static const struct dwarf_regs_idx x86_regidx_table[] =3D= { { "rip", DWARF_REG_PC }, }; =20 -int get_arch_regnum(const char *name) +int get_x86_regnum(const char *name) { unsigned int i; =20 diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 86b3ef638fbb..eac99a246737 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -32,9 +32,17 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int flags __maybe_unused) { +#if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 + if (machine =3D=3D EM_NONE) { + /* Generic arch - use host arch */ + machine =3D EM_HOST; + } +#endif switch (machine) { +#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); +#endif case EM_386: return __get_dwarf_regstr(x86_32_regstr_tbl, n); case EM_X86_64: @@ -65,10 +73,12 @@ const char *get_dwarf_regstr(unsigned int n, unsigned i= nt machine, return NULL; } =20 +#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 __weak int get_arch_regnum(const char *name __maybe_unused) { return -ENOTSUP; } +#endif =20 /* Return DWARF register number from architecture register name */ int get_dwarf_regnum(const char *name, unsigned int machine, unsigned int = flags __maybe_unused) @@ -90,9 +100,16 @@ int get_dwarf_regnum(const char *name, unsigned int mac= hine, unsigned int flags machine =3D EM_HOST; } switch (machine) { +#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 case EM_HOST: reg =3D get_arch_regnum(regname); break; +#endif + case EM_X86_64: + fallthrough; + case EM_386: + reg =3D get_x86_regnum(regname); + break; default: pr_err("ELF MACHINE %x is not supported.\n", machine); } diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include= /dwarf-regs.h index 925525405e2d..062623aefd5a 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -79,7 +79,10 @@ #define DWARF_REG_FB 0xd3affb /* random number */ =20 #ifdef HAVE_LIBDW_SUPPORT +#if !defined(__x86_64__) && !defined(__i386__) const char *get_arch_regstr(unsigned int n); +#endif + /** * get_dwarf_regstr() - Returns ftrace register string from DWARF regnum. * @n: DWARF register number. @@ -88,7 +91,12 @@ const char *get_arch_regstr(unsigned int n); */ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigne= d int flags); =20 +int get_x86_regnum(const char *name); + +#if !defined(__x86_64__) && !defined(__i386__) int get_arch_regnum(const char *name); +#endif + /* * get_dwarf_regnum - Returns DWARF regnum from register name * name: architecture register name --=20 2.47.0.105.g07ac214952-goog From nobody Tue Nov 26 15:41:46 2024 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.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 8CA1558ACE for ; Thu, 17 Oct 2024 00:25:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124750; cv=none; b=qub2yn5lEKMgfqtK8N6uXuS76xSES4taPZCtyHGenhXtK8cFShl2WwinoDhpcehs+FRJYYQYiAOi6WFC2NIUw2qUY7ZsTJyeaiTftcFWlAdfZ1iU8qepBVaag+vWeDhxVv9wuXTdeSsq4P1WqDNEz9MbucL+uK9GMTK7On0CiKE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124750; c=relaxed/simple; bh=jRBIWpJEX0aE5/ws37l0m5t2Darx3S6uVGOdkwAgjeg=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=Q8R8lYoYtPtat6CQhGIc5V2vGUN2AdqnPt8CYICfZ+yIkruhlN71PKfuzji4fNJdrIAXs5oIbIxjZfArYvDmeOSVoJK9t0BmfWDbG0YHZRIaOJTBRaORFHGTKWpydR8cnbSaxb3YHRLO6HQeD67LX23veuFmnKxxN7Fxvhzxwj4= 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=yENPOAKW; arc=none smtp.client-ip=209.85.219.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="yENPOAKW" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e2605ce4276so775875276.3 for ; Wed, 16 Oct 2024 17:25:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124747; x=1729729547; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=dslSAnjJv4+bi+jw9vLrzNQpv+NsibScELb0cgIuYNw=; b=yENPOAKWHaCIX2xI90PL18Ym8n5chyJ5vVFCYUVDEf8EmCp26NlT96EWqlKF38sU+5 VDjg3JOsXDdo2ZM0bCGbqqP95H98wqiRtnGjwRAhclSL8Yv+Tipd8C9WLhcXc35FPHru CAIeUBoCVEGewBPoWvsQh5rsCTSMKkUENv2Rd++6TdcdLQwRyUqyYEMcHsrbADZbfVU3 XwkllFcePZxaRhKXq65I7z05Zw6hLIKguR/qjLO2eybNBqta052gN7Qugifi+izDh7st n5PQmPnQ3XStBhR6SZHQ5irB+/20Amrwq6/3JDoMwnlgftMhp0dXd2B0DukWnQz/g5nb psIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124747; x=1729729547; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dslSAnjJv4+bi+jw9vLrzNQpv+NsibScELb0cgIuYNw=; b=jOIe4Xnv7WCrZGPJucg2nHqJYJX/8GHmEXoBrz0M06fNXJljEQtDlKqH69kXPI8Ibx PlJYKk2b/XwcaItM8dkvr2zPQ4R/lgTX/PVBbnL9W/Mx86NyjTfRraAs7PpTZQ+6Q8Up ifpz737KBHGJ88mhW2XBPT+zUSl752sxrGeM+0WUs2PujKGrhVgRYXqKXD01WDXWgsET /JO0JuCvkir3mH9vPDare6N1L3URqv8X1+WVmFTf/Vr8c6aim6kCcaO9zRMv64qNKHhf 5ZGZFc2DBAFnyIIkOZ4Hsypy9jd40C/gjOvaCdQLE/YzRRxHZ9oppwZBdApf4bUyB90a v5Ig== X-Forwarded-Encrypted: i=1; AJvYcCW8CH6g3pz9fLVEHFRX1L3tbRznlQSDdXEOr2ORlMYvp7XT61Zn+wBDEeUaoNVTqs5CXSYN28R83Ax9wrk=@vger.kernel.org X-Gm-Message-State: AOJu0Ywr86ZFdM6azZW7RPxON8mRkUX7Pe+ZQwBJgRvu3lYzjCW4JfVf BF27vgdQNiwHEkaDTbKZ6XAJy97Hl8psrF+4dslvx7Arf7V+hfQiHdTqg4jka+rx6pXWUhAG162 oihXkBQ== X-Google-Smtp-Source: AGHT+IGX+xXJQajfsUo21pSiHMMPg3ixWu0rLrNuUSYK4yFL/4dyDAI12MBtvoLY2sM/xxmxtpwsQUR20SGF X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a5b:505:0:b0:e28:8f00:896a with SMTP id 3f1490d57ef6-e2978594c30mr3203276.8.1729124747028; Wed, 16 Oct 2024 17:25:47 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:08 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-9-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 08/20] perf arm64: Remove dwarf-regs.c From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , 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" The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case the function can never be called. So remove as dead code. Tidy up the EM_NONE cases for arm64 in dwarf-regs.c. Signed-off-by: Ian Rogers Reviewed-by: Masami Hiramatsu (Google) --- tools/perf/arch/arm64/util/Build | 1 - tools/perf/arch/arm64/util/dwarf-regs.c | 80 ------------------------- tools/perf/util/dwarf-regs.c | 4 +- tools/perf/util/include/dwarf-regs.h | 2 +- 4 files changed, 3 insertions(+), 84 deletions(-) delete mode 100644 tools/perf/arch/arm64/util/dwarf-regs.c diff --git a/tools/perf/arch/arm64/util/Build b/tools/perf/arch/arm64/util/= Build index 4387a6d6a6c3..a74521b79eaa 100644 --- a/tools/perf/arch/arm64/util/Build +++ b/tools/perf/arch/arm64/util/Build @@ -4,7 +4,6 @@ perf-util-y +=3D perf_regs.o perf-util-y +=3D tsc.o perf-util-y +=3D pmu.o perf-util-$(CONFIG_LIBTRACEEVENT) +=3D kvm-stat.o -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LOCAL_LIBUNWIND) +=3D unwind-libunwind.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o =20 diff --git a/tools/perf/arch/arm64/util/dwarf-regs.c b/tools/perf/arch/arm6= 4/util/dwarf-regs.c deleted file mode 100644 index 343a62fa4199..000000000000 --- a/tools/perf/arch/arm64/util/dwarf-regs.c +++ /dev/null @@ -1,80 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Mapping of DWARF debug register numbers into register names. - * - * Copyright (C) 2010 Will Deacon, ARM Ltd. - */ - -#include -#include -#include -#include -#include - -struct regs_dwarfnum { - const char *name; - unsigned int dwarfnum; -}; - -#define REG_DWARFNUM_NAME(r, num) {.name =3D r, .dwarfnum =3D num} -#define GPR_DWARFNUM_NAME(num) \ - {.name =3D __stringify(%x##num), .dwarfnum =3D num} -#define REG_DWARFNUM_END {.name =3D NULL, .dwarfnum =3D 0} - -/* - * Reference: - * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0057b/IHI0057B_aadw= arf64.pdf - */ -static const struct regs_dwarfnum regdwarfnum_table[] =3D { - GPR_DWARFNUM_NAME(0), - GPR_DWARFNUM_NAME(1), - GPR_DWARFNUM_NAME(2), - GPR_DWARFNUM_NAME(3), - GPR_DWARFNUM_NAME(4), - GPR_DWARFNUM_NAME(5), - GPR_DWARFNUM_NAME(6), - GPR_DWARFNUM_NAME(7), - GPR_DWARFNUM_NAME(8), - GPR_DWARFNUM_NAME(9), - GPR_DWARFNUM_NAME(10), - GPR_DWARFNUM_NAME(11), - GPR_DWARFNUM_NAME(12), - GPR_DWARFNUM_NAME(13), - GPR_DWARFNUM_NAME(14), - GPR_DWARFNUM_NAME(15), - GPR_DWARFNUM_NAME(16), - GPR_DWARFNUM_NAME(17), - GPR_DWARFNUM_NAME(18), - GPR_DWARFNUM_NAME(19), - GPR_DWARFNUM_NAME(20), - GPR_DWARFNUM_NAME(21), - GPR_DWARFNUM_NAME(22), - GPR_DWARFNUM_NAME(23), - GPR_DWARFNUM_NAME(24), - GPR_DWARFNUM_NAME(25), - GPR_DWARFNUM_NAME(26), - GPR_DWARFNUM_NAME(27), - GPR_DWARFNUM_NAME(28), - GPR_DWARFNUM_NAME(29), - REG_DWARFNUM_NAME("%lr", 30), - REG_DWARFNUM_NAME("%sp", 31), - REG_DWARFNUM_END, -}; - -/** - * get_arch_regstr() - lookup register name from it's DWARF register number - * @n: the DWARF register number - * - * get_arch_regstr() returns the name of the register in struct - * regdwarfnum_table from it's DWARF register number. If the register is n= ot - * found in the table, this returns NULL; - */ -const char *get_arch_regstr(unsigned int n) -{ - const struct regs_dwarfnum *roff; - - for (roff =3D regdwarfnum_table; roff->name !=3D NULL; roff++) - if (roff->dwarfnum =3D=3D n) - return roff->name; - return NULL; -} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index eac99a246737..18e916c8e993 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -32,14 +32,14 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int flags __maybe_unused) { -#if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 +#if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; } #endif switch (machine) { -#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 +#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include= /dwarf-regs.h index 062623aefd5a..e640657f69c8 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -79,7 +79,7 @@ #define DWARF_REG_FB 0xd3affb /* random number */ =20 #ifdef HAVE_LIBDW_SUPPORT -#if !defined(__x86_64__) && !defined(__i386__) +#if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) const char *get_arch_regstr(unsigned int n); #endif =20 --=20 2.47.0.105.g07ac214952-goog From nobody Tue Nov 26 15:41:46 2024 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.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 295207DA6C for ; Thu, 17 Oct 2024 00:25:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124752; cv=none; b=hxwP3IsbOIlGwxNK1v9YuRU838xUO//aQ97XI0z2/WtCJhnGoPsiNwNZ8TJRFEvIDZ7g5s9+jTPyQt9Cr9f8H+p/M7o7q+BWIekSzQQ0T+0cYdo5lnifPTgln/ZLSTPOeuL+3FPONtwrZS+vVhzydhNbLN9L1AnhBgjvry8N7l4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124752; c=relaxed/simple; bh=E88/vK7PSoE8AdDUbwthsWB4tdtSnj8cfkVzDkVkl0c=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=Wf2dR7N6rpvnSkcKSlokye1r6TZhoknSZjHJUT4mAls7of4IhDAnFe/qGDZqgQhZCJUJbS9/3ECwUCsYRyYLxa0e/z/rhvorW/7twJh3Qaz+IIXNTfo/56sUkkeSe/aXuI4kSatrmYd5nv1tSXdfT/p3fZNaRj5LLeuboIO3q0M= 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=4OBY6IKw; arc=none smtp.client-ip=209.85.128.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="4OBY6IKw" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6e000d68bb1so17293417b3.1 for ; Wed, 16 Oct 2024 17:25:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124750; x=1729729550; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=um/dxmdAe6wcb5R4JQ4GBtPj+lDN5EAHVRH3aRzp8nM=; b=4OBY6IKw114XeqoKSQq2RnDyEmXwXJLwGEmQUYBB6DyqywTdlazEI/xqksDHz6Oh3E AiNOjE3Vdr6UrDB5/NwbX1BabOaVSjHczMLyV7BrEIgrWYHX6RsN5nxP7zYSMqEbb1Xl A7rNZSWOR9I5taKimr7kLpuddHOWphB6HGimhX/Tx7xFTrwxWzkKNlnrV+kG48mcZZpD 0TiHn7cxyxYX/vGdwOsIYRlOg/oDGwUkRmt54X5QssjBq1XfF/YHbvKlhWwWs7gXn2Wb oMA4f96hi72xVBsj8c80UFmF+oNhEavzlyx1OrCE/HmNYlPtKEXoyTFryHX8V7IxwHjQ bAOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124750; x=1729729550; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=um/dxmdAe6wcb5R4JQ4GBtPj+lDN5EAHVRH3aRzp8nM=; b=wetl8q6ywRQwlpErJ5IFnKWoV/FZwkDAUNQZgGGKgJFKxCwYTteFDvyZ/Bi2ZMKiDN 8NkcGQEOq7XzUZH7r6HeLrNWDZ/1sS/dM7OOj3GersdE6UAARmMtqAJnNmuhInf28Rgy aEQMbpgGTVz2zn6UMt/0YPGNZkFHziISDwMDUEIi6NamPULF+PPCxmQk+QnnVx20ZOsN yBm0At5JKmYp3L5Ru2BE2J0tZYCOI0uf+74FYb+jbjjTSCQ+M9VZooFIWXO3YOx2JHq6 Cb5/YIPT9tj4uJZDFAgFOD8rcrnJdNvruNbaaKZ6gERub5oddiQN9YYzhEZdVjUjSP/D ZwkA== X-Forwarded-Encrypted: i=1; AJvYcCWRydLg8sBLWs75dKnXn9mRuvGkVuoDs4bsjiGj67N7SbUhNMCNlFCiHKIE8DuulpgM/Ft/Nvo4k+dO0V8=@vger.kernel.org X-Gm-Message-State: AOJu0YyugIL9aMg/Q9m1GlQVUqB8Ek75FZWB8WBLTuSYfxA/GNs67pSe 3C4Kmxrh+5XhhS+lP6jk4CyJtzBZZxTZms6UfTtQ5EKfrZbd43wy6btfiQx+IpG01Divt3jiUxR sUUdjdA== X-Google-Smtp-Source: AGHT+IEIO7/kIuzXCKLj4vkEiDjLakQIWKT4RUUiJCfFHJfsVrGiZuOblfcM3qLnbWUnO4MbN9NTPRAGbIyC X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:2e45:0:b0:e20:2da6:ed77 with SMTP id 3f1490d57ef6-e2b9ce95b1bmr2417276.5.1729124749588; Wed, 16 Oct 2024 17:25:49 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:09 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-10-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 09/20] perf arm: Remove dwarf-regs.c From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , 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" The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case the function can never be called. So remove as dead code. Tidy up the EM_NONE cases for arm in dwarf-regs.c. Signed-off-by: Ian Rogers Reviewed-by: Masami Hiramatsu (Google) --- tools/perf/arch/arm/util/Build | 2 - tools/perf/arch/arm/util/dwarf-regs.c | 61 --------------------------- tools/perf/util/dwarf-regs.c | 4 +- tools/perf/util/include/dwarf-regs.h | 2 +- 4 files changed, 3 insertions(+), 66 deletions(-) delete mode 100644 tools/perf/arch/arm/util/dwarf-regs.c diff --git a/tools/perf/arch/arm/util/Build b/tools/perf/arch/arm/util/Build index e06fea1ea8ff..f7a8b37d1c68 100644 --- a/tools/perf/arch/arm/util/Build +++ b/tools/perf/arch/arm/util/Build @@ -1,7 +1,5 @@ perf-util-y +=3D perf_regs.o =20 -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o - perf-util-$(CONFIG_LOCAL_LIBUNWIND) +=3D unwind-libunwind.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o =20 diff --git a/tools/perf/arch/arm/util/dwarf-regs.c b/tools/perf/arch/arm/ut= il/dwarf-regs.c deleted file mode 100644 index fc5f71c91802..000000000000 --- a/tools/perf/arch/arm/util/dwarf-regs.c +++ /dev/null @@ -1,61 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Mapping of DWARF debug register numbers into register names. - * - * Copyright (C) 2010 Will Deacon, ARM Ltd. - */ - -#include -#include -#include - -struct pt_regs_dwarfnum { - const char *name; - unsigned int dwarfnum; -}; - -#define REG_DWARFNUM_NAME(r, num) {.name =3D r, .dwarfnum =3D num} -#define GPR_DWARFNUM_NAME(num) \ - {.name =3D __stringify(%r##num), .dwarfnum =3D num} -#define REG_DWARFNUM_END {.name =3D NULL, .dwarfnum =3D 0} - -/* - * Reference: - * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0040a/IHI0040A_aadw= arf.pdf - */ -static const struct pt_regs_dwarfnum regdwarfnum_table[] =3D { - GPR_DWARFNUM_NAME(0), - GPR_DWARFNUM_NAME(1), - GPR_DWARFNUM_NAME(2), - GPR_DWARFNUM_NAME(3), - GPR_DWARFNUM_NAME(4), - GPR_DWARFNUM_NAME(5), - GPR_DWARFNUM_NAME(6), - GPR_DWARFNUM_NAME(7), - GPR_DWARFNUM_NAME(8), - GPR_DWARFNUM_NAME(9), - GPR_DWARFNUM_NAME(10), - REG_DWARFNUM_NAME("%fp", 11), - REG_DWARFNUM_NAME("%ip", 12), - REG_DWARFNUM_NAME("%sp", 13), - REG_DWARFNUM_NAME("%lr", 14), - REG_DWARFNUM_NAME("%pc", 15), - REG_DWARFNUM_END, -}; - -/** - * get_arch_regstr() - lookup register name from it's DWARF register number - * @n: the DWARF register number - * - * get_arch_regstr() returns the name of the register in struct - * regdwarfnum_table from it's DWARF register number. If the register is n= ot - * found in the table, this returns NULL; - */ -const char *get_arch_regstr(unsigned int n) -{ - const struct pt_regs_dwarfnum *roff; - for (roff =3D regdwarfnum_table; roff->name !=3D NULL; roff++) - if (roff->dwarfnum =3D=3D n) - return roff->name; - return NULL; -} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 18e916c8e993..fd21f9e90e40 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -32,14 +32,14 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int flags __maybe_unused) { -#if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 +#if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; } #endif switch (machine) { -#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 +#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include= /dwarf-regs.h index e640657f69c8..0b533409d82a 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -79,7 +79,7 @@ #define DWARF_REG_FB 0xd3affb /* random number */ =20 #ifdef HAVE_LIBDW_SUPPORT -#if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) +#if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) &&= !defined(__arm__) const char *get_arch_regstr(unsigned int n); #endif =20 --=20 2.47.0.105.g07ac214952-goog From nobody Tue Nov 26 15:41:46 2024 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.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 789177DA7F for ; Thu, 17 Oct 2024 00:25:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124755; cv=none; b=gOU3wY8wtBE1RZtZ0auwOUWeokAj2h1HWpFqihrelJNRhZ5YaePbBy6ulAgNzIlufOjEMM7EFgBbj95XOgr3IIzAlQGPf6T/qGXR1btrencFFBRfbMGkX1mviZ2rARyfudQ/lLkMpyoRMBH6r69xGFt5ysBNe7jm+jZtOfqi7pI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124755; c=relaxed/simple; bh=o0PTiK+y2h1Uws8X+L8gDKhz8hsLaB6wtA4lBZEY35A=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=GDrzNB94Bo2EZ4qesUbyDAuI22pNzsOpyz5U0laJxgiVJs/ZCoWuI3j1d995Klbdj+4eyeYJ5tR+mHcyxiC1zJK580LiWMrkzcdFcfiOQSh8vxxDRakyFF1TNiaXcA8QZnBevhT25ckTPuXFBIMnYeE1dLMlySBKrIStbCWzcLc= 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=WEjkKY1p; arc=none smtp.client-ip=209.85.219.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="WEjkKY1p" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e2946a143efso584655276.1 for ; Wed, 16 Oct 2024 17:25:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124752; x=1729729552; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=WG2Q2FB5LUQz01Yds7IeFcawWLtm3SGWZPYeFSNMQiM=; b=WEjkKY1p1uQlJfkOR6IE2d27rPTmTgeAV3zp7NP8VjjIeZV2ZfrUPMTYrtxWwQFqns IUn8A7Ah/WLGh1iJfQKrw1e+u4PRlCKNTD2eFXj3nG7u3VZ6J+PpmTLcUW9Q+zc8zfai CVT069pyHHVD2rotVyJnIXNCEfz/myxiHPkLLJ141y9eKsPdE7mMbkvZ7dzI1/YodNf3 Z5XeNm5HPRvZvXQMuIDKFT7NjCzYgJ9pSzPL75ySV5EB7qDe1uU2JNQVSBLoifsNT1EE fWxZjEPect2atJoptYOxSzHvRYk/h0gYrA+OVljb1eSSP0vCU+wiceVxRPBnNIDmf2c/ 5UJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124752; x=1729729552; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WG2Q2FB5LUQz01Yds7IeFcawWLtm3SGWZPYeFSNMQiM=; b=IJaeEUSY+ZKsbWLjKfM/2ea28gEh5W1Wuoc3HGsEz37g62t2amG7Nd3UQVh014EVPz 8z2mvhDkC9lXLRjKc5tXN4KpzsbT2hluei1bp08koOOVc98Ghe3TeNN7Oq7SI7L1niUJ 2LgUweIrvfyy96uiaT0T25W3eLOVWG09DL93GTMuNRSqON8l8nuVxl9tzFSZK3fN8ubG oKVyp5mBm+OW6ZZpy1kFawLCALeTjbryPlxnOqQxthFHe54MoR7SbhEkjkJ5djCAsi3s QR99yq9dlh9d67Y6tbGndamC3zgY5idusEEfpLCBCJTAr7s/irD9f+GDVE1VkioarvqQ 0gzw== X-Forwarded-Encrypted: i=1; AJvYcCV5uf8fklngJX2aRRALXo1WCjX1+y40sWn70XtyDPaH/LgseTwwTvC22HgHLMdKf8p5q4upZR4ssCf1ejk=@vger.kernel.org X-Gm-Message-State: AOJu0YzoT73Wb/wI1NQ24g+AvCzyZe1rz2QIDQcqQBJXmP8bTOf1FPXP XFST+n1FG0LmiFJ1eKt2dZq0n3n3SrdfybEGuNml8ihYOVK/cjS77BJr1dUQLhEtXU5MVSUNQLu XTgZa3g== X-Google-Smtp-Source: AGHT+IG59YkLvXbjXDygQC7BU6le1sFVoo2SJFZVP20/F7DRXE23oZyCK22C1Wgez9VaPqSPFNUmUo+ETWGD X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:bd91:0:b0:e0b:f6aa:8088 with SMTP id 3f1490d57ef6-e2b9cdec686mr2964276.1.1729124752310; Wed, 16 Oct 2024 17:25:52 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:10 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-11-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 10/20] perf dwarf-regs: Move csky dwarf-regs out of arch From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , 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" Move arch/csky/util/dwarf-regs.c to util/dwarf-regs-csky.c and compile in unconditionally. To avoid get_arch_regstr being duplicated, rename to get_csky_regstr and add to get_dwarf_regstr switch. Update #ifdefs to allow ABI V1 and V2 tables at the same time. Determine the table from the ELF flags. Signed-off-by: Ian Rogers Reviewed-by: Masami Hiramatsu (Google) --- tools/perf/arch/csky/util/Build | 1 - tools/perf/util/Build | 1 + .../dwarf-regs.c =3D> util/dwarf-regs-csky.c} | 19 ++++++++++--------- tools/perf/util/dwarf-regs.c | 11 +++++++---- tools/perf/util/include/dwarf-regs.h | 2 ++ 5 files changed, 20 insertions(+), 14 deletions(-) rename tools/perf/{arch/csky/util/dwarf-regs.c =3D> util/dwarf-regs-csky.c= } (74%) diff --git a/tools/perf/arch/csky/util/Build b/tools/perf/arch/csky/util/Bu= ild index 1325310cab6a..5e6ea82c4202 100644 --- a/tools/perf/arch/csky/util/Build +++ b/tools/perf/arch/csky/util/Build @@ -1,4 +1,3 @@ perf-util-y +=3D perf_regs.o =20 -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o diff --git a/tools/perf/util/Build b/tools/perf/util/Build index 4c615611b9d7..99ae4e2802b8 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -203,6 +203,7 @@ endif perf-util-$(CONFIG_LIBDW) +=3D probe-finder.o perf-util-$(CONFIG_LIBDW) +=3D dwarf-aux.o perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o +perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs-csky.o perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs-x86.o perf-util-$(CONFIG_LIBDW) +=3D debuginfo.o perf-util-$(CONFIG_LIBDW) +=3D annotate-data.o diff --git a/tools/perf/arch/csky/util/dwarf-regs.c b/tools/perf/util/dwarf= -regs-csky.c similarity index 74% rename from tools/perf/arch/csky/util/dwarf-regs.c rename to tools/perf/util/dwarf-regs-csky.c index ca86ecaeacbb..d38ef1f07f3e 100644 --- a/tools/perf/arch/csky/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs-csky.c @@ -5,9 +5,8 @@ #include #include =20 -#if defined(__CSKYABIV2__) -#define CSKY_MAX_REGS 73 -const char *csky_dwarf_regs_table[CSKY_MAX_REGS] =3D { +#define CSKY_ABIV2_MAX_REGS 73 +const char *csky_dwarf_regs_table_abiv2[CSKY_ABIV2_MAX_REGS] =3D { /* r0 ~ r8 */ "%a0", "%a1", "%a2", "%a3", "%regs0", "%regs1", "%regs2", "%regs3", /* r9 ~ r15 */ @@ -26,9 +25,9 @@ const char *csky_dwarf_regs_table[CSKY_MAX_REGS] =3D { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "%epc", }; -#else -#define CSKY_MAX_REGS 57 -const char *csky_dwarf_regs_table[CSKY_MAX_REGS] =3D { + +#define CSKY_ABIV1_MAX_REGS 57 +const char *csky_dwarf_regs_table_abiv1[CSKY_ABIV1_MAX_REGS] =3D { /* r0 ~ r8 */ "%sp", "%regs9", "%a0", "%a1", "%a2", "%a3", "%regs0", "%regs1", /* r9 ~ r15 */ @@ -41,9 +40,11 @@ const char *csky_dwarf_regs_table[CSKY_MAX_REGS] =3D { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "%epc", }; -#endif =20 -const char *get_arch_regstr(unsigned int n) +const char *get_csky_regstr(unsigned int n, unsigned int flags) { - return (n < CSKY_MAX_REGS) ? csky_dwarf_regs_table[n] : NULL; + if (flags & EF_CSKY_ABIV2) + return (n < CSKY_ABIV2_MAX_REGS) ? csky_dwarf_regs_table_abiv2[n] : NULL; + + return (n < CSKY_ABIV1_MAX_REGS) ? csky_dwarf_regs_table_abiv1[n] : NULL; } diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index fd21f9e90e40..9a76f83af62c 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -29,17 +29,18 @@ #define __get_dwarf_regstr(tbl, n) (((n) < ARRAY_SIZE(tbl)) ? (tbl)[(n)] := NULL) =20 /* Return architecture dependent register string (for kprobe-tracer) */ -const char *get_dwarf_regstr(unsigned int n, unsigned int machine, - unsigned int flags __maybe_unused) +const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigne= d int flags) { -#if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM +#if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM \ + || EM_HOST =3D=3D EM_CSKY if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; } #endif switch (machine) { -#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM +#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM \ + && EM_HOST !=3D EM_CSKY case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif @@ -51,6 +52,8 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int= machine, return __get_dwarf_regstr(arm_regstr_tbl, n); case EM_AARCH64: return __get_dwarf_regstr(aarch64_regstr_tbl, n); + case EM_CSKY: + return get_csky_regstr(n, flags); case EM_SH: return __get_dwarf_regstr(sh_regstr_tbl, n); case EM_S390: diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include= /dwarf-regs.h index 0b533409d82a..b72d9d308ce4 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -83,6 +83,8 @@ const char *get_arch_regstr(unsigned int n); #endif =20 +const char *get_csky_regstr(unsigned int n, unsigned int flags); + /** * get_dwarf_regstr() - Returns ftrace register string from DWARF regnum. * @n: DWARF register number. --=20 2.47.0.105.g07ac214952-goog From nobody Tue Nov 26 15:41:46 2024 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (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 ED36713AD33 for ; Thu, 17 Oct 2024 00:25:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124757; cv=none; b=YPu8w8SY7B3FUdafA8RaK1YYeuZ7zzLnTDGb5V0pONMfF6K8QpicCQpa2bssa9i12kwQbDEVVreW7f3+cdy1uOI9cn1t5eog50lAN2qG+6gsLgP/CMRz56tdn0ywfJepoHUZe7YQd70GR6v0eJByex6VmUmXj3iANwBj3eZ8fQ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124757; c=relaxed/simple; bh=yB9luoxNfz1ZB0ZSIvo+9O35nSVN9IWONPN5tQ/jUuA=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=hbEk/ZHrGtLhLZOLk1MnvmnnqrPq8jy7vLxa/s/YntT+MtBO/KLEQL1eZwYaiK5KUaiz2w09stVWMLlLV7bhOJF6KY7cW/ZBS7X/gtb0/leqmMsu4TPWYuOPyUWKGCjfragnBiA6bmTRkosZQ2Y4eINtaLaQHOm5cE+1dCMJsHA= 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=K9jXfHP1; arc=none smtp.client-ip=209.85.128.201 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="K9jXfHP1" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e321d26b38so9563467b3.2 for ; Wed, 16 Oct 2024 17:25:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124755; x=1729729555; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=qQMh1GkNDXXWwo5/jydOz7DZ+MfVb3HK+m6RjxS97PU=; b=K9jXfHP1iY8/o9jrCqS44Xut4mXRrFfWdo56ol40WuaD9crx62hU6ExM90BaUlxw6Z tUtmVincZMUH8zJACzB8uB0Y58/fwANdqNHIBXSniIBuZlre78nRy8YwyQcBR3V0BGKQ NS1AEegQB/hwGngEkeHDExGkQ+YMJxot0t+Z1o6vUH+Brpw9lQHHgS8blpnmyvgXDa27 n+NPdRs4CJeuTnWLnw1+vgXFB2qPCMZnW5nZAHVD6fwdFoHy3Mvr87nQYzc8GX4b/VqD M1WzOs2yywAcHfJsn/a47Zq/Eg3n7eKJ6a0EbvGZKUOj47Py+ViQu+9W+frtt+PtoXUP GMHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124755; x=1729729555; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qQMh1GkNDXXWwo5/jydOz7DZ+MfVb3HK+m6RjxS97PU=; b=rNS6g2x5AysZbMYZw6dMDFgYOAI+WC8srHv8+6ZxWQYdDmwQRFAn/nG/uFv+PSdOPr 0K3/1rpJLpmv4Z9qtXMpCWrE0DBXBZCeva0OazC1p98+bbALh4YnSvE8pLWDId7UjeBE 9LNJCfXpKv4sK0OaKhGmL25Yjybvsl1Mbg0zrNpR3lgo7qUc2Kjj3ng5Mj/BVZ2qA851 +mI5pj5SZaigLKEI5wd5gCnkAg09Pio+EiWlLtKUxDj1GXMa3W1S0AxWsSvSjzWrcFCb UFYYRh08Zxy7fHw6f8qAXdOMv+/19jznQ3KTOlQSrRuU7YyGNi1ppyN0q5z2bho2T2S7 CraA== X-Forwarded-Encrypted: i=1; AJvYcCWmYNDkrieT2WgLiKLEPE9HsUkLtqU15P0mphjjfol0aq83v557YSglT6wxxHtmK7jjt3Qx49xKH2e7xZY=@vger.kernel.org X-Gm-Message-State: AOJu0Yyi9zx0LJt0+saueZz/zo09RNZHiojnSNBBaU07uaXam1Ojbktr Y5GsPQioCiuqAuzh8k9eB4PineqtOFRLR4AN5yy/LCsdd0QlW5NMR+U6PwDwp0OIDo5KQsKArq4 uA/fOiA== X-Google-Smtp-Source: AGHT+IFbm6vwQJDAC4QPC5+PLfr8ycUWXoPY5PpZT0CV0PYSnLWVe//zo2w300WIdP2MxiCfoWlmNy3scmw0 X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a0d:c405:0:b0:6b2:3ecc:817 with SMTP id 00721157ae682-6e3d41eb817mr501607b3.8.1729124754732; Wed, 16 Oct 2024 17:25:54 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:11 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-12-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 11/20] perf loongarch: Remove dwarf-regs.c From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , 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" The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case the function can never be called. So remove as dead code. Tidy up the EM_NONE cases for loongarch in dwarf-regs.c. Signed-off-by: Ian Rogers Reviewed-by: Masami Hiramatsu (Google) --- tools/perf/arch/loongarch/util/Build | 1 - tools/perf/arch/loongarch/util/dwarf-regs.c | 34 --------------------- tools/perf/util/dwarf-regs.c | 4 +-- tools/perf/util/include/dwarf-regs.h | 3 +- 4 files changed, 4 insertions(+), 38 deletions(-) delete mode 100644 tools/perf/arch/loongarch/util/dwarf-regs.c diff --git a/tools/perf/arch/loongarch/util/Build b/tools/perf/arch/loongar= ch/util/Build index 06ff95394921..0aa31986ecb5 100644 --- a/tools/perf/arch/loongarch/util/Build +++ b/tools/perf/arch/loongarch/util/Build @@ -1,7 +1,6 @@ perf-util-y +=3D header.o perf-util-y +=3D perf_regs.o =20 -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LOCAL_LIBUNWIND) +=3D unwind-libunwind.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o perf-util-$(CONFIG_LIBTRACEEVENT) +=3D kvm-stat.o diff --git a/tools/perf/arch/loongarch/util/dwarf-regs.c b/tools/perf/arch/= loongarch/util/dwarf-regs.c deleted file mode 100644 index bee08fdcf2fd..000000000000 --- a/tools/perf/arch/loongarch/util/dwarf-regs.c +++ /dev/null @@ -1,34 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * dwarf-regs.c : Mapping of DWARF debug register numbers into register na= mes. - * - * Copyright (C) 2020-2023 Loongson Technology Corporation Limited - */ - -#include -#include /* for EINVAL */ -#include /* for strcmp */ -#include - -struct pt_regs_dwarfnum { - const char *name; - unsigned int dwarfnum; -}; - -static struct pt_regs_dwarfnum loongarch_gpr_table[] =3D { - {"%r0", 0}, {"%r1", 1}, {"%r2", 2}, {"%r3", 3}, - {"%r4", 4}, {"%r5", 5}, {"%r6", 6}, {"%r7", 7}, - {"%r8", 8}, {"%r9", 9}, {"%r10", 10}, {"%r11", 11}, - {"%r12", 12}, {"%r13", 13}, {"%r14", 14}, {"%r15", 15}, - {"%r16", 16}, {"%r17", 17}, {"%r18", 18}, {"%r19", 19}, - {"%r20", 20}, {"%r21", 21}, {"%r22", 22}, {"%r23", 23}, - {"%r24", 24}, {"%r25", 25}, {"%r26", 26}, {"%r27", 27}, - {"%r28", 28}, {"%r29", 29}, {"%r30", 30}, {"%r31", 31}, - {NULL, 0} -}; - -const char *get_arch_regstr(unsigned int n) -{ - n %=3D 32; - return loongarch_gpr_table[n].name; -} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 9a76f83af62c..efc41d0fbee9 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -32,7 +32,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigne= d int flags) { #if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM \ - || EM_HOST =3D=3D EM_CSKY + || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; @@ -40,7 +40,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int= machine, unsigned int #endif switch (machine) { #if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM \ - && EM_HOST !=3D EM_CSKY + && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include= /dwarf-regs.h index b72d9d308ce4..4f205a58db89 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -79,7 +79,8 @@ #define DWARF_REG_FB 0xd3affb /* random number */ =20 #ifdef HAVE_LIBDW_SUPPORT -#if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) &&= !defined(__arm__) +#if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) &&= !defined(__arm__) \ + && !defined(__loongarch__) const char *get_arch_regstr(unsigned int n); #endif =20 --=20 2.47.0.105.g07ac214952-goog From nobody Tue Nov 26 15:41:46 2024 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.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 5586013CA99 for ; Thu, 17 Oct 2024 00:25:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124759; cv=none; b=cEHGcyV4Nyd+NP+jIt7cV8gZMVx6BV5Z2TbXDLXceyAH/rfEJ134Au9m12CiqBCiepDA4sCAZqRY/DQ7GByVlNhXBB2NoI3Vz6wkMijzWc4DcYpm2aSuAUWNrI4RaqfnzJJDvewQRSpR3yKxSzqfrWNmB6/yETsCA25K3qTpKa4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124759; c=relaxed/simple; bh=ewP1pd5x/QdaYYTA7ggjdp8xLh0lFpl3Jzu/cc1pukU=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=WRmFHftEicXvsFevKP15G0vf/jkjo/06MtVMbfgMY3KL+AyCQyVq6IxqXy1hm0O5d7w1acJOl+/LccnxeddueP/GUD5xL8pUxizsci4DpT8iGJhQWBYk2r2WdWDycCzU2atItaz0xGnbSs3iVOEQThAzZfkzLMbW/4T7z4BQFUg= 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=nG5MZP7s; arc=none smtp.client-ip=209.85.128.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="nG5MZP7s" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6e3497c8eb0so5601837b3.0 for ; Wed, 16 Oct 2024 17:25:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124757; x=1729729557; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=d1gwdO3+1z4qg/OPZ1ChVHm0fXT+3tjeEKhF61J/sGo=; b=nG5MZP7spmkQaGsxglkzeE2BYWq5qVtABBly0B59VlDVWRCyvf3EGjQNuwN085kme5 KwgwYZStLuGpY1yZ/TWcxXvvcSnGRidVmR+TKYCu394LvY2bdRCwRR6hfgGYWV699xuD f+tYPm6alTlBZvd7SanqDH84BSM3KuX+5cVDA/D662Pqz4ffjuK9YN/qtEsQRSoRTjri QLX3tQ7EDnmMAaKjROvzzcrBXP+1lZ2vAxXXrP+GQ6uPjf1UUkj/mOfAeqYR3SWX2lZM 0+hY6s3CJXzU5YDJUD1WCXvhZd+4c0qsPjlsEI6aLlYweOlmQTCImE97HkwIyE9iWbSQ oRRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124757; x=1729729557; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=d1gwdO3+1z4qg/OPZ1ChVHm0fXT+3tjeEKhF61J/sGo=; b=FXZXZ+pyQk+8JfU61SkTwJC7KUj5C9das2X+m2SO2pI0ZYqncHhoatMrrWWfyWb2/v 7dTj0XoBski+SP/vu+MUD382mPMHU31QlAaxUYuzkx8bj0RRlTWoq631EF2H/46zefMf qeXZVraxGSx7amhvxIE6wmAMOFrCLWWH7BjPehtf92ywiZFjALD7RHpt2Xeap29G8Qyb 5RK42NeMHzp+W5mj09WkLVehRihY7mhflmbijWLvcRhfR1iPPCwZNHZ99O9+mjYGRflY NNvZrny6pBYLtQUEE1UUWa3jcxSFyl9PKPzIVjZMVrsU8nCQAY7aJGNemwCtstpFw7kn xbRw== X-Forwarded-Encrypted: i=1; AJvYcCWjR54eqtN50L6OTq9TthTUWhu5xH9w+Z9s+ws8boZQJyAgcGFD6WB0cvaw6rAr4qlNMAnGlcmvAn9U9oo=@vger.kernel.org X-Gm-Message-State: AOJu0YzADtZuQwvbSoob+/1b1GBsDXrT/QDL+SzgDdBXMr8EEwNG8yIU 6B5r8UphGMBeYuzSm34+t21wRFjVPdpkFs15tVxnFBrDAH46hihvE+k5vKl4xz7yO5AnAlNAsBw jYObmZg== X-Google-Smtp-Source: AGHT+IEOn1sxy9x0RhzE2O4lUwxI35kyyV2nRBroxh4Xt3euuArl/KNycbORbJCMSm8H+wpY0Zuqg0FylbxQ X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a05:690c:2d04:b0:6e2:c1c7:ec27 with SMTP id 00721157ae682-6e5a3d1cb28mr93127b3.1.1729124757072; Wed, 16 Oct 2024 17:25:57 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:12 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-13-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 12/20] perf mips: Remove dwarf-regs.c From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , 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" The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case the function can never be called. So remove as dead code. Tidy up the EM_NONE cases for mips in dwarf-regs.c. Signed-off-by: Ian Rogers Reviewed-by: Masami Hiramatsu (Google) --- tools/perf/arch/mips/util/Build | 1 - tools/perf/arch/mips/util/dwarf-regs.c | 38 -------------------------- tools/perf/util/dwarf-regs.c | 4 +-- tools/perf/util/include/dwarf-regs.h | 2 +- 4 files changed, 3 insertions(+), 42 deletions(-) delete mode 100644 tools/perf/arch/mips/util/dwarf-regs.c diff --git a/tools/perf/arch/mips/util/Build b/tools/perf/arch/mips/util/Bu= ild index b328109fc16c..691fa2051958 100644 --- a/tools/perf/arch/mips/util/Build +++ b/tools/perf/arch/mips/util/Build @@ -1,3 +1,2 @@ perf-util-y +=3D perf_regs.o -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LOCAL_LIBUNWIND) +=3D unwind-libunwind.o diff --git a/tools/perf/arch/mips/util/dwarf-regs.c b/tools/perf/arch/mips/= util/dwarf-regs.c deleted file mode 100644 index 25c13a91c2a7..000000000000 --- a/tools/perf/arch/mips/util/dwarf-regs.c +++ /dev/null @@ -1,38 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * dwarf-regs.c : Mapping of DWARF debug register numbers into register na= mes. - * - * Copyright (C) 2013 Cavium, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include -#include - -static const char *mips_gpr_names[32] =3D { - "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9", - "$10", "$11", "$12", "$13", "$14", "$15", "$16", "$17", "$18", "$19", - "$20", "$21", "$22", "$23", "$24", "$25", "$26", "$27", "$28", "$29", - "$30", "$31" -}; - -const char *get_arch_regstr(unsigned int n) -{ - if (n < 32) - return mips_gpr_names[n]; - if (n =3D=3D 64) - return "hi"; - if (n =3D=3D 65) - return "lo"; - return NULL; -} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index efc41d0fbee9..d536964df43c 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -32,7 +32,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigne= d int flags) { #if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM \ - || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH + || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH || EM_HOST = =3D=3D EM_MIPS if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; @@ -40,7 +40,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int= machine, unsigned int #endif switch (machine) { #if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM \ - && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH + && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH && EM_HOST !=3D E= M_MIPS case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include= /dwarf-regs.h index 4f205a58db89..1f771b635789 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -80,7 +80,7 @@ =20 #ifdef HAVE_LIBDW_SUPPORT #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) &&= !defined(__arm__) \ - && !defined(__loongarch__) + && !defined(__loongarch__) && !defined(__mips__) const char *get_arch_regstr(unsigned int n); #endif =20 --=20 2.47.0.105.g07ac214952-goog From nobody Tue Nov 26 15:41:46 2024 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.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 8AC461509B6 for ; Thu, 17 Oct 2024 00:26:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124762; cv=none; b=uos47LXka0okxEw8eRM3Wq/2ohegOY6JYXXQppKvfhHmSnTODszmTr/CYJOl3D/E4tmdaufPMDeaaUDAe9IeWmZGKdNDkghQt2yNr97aR5Njh6/OMbk+WofDG9gocTJ/nrwkmWdyOwrpYPb5Hn5YTYrUnnnrDrgzzIt1Iu7Vl/A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124762; c=relaxed/simple; bh=CIe3OBX0NdSwNlIPGLEr+JjLzoSC/IFPUQ3KAr8b9IM=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=W+Us0e0jkxY+Qn+sSYQ0EY5Z007VC3lZPORmmop3uaqufUR4EzZxKjHnk9PKs7L08KdlCFpX3eFJ3oQzrrwryTlTZq2GqTPMm8dnEHYGDZ+VSkwY6aJbTjfPE5EUgdCQ4RoZoXSIUPirBLV2UWBOwhejavBVkiiKTWfA6ZLzyf4= 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=DwaMb7m4; arc=none smtp.client-ip=209.85.128.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="DwaMb7m4" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6e370139342so8571137b3.3 for ; Wed, 16 Oct 2024 17:26:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124759; x=1729729559; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=458YiwCEQu0xyWW32bw076GTqYPd++B/pRRG623ToYM=; b=DwaMb7m4UI17WY0yStGILpx5gBTyf7CGvajogBz/55MpdrbTLLZcqU5ZpORzt4oFHR 7WMIhicOfIO+AP9t0cdTZOwMhJp3Jdb6YmYRfQA7oLi8L84JU/nM3jVUmY5wsbk43O6l um2aURNTWQ8oNjQpQghk0lslTJRgvYGEcXXNMGaqNPG0geCO2IpJ56dx8V35uXe9+w8l Hh7JbHb5kH6NM1LGxroloUpWqXz8gHkZP2CbbvfVnCOjSAsEqfKB+t5h6GHP6HI/JyWw yRYI3/lEQjsOSZCrJZhAWhdgNFpDmg08kIJKIJQ+FqE2ziDgiCYnCfy8aocAgPX6DtSl SzUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124759; x=1729729559; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=458YiwCEQu0xyWW32bw076GTqYPd++B/pRRG623ToYM=; b=TR/8aOaNRvcODjgCy0g7ywarKPFfqgzFMKUDXFurKNUpnKXi21L4YD8O6C+iHjLKZz 78CK0NOvtAvP2u7DBETcpMTBOCWnJM/Nhko/2okz5SpvztQuN5BocsHriPzWom1leDgi 8UHGPsYNmYytYqQPF7DpvYemUuLfzhJxf6xceHfyI6JRa3O2e1DNALDJN975bifyvfv3 5cBwbxywOQe/KYOb3RfFvsHmrDiDnYtCF75lrjgdHOSQks+oaiu2zjlu8Fxdd9XQvDrz CYkdqP4qXmIFSOI6uklhECfoWHLmuZubozYm1i3xYh/c7vW9xvfVieftsiQXaHMt1J9o /Vfg== X-Forwarded-Encrypted: i=1; AJvYcCWAERQ7a1G0c6CWOc+fZu8JqkXUlTKRn5f5yuJQdphaJk2Y3lALWG03zL3N7QC2Z4eqYXVJhrXCzWVSGWM=@vger.kernel.org X-Gm-Message-State: AOJu0Yx8ZcyGG3UjkwGy6dQCLcK/Q4jMy30yH5hTJEs2Eeme60mwlc2Q lAyQEMkJoHRzxkZYXz2OECb9wGknxglAJ7LUBIlcPoqKFyyGzS2w0ch4BN5sipsJVwTx5zAW8sz WpA3ptg== X-Google-Smtp-Source: AGHT+IHe2nHx8WZSMOYKcxMW4gIJHHBFN2zTVNS46VHOfujhdM1R4tNVwqUCaJ+215uPJw6HHmJzRBUSoCC9 X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a05:690c:3345:b0:6e3:d670:f603 with SMTP id 00721157ae682-6e3d670fa35mr870367b3.3.1729124759496; Wed, 16 Oct 2024 17:25:59 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:13 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-14-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 13/20] perf dwarf-regs: Move powerpc dwarf-regs out of arch From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , 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" Move arch/powerpc/util/dwarf-regs.c to util/dwarf-regs-powerpc.c and compile in unconditionally. get_arch_regstr is redundant when EM_NONE is treated as EM_HOST so remove and update dwarf-regs.c conditions. Make get_powerpc_regs unconditionally available whwn libdw is. Signed-off-by: Ian Rogers Reviewed-by: Masami Hiramatsu (Google) --- tools/perf/arch/powerpc/util/Build | 1 - tools/perf/arch/powerpc/util/dwarf-regs.c | 141 ---------------------- tools/perf/util/Build | 1 + tools/perf/util/dwarf-regs-powerpc.c | 61 ++++++++++ tools/perf/util/dwarf-regs.c | 6 +- tools/perf/util/include/dwarf-regs.h | 9 +- 6 files changed, 70 insertions(+), 149 deletions(-) delete mode 100644 tools/perf/arch/powerpc/util/dwarf-regs.c create mode 100644 tools/perf/util/dwarf-regs-powerpc.c diff --git a/tools/perf/arch/powerpc/util/Build b/tools/perf/arch/powerpc/u= til/Build index 3d979480a188..ed82715080f9 100644 --- a/tools/perf/arch/powerpc/util/Build +++ b/tools/perf/arch/powerpc/util/Build @@ -7,7 +7,6 @@ perf-util-y +=3D sym-handling.o perf-util-y +=3D evsel.o perf-util-y +=3D event.o =20 -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LIBDW) +=3D skip-callchain-idx.o =20 perf-util-$(CONFIG_LIBUNWIND) +=3D unwind-libunwind.o diff --git a/tools/perf/arch/powerpc/util/dwarf-regs.c b/tools/perf/arch/po= werpc/util/dwarf-regs.c deleted file mode 100644 index 23846c59a522..000000000000 --- a/tools/perf/arch/powerpc/util/dwarf-regs.c +++ /dev/null @@ -1,141 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Mapping of DWARF debug register numbers into register names. - * - * Copyright (C) 2010 Ian Munsie, IBM Corporation. - */ - -#include -#include -#include -#include -#include -#include - -struct regs_dwarfnum { - const char *name; - unsigned int dwarfnum; -}; - -#define REG_DWARFNUM_NAME(r, num) \ - {.name =3D __stringify(%)__stringify(r), .dwarfnum =3D num} -#define GPR_DWARFNUM_NAME(num) \ - {.name =3D __stringify(%gpr##num), .dwarfnum =3D num} -#define REG_DWARFNUM_END {.name =3D NULL, .dwarfnum =3D 0} - -/* - * Reference: - * http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html - */ -static const struct regs_dwarfnum regdwarfnum_table[] =3D { - GPR_DWARFNUM_NAME(0), - GPR_DWARFNUM_NAME(1), - GPR_DWARFNUM_NAME(2), - GPR_DWARFNUM_NAME(3), - GPR_DWARFNUM_NAME(4), - GPR_DWARFNUM_NAME(5), - GPR_DWARFNUM_NAME(6), - GPR_DWARFNUM_NAME(7), - GPR_DWARFNUM_NAME(8), - GPR_DWARFNUM_NAME(9), - GPR_DWARFNUM_NAME(10), - GPR_DWARFNUM_NAME(11), - GPR_DWARFNUM_NAME(12), - GPR_DWARFNUM_NAME(13), - GPR_DWARFNUM_NAME(14), - GPR_DWARFNUM_NAME(15), - GPR_DWARFNUM_NAME(16), - GPR_DWARFNUM_NAME(17), - GPR_DWARFNUM_NAME(18), - GPR_DWARFNUM_NAME(19), - GPR_DWARFNUM_NAME(20), - GPR_DWARFNUM_NAME(21), - GPR_DWARFNUM_NAME(22), - GPR_DWARFNUM_NAME(23), - GPR_DWARFNUM_NAME(24), - GPR_DWARFNUM_NAME(25), - GPR_DWARFNUM_NAME(26), - GPR_DWARFNUM_NAME(27), - GPR_DWARFNUM_NAME(28), - GPR_DWARFNUM_NAME(29), - GPR_DWARFNUM_NAME(30), - GPR_DWARFNUM_NAME(31), - REG_DWARFNUM_NAME(msr, 66), - REG_DWARFNUM_NAME(ctr, 109), - REG_DWARFNUM_NAME(link, 108), - REG_DWARFNUM_NAME(xer, 101), - REG_DWARFNUM_NAME(dar, 119), - REG_DWARFNUM_NAME(dsisr, 118), - REG_DWARFNUM_END, -}; - -/** - * get_arch_regstr() - lookup register name from it's DWARF register number - * @n: the DWARF register number - * - * get_arch_regstr() returns the name of the register in struct - * regdwarfnum_table from it's DWARF register number. If the register is n= ot - * found in the table, this returns NULL; - */ -const char *get_arch_regstr(unsigned int n) -{ - const struct regs_dwarfnum *roff; - - for (roff =3D regdwarfnum_table; roff->name !=3D NULL; roff++) - if (roff->dwarfnum =3D=3D n) - return roff->name; - return NULL; -} - -#define PPC_OP(op) (((op) >> 26) & 0x3F) -#define PPC_RA(a) (((a) >> 16) & 0x1f) -#define PPC_RT(t) (((t) >> 21) & 0x1f) -#define PPC_RB(b) (((b) >> 11) & 0x1f) -#define PPC_D(D) ((D) & 0xfffe) -#define PPC_DS(DS) ((DS) & 0xfffc) -#define OP_LD 58 -#define OP_STD 62 - -static int get_source_reg(u32 raw_insn) -{ - return PPC_RA(raw_insn); -} - -static int get_target_reg(u32 raw_insn) -{ - return PPC_RT(raw_insn); -} - -static int get_offset_opcode(u32 raw_insn) -{ - int opcode =3D PPC_OP(raw_insn); - - /* DS- form */ - if ((opcode =3D=3D OP_LD) || (opcode =3D=3D OP_STD)) - return PPC_DS(raw_insn); - else - return PPC_D(raw_insn); -} - -/* - * Fills the required fields for op_loc depending on if it - * is a source or target. - * D form: ins RT,D(RA) -> src_reg1 =3D RA, offset =3D D, dst_reg1 =3D RT - * DS form: ins RT,DS(RA) -> src_reg1 =3D RA, offset =3D DS, dst_reg1 =3D = RT - * X form: ins RT,RA,RB -> src_reg1 =3D RA, src_reg2 =3D RB, dst_reg1 =3D = RT - */ -void get_powerpc_regs(u32 raw_insn, int is_source, - struct annotated_op_loc *op_loc) -{ - if (is_source) - op_loc->reg1 =3D get_source_reg(raw_insn); - else - op_loc->reg1 =3D get_target_reg(raw_insn); - - if (op_loc->multi_regs) - op_loc->reg2 =3D PPC_RB(raw_insn); - - /* TODO: Implement offset handling for X Form */ - if ((op_loc->mem_ref) && (PPC_OP(raw_insn) !=3D 31)) - op_loc->offset =3D get_offset_opcode(raw_insn); -} diff --git a/tools/perf/util/Build b/tools/perf/util/Build index 99ae4e2802b8..eeab8684ddcc 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -204,6 +204,7 @@ perf-util-$(CONFIG_LIBDW) +=3D probe-finder.o perf-util-$(CONFIG_LIBDW) +=3D dwarf-aux.o perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs-csky.o +perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs-powerpc.o perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs-x86.o perf-util-$(CONFIG_LIBDW) +=3D debuginfo.o perf-util-$(CONFIG_LIBDW) +=3D annotate-data.o diff --git a/tools/perf/util/dwarf-regs-powerpc.c b/tools/perf/util/dwarf-r= egs-powerpc.c new file mode 100644 index 000000000000..caf77a234c78 --- /dev/null +++ b/tools/perf/util/dwarf-regs-powerpc.c @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Mapping of DWARF debug register numbers into register names. + * + * Copyright (C) 2010 Ian Munsie, IBM Corporation. + */ + +#include + +#define PPC_OP(op) (((op) >> 26) & 0x3F) +#define PPC_RA(a) (((a) >> 16) & 0x1f) +#define PPC_RT(t) (((t) >> 21) & 0x1f) +#define PPC_RB(b) (((b) >> 11) & 0x1f) +#define PPC_D(D) ((D) & 0xfffe) +#define PPC_DS(DS) ((DS) & 0xfffc) +#define OP_LD 58 +#define OP_STD 62 + +static int get_source_reg(u32 raw_insn) +{ + return PPC_RA(raw_insn); +} + +static int get_target_reg(u32 raw_insn) +{ + return PPC_RT(raw_insn); +} + +static int get_offset_opcode(u32 raw_insn) +{ + int opcode =3D PPC_OP(raw_insn); + + /* DS- form */ + if ((opcode =3D=3D OP_LD) || (opcode =3D=3D OP_STD)) + return PPC_DS(raw_insn); + else + return PPC_D(raw_insn); +} + +/* + * Fills the required fields for op_loc depending on if it + * is a source or target. + * D form: ins RT,D(RA) -> src_reg1 =3D RA, offset =3D D, dst_reg1 =3D RT + * DS form: ins RT,DS(RA) -> src_reg1 =3D RA, offset =3D DS, dst_reg1 =3D = RT + * X form: ins RT,RA,RB -> src_reg1 =3D RA, src_reg2 =3D RB, dst_reg1 =3D = RT + */ +void get_powerpc_regs(u32 raw_insn, int is_source, + struct annotated_op_loc *op_loc) +{ + if (is_source) + op_loc->reg1 =3D get_source_reg(raw_insn); + else + op_loc->reg1 =3D get_target_reg(raw_insn); + + if (op_loc->multi_regs) + op_loc->reg2 =3D PPC_RB(raw_insn); + + /* TODO: Implement offset handling for X Form */ + if ((op_loc->mem_ref) && (PPC_OP(raw_insn) !=3D 31)) + op_loc->offset =3D get_offset_opcode(raw_insn); +} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index d536964df43c..3d98c2bf6035 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -32,7 +32,8 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigne= d int flags) { #if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM \ - || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH || EM_HOST = =3D=3D EM_MIPS + || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH || EM_HOST = =3D=3D EM_MIPS || EM_HOST =3D=3D EM_PPC \ + || EM_HOST =3D=3D EM_PPC64 if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; @@ -40,7 +41,8 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int= machine, unsigned int #endif switch (machine) { #if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM \ - && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH && EM_HOST !=3D E= M_MIPS + && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH && EM_HOST !=3D E= M_MIPS && EM_HOST !=3D EM_PPC \ + && EM_HOST !=3D EM_PPC64 case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include= /dwarf-regs.h index 1f771b635789..1763280855ce 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -80,7 +80,8 @@ =20 #ifdef HAVE_LIBDW_SUPPORT #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) &&= !defined(__arm__) \ - && !defined(__loongarch__) && !defined(__mips__) + && !defined(__loongarch__) && !defined(__mips__) && !defined(__powerpc= __) \ + && !defined(__powerpc64__) const char *get_arch_regstr(unsigned int n); #endif =20 @@ -107,6 +108,8 @@ int get_arch_regnum(const char *name); */ int get_dwarf_regnum(const char *name, unsigned int machine, unsigned int = flags); =20 +void get_powerpc_regs(u32 raw_insn, int is_source, struct annotated_op_loc= *op_loc); + #else /* HAVE_LIBDW_SUPPORT */ =20 static inline int get_dwarf_regnum(const char *name __maybe_unused, @@ -115,16 +118,12 @@ static inline int get_dwarf_regnum(const char *name _= _maybe_unused, { return -1; } -#endif =20 -#if !defined(__powerpc__) || !defined(HAVE_LIBDW_SUPPORT) static inline void get_powerpc_regs(u32 raw_insn __maybe_unused, int is_so= urce __maybe_unused, struct annotated_op_loc *op_loc __maybe_unused) { return; } -#else -void get_powerpc_regs(u32 raw_insn, int is_source, struct annotated_op_loc= *op_loc); #endif =20 #endif --=20 2.47.0.105.g07ac214952-goog From nobody Tue Nov 26 15:41:46 2024 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.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 A8C7716D4E6 for ; Thu, 17 Oct 2024 00:26:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124766; cv=none; b=BYGRDXfPDMQIBUmZpfLnoWo0V+eNEHWoAXvAtfD+gCYKqcS3cmay/x6D8O973GdBlZvKjqKfrtkeqZV5cvDrirAZk34hh0DEETIoNPdbz0CSR1Uy72g6SH436KTSwJlPKwnrV06znwIsjq7pOMJqj1Ap/KWGeEQWjUOmgnEztrw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124766; c=relaxed/simple; bh=tQFvREIQY7U0kHAscC0X44BcsztjavThWbNkAVIdS/M=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=CEqMg/YErkIYL0tFVTHdCoQL1HZUfW1nO5j41y0Ws1mj6Wq1ijNxzx9liKQew5QIFvW/8jJQeXS2uZatc2x4ZTp3wHA2knHbx4loctCBOGw8lsphTdr5YWr6lLAbguNuPf4i0QHkVQwKFiMuAPGvwH2xlojQPhKH0DuATrw3eYc= 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=mKHYIdRn; arc=none smtp.client-ip=209.85.128.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="mKHYIdRn" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6e35199eb2bso8983897b3.3 for ; Wed, 16 Oct 2024 17:26:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124762; x=1729729562; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=f+6tiaKaV6HvKOoydGJA88FSVOYPAhxZOHcfM2Yk7U8=; b=mKHYIdRnJP7JMtjtYs7MPooyEPGbQXEknp2Mh3wDJs1KnRLdTWUEjCvF1Hcr74NJN4 8HeiBPVmYjKRoMt2kvhjJKMr/qWuPdn+/I6XrVC2dCsxiTCQmiRJd/fxqDbQ49j8jnYX geGCZWmwpBBotsly1xYQyZuo4U0YpUB3yq33RQFcedvXYPkEDHuowVOh+8ThKFLksygB sdelgpTDVxI45nao63NsOQyvV7wvAaPWTvKfI0FnAHATDsDsH43OV2ZgcxcPgU89UvkT H0weDtIXsrRfSjjky+Ilz8zcDGsfUtJw1YyrhdF329GfdI97heiUx5H/OMZc1+wCyPnl WKCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124762; x=1729729562; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=f+6tiaKaV6HvKOoydGJA88FSVOYPAhxZOHcfM2Yk7U8=; b=vJviDJnz7kPQtIPm3/rYpTUlnXRfk61DXvKNQ6Ho3kmG8qN8Xg4biJ2vsm+z2d2o5G jhYS4rZ/RGJenF1RuCTvmlVQd5Y44FgDaEHouqPubDeylndv+hQykUh+VCTUe2IVg5Ql Wzuq1iyb+hZD3w5mEE3ckUb35Yt7fEZtxv9Hgtz6LtnwMrJ5ktVp7cUWZZ3oVAmz83Sq Kv9/oSVcFt4YF9/vAvA9Wa2jxfZEBCgGdDhYAiJMTNjxx5pvtdcbPphwl/PGgaiOoiLL 1ix2xMVZMFcgXDu+eZiQNKajJQb/03e7gHx35vJIEPxy2cQZOy8RjO+/qPXyyQ2r2zJw nwcA== X-Forwarded-Encrypted: i=1; AJvYcCURkl20r6OlCun2P/ng9An07FBxI9e6AR7dNcSqygGyj83c+VBMTLdLZgGNlYJAhnIZrsvXBgRMXgJCdv8=@vger.kernel.org X-Gm-Message-State: AOJu0YzVZJotQYardbqcA2rqF8B0hOSGOZgpUP1wG4AR16HPiQSVerX5 TvcewuWlqfVH/Tm0F2ZjJWoub0eQpLXM3A/f/VNMCgRv9GZVYSKj2US8NK9vzh87eAhl/RhYYCn iV68P2g== X-Google-Smtp-Source: AGHT+IF8vR2ODszdvUkiRs2C6hBOma5C+iYC6PWCAbaWDyF1xQHgEj5TqToGlUQxetf5HbIY0PdC8v7iaIAq X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:870c:0:b0:e25:5cb1:77cd with SMTP id 3f1490d57ef6-e2978585305mr4689276.10.1729124761924; Wed, 16 Oct 2024 17:26:01 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:14 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-15-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 14/20] perf riscv: Remove dwarf-regs.c and add dwarf-regs-table.h From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , 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" The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case, and the register table is provided in a header file, the function can never be called. So remove as dead code. Tidy up the EM_NONE cases for riscv in dwarf-regs.c. Signed-off-by: Ian Rogers Acked-by: Palmer Dabbelt Reviewed-by: Masami Hiramatsu (Google) --- .../dwarf-regs-table.h} | 32 ++++--------------- tools/perf/arch/riscv/util/Build | 1 - tools/perf/util/dwarf-regs.c | 7 ++-- tools/perf/util/include/dwarf-regs.h | 2 +- 4 files changed, 12 insertions(+), 30 deletions(-) rename tools/perf/arch/riscv/{util/dwarf-regs.c =3D> include/dwarf-regs-ta= ble.h} (56%) diff --git a/tools/perf/arch/riscv/util/dwarf-regs.c b/tools/perf/arch/risc= v/include/dwarf-regs-table.h similarity index 56% rename from tools/perf/arch/riscv/util/dwarf-regs.c rename to tools/perf/arch/riscv/include/dwarf-regs-table.h index a9c4402ae57e..a45b63a6d5a8 100644 --- a/tools/perf/arch/riscv/util/dwarf-regs.c +++ b/tools/perf/arch/riscv/include/dwarf-regs-table.h @@ -1,23 +1,10 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd. - * Mapping of DWARF debug register numbers into register names. - */ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifdef DEFINE_DWARF_REGSTR_TABLE +/* This is included in perf/util/dwarf-regs.c */ =20 -#include -#include /* for EINVAL */ -#include /* for strcmp */ -#include +#define REG_DWARFNUM_NAME(reg, idx) [idx] =3D "%" #reg =20 -struct regs_dwarfnum { - const char *name; - unsigned int dwarfnum; -}; - -#define REG_DWARFNUM_NAME(r, num) {.name =3D r, .dwarfnum =3D num} -#define REG_DWARFNUM_END {.name =3D NULL, .dwarfnum =3D 0} - -struct regs_dwarfnum riscv_dwarf_regs_table[] =3D { +static const char * const riscv_regstr_tbl[] =3D { REG_DWARFNUM_NAME("%zero", 0), REG_DWARFNUM_NAME("%ra", 1), REG_DWARFNUM_NAME("%sp", 2), @@ -50,13 +37,6 @@ struct regs_dwarfnum riscv_dwarf_regs_table[] =3D { REG_DWARFNUM_NAME("%t4", 29), REG_DWARFNUM_NAME("%t5", 30), REG_DWARFNUM_NAME("%t6", 31), - REG_DWARFNUM_END, }; =20 -#define RISCV_MAX_REGS ((sizeof(riscv_dwarf_regs_table) / \ - sizeof(riscv_dwarf_regs_table[0])) - 1) - -const char *get_arch_regstr(unsigned int n) -{ - return (n < RISCV_MAX_REGS) ? riscv_dwarf_regs_table[n].name : NULL; -} +#endif diff --git a/tools/perf/arch/riscv/util/Build b/tools/perf/arch/riscv/util/= Build index 8f93091b8345..58a672246024 100644 --- a/tools/perf/arch/riscv/util/Build +++ b/tools/perf/arch/riscv/util/Build @@ -2,5 +2,4 @@ perf-util-y +=3D perf_regs.o perf-util-y +=3D header.o =20 perf-util-$(CONFIG_LIBTRACEEVENT) +=3D kvm-stat.o -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 3d98c2bf6035..2c6b197556dd 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -20,6 +20,7 @@ #include "../arch/arm64/include/dwarf-regs-table.h" #include "../arch/sh/include/dwarf-regs-table.h" #include "../arch/powerpc/include/dwarf-regs-table.h" +#include "../arch/riscv/include/dwarf-regs-table.h" #include "../arch/s390/include/dwarf-regs-table.h" #include "../arch/sparc/include/dwarf-regs-table.h" #include "../arch/xtensa/include/dwarf-regs-table.h" @@ -33,7 +34,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int= machine, unsigned int { #if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM \ || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH || EM_HOST = =3D=3D EM_MIPS || EM_HOST =3D=3D EM_PPC \ - || EM_HOST =3D=3D EM_PPC64 + || EM_HOST =3D=3D EM_PPC64 || EM_HOST =3D=3D EM_RISCV if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; @@ -42,7 +43,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int= machine, unsigned int switch (machine) { #if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM \ && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH && EM_HOST !=3D E= M_MIPS && EM_HOST !=3D EM_PPC \ - && EM_HOST !=3D EM_PPC64 + && EM_HOST !=3D EM_PPC64 && EM_HOST !=3D EM_RISCV case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif @@ -63,6 +64,8 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int= machine, unsigned int case EM_PPC: case EM_PPC64: return __get_dwarf_regstr(powerpc_regstr_tbl, n); + case EM_RISCV: + return __get_dwarf_regstr(riscv_regstr_tbl, n); case EM_SPARC: case EM_SPARCV9: return __get_dwarf_regstr(sparc_regstr_tbl, n); diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include= /dwarf-regs.h index 1763280855ce..35f4f33205da 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -81,7 +81,7 @@ #ifdef HAVE_LIBDW_SUPPORT #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) &&= !defined(__arm__) \ && !defined(__loongarch__) && !defined(__mips__) && !defined(__powerpc= __) \ - && !defined(__powerpc64__) + && !defined(__powerpc64__) && !defined(__riscv__) const char *get_arch_regstr(unsigned int n); #endif =20 --=20 2.47.0.105.g07ac214952-goog From nobody Tue Nov 26 15:41:46 2024 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (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 EA81A175D32 for ; Thu, 17 Oct 2024 00:26:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124767; cv=none; b=jvMVpVHAG0Po4PhXesKJdUCkkKwnKZXO59OwdAX3LZ4mVbxrYVdjOOoEO/ONfJVf18xjgrhTTF+Zq0ZHD7YZrcy6wiCslhtSUiRkmOBVrkzEkiJzOUNQ8boDiW4GSXueq454ZjE6PRqNnCqo/3gnSYy19jLGsLuCNAzEeRMbtjQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124767; c=relaxed/simple; bh=avKPqbsQizfnd2YaF1SHUwMDk34bvOtZlva5/e8fDQ0=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=s7opq58ZO1MWZVfijob9+u5E5CvCVFrdlO2A/SsLz1p830lqdfULvN5/3ykBy04MTm/Mlx9D+2ansQseDeoX4UW+VsC6nwXorMaS74G5KyahDt94QDxd0diC9cvSxnSDAAoqTRBzXkJ+VczL6dp8iX99nLPFzEaAnjdG8swGU3k= 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=NTj2n29T; arc=none smtp.client-ip=209.85.128.201 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="NTj2n29T" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e3d660a1afso9874287b3.0 for ; Wed, 16 Oct 2024 17:26:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124765; x=1729729565; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=+vS3pAQ+haKP/8iv+6aAP7RJEQP9tkb6yzoJLAeVBwY=; b=NTj2n29T8tyxXH48+YcDJWEe6QU4Kxki2vLiHHWHi3wB9MZbcE5D9HSbnbMnikpSJK DMME9fQ+4DAXgaGN37pzbwNGVZ3Cy+Z4O9PTiJ/5J2sqUWd7E67I2JtP9te9m7vtcYMn i5vQwJKi6inBKihEKfWpGS1b27yv0vymz22NuFsQKkKfQ5DipIhc8kndnF6zo79XrW8R xh5HAJnF1Vkt4NiT+QybOaUBnSj38Qkkjz3WYEWHnFpP6inq56PlzLSLwuvBl7IGsgm3 O8f0+T9jlA38jHlewtFyU0Cbq0TiqLrP8gMe48Y10FYbycdNSTUjbTyefdyLI159CRK0 A9gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124765; x=1729729565; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+vS3pAQ+haKP/8iv+6aAP7RJEQP9tkb6yzoJLAeVBwY=; b=EfLJoTgCQrPqetXwfsu6Y1/+LeF3g/ClHKdimXjQhQ/tNnGjgy8b0zO/eJwGndL9vm Kza4ahy5UZvOLoDeMCwdZMIGUWqr/TrlCEA8CTinVY4m984KQu2Y3DuS02j3+M2+2aTV mHvm/xa/QHB2m9vHbQN9GP0vDRwe297kOm9CXlAWXt4K0y0ht6at/+1GG9jQqJQqIZxL tgo+YBOgejZrlTDQpd7NEFo5Fv4vgvNidTHGf9hNI//vvpks3fKx+4vKFXctpFRHDCUG OCCxsXrH/+gG78drjkJNobHao8WKH2bq2DRu2tXIwjWXHimXo4QTHtsrw8DWzNDbs8pl vfiQ== X-Forwarded-Encrypted: i=1; AJvYcCWcWGH6bF2dsaq6zFBqGtno3vzZcz/7HzQtLZw7Hw1T0L7H+yRYqBMzM+AxAPICkoudMoWVg/RlWqGyNnQ=@vger.kernel.org X-Gm-Message-State: AOJu0YyNvlZV4jfYdZV48D+ZeP+CWhBEvn8pTOn9R7lvC4FlovTbLXLz Fok0351BjCnO/9tjQJitb7chp0NaL5v1JQ9TOXO5UuWE2f0qdukK1J/ACpZt8RoOp1KzjRscL1/ EA5dh4g== X-Google-Smtp-Source: AGHT+IHww5hKkYtrtEd7xFxuwiqgL1g9EP1jrDvOSFsM0YJ3aBoaypiL1q7z5gT/re1gw8cKAYiVLMh2TMTK X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a05:690c:9a84:b0:6e3:19d7:382a with SMTP id 00721157ae682-6e3d3f7f52fmr1338867b3.1.1729124764951; Wed, 16 Oct 2024 17:26:04 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:15 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-16-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 15/20] perf s390: Remove dwarf-regs.c From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , 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" The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case the function can never be called. So remove as dead code. Tidy up the EM_NONE cases for s390 in dwarf-regs.c. Signed-off-by: Ian Rogers Reviewed-by: Masami Hiramatsu (Google) --- tools/perf/arch/s390/util/Build | 1 - tools/perf/arch/s390/util/dwarf-regs.c | 16 ---------------- tools/perf/util/dwarf-regs.c | 4 ++-- tools/perf/util/include/dwarf-regs.h | 2 +- 4 files changed, 3 insertions(+), 20 deletions(-) delete mode 100644 tools/perf/arch/s390/util/dwarf-regs.c diff --git a/tools/perf/arch/s390/util/Build b/tools/perf/arch/s390/util/Bu= ild index 787410f99bb3..736c0ad09194 100644 --- a/tools/perf/arch/s390/util/Build +++ b/tools/perf/arch/s390/util/Build @@ -2,7 +2,6 @@ perf-util-y +=3D header.o perf-util-$(CONFIG_LIBTRACEEVENT) +=3D kvm-stat.o perf-util-y +=3D perf_regs.o =20 -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o =20 perf-util-y +=3D machine.o diff --git a/tools/perf/arch/s390/util/dwarf-regs.c b/tools/perf/arch/s390/= util/dwarf-regs.c deleted file mode 100644 index 5bcf3192623a..000000000000 --- a/tools/perf/arch/s390/util/dwarf-regs.c +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Mapping of DWARF debug register numbers into register names. - * - * Copyright IBM Corp. 2010, 2017 - * Author(s): Hendrik Brueckner - * - */ - -#include -#include "dwarf-regs-table.h" - -const char *get_arch_regstr(unsigned int n) -{ - return (n >=3D ARRAY_SIZE(s390_dwarf_regs)) ? NULL : s390_dwarf_regs[n]; -} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 2c6b197556dd..1649fc07f4f5 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -34,7 +34,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int= machine, unsigned int { #if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM \ || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH || EM_HOST = =3D=3D EM_MIPS || EM_HOST =3D=3D EM_PPC \ - || EM_HOST =3D=3D EM_PPC64 || EM_HOST =3D=3D EM_RISCV + || EM_HOST =3D=3D EM_PPC64 || EM_HOST =3D=3D EM_RISCV || EM_HOST =3D= =3D EM_S390 if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; @@ -43,7 +43,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int= machine, unsigned int switch (machine) { #if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM \ && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH && EM_HOST !=3D E= M_MIPS && EM_HOST !=3D EM_PPC \ - && EM_HOST !=3D EM_PPC64 && EM_HOST !=3D EM_RISCV + && EM_HOST !=3D EM_PPC64 && EM_HOST !=3D EM_RISCV && EM_HOST !=3D EM_S= 390 case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include= /dwarf-regs.h index 35f4f33205da..25f3d6b90f10 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -81,7 +81,7 @@ #ifdef HAVE_LIBDW_SUPPORT #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) &&= !defined(__arm__) \ && !defined(__loongarch__) && !defined(__mips__) && !defined(__powerpc= __) \ - && !defined(__powerpc64__) && !defined(__riscv__) + && !defined(__powerpc64__) && !defined(__riscv__) && !defined(__s390x_= _) const char *get_arch_regstr(unsigned int n); #endif =20 --=20 2.47.0.105.g07ac214952-goog From nobody Tue Nov 26 15:41:46 2024 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.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 6496122087 for ; Thu, 17 Oct 2024 00:26:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124769; cv=none; b=gas9TG0P1FA6SR3mgBMfE8EhVxFtq/fUSlzYUub9ekhLBQJFjXqmXUETxGjU9eW0TYYfCta6ieUU1OzMFazN3s8IGXR4a31C4XFWh5G6kXd4AaJ3BK20V9shQ1BJo0AyP0DW23Aqg0nWKEYDIUr9V2Ja9iFGAFyCe5/YzClkrmY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124769; c=relaxed/simple; bh=SAv92amf90M9xPKiLnVEQ2/ksaT2ewK9Kq/gzzcJmZE=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=c5vjL1EClwqaa6MA/ZZllThCyAzaTYIYysVnY1QxAtrxnazi50hI6GgxUjL1nDSqVrBowuJ8Diuv4VGI6rthMzoqRgAX3NNWNQZEH1Rz2X6VPKaIYlud+WcB1ZcTZc/gVvI4mrtbX1CgbeDZnLb4BeEPY/uVaWHXWZn48ggVaMs= 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=Z9k7MeL+; arc=none smtp.client-ip=209.85.219.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="Z9k7MeL+" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e1159159528so2307635276.1 for ; Wed, 16 Oct 2024 17:26:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124767; x=1729729567; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=IfgOrXuzIi5D9S6tBKQjs6ZaYP759vz/COjt5onTx3c=; b=Z9k7MeL+mxU6S4Rm7jjFfkLRkot/wmuR20veFBqoO0oCgC6wXME0Nor6XvTRCwmjUT Ojpp86+UiZumky+1qaWieuQMtbOH83+Ra1gI/859sDGNLAHp1lnzB2wme60UztPizzsJ xqeZYW9MScMb2+xMvP274mCAo12NhGAeWhzRlmlYI3EciTlMQfyYAe3smGfemO2H0QOi Nrbe9h+giRcqPFhh51HXXAla3HdrS9e2rOooGy9papP7ROMXD3+Z0T5wbmzZ80FXIKJF msjgHeUzzV6xq1FpFz7fPU/F5j+Wfcn0e20zQQyfSIkveoYvFBAeAHicdcwURB+odJ96 R9xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124767; x=1729729567; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IfgOrXuzIi5D9S6tBKQjs6ZaYP759vz/COjt5onTx3c=; b=sfYCm7nny5s9B/ESOxFodT00Rwm5H80IlpBSNknjRGf+JpPdXI4FQTl4Gqy7co2PPv FXYQ6tLCuNBmc9PIdlyJ9I0VXwIZRAKX2p9n9H84nS/W+URzNJuFwRLjx1RYwenSY6Je MlU/MdIUu4w6xvQAbxIFQHFsIY45EYKunAtYm0szA4kILujPHanzRpNAw2SfbhReDy2Y SV+kQAg+aMWIMQsXEzXujShmIDJSi6MXZrHDL8xadm4uVE5t+SS3iqBvF6ieikXJuPji /WoXec7usSHrCHviaTCEU/ztm6VdMaT78MOQHNwA+D8+ypjmSgY7wjhG29mBQlkjwlSk chSA== X-Forwarded-Encrypted: i=1; AJvYcCX2NIsFDNMSDYO+XPQdcjyOtEIUNeghlGJzgAN1ru+CguiPI+ULWqjJp3BdJAzxUf5m4Nq6VGxlAiKGkXQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzCESvYBn08BT1+vk2JzXgHGUjqOXH6w/cGy+Lv6zZljHMe3fes HtjWVsFknkKBuhMf9mgQRwB0IdglDqJ9jb5sguNYZLfSRaktkYyfGVTw2UcjH4WtV6CSGIjnkZ1 EAua8cA== X-Google-Smtp-Source: AGHT+IFt+bqmIASGNbZ3TFisN0iIRghMq2JpjsLpeMTXAlMa2KnLBBPyKnoUzSRzo42bXC3TE8xo0dk3pEWH X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:664c:0:b0:e29:7454:e773 with SMTP id 3f1490d57ef6-e2b9d02921cmr1392276.5.1729124767112; Wed, 16 Oct 2024 17:26:07 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:16 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-17-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 16/20] perf sh: Remove dwarf-regs.c From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , 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" The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case the function can never be called. So remove as dead code. As this is the only file in the arch/sh/util clean up Build files. Tidy up the EM_NONE cases for sh in dwarf-regs.c. Signed-off-by: Ian Rogers Reviewed-by: Masami Hiramatsu (Google) --- tools/perf/arch/sh/Build | 1 - tools/perf/arch/sh/util/Build | 1 - tools/perf/arch/sh/util/dwarf-regs.c | 41 ---------------------------- tools/perf/util/dwarf-regs.c | 4 +-- tools/perf/util/include/dwarf-regs.h | 2 +- 5 files changed, 3 insertions(+), 46 deletions(-) delete mode 100644 tools/perf/arch/sh/Build delete mode 100644 tools/perf/arch/sh/util/Build delete mode 100644 tools/perf/arch/sh/util/dwarf-regs.c diff --git a/tools/perf/arch/sh/Build b/tools/perf/arch/sh/Build deleted file mode 100644 index e63eabc2c8f4..000000000000 --- a/tools/perf/arch/sh/Build +++ /dev/null @@ -1 +0,0 @@ -perf-util-y +=3D util/ diff --git a/tools/perf/arch/sh/util/Build b/tools/perf/arch/sh/util/Build deleted file mode 100644 index 2337a0b710a2..000000000000 --- a/tools/perf/arch/sh/util/Build +++ /dev/null @@ -1 +0,0 @@ -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o diff --git a/tools/perf/arch/sh/util/dwarf-regs.c b/tools/perf/arch/sh/util= /dwarf-regs.c deleted file mode 100644 index 4b17fc86c73b..000000000000 --- a/tools/perf/arch/sh/util/dwarf-regs.c +++ /dev/null @@ -1,41 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Mapping of DWARF debug register numbers into register names. - * - * Copyright (C) 2010 Matt Fleming - */ - -#include -#include - -/* - * Generic dwarf analysis helpers - */ - -#define SH_MAX_REGS 18 -const char *sh_regs_table[SH_MAX_REGS] =3D { - "r0", - "r1", - "r2", - "r3", - "r4", - "r5", - "r6", - "r7", - "r8", - "r9", - "r10", - "r11", - "r12", - "r13", - "r14", - "r15", - "pc", - "pr", -}; - -/* Return architecture dependent register string (for kprobe-tracer) */ -const char *get_arch_regstr(unsigned int n) -{ - return (n < SH_MAX_REGS) ? sh_regs_table[n] : NULL; -} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 1649fc07f4f5..944ff4ef0290 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -34,7 +34,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int= machine, unsigned int { #if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM \ || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH || EM_HOST = =3D=3D EM_MIPS || EM_HOST =3D=3D EM_PPC \ - || EM_HOST =3D=3D EM_PPC64 || EM_HOST =3D=3D EM_RISCV || EM_HOST =3D= =3D EM_S390 + || EM_HOST =3D=3D EM_PPC64 || EM_HOST =3D=3D EM_RISCV || EM_HOST =3D= =3D EM_S390 || EM_HOST =3D=3D EM_SH if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; @@ -43,7 +43,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int= machine, unsigned int switch (machine) { #if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM \ && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH && EM_HOST !=3D E= M_MIPS && EM_HOST !=3D EM_PPC \ - && EM_HOST !=3D EM_PPC64 && EM_HOST !=3D EM_RISCV && EM_HOST !=3D EM_S= 390 + && EM_HOST !=3D EM_PPC64 && EM_HOST !=3D EM_RISCV && EM_HOST !=3D EM_S= 390 && EM_HOST !=3D EM_SH case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include= /dwarf-regs.h index 25f3d6b90f10..2b212ed70a15 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -81,7 +81,7 @@ #ifdef HAVE_LIBDW_SUPPORT #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) &&= !defined(__arm__) \ && !defined(__loongarch__) && !defined(__mips__) && !defined(__powerpc= __) \ - && !defined(__powerpc64__) && !defined(__riscv__) && !defined(__s390x_= _) + && !defined(__powerpc64__) && !defined(__riscv__) && !defined(__s390x_= _) && !defined(__sh__) const char *get_arch_regstr(unsigned int n); #endif =20 --=20 2.47.0.105.g07ac214952-goog From nobody Tue Nov 26 15:41:46 2024 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (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 75FAA17E00E for ; Thu, 17 Oct 2024 00:26:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124773; cv=none; b=djRPwlPtLDobqcCCqXVVME+xBO+hwq2R5OSwhC7RTsuFfDXLzTeu4oM1pBT4rbTxRe2DzitXU7ZKkftKkr0BrqP5GTcAxUlaAJCnUrhmV0fOkgkhpCgH6sxhksMzepiqoIyXa9t6Me3TQc9j+hV+5gb2TbfwZofh89/YsUXvZY4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124773; c=relaxed/simple; bh=o1BRyYKYbb+p4McU2Dk5LlTJ9SKJ9j4mbqSMgCX4n/8=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=esEss114H0MQpg1U+yNd+IC0PdDiW45jbejOMkegGKwRM6ukqfOtMcePHwLBMftKAsBg0rMrGWNwB5e5NSdPtYG2B+9nbTfSZVCFCS9ucaZ1JTNoABPQK9CSKTfyQQ4HV8RsCgosJcLEt9kPC+3trL3RBmrCnGFTauV9Yhb23eM= 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=tMy0hsEX; arc=none smtp.client-ip=209.85.219.201 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="tMy0hsEX" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e2b9f2c6559so353776276.2 for ; Wed, 16 Oct 2024 17:26:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124770; x=1729729570; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=oW9Ciltxw29Qn009jBViVw/a9LBQmaz3mh3OQFZm1hk=; b=tMy0hsEXnMysiTAPGP1Z4gFmE3Q7mSlx/UfWxUAQjsgljz+qUHDjNZaSIHBDGgRxa4 cLLwXVhhMO+y7xKE1EltBc72g9T7N/1iLgDj//bj5paG7zrg6OvEJE9YFpfqrb3tQSPw VHiAnJfD/vqyhP2wRx0ZssZsZ+zdaxc+HZJ7s1VaLmBreRRF+XTuMc4llBqNEqPs6ps8 9INAmic2QtO8BFS7/88DPDp8u5qv6qY252zYseYbHEhAfysrbpDJUWTzeSNs7Mw1/T2u ljBuo8sqdy9338W8sco7J9sH2fPpn0FJwL5sMy72NuGj/uE24fkQ5gqMiMzkeSmZapr5 gfBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124770; x=1729729570; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oW9Ciltxw29Qn009jBViVw/a9LBQmaz3mh3OQFZm1hk=; b=OY70DanQqoV5JW2E9kxQxBdwne/6iW6XrSXyblQBlGe4EXWe5C8Olb7KO9nl4Co0ji vDIVq4lgcwEvQP4Azvzg5k1+C3An85pnQPOjwL4cq6GuEdqVDt04me+iJ6cnde5UKgyr BLb8prE6NDJR0xaA4Pn8LlDxGW2nqTW9AjZLDMOU0kKqSH4DRpmkQB5q0GmbSdGAUUia rvCS6Bmylkz7t9nfD7lKxi/RDBFVr1Af07TfxyLLz3BrLKgoMAhdyGNiVMT3rFwpPsM+ FbS6ryQytH5aAvx3wTEJvrpE8pXU1ea+QKTeIPtQHu4aidz2LftsVwOtyVShQcC/SjBZ h6AQ== X-Forwarded-Encrypted: i=1; AJvYcCU0SCbye5xyNskFtp/1/+wbn05B03d15g4HvyoBPsQYK1eczZ5F68LK1FAztr1tHfFO7/XqAJ26W09au4I=@vger.kernel.org X-Gm-Message-State: AOJu0YxZacoLzBal0yByMTSkIvYGM/W6eQ8hlvJ+6AjG/tDHAMApsXFs dWwkg4smIwaEuoXMSsL4EtPRGzPVysgpVtVpEbVbWRwedMqdC3r6h2+qNmw2nWkXnc2ks+j+N0/ iORetAg== X-Google-Smtp-Source: AGHT+IGmO4W0BoMjp2vNweM4XGVSqpJs6KmKQXMJOVyvfkUJl62y1U0AKaZtgLbMJwRejRGMM6dtDDGo4NIo X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a5b:60e:0:b0:e28:e97f:5394 with SMTP id 3f1490d57ef6-e29783006ccmr3235276.4.1729124769707; Wed, 16 Oct 2024 17:26:09 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:17 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-18-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 17/20] perf sparc: Remove dwarf-regs.c From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , 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" The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case the function can never be called. So remove as dead code. As this is the only file in the arch/sparc/util clean up Build files. Tidy up the EM_NONE cases for sparc in dwarf-regs.c. Signed-off-by: Ian Rogers Reviewed-by: Masami Hiramatsu (Google) --- tools/perf/arch/sparc/Build | 1 - tools/perf/arch/sparc/util/Build | 1 - tools/perf/arch/sparc/util/dwarf-regs.c | 39 ------------------------- tools/perf/util/dwarf-regs.c | 6 ++-- tools/perf/util/include/dwarf-regs.h | 3 +- 5 files changed, 6 insertions(+), 44 deletions(-) delete mode 100644 tools/perf/arch/sparc/Build delete mode 100644 tools/perf/arch/sparc/util/Build delete mode 100644 tools/perf/arch/sparc/util/dwarf-regs.c diff --git a/tools/perf/arch/sparc/Build b/tools/perf/arch/sparc/Build deleted file mode 100644 index e63eabc2c8f4..000000000000 --- a/tools/perf/arch/sparc/Build +++ /dev/null @@ -1 +0,0 @@ -perf-util-y +=3D util/ diff --git a/tools/perf/arch/sparc/util/Build b/tools/perf/arch/sparc/util/= Build deleted file mode 100644 index 2337a0b710a2..000000000000 --- a/tools/perf/arch/sparc/util/Build +++ /dev/null @@ -1 +0,0 @@ -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o diff --git a/tools/perf/arch/sparc/util/dwarf-regs.c b/tools/perf/arch/spar= c/util/dwarf-regs.c deleted file mode 100644 index 1282cb2dc7bd..000000000000 --- a/tools/perf/arch/sparc/util/dwarf-regs.c +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Mapping of DWARF debug register numbers into register names. - * - * Copyright (C) 2010 David S. Miller - */ - -#include -#include - -#define SPARC_MAX_REGS 96 - -const char *sparc_regs_table[SPARC_MAX_REGS] =3D { - "%g0", "%g1", "%g2", "%g3", "%g4", "%g5", "%g6", "%g7", - "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%sp", "%o7", - "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", - "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%fp", "%i7", - "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7", - "%f8", "%f9", "%f10", "%f11", "%f12", "%f13", "%f14", "%f15", - "%f16", "%f17", "%f18", "%f19", "%f20", "%f21", "%f22", "%f23", - "%f24", "%f25", "%f26", "%f27", "%f28", "%f29", "%f30", "%f31", - "%f32", "%f33", "%f34", "%f35", "%f36", "%f37", "%f38", "%f39", - "%f40", "%f41", "%f42", "%f43", "%f44", "%f45", "%f46", "%f47", - "%f48", "%f49", "%f50", "%f51", "%f52", "%f53", "%f54", "%f55", - "%f56", "%f57", "%f58", "%f59", "%f60", "%f61", "%f62", "%f63", -}; - -/** - * get_arch_regstr() - lookup register name from it's DWARF register number - * @n: the DWARF register number - * - * get_arch_regstr() returns the name of the register in struct - * regdwarfnum_table from it's DWARF register number. If the register is n= ot - * found in the table, this returns NULL; - */ -const char *get_arch_regstr(unsigned int n) -{ - return (n < SPARC_MAX_REGS) ? sparc_regs_table[n] : NULL; -} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 944ff4ef0290..a0bcc2529cb0 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -34,7 +34,8 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int= machine, unsigned int { #if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM \ || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH || EM_HOST = =3D=3D EM_MIPS || EM_HOST =3D=3D EM_PPC \ - || EM_HOST =3D=3D EM_PPC64 || EM_HOST =3D=3D EM_RISCV || EM_HOST =3D= =3D EM_S390 || EM_HOST =3D=3D EM_SH + || EM_HOST =3D=3D EM_PPC64 || EM_HOST =3D=3D EM_RISCV || EM_HOST =3D= =3D EM_S390 || EM_HOST =3D=3D EM_SH \ + || EM_HOST =3D=3D EM_SPARC || EM_HOST =3D=3D EM_SPARCV9 if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; @@ -43,7 +44,8 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int= machine, unsigned int switch (machine) { #if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM \ && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH && EM_HOST !=3D E= M_MIPS && EM_HOST !=3D EM_PPC \ - && EM_HOST !=3D EM_PPC64 && EM_HOST !=3D EM_RISCV && EM_HOST !=3D EM_S= 390 && EM_HOST !=3D EM_SH + && EM_HOST !=3D EM_PPC64 && EM_HOST !=3D EM_RISCV && EM_HOST !=3D EM_S= 390 && EM_HOST !=3D EM_SH \ + && EM_HOST !=3D EM_SPARC && EM_HOST !=3D EM_SPARCV9 case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include= /dwarf-regs.h index 2b212ed70a15..b2cf7d9e4785 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -81,7 +81,8 @@ #ifdef HAVE_LIBDW_SUPPORT #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) &&= !defined(__arm__) \ && !defined(__loongarch__) && !defined(__mips__) && !defined(__powerpc= __) \ - && !defined(__powerpc64__) && !defined(__riscv__) && !defined(__s390x_= _) && !defined(__sh__) + && !defined(__powerpc64__) && !defined(__riscv__) && !defined(__s390x_= _) && !defined(__sh__) \ + && !defined(__sparc64__) && !defined(__sparc__) const char *get_arch_regstr(unsigned int n); #endif =20 --=20 2.47.0.105.g07ac214952-goog From nobody Tue Nov 26 15:41:46 2024 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.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 96929185945 for ; Thu, 17 Oct 2024 00:26:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124775; cv=none; b=TmmrV2jHJcFfM08NBMgKITw7fTjcsTW3GXvLx6y/G8ul4HnN3UYcGUGm74NcYtXrC4lSRIPb0DWA0W9Qvs3dqP8MuNfQZ3coI3m8jDR8iiekyTlFJ37qcxP8810dR5nHIQN8y6hEA6lCzq3sXIrV5SC1k3O4Pz65bq2r/HkH1Uk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124775; c=relaxed/simple; bh=NfxF1XWnz27bXBiL5Xjm5UV8lUk9JDBhGby9Ft11L3k=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=QmkzztY/bt1VMuO0Q0lUYEYOukjTA18IDF7c68/r0u/cvWoW8wjMa1izKC/rk4pN5Mb6q3y3EESJ5aDURtVBEImPgaKPi3MeyAH28+1Lp9cbY2qemptL/V/s0qYyZIFVhvsMX8tKpD3MMbd1CwTyTpYCzJxLYc9DR2nsNpxGb2s= 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=alfuo0Fo; arc=none smtp.client-ip=209.85.219.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="alfuo0Fo" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e292dbfd834so529620276.3 for ; Wed, 16 Oct 2024 17:26:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124773; x=1729729573; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=uq9AxXLwl+md7pGfplbuMGPRmw11SaZaUSrHTUrrfs0=; b=alfuo0Fou5Eow6wLc9elAdM/o48CzEhwSKTWkrvyQ5GGw4rRvzeS1liBMLg/5fhm8K 7CyNBRfbuIVMlFHOUhHGFfoO6LFrHVJJh/dgnSjul9TJJ83doEOxSchOAXn9W+n4UkbO xibD/9XO+qkVZv0HjXF3yMp8NM9vhXXs9LGKhAGicKluLdByrRfATX2RcCxiWjVJZEiZ K3nWDNtFyDOuHLrRczWLSlShtmg6vZBiFNAGUGr4qWkyF5F36K3Ien53E3xoicRibvKI 7hUhEAKDKsRiRc8zaul4ekT0f2iMaLeOq7Q0VMuQPY/KKie2EvJb9E93ZZYkabxwwMvH y1tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124773; x=1729729573; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uq9AxXLwl+md7pGfplbuMGPRmw11SaZaUSrHTUrrfs0=; b=S78lrvlEw6y0ak1iumVORe0MhO3KkHP4+8kIEXoAJkuP8NYwZgYWnYPmvOUcqbnvog qWwXnWnU2Sb7y/CQ3064vMnjL3JhLQpQgJPzHIyhCJS9cyYAPgQnWMVbUaxDM6jHzE1K 5fE6ZabSW/1RhARnipWN8gibIciLPuYQaVQ91JB1SbVFE7sV+QRW+8m8eMwTRIxaQfz1 GG4b6inDrz9E0PRTwMIuW2bCz88Yi4qWzufMhQwTzN74evAC/573ITyZMM2nhuA4PrJl 0RA1QJhFA23PoB4oDp3Pxd4kJnlV7+FNEAmcvPvOJq6waTRJC3fg5jPvDDvQZ+VgyjRQ Rpzw== X-Forwarded-Encrypted: i=1; AJvYcCXkZ5Z/9r2KquZRPaHVGIzA3LAI3LNNa+oJuQQHi7WsONn8kQql0eK6e6D12XTcmZxLxGEfvwnnUtLDmw4=@vger.kernel.org X-Gm-Message-State: AOJu0YzrMEPk0ElRkKIptl5vxGAu1zQHxhntgpQ9zHR5au7npb6kImtE gm5ZOyv7++TL+jo4m6iyYx8tZ9KreyeYscQuWGXapM6XeGeCijygTCas7baE2tXkvhIelkxQXIE rj/olBw== X-Google-Smtp-Source: AGHT+IFblE5b3blF81m60FrHwxXihWa7btaVQayshFuqPR503LpiCQwiOp0I0Sdca5Yyel3RIIDwjSVp3STP X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:7e04:0:b0:e25:fcb:3205 with SMTP id 3f1490d57ef6-e29785695e6mr5028276.8.1729124772530; Wed, 16 Oct 2024 17:26:12 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:18 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-19-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 18/20] perf xtensa: Remove dwarf-regs.c From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , 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" The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case the function can never be called. So remove as dead code. As this is the only file in the arch/xtensa/util clean up Build files. Tidy up the EM_NONE cases for xtensa in dwarf-regs.c. Signed-off-by: Ian Rogers Reviewed-by: Masami Hiramatsu (Google) --- tools/perf/arch/xtensa/Build | 1 - tools/perf/arch/xtensa/util/Build | 1 - tools/perf/arch/xtensa/util/dwarf-regs.c | 21 --------------------- tools/perf/util/dwarf-regs.c | 4 ++-- tools/perf/util/include/dwarf-regs.h | 2 +- 5 files changed, 3 insertions(+), 26 deletions(-) delete mode 100644 tools/perf/arch/xtensa/Build delete mode 100644 tools/perf/arch/xtensa/util/Build delete mode 100644 tools/perf/arch/xtensa/util/dwarf-regs.c diff --git a/tools/perf/arch/xtensa/Build b/tools/perf/arch/xtensa/Build deleted file mode 100644 index e63eabc2c8f4..000000000000 --- a/tools/perf/arch/xtensa/Build +++ /dev/null @@ -1 +0,0 @@ -perf-util-y +=3D util/ diff --git a/tools/perf/arch/xtensa/util/Build b/tools/perf/arch/xtensa/uti= l/Build deleted file mode 100644 index 2d1a48696ad9..000000000000 --- a/tools/perf/arch/xtensa/util/Build +++ /dev/null @@ -1 +0,0 @@ -perf-$(CONFIG_LIBDW) +=3D dwarf-regs.o diff --git a/tools/perf/arch/xtensa/util/dwarf-regs.c b/tools/perf/arch/xte= nsa/util/dwarf-regs.c deleted file mode 100644 index 12f5457300f5..000000000000 --- a/tools/perf/arch/xtensa/util/dwarf-regs.c +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Mapping of DWARF debug register numbers into register names. - * - * Copyright (c) 2015 Cadence Design Systems Inc. - */ - -#include -#include - -#define XTENSA_MAX_REGS 16 - -const char *xtensa_regs_table[XTENSA_MAX_REGS] =3D { - "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", - "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15", -}; - -const char *get_arch_regstr(unsigned int n) -{ - return n < XTENSA_MAX_REGS ? xtensa_regs_table[n] : NULL; -} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index a0bcc2529cb0..05fff75a8f59 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -35,7 +35,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int= machine, unsigned int #if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM \ || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH || EM_HOST = =3D=3D EM_MIPS || EM_HOST =3D=3D EM_PPC \ || EM_HOST =3D=3D EM_PPC64 || EM_HOST =3D=3D EM_RISCV || EM_HOST =3D= =3D EM_S390 || EM_HOST =3D=3D EM_SH \ - || EM_HOST =3D=3D EM_SPARC || EM_HOST =3D=3D EM_SPARCV9 + || EM_HOST =3D=3D EM_SPARC || EM_HOST =3D=3D EM_SPARCV9 || EM_HOST =3D= =3D EM_XTENSA if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; @@ -45,7 +45,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int= machine, unsigned int #if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM \ && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH && EM_HOST !=3D E= M_MIPS && EM_HOST !=3D EM_PPC \ && EM_HOST !=3D EM_PPC64 && EM_HOST !=3D EM_RISCV && EM_HOST !=3D EM_S= 390 && EM_HOST !=3D EM_SH \ - && EM_HOST !=3D EM_SPARC && EM_HOST !=3D EM_SPARCV9 + && EM_HOST !=3D EM_SPARC && EM_HOST !=3D EM_SPARCV9 && EM_HOST !=3D EM= _XTENSA case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include= /dwarf-regs.h index b2cf7d9e4785..9dfc9abfdddd 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -82,7 +82,7 @@ #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) &&= !defined(__arm__) \ && !defined(__loongarch__) && !defined(__mips__) && !defined(__powerpc= __) \ && !defined(__powerpc64__) && !defined(__riscv__) && !defined(__s390x_= _) && !defined(__sh__) \ - && !defined(__sparc64__) && !defined(__sparc__) + && !defined(__sparc64__) && !defined(__sparc__) && !defined(__xtensa__) const char *get_arch_regstr(unsigned int n); #endif =20 --=20 2.47.0.105.g07ac214952-goog From nobody Tue Nov 26 15:41:46 2024 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (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 1A42B24B26 for ; Thu, 17 Oct 2024 00:26:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124777; cv=none; b=nnV15pQ95KB4Cp9F89FxpidXosJYqWbA51BztIAeFIeH//uSqhstQtHrMAmlYYsdQY6UY0j+/DX5x6cKWIm6GrsTsoPHSE9h1QOwsLYe+oofj4lQyAOEeVr2kRxb+FocqfBs97r800z/3Rhq0M5wT8eVAL9Q2msqILdZ9Spz9WA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124777; c=relaxed/simple; bh=h5ZjFR6J5gfi5loliw4Qrm4otdLI+fjevlxZlm5oU1I=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=F3Ef6U8tlzEPIA8DO4N4+43HoSUPWJld/cXIT8y39n1WkqUkEdczbMCigC09kvlbijqYjRR1Fy4cNNvB5/rO0MLe9zKtC8RpT9O9316zcGci/F15e7pfp3oEaI0+nixb/bQ4dR/3uFsqIvq7PWwiE70V+tzFJ7mZgakjH5LhXVg= 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=kAhaN/iV; arc=none smtp.client-ip=209.85.128.201 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="kAhaN/iV" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e3705b2883so10395457b3.3 for ; Wed, 16 Oct 2024 17:26:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124775; x=1729729575; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=KNbBqi1saNqYXEAAo8guTprpDL0iavWB2aVE9Nn4lPM=; b=kAhaN/iVQsPEX+dLCTmBZu+PJa6xauchoYyv2xtoUJP6y5gWhHU+T5sBH2ql+ev3dy dFEqhlOKWZZn/hMDD30xPEjGHzZOOR77QQmQn11M1yGSTkNWQXmCUGwk8pMDac9gSWiA KkusRLYUSg0MaswIU/SvZ7eDgrUyzyMjkBCGxgUrcIDVQF61cTV+pDUIIidH19iJItEC ytlOrlgsexwcSApqro0ge9cbzyJFFj/xyNNj3swALCkvWJJBDnFtz31UoyuzhJO154t8 uTi6UjOFbm4A9CGvybeZzKYB7d6QxuaU+4yGRvS6iUM/ZwJsVIiJyKg/yya/Tf2hZGn5 6UDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124775; x=1729729575; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KNbBqi1saNqYXEAAo8guTprpDL0iavWB2aVE9Nn4lPM=; b=L/EupZWjwFC+XK5ums3tYHR/WbbHOiAX6m29AFBJKvxABeEHJGSTgmtI6zDwIPdvQC 5YAW2FFoReVFTNwzlIwAK+njLaLj+xLp5gOcOLlRV8t+LEGGQXMvIRlvN6is6YCZNrB7 1WA8k52e+YUMQ8N8adapaC9okhdAP7gBihmmnwaY82GFpAeMpuvzTVi7YULey1Kflp9u TbkXpLSdPcJM7ugNwXW+JGWJ9NslW+mSixJggRuJgBn0y8SG3op+vcGb9T81rUg6Q1Dq R586MTv+FkIfixaatrV8WPjyoRO/8+Uz8PFFk8M4yNRbfpy44cu32W9fTA2OMyjyC1Rm lD2Q== X-Forwarded-Encrypted: i=1; AJvYcCVaM6cdZOU6OMOkULBcpA5zziSYZ/OXd1W6NComYO+prFprPEh4JZANZFH+BVlZ8tr1/hlU/SpEnFAsv80=@vger.kernel.org X-Gm-Message-State: AOJu0YzMO5YWE1rqJGXqMimnbx4VCm6JceqhWYbXxAs+KXx3vBSrO67s fU/PN3EG6Xh089WqVy18bc/g4a3zrV9KvhKWw7l8xGHOc2VU4X06day2VXyGWJLTkJLDGylgZqb 65e3LyA== X-Google-Smtp-Source: AGHT+IEbHtnjVfs/XyOXwRVtcImn7Ac6sTdT7J05MnwMea9QA/h1ss5WMT/c3lNVvH8+kCZUWXSdbtC8V8yG X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:dc02:0:b0:e1c:ed3d:7bb7 with SMTP id 3f1490d57ef6-e29782c757dmr2976276.1.1729124774808; Wed, 16 Oct 2024 17:26:14 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:19 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-20-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 19/20] perf dwarf-regs: Remove get_arch_regstr code From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , 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" get_arch_regstr no longer exists so remove declaration. Associated ifs and switches are made unconditional. Signed-off-by: Ian Rogers Reviewed-by: Masami Hiramatsu (Google) --- tools/perf/util/dwarf-regs.c | 12 ------------ tools/perf/util/include/dwarf-regs.h | 7 ------- 2 files changed, 19 deletions(-) diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 05fff75a8f59..28a1cfdf26d4 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -32,23 +32,11 @@ /* Return architecture dependent register string (for kprobe-tracer) */ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigne= d int flags) { -#if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM \ - || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH || EM_HOST = =3D=3D EM_MIPS || EM_HOST =3D=3D EM_PPC \ - || EM_HOST =3D=3D EM_PPC64 || EM_HOST =3D=3D EM_RISCV || EM_HOST =3D= =3D EM_S390 || EM_HOST =3D=3D EM_SH \ - || EM_HOST =3D=3D EM_SPARC || EM_HOST =3D=3D EM_SPARCV9 || EM_HOST =3D= =3D EM_XTENSA if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; } -#endif switch (machine) { -#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM \ - && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH && EM_HOST !=3D E= M_MIPS && EM_HOST !=3D EM_PPC \ - && EM_HOST !=3D EM_PPC64 && EM_HOST !=3D EM_RISCV && EM_HOST !=3D EM_S= 390 && EM_HOST !=3D EM_SH \ - && EM_HOST !=3D EM_SPARC && EM_HOST !=3D EM_SPARCV9 && EM_HOST !=3D EM= _XTENSA - case EM_NONE: /* Generic arch - use host arch */ - return get_arch_regstr(n); -#endif case EM_386: return __get_dwarf_regstr(x86_32_regstr_tbl, n); case EM_X86_64: diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include= /dwarf-regs.h index 9dfc9abfdddd..6ee95cc69917 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -79,13 +79,6 @@ #define DWARF_REG_FB 0xd3affb /* random number */ =20 #ifdef HAVE_LIBDW_SUPPORT -#if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) &&= !defined(__arm__) \ - && !defined(__loongarch__) && !defined(__mips__) && !defined(__powerpc= __) \ - && !defined(__powerpc64__) && !defined(__riscv__) && !defined(__s390x_= _) && !defined(__sh__) \ - && !defined(__sparc64__) && !defined(__sparc__) && !defined(__xtensa__) -const char *get_arch_regstr(unsigned int n); -#endif - const char *get_csky_regstr(unsigned int n, unsigned int flags); =20 /** --=20 2.47.0.105.g07ac214952-goog From nobody Tue Nov 26 15:41:46 2024 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (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 3131F18C92D for ; Thu, 17 Oct 2024 00:26:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124781; cv=none; b=pPZ9Opvw7MgGCJQo1q3DCYz2B8KMxetdzVYJyaLS2biLENhuvJ1Ca04EVD4zk8Cc3hS1q3wA/1JZhW9C0NWYYekjqOIbpeHth3Tw94YcO/Pexu/lhLvz+c3t4NN19q/gSZmlstTRDP+QDAHC3Garb4mr/K2J7bxXa86m90cCBmw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729124781; c=relaxed/simple; bh=atImUl0FotF7zSp+sUCObNt0Nr4nOLPdsoGiee7Bvjg=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=YEEqycsLMXDshJOlB4Hp00y2+p8RZfaqO/aOogcsqonQ97kVD2WKkojG8zhppvV+FTrZaxsnb+Z31P4urUx60g+3BiRrw/Jzmgm8oJEVKg4IiYBq8dP0Akv+pwLcSbbJ5HngvpiCyTsQHYD9kFZ/NwLQbrbJHa/383T6DvOwAU0= 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=Sz/ctqxK; arc=none smtp.client-ip=209.85.128.201 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="Sz/ctqxK" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e376aa4586so12030817b3.1 for ; Wed, 16 Oct 2024 17:26:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124779; x=1729729579; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=SquaAPD0AcQIjNNI8ogmi7jeRDo2TBHiGE7l1NG90xo=; b=Sz/ctqxK3yKIJqd7v9wcFgQDQ7/ELhOIRWc7X1/QRjuwXTrf4hj+4CmmI9pj9bYbT3 Gat1T2/cFoC2ZuESRWRPP+rhdoD9Tfvn5etO2N6hIRRhypebs43vF5DTOFYfN7akbFSM ia4iYOE2HkWcQ/lX8bwX8ISD/92yNq8tWA2Zlqy0QKGzTs107WcRWpzqYJKI6qF5O/WY 5RD/EoT8O1jQQ9kqNpEdUlC851qnDk/VD/nu/ATApHy0W9h+rDja6XiQDQkWRsACPly+ mg4+bEyw+JOwM+L8celfLrWf1Li9zgqNPMnu4lLZElgd/Cr/5IXj4zMriatcN3+UrNBH uMwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124779; x=1729729579; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SquaAPD0AcQIjNNI8ogmi7jeRDo2TBHiGE7l1NG90xo=; b=bR9DJBvZvhIFpC8JUPR08mq2iLhD+d6wjeHxPSIBbCu+oYaXZYD2M9FjDVl+OkZ03L xtZS48bue39XEoOqU3Cn2DnCrE7rN0xiGa86QHRhaiY4V+dRkAgRzEsUE74cMU3kt91M 5yFlOKOm/8unTYx3fEk2PzIEUwRWnsZJc+f9xD1Tkrj0wrbh0Mrh7r3Y/qVXrPqfGvXc FhGwHKAx5yjAaxDX+R+GNr2UTd5K1axtcplfMk8Czbt8CNt5Sv2GSKUknPCWNEhSh+hV Dk1JI0jhWKNLKt3YRCOP0ZzM9C/Tqcu/uVnj1CW/ONpWqN3RMwkY2Z8iMv+X+Vriger+ CjnQ== X-Forwarded-Encrypted: i=1; AJvYcCVlgi9hSRlxf91QYmy02rZ2rgAYDGhEvDYsk5nI94jfEz9bL8HWDMdtzE8TNUdiyQ3swVcDFe35rw+rXV0=@vger.kernel.org X-Gm-Message-State: AOJu0YwXlvolLkD3co+VGSzY3mAc5hurWV3OlzNQPXGKODigorW6g0BL nUSGeghQ+a0KMI5zVEnwkF73Jyq3qsKsJk6JECj65IxPQrCmycGSaj3j3LW35XmaK3b7spTqkYe /0OfGaA== X-Google-Smtp-Source: AGHT+IGs4WdpXIM0biaGJT8f6W/Ar64INlqNJ5uuSoIpjWhZg3wOMLE81Q/Ij8NPQT52fZqpf6BkfGWtnGFO X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:26c4:0:b0:e28:ef6f:3624 with SMTP id 3f1490d57ef6-e2978319b29mr3216276.5.1729124778489; Wed, 16 Oct 2024 17:26:18 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:20 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-21-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 20/20] perf build: Remove PERF_HAVE_DWARF_REGS From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , 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" PERF_HAVE_DWARF_REGS was true when an architecture had a dwarf-regs.c file. There are no more architecture dwarf-regs.c files, selection is done using constants from the ELF file rather than conditional compilation. When removing PERF_HAVE_DWARF_REGS was the only variable in the Makefile, remove the Makefile. Add missing SPDX for RISC-V Makefile. Signed-off-by: Ian Rogers Reviewed-by: Masami Hiramatsu (Google) --- tools/perf/Makefile.config | 13 ++++--------- tools/perf/arch/arm/Makefile | 3 --- tools/perf/arch/arm64/Makefile | 3 --- tools/perf/arch/csky/Makefile | 4 ---- tools/perf/arch/loongarch/Makefile | 3 --- tools/perf/arch/mips/Makefile | 4 ---- tools/perf/arch/powerpc/Makefile | 4 ---- tools/perf/arch/riscv/Makefile | 4 +--- tools/perf/arch/s390/Makefile | 3 --- tools/perf/arch/sh/Makefile | 4 ---- tools/perf/arch/sparc/Makefile | 4 ---- tools/perf/arch/x86/Makefile | 3 --- tools/perf/arch/xtensa/Makefile | 4 ---- 13 files changed, 5 insertions(+), 51 deletions(-) delete mode 100644 tools/perf/arch/csky/Makefile delete mode 100644 tools/perf/arch/sh/Makefile delete mode 100644 tools/perf/arch/xtensa/Makefile diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 1d3f7dcc6b66..87dae64c0501 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -551,15 +551,10 @@ ifndef NO_LIBELF endif =20 ifndef NO_LIBDW - ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) - $(warning DWARF register mappings have not been defined for architec= ture $(SRCARCH), DWARF support disabled) - NO_LIBDW :=3D 1 - else - CFLAGS +=3D -DHAVE_LIBDW_SUPPORT $(LIBDW_CFLAGS) - LDFLAGS +=3D $(LIBDW_LDFLAGS) - EXTLIBS +=3D ${DWARFLIBS} - $(call detected,CONFIG_LIBDW) - endif # PERF_HAVE_DWARF_REGS + CFLAGS +=3D -DHAVE_LIBDW_SUPPORT $(LIBDW_CFLAGS) + LDFLAGS +=3D $(LIBDW_LDFLAGS) + EXTLIBS +=3D ${DWARFLIBS} + $(call detected,CONFIG_LIBDW) endif # NO_LIBDW =20 ifndef NO_LIBBPF diff --git a/tools/perf/arch/arm/Makefile b/tools/perf/arch/arm/Makefile index 9b164d379548..8b59ce8efb89 100644 --- a/tools/perf/arch/arm/Makefile +++ b/tools/perf/arch/arm/Makefile @@ -1,5 +1,2 @@ # SPDX-License-Identifier: GPL-2.0-only -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS :=3D 1 -endif PERF_HAVE_JITDUMP :=3D 1 diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile index ca2e35961287..91570d5d428e 100644 --- a/tools/perf/arch/arm64/Makefile +++ b/tools/perf/arch/arm64/Makefile @@ -1,7 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS :=3D 1 -endif PERF_HAVE_JITDUMP :=3D 1 HAVE_KVM_STAT_SUPPORT :=3D 1 =20 diff --git a/tools/perf/arch/csky/Makefile b/tools/perf/arch/csky/Makefile deleted file mode 100644 index 119b06a64bed..000000000000 --- a/tools/perf/arch/csky/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS :=3D 1 -endif diff --git a/tools/perf/arch/loongarch/Makefile b/tools/perf/arch/loongarch= /Makefile index 79b432744296..52544d59245b 100644 --- a/tools/perf/arch/loongarch/Makefile +++ b/tools/perf/arch/loongarch/Makefile @@ -1,7 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS :=3D 1 -endif PERF_HAVE_JITDUMP :=3D 1 HAVE_KVM_STAT_SUPPORT :=3D 1 =20 diff --git a/tools/perf/arch/mips/Makefile b/tools/perf/arch/mips/Makefile index 733f7b76f52d..827168f1077a 100644 --- a/tools/perf/arch/mips/Makefile +++ b/tools/perf/arch/mips/Makefile @@ -1,8 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS :=3D 1 -endif - # Syscall table generation for perf out :=3D $(OUTPUT)arch/mips/include/generated/asm header :=3D $(out)/syscalls_n64.c diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Mak= efile index ae05727835d8..dc8f4fb8e324 100644 --- a/tools/perf/arch/powerpc/Makefile +++ b/tools/perf/arch/powerpc/Makefile @@ -1,8 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS :=3D 1 -endif - HAVE_KVM_STAT_SUPPORT :=3D 1 PERF_HAVE_JITDUMP :=3D 1 =20 diff --git a/tools/perf/arch/riscv/Makefile b/tools/perf/arch/riscv/Makefile index f01ab2171fd0..087e099fb453 100644 --- a/tools/perf/arch/riscv/Makefile +++ b/tools/perf/arch/riscv/Makefile @@ -1,5 +1,3 @@ -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS :=3D 1 -endif +# SPDX-License-Identifier: GPL-2.0 PERF_HAVE_JITDUMP :=3D 1 HAVE_KVM_STAT_SUPPORT :=3D 1 diff --git a/tools/perf/arch/s390/Makefile b/tools/perf/arch/s390/Makefile index 58e79f5b67a4..c431c21b11ef 100644 --- a/tools/perf/arch/s390/Makefile +++ b/tools/perf/arch/s390/Makefile @@ -1,7 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS :=3D 1 -endif HAVE_KVM_STAT_SUPPORT :=3D 1 PERF_HAVE_JITDUMP :=3D 1 =20 diff --git a/tools/perf/arch/sh/Makefile b/tools/perf/arch/sh/Makefile deleted file mode 100644 index 119b06a64bed..000000000000 --- a/tools/perf/arch/sh/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS :=3D 1 -endif diff --git a/tools/perf/arch/sparc/Makefile b/tools/perf/arch/sparc/Makefile index 7741184894c8..8b59ce8efb89 100644 --- a/tools/perf/arch/sparc/Makefile +++ b/tools/perf/arch/sparc/Makefile @@ -1,6 +1,2 @@ # SPDX-License-Identifier: GPL-2.0-only -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS :=3D 1 -endif - PERF_HAVE_JITDUMP :=3D 1 diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile index 51cf267f4d85..a6b6e0a9308a 100644 --- a/tools/perf/arch/x86/Makefile +++ b/tools/perf/arch/x86/Makefile @@ -1,7 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS :=3D 1 -endif HAVE_KVM_STAT_SUPPORT :=3D 1 PERF_HAVE_JITDUMP :=3D 1 =20 diff --git a/tools/perf/arch/xtensa/Makefile b/tools/perf/arch/xtensa/Makef= ile deleted file mode 100644 index 119b06a64bed..000000000000 --- a/tools/perf/arch/xtensa/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS :=3D 1 -endif --=20 2.47.0.105.g07ac214952-goog