lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 3 May 2019 11:19:32 +0000
From:   Leonard Crestez <leonard.crestez@....com>
To:     Stephen Boyd <sboyd@...nel.org>,
        Kieran Bingham <kbingham@...nel.org>,
        Jan Kiszka <jan.kiszka@...mens.com>
CC:     Andrew Morton <akpm@...ux-foundation.org>,
        Michael Turquette <mturquette@...libre.com>,
        "linux-clk@...r.kernel.org" <linux-clk@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH 2/2] scripts/gdb: Print cached rate in lx-clk-summary

The clk rate is always stored in clk_core but might be out of date and
require calls to update from hardware.

Deal with that case by printing a (c) suffix.

Signed-off-by: Leonard Crestez <leonard.crestez@....com>

---
 scripts/gdb/linux/clk.py          | 21 ++++++++++++++-------
 scripts/gdb/linux/constants.py.in |  4 ++++
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/scripts/gdb/linux/clk.py b/scripts/gdb/linux/clk.py
index 6bf71976b55d..061aecfa294e 100644
--- a/scripts/gdb/linux/clk.py
+++ b/scripts/gdb/linux/clk.py
@@ -3,42 +3,49 @@
 # Copyright (c) NXP 2019
 
 import gdb
 import sys
 
-from linux import utils, lists
+from linux import utils, lists, constants
 
 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."""
+    """Print clk tree summary
+
+Output is a subset of /sys/kernel/debug/clk/clk_summary
+
+No calls are made during printing, instead a (c) if printed after values which
+are cached and potentially out of date"""
 
     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" % (
+        gdb.write("%*s%-*s %7d %8d %8d %11lu%s\n" % (
                 level * 3 + 1, "",
                 30 - level * 3,
                 clk['name'].string(),
                 clk['enable_count'],
                 clk['prepare_count'],
-                clk['protect_count']))
+                clk['protect_count'],
+                clk['rate'],
+                '(c)' if clk['flags'] & constants.LX_CLK_GET_RATE_NOCACHE else '   '))
 
         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")
+        gdb.write("                                 enable  prepare  protect               \n")
+        gdb.write("   clock                          count    count    count        rate   \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)
 
diff --git a/scripts/gdb/linux/constants.py.in b/scripts/gdb/linux/constants.py.in
index 76f46f427b96..1d73083da6cb 100644
--- a/scripts/gdb/linux/constants.py.in
+++ b/scripts/gdb/linux/constants.py.in
@@ -10,10 +10,11 @@
  *
  * This work is licensed under the terms of the GNU GPL version 2.
  *
  */
 
+#include <linux/clk-provider.h>
 #include <linux/fs.h>
 #include <linux/hrtimer.h>
 #include <linux/mount.h>
 #include <linux/of_fdt.h>
 #include <linux/threads.h>
@@ -36,10 +37,13 @@
 /* The build system will take care of deleting everything above this marker */
 <!-- end-c-headers -->
 
 import gdb
 
+/* linux/clk-provider.h */
+LX_GDBPARSED(CLK_GET_RATE_NOCACHE)
+
 /* linux/fs.h */
 LX_VALUE(SB_RDONLY)
 LX_VALUE(SB_SYNCHRONOUS)
 LX_VALUE(SB_MANDLOCK)
 LX_VALUE(SB_DIRSYNC)
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