summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJohn Ogness <john.ogness@linutronix.de>2020-09-14 14:39:52 +0206
committerPetr Mladek <pmladek@suse.com>2020-09-15 15:52:49 +0200
commit10dcb06d40411a73e1ae111717e9a987bb760313 (patch)
tree21520d9beb051c2215ce29d03a30e180b6e78cd7 /scripts
parentcc5c7041c6e1fe8c02fe9e16f28a5e52f7a6957c (diff)
printk: ringbuffer: change representation of states
Rather than deriving the state by evaluating bits within the flags area of the state variable, assign the states explicit values and set those values in the flags area. Introduce macros to make it simple to read and write state values for the state variable. Although the functionality is preserved, the binary representation for the states is changed. 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/20200914123354.832-5-john.ogness@linutronix.de
Diffstat (limited to 'scripts')
-rw-r--r--scripts/gdb/linux/dmesg.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/gdb/linux/dmesg.py b/scripts/gdb/linux/dmesg.py
index 6c6022012ea8..dd8c0b95063a 100644
--- a/scripts/gdb/linux/dmesg.py
+++ b/scripts/gdb/linux/dmesg.py
@@ -78,10 +78,10 @@ class LxDmesg(gdb.Command):
len_off = off + printk_info_type.get_type()['text_len'].bitpos // 8
# definitions from kernel/printk/printk_ringbuffer.h
+ desc_committed = 1
desc_sv_bits = utils.get_long_type().sizeof * 8
- desc_committed_mask = 1 << (desc_sv_bits - 1)
- desc_reuse_mask = 1 << (desc_sv_bits - 2)
- desc_flags_mask = desc_committed_mask | desc_reuse_mask
+ desc_flags_shift = desc_sv_bits - 2
+ desc_flags_mask = 3 << desc_flags_shift
desc_id_mask = ~desc_flags_mask
# read in tail and head descriptor ids
@@ -96,8 +96,9 @@ class LxDmesg(gdb.Command):
desc_off = desc_sz * ind
# skip non-committed record
- state = utils.read_u64(descs, desc_off + sv_off + counter_off) & desc_flags_mask
- if state != desc_committed_mask:
+ state = 3 & (utils.read_u64(descs, desc_off + sv_off +
+ counter_off) >> desc_flags_shift)
+ if state != desc_committed:
if did == head_id:
break
did = (did + 1) & desc_id_mask