From: Jocelyn Falempe <jfalempe@redhat.com>
To: Devin Wittmayer <lucid_duck@justthetip.ca>,
Javier Martinez Canillas <javierm@redhat.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
luyuantao <luyuantao01@163.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH 1/2] drm/panic: Fix kmsg screen hang on a long log line
Date: Fri, 16 Oct 2026 23:09:32 +0200 [thread overview]
Message-ID: <8e525023-dc47-416e-a3fe-c5e6c5660ca5@redhat.com> (raw)
In-Reply-To: <20261016052722.60051-1-lucid_duck@justthetip.ca>
On 10/16/26 07:27, Devin Wittmayer wrote:
> The kmsg panic screen reads the log back one chunk at a time. A record
> that does not fit in a chunk comes back empty without moving on, so the
> screen asks for it again forever and the panic never finishes. Every
> oops logs the list of loaded modules, and on my machine that list does
> not fit.
>
> Read into a buffer the size printk formats one record into, and stop if
> a read still comes back empty.
Thanks for investigating this issue.
That looks good to me.
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
I'm sorry, I probably forgot to push [1], so I will push both patches
next week if no other comments.
[1] https://lore.kernel.org/all/20260126100732.365-1-luyuantao01@163.com/
Best regards,
--
Jocelyn
>
> Fixes: 54034bebb22f ("drm/panic: Add a kmsg panic screen")
> Cc: stable@vger.kernel.org
> Signed-off-by: Devin Wittmayer <lucid_duck@justthetip.ca>
> ---
> I usually work on Wi-Fi drivers, so this is new ground for me. While I
> was testing a fix for a Wi-Fi driver crash, my test machine froze after
> the crash where it should have rebooted, and stayed that way until I
> power cycled it. Working out why led me here.
>
> To reproduce, with the kmsg screen and panic=10 on a display driver with
> panic support, as root:
>
> printf "%600s\n" "" | tr ' ' x > /dev/kmsg
> echo c > /proc/sysrq-trigger
>
> Before this patch the panic never gets to its reboot.
>
> QEMU, 10 runs each, on drm-misc-fixes and drm-misc-next (bochs) and
> 6.12.113 (simpledrm):
>
> before after
> one 600 char line hangs reboots
> same, then 400 short lines hangs reboots
> one record of 300 short lines hangs reboots
> oops with 24 modules loaded hangs reboots
> plain panic reboots reboots
>
> amdgpu, 2 runs each, Arch's source and config, before and after:
>
> 6.18.52, the two commands above hangs reboots
> 6.18.52, one record of 300 lines hangs reboots
> 6.18.52, oops hangs reboots
> 7.2.6, kmsg screen set, oops hangs reboots
>
> luyuantao's patch [1] stops reading once the screen is full, so it only
> helps the second row. With both on drm-misc-fixes, every row reboots.
>
> The buffer is shared, like the QR code buffers; a panic only draws from
> one CPU. In drm-misc-next this code is in drm_panic_helper.c, where the
> same change was tested.
>
> [1] https://lore.kernel.org/all/20260126100732.365-1-luyuantao01@163.com/
>
> drivers/gpu/drm/drm_panic.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c
> index e576c4791861d..29b1487de7ae0 100644
> --- a/drivers/gpu/drm/drm_panic.c
> +++ b/drivers/gpu/drm/drm_panic.c
> @@ -556,7 +556,8 @@ static void draw_panic_screen_kmsg(struct drm_scanout_buffer *sb)
> const struct font_desc *font = get_default_font(sb->width, sb->height, NULL, NULL);
> struct drm_rect r_screen = DRM_RECT_INIT(0, 0, sb->width, sb->height);
> struct kmsg_dump_iter iter;
> - char kmsg_buf[512];
> + /* the size printk formats one record into, too big for the stack */
> + static char kmsg_buf[2048];
> size_t kmsg_len;
> struct drm_panic_line line;
> int yoffset;
> @@ -574,6 +575,10 @@ static void draw_panic_screen_kmsg(struct drm_scanout_buffer *sb)
> char *start;
> char *end;
>
> + /* a record that does not fit comes back empty, every time */
> + if (!kmsg_len)
> + break;
> +
> /* ignore terminating NUL and newline */
> start = kmsg_buf + kmsg_len - 2;
> end = kmsg_buf + kmsg_len - 1;
>
> base-commit: 324fac81f365fc123247f9c8a52cb66ebd93b5e5
prev parent reply other threads:[~2026-10-16 21:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 5:27 Devin Wittmayer
2026-10-16 5:27 ` [PATCH 2/2] drm/panic: Accept a trailing newline in panic_screen Devin Wittmayer
2026-10-16 7:47 ` Tvrtko Ursulin
2026-10-16 21:18 ` Jocelyn Falempe
[not found] ` <sashiko-outbox-173828@kernel.org>
2026-10-16 15:29 ` [PATCH 1/2] drm/panic: Fix kmsg screen hang on a long log line Devin Wittmayer
2026-10-16 21:09 ` Jocelyn Falempe [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=8e525023-dc47-416e-a3fe-c5e6c5660ca5@redhat.com \
--to=jfalempe@redhat.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lucid_duck@justthetip.ca \
--cc=luyuantao01@163.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=stable@vger.kernel.org \
--cc=tzimmermann@suse.de \
/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
all inboxes | Powered by JetHome®