Skip to contentSkip to conversation

perf syscalltbl: Add syscalltbl__id_at_idx() with no syscall table support

PATCH In review Charlie Jenkins 3 participants 4 messages Aug 31, 2024 – Sep 24, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf syscalltbl: Add syscalltbl__id_at_idx() with no syscall table support

When HAVE_SYSCALL_TABLE_SUPPORT is not defined, neither is syscalltbl__id_at_idx(). However, this function is expected to be defined when HAVE_BPF_SKEL is defined.

Return -1 from syscalltbl__id_at_idx() to match the other functions when HAVE_SYSCALL_TABLE_SUPPORT is not defined.

Without this, compiling perf on riscv when libtraceevents, libelf, and clang are available will cause the functions trying to call syscalltbl__id_at_idx() to be compiled. This results in the following error:

/usr/bin/ld: perf-in.o: in function `.L0 ':
builtin-trace.c:(.text+0x60b14): undefined reference to syscalltbl__id_at_idx' /usr/bin/ld: builtin-trace.c:(.text+0x60c6c): undefined reference to syscalltbl__id_at_idx' /usr/bin/ld: perf-in.o: in function `.L2564':
builtin-trace.c:(.text+0x60cb6): undefined reference to `syscalltbl__id_at_idx'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile.perf:793: perf] Error 1
make[1]: *** [Makefile.perf:290: sub-make] Error 2
make: *** [Makefile:70: all] Error 2
make: Leaving directory '/src/linux-6.11-rc5/tools/perf'

This patch resolves this issue for all architectures which do not define HAVE_SYSCALL_TABLE_SUPPORT.

$ ./perf trace -e syscalls:sys_enter_mmap --max-events=1 ls
0.000 ls/287 syscalls:sys_enter_mmap(__syscall_nr: 222, len: 9939, prot: READ, flags: PRIVATE, fd: 3)
Fixes 7a2fb5619cc1 ("perf trace: Fix iteration of syscall ids in syscalltbl->entries")
---
 tools/perf/util/syscalltbl.c | 5 +++++
 1 file changed, 5 insertions(+)
tools/perf/util/syscalltbl.c +5 -0
index 0dd26b991b3f..12654460428f 100644
@@ -188,4 +188,9 @@ int syscalltbl__strglobmatch_first(struct syscalltbl *tbl, const char *syscall_g
 {
 	return syscalltbl__strglobmatch_next(tbl, syscall_glob, idx);
 }
+
+int syscalltbl__id_at_idx(struct syscalltbl *tbl __always_unused, int idx __always_unused)
+{
+	return -1;
+}
 #endif /* HAVE_SYSCALL_TABLE_SUPPORT */

---
base-commit: 985bf40edf4343dcb04c33f58b40b4a85c1776d4
change-id: 20240830-perf_syscalltbl_fix-4f586221795e

Signature · 1 line
- Charlie
#1 lore raw
Quoted 53 lines · Charlie Jenkins

When HAVE_SYSCALL_TABLE_SUPPORT is not defined, neither is syscalltbl__id_at_idx(). However, this function is expected to be defined when HAVE_BPF_SKEL is defined.

Return -1 from syscalltbl__id_at_idx() to match the other functions when HAVE_SYSCALL_TABLE_SUPPORT is not defined.

Without this, compiling perf on riscv when libtraceevents, libelf, and clang are available will cause the functions trying to call syscalltbl__id_at_idx() to be compiled. This results in the following error:

/usr/bin/ld: perf-in.o: in function `.L0 ':
builtin-trace.c:(.text+0x60b14): undefined reference to syscalltbl__id_at_idx' /usr/bin/ld: builtin-trace.c:(.text+0x60c6c): undefined reference to syscalltbl__id_at_idx' /usr/bin/ld: perf-in.o: in function `.L2564':
builtin-trace.c:(.text+0x60cb6): undefined reference to `syscalltbl__id_at_idx'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile.perf:793: perf] Error 1
make[1]: *** [Makefile.perf:290: sub-make] Error 2
make: *** [Makefile:70: all] Error 2
make: Leaving directory '/src/linux-6.11-rc5/tools/perf'

