From patchwork Thu Aug 22 19:13:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13776844 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 C095BC5320E for ; Sun, 25 Aug 2024 17:21:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 059C08D0006; Sun, 25 Aug 2024 13:21:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F270C8D0002; Sun, 25 Aug 2024 13:21:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DEF648D0006; Sun, 25 Aug 2024 13:21:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id C0DE58D0002 for ; Sun, 25 Aug 2024 13:21:50 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 39F5AC073A for ; Sun, 25 Aug 2024 17:21:50 +0000 (UTC) X-FDA: 82491435180.10.2AD922B Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf13.hostedemail.com (Postfix) with ESMTP id 72AED2000D for ; Sun, 25 Aug 2024 17:21:48 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=a8HEkCZK; spf=pass (imf13.hostedemail.com: domain of broonie@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724606423; 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=orGDuveXyQKqNHpXrAjI40khDlMlKDPWgf1ImloLjs8=; b=nNKmzDpXP32aqFpdGafIDRnRJiLuoISFFI3nfwB6ChwXt+D372WE6G7nwSJ/7AMw4I8CW9 vsIhdRtIhh+GwxQaTVyivhM5+kgRfSR0wUueuIdUF7hjY3fnsFPO2Ge7GCRVBHfp98dHVv EdKXcnIo1CJGj/8woLso3e6m1HRpoHY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724606423; a=rsa-sha256; cv=none; b=BYGbVZTX1FMeyycy7jmnRDr3zxr7xNNrlwKueJxuXZ/NR+shaZSwiS3Gk2hpwl+HJiJ2lr nr/+Yl+l4wxkoDaE/mI7fNY1fe8q1o3s9nIuxLJxxBZV4Hb3LBM/tBc1yLMuJP1rymcif5 BrndnWVaqsCesBv9S8VVSHG27W4++tA= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=a8HEkCZK; spf=pass (imf13.hostedemail.com: domain of broonie@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id E901DA41399; Thu, 22 Aug 2024 19:15:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04B2AC4AF12; Thu, 22 Aug 2024 19:15:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724354143; bh=HqTvO4EXWR9m8S4knK2OhOF8g7vD7aNMIK2A6uNJAO8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=a8HEkCZKnKXnymobpVWtAm4avgezgATDH2uSDC/fqFclh/7AwmwSQiwL/dEuW3oY8 3UtIQ2KUfb7EjB8W/WuyZ1z23awOIEarRePcINmkUSjh0DMtbnxMFpy1mBeAYinWpp 8/NJeni7ZoxLfzbDVs9Dozm4WPgmsIsbhg1DsHRzea6PL3uTgtlsqTYPB/xZskTWOL OOdF7roGhhi2Mf+kQfp0I/ulmuL/rltSGxMaESwTnZYxzPTwohXwqkhi+vpzX0Da3a Hyw9GRXbwqrPQhY8FKARJjylxxTCVWjjzEfyl248uxNq7XROy2463GDs/ORWoPmys2 cHIOQH+EYdfYg== From: Mark Brown Date: Thu, 22 Aug 2024 20:13:36 +0100 Subject: [PATCH 2/5] regmap: Hold the regmap lock when allocating and freeing the cache MIME-Version: 1.0 Message-Id: <20240822-b4-regmap-maple-nolock-v1-2-d5e6dbae3396@kernel.org> References: <20240822-b4-regmap-maple-nolock-v1-0-d5e6dbae3396@kernel.org> In-Reply-To: <20240822-b4-regmap-maple-nolock-v1-0-d5e6dbae3396@kernel.org> To: "Liam R. Howlett" Cc: Cristian Ciocaltea , maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.15-dev-37811 X-Developer-Signature: v=1; a=openpgp-sha256; l=1507; i=broonie@kernel.org; h=from:subject:message-id; bh=HqTvO4EXWR9m8S4knK2OhOF8g7vD7aNMIK2A6uNJAO8=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBmx45W7hwqN8635GlhniM9IzBeNxeV+mEbT9v4O hPc/8CuTsWJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZseOVgAKCRAk1otyXVSH 0EOTB/wNrSyae31JmMwCaXdCreGvDhp2iBzo39oKF/d+fEx6wa5Bi1u3nZhgDhj/tZfP+nEjirv WEJdY7o4yBWI4lu9+lSSF9w8sAfo7cmjmQJFGJYnqhBVBQOLtd57WU+unlf60Aj17RxD5VoO6U4 OvF75iSafkKRm5ADTxMPZMdjtKdtNeIwmxZiC9LvhLl4Bx+taoiodUVyIY0GGOtF7uT4joZQKdo QYdy1bY44VKxvI13LI1MFNh6Z7iMxvD1ATfbRmA/dpjcCRDyb/qicbzJ+pO3moKGSIXhENto0cF 4Mbmi9s3Sk1Kq85eRfgJLbtHlMEVPAIS9QjMOAybBqufyqJM X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 72AED2000D X-Stat-Signature: q6td8qxnqs4qzpjb9tf9ieapqiocfuy3 X-HE-Tag: 1724606508-159914 X-HE-Meta: U2FsdGVkX1/6ubcOqh7y6Yovkc3C447GrWhnahpAsX9LTS1xlew9ISuNweyKZE5TDvojOiUu4oEb9dptyClPwtEWGKG6jmCAEo1hzesbP2okHjLw6pcdQVXfauqIQjY1JabqAUIzZh4CJbOjKzHb010SudCuMiVgNxuvY4Awr71c5zyr5zg2ZIBCWdsqHj2itzLl9vHlypw1voVcY96bvaYqH6+Yk1WAIVDg0/z9NA0Nof2nQOmYR+JVMbmqnnF+SMxC7d2al1Nuicph4WtevDUvcxVZulq3kK064AM8S6B2YnbEBDqGgA8DTA8od+0tyl1yvxisqdvyQjYtVso/AK01uavJr/P3WShIEpUShuK4XQiOWthsXJqVkuNUY+q2WAsn2Xnfa71d0FqEZDgYTC7fPMbwH1lWWlrHD/JPjVrvtbZgE/iKkNSSTqoy6Ns6DLi9Oy5lvTVVGftzdQHAjeD9U95AoZT6F5kC6zSzxYMPuHPCzbrAXXtsBrbL4WSpt+YXkxzPiQFF5+MHdj+F7nDDrBKV7DYCGZ5jqjRzL5xCB385y1rr+UVyPlMdbh8XcxhTW91GzPRsD5IWTB6Loqm83BIc8O+69Wp2wWXZpWYnoNueGBt/yW62/3C6QsPOCRBAMWdatcUv77f3MkZG6fyOJnqLEF2Fcp0SXbQmkOV/fmepIga75lWTNtVPWlOnMCGyKNvHZEEwh29pY3AmEjehBnM0vYurK2AfHkejdYc9SXTZNNpvzrI1XBkN5vSaadoYpNeS0jM95MmdIB427fOtB9ScHw4nIv9ibYAVBzWiXev3iJYqX3Woncgs3sUalei1vsD+jv+of4FRwt2kMyY0X43v2bXlWw+KsYZNwlUYfkA9tupcTzps5OqHitfGRrXpwzRZSna6iWwn9ZN+gN5JFKkyG3dxMjSRgDvBWxm8lgU0TJJmTJFlFoimP/Mt4MUY8fRr3EGILSocKvY Ens1wpG1 uQwZYNQ/sF0XdbPXstPSoXgjbVHSiQL1YuI5uEhwpLz/p125m14DNylDaiiqt8BanvJqAuEURHB6fl+05sAWPqwFH/kNLnwnnAJeV/Kukauy0Qol0UQbCjA/RrOX6i32MQ6SMeV/5+BqRXg1ah9evkHtn1+dWYAwiVueo7C6WPmhJfgw7fGL+AEjbXMA1vZK7hJNG2HHof3e1EBkIwoKxyP/BQ7MVKEhdSC/IF3mJb33vbfGqiEpx7O7N9BSLKhc23XMKmQnnSIPNBHD4AbsOuKRHF8sTgNobKRDL 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: For the benefit of the maple tree's lockdep checking hold the lock while creating and exiting the cache. Signed-off-by: Mark Brown --- 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)