public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
	patches@lists.linux.dev, linux-arm-msm@vger.kernel.org,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Douglas Anderson <dianders@chromium.org>
Subject: [PATCH 1/5] clk: Remove prepare_lock hold assertion in __clk_release()
Date: Sun, 24 Mar 2024 22:43:58 -0700	[thread overview]
Message-ID: <20240325054403.592298-2-sboyd@kernel.org> (raw)
In-Reply-To: <20240325054403.592298-1-sboyd@kernel.org>

Removing this assertion lets us move the kref_put() call outside the
prepare_lock section. We don't need to hold the prepare_lock here to
free memory and destroy the clk_core structure. We've already unlinked
the clk from the clk tree and by the time the release function runs
nothing holds a reference to the clk_core anymore so anything with the
pointer can't access the memory that's being freed anyway. Way back in
commit 496eadf821c2 ("clk: Use lockdep asserts to find missing hold of
prepare_lock") we didn't need to have this assertion either.

Fixes: 496eadf821c2 ("clk: Use lockdep asserts to find missing hold of prepare_lock")
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
---
 drivers/clk/clk.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 2253c154a824..44e71736477d 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -4353,8 +4353,6 @@ static void __clk_release(struct kref *ref)
 {
 	struct clk_core *core = container_of(ref, struct clk_core, ref);
 
-	lockdep_assert_held(&prepare_lock);
-
 	clk_core_free_parent_map(core);
 	kfree_const(core->name);
 	kfree(core);
-- 
https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/
https://git.kernel.org/pub/scm/linux/kernel/git/sboyd/spmi.git


  reply	other threads:[~2024-03-25  5:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25  5:43 [PATCH 0/5] Fix a deadlock with clk_pm_runtime_get() Stephen Boyd
2024-03-25  5:43 ` Stephen Boyd [this message]
2024-03-25 16:18   ` [PATCH 1/5] clk: Remove prepare_lock hold assertion in __clk_release() Doug Anderson
2024-03-25  5:43 ` [PATCH 2/5] clk: Don't hold prepare_lock when calling kref_put() Stephen Boyd
2024-03-25 16:19   ` Doug Anderson
2024-03-25  5:44 ` [PATCH 3/5] clk: Initialize struct clk_core kref earlier Stephen Boyd
2024-03-25 16:19   ` Doug Anderson
2024-03-25  5:44 ` [PATCH 4/5] clk: Get runtime PM before walking tree during disable_unused Stephen Boyd
2024-03-25 16:19   ` Doug Anderson
2024-03-25 17:06     ` Stephen Boyd
2024-03-25 17:15       ` Doug Anderson
2024-03-25  5:44 ` [PATCH 5/5] clk: Get runtime PM before walking tree for clk_summary Stephen Boyd
2024-03-25 16:19   ` Doug Anderson
2024-03-25 17:09     ` Stephen Boyd
2024-09-13 19:32 ` [PATCH 0/5] Fix a deadlock with clk_pm_runtime_get() Miquel Raynal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240325054403.592298-2-sboyd@kernel.org \
    --to=sboyd@kernel.org \
    --cc=dianders@chromium.org \
    --cc=krzk@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=patches@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox