linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: David Gow <davidgow@google.com>
Cc: Brendan Higgins <brendan.higgins@linux.dev>,
	Rae Moar <raemoar63@gmail.com>,
	Shuah Khan <skhan@linuxfoundation.org>,
	linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
	linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org
Subject: Re: [PATCH v2] kunit: Enforce task execution in {soft,hard}irq contexts
Date: Mon, 22 Dec 2025 12:22:00 -0800	[thread overview]
Message-ID: <20251222202200.GA2188@quark> (raw)
In-Reply-To: <20251219085259.1163048-1-davidgow@google.com>

On Fri, Dec 19, 2025 at 04:52:58PM +0800, David Gow wrote:
> The kunit_run_irq_test() helper allows a function to be run in hardirq
> and softirq contexts (in addition to the task context). It does this by
> running the user-provided function concurrently in the three contexts,
> until either a timeout has expired or a number of iterations have
> completed in the normal task context.
> 
> However, on setups where the initialisation of the hardirq and softirq
> contexts (or, indeed, the scheduling of those tasks) is significantly
> slower than the function execution, it's possible for that number of
> iterations to be exceeded before any runs in irq contexts actually
> occur. This occurs with the polyval.test_polyval_preparekey_in_irqs
> test, which runs 20000 iterations of the relatively fast preparekey
> function, and therefore fails often under many UML, 32-bit arm, m68k and
> other environments.
> 
> Instead, ensure that the max_iterations limit counts executions in all
> three contexts, and requires at least one of each. This will cause the
> test to continue iterating until at least the irq contexts have been
> tested, or the 1s wall-clock limit has been exceeded. This causes the
> test to pass in all of my environments.
> 
> In so doing, we also update the task counters to atomic ints, to better
> match both the 'int' max_iterations input, and to ensure they are
> correctly updated across contexts.
> 
> Finally, we also fix a few potential assertion messages to be
> less-specific to the original crypto usecases.
> 
> Fixes: b41dc83f0790 ("kunit, lib/crypto: Move run_irq_test() to common header")
> Signed-off-by: David Gow <davidgow@google.com>
> ---
> 
> Changes since v1:
> https://lore.kernel.org/all/20251219080850.921416-1-davidgow@google.com/
> - Remove a leftover debug line which forced max_iterations to 1.
> 
> 
>  include/kunit/run-in-irq-context.h | 39 ++++++++++++++++++++----------
>  1 file changed, 26 insertions(+), 13 deletions(-)

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/log/?h=libcrypto-fixes

Thanks!

- Eric

      parent reply	other threads:[~2025-12-22 20:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-19  8:52 [PATCH v2] kunit: Enforce task execution in {soft,hard}irq contexts David Gow
2025-12-19 19:05 ` Eric Biggers
2025-12-20  6:37   ` David Gow
2025-12-22 20:22 ` Eric Biggers [this message]

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=20251222202200.GA2188@quark \
    --to=ebiggers@kernel.org \
    --cc=brendan.higgins@linux.dev \
    --cc=davidgow@google.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=raemoar63@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).