Skip to content

Commit 6ac7528

Browse files
captain5050namhyung
authored andcommitted
perf dwarf-regs: Remove PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET was used for BPF prologue support which was removed in Commit 3d6dfae ("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. Reviewed-by: Masami Hiramatsu (Google) <[email protected]> Signed-off-by: Ian Rogers <[email protected]> Cc: Anup Patel <[email protected]> Cc: Yang Jihong <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: David S. Miller <[email protected]> Cc: Albert Ou <[email protected]> Cc: Shenlin Liang <[email protected]> Cc: Nick Terrell <[email protected]> Cc: Guilherme Amadio <[email protected]> Cc: Steinar H. Gunderson <[email protected]> Cc: Changbin Du <[email protected]> Cc: Alexander Lobakin <[email protected]> Cc: Przemek Kitszel <[email protected]> Cc: Huacai Chen <[email protected]> Cc: Guo Ren <[email protected]> Cc: Masahiro Yamada <[email protected]> Cc: Will Deacon <[email protected]> Cc: James Clark <[email protected]> Cc: Mike Leach <[email protected]> Cc: Chen Pei <[email protected]> Cc: Leo Yan <[email protected]> Cc: Oliver Upton <[email protected]> Cc: Aditya Gupta <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Athira Rajeev <[email protected]> Cc: [email protected] Cc: [email protected] Cc: Bibo Mao <[email protected]> Cc: John Garry <[email protected]> Cc: Atish Patra <[email protected]> Cc: Dima Kogan <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Dr. David Alan Gilbert <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
1 parent 2bf7692 commit 6ac7528

File tree

14 files changed

+27
-197
lines changed

14 files changed

+27
-197
lines changed

tools/perf/Makefile.config

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,6 @@ FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arc
211211
# include ARCH specific config
212212
-include $(src-perf)/arch/$(SRCARCH)/Makefile
213213

214-
ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
215-
CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
216-
endif
217-
218214
include $(srctree)/tools/scripts/utilities.mak
219215

220216
ifeq ($(call get-executable,$(FLEX)),)

tools/perf/arch/arm64/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ ifndef NO_LIBDW
33
PERF_HAVE_DWARF_REGS := 1
44
endif
55
PERF_HAVE_JITDUMP := 1
6-
PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
76
HAVE_KVM_STAT_SUPPORT := 1
87

98
#

tools/perf/arch/arm64/util/dwarf-regs.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
#include <stddef.h>
1010
#include <string.h>
1111
#include <dwarf-regs.h>
12-
#include <linux/ptrace.h> /* for struct user_pt_regs */
1312
#include <linux/stringify.h>
1413

15-
struct pt_regs_dwarfnum {
14+
struct regs_dwarfnum {
1615
const char *name;
1716
unsigned int dwarfnum;
1817
};
@@ -21,14 +20,12 @@ struct pt_regs_dwarfnum {
2120
#define GPR_DWARFNUM_NAME(num) \
2221
{.name = __stringify(%x##num), .dwarfnum = num}
2322
#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0}
24-
#define DWARFNUM2OFFSET(index) \
25-
(index * sizeof((struct user_pt_regs *)0)->regs[0])
2623

2724
/*
2825
* Reference:
2926
* http://infocenter.arm.com/help/topic/com.arm.doc.ihi0057b/IHI0057B_aadwarf64.pdf
3027
*/
31-
static const struct pt_regs_dwarfnum regdwarfnum_table[] = {
28+
static const struct regs_dwarfnum regdwarfnum_table[] = {
3229
GPR_DWARFNUM_NAME(0),
3330
GPR_DWARFNUM_NAME(1),
3431
GPR_DWARFNUM_NAME(2),
@@ -74,19 +71,10 @@ static const struct pt_regs_dwarfnum regdwarfnum_table[] = {
7471
*/
7572
const char *get_arch_regstr(unsigned int n)
7673
{
77-
const struct pt_regs_dwarfnum *roff;
74+
const struct regs_dwarfnum *roff;
75+
7876
for (roff = regdwarfnum_table; roff->name != NULL; roff++)
7977
if (roff->dwarfnum == n)
8078
return roff->name;
8179
return NULL;
8280
}
83-
84-
int regs_query_register_offset(const char *name)
85-
{
86-
const struct pt_regs_dwarfnum *roff;
87-
88-
for (roff = regdwarfnum_table; roff->name != NULL; roff++)
89-
if (!strcmp(roff->name, name))
90-
return DWARFNUM2OFFSET(roff->dwarfnum);
91-
return -EINVAL;
92-
}

tools/perf/arch/loongarch/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
ifndef NO_LIBDW
33
PERF_HAVE_DWARF_REGS := 1
44
endif
5-
PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
65
PERF_HAVE_JITDUMP := 1
76
HAVE_KVM_STAT_SUPPORT := 1
87

tools/perf/arch/loongarch/util/dwarf-regs.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,3 @@ const char *get_arch_regstr(unsigned int n)
3232
n %= 32;
3333
return loongarch_gpr_table[n].name;
3434
}
35-
36-
int regs_query_register_offset(const char *name)
37-
{
38-
const struct pt_regs_dwarfnum *roff;
39-
40-
for (roff = loongarch_gpr_table; roff->name != NULL; roff++)
41-
if (!strcmp(roff->name, name))
42-
return roff->dwarfnum;
43-
return -EINVAL;
44-
}

tools/perf/arch/powerpc/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ PERF_HAVE_DWARF_REGS := 1
44
endif
55

66
HAVE_KVM_STAT_SUPPORT := 1
7-
PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
87
PERF_HAVE_JITDUMP := 1
98

109
#

tools/perf/arch/powerpc/util/dwarf-regs.c

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,25 @@
99
#include <errno.h>
1010
#include <string.h>
1111
#include <dwarf-regs.h>
12-
#include <linux/ptrace.h>
1312
#include <linux/kernel.h>
1413
#include <linux/stringify.h>
1514

16-
struct pt_regs_dwarfnum {
15+
struct regs_dwarfnum {
1716
const char *name;
1817
unsigned int dwarfnum;
19-
unsigned int ptregs_offset;
2018
};
2119

2220
#define REG_DWARFNUM_NAME(r, num) \
23-
{.name = __stringify(%)__stringify(r), .dwarfnum = num, \
24-
.ptregs_offset = offsetof(struct pt_regs, r)}
21+
{.name = __stringify(%)__stringify(r), .dwarfnum = num}
2522
#define GPR_DWARFNUM_NAME(num) \
26-
{.name = __stringify(%gpr##num), .dwarfnum = num, \
27-
.ptregs_offset = offsetof(struct pt_regs, gpr[num])}
28-
#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0, .ptregs_offset = 0}
23+
{.name = __stringify(%gpr##num), .dwarfnum = num}
24+
#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0}
2925

3026
/*
3127
* Reference:
3228
* http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html
3329
*/
34-
static const struct pt_regs_dwarfnum regdwarfnum_table[] = {
30+
static const struct regs_dwarfnum regdwarfnum_table[] = {
3531
GPR_DWARFNUM_NAME(0),
3632
GPR_DWARFNUM_NAME(1),
3733
GPR_DWARFNUM_NAME(2),
@@ -83,22 +79,14 @@ static const struct pt_regs_dwarfnum regdwarfnum_table[] = {
8379
*/
8480
const char *get_arch_regstr(unsigned int n)
8581
{
86-
const struct pt_regs_dwarfnum *roff;
82+
const struct regs_dwarfnum *roff;
83+
8784
for (roff = regdwarfnum_table; roff->name != NULL; roff++)
8885
if (roff->dwarfnum == n)
8986
return roff->name;
9087
return NULL;
9188
}
9289

93-
int regs_query_register_offset(const char *name)
94-
{
95-
const struct pt_regs_dwarfnum *roff;
96-
for (roff = regdwarfnum_table; roff->name != NULL; roff++)
97-
if (!strcmp(roff->name, name))
98-
return roff->ptregs_offset;
99-
return -EINVAL;
100-
}
101-
10290
#define PPC_OP(op) (((op) >> 26) & 0x3F)
10391
#define PPC_RA(a) (((a) >> 16) & 0x1f)
10492
#define PPC_RT(t) (((t) >> 21) & 0x1f)

tools/perf/arch/riscv/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
ifndef NO_LIBDW
22
PERF_HAVE_DWARF_REGS := 1
33
endif
4-
PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
54
PERF_HAVE_JITDUMP := 1
65
HAVE_KVM_STAT_SUPPORT := 1
76

tools/perf/arch/riscv/util/dwarf-regs.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
#include <string.h> /* for strcmp */
1010
#include <dwarf-regs.h>
1111

12-
struct pt_regs_dwarfnum {
12+
struct regs_dwarfnum {
1313
const char *name;
1414
unsigned int dwarfnum;
1515
};
1616

1717
#define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num}
1818
#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0}
1919

20-
struct pt_regs_dwarfnum riscv_dwarf_regs_table[] = {
20+
struct regs_dwarfnum riscv_dwarf_regs_table[] = {
2121
REG_DWARFNUM_NAME("%zero", 0),
2222
REG_DWARFNUM_NAME("%ra", 1),
2323
REG_DWARFNUM_NAME("%sp", 2),
@@ -60,13 +60,3 @@ const char *get_arch_regstr(unsigned int n)
6060
{
6161
return (n < RISCV_MAX_REGS) ? riscv_dwarf_regs_table[n].name : NULL;
6262
}
63-
64-
int regs_query_register_offset(const char *name)
65-
{
66-
const struct pt_regs_dwarfnum *roff;
67-
68-
for (roff = riscv_dwarf_regs_table; roff->name; roff++)
69-
if (!strcmp(roff->name, name))
70-
return roff->dwarfnum;
71-
return -EINVAL;
72-
}

tools/perf/arch/s390/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ ifndef NO_LIBDW
33
PERF_HAVE_DWARF_REGS := 1
44
endif
55
HAVE_KVM_STAT_SUPPORT := 1
6-
PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
76
PERF_HAVE_JITDUMP := 1
87

98
#

0 commit comments

Comments
 (0)