[v9,3/9] drm/panic: Add a drm panic handler

Sui Jingfeng sui.jingfeng at linux.dev
Tue Mar 12 13:18:54 UTC 2024


Hi,


On 2024/3/7 17:14, 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)
>
> v5
>   * Change the drawing API, use drm_fb_blit_from_r1() to draw the font.
>   * Also add drm_fb_fill() to fill area with background color.
>   * Add draw_pixel_xy() API for drivers that can't provide a linear buffer.
>   * Add a flush() callback for drivers that needs to synchronize the buffer.
>   * Add a void *private field, so drivers can pass private data to
>     draw_pixel_xy() and flush().
>
> v6
>   * Fix sparse warning for panic_msg and logo.
>
> v7
>   * Add select DRM_KMS_HELPER for the color conversion functions.
>
> v8
>   * Register directly each plane to the panic notifier (Sima)
>   * Add raw_spinlock to properly handle concurrency (Sima)
>   * Register plane instead of device, to avoid looping through plane
>     list, and simplify code.
>   * Replace get_scanout_buffer() logic with drm_panic_set_buffer()
>    (Thomas Zimmermann)
>   * Removed the draw_pixel_xy() API, will see later if it can be added back.
>
> v9
>   * Revert to using get_scanout_buffer() (Sima)
>   * Move get_scanout_buffer() and panic_flush() to the plane helper
>     functions (Thomas Zimmermann)
>   * Register all planes with get_scanout_buffer() to the panic notifier
>   * Use drm_panic_lock() to protect against race (Sima)
>
> Signed-off-by: Jocelyn Falempe <jfalempe at redhat.com>
> ---
>   Documentation/gpu/drm-kms.rst            |  12 +
>   drivers/gpu/drm/Kconfig                  |  23 ++
>   drivers/gpu/drm/Makefile                 |   1 +
>   drivers/gpu/drm/drm_drv.c                |   4 +
>   drivers/gpu/drm/drm_panic.c              | 322 +++++++++++++++++++++++
>   drivers/gpu/drm/drm_plane.c              |   1 +
>   include/drm/drm_modeset_helper_vtables.h |  37 +++
>   include/drm/drm_panic.h                  |  52 ++++
>   include/drm/drm_plane.h                  |   5 +
>   9 files changed, 457 insertions(+)
>   create mode 100644 drivers/gpu/drm/drm_panic.c


While applying you patch, there is new blank line at EOF reported, see below.
This is not an issue, but I want to report this to you.


git am ../drm-panic-Add-a-drm-panic-handler.mbox
Applying: drm/panic: Add drm panic locking
Applying: drm/format-helper: Add drm_fb_blit_from_r1 and drm_fb_fill
Applying: drm/panic: Add a drm panic handler
.git/rebase-apply/patch:439: new blank line at EOF.
+
warning: 1 line adds whitespace errors.
Applying: drm/panic: Add debugfs entry to test without triggering panic.
Applying: drm/fb_dma: Add generic get_scanout_buffer() for drm_panic
Applying: drm/simpledrm: Add drm_panic support
Applying: drm/mgag200: Add drm_panic support
Applying: drm/imx: Add drm_panic support
Applying: drm/ast: Add drm_panic support



More information about the dri-devel mailing list