Re: [PATCH] drm/vkms: Fix race-condition between the hrtimer and the atomic commit

Pranav Tyagi
2025-06-26T15:10:35Z

On Thu, Jun 26, 2025 at 8:32 PM Maíra Canal <mcanal@igalia.com> wrote:
>
> Hi Pranav,
>
> On 26/06/25 11:22, Pranav Tyagi wrote:
> > From: Maíra Canal <mcanal@igalia.com>
> >
> > [ Upstream commit a0e6a017ab56936c0405fe914a793b241ed25ee0 ]
> >
> > Currently, it is possible for the composer to be set as enabled and then
> > as disabled without a proper call for the vkms_vblank_simulate(). This
> > is problematic, because the driver would skip one CRC output, causing CRC
> > tests to fail. Therefore, we need to make sure that, for each time the
> > composer is set as enabled, a composer job is added to the queue.
> >
> > In order to provide this guarantee, add a mutex that will lock before
> > the composer is set as enabled and will unlock only after the composer
> > job is added to the queue. This way, we can have a guarantee that the
> > driver won't skip a CRC entry.
> >
> > This race-condition is affecting the IGT test "writeback-check-output",
> > making the test fail and also, leaking writeback framebuffers, as the
> > writeback job is queued, but it is not signaled. This patch avoids both
> > problems.
> >
> > [v2]:
> > * Create a new mutex and keep the spinlock across the atomic commit in
> > order to avoid interrupts that could result in deadlocks.
> >
> > [ Backport to 5.15: context cleanly applied with no semantic changes.
> > Build-tested. ]
> >
> > Signed-off-by: Maíra Canal <mcanal@igalia.com>
> > Reviewed-by: Arthur Grillo <arthurgrillo@riseup.net>
> > Signed-off-by: Maíra Canal <mairacanal@riseup.net>
> > Link: https://patchwork.freedesktop.org/patch/msgid/20230523123207.173976-1-mcanal@igalia.com
> > Signed-off-by: Pranav Tyagi <pranav.tyagi03@gmail.com>
>
> This patch violates locking rules and it was reversed a while ago.
> Please, check commit 7908632f2927 ("Revert "drm/vkms: Fix race-condition
> between the hrtimer and the atomic commit"").
>
> Best Regards,
> - Maíra

Thanks for pointing that out.

I missed the revert. I now see that commit 7908632f2927 reversed
this due to locking issues. I’ll drop this backport from 5.15
accordingly.

Regards
Pranav Tyagi