Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Arnaldo Carvalho de Melo" <acme@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v1 17/17] perf tests report: Exercise the TUI browsers
Date: Tue, 24 Nov 2026 19:01:47 +0000	[thread overview]
Message-ID: <sashiko-outbox-231871@kernel.org> (raw)
In-Reply-To: <20261124184604.24983-18-acme@kernel.org>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] perf tests report_tui: multi-event menu and kptr_restrict
  modal dialog hang
- [Medium] perf tests report_tui: debuginfo and os.write() EIO failure
  in annotate test
--

commit a2002eeed86b16048de69b871224382c3a77c477
Author: Arnaldo Carvalho de Melo <acme@redhat.com>

perf tests report: Exercise the TUI browsers

This commit adds a shell test that runs perf report and perf annotate in
TUI mode inside a Python pty harness and verifies that the expected browser
screens are rendered in response to key presses.

> diff --git a/tools/perf/tests/shell/report_tui.sh b/tools/perf/tests/shell/report_tui.sh
> new file mode 100755
> index 0000000000000..bf5ff1c4c3f6f
> --- /dev/null
> +++ b/tools/perf/tests/shell/report_tui.sh
> @@ -0,0 +1,112 @@

[ ... ]

> +with open(outfile, "wb") as out:
> +	while True:
> +		now = time.time()
> +		if now > deadline:
> +			os.kill(pid, 9)
> +			sys.exit(2)
> +		if keys and now >= next_key:
> +			os.write(fd, keys[:1])
> +			keys = keys[1:]
> +			next_key = now + 0.7
> +		r, _, _ = select.select([fd], [], [], 0.1)
> +		if r:
> +			try:
> +				chunk = os.read(fd, 65536)
> +			except OSError:
> +				break

[ ... ]

> +echo "TUI record"
> +if ! perf record -q -o "${perfdata}" -- perf test -w noploop 1; then
> +	echo "TUI record [Failed: perf record failed]"
> +	cleanup
> +	exit 1
> +fi
> +
> +run_tui "report" "q" "Overhead" perf report --tui -i "${perfdata}"
> +run_tui "report help" "?qq" "Help" perf report --tui -i "${perfdata}"
> +run_tui "report dso zoom" "dq" "Overhead" perf report --tui -i "${perfdata}"
> +run_tui "report thread zoom" "tq" "Overhead" perf report --tui -i "${perfdata}"

[Severity: Medium]
Can running perf record without a single user-space event and perf report
without -q cause these tests to fail or hang until the 20-second timeout?

When no event is specified, evlist__new_default() creates one cycles event
per core PMU.  On hybrid systems with multiple core PMUs, perf.data holds
multiple events, so evlist__tui_browse_hists() enters the event-selection
menu in perf_evsel_menu__run() instead of opening the histogram browser.
In that menu, pressing q exits before Overhead is ever drawn, while
pressing d or t opens an unhandled-hotkey modal dialog that consumes the q
key and leaves perf report blocked until the deadline kills it.  Similarly,
__cmd_annotate() iterates over each evsel with samples, so a single q only
closes the first PMU's browser.

In addition, default recording captures kernel samples when
perf_event_paranoid <= 1.  If kallsyms addresses are restricted by
kptr_restrict, report__warn_kptr_restrict() calls ui__warning() on startup,
opening a modal warning dialog that consumes the first key sent by
tui_keys.py.

Passing -e cpu-clock:u (or -e cycles:u) to perf record and -q to perf
report --tui would ensure a single user-space event and suppress startup
warning dialogs.

> +run_tui "annotate" "q" "Percent" perf annotate --tui -i "${perfdata}"
> +# noploop is built without debug info, so 's' opens the "no source code"
> +# warning and the first 'q' only dismisses it; the second one quits.
> +run_tui "annotate source" "sqq" "Percent" perf annotate --tui -i "${perfdata}"

[Severity: Medium]
Can the annotate source test fail with an unhandled OSError in tui_keys.py
when perf is built with debug info?

tools/perf/tests/workloads/Build compiles noploop.o with the default
CORE_CFLAGS, which includes -g in debug builds (such as DEBUG=1 or
EXTRA_CFLAGS=-g).  When DWARF info is present, pressing s in
annotate_browser__toggle_source() finds annotation__has_source(notes) true
and toggles the source view without opening a warning dialog.  The first q
in sqq then exits perf annotate immediately, and when tui_keys.py sends the
second q via os.write(fd, keys[:1]) (which, unlike os.read(), is not
wrapped in try/except OSError), writing to the closed pty raises EIO and
fails the test.

Conversely, if a user's ~/.perfconfig sets annotate.hide_src_code = false
and debug info is absent, __hist_entry__tui_annotate() opens the "Annotation
has no source code." modal warning on startup, consuming the single q in
the first annotate test and causing it to hang until the timeout.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124184604.24983-1-acme@kernel.org?part=17

  reply	other threads:[~2026-11-24 19:01 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 18:45 [PATCH v1 00/17] perf tests: Add coverage for the untested perf subcommands Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 01/17] perf tests top: Pin the ring buffer size Arnaldo Carvalho de Melo
2026-11-24 19:01   ` sashiko-bot
2026-11-24 18:45 ` [PATCH v1 02/17] perf tests sched: Exercise the sched views and options Arnaldo Carvalho de Melo
2026-11-24 18:58   ` sashiko-bot
2026-11-24 18:45 ` [PATCH v1 03/17] perf tests help: Add a basic perf help test Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 04/17] perf tests config: Exercise the config file and list options Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 05/17] perf tests script: Exercise the list, fields and dump options Arnaldo Carvalho de Melo
2026-11-24 18:54   ` sashiko-bot
2026-11-24 18:45 ` [PATCH v1 06/17] perf tests sort: Exercise the report and diff sort keys Arnaldo Carvalho de Melo
2026-11-24 19:02   ` sashiko-bot
2026-11-24 18:45 ` [PATCH v1 07/17] perf tests diff: Exercise the output options Arnaldo Carvalho de Melo
2026-11-24 18:57   ` sashiko-bot
2026-11-24 18:45 ` [PATCH v1 08/17] perf tests annotate: Exercise the output and filter options Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 09/17] perf tests report: Exercise the output and format options Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 10/17] perf tests record: Exercise more record options Arnaldo Carvalho de Melo
2026-11-24 19:03   ` sashiko-bot
2026-11-24 18:45 ` [PATCH v1 11/17] perf tests trace: Exercise the tracing options Arnaldo Carvalho de Melo
2026-11-24 19:02   ` sashiko-bot
2026-11-24 18:45 ` [PATCH v1 12/17] perf tests timechart: Exercise the report options Arnaldo Carvalho de Melo
2026-11-24 18:46 ` [PATCH v1 13/17] perf tests kmem: Add a basic perf kmem test Arnaldo Carvalho de Melo
2026-11-24 18:57   ` sashiko-bot
2026-11-24 18:46 ` [PATCH v1 14/17] perf tests bench: Add smoke tests for perf bench Arnaldo Carvalho de Melo
2026-11-24 19:03   ` sashiko-bot
2026-11-24 18:46 ` [PATCH v1 15/17] perf tests lock: Exercise perf lock report and info Arnaldo Carvalho de Melo
2026-11-24 18:46 ` [PATCH v1 16/17] perf tests probe: Exercise the variable and line listing Arnaldo Carvalho de Melo
2026-11-24 19:00   ` sashiko-bot
2026-11-24 18:46 ` [PATCH v1 17/17] perf tests report: Exercise the TUI browsers Arnaldo Carvalho de Melo
2026-11-24 19:01   ` sashiko-bot [this message]
2026-11-24 19:03 ` [PATCH v1 00/17] perf tests: Add coverage for the untested perf subcommands sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-231871@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=acme@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox