mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: irogers@google.com, acme@kernel.org, namhyung@kernel.org
Cc: 9erthalion6@gmail.com, adrian.hunter@intel.com,
	james.clark@linaro.org,  jolsa@kernel.org, leo.yan@arm.com,
	linux-kernel@vger.kernel.org,  linux-perf-users@vger.kernel.org,
	mingo@redhat.com, peterz@infradead.org
Subject: [PATCH v5 0/3] perf test: Per-test timeouts and JUnit XML schema compliance
Date: Thu, 22 Oct 2026 14:07:50 -0700	[thread overview]
Message-ID: <20261022210753.1851597-1-irogers@google.com> (raw)
In-Reply-To: <20261012234724.721224-1-irogers@google.com>

This series adds per-test timeout support to 'perf test', improves JUnit
XML output to validate against strict JUnit schemas, and ensures time
spent waiting for the shared mlock budget does not count towards a
test's timeout or reported duration:

1. Add a per-test timeout (default 120s, configurable via '-t'/'--timeout',
   0 to disable, disabled with '-F'/'--dont-fork'). Forked tests run in
   their own process groups and the existing polling loops in
   finish_test() and finish_tests_parallel() check elapsed runtimes,
   sending SIGTERM on timeout and escalating to SIGKILL after 1 second.
   Timed out tests are reported as 'TIMEOUT!', listed in the summary,
   and recorded as '<error message="TIMEOUT" type="timeout">' in JUnit
   XML output.

2. Update 'perf test -j' output to validate cleanly against both the
   Apache Ant/Windy Road JUnit schema (JUnit.xsd) and the Jenkins
   xUnit/Maven Surefire schema (junit-10.xsd), including required
   '<testsuite>' attributes, '<properties>' from uname, '<system-out/>'
   and '<system-err/>', self-closing tags, apostrophe escaping, and
   UTF-8/XML 1.0 codepoint validation.

3. Record each mlock-serialized test's start time in the shared
   mlock_budget mapping when it acquires mlock_budget->lock in
   run_test_case_mlocked(), so tests waiting for the mlock budget do not
   time out while waiting in line and their reported elapsed time
   reflects actual execution time.

