diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-14 23:08:51 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-14 23:08:51 -0400 |
| commit | 1064d857738187c764c0bd76040f424397f857c7 (patch) | |
| tree | 13d16c0aed50b64c20b8fe235b15172f3c997f15 /scripts/gdb/linux/clk.py | |
| parent | 35c99ffa20edd3c24be352d28a63cd3a23121282 (diff) | |
| parent | def0fdae813dbbbbb588bfc5f52856be2e842b35 (diff) | |
Merge branch 'akpm' (patches from Andrew)
Merge more updates from Andrew Morton:
- a couple of hotfixes
- almost all of the rest of MM
- lib/ updates
- binfmt_elf updates
- autofs updates
- quite a lot of misc fixes and updates
- reiserfs, fatfs
- signals
- exec
- cpumask
- rapidio
- sysctl
- pids
- eventfd
- gcov
- panic
- pps
- gdb script updates
- ipc updates
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (126 commits)
mm: memcontrol: fix NUMA round-robin reclaim at intermediate level
mm: memcontrol: fix recursive statistics correctness & scalabilty
mm: memcontrol: move stat/event counting functions out-of-line
mm: memcontrol: make cgroup stats and events query API explicitly local
drivers/virt/fsl_hypervisor.c: prevent integer overflow in ioctl
drivers/virt/fsl_hypervisor.c: dereferencing error pointers in ioctl
mm, memcg: rename ambiguously named memory.stat counters and functions
arch: remove <asm/sizes.h> and <asm-generic/sizes.h>
treewide: replace #include <asm/sizes.h> with #include <linux/sizes.h>
fs/block_dev.c: Remove duplicate header
fs/cachefiles/namei.c: remove duplicate header
include/linux/sched/signal.h: replace `tsk' with `task'
fs/coda/psdev.c: remove duplicate header
ipc: do cyclic id allocation for the ipc object.
ipc: conserve sequence numbers in ipcmni_extend mode
ipc: allow boot time extension of IPCMNI from 32k to 16M
ipc/mqueue: optimize msg_get()
ipc/mqueue: remove redundant wq task assignment
ipc: prevent lockup on alloc_msg and free_msg
scripts/gdb: print cached rate in lx-clk-summary
...
Diffstat (limited to 'scripts/gdb/linux/clk.py')
| -rw-r--r-- | scripts/gdb/linux/clk.py | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/scripts/gdb/linux/clk.py b/scripts/gdb/linux/clk.py new file mode 100644 index 000000000000..061aecfa294e --- /dev/null +++ b/scripts/gdb/linux/clk.py | |||
| @@ -0,0 +1,76 @@ | |||
| 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, constants | ||
| 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 clk tree summary | ||
| 20 | |||
| 21 | Output is a subset of /sys/kernel/debug/clk/clk_summary | ||
| 22 | |||
| 23 | No calls are made during printing, instead a (c) if printed after values which | ||
| 24 | are cached and potentially out of date""" | ||
| 25 | |||
| 26 | def __init__(self): | ||
| 27 | super(LxClkSummary, self).__init__("lx-clk-summary", gdb.COMMAND_DATA) | ||
| 28 | |||
| 29 | def show_subtree(self, clk, level): | ||
| 30 | gdb.write("%*s%-*s %7d %8d %8d %11lu%s\n" % ( | ||
| 31 | level * 3 + 1, "", | ||
| 32 | 30 - level * 3, | ||
| 33 | clk['name'].string(), | ||
| 34 | clk['enable_count'], | ||
| 35 | clk['prepare_count'], | ||
| 36 | clk['protect_count'], | ||
| 37 | clk['rate'], | ||
| 38 | '(c)' if clk['flags'] & constants.LX_CLK_GET_RATE_NOCACHE else ' ')) | ||
| 39 | |||
| 40 | for child in clk_core_for_each_child(clk['children']): | ||
| 41 | self.show_subtree(child, level + 1) | ||
| 42 | |||
| 43 | def invoke(self, arg, from_tty): | ||
| 44 | gdb.write(" enable prepare protect \n") | ||
| 45 | gdb.write(" clock count count count rate \n") | ||
| 46 | gdb.write("------------------------------------------------------------------------\n") | ||
| 47 | for clk in clk_core_for_each_child(gdb.parse_and_eval("clk_root_list")): | ||
| 48 | self.show_subtree(clk, 0) | ||
| 49 | for clk in clk_core_for_each_child(gdb.parse_and_eval("clk_orphan_list")): | ||
| 50 | self.show_subtree(clk, 0) | ||
| 51 | |||
| 52 | |||
| 53 | LxClkSummary() | ||
| 54 | |||
| 55 | |||
| 56 | class LxClkCoreLookup(gdb.Function): | ||
| 57 | """Find struct clk_core by name""" | ||
| 58 | |||
| 59 | def __init__(self): | ||
| 60 | super(LxClkCoreLookup, self).__init__("lx_clk_core_lookup") | ||
| 61 | |||
| 62 | def lookup_hlist(self, hlist_head, name): | ||
| 63 | for child in clk_core_for_each_child(hlist_head): | ||
| 64 | if child['name'].string() == name: | ||
| 65 | return child | ||
| 66 | result = self.lookup_hlist(child['children'], name) | ||
| 67 | if result: | ||
| 68 | return result | ||
| 69 | |||
| 70 | def invoke(self, name): | ||
| 71 | name = name.string() | ||
| 72 | return (self.lookup_hlist(gdb.parse_and_eval("clk_root_list"), name) or | ||
| 73 | self.lookup_hlist(gdb.parse_and_eval("clk_orphan_list"), name)) | ||
| 74 | |||
| 75 | |||
| 76 | LxClkCoreLookup() | ||
