From: Leonard Crestez <leonard.crestez@nxp.com>
To: Stephen Boyd <sboyd@kernel.org>,
Jan Kiszka <jan.kiszka@siemens.com>,
Kieran Bingham <kbingham@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/3] scripts/gdb: Initial clk support: lx-clk-summary
Date: Mon, 22 Apr 2019 08:26:57 +0000 [thread overview]
Message-ID: <ab7b65d29dbd7623c679c4ef91352d594a24f39a.1555921081.git.leonard.crestez@nxp.com> (raw)
In-Reply-To: <cover.1555921081.git.leonard.crestez@nxp.com>
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.
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
---
scripts/gdb/linux/clk.py | 46 ++++++++++++++++++++++++++++++++++++++
scripts/gdb/vmlinux-gdb.py | 1 +
2 files changed, 47 insertions(+)
create mode 100644 scripts/gdb/linux/clk.py
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 @@
+# 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()
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
@@ -32,5 +32,6 @@ else:
import linux.lists
import linux.rbtree
import linux.proc
import linux.constants
import linux.timerlist
+ import linux.clk
--
2.17.1
next prev parent reply other threads:[~2019-04-22 8:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-22 8:26 [PATCH 0/3] scripts/gdb: Initial clk support Leonard Crestez
2019-04-22 8:26 ` [PATCH 1/3] scripts/gdb: Add hlist utilities Leonard Crestez
2019-04-22 20:41 ` Stephen Boyd
2019-04-23 9:20 ` Leonard Crestez
2019-04-22 8:26 ` Leonard Crestez [this message]
2019-04-22 20:22 ` [PATCH 2/3] scripts/gdb: Initial clk support: lx-clk-summary Stephen Boyd
2019-04-22 8:26 ` [PATCH 3/3] scripts/gdb: Add $lx_clk_core_lookup function Leonard Crestez
[not found] ` <155596430227.15276.13435242792506854365@swboyd.mtv.corp.google.com>
2019-04-23 11:12 ` Leonard Crestez
2019-04-23 18:16 ` Stephen Boyd
2019-04-22 20:40 ` [PATCH 0/3] scripts/gdb: Initial clk support Stephen Boyd
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=ab7b65d29dbd7623c679c4ef91352d594a24f39a.1555921081.git.leonard.crestez@nxp.com \
--to=leonard.crestez@nxp.com \
--cc=akpm@linux-foundation.org \
--cc=jan.kiszka@siemens.com \
--cc=kbingham@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sboyd@kernel.org \
/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 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.