diff options
author | Leonard Crestez <leonard.crestez@nxp.com> | 2019-05-14 18:46:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-14 22:52:52 -0400 |
commit | d1e9710b63d87209e1a14d6e6d8cf1431d8daa31 (patch) | |
tree | bb0dee8f2c372b871cf590f8b4441fbd0f8252b4 /scripts | |
parent | 47d0d12855c9eee9dac72d2359f2ccfac3f7f501 (diff) |
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@nxp.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Kieran Bingham <kbingham@kernel.org>
Cc: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/gdb/linux/clk.py | 46 | ||||
-rw-r--r-- | scripts/gdb/vmlinux-gdb.py | 1 |
2 files changed, 47 insertions, 0 deletions
diff --git a/scripts/gdb/linux/clk.py b/scripts/gdb/linux/clk.py new file mode 100644 index 000000000000..a9129d865c5d --- /dev/null +++ b/scripts/gdb/linux/clk.py | |||
@@ -0,0 +1,46 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
2 | # | ||
3 | # Copyright (c) NXP 2019 | ||
4 | |||
5 | import gdb | ||
6 | import sys | ||
7 | |||
8 | from linux import utils, lists | ||
9 | |||
10 | clk_core_type = utils.CachedType("struct clk_core") | ||
11 | |||
12 | |||
13 | def clk_core_for_each_child(hlist_head): | ||
14 | return lists.hlist_for_each_entry(hlist_head, | ||
15 | clk_core_type.get_type().pointer(), "child_node") | ||
16 | |||
17 | |||
18 | class LxClkSummary(gdb.Command): | ||
19 | """Print Linux kernel log buffer.""" | ||
20 | |||
21 | def __init__(self): | ||
22 | super(LxClkSummary, self).__init__("lx-clk-summary", gdb.COMMAND_DATA) | ||
23 | |||
24 | def show_subtree(self, clk, level): | ||
25 | gdb.write("%*s%-*s %7d %8d %8d\n" % ( | ||
26 | level * 3 + 1, "", | ||
27 | 30 - level * 3, | ||
28 | clk['name'].string(), | ||
29 | clk['enable_count'], | ||
30 | clk['prepare_count'], | ||
31 | clk['protect_count'])) | ||
32 | |||
33 | for child in clk_core_for_each_child(clk['children']): | ||
34 | self.show_subtree(child, level + 1) | ||
35 | |||
36 | def invoke(self, arg, from_tty): | ||
37 | gdb.write(" enable prepare protect\n") | ||
38 | gdb.write(" clock count count count\n") | ||
39 | gdb.write("---------------------------------------------------------\n") | ||
40 | for clk in clk_core_for_each_child(gdb.parse_and_eval("clk_root_list")): | ||
41 | self.show_subtree(clk, 0) | ||
42 | for clk in clk_core_for_each_child(gdb.parse_and_eval("clk_orphan_list")): | ||
43 | self.show_subtree(clk, 0) | ||
44 | |||
45 | |||
46 | LxClkSummary() | ||
diff --git a/scripts/gdb/vmlinux-gdb.py b/scripts/gdb/vmlinux-gdb.py index 033578cc4cd7..eff5a48ac026 100644 --- a/scripts/gdb/vmlinux-gdb.py +++ b/scripts/gdb/vmlinux-gdb.py | |||
@@ -34,3 +34,4 @@ else: | |||
34 | import linux.proc | 34 | import linux.proc |
35 | import linux.constants | 35 | import linux.constants |
36 | import linux.timerlist | 36 | import linux.timerlist |
37 | import linux.clk | ||