[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ytbw1T6uspICqj5B@bombadil.infradead.org>
Date: Tue, 19 Jul 2022 10:58:45 -0700
From: Luis Chamberlain <mcgrof@...nel.org>
To: Daniel Latypov <dlatypov@...gle.com>
Cc: David Gow <davidgow@...gle.com>,
Brendan Higgins <brendanhiggins@...gle.com>,
Shuah Khan <skhan@...uxfoundation.org>,
Jeremy Kerr <jk@...econstruct.com.au>,
linux-modules@...r.kernel.org, kunit-dev@...glegroups.com,
linux-kselftest@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] module: kunit: Load .kunit_test_suites section when
CONFIG_KUNIT=m
On Wed, Jul 13, 2022 at 08:24:32AM -0700, Daniel Latypov wrote:
> On Tue, Jul 12, 2022 at 5:52 PM David Gow <davidgow@...gle.com> wrote:
> >
> > The new KUnit module handling has KUnit test suites listed in a
> > .kunit_test_suites section of each module. This should be loaded when
> > the module is, but at the moment this only happens if KUnit is built-in.
> >
> > Also load this when KUnit is enabled as a module: it'll not be usable
> > unless KUnit is loaded, but such modules are likely to depend on KUnit
> > anyway, so it's unlikely to ever be loaded needlessly.
>
> This seems reasonable to me.
>
> Question: what happens in this case?
> 1. insmod <test-module>
> 2. insmod kunit
> 3. rmmod <test-module>
>
> I think on 3, we'll call the cleanup code, __kunit_test_suites_exit(),
> for <test-module>, I think?
> But we never called __kunit_test_suites_init().
> My fear is what breaks as a result of this precondition break.
>
> E.g. In the case that CONFIG_KUNIT_DEBUGFS is enabled, this includes a
> call to kunit_debugfs_destroy_suite() with no previous call to
> kunit_debugfs_create_suite().
> That will include a call to debugfs_remove_recursive(suite->debugfs),
> where suite->debugfs is an uninitialized pointer.
>
> Maybe we can treat it as "undefined behavior" for now and proceed with
> this patch.
>
> In terms of long-term fixes, perhaps insmod kunit could trigger it to
> 1. run all built-in tests (IIUC, it doesn't right now)
> 2. run all the tests of currently loaded modules
> 3. track which modules already ran so if you rmmod + insmod kunit
> again, it won't rerun tests?
Let's please address these considerations.
Luis
Powered by blists - more mailing lists