[RFC 0/3] drm: Add panic handling

Noralf Trønnes noralf at tronnes.org
Tue Aug 9 17:45:39 UTC 2016

This patchset proposes a way to get output of kernel messages on the
display during panic(). The responsibility of the driver is to provide
a framebuffer with a virtual mapping that the messages can be rendered
on. Only linear RGB is supported in this version.

David Herrmann, who has worked on this problem before[1], prefers to have
a dedicated renderer for the panic case, and a different one for other
uses like console. To try and keep the code simple, I just collect kernel
messages in a circular buffer until a panic situation occurs and then the
messages are rendered on all the framebuffers/devices it can find.
>From this point on, all messages are rendered as they come in.

I have added a debugfs file that can trigger various "levels" of panic
handling to aid in testing the drivers. There's one test that is missing
which Daniel Vetter mentions on the DRMJanitors page:

    hardirq context could be achieved by using an ipi to the local processor.

I don't know how to actually do this.

I've come to the understanding that switching buffers can actually be very
tricky for a driver to achieve in atomic context like a panic situation.
And atomically vmapping the buffer being scanned out isn't possible.
Maybe it's possible to kmap_atomic() the pages and write to them individually?

I know that this is low priority for the drm maintainers, so please ignore
this if the timing isn't right and/or the solution is wrong.


[1] drmlog:

Noralf Trønnes (3):
  drm: Add a way to iterate over minors
  drm: Add panic handling
  drm: simpledrm: Add panic handling

 drivers/gpu/drm/Makefile                  |   2 +-
 drivers/gpu/drm/drm_drv.c                 |  33 ++
 drivers/gpu/drm/drm_internal.h            |   4 +
 drivers/gpu/drm/drm_panic.c               | 606 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/simpledrm/simpledrm_drv.c |  24 ++
 include/drm/drmP.h                        |  35 ++
 6 files changed, 703 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/drm_panic.c


More information about the dri-devel mailing list