[PATCH v7 2/9] drm/panic: Add a drm panic handler

Jocelyn Falempe jfalempe at redhat.com
Fri Jan 19 17:20:44 UTC 2024



On 12/01/2024 14:50, Daniel Vetter wrote:
> On Thu, Jan 04, 2024 at 05:00:46PM +0100, Jocelyn Falempe wrote:
>> +/**
>> + * drm_panic_init() - Initialize drm-panic subsystem
>> + *
>> + * register the panic notifier
>> + */
>> +void drm_panic_init(void)
>> +{
>> +	atomic_notifier_chain_register(&panic_notifier_list,
>> +				       &drm_panic_notifier);
> 
> Ok I've found another one after checking core panic code. This is the
> wrong hook, we want to be a sttruct kmsg_dumper and use
> kmsg_dump_register. And again once for each drm_panic_device so that we
> can rely on core locking, as I've explained in the other reply.
> 
> Also because it trashes buffers from userspace I think by default we want
> to only dump on panic, so KMS_DUMP_PANIC.
> -Sima


I've tested this change and I don't think kmsg_dumper is the right callback.
At least with panic_notifier, you get one line on why the panic occurs. 
With kmsg_dumper you get the whole kmsg buffer, but I don't want to 
throw that at the user. And it's not possible to extract just the panic 
reason from the log.
I think the debug information should go in a QRCode, so you can actually 
report the crash somewhere, and copy/paste the backtrace and other info 
to the bug. I've a PoC for that, but I prefer to have the main drm_panic 
merged before working further on this.

Anyway it's pretty easy to change from one to the other, since the API 
are quite similar. So if we need the complete kmsg log someday, it 
should be easy to switch.

Best regards,

-- 

Jocelyn



More information about the dri-devel mailing list