Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/vc4: KUnit test leaks modeset locks on KUNIT_ASSERT failure
--

commit d86da181a3f3948d7fa9df62b1551aeb2cabcba4
Author: Maxime Ripard <[email protected]>

drm/vc4: Carry the HVS channel over to created CRTC states

This commit copies the current HVS channel into newly created CRTC states
in vc4_pv_muxing_atomic_check() when a CRTC remains enabled, and adds a
KUnit test covering that path.

> diff --git a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c 
> b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c
> index 7a54f46acff91..c868d2cd1b3db 100644
> --- a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c
> +++ b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c
> @@ -1121,10 +1121,115 @@ 
> drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable_too_many_crtc_state(struct 
> ku

[ ... ]

> +static void
> +drm_test_vc5_pv_muxing_bugs_created_state_keeps_channel(struct kunit *test)
> +{
> +     struct drm_modeset_acquire_ctx ctx;

[ ... ]

> +     drm_modeset_acquire_init(&ctx, 0);
> +
> +     drm = &vc4->base;
> +retry_first:
> +     state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
> +     KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
> +
> +     ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI0);
> +     if (ret == -EDEADLK) {
> +             drm_atomic_commit_clear(state);
> +             ret = drm_modeset_backoff(&ctx);
> +             if (!ret)
> +                     goto retry_first;
> +     }
> +     KUNIT_ASSERT_EQ(test, ret, 0);

[ ... ]

> +     KUNIT_EXPECT_EQ(test, new_vc4_crtc_state->assigned_channel, 
> old_channel);
> +
> +     drm_modeset_drop_locks(&ctx);
> +     drm_modeset_acquire_fini(&ctx);
> +}

[Severity: Low]
Can a failing KUNIT_ASSERT_* in this test leak the modeset locks held in
ctx?

Once vc4_mock_atomic_add_output() or drm_atomic_check_only() acquires
modeset locks into ctx, any subsequent KUNIT_ASSERT_* failure exits the
test kthread directly via kunit_try_catch_throw() without reaching
drm_modeset_drop_locks() and drm_modeset_acquire_fini().

That trips lockdep's held-lock check on thread exit and leaves the locks
linked onto the abandoned ctx.locked list, hitting
WARN_ON(!list_empty(&lock->head)) in drm_modeset_lock_fini() during
KUnit device teardown.

Using KUNIT_EXPECT_* with a jump to a cleanup label would ensure the
locks are released on failure.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=6

Reply via email to