[PATCH v4 7/7] configfs: Fix LOCKDEP nesting issues with fragment semaphores

Mike Leach mike.leach at linaro.org
Fri Aug 5 07:15:53 PDT 2022


Hi Christoph.

[adding in Suzuki and Mathieu who maintain the coresight subsystem & lists]

You are correct - in this patchset we are adding the use of a binary
attribute to load and unload Coresight configurations and features -
which action has a side effect of adding and removing entries in
particular sub-directories in our configfs sub-system.

Our use case for configfs is somewhat more complex than the other
existing usages - such as ACPI, where the format of the directory
structure and attributes is static, and known ahead of time.

The CoreSight configurations have variable numbers of attributes
appearing in the configfs directories  - so the attribute arrays are
built dynamically at load time. The load process and also result in
elements appearing in both the cs-syscfg/configurations and the
cs-syscfg/features sub directories. This dynamic nature and split
elements means that the traditional mkdir/rmdir configfs paradigm
cannot be made to work.

We currently have two methods upstreamed for loading configurations, 1
is a configuration directly built into the coresight core code, and
the other is to allow configurations to be loaded as kernel loadable
modules.
However these 2 are dependent on compile time operations, and have
kernel dependencies.

Hence we have introduced the direct load via configfs binary attribute
- which is more portable, flexible and convenient for the end user.

I appreciate that this may not be a usage you anticipated for
configfs, but it does serve our purposes very well, and as far a I can
tell from examination of configfs code and considerable testing, works
fine and does not have any operational issues, other than the lockdep
warnings on unload, which are caused be the fragment locks (lockdep
being confused by holding the fragment for the initial cs-syscfg root
system, and the one for the sub-directory we want to unload).

I am open to suggestions for a different way of doing this within the
established directory structure we need to maintain.

Thanks and Regards

Mike









On Fri, 29 Jul 2022 at 14:24, Christoph Hellwig <hch at lst.de> wrote:
>
> On Fri, Jul 29, 2022 at 07:41:00AM +0100, Mike Leach wrote:
> > Sure - see below
> >
> > Happens  during the unload process of the coresight configuration.
>
> Hmm.  It seems like youre bin_attr ->write handler (which gets called
> from configfs_release_bin_file) tries to unregister a group.  That's
> not really how the configfs API is supposed to be used.



--
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK



More information about the linux-arm-kernel mailing list