All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Jocelyn Falempe <jfalempe@redhat.com>
Cc: 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, noralf@tronnes.org,
	gpiccoli@igalia.com
Subject: Re: [PATCH v8 5/8] drm/simpledrm: Add drm_panic support
Date: Thu, 29 Feb 2024 12:17:46 +0100	[thread overview]
Message-ID: <ZeBn2sJmmQzY3Nxu@phenom.ffwll.local> (raw)
In-Reply-To: <20240227100459.194478-6-jfalempe@redhat.com>

On Tue, Feb 27, 2024 at 11:04:16AM +0100, Jocelyn Falempe wrote:
> Add support for the drm_panic module, which displays a user-friendly
> message to the screen when a kernel panic occurs.
> 
> v8:
>  * Replace get_scanout_buffer() with drm_panic_set_buffer()
>    (Thomas Zimmermann)
> 
> Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
> ---
>  drivers/gpu/drm/tiny/simpledrm.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
> index 7ce1c4617675..a2190995354a 100644
> --- a/drivers/gpu/drm/tiny/simpledrm.c
> +++ b/drivers/gpu/drm/tiny/simpledrm.c
> @@ -25,6 +25,7 @@
>  #include <drm/drm_gem_shmem_helper.h>
>  #include <drm/drm_managed.h>
>  #include <drm/drm_modeset_helper_vtables.h>
> +#include <drm/drm_panic.h>
>  #include <drm/drm_probe_helper.h>
>  
>  #define DRIVER_NAME	"simpledrm"
> @@ -735,6 +736,20 @@ static const struct drm_connector_funcs simpledrm_connector_funcs = {
>  	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>  };
>  
> +static void simpledrm_init_panic_buffer(struct drm_plane *plane)
> +{
> +	struct simpledrm_device *sdev = simpledrm_device_of_dev(plane->dev);
> +	struct drm_framebuffer fb;
> +
> +	/* Fake framebuffer struct for drm_panic_set_buffer */
> +	fb.width = sdev->mode.hdisplay;
> +	fb.height = sdev->mode.vdisplay;
> +	fb.format = sdev->format;
> +	fb.pitches[0] = sdev->pitch;
> +
> +	drm_panic_set_buffer(plane->panic_scanout, &fb, &sdev->screen_base);
> +}
> +
>  static const struct drm_mode_config_funcs simpledrm_mode_config_funcs = {
>  	.fb_create = drm_gem_fb_create_with_dirty,
>  	.atomic_check = drm_atomic_helper_check,
> @@ -945,6 +960,8 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
>  		return ERR_PTR(ret);
>  	drm_plane_helper_add(primary_plane, &simpledrm_primary_plane_helper_funcs);
>  	drm_plane_enable_fb_damage_clips(primary_plane);
> +	drm_panic_register(primary_plane);

Just a quick comment on this:

This does not work, the driver is not ready to handle panic calls at this
stage. Instead we need to automatically register all planes that support
panic handling in drm_dev_register(), and we need to remove them all again
in drm_dev_unregister(). Outside of these functions it is not safe to call
into driver code.

At that point it might be simpler to only register one panic notifier per
drm_device, and push the loop into the panic handler again.

Cheers, Sima

> +	simpledrm_init_panic_buffer(primary_plane);
>  
>  	/* CRTC */
>  
> -- 
> 2.43.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2024-02-29 11:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 10:04 [RFC][PATCH v8 0/8] drm/panic: Add a drm panic handler Jocelyn Falempe
2024-02-27 10:04 ` [PATCH v8 1/8] drm/format-helper: Add drm_fb_blit_from_r1 and drm_fb_fill Jocelyn Falempe
2024-02-27 10:04 ` [PATCH v8 2/8] drm/panic: Add a drm panic handler Jocelyn Falempe
2024-02-27 10:04 ` [PATCH v8 3/8] drm/panic: Add debugfs entry to test without triggering panic Jocelyn Falempe
2024-02-29 11:21   ` Daniel Vetter
2024-02-29 13:56     ` Jocelyn Falempe
2024-02-29 19:08   ` kernel test robot
2024-02-27 10:04 ` [PATCH v8 4/8] drm/fb_dma: Add generic set_scanout_buffer() for drm_panic Jocelyn Falempe
2024-02-29 15:12   ` kernel test robot
2024-03-01  2:13   ` kernel test robot
2024-02-27 10:04 ` [PATCH v8 5/8] drm/simpledrm: Add drm_panic support Jocelyn Falempe
2024-02-29 11:17   ` Daniel Vetter [this message]
2024-02-29 14:02     ` Jocelyn Falempe
2024-02-27 10:04 ` [PATCH v8 6/8] drm/mgag200: " Jocelyn Falempe
2024-02-27 10:04 ` [PATCH v8 7/8] drm/imx: " Jocelyn Falempe
2024-02-27 10:04 ` [PATCH v8 8/8] drm/ast: " Jocelyn Falempe

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=ZeBn2sJmmQzY3Nxu@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@redhat.com \
    --cc=bluescreen_avenger@verizon.net \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gpiccoli@igalia.com \
    --cc=javierm@redhat.com \
    --cc=jfalempe@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.