• Mike Leach's avatar
    coresight: syscfg: Update load and unload operations · 8add26f7
    Mike Leach authored
    The configfs system is a source of access to the config information in the
    configuration and feature lists.
    
    This can result in additional LOCKDEP issues as a result of the mutex
    ordering between the config list mutex (cscfg_mutex) and the configfs
    system mutexes.
    
    As such we need to adjust how load/unload operations work to ensure correct
    operation.
    
    1) Previously the cscfg_mutex was held throughout the load/unload
    operation. This is now only held during configuration list manipulations,
    resulting in a multi-stage load/unload process.
    
    2) All operations that manipulate the configfs representation of the
    configurations and features are now separated out and run without the
    cscfg_mutex being held. This avoids circular lock_dep issue with the
    built-in configfs mutexes and semaphores
    
    3) As the load and unload is now multi-stage, some parts under the
    cscfg_mutex and others not:
    i) A flag indicating a load / unload operation in progress is used to
    serialise load / unload operations.
    ii) activating any configuration not possible when unload is in progress.
    iii) Configurations have an "available" flag set only after the last load
    stage for the configuration is complete. Activation of the configuration
    not possible till flag is set.
    
    4) Following load/unload rules remain:
    i) Unload prevented while any configuration is active remains.
    ii) Unload in strict reverse order of load.
    iii) Existing configurations can be activated while a new load operation
    is underway. (by definition there can be no dependencies between an
    existing configuration and a new loading one due to ii) above.)
    
    Fixes: eb2ec496 ("coresight: syscfg: Update load API for config loadable modules")
    Reported-by: default avatarSuzuki Poulose <suzuki.poulose@arm.com>
    Signed-off-by: default avatarMike Leach <mike.leach@linaro.org>
    Reviewed-and-tested-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
    Link: https://lore.kernel.org/r/20220628173004.30002-3-mike.leach@linaro.orgSigned-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
    8add26f7
coresight-syscfg.h 4.42 KB