Linux Documentation
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Brendan Higgins <brendan.higgins@linux.dev>,
	 David Gow <david@davidgow.net>, Rae Moar <raemoar63@gmail.com>,
	 Shuah Khan <skhan@linuxfoundation.org>,
	 Daniel Latypov <dlatypov@google.com>,
	Jonathan Corbet <corbet@lwn.net>,
	 Randy Dunlap <rdunlap@infradead.org>
Cc: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
	 linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	 Mark Brown <broonie@kernel.org>
Subject: [PATCH 0/7] kunit: tool: Support parallel test execution
Date: Tue, 13 Oct 2026 16:43:19 +0100	[thread overview]
Message-ID: <20261013-kunit-parallel-v1-0-f4be28c895e5@kernel.org> (raw)

Currently the test execution part of KUnit is very single threaded,
meaning that on larger systems with many CPUs the wall clock time for
running the full suite is longer than it could be.  While we don't want
to run multiple tests in parallel on the same kernel for stability and
clarity reasons all the tests are being run in a virtual environment of
some kind so we can achieve better parallelism by splitting the tests
between multiple simultaneously running virtual environments.  The KUnit
runner already has support for splitting tests up and running either
suites or individual tests in isolated guests, build on this to support
parallel execution.

While developing this some existing issues became more visible, some of
these are fixed with some standalone patches at the start of the series 
but I split some issues with test naming out, these were sent as:

 - lib/tests: util_macros: Drop the '.' from the KUnit suite name
   https://lore.kernel.org/r/20261012-kunit-util-macros-name-v1-1-810b401baeb0@kernel.org
 - kunit: Add KUNIT_CASE_PARAM_UNIQUE() and KUNIT_CASE_PARAM_WITH_INIT_UNIQUE()
   https://lore.kernel.org/r/20261013-kunit-param-names-v1-0-4b22ec5b85b9@kernel.org

Performance results with --alltests, using the elapsed time reported by
the KUnit runner with an already built kernel on a Raspberry Pi 5 with 4
CPUs and a Graviton 4 with 192 CPUs:

                     default  parallel  per test   parallel per test
  Raspberry Pi 5     67.7s    49.4s     836.4s     326.5s
  Graviton 4         64.1s    30.8s     445.9s      39.7s

Even with the overhead of having to boot more kernels we are seeing
substantial speedups, even on lower end systems with limited parallelism
available.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
Mark Brown (7):
      kunit: tool: Preserve failures from kernels without test results
      kunit: tool: Combine reports from isolated kernels
      kunit: tool: Boot with a larger log buffer when listing tests
      kunit: tool: Add an outfile argument to run_kernel()
      kunit: tool: Allow several run_kernel() calls to be in flight at once
      kunit: tool: Serialise output written from multiple threads
      kunit: tool: Add --parallel to run suites in concurrent kernels

 Documentation/dev-tools/kunit/run_wrapper.rst |  11 ++
 tools/testing/kunit/kunit.py                  | 151 +++++++++++----
 tools/testing/kunit/kunit_junit.py            |   3 +-
 tools/testing/kunit/kunit_kernel.py           |  78 +++++---
 tools/testing/kunit/kunit_printer.py          |   9 +-
 tools/testing/kunit/kunit_tool_test.py        | 253 +++++++++++++++++++++++++-
 6 files changed, 438 insertions(+), 67 deletions(-)
---
base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm master
change-id: 20261012-kunit-parallel-a8a7e3c19a30

Best regards,
--  
Mark Brown <broonie@kernel.org>


             reply	other threads:[~2026-10-13 15:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 15:43 Mark Brown [this message]
2026-10-13 15:43 ` [PATCH 1/7] kunit: tool: Preserve failures from kernels without test results Mark Brown
2026-10-13 15:43 ` [PATCH 2/7] kunit: tool: Combine reports from isolated kernels Mark Brown
2026-10-13 15:43 ` [PATCH 3/7] kunit: tool: Boot with a larger log buffer when listing tests Mark Brown
2026-10-13 15:43 ` [PATCH 4/7] kunit: tool: Add an outfile argument to run_kernel() Mark Brown
2026-10-13 15:43 ` [PATCH 5/7] kunit: tool: Allow several run_kernel() calls to be in flight at once Mark Brown
2026-10-13 15:43 ` [PATCH 6/7] kunit: tool: Serialise output written from multiple threads Mark Brown
2026-10-13 15:43 ` [PATCH 7/7] kunit: tool: Add --parallel to run suites in concurrent kernels Mark Brown

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=20261013-kunit-parallel-v1-0-f4be28c895e5@kernel.org \
    --to=broonie@kernel.org \
    --cc=brendan.higgins@linux.dev \
    --cc=corbet@lwn.net \
    --cc=david@davidgow.net \
    --cc=dlatypov@google.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=raemoar63@gmail.com \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.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