linux/drivers/base/regmap
Andy Shevchenko 953e549471
regmap: irq: Set lockdep class for hierarchical IRQ domains
Lockdep gives a false positive splat as it can't distinguish the lock
which is taken by different IRQ descriptors from different IRQ chips
that are organized in a way of a hierarchy:

   ======================================================
   WARNING: possible circular locking dependency detected
   6.12.0-rc5-next-20241101-00148-g9fabf8160b53 #562 Tainted: G        W
   ------------------------------------------------------
   modprobe/141 is trying to acquire lock:
   ffff899446947868 (intel_soc_pmic_bxtwc:502:(&bxtwc_regmap_config)->lock){+.+.}-{4:4}, at: regmap_update_bits_base+0x33/0x90

   but task is already holding lock:
   ffff899446947c68 (&d->lock){+.+.}-{4:4}, at: __setup_irq+0x682/0x790

   which lock already depends on the new lock.

   -> #3 (&d->lock){+.+.}-{4:4}:
   -> #2 (&desc->request_mutex){+.+.}-{4:4}:
   -> #1 (ipclock){+.+.}-{4:4}:
   -> #0 (intel_soc_pmic_bxtwc:502:(&bxtwc_regmap_config)->lock){+.+.}-{4:4}:

   Chain exists of:
     intel_soc_pmic_bxtwc:502:(&bxtwc_regmap_config)->lock --> &desc->request_mutex --> &d->lock

    Possible unsafe locking scenario:

          CPU0                    CPU1
          ----                    ----
     lock(&d->lock);
                                  lock(&desc->request_mutex);
                                  lock(&d->lock);
     lock(intel_soc_pmic_bxtwc:502:(&bxtwc_regmap_config)->lock);

    *** DEADLOCK ***

   3 locks held by modprobe/141:
    #0: ffff8994419368f8 (&dev->mutex){....}-{4:4}, at: __driver_attach+0xf6/0x250
    #1: ffff89944690b250 (&desc->request_mutex){+.+.}-{4:4}, at: __setup_irq+0x1a2/0x790
    #2: ffff899446947c68 (&d->lock){+.+.}-{4:4}, at: __setup_irq+0x682/0x790

Set a lockdep class when we map the IRQ so that it doesn't warn about
a lockdep bug that doesn't exist.

Fixes: 4af8be67fd ("regmap: Convert regmap_irq to use irq_domain")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241101165553.4055617-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-11-01 18:57:59 +00:00
..
internal.h regmap: maple: Provide lockdep (sub)class for maple tree's internal lock 2024-10-31 17:24:19 +00:00
Kconfig
Makefile
regcache-flat.c regcache: use map->alloc_flags also for allocating cache 2024-08-28 13:52:29 +01:00
regcache-maple.c regmap: maple: Provide lockdep (sub)class for maple tree's internal lock 2024-10-31 17:24:19 +00:00
regcache-rbtree.c regcache: use map->alloc_flags also for allocating cache 2024-08-28 13:52:29 +01:00
regcache.c regmap: Hold the regmap lock when allocating and freeing the cache 2024-08-23 11:03:11 +01:00
regmap-ac97.c regmap: add missing MODULE_DESCRIPTION() macros 2024-06-24 13:38:40 +01:00
regmap-debugfs.c
regmap-fsi.c
regmap-i2c.c regmap-i2c: add missing MODULE_DESCRIPTION() macro 2024-06-14 15:23:14 +01:00
regmap-i3c.c regmap: Drop capitalisation in MODULE_DESCRIPTION() 2024-04-10 22:45:52 +01:00
regmap-irq.c regmap: irq: Set lockdep class for hierarchical IRQ domains 2024-11-01 18:57:59 +00:00
regmap-kunit.c regmap: kunit: Fix repeated test param 2024-10-29 18:56:49 +00:00
regmap-mdio.c regmap: Drop capitalisation in MODULE_DESCRIPTION() 2024-04-10 22:45:52 +01:00
regmap-mmio.c
regmap-ram.c regmap: add missing MODULE_DESCRIPTION() macros 2024-06-24 13:38:40 +01:00
regmap-raw-ram.c regmap: add missing MODULE_DESCRIPTION() macros 2024-06-24 13:38:40 +01:00
regmap-sccb.c regmap: add missing MODULE_DESCRIPTION() macros 2024-06-24 13:38:40 +01:00
regmap-sdw-mbq.c regmap: Drop capitalisation in MODULE_DESCRIPTION() 2024-04-10 22:45:52 +01:00
regmap-sdw.c regmap: Drop capitalisation in MODULE_DESCRIPTION() 2024-04-10 22:45:52 +01:00
regmap-slimbus.c regmap: add missing MODULE_DESCRIPTION() macros 2024-06-24 13:38:40 +01:00
regmap-spi-avmm.c regmap: add missing MODULE_DESCRIPTION() macros 2024-06-24 13:38:40 +01:00
regmap-spi.c regmap: spi: Fix potential off-by-one when calculating reserved size 2024-06-05 22:23:52 +01:00
regmap-spmi.c regmap: add missing MODULE_DESCRIPTION() macros 2024-06-24 13:38:40 +01:00
regmap-w1.c regmap: add missing MODULE_DESCRIPTION() macros 2024-06-24 13:38:40 +01:00
regmap.c regmap: maple: Provide lockdep (sub)class for maple tree's internal lock 2024-10-31 17:24:19 +00:00
trace.h tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00