Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf lock contention: Fix struct rq lock access

The BPF CO-RE's ignore suffix rule requires three underscores.
Otherwise it'd fail like below:

$ sudo perf lock contention -ab
libbpf: prog 'collect_lock_syms': BPF program load failed: Invalid argument
libbpf: prog 'collect_lock_syms': -- BEGIN PROG LOAD LOG --
reg type unsupported for arg#0 function collect_lock_syms#380
; int BPF_PROG(collect_lock_syms)
0: (b7) r6 = 0 ; R6_w=0
1: (b7) r7 = 0 ; R7_w=0
2: (b7) r9 = 1 ; R9_w=1
3: <invalid CO-RE relocation>
failed to resolve CO-RE relocation <byte_off> [381] struct rq__new.__lock (0:0 @ offset 0)

Fixes: 0c1228486befa3d6 ("perf lock contention: Support pre-5.14 kernels")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Hao Luo <haoluo@google.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <song@kernel.org>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20230427234833.1576130-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
e53de7b6 06bff3d9

+4 -4
+4 -4
tools/perf/util/bpf_skel/lock_contention.bpf.c
··· 418 418 419 419 extern struct rq runqueues __ksym; 420 420 421 - struct rq__old { 421 + struct rq___old { 422 422 raw_spinlock_t lock; 423 423 } __attribute__((preserve_access_index)); 424 424 425 - struct rq__new { 425 + struct rq___new { 426 426 raw_spinlock_t __lock; 427 427 } __attribute__((preserve_access_index)); 428 428 ··· 434 434 435 435 for (int i = 0; i < MAX_CPUS; i++) { 436 436 struct rq *rq = bpf_per_cpu_ptr(&runqueues, i); 437 - struct rq__new *rq_new = (void *)rq; 438 - struct rq__old *rq_old = (void *)rq; 437 + struct rq___new *rq_new = (void *)rq; 438 + struct rq___old *rq_old = (void *)rq; 439 439 440 440 if (rq == NULL) 441 441 break;