This patch resolves this issue for all architectures which do not define HAVE_SYSCALL_TABLE_SUPPORT.

$ ./perf trace -e syscalls:sys_enter_mmap --max-events=1 ls
0.000 ls/287 syscalls:sys_enter_mmap(__syscall_nr: 222, len: 9939, prot: READ, flags: PRIVATE, fd: 3)
Fixes 7a2fb5619cc1 ("perf trace: Fix iteration of syscall ids in syscalltbl->entries")
---
 tools/perf/util/syscalltbl.c | 5 +++++
 1 file changed, 5 insertions(+)
tools/perf/util/syscalltbl.c +5 -1
index 0dd26b991b3f..12654460428f 100644
@@ -188,4 +188,9 @@ int syscalltbl__strglobmatch_first(struct syscalltbl *tbl, const char *syscall_g
 {
 	return syscalltbl__strglobmatch_next(tbl, syscall_glob, idx);
 }
+
+int syscalltbl__id_at_idx(struct syscalltbl *tbl __always_unused, int idx __always_unused)
+{
+	return -1;
+}
 #endif /* HAVE_SYSCALL_TABLE_SUPPORT */
 
---
Quoted 5 lines

base-commit: 985bf40edf4343dcb04c33f58b40b4a85c1776d4
change-id: 20240830-perf_syscalltbl_fix-4f586221795e

Signature · 1 line
- Charlie

Can this please be picked up? Compilation on riscv (along with any of the other architectures that don't have syscall table support) is broken. The long term solution is to add support for the syscall table on riscv. I will send out a patch for that, but in the meantime it would be great to have this in the tree.

- Charlie

reviewer
#2 lore raw
Quoted 54 lines · Charlie Jenkins
Quoted 52 lines · Charlie Jenkins

When HAVE_SYSCALL_TABLE_SUPPORT is not defined, neither is syscalltbl__id_at_idx(). However, this function is expected to be defined when HAVE_BPF_SKEL is defined.

Return -1 from syscalltbl__id_at_idx() to match the other functions when HAVE_SYSCALL_TABLE_SUPPORT is not defined.

Without this, compiling perf on riscv when libtraceevents, libelf, and clang are available will cause the functions trying to call syscalltbl__id_at_idx() to be compiled. This results in the following error:

/usr/bin/ld: perf-in.o: in function `.L0 ':
builtin-trace.c:(.text+0x60b14): undefined reference to syscalltbl__id_at_idx' /usr/bin/ld: builtin-trace.c:(.text+0x60c6c): undefined reference to syscalltbl__id_at_idx' /usr/bin/ld: perf-in.o: in function `.L2564':
builtin-trace.c:(.text+0x60cb6): undefined reference to `syscalltbl__id_at_idx'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile.perf:793: perf] Error 1
make[1]: *** [Makefile.perf:290: sub-make] Error 2
make: *** [Makefile:70: all] Error 2
make: Leaving directory '/src/linux-6.11-rc5/tools/perf'

This patch resolves this issue for all architectures which do not define HAVE_SYSCALL_TABLE_SUPPORT.

$ ./perf trace -e syscalls:sys_enter_mmap --max-events=1 ls
0.000 ls/287 syscalls:sys_enter_mmap(__syscall_nr: 222, len: 9939, prot: READ, flags: PRIVATE, fd: 3)
Fixes 7a2fb5619cc1 ("perf trace: Fix iteration of syscall ids in syscalltbl->entries")
---
 tools/perf/util/syscalltbl.c | 5 +++++
 1 file changed, 5 insertions(+)
tools/perf/util/syscalltbl.c +5 -0
index 0dd26b991b3f..12654460428f 100644
@@ -188,4 +188,9 @@ int syscalltbl__strglobmatch_first(struct syscalltbl *tbl, const char *syscall_g
 {
      return syscalltbl__strglobmatch_next(tbl, syscall_glob, idx);
 }
+
+int syscalltbl__id_at_idx(struct syscalltbl *tbl __always_unused, int idx __always_unused)
+{
+     return -1;
+}
 #endif /* HAVE_SYSCALL_TABLE_SUPPORT */
Quoted 12 lines
Quoted 6 lines

---
base-commit: 985bf40edf4343dcb04c33f58b40b4a85c1776d4
change-id: 20240830-perf_syscalltbl_fix-4f586221795e --
- Charlie

Can this please be picked up? Compilation on riscv (along with any of the other architectures that don't have syscall table support) is broken. The long term solution is to add support for the syscall table on riscv. I will send out a patch for that, but in the meantime it would be great to have this in the tree.

I thought something had been done:
https://lore.kernel.org/lkml/[email protected]/
Not sure what's happened.

Thanks,
Ian

maintainer
#3 lore raw
Quoted 68 lines · Ian Rogers
Quoted 54 lines · Charlie Jenkins
Quoted 52 lines · Charlie Jenkins

When HAVE_SYSCALL_TABLE_SUPPORT is not defined, neither is syscalltbl__id_at_idx(). However, this function is expected to be defined when HAVE_BPF_SKEL is defined.

Return -1 from syscalltbl__id_at_idx() to match the other functions when HAVE_SYSCALL_TABLE_SUPPORT is not defined.

Without this, compiling perf on riscv when libtraceevents, libelf, and clang are available will cause the functions trying to call syscalltbl__id_at_idx() to be compiled. This results in the following error:

/usr/bin/ld: perf-in.o: in function `.L0 ':
builtin-trace.c:(.text+0x60b14): undefined reference to syscalltbl__id_at_idx' /usr/bin/ld: builtin-trace.c:(.text+0x60c6c): undefined reference to syscalltbl__id_at_idx' /usr/bin/ld: perf-in.o: in function `.L2564':
builtin-trace.c:(.text+0x60cb6): undefined reference to `syscalltbl__id_at_idx'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile.perf:793: perf] Error 1
make[1]: *** [Makefile.perf:290: sub-make] Error 2
make: *** [Makefile:70: all] Error 2
make: Leaving directory '/src/linux-6.11-rc5/tools/perf'

This patch resolves this issue for all architectures which do not define HAVE_SYSCALL_TABLE_SUPPORT.

$ ./perf trace -e syscalls:sys_enter_mmap --max-events=1 ls
0.000 ls/287 syscalls:sys_enter_mmap(__syscall_nr: 222, len: 9939, prot: READ, flags: PRIVATE, fd: 3)
Fixes 7a2fb5619cc1 ("perf trace: Fix iteration of syscall ids in syscalltbl->entries")
---
 tools/perf/util/syscalltbl.c | 5 +++++
 1 file changed, 5 insertions(+)
tools/perf/util/syscalltbl.c +5 -0
index 0dd26b991b3f..12654460428f 100644
@@ -188,4 +188,9 @@ int syscalltbl__strglobmatch_first(struct syscalltbl *tbl, const char *syscall_g
 {
      return syscalltbl__strglobmatch_next(tbl, syscall_glob, idx);
 }
+
+int syscalltbl__id_at_idx(struct syscalltbl *tbl __always_unused, int idx __always_unused)
+{
+     return -1;
+}
 #endif /* HAVE_SYSCALL_TABLE_SUPPORT */
Quoted 12 lines
Quoted 6 lines

---
base-commit: 985bf40edf4343dcb04c33f58b40b4a85c1776d4
change-id: 20240830-perf_syscalltbl_fix-4f586221795e --
- Charlie

Can this please be picked up? Compilation on riscv (along with any of the other architectures that don't have syscall table support) is broken. The long term solution is to add support for the syscall table on riscv. I will send out a patch for that, but in the meantime it would be great to have this in the tree.

Quoted 3 lines

I thought something had been done:
https://lore.kernel.org/lkml/[email protected]/
Not sure what's happened.

Hi Arnaldo, can you clarify what's going on here?

Thanks,
Namhyung