aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/gdb
diff options
context:
space:
mode:
authorJohn Ogness <john.ogness@linutronix.de>2020-09-21 13:24:45 +0206
committerPetr Mladek <pmladek@suse.com>2020-09-22 11:27:48 +0200
commit74caba7f2a0685575b3ee5330a118f5922485e02 (patch)
treeeb195b5d665b166c8158af3bcdc151d2b84b447f /scripts/gdb
parentprintk: move printk_info into separate array (diff)
downloadlinux-dev-74caba7f2a0685575b3ee5330a118f5922485e02.tar.xz
linux-dev-74caba7f2a0685575b3ee5330a118f5922485e02.zip
printk: move dictionary keys to dev_printk_info
Dictionaries are only used for SUBSYSTEM and DEVICE properties. The current implementation stores the property names each time they are used. This requires more space than otherwise necessary. Also, because the dictionary entries are currently considered optional, it cannot be relied upon that they are always available, even if the writer wanted to store them. These issues will increase should new dictionary properties be introduced. Rather than storing the subsystem and device properties in the dict ring, introduce a struct dev_printk_info with separate fields to store only the property values. Embed this struct within the struct printk_info to provide guaranteed availability. Signed-off-by: John Ogness <john.ogness@linutronix.de> Reviewed-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/87mu1jl6ne.fsf@jogness.linutronix.de
Diffstat (limited to 'scripts/gdb')
-rw-r--r--scripts/gdb/linux/dmesg.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/scripts/gdb/linux/dmesg.py b/scripts/gdb/linux/dmesg.py
index bce14de5f610..a92c55bd8de5 100644
--- a/scripts/gdb/linux/dmesg.py
+++ b/scripts/gdb/linux/dmesg.py
@@ -52,6 +52,12 @@ class LxDmesg(gdb.Command):
addr = utils.read_ulong(desc_ring, off)
descs = utils.read_memoryview(inf, addr, desc_sz * desc_ring_count).tobytes()
+ # read in info array
+ info_sz = printk_info_type.get_type().sizeof
+ off = prb_desc_ring_type.get_type()['infos'].bitpos // 8
+ addr = utils.read_ulong(desc_ring, off)
+ infos = utils.read_memoryview(inf, addr, info_sz * desc_ring_count).tobytes()
+
# read in text data ring structure
off = printk_ringbuffer_type.get_type()['text_data_ring'].bitpos // 8
addr = prb_addr + off
@@ -73,9 +79,8 @@ class LxDmesg(gdb.Command):
begin_off = off + (prb_data_blk_lpos_type.get_type()['begin'].bitpos // 8)
next_off = off + (prb_data_blk_lpos_type.get_type()['next'].bitpos // 8)
- off = prb_desc_type.get_type()['info'].bitpos // 8
- ts_off = off + printk_info_type.get_type()['ts_nsec'].bitpos // 8
- len_off = off + printk_info_type.get_type()['text_len'].bitpos // 8
+ ts_off = printk_info_type.get_type()['ts_nsec'].bitpos // 8
+ len_off = printk_info_type.get_type()['text_len'].bitpos // 8
# definitions from kernel/printk/printk_ringbuffer.h
desc_committed = 1
@@ -95,6 +100,7 @@ class LxDmesg(gdb.Command):
while True:
ind = did % desc_ring_count
desc_off = desc_sz * ind
+ info_off = info_sz * ind
# skip non-committed record
state = 3 & (utils.read_u64(descs, desc_off + sv_off +
@@ -119,7 +125,7 @@ class LxDmesg(gdb.Command):
# skip over descriptor id
text_start = begin + utils.get_long_type().sizeof
- text_len = utils.read_u16(descs, desc_off + len_off)
+ text_len = utils.read_u16(infos, info_off + len_off)
# handle truncated message
if end - text_start < text_len:
@@ -128,7 +134,7 @@ class LxDmesg(gdb.Command):
text = text_data[text_start:text_start + text_len].decode(
encoding='utf8', errors='replace')
- time_stamp = utils.read_u64(descs, desc_off + ts_off)
+ time_stamp = utils.read_u64(infos, info_off + ts_off)
for line in text.splitlines():
msg = u"[{time:12.6f}] {line}\n".format(