2022-12-29 14:21:06

by John Ogness

[permalink] [raw]
Subject: [PATCH] docs: gdbmacros: print newest record

@head_id points to the newest record, but the printing loop
exits when it increments to this value (before printing).

Exit the printing loop after the newest record has been printed.

The python-based function in scripts/gdb/linux/dmesg.py already
does this correctly.

Fixes: e60768311af8 ("scripts/gdb: update for lockless printk ringbuffer")
Cc: [email protected]
Signed-off-by: John Ogness <[email protected]>
---
Documentation/admin-guide/kdump/gdbmacros.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/kdump/gdbmacros.txt b/Documentation/admin-guide/kdump/gdbmacros.txt
index 82aecdcae8a6..030de95e3e6b 100644
--- a/Documentation/admin-guide/kdump/gdbmacros.txt
+++ b/Documentation/admin-guide/kdump/gdbmacros.txt
@@ -312,10 +312,10 @@ define dmesg
set var $prev_flags = $info->flags
end

- set var $id = ($id + 1) & $id_mask
if ($id == $end_id)
loop_break
end
+ set var $id = ($id + 1) & $id_mask
end
end
document dmesg

base-commit: 1b929c02afd37871d5afb9d498426f83432e71c2
--
2.30.2


2023-01-03 09:56:09

by Petr Mladek

[permalink] [raw]
Subject: Re: [PATCH] docs: gdbmacros: print newest record

On Thu 2022-12-29 14:49:39, John Ogness wrote:
> @head_id points to the newest record, but the printing loop
> exits when it increments to this value (before printing).
>
> Exit the printing loop after the newest record has been printed.
>
> The python-based function in scripts/gdb/linux/dmesg.py already
> does this correctly.
>
> Fixes: e60768311af8 ("scripts/gdb: update for lockless printk ringbuffer")
> Cc: [email protected]
> Signed-off-by: John Ogness <[email protected]>

JFYI, the patch has been committed into printk/linux.git,
branch for-6.3.

Best Regards,
Petr

2023-01-03 10:22:07

by Petr Mladek

[permalink] [raw]
Subject: Re: [PATCH] docs: gdbmacros: print newest record

On Thu 2022-12-29 14:49:39, John Ogness wrote:
> @head_id points to the newest record, but the printing loop
> exits when it increments to this value (before printing).
>
> Exit the printing loop after the newest record has been printed.
>
> The python-based function in scripts/gdb/linux/dmesg.py already
> does this correctly.
>
> Fixes: e60768311af8 ("scripts/gdb: update for lockless printk ringbuffer")
> Cc: [email protected]
> Signed-off-by: John Ogness <[email protected]>

Great catch!

Reviewed-by: Petr Mladek <[email protected]>

Best Regards,
Petr