* [PATCH] clk: expand clk_ignore_unused mechanism to keep only a few clks on
@ 2021-08-18 16:04 Uwe Kleine-König
2021-08-19 8:05 ` kernel test robot
0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2021-08-18 16:04 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: Jonathan Corbet, linux-doc, linux-kernel, linux-clk, kernel
Allow to pass an integer n that results in only keeping n unused clocks
enabled.
This helps to debug the problem if you only know that clk_ignore_unused
helps but you have no clue yet which clock is the culprit.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Documentation/driver-api/clk.rst | 4 +++-
drivers/clk/clk.c | 33 ++++++++++++++++++++++++--------
2 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/Documentation/driver-api/clk.rst b/Documentation/driver-api/clk.rst
index 3cad45d14187..65ae7c3e2b33 100644
--- a/Documentation/driver-api/clk.rst
+++ b/Documentation/driver-api/clk.rst
@@ -259,7 +259,9 @@ the disabling means that the driver will remain functional while the issues
are sorted out.
To bypass this disabling, include "clk_ignore_unused" in the bootargs to the
-kernel.
+kernel. If you pass "clk_ignore_unused=n" (where n is an integer) the first n
+found clocks are not disabled which can be useful for bisecting over the unused
+clks if you don't know yet which of them is reponsible for your problem.
Locking
=======
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 65508eb89ec9..7189a56bb29f 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1236,6 +1236,8 @@ static void __init clk_unprepare_unused_subtree(struct clk_core *core)
clk_pm_runtime_put(core);
}
+static unsigned clk_unused_keep_on __initdata;
+
static void __init clk_disable_unused_subtree(struct clk_core *core)
{
struct clk_core *child;
@@ -1266,12 +1268,17 @@ static void __init clk_disable_unused_subtree(struct clk_core *core)
* back to .disable
*/
if (clk_core_is_enabled(core)) {
- trace_clk_disable(core);
- if (core->ops->disable_unused)
- core->ops->disable_unused(core->hw);
- else if (core->ops->disable)
- core->ops->disable(core->hw);
- trace_clk_disable_complete(core);
+ if (clk_unused_keep_on) {
+ pr_warn("Keep unused clk \"%s\" on\n", core->name);
+ clk_unused_keep_on -= 1;
+ } else {
+ trace_clk_disable(core);
+ if (core->ops->disable_unused)
+ core->ops->disable_unused(core->hw);
+ else if (core->ops->disable)
+ core->ops->disable(core->hw);
+ trace_clk_disable_complete(core);
+ }
}
unlock_out:
@@ -1283,9 +1290,17 @@ static void __init clk_disable_unused_subtree(struct clk_core *core)
}
static bool clk_ignore_unused __initdata;
-static int __init clk_ignore_unused_setup(char *__unused)
+static int __init clk_ignore_unused_setup(char *keep)
{
- clk_ignore_unused = true;
+ if (*keep == '=') {
+ int ret;
+
+ ret = kstrtouint(keep + 1, 0, &clk_unused_keep_on);
+ if (ret < 0)
+ pr_err("Warning: failed to parse clk_ignore_unused parameter, ignoring");
+ } else {
+ clk_ignore_unused = true;
+ }
return 1;
}
__setup("clk_ignore_unused", clk_ignore_unused_setup);
@@ -1297,6 +1312,8 @@ static int __init clk_disable_unused(void)
if (clk_ignore_unused) {
pr_warn("clk: Not disabling unused clocks\n");
return 0;
+ } else if (clk_ignore_unused) {
+ pr_warn("clk: Not disabling %u unused clocks\n", clk_ignore_unused);
}
clk_prepare_lock();
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: expand clk_ignore_unused mechanism to keep only a few clks on
2021-08-18 16:04 [PATCH] clk: expand clk_ignore_unused mechanism to keep only a few clks on Uwe Kleine-König
@ 2021-08-19 8:05 ` kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-08-19 8:05 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3843 bytes --]
Hi Uwe,
I love your patch! Perhaps something to improve:
[auto build test WARNING on clk/clk-next]
[also build test WARNING on linux/master linus/master v5.14-rc6
next-20210818]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url:
https://github.com/0day-ci/linux/commits/Uwe-Kleine-K-nig/clk-expand-clk_ignore_unused-mechanism-to-keep-only-a-few-clks-on/20210819-000800
base: https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git
clk-next
:::::: branch date: 7 hours ago
:::::: commit date: 7 hours ago
compiler: xtensa-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> drivers/clk/clk.c:1315:12: warning: Expression is always false
because 'else if' condition matches previous condition at line 1312.
[multiCondition]
} else if (clk_ignore_unused) {
^
vim +1315 drivers/clk/clk.c
7ec986efed0208c Dong Aisheng 2016-06-30 1307
564f86d384755e3 Rasmus Villemoes 2019-10-04 1308 static int __init
clk_disable_unused(void)
7ec986efed0208c Dong Aisheng 2016-06-30 1309 {
7ec986efed0208c Dong Aisheng 2016-06-30 1310 struct clk_core *core;
7ec986efed0208c Dong Aisheng 2016-06-30 1311
7ec986efed0208c Dong Aisheng 2016-06-30 @1312 if (clk_ignore_unused) {
7ec986efed0208c Dong Aisheng 2016-06-30 1313 pr_warn("clk: Not
disabling unused clocks\n");
7ec986efed0208c Dong Aisheng 2016-06-30 1314 return 0;
bef2d694904f8db Uwe Kleine-König 2021-08-18 @1315 } else if
(clk_ignore_unused) {
bef2d694904f8db Uwe Kleine-König 2021-08-18 1316 pr_warn("clk: Not
disabling %u unused clocks\n", clk_ignore_unused);
7ec986efed0208c Dong Aisheng 2016-06-30 1317 }
7ec986efed0208c Dong Aisheng 2016-06-30 1318
7ec986efed0208c Dong Aisheng 2016-06-30 1319 clk_prepare_lock();
7ec986efed0208c Dong Aisheng 2016-06-30 1320
7ec986efed0208c Dong Aisheng 2016-06-30 1321
hlist_for_each_entry(core, &clk_root_list, child_node)
7ec986efed0208c Dong Aisheng 2016-06-30 1322
clk_disable_unused_subtree(core);
7ec986efed0208c Dong Aisheng 2016-06-30 1323
7ec986efed0208c Dong Aisheng 2016-06-30 1324
hlist_for_each_entry(core, &clk_orphan_list, child_node)
7ec986efed0208c Dong Aisheng 2016-06-30 1325
clk_disable_unused_subtree(core);
7ec986efed0208c Dong Aisheng 2016-06-30 1326
7ec986efed0208c Dong Aisheng 2016-06-30 1327
hlist_for_each_entry(core, &clk_root_list, child_node)
7ec986efed0208c Dong Aisheng 2016-06-30 1328
clk_unprepare_unused_subtree(core);
7ec986efed0208c Dong Aisheng 2016-06-30 1329
7ec986efed0208c Dong Aisheng 2016-06-30 1330
hlist_for_each_entry(core, &clk_orphan_list, child_node)
7ec986efed0208c Dong Aisheng 2016-06-30 1331
clk_unprepare_unused_subtree(core);
7ec986efed0208c Dong Aisheng 2016-06-30 1332
7ec986efed0208c Dong Aisheng 2016-06-30 1333 clk_prepare_unlock();
7ec986efed0208c Dong Aisheng 2016-06-30 1334
7ec986efed0208c Dong Aisheng 2016-06-30 1335 return 0;
7ec986efed0208c Dong Aisheng 2016-06-30 1336 }
7ec986efed0208c Dong Aisheng 2016-06-30 1337
late_initcall_sync(clk_disable_unused);
7ec986efed0208c Dong Aisheng 2016-06-30 1338
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: expand clk_ignore_unused mechanism to keep only a few clks on
@ 2021-08-18 23:27 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-08-18 23:27 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 4168 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210818160457.320598-1-u.kleine-koenig@pengutronix.de>
References: <20210818160457.320598-1-u.kleine-koenig@pengutronix.de>
TO: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
TO: Michael Turquette <mturquette@baylibre.com>
TO: Stephen Boyd <sboyd@kernel.org>
CC: Jonathan Corbet <corbet@lwn.net>
CC: linux-doc(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org
CC: linux-clk(a)vger.kernel.org
CC: kernel(a)pengutronix.de
Hi "Uwe,
I love your patch! Perhaps something to improve:
[auto build test WARNING on clk/clk-next]
[also build test WARNING on linux/master linus/master v5.14-rc6 next-20210818]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Uwe-Kleine-K-nig/clk-expand-clk_ignore_unused-mechanism-to-keep-only-a-few-clks-on/20210819-000800
base: https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
:::::: branch date: 7 hours ago
:::::: commit date: 7 hours ago
compiler: xtensa-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> drivers/clk/clk.c:1315:12: warning: Expression is always false because 'else if' condition matches previous condition at line 1312. [multiCondition]
} else if (clk_ignore_unused) {
^
vim +1315 drivers/clk/clk.c
7ec986efed0208c Dong Aisheng 2016-06-30 1307
564f86d384755e3 Rasmus Villemoes 2019-10-04 1308 static int __init clk_disable_unused(void)
7ec986efed0208c Dong Aisheng 2016-06-30 1309 {
7ec986efed0208c Dong Aisheng 2016-06-30 1310 struct clk_core *core;
7ec986efed0208c Dong Aisheng 2016-06-30 1311
7ec986efed0208c Dong Aisheng 2016-06-30 @1312 if (clk_ignore_unused) {
7ec986efed0208c Dong Aisheng 2016-06-30 1313 pr_warn("clk: Not disabling unused clocks\n");
7ec986efed0208c Dong Aisheng 2016-06-30 1314 return 0;
bef2d694904f8db Uwe Kleine-König 2021-08-18 @1315 } else if (clk_ignore_unused) {
bef2d694904f8db Uwe Kleine-König 2021-08-18 1316 pr_warn("clk: Not disabling %u unused clocks\n", clk_ignore_unused);
7ec986efed0208c Dong Aisheng 2016-06-30 1317 }
7ec986efed0208c Dong Aisheng 2016-06-30 1318
7ec986efed0208c Dong Aisheng 2016-06-30 1319 clk_prepare_lock();
7ec986efed0208c Dong Aisheng 2016-06-30 1320
7ec986efed0208c Dong Aisheng 2016-06-30 1321 hlist_for_each_entry(core, &clk_root_list, child_node)
7ec986efed0208c Dong Aisheng 2016-06-30 1322 clk_disable_unused_subtree(core);
7ec986efed0208c Dong Aisheng 2016-06-30 1323
7ec986efed0208c Dong Aisheng 2016-06-30 1324 hlist_for_each_entry(core, &clk_orphan_list, child_node)
7ec986efed0208c Dong Aisheng 2016-06-30 1325 clk_disable_unused_subtree(core);
7ec986efed0208c Dong Aisheng 2016-06-30 1326
7ec986efed0208c Dong Aisheng 2016-06-30 1327 hlist_for_each_entry(core, &clk_root_list, child_node)
7ec986efed0208c Dong Aisheng 2016-06-30 1328 clk_unprepare_unused_subtree(core);
7ec986efed0208c Dong Aisheng 2016-06-30 1329
7ec986efed0208c Dong Aisheng 2016-06-30 1330 hlist_for_each_entry(core, &clk_orphan_list, child_node)
7ec986efed0208c Dong Aisheng 2016-06-30 1331 clk_unprepare_unused_subtree(core);
7ec986efed0208c Dong Aisheng 2016-06-30 1332
7ec986efed0208c Dong Aisheng 2016-06-30 1333 clk_prepare_unlock();
7ec986efed0208c Dong Aisheng 2016-06-30 1334
7ec986efed0208c Dong Aisheng 2016-06-30 1335 return 0;
7ec986efed0208c Dong Aisheng 2016-06-30 1336 }
7ec986efed0208c Dong Aisheng 2016-06-30 1337 late_initcall_sync(clk_disable_unused);
7ec986efed0208c Dong Aisheng 2016-06-30 1338
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-19 8:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 16:04 [PATCH] clk: expand clk_ignore_unused mechanism to keep only a few clks on Uwe Kleine-König
2021-08-19 8:05 ` kernel test robot
2021-08-18 23:27 kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.