The patch titled Subject: scripts/gdb: initial clk support: lx-clk-summary has been added to the -mm tree. Its filename is scripts-gdb-initial-clk-support-lx-clk-summary.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/scripts-gdb-initial-clk-support-lx-clk-summary.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/scripts-gdb-initial-clk-support-lx-clk-summary.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Leonard Crestez <leonard.crestez@xxxxxxx> Subject: scripts/gdb: initial clk support: lx-clk-summary Add an lx-clk-summary command which prints a subset of /sys/kernel/debug/clk/clk_summary. This can be used to examine hangs caused by clk not being enabled. Link: http://lkml.kernel.org/r/Message-ID: Signed-off-by: Leonard Crestez <leonard.crestez@xxxxxxx> Cc: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> Cc: Jason Wessel <jason.wessel@xxxxxxxxxxxxx> Cc: Kieran Bingham <kbingham@xxxxxxxxxx> Cc: Stephen Boyd <swboyd@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- scripts/gdb/linux/clk.py | 46 +++++++++++++++++++++++++++++++++++ scripts/gdb/vmlinux-gdb.py | 1 2 files changed, 47 insertions(+) --- /dev/null +++ a/scripts/gdb/linux/clk.py @@ -0,0 +1,46 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) NXP 2019 + +import gdb +import sys + +from linux import utils, lists + +clk_core_type = utils.CachedType("struct clk_core") + + +def clk_core_for_each_child(hlist_head): + return lists.hlist_for_each_entry(hlist_head, + clk_core_type.get_type().pointer(), "child_node") + + +class LxClkSummary(gdb.Command): + """Print Linux kernel log buffer.""" + + def __init__(self): + super(LxClkSummary, self).__init__("lx-clk-summary", gdb.COMMAND_DATA) + + def show_subtree(self, clk, level): + gdb.write("%*s%-*s %7d %8d %8d\n" % ( + level * 3 + 1, "", + 30 - level * 3, + clk['name'].string(), + clk['enable_count'], + clk['prepare_count'], + clk['protect_count'])) + + for child in clk_core_for_each_child(clk['children']): + self.show_subtree(child, level + 1) + + def invoke(self, arg, from_tty): + gdb.write(" enable prepare protect\n") + gdb.write(" clock count count count\n") + gdb.write("---------------------------------------------------------\n") + for clk in clk_core_for_each_child(gdb.parse_and_eval("clk_root_list")): + self.show_subtree(clk, 0) + for clk in clk_core_for_each_child(gdb.parse_and_eval("clk_orphan_list")): + self.show_subtree(clk, 0) + + +LxClkSummary() --- a/scripts/gdb/vmlinux-gdb.py~scripts-gdb-initial-clk-support-lx-clk-summary +++ a/scripts/gdb/vmlinux-gdb.py @@ -34,3 +34,4 @@ else: import linux.proc import linux.constants import linux.timerlist + import linux.clk _ Patches currently in -mm which might be from leonard.crestez@xxxxxxx are scripts-gdb-add-hlist-utilities.patch scripts-gdb-initial-clk-support-lx-clk-summary.patch scripts-gdb-add-lx_clk_core_lookup-function.patch