v5:
 - Rebase onto tmp.perf-tools-next (patch 3 of v4 was applied upstream)
   and add Namhyung's Acked-by to patches 1 and 2.
 - Add patch 3 so tests waiting on mlock_budget->lock don't time out
   while waiting.
 - Increase the default per-test timeout from 60s to 120s. When running
   the full suite as root (where CAP_IPC_LOCK lifts the mlock limit and
   mlock_budget is unused), all ~180 non-exclusive tests start
   simultaneously at t=0 and contend heavily on CPUs, /proc scanning,
   and vmlinux/DWARF symbol resolution. On a 28-CPU hybrid machine, a
   60s timeout resulted in 33 timeouts across the parallel burst and
   large sequential suites; increasing the default to 120s allowed
   longer tests ('kernel lock contention analysis test' at 115.3s,
   'task-analyzer python test' at 94.7s, 'perf data type profiling
   tests' at 92.6s, 'perf metrics value validation' at 91.2s, 'perf
   record tests' at 79.0s, and 'python profiling with jitdump' at 62.7s)
   to complete, reducing timeouts from 33 to 2 ('perf record LBR tests'
   and 'perftool-testsuite_report') and overall suite wall-clock time
   from 503.5s to 363.9s.

v4:
 - Drop the ITIMER_REAL timer and SIGALRM handler in patch 1, relying on
   the existing 10ms/100ms polling loops in finish_test() and
   finish_tests_parallel() to detect timeouts.
 - Only fall back to kill(pid, sig) when kill(-pid, sig) fails, and
   ignore SIGTERM/SIGINT while waiting for subprocesses in
   run_test_child().
 - Add patch 3 to avoid stack trace noise in verbose=1 failure snippets.

v3:
 - Block SIGINT/SIGTERM while a test process may be reaped and until its
   pid is cleared, and skip already reaped tests in the signal path.

v2:
 - Reset SIGALRM to SIG_DFL in the forked test child.
 - Replace the blocking waitpid(-1) loop with a bounded, non-blocking
   wait that only runs when interrupted by SIGTERM/SIGINT.
 - Ensure the SIGKILL escalation reaches the whole process group before
   the zombie is reaped.
 - Factor out timespec_diff_secs() and TEST_KILL_GRACE_SECS.

Assisted-by: Antigravity:gemini-3.1-pro

Ian Rogers (3):
  perf test: Add per-test timeout support
  perf test: Improve JUnit XML schema compliance and completeness
  perf test: Don't count mlock budget wait time towards test timeout

 tools/perf/Documentation/perf-test.txt |  12 +-
 tools/perf/tests/builtin-test.c        | 645 +++++++++++++++++++------
 tools/perf/tests/tests.h               |   7 +-
 3 files changed, 523 insertions(+), 141 deletions(-)

-- 
2.56.0.307.g5fe7bd680c-goog


  parent reply	other threads:[~2026-10-22 21:07 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 21:01 [PATCH v1 1/2] perf test: Add per-test timeout support Ian Rogers
2026-09-28 21:01 ` [PATCH v1 2/2] perf test: Improve JUnit XML schema compliance and completeness Ian Rogers
2026-09-29  1:18 ` [PATCH v2 1/2] perf test: Add per-test timeout support Ian Rogers
2026-09-29  1:18   ` [PATCH v2 2/2] perf test: Improve JUnit XML schema compliance and completeness Ian Rogers
2026-09-29  2:53   ` [PATCH v3 1/2] perf test: Add per-test timeout support Ian Rogers
2026-09-29  2:53     ` [PATCH v3 2/2] perf test: Improve JUnit XML schema compliance and completeness Ian Rogers
2026-10-05 22:44     ` [PATCH v3 1/2] perf test: Add per-test timeout support Namhyung Kim
2026-10-12 21:57       ` Ian Rogers
2026-10-12 23:47     ` [PATCH v4 0/3] perf test: Per-test timeouts, JUnit XML compliance, and snippet improvements Ian Rogers
2026-10-12 23:47       ` [PATCH v4 1/3] perf test: Add per-test timeout support Ian Rogers
2026-10-12 23:47       ` [PATCH v4 2/3] perf test: Improve JUnit XML schema compliance and completeness Ian Rogers
2026-10-12 23:47       ` [PATCH v4 3/3] perf test: Avoid stack trace noise in verbose=1 failure snippets Ian Rogers
2026-10-14 21:33       ` [PATCH v4 0/3] perf test: Per-test timeouts, JUnit XML compliance, and snippet improvements Namhyung Kim
2026-10-19 12:22         ` Arnaldo Carvalho de Melo
2026-10-22 16:00           ` Ian Rogers
2026-10-22 21:07       ` Ian Rogers [this message]
2026-10-22 21:07         ` [PATCH v5 1/3] perf test: Add per-test timeout support Ian Rogers
2026-10-22 21:07         ` [PATCH v5 2/3] perf test: Improve JUnit XML schema compliance and completeness Ian Rogers
2026-10-22 21:07         ` [PATCH v5 3/3] perf test: Don't count mlock budget wait time towards test timeout Ian Rogers
2026-10-22 22:22         ` [PATCH v6 0/3] perf test: Per-test timeouts and JUnit XML schema compliance Ian Rogers
2026-10-22 22:22           ` [PATCH v6 1/3] perf test: Add per-test timeout support Ian Rogers
2026-10-22 22:22           ` [PATCH v6 2/3] perf test: Improve JUnit XML schema compliance and completeness Ian Rogers
2026-10-22 22:22           ` [PATCH v6 3/3] perf test: Don't count mlock budget wait time towards test timeout Ian Rogers

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=20261022210753.1851597-1-irogers@google.com \
    --to=irogers@google.com \
    --cc=9erthalion6@gmail.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=leo.yan@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /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

all inboxes | Powered by JetHome®