Skip to contentSkip to conversation

tools/runqslower: add BPF_F_CURRENT_CPU for running selftest on older kernels

PATCH In review Andrii Nakryiko 2 participants 2 messages Mar 11, 2020

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

PATCH 1/1 tools/runqslower: add BPF_F_CURRENT_CPU for running selftest on older kernels

Libbpf compiles and runs subset of selftests on each PR in its Github mirror repository. To allow still building up-to-date selftests against outdated kernel images, add back BPF_F_CURRENT_CPU definitions back.

N.B. BCC's runqslower version ([0]) doesn't need BPF_F_CURRENT_CPU due to use of locally checked in vmlinux.h, generated against kernel with 1aae4bdd7879 ("bpf:
Switch BPF UAPI #define constants used from BPF program side to enums") applied.

[0] https://github.com/iovisor/bcc/pull/2809

Fixes 367d82f17eff (" tools/runqslower: Drop copy/pasted BPF_F_CURRENT_CPU definiton")
---
 tools/bpf/runqslower/runqslower.bpf.c | 1 +
 1 file changed, 1 insertion(+)
tools/bpf/runqslower/runqslower.bpf.c +1 -0
index 0ba501305bad..1f18a409f044 100644
@@ -5,6 +5,7 @@
 #include "runqslower.h"
 
 #define TASK_RUNNING 0
+#define BPF_F_CURRENT_CPU 0xffffffffULL
 
 const volatile __u64 min_us = 0;
 const volatile pid_t targ_pid = 0;
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 9 lines · Andrii Nakryiko

Libbpf compiles and runs subset of selftests on each PR in its Github mirror repository. To allow still building up-to-date selftests against outdated kernel images, add back BPF_F_CURRENT_CPU definitions back.

N.B. BCC's runqslower version ([0]) doesn't need BPF_F_CURRENT_CPU due to use of locally checked in vmlinux.h, generated against kernel with 1aae4bdd7879 ("bpf:
Switch BPF UAPI #define constants used from BPF program side to enums") applied.

Quoted 4 lines
   [0] https://github.com/iovisor/bcc/pull/2809
Fixes 367d82f17eff (" tools/runqslower: Drop copy/pasted BPF_F_CURRENT_CPU definiton")

Too bad, applied, thanks!