Re: [PATCH v9 3/6] selftests: add tests_sysfs module

Luis Chamberlain
2021-12-10T21:39:47Z

On Wed, Dec 08, 2021 at 05:48:25PM -0800, Luis Chamberlain wrote:
> On Fri, Dec 03, 2021 at 04:29:02PM +0100, Greg KH wrote:
> > On Fri, Oct 29, 2021 at 11:44:57AM -0700, Luis Chamberlain wrote:
> > > This adds a new selftest module which can be used to test sysfs, which
> > > would otherwise require using an existing driver. This lets us muck
> > > with a template driver to test breaking things without affecting
> > > system behaviour or requiring the dependencies of a real device
> > > driver.
> >
> > Test sysfs "how"? What exactly are you wanting to test?
>
> You can look at the 32 tests added after all patches applied.
>
> > I see lots of things in this code as examples of how to NOT use sysfs,
> > so are you testing my review cycles? :)
>
> You are exagerating, there are 32 tests there and only 2 tests deal
> with a deadlock which we are not yet sure how widespread it could be.

Also very important is how one test uses failure injection support to proove
how getting the kernfs active reference suffices to avoid crashes with
module removal and uses of sysfs ops in a driver, something which *you*
did not believe to be true but the code speaks for itself. This is also
why uses of try_module_get() is *safe* if used on sysfs ops.

Luis