* [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found
@ 2026-11-21 3:20 Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 01/16] perf build: Link the GTK UI with EXTRA_CFLAGS Arnaldo Carvalho de Melo
` (16 more replies)
0 siblings, 17 replies; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-11-21 3:20 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-kernel, linux-perf-users,
Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Hi,
Nothing measured how much of perf the test suite reaches. Patches 15-16
add coverage.sh, which builds perf with clang source based coverage, runs
the full test suite and reports line and function coverage, and
coverage-table.sh, which renders the biggest uncovered gaps over the
whole tree, not only the files the tests already touch.
Patches 1-6 are the fixes the first runs found, 7-14 their tests and the
test fixes. 1 is a build fix for the GTK UI, which the coverage build
needs; 5 is a parser change, not a regression fix.
- The GTK UI was not linked with EXTRA_CFLAGS, so the coverage build
never saw its counters (1).
- Absolute addressing was missing from the data type resolver (2);
movabs was not parsed (5).
- --insn-stat was printed before the samples were accounted (3).
- FEATURE-DUMP didn't record features checked outside FEATURE_TESTS
(4).
- The flexible array member row showed 0.00% while the member said
100.00% (6).
- Tests for the x86 operand parser (7), DW_OP_addrx globals (8, test
only: fixed upstream by c3991e42f58a3650), the flexible array path
(9), a struct pointer kept in a register at -O2 (10) and the
annotate stats (11).
- Intel PT virtual LBR, dlfilter zeroed IP and LBR inline unwinding
test fixes (12-14).
clang DWARF 4, full test suite as root on this AMD host with the v10
plus cs-etm tree: 112250 of 232853 lines (48.21%), 86661 of 173942 in
tools/perf/ (49.82%), 170 passed, one failure (21.2, the known
Tracepoint event kernel regression). The total includes libbpf and the
dlfilters, so it is not comparable with the v6 total.
The harness and the tests were developed with an AI coding assistant
(OpenCode), which drafted the script and the tests and helped debug the
failures; I reviewed every change and reproduced each failure.
What changed from v9:
- Split into fixes, tests and infrastructure; the fixes no longer
carry their tests.
- The harness is 15 and the table is split out of it as 16.
- The libbfd probe (v9 9) is dropped, the base checks it via
Makefile.feature (5aa34144027f); the movabs change (5) is new.
- 8 and 10: diagnostic greps use || true, so they no longer fire the
EXIT trap.
Best regards,
- Arnaldo
Arnaldo Carvalho de Melo (16):
perf build: Link the GTK UI with EXTRA_CFLAGS
perf annotate: Handle absolute addressing in data type profiling
perf annotate: Print the stats after the annotations
perf build: Record the features checked outside FEATURE_TESTS
perf annotate-x86: Parse movabs like a mov
perf annotate-data: Count flexible array accesses for the whole struct
perf tests: Exercise the x86 operand parser
perf tests: Exercise DW_OP_addrx global variables
perf tests: Exercise the flexible array member path
perf tests: Exercise data type resolution from a register
perf tests: Exercise the annotate stats output
perf tests: Fix the Intel PT virtual LBR check
perf test: Drop samples without an IP in the dlfilter test
perf test: Skip the LBR inline unwinding check when unsupported
perf scripts: Add a coverage harness for perf
perf scripts: Add a coverage table
tools/perf/.gitignore | 1 +
tools/perf/Documentation/perf-annotate.txt | 2 +-
tools/perf/Makefile | 15 +-
tools/perf/Makefile.config | 7 +
tools/perf/Makefile.perf | 8 +-
tools/perf/builtin-annotate.c | 19 +-
tools/perf/scripts/coverage-table.sh | 310 +++++++++++++
tools/perf/scripts/coverage.sh | 434 ++++++++++++++++++
tools/perf/tests/Build | 1 +
tools/perf/tests/annotate-ops.c | 127 +++++
tools/perf/tests/builtin-test.c | 4 +
tools/perf/tests/shell/addr2line_inlines.sh | 20 +-
tools/perf/tests/shell/annotate_stats.sh | 69 +++
.../perf/tests/shell/data_type_flex_array.sh | 111 +++++
tools/perf/tests/shell/data_type_global.sh | 73 +++
tools/perf/tests/shell/data_type_register.sh | 63 +++
tools/perf/tests/shell/script_dlfilter.sh | 2 +-
tools/perf/tests/shell/test_intel_pt.sh | 10 +-
tools/perf/tests/tests.h | 4 +
tools/perf/tests/workloads/Build | 6 +
tools/perf/tests/workloads/flex_array.c | 55 +++
tools/perf/tests/workloads/global_data.c | 57 +++
tools/perf/tests/workloads/regptr.c | 60 +++
tools/perf/ui/browsers/annotate-data.c | 7 +-
tools/perf/util/annotate-arch/annotate-x86.c | 45 +-
tools/perf/util/annotate-data.c | 25 +-
tools/perf/util/annotate-data.h | 8 +
tools/perf/util/annotate.c | 27 +-
tools/perf/util/annotate.h | 7 +
29 files changed, 1548 insertions(+), 29 deletions(-)
create mode 100755 tools/perf/scripts/coverage-table.sh
create mode 100755 tools/perf/scripts/coverage.sh
create mode 100644 tools/perf/tests/annotate-ops.c
create mode 100755 tools/perf/tests/shell/annotate_stats.sh
create mode 100755 tools/perf/tests/shell/data_type_flex_array.sh
create mode 100755 tools/perf/tests/shell/data_type_global.sh
create mode 100755 tools/perf/tests/shell/data_type_register.sh
create mode 100644 tools/perf/tests/workloads/flex_array.c
create mode 100644 tools/perf/tests/workloads/global_data.c
create mode 100644 tools/perf/tests/workloads/regptr.c
base-commit: bb27ddbaee56536fb8df0a24f07b526766dfe131
v1-head: 3f5465bea8f5a97a
v2-head: 9706c488afffeb6d
v3-head: f2daf1586528671a
v4-head: b9e240a1b80ecd2a
v5-head: a21454e3d055c93b
v6-head: e1315408a335617d
v7-head: 7f8dc594d77ed495
v8-head: 67fde34aeab98a91
v9-head: b1765115908ede31
v10-head: 83b30d979fb2d96d
--
2.56.0
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v10 01/16] perf build: Link the GTK UI with EXTRA_CFLAGS
2026-11-21 3:20 [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found Arnaldo Carvalho de Melo
@ 2026-11-21 3:20 ` Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 02/16] perf annotate: Handle absolute addressing in data type profiling Arnaldo Carvalho de Melo
` (15 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-11-21 3:20 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-kernel, linux-perf-users,
Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
The GTK objects are compiled with EXTRA_CFLAGS but libperf-gtk.so is
linked with LDFLAGS only, so flags with link-time parts never reach it.
With -fprofile-instr-generate the profiler runtime is missing at link
time. Pass EXTRA_CFLAGS at link time, as the dlfilter rule does.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Makefile.perf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 1850ca2eeffe962a..d4b641925ab296db 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -644,7 +644,7 @@ $(GTK_IN): FORCE prepare
$(Q)$(MAKE) $(build)=gtk
$(OUTPUT)libperf-gtk.so: $(GTK_IN) $(PERFLIBS)
- $(QUIET_LINK)$(CC) -o $@ -shared $(LDFLAGS) $(filter %.o,$^) $(GTK_LIBS)
+ $(QUIET_LINK)$(CC) -o $@ -shared $(LDFLAGS) $(EXTRA_CFLAGS) $(filter %.o,$^) $(GTK_LIBS)
$(SCRIPTS) : $(OUTPUT)% : %.sh
$(QUIET_GEN)$(INSTALL) '$<' '$@'
--
2.56.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v10 02/16] perf annotate: Handle absolute addressing in data type profiling
2026-11-21 3:20 [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 01/16] perf build: Link the GTK UI with EXTRA_CFLAGS Arnaldo Carvalho de Melo
@ 2026-11-21 3:20 ` Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 03/16] perf annotate: Print the stats after the annotations Arnaldo Carvalho de Melo
` (14 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-11-21 3:20 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-kernel, linux-perf-users,
Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
x86 accesses globals with absolute addresses, and not only in 32-bit
builds: the 64-bit kernel's __default_send_IPI_dest_field uses a disp32
the CPU sign extends, an absolute SIB with no base and no index. From an
allmodconfig clang build, arch/x86/kernel/ipi.o:
890: 8b 04 25 00 c3 5f ff mov 0xffffffffff5fc300,%eax
8b1: 89 3c 25 10 c3 5f ff mov %edi,0xffffffffff5fc310
llvm-objdump prints the same displacements as -0xa03d00 and -0xa03cf0.
The operand parser only recognized offset(reg), so the resolver skipped
the access as not a memory reference.
Parse a bare hex number as an absolute memory operand, including the
negative disp32 llvm-objdump prints, and use the address in the resolver.
Jump, call and loop targets are left out; the displacement is sign
extended for 64-bit objects and zero extended for 32-bit ones; values
that do not fit, zero and relocatable addends are skipped.
An absolute global load records the type in the destination register, so
the state is TSR_KIND_TYPE; a POINTER state records the address itself.
Guard the comparisons that made a -1 frame base equal the -1 "no
register" of an absolute operand. Operands left with no register, like a
user space "%gs:imm", are no longer looked up as variables, which can
change the data type stats of those samples.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/annotate-arch/annotate-x86.c | 44 ++++++++++++++++----
tools/perf/util/annotate.c | 27 +++++++++++-
tools/perf/util/annotate.h | 7 ++++
3 files changed, 70 insertions(+), 8 deletions(-)
diff --git a/tools/perf/util/annotate-arch/annotate-x86.c b/tools/perf/util/annotate-arch/annotate-x86.c
index e38a4e7a54d5585c..19663b780d19e2c4 100644
--- a/tools/perf/util/annotate-arch/annotate-x86.c
+++ b/tools/perf/util/annotate-arch/annotate-x86.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include <string.h>
#include <stdlib.h>
+#include <limits.h>
#include <linux/compiler.h>
#include <linux/ctype.h>
#include <linux/zalloc.h>
@@ -230,6 +231,11 @@ static bool vtable_get_rettype(Dwarf_Die *class_die, int offset,
return die_get_real_type(&func_die, type_die) != NULL;
}
+static bool is_stack_or_fb_reg(struct type_state *state, int fbreg, int reg)
+{
+ return (fbreg != -1 && reg == fbreg) || reg == state->stack_reg;
+}
+
static void update_insn_state_x86(struct type_state *state,
struct data_loc_info *dloc, Dwarf_Die *cu_die,
struct disasm_line *dl)
@@ -437,7 +443,7 @@ static void update_insn_state_x86(struct type_state *state,
invalidate_reg_state(tsr);
/* Case 1: Based on stack pointer or frame pointer */
- if (sreg == fbreg || sreg == state->stack_reg) {
+ if (is_stack_or_fb_reg(state, fbreg, sreg)) {
struct type_state_stack *stack;
int offset = src->offset - fboff;
@@ -626,7 +632,7 @@ static void update_insn_state_x86(struct type_state *state,
retry:
/* Check stack variables with offset */
- if (sreg == fbreg || sreg == state->stack_reg) {
+ if (is_stack_or_fb_reg(state, fbreg, sreg)) {
struct type_state_stack *stack;
int offset = src->offset - fboff;
@@ -717,13 +723,17 @@ static void update_insn_state_x86(struct type_state *state,
pr_debug_type_name(&tsr->type, tsr->kind);
}
/* Or check if it's a global variable */
- else if (sreg == DWARF_REG_PC) {
+ else if (sreg == DWARF_REG_PC ||
+ annotated_op_loc__is_abs(src, map__dso(dloc->ms->map))) {
struct map_symbol *ms = dloc->ms;
u64 ip = ms->sym->start + dl->al.offset;
u64 addr;
int offset;
- addr = annotate_calc_pcrel(ms, ip, src->offset, dl);
+ if (sreg == DWARF_REG_PC)
+ addr = annotate_calc_pcrel(ms, ip, src->offset, dl);
+ else
+ addr = annotated_op_loc__abs_addr(src, map__dso(ms->map));
if (!get_global_var_type(cu_die, dloc, ip, addr, &offset,
&type_die) ||
@@ -737,7 +747,7 @@ static void update_insn_state_x86(struct type_state *state,
tsr->offset = 0;
tsr->ok = true;
- pr_debug_dtp("mov [%x] global addr=%"PRIx64" -> reg%d",
+ pr_debug_dtp("mov [%x] global addr=%#"PRIx64" -> reg%d",
insn_offset, addr, dst->reg1);
pr_debug_type_name(&type_die, tsr->kind);
}
@@ -827,7 +837,7 @@ static void update_insn_state_x86(struct type_state *state,
/* Case 3. register to memory transfers */
if (!src->mem_ref && dst->mem_ref) {
/* Check stack variables with offset */
- if (dst->reg1 == fbreg || dst->reg1 == state->stack_reg) {
+ if (is_stack_or_fb_reg(state, fbreg, dst->reg1)) {
struct type_state_stack *stack;
int offset = dst->offset - fboff;
@@ -931,7 +941,7 @@ static int extract_reg_offset(const struct arch *arch, const char *str,
}
static void extract_op_location_x86(const struct arch *arch,
- struct disasm_line *dl __maybe_unused,
+ struct disasm_line *dl,
const char *op_str, int op_idx __maybe_unused,
struct annotated_op_loc *op_loc)
{
@@ -960,6 +970,26 @@ static void extract_op_location_x86(const struct arch *arch,
op_loc->offset = strtol(s + 1, &p, 0);
if (p && p != s + 1)
op_loc->imm = true;
+ } else if ((*s == '-' || strstarts(s, "0x")) &&
+ !ins__is_call(&dl->ins) && !ins__is_jump(&dl->ins) &&
+ strncmp(dl->ins.name, "loop", 4)) {
+ bool neg = *s == '-';
+ u64 offset = strtoull(s + neg, NULL, 0);
+ bool exact;
+
+ if (neg)
+ offset = -offset;
+ /*
+ * The offset is an int: a disp32 fits it as a u32 or,
+ * sign extended, as an int, which is how the LLVM
+ * disassembler prints one that does not fit an int.
+ */
+ exact = (s64)(int)offset == (s64)offset;
+ if (offset != 0 && (offset <= UINT_MAX || exact)) {
+ /* An absolute address: 32-bit code, or a 64-bit disp32 */
+ op_loc->mem_ref = true;
+ op_loc->offset = offset;
+ }
}
}
}
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 66d3453e7ffd0d5d..61ee6a3b2fa91d57 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -2755,6 +2755,21 @@ int arch__dwarf_regnum(const struct arch *arch, const char *str)
return reg < 0 ? -1 : reg;
}
+/* A relocatable object's operand is an unrelocated addend, not an address */
+bool annotated_op_loc__is_abs(const struct annotated_op_loc *op_loc,
+ const struct dso *dso)
+{
+ return !dso__rel(dso) && op_loc->mem_ref && op_loc->reg1 == -1 && op_loc->reg2 == -1 &&
+ op_loc->segment == INSN_SEG_NONE && op_loc->offset != 0;
+}
+
+/* The disp32 of a 64-bit object is sign extended, a 32-bit one is not */
+u64 annotated_op_loc__abs_addr(const struct annotated_op_loc *op_loc,
+ const struct dso *dso)
+{
+ return dso__is_64_bit(dso) ? (u64)(s64)op_loc->offset : (u32)op_loc->offset;
+}
+
/**
* annotate_get_insn_location - Get location of instruction
* @arch: the architecture info
@@ -2772,7 +2787,7 @@ int arch__dwarf_regnum(const struct arch *arch, const char *str)
* mov (%rax), %rcx # src_reg1 = rax, src_mem = 1, src_offset = 0
* # dst_reg1 = rcx, dst_mem = 0
*
- * mov 0x18, %r8 # src_reg1 = -1, src_mem = 0
+ * mov 0x18, %r8 # src_reg1 = -1, src_mem = 1, src_offset = 0x18
* # dst_reg1 = r8, dst_mem = 0
*
* mov %rsi, 8(%rbx,%rcx,4) # src_reg1 = rsi, src_mem = 0, src_multi_regs = 0
@@ -3046,6 +3061,13 @@ __hist_entry__get_data_type(struct hist_entry *he, const struct arch *arch,
dloc.var_addr = annotate_calc_pcrel(ms, dloc.ip,
op_loc->offset, dl);
}
+ /* An absolute address: 32-bit code, or a 64-bit disp32 */
+ else if (annotated_op_loc__is_abs(op_loc, map__dso(ms->map))) {
+ struct dso *dso = map__dso(ms->map);
+
+ dloc.var_addr = annotated_op_loc__abs_addr(op_loc, dso);
+ op_loc->reg1 = DWARF_REG_PC;
+ }
/* This CPU access in kernel - pretend PC-relative addressing */
if (dso__kernel(map__dso(ms->map)) && arch__is_x86(arch) &&
@@ -3054,6 +3076,9 @@ __hist_entry__get_data_type(struct hist_entry *he, const struct arch *arch,
op_loc->reg1 = DWARF_REG_PC;
}
+ if (op_loc->reg1 == -1)
+ continue;
+
mem_type = find_data_type(&dloc);
if (mem_type == NULL && is_stack_canary(arch, op_loc)) {
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index bc2237609d6e16e8..dc4fc8b1b320c1fb 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -18,6 +18,7 @@
#include "branch.h"
#include "evsel.h"
+struct dso;
struct hist_browser_timer;
struct hist_entry;
struct map;
@@ -637,6 +638,12 @@ struct annotated_insn_loc {
i < INSN_OP_MAX; \
i++, op_loc++)
+/* Bare number operand: an absolute address, as 32-bit code and the kernel use */
+bool annotated_op_loc__is_abs(const struct annotated_op_loc *op_loc,
+ const struct dso *dso);
+u64 annotated_op_loc__abs_addr(const struct annotated_op_loc *op_loc,
+ const struct dso *dso);
+
/* Get detailed location info in the instruction */
int annotate_get_insn_location(const struct arch *arch, struct disasm_line *dl,
struct annotated_insn_loc *loc);
--
2.56.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v10 03/16] perf annotate: Print the stats after the annotations
2026-11-21 3:20 [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 01/16] perf build: Link the GTK UI with EXTRA_CFLAGS Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 02/16] perf annotate: Handle absolute addressing in data type profiling Arnaldo Carvalho de Melo
@ 2026-11-21 3:20 ` Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 04/16] perf build: Record the features checked outside FEATURE_TESTS Arnaldo Carvalho de Melo
` (13 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-11-21 3:20 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-kernel, linux-perf-users,
Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
With --code-with-type the instruction stats are printed from
hists__find_annotations() before that event is annotated: the first
event reports zeros and later events can report stale counts. The data
type total is only counted in --data-type mode, so --type-stat without
it is incomplete too.
Print the stats once after all events have been annotated, warning if
--type-stat is used without --data-type. Leave the TUI's alternate
screen before printing, so the stats remain on the terminal.
Fixes: 58824fa0087e1cb7 ("perf annotate: Add --insn-stat option for debugging")
Fixes: 61a9741e9f78c64c ("perf annotate: Add --type-stat option for debugging")
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-annotate.txt | 2 +-
tools/perf/builtin-annotate.c | 19 ++++++++++++++-----
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/tools/perf/Documentation/perf-annotate.txt b/tools/perf/Documentation/perf-annotate.txt
index 1a90b09a12d5abb1..d27eff28ba4f6af0 100644
--- a/tools/perf/Documentation/perf-annotate.txt
+++ b/tools/perf/Documentation/perf-annotate.txt
@@ -169,7 +169,7 @@ include::itrace.txt[]
all data types it finds.
--type-stat::
- Show stats for the data type annotation.
+ Show stats for the data type annotation (with --data-type).
--skip-empty::
Do not display empty (or dummy) events.
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 7cb7e03d9a21d81b..e768f0fd8d4813de 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -414,11 +414,6 @@ static void hists__find_annotations(struct hists *hists,
struct rb_node *nd = rb_first_cached(&hists->entries), *next;
int key = K_RIGHT;
- if (ann->type_stat)
- print_annotate_data_stat(&ann_data_stat);
- if (ann->insn_stat)
- print_annotate_item_stat(&ann_insn_stat, "Instruction");
-
while (nd) {
struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node);
struct annotation *notes;
@@ -663,6 +658,17 @@ static int __cmd_annotate(struct perf_annotate *ann)
hists__find_annotations(hists, pos, ann);
}
+ if (use_browser == 1 && (ann->insn_stat || (ann->data_type && ann->type_stat))) {
+ /* Leave the alternate screen before printing to the terminal. */
+ ui__exit(false);
+ use_browser = 0;
+ }
+
+ if (ann->data_type && ann->type_stat)
+ print_annotate_data_stat(&ann_data_stat);
+ if (ann->insn_stat)
+ print_annotate_item_stat(&ann_insn_stat, "Instruction");
+
if (use_browser == 2) {
void (*show_annotations)(void);
@@ -868,6 +874,9 @@ int cmd_annotate(int argc, const char **argv)
if (quiet)
perf_quiet_option();
+ if (annotate.type_stat && !annotate.data_type)
+ pr_warning("Warning: --type-stat needs --data-type\n");
+
data.path = input_name;
perf_tool__init(&annotate.tool, /*ordered_events=*/true);
--
2.56.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v10 04/16] perf build: Record the features checked outside FEATURE_TESTS
2026-11-21 3:20 [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found Arnaldo Carvalho de Melo
` (2 preceding siblings ...)
2026-11-21 3:20 ` [PATCH v10 03/16] perf annotate: Print the stats after the annotations Arnaldo Carvalho de Melo
@ 2026-11-21 3:20 ` Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 05/16] perf annotate-x86: Parse movabs like a mov Arnaldo Carvalho de Melo
` (12 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-11-21 3:20 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-kernel, linux-perf-users,
Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
llvm-perf and rust are in FEATURE_DISPLAY but not in FEATURE_TESTS, and
jvmti and jvmti-cmlr are in neither list: they can't be part of the
test-all fast path, which sets every FEATURE_TESTS entry to 1 when
test-all.c builds. Since FEATURE-DUMP is written from FEATURE_TESTS
only, a FEATURES_DUMP= build, as used by build-test, never sees them and
silently builds without libLLVM, the rust workloads and the jvmti agent.
Record the display features and the jvmti ones that aren't in
FEATURE_TESTS in the dump after the regular feature checks have run.
Fixes: 206dcfca1f5cfac3 ("perf build: Autodetect minimum required llvm-dev version")
Fixes: 3f5dfa472ea6771c ("tools build: Fix rust feature detection")
Cc: James Clark <james.clark@linaro.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Makefile.config | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 1cee80c531abf434..9613594b40e82179 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -1364,3 +1364,10 @@ endif
# tests.
$(shell rm -f $(FEATURE_DUMP_FILENAME))
$(foreach feat,$(FEATURE_TESTS),$(shell echo "$(call feature_assign,$(feat))" >> $(FEATURE_DUMP_FILENAME)))
+# Features checked outside FEATURE_TESTS aren't part of the test-all fast
+# path, so they have to be checked explicitly and recorded here too,
+# otherwise a FEATURES_DUMP= build silently disables them (llvm-perf,
+# rust and the jvmti agent).
+ifeq ($(FEATURES_DUMP),)
+$(foreach feat,$(filter-out $(FEATURE_TESTS),$(FEATURE_DISPLAY) jvmti jvmti-cmlr),$(shell echo "$(call feature_assign,$(feat))" >> $(FEATURE_DUMP_FILENAME)))
+endif
--
2.56.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v10 05/16] perf annotate-x86: Parse movabs like a mov
2026-11-21 3:20 [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found Arnaldo Carvalho de Melo
` (3 preceding siblings ...)
2026-11-21 3:20 ` [PATCH v10 04/16] perf build: Record the features checked outside FEATURE_TESTS Arnaldo Carvalho de Melo
@ 2026-11-21 3:20 ` Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 06/16] perf annotate-data: Count flexible array accesses for the whole struct Arnaldo Carvalho de Melo
` (11 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-11-21 3:20 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-kernel, linux-perf-users,
Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
x86__instructions[] has no movabs: ins__find() strips the size suffix
of "movabsq" and still finds nothing, so mov__parse() never runs and
the source and target operands of the instruction are not split. The
data type tracking then sees nothing, where the same instruction as a
plain mov sets the destination register.
The clang allmodconfig build has plenty, 282558 in vmlinux, all with an
immediate, the KASAN shadow offset:
ffffffff81271e2b: movabsq $-0x2000040000000000, %r15
No movabs with a memory operand shows up in vmlinux or in any object of
that build.
Add it as a mov.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/annotate-arch/annotate-x86.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/util/annotate-arch/annotate-x86.c b/tools/perf/util/annotate-arch/annotate-x86.c
index 19663b780d19e2c4..3f6cf3bfb63dd300 100644
--- a/tools/perf/util/annotate-arch/annotate-x86.c
+++ b/tools/perf/util/annotate-arch/annotate-x86.c
@@ -85,6 +85,7 @@ static const struct ins x86__instructions[] = {
{ .name = "lea", .ops = &mov_ops, },
{ .name = "lock", .ops = &lock_ops, },
{ .name = "mov", .ops = &mov_ops, },
+ { .name = "movabs", .ops = &mov_ops, },
{ .name = "movapd", .ops = &mov_ops, },
{ .name = "movaps", .ops = &mov_ops, },
{ .name = "movdqa", .ops = &mov_ops, },
--
2.56.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v10 06/16] perf annotate-data: Count flexible array accesses for the whole struct
2026-11-21 3:20 [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found Arnaldo Carvalho de Melo
` (4 preceding siblings ...)
2026-11-21 3:20 ` [PATCH v10 05/16] perf annotate-x86: Parse movabs like a mov Arnaldo Carvalho de Melo
@ 2026-11-21 3:20 ` Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 07/16] perf tests: Exercise the x86 operand parser Arnaldo Carvalho de Melo
` (10 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-11-21 3:20 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-kernel, linux-perf-users,
Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
The per-member percentage sums the histogram entries in the member's
own [offset, offset + size) range. A flexible array member is resolved
past the end of its struct, so the struct row only covered its declared
size and showed 0.00% while the member row showed 100.00% and the
header said N samples.
Take a member's extent as the end of its furthest child as well, so the
struct counts what was resolved past it. Union members all start at
offset 0, so a plain union keeps its size; a member that is itself a
struct with a flexible array extends the union too. The TUI browser
accounts the members the same way, use the extent there as well.
Fixes: aaca646915a1bb53 ("perf annotate-data: Adjust type offset for flex-array")
Reviewed-by: Ian Rogers <irogers@google.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/browsers/annotate-data.c | 7 +++----
tools/perf/util/annotate-data.c | 25 +++++++++++++++++++++++--
tools/perf/util/annotate-data.h | 8 ++++++++
3 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/tools/perf/ui/browsers/annotate-data.c b/tools/perf/ui/browsers/annotate-data.c
index 0f778788df4a934b..e4047e97e8a943a4 100644
--- a/tools/perf/ui/browsers/annotate-data.c
+++ b/tools/perf/ui/browsers/annotate-data.c
@@ -53,12 +53,11 @@ static int get_member_overhead(struct annotated_data_type *adt,
struct evsel *leader)
{
struct annotated_member *member = entry->data;
- int i, k;
+ int i, k, end = annotated_member__extent(member);
- for (i = 0; i < member->size; i++) {
+ for (i = member->offset; i < end; i++) {
struct type_hist *h;
struct evsel *evsel;
- int offset = member->offset + i;
k = 0;
for_each_group_evsel(evsel, leader) {
@@ -69,7 +68,7 @@ static int get_member_overhead(struct annotated_data_type *adt,
continue;
h = &adt->histograms[evsel->core.idx];
- if (hashmap__find(&h->samples, offset, &hist))
+ if (hashmap__find(&h->samples, i, &hist))
update_hist_entry(&entry->hists[k], hist);
k++;
}
diff --git a/tools/perf/util/annotate-data.c b/tools/perf/util/annotate-data.c
index 2332d465f9751ef3..19c1de5c29853f69 100644
--- a/tools/perf/util/annotate-data.c
+++ b/tools/perf/util/annotate-data.c
@@ -2208,6 +2208,26 @@ static void print_annotated_data_value(struct type_hist *h, u64 period, int nr_s
color_fprintf(stdout, color, " %7.2f", percent);
}
+/*
+ * A flexible array member is resolved past the end of its parent, so the
+ * parent's samples are not bounded by its size. A GNU extension non-last
+ * member with a flexible array can overlap the next member and double-count.
+ */
+int annotated_member__extent(struct annotated_member *member)
+{
+ struct annotated_member *child;
+ int end = member->offset + member->size;
+
+ list_for_each_entry(child, &member->children, node) {
+ int child_end = annotated_member__extent(child);
+
+ if (child_end > end)
+ end = child_end;
+ }
+
+ return end;
+}
+
static void print_annotated_data_type(struct annotated_data_type *mem_type,
struct annotated_member *member,
struct evsel *evsel, int indent)
@@ -2215,6 +2235,7 @@ static void print_annotated_data_type(struct annotated_data_type *mem_type,
struct annotated_member *child;
struct type_hist *h;
int i, nr_events = 0, samples = 0;
+ int end = annotated_member__extent(member);
u64 period = 0;
int width = symbol_conf.show_total_period ? 11 : 7;
struct evsel *pos;
@@ -2228,10 +2249,10 @@ static void print_annotated_data_type(struct annotated_data_type *mem_type,
samples = 0;
period = 0;
- for (i = 0; i < member->size; i++) {
+ for (i = member->offset; i < end; i++) {
struct type_hist_entry *entry;
- if (!hashmap__find(&h->samples, member->offset + i, &entry))
+ if (!hashmap__find(&h->samples, i, &entry))
continue;
samples += entry->nr_samples;
diff --git a/tools/perf/util/annotate-data.h b/tools/perf/util/annotate-data.h
index 184262c7356213fa..6e0d410929651426 100644
--- a/tools/perf/util/annotate-data.h
+++ b/tools/perf/util/annotate-data.h
@@ -260,6 +260,9 @@ void global_var_type__tree_delete(struct rb_root *root);
/* Print data type annotation (including members) on stdout */
int hist_entry__annotate_data_tty(struct hist_entry *he, struct evsel *evsel);
+/* End offset of a member, including a flexible array's children */
+int annotated_member__extent(struct annotated_member *member);
+
/* Get name of member field at the given offset in the data type */
int annotated_data_type__get_member_name(struct annotated_data_type *adt,
char *buf, size_t sz, int member_offset);
@@ -316,6 +319,11 @@ static inline int hist_entry__annotate_data_tty(struct hist_entry *he __maybe_un
return -1;
}
+static inline int annotated_member__extent(struct annotated_member *member)
+{
+ return member->offset + member->size;
+}
+
static inline int annotated_data_type__get_member_name(struct annotated_data_type *adt __maybe_unused,
char *buf __maybe_unused,
size_t sz __maybe_unused,
--
2.56.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v10 07/16] perf tests: Exercise the x86 operand parser
2026-11-21 3:20 [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found Arnaldo Carvalho de Melo
` (5 preceding siblings ...)
2026-11-21 3:20 ` [PATCH v10 06/16] perf annotate-data: Count flexible array accesses for the whole struct Arnaldo Carvalho de Melo
@ 2026-11-21 3:20 ` Arnaldo Carvalho de Melo
2026-11-21 3:29 ` sashiko-bot
2026-11-21 3:20 ` [PATCH v10 08/16] perf tests: Exercise DW_OP_addrx global variables Arnaldo Carvalho de Melo
` (9 subsequent siblings)
16 siblings, 1 reply; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-11-21 3:20 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-kernel, linux-perf-users,
Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Add a unit test for the x86 operand parser covering the absolute
addressing and movabs forms the data type resolver handles. The cases
are the instructions from the allmodconfig clang build quoted in the two
fixes.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/Build | 1 +
tools/perf/tests/annotate-ops.c | 127 ++++++++++++++++++++++++++++++++
tools/perf/tests/builtin-test.c | 1 +
tools/perf/tests/tests.h | 1 +
4 files changed, 130 insertions(+)
create mode 100644 tools/perf/tests/annotate-ops.c
diff --git a/tools/perf/tests/Build b/tools/perf/tests/Build
index 5eebb2ec5ddefcfd..c7edd8569bbccb06 100644
--- a/tools/perf/tests/Build
+++ b/tools/perf/tests/Build
@@ -2,6 +2,7 @@
perf-test-y += builtin-test.o
perf-test-y += tests-scripts.o
+perf-test-y += annotate-ops.o
perf-test-y += parse-events.o
perf-test-y += uncore-event-sorting.o
perf-test-y += dso-data.o
diff --git a/tools/perf/tests/annotate-ops.c b/tools/perf/tests/annotate-ops.c
new file mode 100644
index 0000000000000000..1c73433fbac67d85
--- /dev/null
+++ b/tools/perf/tests/annotate-ops.c
@@ -0,0 +1,127 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * The x86 operand parser: what is a memory reference and where it points.
+ *
+ * The absolute addressing forms are the ones perf annotate's data type
+ * resolver has to follow, and the ones it must not mistake for a data
+ * access: a direct branch target and an immediate.
+ */
+#include <elf.h>
+#include <linux/compiler.h>
+#include <stdlib.h>
+#include <string.h>
+#include "annotate.h"
+#include "debug.h"
+#include "disasm.h"
+#include "tests.h"
+
+struct op_case {
+ const char *insn;
+ const struct ins_ops *ops;
+ const char *operand;
+ enum annotated_insn_ops which;
+ bool mem_ref;
+ int offset;
+};
+
+static struct op_case op_cases[] = {
+ /* 32-bit absolute, and the 64-bit sign extended disp32 both ways */
+ { "mov", &mov_ops, "0x8c73448", INSN_OP_SOURCE, true, 0x8c73448 },
+ { "mov", &mov_ops, "0xffffffffff5fc300", INSN_OP_SOURCE, true, -0xa03d00 },
+ { "mov", &mov_ops, "-0xa03d00", INSN_OP_SOURCE, true, -0xa03d00 },
+ /* An immediate and a direct branch target, with the same 0x */
+ { "mov", &mov_ops, "$0x10", INSN_OP_SOURCE, false, 0 },
+ { "call", &call_ops, "0x401020", INSN_OP_TARGET, false, 0 },
+ { "jmp", &jump_ops, "0x401020", INSN_OP_TARGET, false, 0 },
+ { "loop", NULL, "0x401020", INSN_OP_TARGET, false, 0 },
+};
+
+static int check_operand(const struct arch *arch, const struct op_case *c)
+{
+ struct disasm_line dl = {
+ .ins = { .name = c->insn, .ops = c->ops },
+ };
+ struct annotated_insn_loc loc;
+ struct annotated_op_loc *op;
+ int ret = 0;
+
+ if (c->which == INSN_OP_TARGET)
+ dl.ops.target.raw = (char *)c->operand;
+ else
+ dl.ops.source.raw = (char *)c->operand;
+
+ if (annotate_get_insn_location(arch, &dl, &loc) < 0)
+ return TEST_FAIL;
+
+ op = &loc.ops[c->which];
+ if (op->mem_ref != c->mem_ref) {
+ pr_debug("'%s %s': mem_ref %d, expected %d\n", c->insn,
+ c->operand, op->mem_ref, c->mem_ref);
+ ret = TEST_FAIL;
+ }
+ if (op->mem_ref && op->offset != c->offset) {
+ pr_debug("'%s %s': offset %#x, expected %#x\n", c->insn,
+ c->operand, op->offset, c->offset);
+ ret = TEST_FAIL;
+ }
+
+ return ret;
+}
+
+/* Real disassembly of a movabs, through the instruction's own parser */
+static const char *movabs_lines[][2] = {
+ { "movabsq", "$-0x2000040000000000, %r15 # imm = 0xDFFFFC0000000000" },
+ { "movabs", "$0xdfffffc000000000,%r15" },
+};
+
+static int check_movabs(const struct arch *arch, const char *name, const char *ops)
+{
+ struct disasm_line dl = { .ins = { .name = name } };
+ struct annotated_insn_loc loc;
+ int ret = TEST_FAIL;
+
+ dl.ops.raw = strdup(ops);
+ if (dl.ops.raw == NULL)
+ return TEST_FAIL;
+
+ dl.ins.ops = ins__find(arch, name, &dl);
+ if (dl.ins.ops != &mov_ops || dl.ins.ops->parse(arch, &dl.ops, NULL, &dl) < 0) {
+ pr_debug("'%s %s': not parsed as a mov\n", name, ops);
+ goto out;
+ }
+
+ if (annotate_get_insn_location(arch, &dl, &loc) == 0 &&
+ !loc.ops[INSN_OP_SOURCE].mem_ref && loc.ops[INSN_OP_SOURCE].imm &&
+ loc.ops[INSN_OP_TARGET].reg1 != -1)
+ ret = TEST_OK;
+ else
+ pr_debug("'%s %s': not an immediate to a register\n", name, ops);
+out:
+ free(dl.ops.source.raw);
+ free(dl.ops.target.raw);
+ free(dl.ops.raw);
+ return ret;
+}
+
+static int test__annotate_ops(struct test_suite *test __maybe_unused,
+ int subtest __maybe_unused)
+{
+ struct e_machine_and_e_flags id = { .e_machine = EM_X86_64, };
+ const struct arch *arch = arch__new_x86(&id, NULL);
+ size_t i;
+ int ret = 0;
+
+ if (arch == NULL)
+ return TEST_FAIL;
+
+ for (i = 0; i < ARRAY_SIZE(op_cases); i++)
+ ret |= check_operand(arch, &op_cases[i]);
+
+ for (i = 0; i < ARRAY_SIZE(movabs_lines); i++)
+ ret |= check_movabs(arch, movabs_lines[i][0], movabs_lines[i][1]);
+
+ free((void *)arch);
+ return ret;
+}
+
+DEFINE_SUITE("Annotate operand parsing", annotate_ops);
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 01c78ef20b97dec9..a27baf3a819ccf36 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -117,6 +117,7 @@ static struct test_suite *generic_tests[] = {
&suite__openat_syscall_event_on_all_cpus,
&suite__basic_mmap,
&suite__mem,
+ &suite__annotate_ops,
&suite__parse_events,
&suite__uncore_event_sorting,
&suite__expr,
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h
index af822885890dda73..963cb34acd345153 100644
--- a/tools/perf/tests/tests.h
+++ b/tools/perf/tests/tests.h
@@ -153,6 +153,7 @@ DECLARE_SUITE(sample_parsing);
DECLARE_SUITE(keep_tracking);
DECLARE_SUITE(parse_no_sample_id_all);
DECLARE_SUITE(dwarf_unwind);
+DECLARE_SUITE(annotate_ops);
DECLARE_SUITE(expr);
DECLARE_SUITE(hists_filter);
DECLARE_SUITE(mmap_thread_lookup);
--
2.56.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v10 08/16] perf tests: Exercise DW_OP_addrx global variables
2026-11-21 3:20 [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found Arnaldo Carvalho de Melo
` (6 preceding siblings ...)
2026-11-21 3:20 ` [PATCH v10 07/16] perf tests: Exercise the x86 operand parser Arnaldo Carvalho de Melo
@ 2026-11-21 3:20 ` Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 09/16] perf tests: Exercise the flexible array member path Arnaldo Carvalho de Melo
` (8 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-11-21 3:20 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-kernel, linux-perf-users,
Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
clang emits DW_AT_location with DW_OP_addrx for globals in DWARF 5, gcc
emits DW_OP_addr. The global_data workload keeps a zero initialized
struct in .bss: at run time it sits past the file backed mapping, where
the by-name fallback through the thread maps cannot find it, so only the
DWARF address lookup resolves it. The test checks that its three member
accesses are annotated, so the DW_OP_addrx path is exercised when perf
is built with clang and DWARF 5 (e.g. scripts/coverage.sh with
DWARF_VERSION=5), and the DW_OP_addr one with gcc.
It skips on 32-bit PIE builds, which reach static globals relative to
the GOT base register, and the resolver does not track that.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/builtin-test.c | 1 +
tools/perf/tests/shell/data_type_global.sh | 73 ++++++++++++++++++++++
tools/perf/tests/tests.h | 1 +
tools/perf/tests/workloads/Build | 2 +
tools/perf/tests/workloads/global_data.c | 57 +++++++++++++++++
5 files changed, 134 insertions(+)
create mode 100755 tools/perf/tests/shell/data_type_global.sh
create mode 100644 tools/perf/tests/workloads/global_data.c
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index a27baf3a819ccf36..42e85d1b1420f0a7 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -214,6 +214,7 @@ static struct test_workload *workloads[] = {
&workload__deterministic,
&workload__callchain,
&workload__false_sharing,
+ &workload__global_data,
#ifdef HAVE_RUST_SUPPORT
&workload__code_with_type,
diff --git a/tools/perf/tests/shell/data_type_global.sh b/tools/perf/tests/shell/data_type_global.sh
new file mode 100755
index 0000000000000000..14f57d5a1b26a5ea
--- /dev/null
+++ b/tools/perf/tests/shell/data_type_global.sh
@@ -0,0 +1,73 @@
+#!/bin/bash
+# perf data type profiling test for a global variable
+# SPDX-License-Identifier: GPL-2.0
+
+set -e
+
+perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
+perfout=$(mktemp /tmp/__perf_test.perf.out.XXXXX)
+perferr=$(mktemp /tmp/__perf_test.perf.err.XXXXX)
+
+cleanup()
+{
+ rm -f "$perfdata" "$perfout" "$perferr"
+ trap - EXIT TERM INT
+}
+
+trap_cleanup()
+{
+ echo "Unexpected signal in ${FUNCNAME[1]}"
+ cleanup
+ exit 1
+}
+trap trap_cleanup EXIT TERM INT
+
+if ! perf check feature -q dwarf; then
+ echo "Skip: no DWARF (libdw) support"
+ cleanup
+ exit 2
+fi
+
+# 32-bit x86 PIE reaches static globals relative to the GOT base register,
+# which the resolver does not track; e_type's low byte is at 16 on LE x86.
+perf_bin=$(command -v perf)
+if [ "$(od -An -tx1 -j4 -N1 "$perf_bin" | tr -d ' ')" = 01 ] &&
+ [ "$(od -An -tx1 -j16 -N1 "$perf_bin" | tr -d ' ')" = 03 ]; then
+ echo "Skip: 32-bit PIE uses GOT-relative global accesses"
+ cleanup
+ exit 2
+fi
+
+# No point in recording if the PMU cannot do memory events.
+if ! perf mem record -o /dev/null -- true 2>/dev/null; then
+ echo "Skip: cannot record memory events on this PMU"
+ cleanup
+ exit 2
+fi
+
+if ! perf mem record -o "$perfdata" -- perf test -w global_data 1 \
+ > /dev/null 2> "$perferr"; then
+ echo "FAIL: perf mem record"
+ cat "$perferr"
+ cleanup
+ exit 1
+fi
+
+if ! perf annotate --code-with-type -i "$perfdata" --stdio \
+ --percent-limit 1 > "$perfout"; then
+ echo "FAIL: perf annotate"
+ cleanup
+ exit 1
+fi
+
+for member in "+0 (saddr)" "+0x4 (daddr)" "+0x8 (bytes)"; do
+ if ! grep -Fq "# data-type: struct conn ${member}" "$perfout"; then
+ echo "FAIL: member ${member} not resolved"
+ grep 'struct conn' "$perfout" || true
+ cleanup
+ exit 1
+ fi
+done
+
+echo "global variable resolved"
+cleanup
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h
index 963cb34acd345153..63d49a960eab8f3c 100644
--- a/tools/perf/tests/tests.h
+++ b/tools/perf/tests/tests.h
@@ -274,6 +274,7 @@ DECLARE_WORKLOAD(context_switch_loop);
DECLARE_WORKLOAD(deterministic);
DECLARE_WORKLOAD(callchain);
DECLARE_WORKLOAD(false_sharing);
+DECLARE_WORKLOAD(global_data);
#ifdef HAVE_RUST_SUPPORT
DECLARE_WORKLOAD(code_with_type);
diff --git a/tools/perf/tests/workloads/Build b/tools/perf/tests/workloads/Build
index 43cc4da6fb0786de..03017aaaaa0bec32 100644
--- a/tools/perf/tests/workloads/Build
+++ b/tools/perf/tests/workloads/Build
@@ -17,6 +17,7 @@ perf-test-y += context_switch_loop.o
perf-test-y += deterministic.o
perf-test-y += callchain.o
perf-test-y += false_sharing.o
+perf-test-y += global_data.o
ifeq ($(CONFIG_RUST_SUPPORT),y)
perf-test-y += code_with_type.o
@@ -35,3 +36,4 @@ CFLAGS_deterministic.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
CFLAGS_named_threads.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
CFLAGS_callchain.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
CFLAGS_false_sharing.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
+CFLAGS_global_data.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
diff --git a/tools/perf/tests/workloads/global_data.c b/tools/perf/tests/workloads/global_data.c
new file mode 100644
index 0000000000000000..5973f7bb16fd007c
--- /dev/null
+++ b/tools/perf/tests/workloads/global_data.c
@@ -0,0 +1,57 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * A zero initialized global struct, so it lands in .bss, past the file
+ * backed end of the last segment: at run time it sits in an anonymous
+ * mapping that the thread maps do not name, so only the DWARF address
+ * lookup finds it. clang describes its address with DW_OP_addrx in
+ * DWARF 5, gcc with DW_OP_addr.
+ *
+ * 'perf mem record' of this workload followed by 'perf annotate
+ * --code-with-type' (see tests/shell/data_type_global.sh) resolves the
+ * accesses to struct conn.
+ */
+#include <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <linux/compiler.h>
+#include "../tests.h"
+
+struct conn {
+ int saddr;
+ int daddr;
+ long bytes;
+};
+
+static volatile struct conn conn;
+static volatile unsigned long conn_sink;
+static volatile sig_atomic_t done;
+
+static void sighandler(int sig __maybe_unused)
+{
+ done = 1;
+}
+
+static int global_data(int argc, const char **argv)
+{
+ unsigned long sum = 0;
+ unsigned int i = 0;
+ int sec = 1;
+
+ if (argc > 0)
+ sec = atoi(argv[0]);
+
+ signal(SIGINT, sighandler);
+ signal(SIGALRM, sighandler);
+ alarm(sec);
+
+ while (!done) {
+ conn.saddr = i;
+ conn.daddr = i + 1;
+ sum += conn.bytes;
+ i++;
+ }
+ conn_sink = sum;
+ return 0;
+}
+
+DEFINE_WORKLOAD(global_data);
--
2.56.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v10 09/16] perf tests: Exercise the flexible array member path
2026-11-21 3:20 [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found Arnaldo Carvalho de Melo
` (7 preceding siblings ...)
2026-11-21 3:20 ` [PATCH v10 08/16] perf tests: Exercise DW_OP_addrx global variables Arnaldo Carvalho de Melo
@ 2026-11-21 3:20 ` Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 10/16] perf tests: Exercise data type resolution from a register Arnaldo Carvalho de Melo
` (7 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-11-21 3:20 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-kernel, linux-perf-users,
Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
No test covered find_flex_array() and get_flex_array_member(). Add a
flex_array workload that keeps a struct with a trailing data[] behind a
global pointer, and a test that checks the accesses past the struct size
are resolved and named after the flexible array member; find_data_type()
folds offsets past the struct modulo the element size back to the
member's offset (+0x4 for char data[]). The test also checks that the
accesses count for the struct in the percent, samples and period columns.
It skips on 32-bit PIE builds, which reach static globals relative to the
GOT base register.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/builtin-test.c | 1 +
.../perf/tests/shell/data_type_flex_array.sh | 111 ++++++++++++++++++
tools/perf/tests/tests.h | 1 +
tools/perf/tests/workloads/Build | 2 +
tools/perf/tests/workloads/flex_array.c | 55 +++++++++
5 files changed, 170 insertions(+)
create mode 100755 tools/perf/tests/shell/data_type_flex_array.sh
create mode 100644 tools/perf/tests/workloads/flex_array.c
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 42e85d1b1420f0a7..d761758201a4b2f2 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -215,6 +215,7 @@ static struct test_workload *workloads[] = {
&workload__callchain,
&workload__false_sharing,
&workload__global_data,
+ &workload__flex_array,
#ifdef HAVE_RUST_SUPPORT
&workload__code_with_type,
diff --git a/tools/perf/tests/shell/data_type_flex_array.sh b/tools/perf/tests/shell/data_type_flex_array.sh
new file mode 100755
index 0000000000000000..6adbb556f0e48921
--- /dev/null
+++ b/tools/perf/tests/shell/data_type_flex_array.sh
@@ -0,0 +1,111 @@
+#!/bin/bash
+# perf data type profiling tests for flexible array members
+# SPDX-License-Identifier: GPL-2.0
+
+set -e
+
+perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
+perfout=$(mktemp /tmp/__perf_test.perf.out.XXXXX)
+perferr=$(mktemp /tmp/__perf_test.perf.err.XXXXX)
+
+cleanup()
+{
+ rm -f "$perfdata" "$perfout" "$perferr"
+ trap - EXIT TERM INT
+}
+
+trap_cleanup()
+{
+ echo "Unexpected signal in ${FUNCNAME[1]}"
+ cleanup
+ exit 1
+}
+trap trap_cleanup EXIT TERM INT
+
+if ! perf check feature -q dwarf; then
+ echo "Skip: no DWARF (libdw) support"
+ cleanup
+ exit 2
+fi
+
+# 32-bit x86 PIE reaches static globals relative to the GOT base register,
+# which the resolver does not track; e_type's low byte is at 16 on LE x86.
+perf_bin=$(command -v perf)
+if [ "$(od -An -tx1 -j4 -N1 "$perf_bin" | tr -d ' ')" = 01 ] &&
+ [ "$(od -An -tx1 -j16 -N1 "$perf_bin" | tr -d ' ')" = 03 ]; then
+ echo "Skip: 32-bit PIE uses GOT-relative global accesses"
+ cleanup
+ exit 2
+fi
+
+# No point in recording if the PMU cannot do memory events.
+if ! perf mem record -o /dev/null -- true 2>/dev/null; then
+ echo "Skip: cannot record memory events on this PMU"
+ cleanup
+ exit 2
+fi
+
+if ! perf mem record -o "$perfdata" -- perf test -w flex_array 1 \
+ > /dev/null 2> "$perferr"; then
+ echo "FAIL: perf mem record"
+ cat "$perferr"
+ cleanup
+ exit 1
+fi
+
+if ! perf annotate --code-with-type -i "$perfdata" --stdio \
+ --percent-limit 1 > "$perfout"; then
+ echo "FAIL: perf annotate"
+ cleanup
+ exit 1
+fi
+
+if ! grep -Fq "# data-type: struct flex +0x4 (data)" "$perfout"; then
+ echo "FAIL: flexible array member not resolved"
+ tail -n 30 "$perfout"
+ cleanup
+ exit 1
+fi
+
+# The accesses to the flexible array are resolved past the end of the
+# struct: they must count for the struct, not only for the member.
+if ! perf annotate --data-type -i "$perfdata" --stdio > "$perfout"; then
+ echo "FAIL: perf annotate --data-type"
+ cleanup
+ exit 1
+fi
+
+if ! awk '
+ $1 + 0 == 100.00 && /struct flex/ { struct_ok = 1 }
+ $1 + 0 > 0 && /char\[\]/ && /data;/ { data_ok = 1 }
+ END { exit !(struct_ok && data_ok) }
+' <(sed -n "/^Annotate type: 'struct flex' in/,/^Annotate type: /p" "$perfout"); then
+ echo "FAIL: --data-type does not count the flexible array accesses"
+ tail -n 30 "$perfout"
+ cleanup
+ exit 1
+fi
+
+# Same with the samples and period columns, the other two display modes.
+for mode in --show-nr-samples --show-total-period; do
+ if ! perf annotate --data-type -i "$perfdata" --stdio "$mode" > "$perfout"; then
+ echo "FAIL: perf annotate --data-type $mode"
+ cleanup
+ exit 1
+ fi
+
+ if ! awk '
+ $1 + 0 > 0 && /struct flex/ { total = $1 + 0 }
+ /int/ && /len;/ { len = $1 + 0 }
+ /char\[\]/ && /data;/ { data = $1 + 0 }
+ END { exit !(total > 0 && data > 0 && total == data + len) }
+ ' <(sed -n "/^Annotate type: 'struct flex' in/,/^Annotate type: /p" "$perfout"); then
+ echo "FAIL: --data-type $mode does not count the flexible array accesses"
+ tail -n 30 "$perfout"
+ cleanup
+ exit 1
+ fi
+done
+
+echo "flexible array member resolved and counted"
+cleanup
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h
index 63d49a960eab8f3c..8621ea345b5f06ff 100644
--- a/tools/perf/tests/tests.h
+++ b/tools/perf/tests/tests.h
@@ -275,6 +275,7 @@ DECLARE_WORKLOAD(deterministic);
DECLARE_WORKLOAD(callchain);
DECLARE_WORKLOAD(false_sharing);
DECLARE_WORKLOAD(global_data);
+DECLARE_WORKLOAD(flex_array);
#ifdef HAVE_RUST_SUPPORT
DECLARE_WORKLOAD(code_with_type);
diff --git a/tools/perf/tests/workloads/Build b/tools/perf/tests/workloads/Build
index 03017aaaaa0bec32..74a0cbe49dc93533 100644
--- a/tools/perf/tests/workloads/Build
+++ b/tools/perf/tests/workloads/Build
@@ -18,6 +18,7 @@ perf-test-y += deterministic.o
perf-test-y += callchain.o
perf-test-y += false_sharing.o
perf-test-y += global_data.o
+perf-test-y += flex_array.o
ifeq ($(CONFIG_RUST_SUPPORT),y)
perf-test-y += code_with_type.o
@@ -37,3 +38,4 @@ CFLAGS_named_threads.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
CFLAGS_callchain.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
CFLAGS_false_sharing.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
CFLAGS_global_data.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
+CFLAGS_flex_array.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
diff --git a/tools/perf/tests/workloads/flex_array.c b/tools/perf/tests/workloads/flex_array.c
new file mode 100644
index 0000000000000000..141f9d510816cb05
--- /dev/null
+++ b/tools/perf/tests/workloads/flex_array.c
@@ -0,0 +1,55 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Flexible array member workload for data type profiling: the accesses to
+ * the array are past the end of the struct, where the resolver has to find
+ * the flexible array member.
+ *
+ * See tests/shell/data_type_flex_array.sh.
+ */
+#include <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <linux/compiler.h>
+#include "../tests.h"
+
+struct flex {
+ int len;
+ char data[];
+};
+
+static struct flex *gp;
+static volatile unsigned long flex_sink;
+static volatile sig_atomic_t done;
+
+static void sighandler(int sig __maybe_unused)
+{
+ done = 1;
+}
+
+static int flex_array(int argc, const char **argv)
+{
+ unsigned long sum = 0;
+ int sec = 1;
+
+ if (argc > 0)
+ sec = atoi(argv[0]);
+
+ gp = calloc(1, sizeof(*gp) + 4096);
+ if (gp == NULL)
+ return 1;
+ gp->len = 4096;
+
+ signal(SIGINT, sighandler);
+ signal(SIGALRM, sighandler);
+ alarm(sec);
+
+ while (!done) {
+ sum += gp->data[3];
+ gp->data[5] = 1;
+ }
+ flex_sink = sum;
+ free(gp);
+ return 0;
+}
+
+DEFINE_WORKLOAD(flex_array);
--
2.56.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v10 10/16] perf tests: Exercise data type resolution from a register
2026-11-21 3:20 [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found Arnaldo Carvalho de Melo
` (8 preceding siblings ...)
2026-11-21 3:20 ` [PATCH v10 09/16] perf tests: Exercise the flexible array member path Arnaldo Carvalho de Melo
@ 2026-11-21 3:20 ` Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 11/16] perf tests: Exercise the annotate stats output Arnaldo Carvalho de Melo
` (6 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-11-21 3:20 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-kernel, linux-perf-users,
Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
At -O2 a struct pointer lives in a register (with DWARF describing it with
a register location on register-argument ABIs), while the unoptimized
workloads the data type tests profile keep their variables on the stack.
Add a regptr workload with a noinline function that takes the pointer from
a volatile global, so the compiler cannot constant-propagate the object
address, and check that its three member accesses are resolved from that
register.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/builtin-test.c | 1 +
tools/perf/tests/shell/data_type_register.sh | 63 ++++++++++++++++++++
tools/perf/tests/tests.h | 1 +
tools/perf/tests/workloads/Build | 2 +
tools/perf/tests/workloads/regptr.c | 60 +++++++++++++++++++
5 files changed, 127 insertions(+)
create mode 100755 tools/perf/tests/shell/data_type_register.sh
create mode 100644 tools/perf/tests/workloads/regptr.c
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index d761758201a4b2f2..29068963b9d5bae0 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -216,6 +216,7 @@ static struct test_workload *workloads[] = {
&workload__false_sharing,
&workload__global_data,
&workload__flex_array,
+ &workload__regptr,
#ifdef HAVE_RUST_SUPPORT
&workload__code_with_type,
diff --git a/tools/perf/tests/shell/data_type_register.sh b/tools/perf/tests/shell/data_type_register.sh
new file mode 100755
index 0000000000000000..a80ac72c9022ece7
--- /dev/null
+++ b/tools/perf/tests/shell/data_type_register.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+# perf data type profiling tests for register variables
+# SPDX-License-Identifier: GPL-2.0
+
+set -e
+
+perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
+perfout=$(mktemp /tmp/__perf_test.perf.out.XXXXX)
+perferr=$(mktemp /tmp/__perf_test.perf.err.XXXXX)
+
+cleanup()
+{
+ rm -f "$perfdata" "$perfout" "$perferr"
+ trap - EXIT TERM INT
+}
+
+trap_cleanup()
+{
+ echo "Unexpected signal in ${FUNCNAME[1]}"
+ cleanup
+ exit 1
+}
+trap trap_cleanup EXIT TERM INT
+
+if ! perf check feature -q dwarf; then
+ echo "Skip: no DWARF (libdw) support"
+ cleanup
+ exit 2
+fi
+
+# No point in recording if the PMU cannot do memory events.
+if ! perf mem record -o /dev/null -- true 2>/dev/null; then
+ echo "Skip: cannot record memory events on this PMU"
+ cleanup
+ exit 2
+fi
+
+if ! perf mem record -o "$perfdata" -- perf test -w regptr 1 \
+ > /dev/null 2> "$perferr"; then
+ echo "FAIL: perf mem record"
+ cat "$perferr"
+ cleanup
+ exit 1
+fi
+
+if ! perf annotate --code-with-type -i "$perfdata" --stdio \
+ --percent-limit 1 > "$perfout"; then
+ echo "FAIL: perf annotate"
+ cleanup
+ exit 1
+fi
+
+for member in "+0 (a)" "+0x8 (b)" "+0x10 (c)"; do
+ if ! grep -Fq "# data-type: struct node ${member}" "$perfout"; then
+ echo "FAIL: member ${member} not resolved from the register"
+ grep 'struct node' "$perfout" || true
+ cleanup
+ exit 1
+ fi
+done
+
+echo "register held access resolved"
+cleanup
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h
index 8621ea345b5f06ff..6bfb30687e12eeb7 100644
--- a/tools/perf/tests/tests.h
+++ b/tools/perf/tests/tests.h
@@ -276,6 +276,7 @@ DECLARE_WORKLOAD(callchain);
DECLARE_WORKLOAD(false_sharing);
DECLARE_WORKLOAD(global_data);
DECLARE_WORKLOAD(flex_array);
+DECLARE_WORKLOAD(regptr);
#ifdef HAVE_RUST_SUPPORT
DECLARE_WORKLOAD(code_with_type);
diff --git a/tools/perf/tests/workloads/Build b/tools/perf/tests/workloads/Build
index 74a0cbe49dc93533..17189458032c0a17 100644
--- a/tools/perf/tests/workloads/Build
+++ b/tools/perf/tests/workloads/Build
@@ -19,6 +19,7 @@ perf-test-y += callchain.o
perf-test-y += false_sharing.o
perf-test-y += global_data.o
perf-test-y += flex_array.o
+perf-test-y += regptr.o
ifeq ($(CONFIG_RUST_SUPPORT),y)
perf-test-y += code_with_type.o
@@ -39,3 +40,4 @@ CFLAGS_callchain.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
CFLAGS_false_sharing.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
CFLAGS_global_data.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
CFLAGS_flex_array.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
+CFLAGS_regptr.o = -g -O2
diff --git a/tools/perf/tests/workloads/regptr.c b/tools/perf/tests/workloads/regptr.c
new file mode 100644
index 0000000000000000..00f31c16ac1e4a5a
--- /dev/null
+++ b/tools/perf/tests/workloads/regptr.c
@@ -0,0 +1,60 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * A struct pointer that -O2 keeps in a register, so the member accesses
+ * have to be resolved from the register's type state and not from a
+ * stack slot.
+ *
+ * See tests/shell/data_type_register.sh.
+ */
+#include <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <linux/compiler.h>
+#include "../tests.h"
+
+struct node {
+ long long a;
+ long long b;
+ long long c;
+};
+
+static struct node node;
+static struct node *volatile vp;
+static volatile unsigned long long reg_sink;
+static volatile sig_atomic_t done;
+
+static void sighandler(int sig __maybe_unused)
+{
+ done = 1;
+}
+
+static noinline long long touch(struct node *p)
+{
+ long long sum = 0;
+
+ sum += p->a;
+ p->b += sum;
+ sum += p->c;
+ return sum;
+}
+
+static int regptr(int argc, const char **argv)
+{
+ unsigned long long sum = 0;
+ int sec = 1;
+
+ if (argc > 0)
+ sec = atoi(argv[0]);
+
+ vp = &node;
+ signal(SIGINT, sighandler);
+ signal(SIGALRM, sighandler);
+ alarm(sec);
+
+ while (!done)
+ sum += touch(vp);
+ reg_sink = sum;
+ return 0;
+}
+
+DEFINE_WORKLOAD(regptr);
--
2.56.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v10 11/16] perf tests: Exercise the annotate stats output
2026-11-21 3:20 [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found Arnaldo Carvalho de Melo
` (9 preceding siblings ...)
2026-11-21 3:20 ` [PATCH v10 10/16] perf tests: Exercise data type resolution from a register Arnaldo Carvalho de Melo
@ 2026-11-21 3:20 ` Arnaldo Carvalho de Melo
2026-11-21 3:30 ` sashiko-bot
2026-11-21 3:20 ` [PATCH v10 12/16] perf tests: Fix the Intel PT virtual LBR check Arnaldo Carvalho de Melo
` (5 subsequent siblings)
16 siblings, 1 reply; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-11-21 3:20 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-kernel, linux-perf-users,
Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Add a shell test for the --insn-stat and --type-stat output printed
after the annotations, and for the warning when --type-stat is used
without --data-type.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/shell/annotate_stats.sh | 69 ++++++++++++++++++++++++
1 file changed, 69 insertions(+)
create mode 100755 tools/perf/tests/shell/annotate_stats.sh
diff --git a/tools/perf/tests/shell/annotate_stats.sh b/tools/perf/tests/shell/annotate_stats.sh
new file mode 100755
index 0000000000000000..5af48bf187c5e8f5
--- /dev/null
+++ b/tools/perf/tests/shell/annotate_stats.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+# perf annotate instruction stats test
+# SPDX-License-Identifier: GPL-2.0
+
+set -e
+
+perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
+perfout=$(mktemp /tmp/__perf_test.perf.out.XXXXX)
+perferr=$(mktemp /tmp/__perf_test.perf.err.XXXXX)
+
+cleanup()
+{
+ rm -f "$perfdata" "$perfout" "$perferr"
+ trap - EXIT TERM INT
+}
+
+trap_cleanup()
+{
+ echo "Unexpected signal in ${FUNCNAME[1]}"
+ cleanup
+ exit 1
+}
+trap trap_cleanup EXIT TERM INT
+
+if ! perf check feature -q dwarf; then
+ echo "Skip: no DWARF (libdw) support"
+ cleanup
+ exit 2
+fi
+
+# No point in recording if the PMU cannot do memory events.
+if ! perf mem record -o /dev/null -- true 2>/dev/null; then
+ echo "Skip: cannot record memory events on this PMU"
+ cleanup
+ exit 2
+fi
+
+if ! perf mem record -o "$perfdata" -- perf test -w datasym > /dev/null 2>&1; then
+ echo "FAIL: perf mem record"
+ cleanup
+ exit 1
+fi
+
+if ! perf annotate --code-with-type --insn-stat -i "$perfdata" --stdio \
+ --percent-limit 1 > "$perfout"; then
+ echo "FAIL: perf annotate"
+ cleanup
+ exit 1
+fi
+
+# The instruction stats are accounted while the instructions are
+# displayed; printing them before the display loop shows zeros.
+if ! grep -Eq '^total [1-9][0-9]*,' "$perfout"; then
+ echo "FAIL: instruction stats not accounted"
+ tail -n 30 "$perfout"
+ cleanup
+ exit 1
+fi
+
+if ! perf annotate --type-stat -i "$perfdata" --stdio > /dev/null 2> "$perferr" ||
+ ! grep -Fxq "Warning: --type-stat needs --data-type" "$perferr"; then
+ echo "FAIL: missing --type-stat warning"
+ tail -n 30 "$perferr"
+ cleanup
+ exit 1
+fi
+
+echo "instruction stats accounted"
+cleanup
--
2.56.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v10 12/16] perf tests: Fix the Intel PT virtual LBR check
2026-11-21 3:20 [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found Arnaldo Carvalho de Melo
` (10 preceding siblings ...)
2026-11-21 3:20 ` [PATCH v10 11/16] perf tests: Exercise the annotate stats output Arnaldo Carvalho de Melo
@ 2026-11-21 3:20 ` Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 13/16] perf test: Drop samples without an IP in the dlfilter test Arnaldo Carvalho de Melo
` (4 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-11-21 3:20 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-kernel, linux-perf-users,
Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
On an Intel host the virtual LBR check failed with:
Warning: Processed 29 samples and lost 100.00%
The record leaves the buffer sizes to the tool defaults: the data ring
follows perf_event_mlock_kb, and the runner's small value left a single
page, too small for the AUX samples. Pin 4 data and 64 AUX pages, so
the test does not depend on the host sysctl, and give the AUX ring room
instead of the single page the tool sizes to the 4 KiB snapshot. Both
fit in the default mlock allowance regardless of the CPU count.
Also require the Python perf module to export session: a perf module
without it, like the distro's python3-perf, made the check fail instead
of skipping.
Fixes: 915d6b14dc0c8971 ("perf test: Migrate Intel PT virtual LBR test to Python API")
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/shell/test_intel_pt.sh | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tools/perf/tests/shell/test_intel_pt.sh b/tools/perf/tests/shell/test_intel_pt.sh
index c0ecece0a8255124..96f5c132cebf23e6 100755
--- a/tools/perf/tests/shell/test_intel_pt.sh
+++ b/tools/perf/tests/shell/test_intel_pt.sh
@@ -384,13 +384,15 @@ test_virtual_lbr()
# shellcheck source=lib/setup_python.sh
. "${shelldir}"/lib/setup_python.sh
- if ! "$PYTHON" -c 'import perf' > /dev/null 2>&1; then
- echo "SKIP: Python perf module not found"
+ if ! "$PYTHON" -c 'import perf; perf.session' > /dev/null 2>&1; then
+ echo "SKIP: Python perf module with session support not found"
return 2
fi
- # Check if virtual lbr is working
- perf_record_no_bpf -o "${tmpfile}" --aux-sample \
+ # The default data ring follows perf_event_mlock_kb and can be too
+ # small for the AUX samples; pin 4 data and 64 AUX pages, which fit
+ # in the default allowance.
+ perf_record_no_bpf -m 4,64 -o "${tmpfile}" --aux-sample \
-e '{intel_pt//,cycles}:u' perf test -w brstack || return 1
perf inject --itrace=L -i "${tmpfile}" -o "${perfdatafile}" || return 1
output=$("$PYTHON" "${shelldir}/lib/perf_brstack_max.py" -i "${perfdatafile}") || return 1
--
2.56.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v10 13/16] perf test: Drop samples without an IP in the dlfilter test
2026-11-21 3:20 [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found Arnaldo Carvalho de Melo
` (11 preceding siblings ...)
2026-11-21 3:20 ` [PATCH v10 12/16] perf tests: Fix the Intel PT virtual LBR check Arnaldo Carvalho de Melo
@ 2026-11-21 3:20 ` Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 14/16] perf test: Skip the LBR inline unwinding check when unsupported Arnaldo Carvalho de Melo
` (3 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-11-21 3:20 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-kernel, linux-perf-users,
Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Since v7.3 the kernel zeroes PERF_SAMPLE_IP when a user-only event skids
into kernel mode, so that kernel register state is not exposed to user
space: commit 166f10836a653dfa ("perf/core: Fix kernel register info
leak via hardware skid").
The test records without an event modifier, which is user-only only when
perf falls back to cycles:u for an unprivileged user, which is why root
runs never saw it. The dlfilter keeps those ip 0 samples, and the check
that nothing but test_loop survives then trips on their lines: the comm
column reads "perf". Drop them, as everything except test_loop must be
filtered out.
Fixes: 199d5e872a9ce737 ("perf tests script dlfilter: Add a dlfilter test")
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/shell/script_dlfilter.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/tests/shell/script_dlfilter.sh b/tools/perf/tests/shell/script_dlfilter.sh
index 88222280f6094fd0..797cd9ae84141f64 100755
--- a/tools/perf/tests/shell/script_dlfilter.sh
+++ b/tools/perf/tests/shell/script_dlfilter.sh
@@ -46,7 +46,7 @@ int filter_event(void *data, const struct perf_dlfilter_sample *sample, void *ct
const struct perf_dlfilter_al *al;
if (!sample->ip)
- return 0;
+ return 1;
al = perf_dlfilter_fns.resolve_ip(ctx);
if (!al || !al->sym || strcmp(al->sym, "test_loop"))
--
2.56.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v10 14/16] perf test: Skip the LBR inline unwinding check when unsupported
2026-11-21 3:20 [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found Arnaldo Carvalho de Melo
` (12 preceding siblings ...)
2026-11-21 3:20 ` [PATCH v10 13/16] perf test: Drop samples without an IP in the dlfilter test Arnaldo Carvalho de Melo
@ 2026-11-21 3:20 ` Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 15/16] perf scripts: Add a coverage harness for perf Arnaldo Carvalho de Melo
` (2 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-11-21 3:20 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-kernel, linux-perf-users,
Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
The LBR check takes caps/branches as sufficient to record cycles with
--call-graph lbr, but the file only says the PMU has an LBR: AMD LBRv2
rejects the call stack mode with EOPNOTSUPP and AMD BRS, which samples
only its own retired branches event, rejects cycles with EINVAL, so the
test fails on AMD instead of skipping.
Skip when the same event records without the branch stack, so a PMU
without the LBR call stack skips while a perf record that fails for
another reason still shows its error and fails the test.
Fixes: 446c595dc0dd1759 ("perf test addr2line_inlines: Ensure inline information shows on LBR leaves")
Cc: Ian Rogers <irogers@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/shell/addr2line_inlines.sh | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/tools/perf/tests/shell/addr2line_inlines.sh b/tools/perf/tests/shell/addr2line_inlines.sh
index e8754ef2d7f21ac2..050e95c0fea12aae 100755
--- a/tools/perf/tests/shell/addr2line_inlines.sh
+++ b/tools/perf/tests/shell/addr2line_inlines.sh
@@ -8,6 +8,7 @@ err=0
test_dir=$(mktemp -d /tmp/perf-test-inline-addr2line.XXXXXXXXXX)
perf_data="${test_dir}/perf.data"
perf_script_txt="${test_dir}/perf_script.txt"
+perf_record_err="${test_dir}/perf_record.err"
cleanup() {
rm -rf "${test_dir}"
@@ -71,7 +72,24 @@ test_lbr() {
fi
# Record data. Currently only dwarf callchains support inlined functions.
- perf record --call-graph lbr -e cycles:u -o "${perf_data}" -- perf test -w inlineloop 1
+ # caps/branches does not mean the LBR call stack is supported: AMD LBRv2
+ # rejects it with EOPNOTSUPP and AMD BRS, which samples only its own
+ # retired branches event, rejects cycles with EINVAL. Skip when the same
+ # event records without the branch stack.
+ if ! perf record --call-graph lbr -e cycles:u -o "${perf_data}" -- \
+ perf test -w inlineloop 1 2> "${perf_record_err}"
+ then
+ if perf record -e cycles:u -o "${perf_data}" -- true 2> /dev/null
+ then
+ echo "Skip: LBR call stack not supported by the PMU"
+ else
+ cat "${perf_record_err}"
+ echo "Inline unwinding lbr verification test [Failed to record]"
+ err=1
+ fi
+ return
+ fi
+ cat "${perf_record_err}"
# Check output with inline (default) and srcline
perf script -i "${perf_data}" --fields +srcline > "${perf_script_txt}"
--
2.56.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v10 15/16] perf scripts: Add a coverage harness for perf
2026-11-21 3:20 [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found Arnaldo Carvalho de Melo
` (13 preceding siblings ...)
2026-11-21 3:20 ` [PATCH v10 14/16] perf test: Skip the LBR inline unwinding check when unsupported Arnaldo Carvalho de Melo
@ 2026-11-21 3:20 ` Arnaldo Carvalho de Melo
2026-11-21 3:36 ` sashiko-bot
2026-11-21 3:20 ` [PATCH v10 16/16] perf scripts: Add a coverage table Arnaldo Carvalho de Melo
2026-11-21 3:36 ` [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found sashiko-bot
16 siblings, 1 reply; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-11-21 3:20 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-kernel, linux-perf-users,
Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Build perf with clang source based coverage, run the complete perf test
suite, merge the raw profiles and report line and function coverage,
optionally against a baseline. Wired as 'make -C tools/perf coverage'
and 'coverage-prep'; coverage-prep builds the instrumented perf apart
from the test run, for the root tests on the bare metal host while
building in the development container.
The report covers the whole tree, not only the paths the tests walk.
The static libbpf build inherits EXTRA_CFLAGS, and the dlopened UI,
jvmti, Python and dlfilter libraries are passed to llvm-cov as separate
objects. 'perf test' exits 0 even when tests fail, so the status comes
from its "Failed tests :" and "Timed out tests :" lines.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/.gitignore | 1 +
tools/perf/Makefile | 12 +-
tools/perf/Makefile.perf | 5 +-
tools/perf/scripts/coverage.sh | 434 +++++++++++++++++++++++++++++++++
4 files changed, 450 insertions(+), 2 deletions(-)
create mode 100755 tools/perf/scripts/coverage.sh
diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
index 3b968c5158b822ce..d263877366ca1440 100644
--- a/tools/perf/.gitignore
+++ b/tools/perf/.gitignore
@@ -27,6 +27,7 @@ stats-*.csv
cscope*
config.mak
config.mak.autogen
+/cov/
*-bison.*
*-flex.*
*.pyc
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 00baf90e5bda7123..d9ad8c0d796c2852 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -140,6 +140,16 @@ check-headers:
sync-headers:
@./scripts/sync-headers.sh $(SYNC_HEADERS_ARGS)
+coverage_o = $(if $(O),\
+$(if $(shell cd $(PWD); test -d $(O) || echo $(O)),\
+$(error O=$(O) does not exist),--build-dir=$(FULL_O)))
+
+coverage-prep:
+ @./scripts/coverage.sh --prep $(coverage_o) $(COVERAGE_ARGS)
+
+coverage:
+ @./scripts/coverage.sh $(coverage_o) $(COVERAGE_ARGS)
+
#
# All other targets get passed through:
#
@@ -147,4 +157,4 @@ sync-headers:
$(print_msg)
$(make)
-.PHONY: all clean tags TAGS FORCE Makefile build-test build-test-tarball check-headers sync-headers
+.PHONY: all clean tags TAGS FORCE Makefile build-test build-test-tarball check-headers sync-headers coverage coverage-prep
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index d4b641925ab296db..f32c96be3f464ed2 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -812,7 +812,7 @@ $(LIBAPI)-clean:
$(LIBBPF): FORCE | $(LIBBPF_OUTPUT)
$(Q)$(MAKE) -C $(LIBBPF_DIR) FEATURES_DUMP=$(FEATURE_DUMP_EXPORT) \
O= OUTPUT=$(LIBBPF_OUTPUT)/ DESTDIR=$(LIBBPF_DESTDIR) prefix= subdir= \
- EXTRA_CFLAGS="-fPIC" $@ install_headers
+ EXTRA_CFLAGS="-fPIC $(EXTRA_CFLAGS)" $@ install_headers
$(LIBBPF)-clean:
$(call QUIET_CLEAN, libbpf)
@@ -877,6 +877,9 @@ help:
@echo ' check-headers - check which header copies are out of sync with the kernel'
@echo ' sync-headers - sync those header copies with the kernel, creating commits'
@echo ' (SYNC_HEADERS_ARGS="..." passes options to the script)'
+ @echo ' coverage-prep - build perf with clang coverage, ready for a root test run'
+ @echo ' coverage - build perf with clang coverage, run the tests and report'
+ @echo ' (O=DIR uses an existing build dir; COVERAGE_ARGS="..." passes options)'
DOC_TARGETS := doc man html info pdf
diff --git a/tools/perf/scripts/coverage.sh b/tools/perf/scripts/coverage.sh
new file mode 100755
index 0000000000000000..1d49b09258818762
--- /dev/null
+++ b/tools/perf/scripts/coverage.sh
@@ -0,0 +1,434 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (C) 2026, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
+#
+# Build perf with clang source based coverage, run the perf test suite and
+# report line coverage. coverage-table.sh renders the last report as a
+# table of the files with the most uncovered lines.
+# The build goes into tools/perf and the profiles and report into
+# tools/perf/cov; -b and -c override them, following perf's O= layout.
+# --prep stops after the instrumented build, for running the tests later as
+# root with the same build directory.
+
+set -euo pipefail
+
+PERF_DIR=$(cd "$(dirname "$0")/.." && pwd -P)
+TOOLS_DIR=$(cd "$PERF_DIR/.." && pwd -P)
+SRC_DIR=$(cd "$TOOLS_DIR/.." && pwd -P)
+
+# perf links objects from these directories, so a change in any of them
+# makes the build stale.
+PERF_SOURCES=("$PERF_DIR" "$TOOLS_DIR/lib/perf" "$TOOLS_DIR/lib/api"
+ "$TOOLS_DIR/lib/subcmd" "$TOOLS_DIR/lib/bpf"
+ "$TOOLS_DIR/lib/symbol" "$TOOLS_DIR/include"
+ "$TOOLS_DIR/arch")
+
+BUILD_DIR=${BUILD_DIR:-}
+COV_DIR=${COV_DIR:-}
+JOBS=${JOBS:-$(nproc 2>/dev/null || echo 1)}
+LLVM_PROFDATA=${LLVM_PROFDATA:-llvm-profdata}
+LLVM_COV=${LLVM_COV:-llvm-cov}
+DWARF_VERSION=${DWARF_VERSION:-4}
+
+PREP=0
+SKIP_BUILD=0
+USE_BASELINE=1
+TESTS=()
+
+ROOT=0
+[ "$(id -u)" = 0 ] && ROOT=1
+
+say() { printf '\033[1;34m==>\033[0m %s\n' "$*"; }
+warn() { printf '\033[0;33mwarning:\033[0m %s\n' "$*" >&2; }
+die() { printf '\033[0;31merror:\033[0m %s\n' "$*" >&2; exit 1; }
+
+usage()
+{
+ cat <<EOF
+Usage: scripts/coverage.sh [options] [test name fragment...]
+
+Builds perf with clang source based coverage, runs the complete perf test
+suite and reports line coverage. Use -t to run a subset and
+scripts/coverage-table.sh to render the last report as a table.
+
+Options:
+ -b, --build-dir DIR existing perf build directory (default: $PERF_DIR)
+ -c, --cov-dir DIR profiles and report (default: BUILD_DIR/cov)
+ -j, --jobs N parallel build jobs (default: $JOBS)
+ -t, --tests "A;B" test name fragments, ';' separated (default: all)
+ --no-baseline do not compare against or update the baseline
+ --prep build the instrumented perf and stop
+ -h, --help show this help
+
+Environment: BUILD_DIR, COV_DIR, JOBS, LLVM_COV, LLVM_PROFDATA,
+DWARF_VERSION
+
+Through make:
+ make -C tools/perf coverage
+ make -C tools/perf coverage-prep O=/tmp/build/perf-coverage
+ sudo make -C tools/perf coverage O=/tmp/build/perf-coverage
+ make -C tools/perf coverage-table O=/tmp/build/perf-coverage
+EOF
+}
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ --build-dir=*) BUILD_DIR=${1#*=} ;;
+ --cov-dir=*) COV_DIR=${1#*=} ;;
+ --jobs=*) JOBS=${1#*=} ;;
+ --tests=*) IFS=';' read -r -a _t <<< "${1#*=}"
+ TESTS+=("${_t[@]}") ;;
+ -b|--build-dir) BUILD_DIR=${2:?$1 needs a value}; shift ;;
+ -c|--cov-dir) COV_DIR=${2:?$1 needs a value}; shift ;;
+ -j|--jobs) JOBS=${2:?$1 needs a value}; shift ;;
+ -t|--tests) IFS=';' read -r -a _t <<< "${2:?$1 needs a value}"
+ TESTS+=("${_t[@]}"); shift ;;
+ --no-baseline) USE_BASELINE=0 ;;
+ --prep) PREP=1 ;;
+ -h|--help) usage; exit 0 ;;
+ -*) die "unknown option: $1 (see --help)" ;;
+ *) TESTS+=("$1") ;;
+ esac
+ shift
+done
+
+[ -n "$BUILD_DIR" ] || BUILD_DIR=$PERF_DIR
+BUILD_DIR=$(realpath -m "$BUILD_DIR")
+[ -d "$BUILD_DIR" ] ||
+ die "$BUILD_DIR does not exist; create it first, as with 'make O=DIR'"
+
+[ -n "$COV_DIR" ] || COV_DIR=$BUILD_DIR/cov
+COV_DIR=$(realpath -m "$COV_DIR")
+
+# An in-tree build has the sources below BUILD_DIR, so only a separate
+# build directory can tell generated files apart from the tree's sources.
+BUILD_AWK_DIR=$BUILD_DIR
+[ "$BUILD_DIR" = "$PERF_DIR" ] && BUILD_AWK_DIR=
+
+[[ $JOBS =~ ^[0-9]+$ ]] || die "--jobs wants a number, not '$JOBS'"
+[[ $DWARF_VERSION =~ ^[0-9]+$ ]] ||
+ die "DWARF_VERSION wants a number, not '$DWARF_VERSION'"
+
+#
+# The tests execute $BUILD_DIR/perf, root included: refuse a directory
+# owned by somebody else or writable by another user.
+#
+TRUST_UID=$(id -u)
+if [ "$ROOT" = 1 ]; then
+ if [ -n "${SUDO_UID:-}" ]; then
+ TRUST_UID=$SUDO_UID
+ else
+ TRUST_UID=$(stat -c %u "$PERF_DIR" 2>/dev/null) ||
+ die "could not stat $PERF_DIR"
+ fi
+fi
+
+check_owner()
+{
+ local path=$1 uid gid mode
+
+ [ -e "$path" ] || return 0
+ read -r uid gid mode < <(stat -c '%u %g %a' "$path" 2>/dev/null) ||
+ die "could not stat $path"
+ [ "$uid" = 0 ] || [ "$uid" = "$TRUST_UID" ] ||
+ die "$path is owned by uid $uid, not by root or uid $TRUST_UID"
+ [ $(( 8#$mode & 8#022 )) = 0 ] ||
+ die "$path is writable by another user"
+}
+
+check_owner "$BUILD_DIR"
+check_owner "$BUILD_DIR/perf"
+
+mkdir -p "$COV_DIR" || die "could not create $COV_DIR"
+check_owner "$COV_DIR"
+
+# A sudo run leaves the profiles and report owned by root; give them back
+# to the developer so the next run can replace them.
+if [ "$ROOT" = 1 ] && [ -n "${SUDO_UID:-}" ]; then
+ trap 'chown -R "$SUDO_UID:${SUDO_GID:-$SUDO_UID}" "$COV_DIR" 2>/dev/null || true' EXIT
+fi
+
+BUILD_LOG=$COV_DIR/build.log
+TEST_LOG=$COV_DIR/tests.log
+REPORT=$COV_DIR/report.txt
+PROFDATA=$COV_DIR/perf.profdata
+BASELINE=$COV_DIR/baseline.txt
+
+#
+# Build: clang, DEBUG=1 gives -O0 -g, which keeps the line mapping honest
+# at the cost of slower test runs.
+#
+build_perf()
+{
+ local make_args=()
+
+ if [ "$SKIP_BUILD" = 1 ]; then
+ [ -x "$BUILD_DIR/perf" ] ||
+ die "no $BUILD_DIR/perf, run coverage-prep first"
+ if command -v nm > /dev/null; then
+ # No -q: grep reads all of nm's output, so pipefail
+ # does not see a SIGPIPE from an early exit.
+ nm "$BUILD_DIR/perf" 2>/dev/null |
+ grep '__llvm_profile' > /dev/null ||
+ die "$BUILD_DIR/perf was not built for coverage," \
+ "run coverage-prep first"
+ else
+ warn "nm not found, cannot verify that $BUILD_DIR/perf is instrumented"
+ fi
+ return
+ fi
+
+ say "Building perf in $BUILD_DIR"
+ [ "$BUILD_DIR" = "$PERF_DIR" ] || make_args+=(O="$BUILD_DIR")
+ if ! make -C "$PERF_DIR" "${make_args[@]+"${make_args[@]}"}" \
+ CC=clang DEBUG=1 \
+ EXTRA_CFLAGS="-fprofile-instr-generate -fcoverage-mapping -gdwarf-$DWARF_VERSION" \
+ -j"$JOBS" > "$BUILD_LOG" 2>&1; then
+ tail -20 "$BUILD_LOG" >&2
+ die "build failed, full log in $BUILD_LOG"
+ fi
+ tail -1 "$BUILD_LOG"
+}
+
+run_tests()
+{
+ if [ ${#TESTS[@]} -eq 0 ]; then
+ say "Running the complete perf test suite"
+ else
+ say "Running perf tests: ${TESTS[*]}"
+ fi
+ rm -rf "$COV_DIR/raw"
+ mkdir -p "$COV_DIR/raw"
+
+ set +e
+ # The shell tests are found from the kernel tree root.
+ (cd "$SRC_DIR" &&
+ PATH="$BUILD_DIR:$PATH" \
+ LLVM_PROFILE_FILE="$COV_DIR/raw/perf-%p-%m.profraw" \
+ "$BUILD_DIR/perf" test -v \
+ "${TESTS[@]+"${TESTS[@]}"}") 2>&1 | tee "$TEST_LOG"
+ pipe_status=("${PIPESTATUS[@]}")
+ set -e
+ test_status=${pipe_status[0]}
+ [ "${pipe_status[1]}" = 0 ] ||
+ die "could not write $TEST_LOG"
+
+ # 'perf test' exits 0 even when tests fail or time out, only the
+ # summary tells.
+ if [ "$test_status" = 0 ] &&
+ grep -qE '^(Failed|Timed out) tests +: +[1-9]' "$TEST_LOG"; then
+ test_status=1
+ fi
+
+ grep -E '^(Passed|Skipped|Failed|Timed out) .*:' "$TEST_LOG" || true
+ [ "$test_status" = 0 ] ||
+ warn "some tests failed, coverage is still collected"
+}
+
+merge_profiles()
+{
+ local count size
+
+ # llvm-profdata reads the list from a file: a full run leaves
+ # thousands of profiles, too many for the command line.
+ find "$COV_DIR/raw" -name '*.profraw' | sort > "$COV_DIR/profiles.txt"
+ count=$(wc -l < "$COV_DIR/profiles.txt")
+ size=$(du -sh "$COV_DIR/raw" 2>/dev/null | cut -f1)
+ [ "$count" -gt 0 ] ||
+ die "no .profraw files, was perf rebuilt with -fprofile-instr-generate?"
+
+ say "Merging $count profile files ($size)"
+ if ! "$LLVM_PROFDATA" merge -sparse \
+ --input-files="$COV_DIR/profiles.txt" \
+ -o "$PROFDATA" 2> "$COV_DIR/merge.log"; then
+ # A profile left half written, by a perf killed at exit or by
+ # a full tmpfs, makes llvm-profdata drop the whole merge:
+ # retry without the invalid ones.
+ warn "some profile files are unusable, merging the rest"
+ "$LLVM_PROFDATA" merge -sparse --failure-mode=all \
+ --input-files="$COV_DIR/profiles.txt" -o "$PROFDATA" \
+ 2> "$COV_DIR/merge.log" ||
+ die "llvm-profdata merge failed, see $COV_DIR/merge.log"
+ fi
+}
+
+llvm_cov_objects()
+{
+ echo "$BUILD_DIR/perf"
+ local so
+
+ # These are dlopened by perf and have to be profiled separately;
+ # libperf is linked into perf as a static library.
+ for so in libperf-gtk.so libperf-jvmti.so; do
+ [ -f "$BUILD_DIR/$so" ] && echo "--object=$BUILD_DIR/$so"
+ done
+ for so in "$BUILD_DIR"/dlfilters/*.so; do
+ [ -f "$so" ] && echo "--object=$so"
+ done
+ for so in "$BUILD_DIR"/python/perf*.so; do
+ [ -f "$so" ] && echo "--object=$so"
+ done
+}
+
+render_report()
+{
+ local objects
+
+ mapfile -t objects < <(llvm_cov_objects)
+ say "Generating report"
+ "$LLVM_COV" report "${objects[@]}" --instr-profile="$PROFDATA" \
+ > "$REPORT" || die "llvm-cov report failed"
+}
+
+# llvm-cov strips the prefix every reported file has in common, so a
+# tools/perf source can read as perf/util/evsel.c.
+AWK_PERF='
+function perf_relpath(p) {
+ sub(/^.*tools\/perf\//, "", p)
+ sub(/^perf\//, "", p)
+ return p
+}
+function under_build(p, b, n) {
+ if (build == "")
+ return 0
+ b = build
+ while (1) {
+ n = length(b)
+ if (substr(p, 1, n + 1) == b "/")
+ return 1
+ if (index(b, "/") == 0)
+ return 0
+ sub(/^[^\/]*\//, "", b)
+ if (b == "")
+ return 0
+ }
+}
+function generated(p, r) {
+ r = perf_relpath(p)
+ if (under_build(p))
+ return 1
+ return r ~ /^(lib(api|bpf|perf|subcmd|symbol)|trace\/beauty\/generated)\// ||
+ r ~ /^arch\/[^\/]+\/include\/generated\// ||
+ r ~ /^pmu-events\/(pmu-events(-string)?|test-empty-pmu-events)\.c$/ ||
+ r ~ /^util\/(intel-pt-decoder\/inat-tables\.c|.*-(bison|flex)\.[ch])$/ ||
+ r ~ /^util\/bpf_skel\/(\.tmp\/|vmlinux\.h$)/ ||
+ r ~ /\.skel\.h$/ ||
+ r == "common-cmds.h"
+}
+'
+
+total_cov()
+{
+ awk '$1 == "TOTAL" { print $8, $9, $10 }' "$1"
+}
+
+total_cov_perf()
+{
+ awk -v build="$BUILD_AWK_DIR" "$AWK_PERF"'
+ generated($1) { next }
+ $1 != "TOTAL" &&
+ ($1 ~ /(^|\/)tools\/perf\// || $1 ~ /^perf\//) {
+ lines += $8
+ missed += $9
+ }
+ END {
+ if (lines)
+ printf "%d %d %.2f%%\n", lines, missed,
+ 100 * (lines - missed) / lines
+ }' "$1"
+}
+
+since_baseline()
+{
+ local old cur
+
+ [ "$USE_BASELINE" = 1 ] && [ -f "$BASELINE" ] &&
+ ! cmp -s "$BASELINE" "$REPORT" || return 0
+ old=$(awk '$1 == "TOTAL" { print $10 }' "$BASELINE")
+ cur=$(awk '$1 == "TOTAL" { print $10 }' "$REPORT")
+ [ -n "$old" ] && [ -n "$cur" ] || return 0
+ awk -v old="$old" -v cur="$cur" 'BEGIN {
+ sub(/%$/, "", cur)
+ printf " (previous %s, %+.2f%%)", old, cur - old }'
+}
+
+print_summary()
+{
+ local lines missed cover p_lines p_missed p_cover
+
+ read -r lines missed cover < <(total_cov "$REPORT") ||
+ die "no TOTAL row in $REPORT"
+ printf "\n\033[1mTotal:\033[0m %s of %s lines covered (%s)" \
+ "$((lines - missed))" "$lines" "$cover"
+ since_baseline
+ printf "\n"
+
+ read -r p_lines p_missed p_cover < <(total_cov_perf "$REPORT") || true
+ if [ -n "$p_lines" ]; then
+ printf " perf: %s of %s lines covered (%s)\n" \
+ "$((p_lines - p_missed))" "$p_lines" "$p_cover"
+ fi
+}
+
+update_baseline()
+{
+ [ "$USE_BASELINE" = 1 ] || return 0
+ # A -t run covers a subset, saving it would poison the next run.
+ if [ ${#TESTS[@]} -gt 0 ]; then
+ printf "\nBaseline not updated, this was a subset run\n"
+ return 0
+ fi
+ [ -f "$BASELINE" ] && mv "$BASELINE" "$BASELINE.prev"
+ cp "$REPORT" "$BASELINE"
+ printf "\nBaseline saved: %s\n" "$BASELINE"
+}
+
+if [ "$PREP" = 0 ]; then
+ command -v "$LLVM_COV" > /dev/null ||
+ die "$LLVM_COV not found (set LLVM_COV)"
+ command -v "$LLVM_PROFDATA" > /dev/null ||
+ die "$LLVM_PROFDATA not found (set LLVM_PROFDATA)"
+fi
+
+if [ "$SKIP_BUILD" = 0 ]; then
+ command -v clang > /dev/null ||
+ die "clang not found, it is the only compiler with -fcoverage-mapping"
+fi
+
+# Root does not rebuild a prepared build: use the perf already in
+# BUILD_DIR, or build when there is none.
+if [ "$ROOT" = 1 ] && [ "$PREP" = 0 ]; then
+ if [ -x "$BUILD_DIR/perf" ]; then
+ SKIP_BUILD=1
+ say "Running as root, using the coverage build in $BUILD_DIR"
+ else
+ say "Running as root, building perf in $BUILD_DIR"
+ fi
+fi
+
+test_status=0
+
+if [ "$PREP" = 1 ]; then
+ build_perf
+ say "Coverage build ready: $BUILD_DIR/perf"
+ make_hint="make -C $PERF_DIR coverage"
+ [ "$BUILD_DIR" = "$PERF_DIR" ] || make_hint+=" O=$BUILD_DIR"
+ printf "As root: %s\n" "$make_hint"
+ exit 0
+fi
+
+build_perf
+run_tests
+merge_profiles
+
+[ -f "$PROFDATA" ] || die "no $PROFDATA, the merge did not run"
+
+export LC_ALL=C
+render_report
+print_summary
+update_baseline
+
+printf "\nReport: %s\n" "$REPORT"
+printf "Table: %s/scripts/coverage-table.sh\n" "$PERF_DIR"
+exit "$test_status"
--
2.56.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v10 16/16] perf scripts: Add a coverage table
2026-11-21 3:20 [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found Arnaldo Carvalho de Melo
` (14 preceding siblings ...)
2026-11-21 3:20 ` [PATCH v10 15/16] perf scripts: Add a coverage harness for perf Arnaldo Carvalho de Melo
@ 2026-11-21 3:20 ` Arnaldo Carvalho de Melo
2026-11-21 3:34 ` sashiko-bot
2026-11-21 3:36 ` [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found sashiko-bot
16 siblings, 1 reply; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-11-21 3:20 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-kernel, linux-perf-users,
Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Render the report of the last coverage run as a table of the files with
the most uncovered lines, biggest gap first; --all lists every file and
-f picks files explicitly. It only reads coverage.sh's report.txt, so
the measurement and the table are reviewed and changed separately.
Wired as 'make -C tools/perf coverage-table'.
For example, with --top 4 on the v10 run:
$ make -C tools/perf coverage-table O=/tmp/build/coverage \
COVERAGE_ARGS="--top 4"
tools/perf (no tests/ or bench/), 100+ executable lines:
the 4 biggest uncovered gaps, start here when adding coverage tests.
--all for every file: make -C tools/perf coverage-table O=/tmp/build/coverage COVERAGE_ARGS="--all"
┌──────────────────────────────────────────┬────────┬────────┬────────┬─────────────────────────────┬─────────────┬──────────┐
│ File │ Lines │ Hit │ Miss │ Line Coverage │ Funcs │ FuncCov │
├──────────────────────────────────────────┼────────┼────────┼────────┼─────────────────────────────┼─────────────┼──────────┤
│ util/intel-pt.c │ 3237 │ 0 │ 3237 │ ░░░░░░░░░░░░░░░░░░░░ 0.0% │ 0/142 │ 0.00% │
│ util/intel-pt-decoder/intel-pt-decoder.c │ 3208 │ 0 │ 3208 │ ░░░░░░░░░░░░░░░░░░░░ 0.0% │ 0/119 │ 0.00% │
│ ui/browsers/hists.c │ 2742 │ 0 │ 2742 │ ░░░░░░░░░░░░░░░░░░░░ 0.0% │ 0/124 │ 0.00% │
│ builtin-sched.c │ 3737 │ 1558 │ 2179 │ ████████░░░░░░░░░░░░ 41.7% │ 64/141 │ 45.39% │
├──────────────────────────────────────────┼────────┼────────┼────────┼─────────────────────────────┼─────────────┼──────────┤
│ TOTAL (perf) │ 173942 │ 86661 │ 87281 │ █████████░░░░░░░░░░░ 49.8% │ 5669/9351 │ 60.62% │
└──────────────────────────────────────────┴────────┴────────┴────────┴─────────────────────────────┴─────────────┴──────────┘
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Makefile | 5 +-
tools/perf/Makefile.perf | 1 +
tools/perf/scripts/coverage-table.sh | 310 +++++++++++++++++++++++++++
3 files changed, 315 insertions(+), 1 deletion(-)
create mode 100755 tools/perf/scripts/coverage-table.sh
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index d9ad8c0d796c2852..5da13faa1c18b510 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -150,6 +150,9 @@ coverage-prep:
coverage:
@./scripts/coverage.sh $(coverage_o) $(COVERAGE_ARGS)
+coverage-table:
+ @./scripts/coverage-table.sh $(coverage_o) $(COVERAGE_ARGS)
+
#
# All other targets get passed through:
#
@@ -157,4 +160,4 @@ coverage:
$(print_msg)
$(make)
-.PHONY: all clean tags TAGS FORCE Makefile build-test build-test-tarball check-headers sync-headers coverage coverage-prep
+.PHONY: all clean tags TAGS FORCE Makefile build-test build-test-tarball check-headers sync-headers coverage coverage-prep coverage-table
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index f32c96be3f464ed2..997527f894daee4f 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -879,6 +879,7 @@ help:
@echo ' (SYNC_HEADERS_ARGS="..." passes options to the script)'
@echo ' coverage-prep - build perf with clang coverage, ready for a root test run'
@echo ' coverage - build perf with clang coverage, run the tests and report'
+ @echo ' coverage-table - print a text table of the last coverage run'
@echo ' (O=DIR uses an existing build dir; COVERAGE_ARGS="..." passes options)'
diff --git a/tools/perf/scripts/coverage-table.sh b/tools/perf/scripts/coverage-table.sh
new file mode 100755
index 0000000000000000..8aa538255e9be636
--- /dev/null
+++ b/tools/perf/scripts/coverage-table.sh
@@ -0,0 +1,310 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (C) 2026, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
+#
+# Render the report of the last coverage run as a text table, like pahole's
+# coverage_table.py. Without -f the default is the tool's files, not its
+# tests and benches, with the most uncovered lines, biggest gap first;
+# --all lists every tools/perf file, most covered first. The total is the
+# tools/perf subtotal, the run summary has the whole report.
+
+set -euo pipefail
+
+PERF_DIR=$(cd "$(dirname "$0")/.." && pwd -P)
+
+BUILD_DIR=${BUILD_DIR:-}
+COV_DIR=${COV_DIR:-}
+TOP=${TOP:-20}
+MIN_LINES=${MIN_LINES:-100}
+TABLE_ALL=0
+FOCUS=()
+
+die() { printf '\033[0;31merror:\033[0m %s\n' "$*" >&2; exit 1; }
+
+usage()
+{
+ cat <<EOF
+Usage: scripts/coverage-table.sh [options]
+
+Render the report of the last coverage run as a text table. Run
+scripts/coverage.sh first to produce the report.
+
+Options:
+ -b, --build-dir DIR build directory of the run (default: $PERF_DIR)
+ -c, --cov-dir DIR directory with report.txt (default: BUILD_DIR/cov)
+ -f, --focus FILE add a file to the table (repeatable)
+ --top N default view: the N files with the most uncovered
+ lines (default: $TOP, 0 to disable)
+ --all list every tools/perf file, most covered first
+ --min-lines N default view: only files with N+ executable
+ lines (default: $MIN_LINES)
+ -h, --help show this help
+
+Environment: BUILD_DIR, COV_DIR, TOP, MIN_LINES
+EOF
+}
+
+while [ $# -gt 0 ]; do
+ arg=$1
+ optval=
+ case "$arg" in
+ --*=*) optval=${arg#*=}; arg=${arg%%=*}
+ [ -n "$optval" ] || die "$arg needs a value" ;;
+ esac
+
+ case "$arg" in
+ --all|-h|--help)
+ [ -z "$optval" ] || die "$arg takes no value" ;;
+ esac
+
+ case "$arg" in
+ -b|--build-dir) BUILD_DIR=${optval:-${2:?$arg needs a value}}
+ [ -z "$optval" ] && shift ;;
+ -c|--cov-dir) COV_DIR=${optval:-${2:?$arg needs a value}}
+ [ -z "$optval" ] && shift ;;
+ -f|--focus) FOCUS+=("${optval:-${2:?$arg needs a value}}")
+ [ -z "$optval" ] && shift ;;
+ --top) TOP=${optval:-${2:?$arg needs a value}}
+ [ -z "$optval" ] && shift ;;
+ --min-lines) MIN_LINES=${optval:-${2:?$arg needs a value}}
+ [ -z "$optval" ] && shift ;;
+ --all) TABLE_ALL=1 ;;
+ -h|--help) usage; exit 0 ;;
+ -*) die "unknown option: $arg (see --help)" ;;
+ *) die "unexpected argument: $arg (see --help)" ;;
+ esac
+ shift
+done
+
+[ -n "$BUILD_DIR" ] || BUILD_DIR=$PERF_DIR
+BUILD_DIR=$(realpath -m "$BUILD_DIR")
+[ -n "$COV_DIR" ] || COV_DIR=$BUILD_DIR/cov
+COV_DIR=$(realpath -m "$COV_DIR")
+REPORT=$COV_DIR/report.txt
+
+[ -f "$REPORT" ] || die "no $REPORT, run coverage first"
+[[ $TOP =~ ^[0-9]+$ ]] || die "--top wants a number, not '$TOP'"
+[[ $MIN_LINES =~ ^[0-9]+$ ]] ||
+ die "--min-lines wants a number, not '$MIN_LINES'"
+
+# An in-tree build has the sources below BUILD_DIR, so only a separate
+# build directory can tell generated files apart from the tree's sources.
+BUILD_AWK_DIR=$BUILD_DIR
+[ "$BUILD_DIR" = "$PERF_DIR" ] && BUILD_AWK_DIR=
+
+# llvm-cov strips the prefix every reported file has in common, so a
+# tools/perf source can read as perf/util/evsel.c.
+AWK_PERF='
+function perf_relpath(p) {
+ sub(/^.*tools\/perf\//, "", p)
+ sub(/^perf\//, "", p)
+ return p
+}
+function under_build(p, b, n) {
+ if (build == "")
+ return 0
+ b = build
+ while (1) {
+ n = length(b)
+ if (substr(p, 1, n + 1) == b "/")
+ return 1
+ if (index(b, "/") == 0)
+ return 0
+ sub(/^[^\/]*\//, "", b)
+ if (b == "")
+ return 0
+ }
+}
+function generated(p, r) {
+ r = perf_relpath(p)
+ if (under_build(p))
+ return 1
+ return r ~ /^(lib(api|bpf|perf|subcmd|symbol)|trace\/beauty\/generated)\// ||
+ r ~ /^arch\/[^\/]+\/include\/generated\// ||
+ r ~ /^pmu-events\/(pmu-events(-string)?|test-empty-pmu-events)\.c$/ ||
+ r ~ /^util\/(intel-pt-decoder\/inat-tables\.c|.*-(bison|flex)\.[ch])$/ ||
+ r ~ /^util\/bpf_skel\/(\.tmp\/|vmlinux\.h$)/ ||
+ r ~ /\.skel\.h$/ ||
+ r == "common-cmds.h"
+}
+'
+
+bar()
+{
+ local pct=$1 width=$2 filled i out=
+ filled=$(awk -v p="$pct" -v w="$width" 'BEGIN { printf "%d", p * w / 100 }')
+ for ((i = 0; i < filled; i++)); do out+=█; done
+ for ((i = filled; i < width; i++)); do out+=░; done
+ printf '%s' "$out"
+}
+
+center()
+{
+ local left=$(( ($2 - ${#1}) / 2 ))
+ printf '%*s%s%*s' "$left" '' "$1" "$(( $2 - ${#1} - left ))" ''
+}
+
+dashes()
+{
+ local s
+ printf -v s '%*s' "$1" ''
+ printf '%s' "${s// /─}"
+}
+
+table_row()
+{
+ awk -v f="$2" "$AWK_PERF"'
+ {
+ g = perf_relpath(f)
+ path = perf_relpath($1)
+ if (path == f || path == g || $1 == f) {
+ printf "%s\t%s\t%d\t%d\t%.2f\t%s\t%d\t%s\n",
+ path, $8, $8 - $9, $9, $10, $5, $5 - $6, $7
+ exit
+ }
+ }' "$1"
+}
+
+table_rows()
+{
+ local file
+
+ if [ ${#FOCUS[@]} -gt 0 ]; then
+ for file in "${FOCUS[@]}"; do
+ table_row "$REPORT" "$file"
+ done | sort -t$'\t' -k5,5gr
+ return
+ fi
+
+ if [ "$TABLE_ALL" = 1 ]; then
+ awk -v build="$BUILD_AWK_DIR" "$AWK_PERF"'
+ ($1 ~ /(^|\/)tools\/perf\// || $1 ~ /^perf\//) &&
+ !generated($1) && $8 > 0 {
+ printf "%s\t%s\t%d\t%d\t%.2f\t%s\t%d\t%s\n",
+ perf_relpath($1), $8, $8 - $9, $9, $10,
+ $5, $5 - $6, $7
+ }' "$REPORT" |
+ sort -t$'\t' -k5,5gr
+ return
+ fi
+
+ awk -v min="$MIN_LINES" -v build="$BUILD_AWK_DIR" "$AWK_PERF"'
+ ($1 ~ /(^|\/)tools\/perf\// || $1 ~ /^perf\//) &&
+ !generated($1) && $8 >= min && $9 > 0 &&
+ perf_relpath($1) !~ /^(tests|bench)\// {
+ printf "%s\t%s\t%d\t%d\t%.2f\t%s\t%d\t%s\n",
+ perf_relpath($1), $8, $8 - $9, $9, $10,
+ $5, $5 - $6, $7
+ }' "$REPORT" |
+ sort -t$'\t' -k4,4nr |
+ if [ "$TOP" -gt 0 ]; then
+ sed -n "1,${TOP}p"
+ else
+ cat
+ fi
+}
+
+# The table is about tools/perf, so its total is the tools/perf subtotal;
+# the run summary prints the whole report, generated files included.
+table_total()
+{
+ awk -v build="$BUILD_AWK_DIR" "$AWK_PERF"'
+ $1 != "TOTAL" && !generated($1) &&
+ ($1 ~ /(^|\/)tools\/perf\// || $1 ~ /^perf\//) {
+ lines += $8
+ missed += $9
+ funcs += $5
+ funcs_missed += $6
+ }
+ END {
+ printf "%d\t%d\t%d\t%.2f\t%d\t%d\t%.2f%%\n",
+ lines, lines - missed, missed,
+ lines ? 100 * (lines - missed) / lines : 0,
+ funcs, funcs - funcs_missed,
+ funcs ? 100 * (funcs - funcs_missed) / funcs : 0
+ }' "$REPORT"
+}
+
+# At most three lines: what the table shows and how to see every file.
+table_caption()
+{
+ if [ ${#FOCUS[@]} -gt 0 ]; then
+ echo "files requested with -f."
+ elif [ "$TABLE_ALL" = 1 ]; then
+ echo "every tools/perf file, tests and benches included, most covered first."
+ return
+ elif [ "$TOP" -gt 0 ] && [ "$MIN_LINES" -gt 0 ]; then
+ printf "tools/perf (no tests/ or bench/), %d+ executable lines:\n" "$MIN_LINES"
+ echo "the $TOP biggest uncovered gaps, start here when adding coverage tests."
+ elif [ "$TOP" -gt 0 ]; then
+ printf "tools/perf (no tests/ or bench/): the %d files with the\n" "$TOP"
+ echo "biggest uncovered gaps, start here when adding coverage tests."
+ elif [ "$MIN_LINES" -gt 0 ]; then
+ printf "tools/perf (no tests/ or bench/), %d+ executable lines:\n" "$MIN_LINES"
+ echo "start here when adding coverage tests, biggest gaps first."
+ else
+ echo "tools/perf (no tests/ or bench/), biggest gaps first."
+ fi
+ local cmd='make -C tools/perf coverage-table'
+ [ "$BUILD_DIR" = "$PERF_DIR" ] || cmd+=" O=$BUILD_DIR"
+ printf '%s %s COVERAGE_ARGS="--all"\n' '--all for every file:' "$cmd"
+}
+
+print_table()
+{
+ local rows total path lines hit missed pct funcs funcs_hit func_cov
+ local row_fmt w d_file d29 d13 d10 d8
+
+ rows=$(table_rows)
+ [ -n "$rows" ] ||
+ die "no coverage data in $REPORT for the requested files"
+ total=$(table_total)
+ [ -n "$total" ] || die "no coverage data in $REPORT"
+
+ table_caption
+ printf '\n'
+
+ w=12 # "TOTAL (perf)"
+ while IFS=$'\t' read -r path _; do
+ if [ ${#path} -gt "$w" ]; then
+ w=${#path}
+ fi
+ done <<< "$rows"
+
+ d8=$(dashes 8)
+ d10=$(dashes 10)
+ d13=$(dashes 13)
+ d29=$(dashes 29)
+ d_file=$(dashes $((w + 2)))
+
+ printf '┌%s┬%s┬%s┬%s┬%s┬%s┬%s┐\n' \
+ "$d_file" "$d8" "$d8" "$d8" "$d29" "$d13" "$d10"
+ printf '│ %-*s │ %6s │ %6s │ %6s │ %s │ %11s │ %8s │\n' \
+ "$w" "File" "Lines" "Hit" "Miss" \
+ "$(center 'Line Coverage' 27)" "Funcs" "FuncCov"
+ printf '├%s┼%s┼%s┼%s┼%s┼%s┼%s┤\n' \
+ "$d_file" "$d8" "$d8" "$d8" "$d29" "$d13" "$d10"
+
+ row_fmt=$(printf '│ %%-%ds │ %%6s │ %%6s │ %%6s │ %%s %%5.1f%%%%' "$w")
+ row_fmt+=' │ %5s/%-5s │ %8s │\n'
+
+ while IFS=$'\t' read -r path lines hit missed pct funcs funcs_hit func_cov; do
+ printf "$row_fmt" "$path" "$lines" "$hit" "$missed" \
+ "$(bar "$pct" 20)" "$pct" "$funcs_hit" "$funcs" "$func_cov"
+ done <<< "$rows"
+
+ printf '├%s┼%s┼%s┼%s┼%s┼%s┼%s┤\n' \
+ "$d_file" "$d8" "$d8" "$d8" "$d29" "$d13" "$d10"
+ while IFS=$'\t' read -r lines hit missed pct funcs funcs_hit func_cov; do
+ printf "$row_fmt" "TOTAL (perf)" "$lines" "$hit" "$missed" \
+ "$(bar "$pct" 20)" "$pct" "$funcs_hit" "$funcs" "$func_cov"
+ done <<< "$total"
+ printf '└%s┴%s┴%s┴%s┴%s┴%s┴%s┘\n' \
+ "$d_file" "$d8" "$d8" "$d8" "$d29" "$d13" "$d10"
+}
+
+# The table code parses llvm-cov's decimal points; keep the numeric locale
+# fixed.
+export LC_ALL=C
+print_table
--
2.56.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH v10 07/16] perf tests: Exercise the x86 operand parser
2026-11-21 3:20 ` [PATCH v10 07/16] perf tests: Exercise the x86 operand parser Arnaldo Carvalho de Melo
@ 2026-11-21 3:29 ` sashiko-bot
0 siblings, 0 replies; 22+ messages in thread
From: sashiko-bot @ 2026-11-21 3:29 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-perf-users
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] perf tests: check_movabs() fails when built without
HAVE_LIBDW_SUPPORT
--
commit 74653224cba4e46d55b956a2e180f6f29cb4d93b
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
perf tests: Exercise the x86 operand parser
This commit adds a unit test for the x86 operand parser covering absolute
addressing, immediate operands, direct branch targets, and movabs
instructions.
> diff --git a/tools/perf/tests/annotate-ops.c b/tools/perf/tests/annotate-ops.c
> new file mode 100644
> index 0000000000000..1c73433fbac67
> --- /dev/null
> +++ b/tools/perf/tests/annotate-ops.c
[ ... ]
> +static int check_movabs(const struct arch *arch, const char *name, const char *ops)
> +{
> + struct disasm_line dl = { .ins = { .name = name } };
> + struct annotated_insn_loc loc;
> + int ret = TEST_FAIL;
> +
> + dl.ops.raw = strdup(ops);
> + if (dl.ops.raw == NULL)
> + return TEST_FAIL;
> +
> + dl.ins.ops = ins__find(arch, name, &dl);
> + if (dl.ins.ops != &mov_ops || dl.ins.ops->parse(arch, &dl.ops, NULL, &dl) < 0) {
> + pr_debug("'%s %s': not parsed as a mov\n", name, ops);
> + goto out;
> + }
> +
> + if (annotate_get_insn_location(arch, &dl, &loc) == 0 &&
> + !loc.ops[INSN_OP_SOURCE].mem_ref && loc.ops[INSN_OP_SOURCE].imm &&
> + loc.ops[INSN_OP_TARGET].reg1 != -1)
> + ret = TEST_OK;
> + else
> + pr_debug("'%s %s': not an immediate to a register\n", name, ops);
[Severity: Medium]
Will check_movabs() fail when perf is built without HAVE_LIBDW_SUPPORT
(for example with NO_LIBDW=1)?
extract_op_location_x86() resolves %r15 via arch__dwarf_regnum() ->
get_dwarf_regnum(), which is a stub returning -1 in
tools/perf/util/include/dwarf-regs.h when HAVE_LIBDW_SUPPORT is not
defined, leaving loc.ops[INSN_OP_TARGET].reg1 at -1 while the test suite is
built and registered unconditionally.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261121032052.1392234-1-acme@kernel.org?part=7
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v10 11/16] perf tests: Exercise the annotate stats output
2026-11-21 3:20 ` [PATCH v10 11/16] perf tests: Exercise the annotate stats output Arnaldo Carvalho de Melo
@ 2026-11-21 3:30 ` sashiko-bot
0 siblings, 0 replies; 22+ messages in thread
From: sashiko-bot @ 2026-11-21 3:30 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-perf-users
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] perf tests: annotate_stats.sh omits --data-type --type-stat
output check
--
commit ce86ed141b9b58088762fac4e45ac569c679a1ab
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
perf tests: Exercise the annotate stats output
This commit adds a shell test exercising perf annotate instruction statistics
output and the warning emitted when --type-stat is used without --data-type.
> diff --git a/tools/perf/tests/shell/annotate_stats.sh b/tools/perf/tests/shell/annotate_stats.sh
> new file mode 100755
> index 0000000000000..5af48bf187c5e
> --- /dev/null
> +++ b/tools/perf/tests/shell/annotate_stats.sh
[ ... ]
> +if ! perf annotate --code-with-type --insn-stat -i "$perfdata" --stdio \
> + --percent-limit 1 > "$perfout"; then
> + echo "FAIL: perf annotate"
> + cleanup
> + exit 1
> +fi
> +
> +# The instruction stats are accounted while the instructions are
> +# displayed; printing them before the display loop shows zeros.
> +if ! grep -Eq '^total [1-9][0-9]*,' "$perfout"; then
> + echo "FAIL: instruction stats not accounted"
> + tail -n 30 "$perfout"
> + cleanup
> + exit 1
> +fi
> +
> +if ! perf annotate --type-stat -i "$perfdata" --stdio > /dev/null 2> "$perferr" ||
> + ! grep -Fxq "Warning: --type-stat needs --data-type" "$perferr"; then
> + echo "FAIL: missing --type-stat warning"
> + tail -n 30 "$perferr"
> + cleanup
> + exit 1
> +fi
[Severity: Low]
Does this script omit testing the actual --type-stat output promised by the
commit message?
__cmd_annotate() only calls print_annotate_data_stat() when both --data-type
and --type-stat are passed, whereas the first perf annotate call here passes
only --code-with-type --insn-stat and the second checks only the warning when
--data-type is missing.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261121032052.1392234-1-acme@kernel.org?part=11
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v10 16/16] perf scripts: Add a coverage table
2026-11-21 3:20 ` [PATCH v10 16/16] perf scripts: Add a coverage table Arnaldo Carvalho de Melo
@ 2026-11-21 3:34 ` sashiko-bot
0 siblings, 0 replies; 22+ messages in thread
From: sashiko-bot @ 2026-11-21 3:34 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-perf-users
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] perf scripts: unbounded prefix stripping in under_build()
drops source files
--
commit 4ac2ff16920b880b37f2d7980a454661167aa1a9
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
perf scripts: Add a coverage table
This commit adds tools/perf/scripts/coverage-table.sh and a coverage-table
make target to render the last coverage run's report.txt as a text table.
> diff --git a/tools/perf/scripts/coverage-table.sh b/tools/perf/scripts/coverage-table.sh
> new file mode 100755
> index 0000000000000..8aa538255e9be
> --- /dev/null
> +++ b/tools/perf/scripts/coverage-table.sh
> @@ -0,0 +1,310 @@
[ ... ]
> +# An in-tree build has the sources below BUILD_DIR, so only a separate
> +# build directory can tell generated files apart from the tree's sources.
> +BUILD_AWK_DIR=$BUILD_DIR
> +[ "$BUILD_DIR" = "$PERF_DIR" ] && BUILD_AWK_DIR=
> +
> +# llvm-cov strips the prefix every reported file has in common, so a
> +# tools/perf source can read as perf/util/evsel.c.
> +AWK_PERF='
> +function perf_relpath(p) {
> + sub(/^.*tools\/perf\//, "", p)
> + sub(/^perf\//, "", p)
> + return p
> +}
> +function under_build(p, b, n) {
> + if (build == "")
> + return 0
> + b = build
> + while (1) {
> + n = length(b)
> + if (substr(p, 1, n + 1) == b "/")
> + return 1
> + if (index(b, "/") == 0)
> + return 0
> + sub(/^[^\/]*\//, "", b)
> + if (b == "")
> + return 0
> + }
> +}
[Severity: Medium]
Can under_build() match every tools/perf source file in report.txt when
BUILD_DIR shares a parent directory with PERF_DIR and ends with a path
component like perf or tools/perf?
under_build() strips leading path components from build all the way down
to its basename instead of stopping where BUILD_DIR diverges from
PERF_DIR. For an out-of-tree build such as O=/path/to/linux/tools/build/perf
(or O=/home/user/build/perf for a tree at /home/user/perf), llvm-cov
strips the common prefix so source paths in report.txt begin with perf/,
and b shrinks to perf. generated() then returns 1 for every source file,
leaving table_rows() empty and causing print_table() to exit with an
error.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261121032052.1392234-1-acme@kernel.org?part=16
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v10 15/16] perf scripts: Add a coverage harness for perf
2026-11-21 3:20 ` [PATCH v10 15/16] perf scripts: Add a coverage harness for perf Arnaldo Carvalho de Melo
@ 2026-11-21 3:36 ` sashiko-bot
0 siblings, 0 replies; 22+ messages in thread
From: sashiko-bot @ 2026-11-21 3:36 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-perf-users
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] perf scripts: clang check in coverage.sh runs before
SKIP_BUILD=1 is set
- [Medium] perf scripts: stale dlfilters in existing BUILD_DIR fail
render_report()
- [Low] perf scripts: unused PERF_SOURCES array in coverage.sh
--
commit 54b8c85c84ec187dba6b344cdcebe3e4a53cc9a6
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
perf scripts: Add a coverage harness for perf
This commit adds scripts/coverage.sh and the coverage and coverage-prep make
targets to build perf with clang source-based coverage, run the perf test
suite, and report line coverage.
> diff --git a/tools/perf/scripts/coverage.sh b/tools/perf/scripts/coverage.sh
> new file mode 100755
> index 0000000000000..1d49b09258818
> --- /dev/null
> +++ b/tools/perf/scripts/coverage.sh
> @@ -0,0 +1,434 @@
[ ... ]
> +# perf links objects from these directories, so a change in any of them
> +# makes the build stale.
> +PERF_SOURCES=("$PERF_DIR" "$TOOLS_DIR/lib/perf" "$TOOLS_DIR/lib/api"
> + "$TOOLS_DIR/lib/subcmd" "$TOOLS_DIR/lib/bpf"
> + "$TOOLS_DIR/lib/symbol" "$TOOLS_DIR/include"
> + "$TOOLS_DIR/arch")
[Severity: Low]
PERF_SOURCES is declared here, but nothing in the script references it.
[ ... ]
> + say "Building perf in $BUILD_DIR"
> + [ "$BUILD_DIR" = "$PERF_DIR" ] || make_args+=(O="$BUILD_DIR")
> + if ! make -C "$PERF_DIR" "${make_args[@]+"${make_args[@]}"}" \
> + CC=clang DEBUG=1 \
> + EXTRA_CFLAGS="-fprofile-instr-generate -fcoverage-mapping -gdwarf-$DWARF_VERSION" \
> + -j"$JOBS" > "$BUILD_LOG" 2>&1; then
> + tail -20 "$BUILD_LOG" >&2
> + die "build failed, full log in $BUILD_LOG"
> + fi
> + tail -1 "$BUILD_LOG"
> +}
[ ... ]
> +llvm_cov_objects()
> +{
> + echo "$BUILD_DIR/perf"
> + local so
> +
> + # These are dlopened by perf and have to be profiled separately;
> + # libperf is linked into perf as a static library.
> + for so in libperf-gtk.so libperf-jvmti.so; do
> + [ -f "$BUILD_DIR/$so" ] && echo "--object=$BUILD_DIR/$so"
> + done
> + for so in "$BUILD_DIR"/dlfilters/*.so; do
> + [ -f "$so" ] && echo "--object=$so"
> + done
> + for so in "$BUILD_DIR"/python/perf*.so; do
> + [ -f "$so" ] && echo "--object=$so"
> + done
> +}
> +
> +render_report()
> +{
> + local objects
> +
> + mapfile -t objects < <(llvm_cov_objects)
> + say "Generating report"
> + "$LLVM_COV" report "${objects[@]}" --instr-profile="$PROFDATA" \
> + > "$REPORT" || die "llvm-cov report failed"
> +}
[Severity: Medium]
Can stale shared objects in an existing BUILD_DIR cause render_report() to
fail?
Unlike objects built via tools/build/Makefile.build, the dlfilters pattern
rules in tools/perf/Makefile.perf do not track compiler flag changes:
tools/perf/Makefile.perf:
$(OUTPUT)dlfilters/%.o: dlfilters/%.c include/perf/perf_dlfilter.h
$(Q)$(MKDIR) -p $(OUTPUT)dlfilters
$(QUIET_CC)$(CC) -c -Iinclude $(EXTRA_CFLAGS) -o $@ -fpic $<
.SECONDARY: $(DLFILTERS:.so=.o)
$(OUTPUT)dlfilters/%.so: $(OUTPUT)dlfilters/%.o
$(QUIET_LINK)$(CC) $(filter-out -static,$(LDFLAGS)) $(EXTRA_CFLAGS) -shared -o $@ $<
When coverage.sh runs in a build directory that already had a standard
non-coverage build (or a prior GTK4=1 build leaving libperf-gtk.so behind),
build_perf() does not rebuild dlfilters/*.so or libperf-gtk.so.
llvm_cov_objects() then passes those uninstrumented binaries via --object=
to llvm-cov report, which exits with a "No coverage data found" error.
[ ... ]
> +if [ "$SKIP_BUILD" = 0 ]; then
> + command -v clang > /dev/null ||
> + die "clang not found, it is the only compiler with -fcoverage-mapping"
> +fi
> +
> +# Root does not rebuild a prepared build: use the perf already in
> +# BUILD_DIR, or build when there is none.
> +if [ "$ROOT" = 1 ] && [ "$PREP" = 0 ]; then
> + if [ -x "$BUILD_DIR/perf" ]; then
> + SKIP_BUILD=1
> + say "Running as root, using the coverage build in $BUILD_DIR"
> + else
> + say "Running as root, building perf in $BUILD_DIR"
> + fi
> +fi
[Severity: Medium]
Should the clang check run after the root block that sets SKIP_BUILD=1?
Because SKIP_BUILD is still 0 when the clang check runs, executing
coverage.sh as root against a prepared build fails whenever clang is not
installed on the test host or not in root's PATH.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261121032052.1392234-1-acme@kernel.org?part=15
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found
2026-11-21 3:20 [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found Arnaldo Carvalho de Melo
` (15 preceding siblings ...)
2026-11-21 3:20 ` [PATCH v10 16/16] perf scripts: Add a coverage table Arnaldo Carvalho de Melo
@ 2026-11-21 3:36 ` sashiko-bot
16 siblings, 0 replies; 22+ messages in thread
From: sashiko-bot @ 2026-11-21 3:36 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-perf-users
Sashiko has finished reviewing this 16-patch series:
- Patches 1-6, 8-10, and 12-14: no issues found.
- Patch 7 ("perf tests: Exercise the x86 operand parser"): 1 potential
issue (1 Medium)
- Patch 11 ("perf tests: Exercise the annotate stats output"): 1
potential issue (1 Low)
- Patch 15 ("perf scripts: Add a coverage harness for perf"): 3
potential issues (2 Medium, 1 Low)
- Patch 16 ("perf scripts: Add a coverage table"): 1 potential issue (1
Medium)
Detailed reviews have been sent as separate replies to patches 7, 11,
15, and 16.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261121032052.1392234-1-acme@kernel.org
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2026-11-21 3:36 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-21 3:20 [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 01/16] perf build: Link the GTK UI with EXTRA_CFLAGS Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 02/16] perf annotate: Handle absolute addressing in data type profiling Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 03/16] perf annotate: Print the stats after the annotations Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 04/16] perf build: Record the features checked outside FEATURE_TESTS Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 05/16] perf annotate-x86: Parse movabs like a mov Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 06/16] perf annotate-data: Count flexible array accesses for the whole struct Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 07/16] perf tests: Exercise the x86 operand parser Arnaldo Carvalho de Melo
2026-11-21 3:29 ` sashiko-bot
2026-11-21 3:20 ` [PATCH v10 08/16] perf tests: Exercise DW_OP_addrx global variables Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 09/16] perf tests: Exercise the flexible array member path Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 10/16] perf tests: Exercise data type resolution from a register Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 11/16] perf tests: Exercise the annotate stats output Arnaldo Carvalho de Melo
2026-11-21 3:30 ` sashiko-bot
2026-11-21 3:20 ` [PATCH v10 12/16] perf tests: Fix the Intel PT virtual LBR check Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 13/16] perf test: Drop samples without an IP in the dlfilter test Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 14/16] perf test: Skip the LBR inline unwinding check when unsupported Arnaldo Carvalho de Melo
2026-11-21 3:20 ` [PATCH v10 15/16] perf scripts: Add a coverage harness for perf Arnaldo Carvalho de Melo
2026-11-21 3:36 ` sashiko-bot
2026-11-21 3:20 ` [PATCH v10 16/16] perf scripts: Add a coverage table Arnaldo Carvalho de Melo
2026-11-21 3:34 ` sashiko-bot
2026-11-21 3:36 ` [PATCH v10 00/16] perf coverage: A harness for perf, and the fixes it found sashiko-bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.