From: John Ogness <john.ogness@linutronix.de>
To: Petr Mladek <pmladek@suse.com>
Cc: Andrea Parri <parri.andrea@gmail.com>,
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
Paul McKenney <paulmck@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH next v3 8/8] scripts/gdb: support printk finalized records
Date: Mon, 31 Aug 2020 03:16:58 +0206 [thread overview]
Message-ID: <20200831011058.6286-9-john.ogness@linutronix.de> (raw)
In-Reply-To: <20200831011058.6286-1-john.ogness@linutronix.de>
With commit ("printk: ringbuffer: add finalization/extension support")
a new state bit for finalized records was added. This not only changed
the bit representation of committed records, but also reduced the size
for record IDs.
Update the gdb scripts to correctly interpret the state variable.
Signed-off-by: John Ogness <john.ogness@linutronix.de>
---
Documentation/admin-guide/kdump/gdbmacros.txt | 10 +++++++---
scripts/gdb/linux/dmesg.py | 10 ++++++----
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/Documentation/admin-guide/kdump/gdbmacros.txt b/Documentation/admin-guide/kdump/gdbmacros.txt
index 7adece30237e..bcb78368b381 100644
--- a/Documentation/admin-guide/kdump/gdbmacros.txt
+++ b/Documentation/admin-guide/kdump/gdbmacros.txt
@@ -295,8 +295,11 @@ document dump_record
end
define dmesg
- set var $desc_committed = 1UL << ((sizeof(long) * 8) - 1)
- set var $flags_mask = 3UL << ((sizeof(long) * 8) - 2)
+ # definitions from kernel/printk/printk_ringbuffer.h
+ set var $desc_commit = 1UL << ((sizeof(long) * 8) - 1)
+ set var $desc_final = 1UL << ((sizeof(long) * 8) - 2)
+ set var $desc_reuse = 1UL << ((sizeof(long) * 8) - 3)
+ set var $flags_mask = $desc_commit | $desc_final | $desc_reuse
set var $id_mask = ~$flags_mask
set var $desc_count = 1U << prb->desc_ring.count_bits
@@ -309,7 +312,8 @@ define dmesg
set var $desc = &prb->desc_ring.descs[$id % $desc_count]
# skip non-committed record
- if (($desc->state_var.counter & $flags_mask) == $desc_committed)
+ # (note that commit+!final records will be displayed)
+ if (($desc->state_var.counter & $desc_commit) == $desc_commit)
dump_record $desc $prev_flags
set var $prev_flags = $desc->info.flags
end
diff --git a/scripts/gdb/linux/dmesg.py b/scripts/gdb/linux/dmesg.py
index 6c6022012ea8..367523c5c270 100644
--- a/scripts/gdb/linux/dmesg.py
+++ b/scripts/gdb/linux/dmesg.py
@@ -79,9 +79,10 @@ class LxDmesg(gdb.Command):
# definitions from kernel/printk/printk_ringbuffer.h
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_commit_mask = 1 << (desc_sv_bits - 1)
+ desc_final_mask = 1 << (desc_sv_bits - 2)
+ desc_reuse_mask = 1 << (desc_sv_bits - 3)
+ desc_flags_mask = desc_commit_mask | desc_final_mask | desc_reuse_mask
desc_id_mask = ~desc_flags_mask
# read in tail and head descriptor ids
@@ -96,8 +97,9 @@ class LxDmesg(gdb.Command):
desc_off = desc_sz * ind
# skip non-committed record
+ # (note that commit+!final records will be displayed)
state = utils.read_u64(descs, desc_off + sv_off + counter_off) & desc_flags_mask
- if state != desc_committed_mask:
+ if state & desc_commit_mask != desc_commit_mask:
if did == head_id:
break
did = (did + 1) & desc_id_mask
--
2.20.1
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
prev parent reply other threads:[~2020-08-31 1:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-31 1:10 [PATCH next v3 0/8] printk: reimplement LOG_CONT handling John Ogness
2020-08-31 1:10 ` [PATCH next v3 1/8] printk: ringbuffer: rename DESC_COMMITTED_MASK flag John Ogness
2020-08-31 1:10 ` [PATCH next v3 2/8] printk: ringbuffer: change representation of reusable John Ogness
2020-08-31 1:10 ` [PATCH next v3 3/8] printk: ringbuffer: relocate get_data() John Ogness
2020-08-31 1:10 ` [PATCH next v3 4/8] printk: ringbuffer: add BLK_DATALESS() macro John Ogness
2020-08-31 1:10 ` [PATCH next v3 5/8] printk: ringbuffer: clear initial reserved fields John Ogness
2020-09-01 14:33 ` Petr Mladek
2020-08-31 1:10 ` [PATCH next v3 6/8] printk: ringbuffer: add finalization/extension support John Ogness
2020-08-31 12:54 ` John Ogness
2020-09-02 10:52 ` state names: vas: " Petr Mladek
2020-09-02 11:20 ` John Ogness
2020-09-02 12:39 ` Petr Mladek
2020-09-02 10:58 ` Petr Mladek
2020-09-02 12:21 ` misc: was: " Petr Mladek
2020-08-31 1:10 ` [PATCH next v3 7/8] printk: reimplement log_cont using record extension John Ogness
2020-09-02 13:38 ` Petr Mladek
2020-08-31 1:10 ` John Ogness [this message]
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=20200831011058.6286-9-john.ogness@linutronix.de \
--to=john.ogness@linutronix.de \
--cc=gregkh@linuxfoundation.org \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=parri.andrea@gmail.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=sergey.senozhatsky@gmail.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox