* [PATCH] kunit: bail out early in __kunit_test_suites_init() if there are no suites to test [not found] <CAA1CXcBqcyXma1kGwvfAQ5T24dmuH_Or9RPrVqxDoVq=N4Se3w@mail.gmail.com> @ 2024-03-21 14:32 ` Scott Mayhew 2024-03-21 23:22 ` Rae Moar 2024-03-23 5:24 ` David Gow 0 siblings, 2 replies; 5+ messages in thread From: Scott Mayhew @ 2024-03-21 14:32 UTC (permalink / raw) To: brendanhiggins, davidgow Cc: rmoar, npache, linux-kselftest, kunit-dev, linux-nfs Commit c72a870926c2 added a mutex to prevent kunit tests from running concurrently. Unfortunately that mutex gets locked during module load regardless of whether the module actually has any kunit tests. This causes a problem for kunit tests that might need to load other kernel modules (e.g. gss_krb5_test loading the camellia module). So check to see if there are actually any tests to run before locking the kunit_run_lock mutex. Fixes: c72a870926c2 ("kunit: add ability to run tests after boot using debugfs") Reported-by: Nico Pache <npache@redhat.com> Signed-off-by: Scott Mayhew <smayhew@redhat.com> --- lib/kunit/test.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/kunit/test.c b/lib/kunit/test.c index 1d1475578515..b8514dbb337c 100644 --- a/lib/kunit/test.c +++ b/lib/kunit/test.c @@ -712,6 +712,9 @@ int __kunit_test_suites_init(struct kunit_suite * const * const suites, int num_ { unsigned int i; + if (num_suites == 0) + return 0; + if (!kunit_enabled() && num_suites > 0) { pr_info("kunit: disabled\n"); return 0; -- 2.43.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] kunit: bail out early in __kunit_test_suites_init() if there are no suites to test 2024-03-21 14:32 ` [PATCH] kunit: bail out early in __kunit_test_suites_init() if there are no suites to test Scott Mayhew @ 2024-03-21 23:22 ` Rae Moar 2024-03-23 5:24 ` David Gow 1 sibling, 0 replies; 5+ messages in thread From: Rae Moar @ 2024-03-21 23:22 UTC (permalink / raw) To: Scott Mayhew Cc: brendanhiggins, davidgow, npache, linux-kselftest, kunit-dev, linux-nfs On Thu, Mar 21, 2024 at 10:32 AM Scott Mayhew <smayhew@redhat.com> wrote: > > Commit c72a870926c2 added a mutex to prevent kunit tests from running > concurrently. Unfortunately that mutex gets locked during module load > regardless of whether the module actually has any kunit tests. This > causes a problem for kunit tests that might need to load other kernel > modules (e.g. gss_krb5_test loading the camellia module). > > So check to see if there are actually any tests to run before locking > the kunit_run_lock mutex. > > Fixes: c72a870926c2 ("kunit: add ability to run tests after boot using debugfs") > Reported-by: Nico Pache <npache@redhat.com> > Signed-off-by: Scott Mayhew <smayhew@redhat.com> Hi! Sorry about this bug. Thanks for the patch! We should definitely add this check. Reviewed-by: Rae Moar <rmoar@google.com> Thanks! -Rae > --- > lib/kunit/test.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/lib/kunit/test.c b/lib/kunit/test.c > index 1d1475578515..b8514dbb337c 100644 > --- a/lib/kunit/test.c > +++ b/lib/kunit/test.c > @@ -712,6 +712,9 @@ int __kunit_test_suites_init(struct kunit_suite * const * const suites, int num_ > { > unsigned int i; > > + if (num_suites == 0) > + return 0; > + > if (!kunit_enabled() && num_suites > 0) { > pr_info("kunit: disabled\n"); > return 0; > -- > 2.43.0 > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kunit: bail out early in __kunit_test_suites_init() if there are no suites to test 2024-03-21 14:32 ` [PATCH] kunit: bail out early in __kunit_test_suites_init() if there are no suites to test Scott Mayhew 2024-03-21 23:22 ` Rae Moar @ 2024-03-23 5:24 ` David Gow 2024-04-30 13:58 ` Scott Mayhew 1 sibling, 1 reply; 5+ messages in thread From: David Gow @ 2024-03-23 5:24 UTC (permalink / raw) To: Scott Mayhew Cc: brendanhiggins, rmoar, npache, linux-kselftest, kunit-dev, linux-nfs [-- Attachment #1: Type: text/plain, Size: 1385 bytes --] On Thu, 21 Mar 2024 at 22:32, Scott Mayhew <smayhew@redhat.com> wrote: > > Commit c72a870926c2 added a mutex to prevent kunit tests from running > concurrently. Unfortunately that mutex gets locked during module load > regardless of whether the module actually has any kunit tests. This > causes a problem for kunit tests that might need to load other kernel > modules (e.g. gss_krb5_test loading the camellia module). > > So check to see if there are actually any tests to run before locking > the kunit_run_lock mutex. > > Fixes: c72a870926c2 ("kunit: add ability to run tests after boot using debugfs") > Reported-by: Nico Pache <npache@redhat.com> > Signed-off-by: Scott Mayhew <smayhew@redhat.com> > --- Thanks, this works well here, and is a good idea anyway. Reviewed-by: David Gow <davidgow@google.com> Cheers, -- David > lib/kunit/test.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/lib/kunit/test.c b/lib/kunit/test.c > index 1d1475578515..b8514dbb337c 100644 > --- a/lib/kunit/test.c > +++ b/lib/kunit/test.c > @@ -712,6 +712,9 @@ int __kunit_test_suites_init(struct kunit_suite * const * const suites, int num_ > { > unsigned int i; > > + if (num_suites == 0) > + return 0; > + > if (!kunit_enabled() && num_suites > 0) { > pr_info("kunit: disabled\n"); > return 0; > -- > 2.43.0 > [-- Attachment #2: S/MIME Cryptographic Signature --] [-- Type: application/pkcs7-signature, Size: 4014 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kunit: bail out early in __kunit_test_suites_init() if there are no suites to test 2024-03-23 5:24 ` David Gow @ 2024-04-30 13:58 ` Scott Mayhew 2024-05-02 0:01 ` David Gow 0 siblings, 1 reply; 5+ messages in thread From: Scott Mayhew @ 2024-04-30 13:58 UTC (permalink / raw) To: David Gow Cc: brendanhiggins, rmoar, npache, linux-kselftest, kunit-dev, linux-nfs On Sat, 23 Mar 2024, David Gow wrote: > On Thu, 21 Mar 2024 at 22:32, Scott Mayhew <smayhew@redhat.com> wrote: > > > > Commit c72a870926c2 added a mutex to prevent kunit tests from running > > concurrently. Unfortunately that mutex gets locked during module load > > regardless of whether the module actually has any kunit tests. This > > causes a problem for kunit tests that might need to load other kernel > > modules (e.g. gss_krb5_test loading the camellia module). > > > > So check to see if there are actually any tests to run before locking > > the kunit_run_lock mutex. > > > > Fixes: c72a870926c2 ("kunit: add ability to run tests after boot using debugfs") > > Reported-by: Nico Pache <npache@redhat.com> > > Signed-off-by: Scott Mayhew <smayhew@redhat.com> > > --- > > Thanks, this works well here, and is a good idea anyway. > > Reviewed-by: David Gow <davidgow@google.com> > Brendan, David, Is there a reason this patch hasn't been merged? -Scott > Cheers, > -- David > > > lib/kunit/test.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/lib/kunit/test.c b/lib/kunit/test.c > > index 1d1475578515..b8514dbb337c 100644 > > --- a/lib/kunit/test.c > > +++ b/lib/kunit/test.c > > @@ -712,6 +712,9 @@ int __kunit_test_suites_init(struct kunit_suite * const * const suites, int num_ > > { > > unsigned int i; > > > > + if (num_suites == 0) > > + return 0; > > + > > if (!kunit_enabled() && num_suites > 0) { > > pr_info("kunit: disabled\n"); > > return 0; > > -- > > 2.43.0 > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kunit: bail out early in __kunit_test_suites_init() if there are no suites to test 2024-04-30 13:58 ` Scott Mayhew @ 2024-05-02 0:01 ` David Gow 0 siblings, 0 replies; 5+ messages in thread From: David Gow @ 2024-05-02 0:01 UTC (permalink / raw) To: Scott Mayhew Cc: brendanhiggins, rmoar, npache, linux-kselftest, kunit-dev, linux-nfs [-- Attachment #1: Type: text/plain, Size: 1332 bytes --] On Tue, 30 Apr 2024 at 21:58, Scott Mayhew <smayhew@redhat.com> wrote: > > On Sat, 23 Mar 2024, David Gow wrote: > > > On Thu, 21 Mar 2024 at 22:32, Scott Mayhew <smayhew@redhat.com> wrote: > > > > > > Commit c72a870926c2 added a mutex to prevent kunit tests from running > > > concurrently. Unfortunately that mutex gets locked during module load > > > regardless of whether the module actually has any kunit tests. This > > > causes a problem for kunit tests that might need to load other kernel > > > modules (e.g. gss_krb5_test loading the camellia module). > > > > > > So check to see if there are actually any tests to run before locking > > > the kunit_run_lock mutex. > > > > > > Fixes: c72a870926c2 ("kunit: add ability to run tests after boot using debugfs") > > > Reported-by: Nico Pache <npache@redhat.com> > > > Signed-off-by: Scott Mayhew <smayhew@redhat.com> > > > --- > > > > Thanks, this works well here, and is a good idea anyway. > > > > Reviewed-by: David Gow <davidgow@google.com> > > > > Brendan, David, > > Is there a reason this patch hasn't been merged? > > -Scott > Sorry: it totally slipped through the net. Thanks for the reminder, it's merged now: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=kunit&id=2168e528f8679881df7487309f3444a121b2b544 Cheers, -- David [-- Attachment #2: S/MIME Cryptographic Signature --] [-- Type: application/pkcs7-signature, Size: 4014 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-05-02 0:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CAA1CXcBqcyXma1kGwvfAQ5T24dmuH_Or9RPrVqxDoVq=N4Se3w@mail.gmail.com>
2024-03-21 14:32 ` [PATCH] kunit: bail out early in __kunit_test_suites_init() if there are no suites to test Scott Mayhew
2024-03-21 23:22 ` Rae Moar
2024-03-23 5:24 ` David Gow
2024-04-30 13:58 ` Scott Mayhew
2024-05-02 0:01 ` David Gow
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox