From: Thomas Zimmermann <tzimmermann@suse.de>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: jfalempe@redhat.com, javierm@redhat.com, airlied@gmail.com,
simona@ffwll.ch, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, dri-devel@lists.freedesktop.org,
linux-doc@vger.kernel.org, amd-gfx@lists.freedesktop.org,
rust-for-linux@vger.kernel.org, linux-hyperv@vger.kernel.org,
intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
nouveau@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org,
virtualization@lists.linux.dev, sashiko-reviews@lists.linux.dev
Subject: Re: [PATCH 01/12] drm/panic: Allocate QR-code buffers statically
Date: Wed, 19 Aug 2026 12:45:37 +0200 [thread overview]
Message-ID: <427a13f5-c820-4aa1-b19f-1fb0493d264d@suse.de> (raw)
In-Reply-To: <CAMuHMdWYVjvGM2pOzWoDq8LUSrkFtzOQwdmosHYQuBLnSn3D-Q@mail.gmail.com>
Hi
Am 19.08.26 um 11:38 schrieb Geert Uytterhoeven:
> Hi Thomas,
>
> On Tue, 18 Aug 2026 at 15:00, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>> Declare qrbuf1 and qrbuf2 as static arrays so that the module loader
>> allocates them for us. Avoids the kmalloc later on. Also allows for
>> using sizeof() to get the number of bytes in each array. Access the
>> arrays once with memset, so that the physical pages are available on
>> a panic.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Thanks for your patch!
>
>> --- a/drivers/gpu/drm/drm_panic.c
>> +++ b/drivers/gpu/drm/drm_panic.c
>> @@ -628,24 +628,23 @@ MODULE_PARM_DESC(panic_qr_version, "maximum version (size) of the QR code");
>> #define WINDOW_BITS 12
>> #define MEM_LEVEL 4
>>
>> -static char *qrbuf1;
>> -static char *qrbuf2;
>> +static u8 qrbuf1[QR_BUFFER1_SIZE];
>> +static u8 qrbuf2[QR_BUFFER2_SIZE];
> I am not a big fan of increasing kernel size like this.
> You may run (faster) into boot loader limitations.
Which limitation would this be?
>
>> static struct z_stream_s stream;
>>
>> static void __init drm_panic_qr_init(void)
>> {
>> - qrbuf1 = kmalloc(QR_BUFFER1_SIZE, GFP_KERNEL);
>> - qrbuf2 = kmalloc(QR_BUFFER2_SIZE, GFP_KERNEL);
>> + /* best-effort allocation; can be NULL */
>> stream.workspace = kmalloc(zlib_deflate_workspacesize(WINDOW_BITS, MEM_LEVEL),
>> GFP_KERNEL);
> <ironic>Why not use a static array for this, too?</ironic>
I tried, by the size is calculated at runtime.
>
>> +
>> + /* touch memory so that pages are there in the case of a panic */
>> + memset(qrbuf1, 0, sizeof(qrbuf1));
>> + memset(qrbuf2, 0, sizeof(qrbuf2));
> Please clarify "there"?
> In cache? Not all systems have sufficient data cache, so it may be
> evicted at any time.
> In RAM? AFAIK kernel and module memory is not demand-paged.
> In TLB? Like cache, it may be evicted at any time.
I'd like to avoid looking for a page after a panic has already occurred.
But I guess it might not make a difference, given all the DRM that is
involved.
The motivation here was that I did not like that panic handling depends
on a number of dynamic kmallocs, with which we don't even detect alloc
failures until a panic has occurred.
>
> So IMHO this is futile.
Noted.
Best regards
Thomas
>
>> }
> Gr{oetje,eeting}s,
>
> Geert
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, (HRB 36809, AG Nürnberg)
next prev parent reply other threads:[~2026-08-19 10:45 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 12:27 [PATCH 00/12] drm/panic: Split into core and helpers Thomas Zimmermann
2026-08-18 12:27 ` [PATCH 01/12] drm/panic: Allocate QR-code buffers statically Thomas Zimmermann
2026-08-18 13:09 ` sashiko-bot
2026-08-19 9:38 ` Geert Uytterhoeven
2026-08-19 10:45 ` Thomas Zimmermann [this message]
2026-08-18 12:28 ` [PATCH 02/12] drm/panic: Make allocation of zlib workspace more robust Thomas Zimmermann
2026-08-18 12:28 ` [PATCH 03/12] drm/panic: Return -EINVAL if font is not available Thomas Zimmermann
2026-08-18 13:04 ` sashiko-bot
2026-08-18 12:28 ` [PATCH 04/12] drm/panic: Return errno codes if panic output fails Thomas Zimmermann
2026-08-18 13:03 ` sashiko-bot
2026-08-18 12:28 ` [PATCH 05/12] drm/panic: Pass colors to draw_panic_dispatch() Thomas Zimmermann
2026-08-18 12:28 ` [PATCH 06/12] drm/panic: Pass global module parameters to drm_panic_dispatch() Thomas Zimmermann
2026-08-18 13:09 ` sashiko-bot
2026-08-19 8:19 ` Thomas Zimmermann
2026-08-18 12:28 ` [PATCH 07/12] drm/panic: Retry in dispatch function if panic output fails Thomas Zimmermann
2026-08-18 13:05 ` sashiko-bot
2026-08-19 8:22 ` Thomas Zimmermann
2026-08-18 12:28 ` [PATCH 08/12] drm/panic: Split draw_panic_plane() Thomas Zimmermann
2026-08-18 13:14 ` sashiko-bot
2026-08-18 12:28 ` [PATCH 09/12] drm/panic: Display panic screen via per-plane callback Thomas Zimmermann
2026-08-18 13:19 ` sashiko-bot
2026-08-19 9:02 ` Thomas Zimmermann
2026-08-18 12:28 ` [PATCH 10/12] drm/panic: Internalize panic locking in DRM core and helpers Thomas Zimmermann
2026-08-18 12:28 ` [PATCH 11/12] drm/panic: Move panic display code into helper library Thomas Zimmermann
2026-08-18 13:13 ` sashiko-bot
2026-08-18 15:55 ` Randy Dunlap
2026-08-19 6:16 ` Thomas Zimmermann
2026-08-18 12:28 ` [PATCH 12/12] drm/panic: Compile KUnit tests as module Thomas Zimmermann
2026-08-18 13:18 ` sashiko-bot
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=427a13f5-c820-4aa1-b19f-1fb0493d264d@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert@linux-m68k.org \
--cc=imx@lists.linux.dev \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=jfalempe@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=nouveau@lists.freedesktop.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=simona@ffwll.ch \
--cc=virtualization@lists.linux.dev \
/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