All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] drm/panic: Add support to scanout buffer as array of pages
@ 2025-03-21 11:16 Jocelyn Falempe
  2025-03-21 11:16 ` [PATCH v2 1/2] mm/kmap: Add kmap_local_page_try_from_panic() Jocelyn Falempe
  2025-03-21 11:16 ` [PATCH v2 2/2] drm/panic: Add support to scanout buffer as array of pages Jocelyn Falempe
  0 siblings, 2 replies; 4+ messages in thread
From: Jocelyn Falempe @ 2025-03-21 11:16 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Ryosuke Yasuoka, Javier Martinez Canillas,
	Wei Yang, Andrew Morton, David Hildenbrand, John Ogness,
	Thomas Gleixner, linux-mm, dri-devel, linux-kernel
  Cc: Jocelyn Falempe

Some drivers like virtio-gpu, don't map the scanout buffer in the
kernel. Calling vmap() in a panic handler is not safe, and writing an
atomic_vmap() API is more complex than expected [1].
So instead, pass the array of pages of the scanout buffer to the
panic handler, and map only one page at a time to draw the pixels.
This is obviously slow, but acceptable for a panic handler.
As kmap_local_page() is not safe to call from a panic handler,
introduce a kmap_local_page_try_from_panic() that will avoid unsafe
operations.

[1] https://lore.kernel.org/dri-devel/20250305152555.318159-1-ryasuoka@redhat.com/

v2:
 * Add kmap_local_page_try_from_panic() Simona Vetter
 * Correctly handle the case if kmap_local_page_try_from_panic()
   returns NULL
 * Check that the current page is not NULL before trying to map it.
 * Add a comment in struct drm_scanout_buffer, that the array of
   pages shouldn't be allocated in the get_scanout_buffer() callback.

Jocelyn Falempe (2):
  mm/kmap: Add kmap_local_page_try_from_panic()
  drm/panic: Add support to scanout buffer as array of pages

 drivers/gpu/drm/drm_panic.c      | 142 +++++++++++++++++++++++++++++--
 include/drm/drm_panic.h          |  12 ++-
 include/linux/highmem-internal.h |  12 +++
 3 files changed, 159 insertions(+), 7 deletions(-)


base-commit: f24d1d4a7a425e67551ca8d86a89df7102766ac9
-- 
2.47.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-04-04  7:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-21 11:16 [PATCH v2 0/2] drm/panic: Add support to scanout buffer as array of pages Jocelyn Falempe
2025-03-21 11:16 ` [PATCH v2 1/2] mm/kmap: Add kmap_local_page_try_from_panic() Jocelyn Falempe
2025-04-04  7:33   ` Thomas Gleixner
2025-03-21 11:16 ` [PATCH v2 2/2] drm/panic: Add support to scanout buffer as array of pages Jocelyn Falempe

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.