dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jocelyn Falempe <jfalempe@redhat.com>
To: "Noralf Trønnes" <noralf@tronnes.org>,
	dri-devel@lists.freedesktop.org, tzimmermann@suse.de,
	airlied@redhat.com, maarten.lankhorst@linux.intel.com,
	mripard@kernel.org, daniel@ffwll.ch, javierm@redhat.com,
	bluescreen_avenger@verizon.net
Cc: gpiccoli@igalia.com
Subject: Re: [PATCH v4 2/4] drm/panic: Add a drm panic handler
Date: Mon, 9 Oct 2023 10:01:04 +0200	[thread overview]
Message-ID: <52339812-ffae-0d76-e8ba-db6d1de7e832@redhat.com> (raw)
In-Reply-To: <7eee2ca0-d2d4-4bfe-b253-fe6147aec173@tronnes.org>

On 07/10/2023 14:38, Noralf Trønnes wrote:
> 
> 
> On 10/3/23 16:22, Jocelyn Falempe wrote:
>> This module displays a user friendly message when a kernel panic
>> occurs. It currently doesn't contain any debug information,
>> but that can be added later.
>>
>> v2
>>   * Use get_scanout_buffer() instead of the drm client API.
>>    (Thomas Zimmermann)
>>   * Add the panic reason to the panic message (Nerdopolis)
>>   * Add an exclamation mark (Nerdopolis)
>>
>> v3
>>   * Rework the drawing functions, to write the pixels line by line and
>>   to use the drm conversion helper to support other formats.
>>   (Thomas Zimmermann)
>>
>> v4
>>   * Use drm_fb_r1_to_32bit for fonts (Thomas Zimmermann)
>>   * Remove the default y to DRM_PANIC config option (Thomas Zimmermann)
>>   * Add foreground/background color config option
>>   * Fix the bottom lines not painted if the framebuffer height
>>     is not a multiple of the font height.
>>   * Automatically register the device to drm_panic, if the function
>>     get_scanout_buffer exists. (Thomas Zimmermann)
>>
>> Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
>> ---
>>   drivers/gpu/drm/Kconfig     |  22 ++
>>   drivers/gpu/drm/Makefile    |   1 +
>>   drivers/gpu/drm/drm_drv.c   |   8 +
>>   drivers/gpu/drm/drm_panic.c | 413 ++++++++++++++++++++++++++++++++++++
>>   include/drm/drm_drv.h       |  14 ++
>>   include/drm/drm_panic.h     |  41 ++++
>>   6 files changed, 499 insertions(+)
>>   create mode 100644 drivers/gpu/drm/drm_panic.c
>>   create mode 100644 include/drm/drm_panic.h
>>
> 
>> diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c
>> new file mode 100644
> 
>> +static void draw_panic_device(struct drm_device *dev, const char *msg)
>> +{
>> +	struct drm_scanout_buffer sb;
>> +
>> +	if (dev->driver->get_scanout_buffer(dev, &sb))
>> +		return;
>> +	if (!drm_panic_line_buf)
>> +		return;
>> +
> 
> Unless something has changed since 2019 we need to make sure fbcon
> hasn't already printed the panic to avoid jumbled output. See [1] for
> more info.

I think DRM_PANIC and fbcon are incompatible, so in Kconfig I prevent 
them to be built together:

config DRM_PANIC
   bool "Display a user-friendly message when a kernel panic occurs"
   depends on DRM && !FRAMEBUFFER_CONSOLE

So DRM_PANIC should be used with a userspace console, either kmscon, or 
some lightweight terminal emulator/wayland compositor, like cage/foot.

As fbcon has lost scrolling support, it's time to switch to something 
better. [1]

-- 

Jocelyn

[1]
https://www.reddit.com/r/linux/comments/10eccv9/config_vtn_in_2023/

> 
> Noralf.
> 
> [1]
> https://lore.kernel.org/dri-devel/20190312095320.GX2665@phenom.ffwll.local/
> 
>> +	/* to avoid buffer overflow on drm_panic_line_buf */
>> +	if (sb.width > DRM_PANIC_MAX_WIDTH)
>> +		sb.width = DRM_PANIC_MAX_WIDTH;
>> +
>> +	draw_panic_static(&sb, msg);
>> +}
> 


  reply	other threads:[~2023-10-09  8:01 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-03 14:22 [RFC][PATCH v4 0/4] drm/panic: Add a drm panic handler Jocelyn Falempe
2023-10-03 14:22 ` [PATCH v4 1/4] drm/format-helper: Export line conversion helper for drm_panic Jocelyn Falempe
2023-10-03 15:56   ` kernel test robot
2023-10-04  1:45   ` nerdopolis
2023-10-05  7:37     ` Jocelyn Falempe
2023-10-16 10:47   ` Thomas Zimmermann
2023-10-16 10:50     ` Thomas Zimmermann
2023-10-16 16:22     ` Jocelyn Falempe
2023-10-03 14:22 ` [PATCH v4 2/4] drm/panic: Add a drm panic handler Jocelyn Falempe
2023-10-05  3:39   ` kernel test robot
2023-10-05  8:18   ` Maxime Ripard
2023-10-05  9:16     ` Jocelyn Falempe
2023-10-06 14:35       ` Maxime Ripard
2023-10-06 16:54         ` Noralf Trønnes
2023-10-09  7:47           ` Jocelyn Falempe
2023-10-09  8:28             ` Maxime Ripard
2023-10-09  9:48               ` Jocelyn Falempe
2023-10-09 11:33                 ` Maxime Ripard
2023-10-09 14:05                   ` Jocelyn Falempe
2023-10-09 16:07                     ` Maxime Ripard
2023-10-10  7:55                       ` Jocelyn Falempe
2023-10-10  8:30                         ` Maxime Ripard
2023-10-10  9:04                       ` Thomas Zimmermann
2023-10-10  9:33                         ` Maxime Ripard
2023-10-10 13:05                           ` Thomas Zimmermann
2023-10-10 13:32                             ` Jocelyn Falempe
2023-10-10  8:55                   ` Thomas Zimmermann
2023-10-10  9:25                     ` Maxime Ripard
2023-10-10 11:29                       ` Noralf Trønnes
2023-10-10 12:15                         ` Maxime Ripard
2023-10-10 12:59                           ` Daniel Vetter
2023-10-10 13:24                             ` Thomas Zimmermann
2023-10-10 13:24                             ` Jocelyn Falempe
2023-10-07 12:38   ` Noralf Trønnes
2023-10-09  8:01     ` Jocelyn Falempe [this message]
2023-10-03 14:22 ` [PATCH v4 3/4] drm/simpledrm: Add drm_panic support Jocelyn Falempe
2023-10-03 14:22 ` [PATCH v4 4/4] drm/mgag200: " Jocelyn Falempe
2023-10-07 14:30   ` Noralf Trønnes
2023-10-09 10:01     ` Jocelyn Falempe
2023-10-10  9:23   ` Thomas Zimmermann

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=52339812-ffae-0d76-e8ba-db6d1de7e832@redhat.com \
    --to=jfalempe@redhat.com \
    --cc=airlied@redhat.com \
    --cc=bluescreen_avenger@verizon.net \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gpiccoli@igalia.com \
    --cc=javierm@redhat.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=noralf@tronnes.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;
as well as URLs for NNTP newsgroup(s).