Hi Maxime,

On 18/03/25 11:17, Maxime Ripard wrote:
Some functions used by the HVS->PV muxing tests can return with EDEADLK,
meaning the entire sequence should be restarted. It's not a fatal error
and we should treat it as a recoverable error, and recover, instead of
failing the test like we currently do.

Fixes: 76ec18dc5afa ("drm/vc4: tests: Add unit test suite for the PV muxing")
Signed-off-by: Maxime Ripard <mrip...@kernel.org>
---
  drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c | 44 ++++++++++++++++++++++++++
  1 file changed, 44 insertions(+)

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 
52c04ef33206bf4f9e21e3c8b7cea932824a67fa..94e05bddb630a79aab189d9bc16f09a9d84ce396
 100644
--- a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c
+++ b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c
@@ -685,20 +685,26 @@ static void drm_vc4_test_pv_muxing(struct kunit *test)
drm_modeset_acquire_init(&ctx, 0); vc4 = priv->vc4;
        drm = &vc4->base;
+
+retry:
        state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
        KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
        for (i = 0; i < params->nencoders; i++) {
                enum vc4_encoder_type enc_type = params->encoders[i];
ret = vc4_mock_atomic_add_output(test, state, enc_type);
+               if (ret == -EDEADLK)
+                       goto retry;
                KUNIT_ASSERT_EQ(test, ret, 0);
        }
ret = drm_atomic_check_only(state);
+       if (ret == -EDEADLK)
+               goto retry;

Shouldn't we call `drm_modeset_backoff()` before retrying (maybe
`drm_atomic_state_clear()` as well)?

Best Regards,
- Maíra

        KUNIT_EXPECT_EQ(test, ret, 0);
KUNIT_EXPECT_TRUE(test,
                          check_fifo_conflict(test, state));

Reply via email to