Patch "clk: Get runtime PM before walking tree for clk_summary" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    clk: Get runtime PM before walking tree for clk_summary

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     clk-get-runtime-pm-before-walking-tree-for-clk_summa.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c2f38933731c51398a79dce6bd19909bc73483c3
Author: Stephen Boyd <sboyd@xxxxxxxxxx>
Date:   Mon Mar 25 11:41:59 2024 -0700

    clk: Get runtime PM before walking tree for clk_summary
    
    [ Upstream commit 9d1e795f754db1ac3344528b7af0b17b8146f321 ]
    
    Similar to the previous commit, we should make sure that all devices are
    runtime resumed before printing the clk_summary through debugfs. Failure
    to do so would result in a deadlock if the thread is resuming a device
    to print clk state and that device is also runtime resuming in another
    thread, e.g the screen is turning on and the display driver is starting
    up. We remove the calls to clk_pm_runtime_{get,put}() in this path
    because they're superfluous now that we know the devices are runtime
    resumed. This also squashes a bug where the return value of
    clk_pm_runtime_get() wasn't checked, leading to an RPM count underflow
    on error paths.
    
    Fixes: 1bb294a7981c ("clk: Enable/Disable runtime PM for clk_summary")
    Cc: Taniya Das <quic_tdas@xxxxxxxxxxx>
    Cc: Douglas Anderson <dianders@xxxxxxxxxxxx>
    Signed-off-by: Stephen Boyd <sboyd@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240325184204.745706-6-sboyd@xxxxxxxxxx
    Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index ded4a51323d2e..fe1d45eac837c 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -3247,9 +3247,7 @@ static void clk_summary_show_subtree(struct seq_file *s, struct clk_core *c,
 {
 	struct clk_core *child;
 
-	clk_pm_runtime_get(c);
 	clk_summary_show_one(s, c, level);
-	clk_pm_runtime_put(c);
 
 	hlist_for_each_entry(child, &c->children, child_node)
 		clk_summary_show_subtree(s, child, level + 1);
@@ -3259,11 +3257,15 @@ static int clk_summary_show(struct seq_file *s, void *data)
 {
 	struct clk_core *c;
 	struct hlist_head **lists = s->private;
+	int ret;
 
 	seq_puts(s, "                                 enable  prepare  protect                                duty  hardware                            connection\n");
 	seq_puts(s, "   clock                          count    count    count        rate   accuracy phase  cycle    enable   consumer                         id\n");
 	seq_puts(s, "---------------------------------------------------------------------------------------------------------------------------------------------\n");
 
+	ret = clk_pm_runtime_get_all();
+	if (ret)
+		return ret;
 
 	clk_prepare_lock();
 
@@ -3272,6 +3274,7 @@ static int clk_summary_show(struct seq_file *s, void *data)
 			clk_summary_show_subtree(s, c, 0);
 
 	clk_prepare_unlock();
+	clk_pm_runtime_put_all();
 
 	return 0;
 }
@@ -3319,8 +3322,14 @@ static int clk_dump_show(struct seq_file *s, void *data)
 	struct clk_core *c;
 	bool first_node = true;
 	struct hlist_head **lists = s->private;
+	int ret;
+
+	ret = clk_pm_runtime_get_all();
+	if (ret)
+		return ret;
 
 	seq_putc(s, '{');
+
 	clk_prepare_lock();
 
 	for (; *lists; lists++) {
@@ -3333,6 +3342,7 @@ static int clk_dump_show(struct seq_file *s, void *data)
 	}
 
 	clk_prepare_unlock();
+	clk_pm_runtime_put_all();
 
 	seq_puts(s, "}\n");
 	return 0;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux