Re: [PATCH v4 04/14] drm/msm: order the display snapshot sources around its worker

From: Konrad Dybcio

Date: Mon Nov 30 2026 - 03:46:35 EST


On 11/27/26 8:44 PM, Dmitry Baryshkov wrote:
> The display snapshot work is queued on kms->dump_worker by the IOMMU
> fault handler of the KMS and by the DPU interrupt handlers, but neither
> of them follows the lifetime of the worker:
>
> - the fault handler is registered by msm_kms_init_vm() in the middle of
> kms_init() and is never unregistered, so a fault during kms_init(),
> or in the error path of msm_drm_kms_init(), dumps a KMS which is
> still being set up or already being torn down, and a fault after
> msm_drm_kms_uninit() queues the work on a destroyed worker;
>
> - msm_drm_kms_uninit() destroys the worker before it uninstalls the
> interrupt handlers, so an underrun or a timeout in between queues the
> work on a destroyed worker as well.
>
> Start the sources only once the KMS is fully set up and stop them before
> the worker goes away: register the fault handler as the last step of
> msm_drm_kms_init(), unregister it first thing in msm_drm_kms_uninit(),
> and destroy the worker after the interrupts have been uninstalled but
> before the KMS itself, so that the dumps still pending run against an
> intact KMS.
>
> A fault during kms_init() therefore no longer produces a dump; the KMS
> is not complete enough to describe one at that point. The handler is
> cleared with the kms argument left in place, so that a fault handler
> already running still gets a valid one.
>
> Fixes: 2ec5b3dc18ba ("drm/msm: add disp snapshot points across dpu driver")
> Fixes: eabba31a839a ("drm/msm: register a fault handler for display mmu faults")
> Assisted-by: LLM
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
> ---

Sashiko has concerns

Konrad