Re: [PATCH v3 1/2] perf test: Add per-test timeout support
From: Ian Rogers
Date: Mon Oct 12 2026 - 17:57:42 EST
On Mon, Oct 5, 2026 at 3:44 PM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
>
> On Mon, Sep 28, 2026 at 07:53:44PM -0700, Ian Rogers wrote:
> > When a test hangs in 'perf test', the entire test run hangs and makes it
> > difficult to inspect output from other tests.
> >
> > Add a new TEST_TIMEOUT result category and a per-test timeout (default
> > 60 seconds, configurable via '-t'/'--timeout', with 0 to disable). When
> > '-F' ('--dont-fork') is specified, timeouts are disabled.
> >
> > To enforce the timeout:
> > - Place each forked test child into its own process group via
> > setpgid(0, 0) in the child and setpgid(pid, pid) in the parent so any
> > subprocesses spawned by shell or workload tests can be terminated
> > together.
> > - Arm an ITIMER_REAL periodic timer with a SIGALRM handler (using
> > SA_RESTART so /proc status reads in check_if_command_finished() are
> > not interrupted by EINTR while poll()/usleep() waits still wake up).
>
> Do we really need this timer? I think poll() already has a timeout so
> it'll wake up on every 100 msec anyway?
Agreed and that avoids async/signal issues. I will fix this in v4.
Thanks,
Ian
> Thanks,
> Namhyung
>
>
> > - Check elapsed child runtimes against test_timeout in finish_test() and
> > finish_tests_parallel(), sending SIGTERM first and escalating to
> > SIGKILL after 1 second if the child process group has not exited.
> > - Report timed out tests in red ('TIMEOUT!'), track and display them in
> > the test summary, and emit '<error message="TIMEOUT" type="timeout">'
> > counted under the 'errors' attribute in JUnit XML output.
> > - Document '-t'/'--timeout' and '-F'/'--dont-fork' in perf-test.txt.
> >
> > Assisted-by: Antigravity:gemini-3.1-pro
> > Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>