From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85D94C5474B for ; Wed, 28 Aug 2024 10:02:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0D8926B008C; Wed, 28 Aug 2024 06:02:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 088756B0092; Wed, 28 Aug 2024 06:02:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E44056B0093; Wed, 28 Aug 2024 06:02:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id BDB046B008C for ; Wed, 28 Aug 2024 06:02:46 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 6C831C1D95 for ; Wed, 28 Aug 2024 10:02:46 +0000 (UTC) X-FDA: 82501215132.16.3065C36 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by imf28.hostedemail.com (Postfix) with ESMTP id 9FED2C0024 for ; Wed, 28 Aug 2024 10:02:43 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=rGqsRbAM; spf=pass (imf28.hostedemail.com: domain of m.szyprowski@samsung.com designates 210.118.77.11 as permitted sender) smtp.mailfrom=m.szyprowski@samsung.com; dmarc=pass (policy=none) header.from=samsung.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724839294; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=jxOYpLlpHtoqPanB1bXfLrsnl/Hdigkcgd5eIcTB9uk=; b=0ttQDNS2wB8tp0tdNyabN9WGXzSDYPLr0St9cKfGPWIWeQofM9rxYxy+e6motmjEteDako j9bCqgYJ0ADbsuxO8o3fLiwjR/x+0qmt0MQ1Ed/umAinoYJv5CP8XxFjltKEjIl7p05vpL mf/4EOKn98jeS3fhd4Ic1yXJR2TGGoA= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=rGqsRbAM; spf=pass (imf28.hostedemail.com: domain of m.szyprowski@samsung.com designates 210.118.77.11 as permitted sender) smtp.mailfrom=m.szyprowski@samsung.com; dmarc=pass (policy=none) header.from=samsung.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724839294; a=rsa-sha256; cv=none; b=OcQKDM5jc5bmyxjt+o7laaXB7zwDMT/fyCwf1sUAzE9gauDOjAGGZ9T16XOSrw/w6SPA2L 7Z04nRIl3V9r+s4teYgolvNCRy8Hxc6yUJOaoYqs3h4pIrCGf2FxhWcdzM1Xrn/RAk5b+X jwl8jjhh7sqEtuADpEFIj/d3p9wyk04= Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20240828100240euoutp013bfb843de92a665377e9d0da3f1dfc6a~v3EKcmw2Y0251902519euoutp01H for ; Wed, 28 Aug 2024 10:02:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20240828100240euoutp013bfb843de92a665377e9d0da3f1dfc6a~v3EKcmw2Y0251902519euoutp01H DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1724839361; bh=jxOYpLlpHtoqPanB1bXfLrsnl/Hdigkcgd5eIcTB9uk=; h=Date:Subject:To:Cc:From:In-Reply-To:References:From; b=rGqsRbAM7lisA7vhQ+TbBuiBbyIB0vtnlXpbsNdqoJjN+XaYXUcfM5wM1srfaImvi ZmEdb/V/DusMnO4kginlwcTJUDJ4auzDIEdw1CwuT3CAsidV1YP8DrB3h0m8xMTqFc 0nrIed8juDLamnNGnrQhGX0MvxdRjPV0dDbeaWTk= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20240828100240eucas1p1c6fd26d45b966c026319f660ea11ef79~v3EKF9D2z3233832338eucas1p1d; Wed, 28 Aug 2024 10:02:40 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id FA.39.09624.0C5FEC66; Wed, 28 Aug 2024 11:02:40 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20240828100239eucas1p2afc0d3088c66468061baf81c5676882a~v3EJiUdmT2575325753eucas1p2n; Wed, 28 Aug 2024 10:02:39 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20240828100239eusmtrp12197c5e18ae88c568b560c2807b4f984~v3EJhwLjW0290402904eusmtrp1k; Wed, 28 Aug 2024 10:02:39 +0000 (GMT) X-AuditID: cbfec7f2-c11ff70000002598-8c-66cef5c09732 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 88.E4.08810.FB5FEC66; Wed, 28 Aug 2024 11:02:39 +0100 (BST) Received: from [106.210.134.192] (unknown [106.210.134.192]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20240828100239eusmtip23fa78ebad18e90509ddcc4d30b670050~v3EI3nevQ0491504915eusmtip2D; Wed, 28 Aug 2024 10:02:39 +0000 (GMT) Message-ID: <8303f283-d60a-4840-aff2-b486d6a9774f@samsung.com> Date: Wed, 28 Aug 2024 12:02:38 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/5] regmap: Hold the regmap lock when allocating and freeing the cache To: Mark Brown , "Liam R. Howlett" Cc: Cristian Ciocaltea , maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Language: en-US From: Marek Szyprowski In-Reply-To: <20240822-b4-regmap-maple-nolock-v1-2-d5e6dbae3396@kernel.org> Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNKsWRmVeSWpSXmKPExsWy7djP87oHvp5LM+i8LmYx9eETNotvh84w WmxveMBucXnXHDaLe2v+s1psWNnA5MDmsePuEkaPTas62Tw2fZrE7rF5Sb3Hx6e3WDw+b5IL YIvisklJzcksSy3St0vgyphxawNbwdJ2xoreTWtYGhh7K7sYOTkkBEwknhy/yd7FyMUhJLCC UeLBkiUsIAkhgS+MEveOSUAkPjNK/H29ihGm4+zcm2wQieWMEssmPGWD6PjIKHFpHieIzStg J9F27TPQWA4OFgFViaM/zCHCghInZz4BWyAqIC9x/9YMdhBbWCBWonf7T1YQW0QgSOLklhlM IDazQD+jxNOOYghbXOLWk/lgcTYBQ4mut11gazkFvCX6Tk5hg6iRl2jeOpsZ4s47HBL39utA 2C4SVybPZIGwhSVeHd/CDmHLSJye3MMC8ouEQDujxILf95kgnAmMEg3Pb0F9bC1x59wvNpBn mAU0Jdbv0ocIO0psv3oMLCwhwCdx460gxA18EpO2TWeGCPNKdLQJQVSrScw6vg5u7cELl5gn MCrNQgqVWUi+nIXkm1kIexcwsqxiFE8tLc5NTy02zEst1ytOzC0uzUvXS87P3cQITD+n/x3/ tINx7quPeocYmTgYDzFKcDArifCeOH42TYg3JbGyKrUoP76oNCe1+BCjNAeLkjivaop8qpBA emJJanZqakFqEUyWiYNTqoHJYG8vz8prBzJ+BXryxey/dfvW1Qeit0vd9ZIMNp8xmCyxp2lb 23OJs30fl+iefmD47eolj2LBqCu7nwg4bRHY7L/A/uqKfvXb0lIhyz9feBxz2LNPtZpX6ao9 x/ONRq9uZavMCL2lfnmZ/LtUiZRJ+w94i5zkOf/i7dIa6zX6BoH3o5gjD3hb2snve7ejL/h/ +/rzf+X6P6UtUBD6GfZ94u99FZwvU1IOHtE1nWB1Z2/B+a41do2We9e9F/d5WT/3zfxFcgVR j6dO0Z6Yza4QJbL1iblj2OMcwfexFSdCUwpLP+9UtrncMG/d7u7be3wEC7lW54kG2Bs9L12w 5cjf3u7kkxVu66bPLze43PfbUYmlOCPRUIu5qDgRAGNGVzSuAwAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIIsWRmVeSWpSXmKPExsVy+t/xe7r7v55LM/jQqGMx9eETNotvh84w WmxveMBucXnXHDaLe2v+s1psWNnA5MDmsePuEkaPTas62Tw2fZrE7rF5Sb3Hx6e3WDw+b5IL YIvSsynKLy1JVcjILy6xVYo2tDDSM7S00DMysdQzNDaPtTIyVdK3s0lJzcksSy3St0vQy5hx awNbwdJ2xoreTWtYGhh7K7sYOTkkBEwkzs69ydbFyMUhJLCUUeLFsVnMEAkZiZPTGlghbGGJ P9e6oIreM0pM2LCEHSTBK2An0XbtM5DNwcEioCpx9Ic5RFhQ4uTMJywgtqiAvMT9WzPAyoUF YiV6t/8EmykiECRx/NszsJnMAv2MEh17vrFDLOhmlJh2bxnYFcwC4hK3nsxnArHZBAwlut6C XMHJwSngLdF3cgobRI2ZRNfWLkYIW16ieets5gmMQrOQHDILyahZSFpmIWlZwMiyilEktbQ4 Nz232FCvODG3uDQvXS85P3cTIzDuth37uXkH47xXH/UOMTJxMB5ilOBgVhLhPXH8bJoQb0pi ZVVqUX58UWlOavEhRlNgYExklhJNzgdGfl5JvKGZgamhiZmlgamlmbGSOK9nQUeikEB6Yklq dmpqQWoRTB8TB6dUA9OMsnUeYqJNDaoTvJYn3D3t57pMwlKjfuH2vrbT97f5OFzcstrP/4/t o+B7mn7Ne29mvIqbHp8nvUt79n11LT/Duk8th6tSW8ojIzZm1Djm1K0oSBdwv5PwgMv90qFT Dtf9hFY8U0orM1/lFRMkdCj3kl/B/eDsKecs9++cnxjm/GOO8d9viYlR5jdKe3g1HuvoG+71 7n2YKxRmfSFcLD11ifiO5zsrfq9J/dNb1FGbm+zZkv78kfaDLuZncgr79XaJBZxffWyW0aIM jjvyFrqClSfa+CsvPb7t8e3bqmxXxgM2nTIuqTULlN/UfH604OXeW99n3VkZsu/D5n32+v4P whZ+nsvFm5G5/c+MbCWW4oxEQy3mouJEAAD2JA9EAwAA X-CMS-MailID: 20240828100239eucas1p2afc0d3088c66468061baf81c5676882a X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20240828100239eucas1p2afc0d3088c66468061baf81c5676882a X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20240828100239eucas1p2afc0d3088c66468061baf81c5676882a References: <20240822-b4-regmap-maple-nolock-v1-0-d5e6dbae3396@kernel.org> <20240822-b4-regmap-maple-nolock-v1-2-d5e6dbae3396@kernel.org> X-Stat-Signature: o97xjxng33rnzhmqaec9fpwsr5y7jjqf X-Rspam-User: X-Rspamd-Queue-Id: 9FED2C0024 X-Rspamd-Server: rspam02 X-HE-Tag: 1724839363-111586 X-HE-Meta: U2FsdGVkX1+ggr1MDhtuBXDKbrFhtzPDZFqBlM2NHDi09G8pIlDThb2SIrcNea71bwM4vrL18ha3LeU/tskd9cX7qkfO6hb/CbFQc2YDv18UpvdwDfygxZr8+BzwIb1habRHUO2y5tyxKUX6WfDpmeTGkTREnQLAcotfj/6sCBHLJxkXxXLRnSfQomwQeJOFTdx08yFHWbBh16wxFLJ5FX04Pk3oS6+dYe2gUDKP9Qow5fqEfUwcAHs3CqP5gwTMJ9mX27j0M+Ei//8wTutaLLMRMWhMDFa7J5OJpv0+MSPUoyWncbKX2qfEO+HwMgLHtccYXYrC+SxZAxbtKS+LqJY1ESYGlYx/4dA7T/Ep+1/JNO2EDzc+5N/nxhphUMV5XZGBSYdfMwKh0Pq9W6TF1A8azV94QAB0dK/k+J0eqFkWREJjzAs/hctTgGpHwojSDZGXwkHRw2GUlNNTF3GyrVVZ5fdZph+FzwvgIEpA4sd0yk07rPgvOzOE2j05YrjRJhlY1ewC4daypCs2XLT0FQao9PgyriwJ+XKAeF0dprzFjcHWNn4LotDKFCot/6phZCn+DrbD8LKaaKjPjWS6szbVoSHVSbvZV8tDzaQ3g+R8SfiJEV7BHBriLmtHnzShJFfdUkvRi3hG10+VkRQt1N87ktNlXV2fD7uax+gKBjMk2ElwMOxNORGqp8RbmgGoPLNbQ5NbgFFFriqgj0OJa2VN9cnwQukNsA7AEmjLZiAezkgWRvqDF0cw3gS4lwXVKcd3Pp7r1/85m5aGPCLHjuBtfbfxZEabB/zEoUoEoRbyGF4NKPtli8Y3TEX6nrRz9kcWmfWDecfwFlxDQ0RgyULTdAf+fING7k6wb78ggffvWJK/ieFHRCl4/f5clwjvgPxzWz/go4VWzwKfAWbHE5OAADFgvnsR9ES5/HBM7N0HQsGEsVEQcCuCNwxew1v4Jye4BnbvV/vk+ufuOMn tQLaqEWc Cvbo+eybF9J2WrxF0wLL7HUTQpD8xTXsMudiGjH6q6v9n18Za0HzvcFAwzCmS4Ae/cCqdjpAK5BPrmV+RHdUDhuqI8M/f2zI+4q+9SqQbYGRBuMyhKxe0uyzHZMuV3Om1krsa X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Dear Mark, On 22.08.2024 21:13, Mark Brown wrote: > For the benefit of the maple tree's lockdep checking hold the lock while > creating and exiting the cache. > > Signed-off-by: Mark Brown This patch landed recently in linux-next as commit fd4ebc07b4df ("regmap: Hold the regmap lock when allocating and freeing the cache"). In my tests I found that it triggers the following warnings on Rockchip3568 based Odroid-M1 board: BUG: sleeping function called from invalid context at include/linux/sched/mm.h:337 in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 157, name: systemd-udevd preempt_count: 1, expected: 0 RCU nest depth: 0, expected: 0 2 locks held by systemd-udevd/157:  #0: ffff0001f0cf30f8 (&dev->mutex){....}-{3:3}, at: __driver_attach+0x90/0x1ac  #1: ffff0001f1196818 (rockchip_i2s_tdm:1300:(&rockchip_i2s_tdm_regmap_config)->lock){....}-{2:2}, at: regmap_lock_spinlock+0x18/0x2c irq event stamp: 11474 hardirqs last  enabled at (11473): [] _raw_spin_unlock_irqrestore+0x74/0x78 hardirqs last disabled at (11474): [] _raw_spin_lock_irqsave+0x84/0x88 softirqs last  enabled at (9730): [] handle_softirqs+0x4cc/0x4e4 softirqs last disabled at (9721): [] __do_softirq+0x14/0x20 CPU: 3 UID: 0 PID: 157 Comm: systemd-udevd Not tainted 6.11.0-rc3+ #15305 Hardware name: Hardkernel ODROID-M1 (DT) Call trace:  dump_backtrace+0x94/0xec  show_stack+0x18/0x24  dump_stack_lvl+0x90/0xd0  dump_stack+0x18/0x24  __might_resched+0x144/0x248  __might_sleep+0x48/0x98  __kmalloc_noprof+0x208/0x328  regcache_flat_init+0x40/0xb0  regcache_init+0x1ec/0x490  __regmap_init+0x8e0/0xd50  __devm_regmap_init+0x78/0xc8  __devm_regmap_init_mmio_clk+0x9c/0xc4  rockchip_i2s_tdm_probe+0x318/0x754 [snd_soc_rockchip_i2s_tdm]  platform_probe+0x68/0xdc  really_probe+0xbc/0x298  __driver_probe_device+0x78/0x12c  driver_probe_device+0x40/0x164  __driver_attach+0x9c/0x1ac  bus_for_each_dev+0x74/0xd4  driver_attach+0x24/0x30  bus_add_driver+0xe4/0x208  driver_register+0x60/0x128  __platform_driver_register+0x28/0x34  rockchip_i2s_tdm_driver_init+0x20/0x1000 [snd_soc_rockchip_i2s_tdm]  do_one_initcall+0x68/0x300  do_init_module+0x60/0x224  load_module+0x1b0c/0x1cb0  init_module_from_file+0x84/0xc4  idempotent_init_module+0x18c/0x284  __arm64_sys_finit_module+0x64/0xa0  invoke_syscall+0x48/0x110  el0_svc_common.constprop.0+0xc8/0xe8  do_el0_svc+0x20/0x2c  el0_svc+0x4c/0x11c  el0t_64_sync_handler+0x13c/0x158  el0t_64_sync+0x190/0x194 and ======================================================== WARNING: possible irq lock inversion dependency detected 6.11.0-rc3+ #15305 Tainted: G        W -------------------------------------------------------- swapper/0/0 just changed the state of lock: ffff0001f2305018 (rockchip_drm_vop2:3114:(&vop2_regmap_config)->lock){-...}-{2:2}, at: regmap_lock_spinlock+0x18/0x2c but this lock took another, HARDIRQ-unsafe lock in the past:  (fs_reclaim){+.+.}-{0:0} and interrupts could create inverse lock ordering between them. other info that might help us debug this:  Possible interrupt unsafe locking scenario:        CPU0                    CPU1        ----                    ----   lock(fs_reclaim);                                local_irq_disable(); lock(rockchip_drm_vop2:3114:(&vop2_regmap_config)->lock);                                lock(fs_reclaim);   lock(rockchip_drm_vop2:3114:(&vop2_regmap_config)->lock);  *** DEADLOCK *** no locks held by swapper/0/0. the shortest dependencies between 2nd lock and 1st lock:  -> (fs_reclaim){+.+.}-{0:0} {     HARDIRQ-ON-W at:                       lock_acquire+0x200/0x340                       fs_reclaim_acquire+0xdc/0xfc                       __kmalloc_cache_noprof+0x54/0x288                       __kthread_create_worker+0x3c/0x150                       kthread_create_worker+0x64/0x8c                       workqueue_init+0x30/0x3c4                       kernel_init_freeable+0x11c/0x50c                       kernel_init+0x20/0x1d8                       ret_from_fork+0x10/0x20     SOFTIRQ-ON-W at:                       lock_acquire+0x200/0x340                       fs_reclaim_acquire+0xdc/0xfc                       __kmalloc_cache_noprof+0x54/0x288                       __kthread_create_worker+0x3c/0x150                       kthread_create_worker+0x64/0x8c                       workqueue_init+0x30/0x3c4                       kernel_init_freeable+0x11c/0x50c                       kernel_init+0x20/0x1d8                       ret_from_fork+0x10/0x20     INITIAL USE at:                      lock_acquire+0x200/0x340                      fs_reclaim_acquire+0xdc/0xfc                      __kmalloc_cache_noprof+0x54/0x288                      __kthread_create_worker+0x3c/0x150                      kthread_create_worker+0x64/0x8c                      workqueue_init+0x30/0x3c4                      kernel_init_freeable+0x11c/0x50c                      kernel_init+0x20/0x1d8                      ret_from_fork+0x10/0x20   }   ... key      at: [] __fs_reclaim_map+0x0/0x28   ... acquired at:    fs_reclaim_acquire+0xdc/0xfc    __kmalloc_cache_noprof+0x54/0x288    regcache_maple_init+0x2c/0x110    regcache_init+0x1ec/0x490    __regmap_init+0x8e0/0xd50    __devm_regmap_init+0x78/0xc8    __devm_regmap_init_mmio_clk+0x9c/0xc4    vop2_bind+0xf4/0xb10 [rockchipdrm]    component_bind_all+0x118/0x24c    rockchip_drm_bind+0xb0/0x1fc [rockchipdrm]    try_to_bring_up_aggregate_device+0x168/0x1d4    component_master_add_with_match+0xb4/0xfc    rockchip_drm_platform_probe+0x154/0x284 [rockchipdrm]    platform_probe+0x68/0xdc    really_probe+0xbc/0x298    __driver_probe_device+0x78/0x12c    driver_probe_device+0x40/0x164    __driver_attach+0x9c/0x1ac    bus_for_each_dev+0x74/0xd4    driver_attach+0x24/0x30    bus_add_driver+0xe4/0x208    driver_register+0x60/0x128    __platform_driver_register+0x28/0x34    dw_hdmi_cec_transmit+0x44/0xc4 [dw_hdmi_cec]    do_one_initcall+0x68/0x300    do_init_module+0x60/0x224    load_module+0x1b0c/0x1cb0    init_module_from_file+0x84/0xc4    idempotent_init_module+0x18c/0x284    __arm64_sys_finit_module+0x64/0xa0    invoke_syscall+0x48/0x110    el0_svc_common.constprop.0+0xc8/0xe8    do_el0_svc+0x20/0x2c    el0_svc+0x4c/0x11c    el0t_64_sync_handler+0x13c/0x158    el0t_64_sync+0x190/0x194 -> (rockchip_drm_vop2:3114:(&vop2_regmap_config)->lock){-...}-{2:2} {    IN-HARDIRQ-W at:                     lock_acquire+0x200/0x340                     _raw_spin_lock_irqsave+0x60/0x88                     regmap_lock_spinlock+0x18/0x2c                     regmap_read+0x3c/0x78                     vop2_isr+0x84/0x2a8 [rockchipdrm]                     __handle_irq_event_percpu+0x9c/0x304                     handle_irq_event+0x4c/0xa8                     handle_fasteoi_irq+0xa4/0x1cc                     generic_handle_domain_irq+0x2c/0x44                     gic_handle_irq+0x4c/0x110                     call_on_irq_stack+0x24/0x4c                     do_interrupt_handler+0x80/0x84                     el1_interrupt+0x34/0x64                     el1h_64_irq_handler+0x18/0x24                     el1h_64_irq+0x64/0x68                     default_idle_call+0xa8/0x1e8                     do_idle+0x220/0x284                     cpu_startup_entry+0x34/0x3c                     rest_init+0xf4/0x184                     start_kernel+0x680/0x78c                     __primary_switched+0x80/0x88    INITIAL USE at:                    lock_acquire+0x200/0x340                    _raw_spin_lock_irqsave+0x60/0x88                    regmap_lock_spinlock+0x18/0x2c                    regcache_init+0x1dc/0x490                    __regmap_init+0x8e0/0xd50                    __devm_regmap_init+0x78/0xc8                    __devm_regmap_init_mmio_clk+0x9c/0xc4                    vop2_bind+0xf4/0xb10 [rockchipdrm]                    component_bind_all+0x118/0x24c                    rockchip_drm_bind+0xb0/0x1fc [rockchipdrm]                    try_to_bring_up_aggregate_device+0x168/0x1d4                    component_master_add_with_match+0xb4/0xfc                    rockchip_drm_platform_probe+0x154/0x284 [rockchipdrm]                    platform_probe+0x68/0xdc                    really_probe+0xbc/0x298                    __driver_probe_device+0x78/0x12c                    driver_probe_device+0x40/0x164                    __driver_attach+0x9c/0x1ac                    bus_for_each_dev+0x74/0xd4                    driver_attach+0x24/0x30                    bus_add_driver+0xe4/0x208                    driver_register+0x60/0x128                    __platform_driver_register+0x28/0x34                    dw_hdmi_cec_transmit+0x44/0xc4 [dw_hdmi_cec]                    do_one_initcall+0x68/0x300                    do_init_module+0x60/0x224                    load_module+0x1b0c/0x1cb0                    init_module_from_file+0x84/0xc4                    idempotent_init_module+0x18c/0x284                    __arm64_sys_finit_module+0x64/0xa0                    invoke_syscall+0x48/0x110                    el0_svc_common.constprop.0+0xc8/0xe8                    do_el0_svc+0x20/0x2c                    el0_svc+0x4c/0x11c                    el0t_64_sync_handler+0x13c/0x158                    el0t_64_sync+0x190/0x194  }  ... key      at: [] _key.6+0x0/0xffffffffffffd5a8 [rockchipdrm]  ... acquired at:    __lock_acquire+0xb10/0x21a0    lock_acquire+0x200/0x340    _raw_spin_lock_irqsave+0x60/0x88    regmap_lock_spinlock+0x18/0x2c    regmap_read+0x3c/0x78    vop2_isr+0x84/0x2a8 [rockchipdrm]    __handle_irq_event_percpu+0x9c/0x304    handle_irq_event+0x4c/0xa8    handle_fasteoi_irq+0xa4/0x1cc    generic_handle_domain_irq+0x2c/0x44    gic_handle_irq+0x4c/0x110    call_on_irq_stack+0x24/0x4c    do_interrupt_handler+0x80/0x84    el1_interrupt+0x34/0x64    el1h_64_irq_handler+0x18/0x24    el1h_64_irq+0x64/0x68    default_idle_call+0xa8/0x1e8    do_idle+0x220/0x284    cpu_startup_entry+0x34/0x3c    rest_init+0xf4/0x184    start_kernel+0x680/0x78c    __primary_switched+0x80/0x88 stack backtrace: CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Tainted: G        W 6.11.0-rc3+ #15305 Tainted: [W]=WARN Hardware name: Hardkernel ODROID-M1 (DT) Call trace:  dump_backtrace+0x94/0xec  show_stack+0x18/0x24  dump_stack_lvl+0x90/0xd0  dump_stack+0x18/0x24  print_irq_inversion_bug.part.0+0x1ec/0x27c  mark_lock+0x63c/0x954  __lock_acquire+0xb10/0x21a0  lock_acquire+0x200/0x340  _raw_spin_lock_irqsave+0x60/0x88  regmap_lock_spinlock+0x18/0x2c  regmap_read+0x3c/0x78  vop2_isr+0x84/0x2a8 [rockchipdrm]  __handle_irq_event_percpu+0x9c/0x304  handle_irq_event+0x4c/0xa8  handle_fasteoi_irq+0xa4/0x1cc  generic_handle_domain_irq+0x2c/0x44  gic_handle_irq+0x4c/0x110  call_on_irq_stack+0x24/0x4c  do_interrupt_handler+0x80/0x84  el1_interrupt+0x34/0x64  el1h_64_irq_handler+0x18/0x24  el1h_64_irq+0x64/0x68  default_idle_call+0xa8/0x1e8  do_idle+0x220/0x284  cpu_startup_entry+0x34/0x3c  rest_init+0xf4/0x184  start_kernel+0x680/0x78c  __primary_switched+0x80/0x88 Console: switching to colour frame buffer device 240x67 rockchip-drm display-subsystem: [drm] fb0: rockchipdrmfb frame buffer device Both issues can be fixed by the following patch, but I'm not sure if this is not an overuse of the GFP_ATOMIC just for the initialization phase: diff --git a/drivers/base/regmap/regcache-flat.c b/drivers/base/regmap/regcache-flat.c index 9b17c77dec9d..8e8cf328bffb 100644 --- a/drivers/base/regmap/regcache-flat.c +++ b/drivers/base/regmap/regcache-flat.c @@ -27,7 +27,8 @@static int regcache_flat_init(struct regmap *map)                return -EINVAL;        map->cache = kcalloc(regcache_flat_get_index(map, map->max_register) -                            + 1, sizeof(unsigned int), GFP_KERNEL); +     + 1, sizeof(unsigned int), +     map->can_sleep ? GFP_KERNEL : GFP_ATOMIC);        if (!map->cache)                return -ENOMEM; diff --git a/drivers/base/regmap/regcache-maple.c b/drivers/base/regmap/regcache-maple.c index 2dea9d259c49..b95130127bdc 100644 --- a/drivers/base/regmap/regcache-maple.c +++ b/drivers/base/regmap/regcache-maple.c @@ -348,7 +348,7 @@static int regcache_maple_init(struct regmap *map)        int ret;        int range_start; -       mt = kmalloc(sizeof(*mt), GFP_KERNEL); +mt = kmalloc(sizeof(*mt), map->can_sleep ? GFP_KERNEL : GFP_ATOMIC);        if (!mt)                return -ENOMEM;        map->cache = mt; diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index 3db88bbcae0f..c53c38a965d5 100644 --- a/drivers/base/regmap/regcache-rbtree.c +++ b/drivers/base/regmap/regcache-rbtree.c @@ -187,7 +187,8 @@static int regcache_rbtree_init(struct regmap *map)        int i;        int ret; -       map->cache = kmalloc(sizeof *rbtree_ctx, GFP_KERNEL); +map->cache = kmalloc(sizeof *rbtree_ctx, +     map->can_sleep ? GFP_KERNEL : GFP_ATOMIC);        if (!map->cache)                return -ENOMEM; Let me know if such approach is fine, then I will submit a proper patch in a few minutes. > --- > drivers/base/regmap/regcache.c | 4 ++++ > drivers/base/regmap/regmap.c | 1 + > 2 files changed, 5 insertions(+) > > diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c > index 7ec1ec605335..d3659ba3cc11 100644 > --- a/drivers/base/regmap/regcache.c > +++ b/drivers/base/regmap/regcache.c > @@ -195,7 +195,9 @@ int regcache_init(struct regmap *map, const struct regmap_config *config) > if (map->cache_ops->init) { > dev_dbg(map->dev, "Initializing %s cache\n", > map->cache_ops->name); > + map->lock(map->lock_arg); > ret = map->cache_ops->init(map); > + map->unlock(map->lock_arg); > if (ret) > goto err_free; > } > @@ -223,7 +225,9 @@ void regcache_exit(struct regmap *map) > if (map->cache_ops->exit) { > dev_dbg(map->dev, "Destroying %s cache\n", > map->cache_ops->name); > + map->lock(map->lock_arg); > map->cache_ops->exit(map); > + map->unlock(map->lock_arg); > } > } > > diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c > index bfc6bc1eb3a4..9ed842d17642 100644 > --- a/drivers/base/regmap/regmap.c > +++ b/drivers/base/regmap/regmap.c > @@ -1445,6 +1445,7 @@ void regmap_exit(struct regmap *map) > struct regmap_async *async; > > regcache_exit(map); > + > regmap_debugfs_exit(map); > regmap_range_exit(map); > if (map->bus && map->bus->free_context) > Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland