Re: [PATCH] media: mediatek: vcodec: Initialize context lock before firmware setup
From: Nicolas Dufresne
Date: Sun Oct 04 2026 - 09:18:36 EST
Le dimanche 04 octobre 2026 à 20:39 +0800, Runyu Xiao a écrit :
> Hi Nicolas,
>
> On Sun, 4 Oct 2026 07:17:43 -0400, Nicolas Dufresne wrote:
>
> > The very first place the lock will be taken is in _open() and that cannot
> > happen before video_register_device(), which is kept last. Please
> > demonstrate what the issue you are suggesting if you'd like to see this
> > merged.
>
> The normal encoder open path is as you describe. On VPU-backed systems,
> firmware setup registers the encoder reset callback before dev_ctx_lock is
> initialized. A timeout on the shared VPU while another client is active
> queues reset work, which invokes registered callbacks. If that work runs
> before spin_lock_init(), the callback takes the uninitialized lock. The
> context list is initialized but empty during probe, so I cannot claim list
> corruption or a user-visible failure. With CONFIG_DEBUG_SPINLOCK, the
> zeroed lock fails the magic check.
Then please make a v2 that includes the mention of the encoder path, and that
includes the debug output when CONFIG_DEBUG_SPINLOCK in your message. That will
show that you actually tested it. Its extra effort, but please understand that I
receive dozen of hypothetical fixes (sometimes multiple time the same fix made
by LLM users that may or may not follow the list).
cheers,
Nicolas
>
> Thanks,
> Runyu
Attachment:
signature.asc
Description: This is a digitally signed message part