dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Cristian Ciocaltea" <cristian.ciocaltea@collabora.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 25/25] drm/tests: probe-helper: Add .force_ctx() callback coverage
Date: Sat, 14 Nov 2026 18:28:22 +0000	[thread overview]
Message-ID: <sashiko-outbox-214902@kernel.org> (raw)
In-Reply-To: <20261114-drm-conn-hdmi-cleanup-v1-25-20e8a33a2286@collabora.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/tests: unhandled -EDEADLK injection in
  drm_probe_helper_contender_fn()
--

commit d28b5fe04c94cb62864f25a529c3f378922f36a4
Author: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>

drm/tests: probe-helper: Add .force_ctx() callback coverage

This commit adds KUnit tests for the .force_ctx() connector helper
callback, including deadlock backoff handling using a contender kthread.

> diff --git a/drivers/gpu/drm/tests/drm_probe_helper_test.c b/drivers/gpu/drm/tests/drm_probe_helper_test.c
> index ebc0392585e72..5d7dc47255181 100644
> --- a/drivers/gpu/drm/tests/drm_probe_helper_test.c
> +++ b/drivers/gpu/drm/tests/drm_probe_helper_test.c
[ ... ]
> @@ -212,6 +225,289 @@ static struct kunit_suite drm_test_connector_helper_tv_get_modes_suite = {
>  
>  kunit_test_suite(drm_test_connector_helper_tv_get_modes_suite);
>  
> +/*
> + * Runs an acquire context older than the probe one, which first takes @lock,
> + * then waits to be told to also request the connection_mutex held by the
> + * probe context.  Being older, it wounds the probe context, which will get
> + * -EDEADLK as soon as it tries to take @lock.
> + */
> +struct drm_probe_helper_contender {
> +	struct drm_device *drm;
> +	struct drm_modeset_lock lock;
> +	struct completion locked;
> +	struct completion go;
> +	struct completion done;
> +	int ret;
> +};
> +
> +static int drm_probe_helper_contender_fn(void *data)
> +{
> +	struct drm_probe_helper_contender *contender = data;
> +	struct drm_modeset_acquire_ctx ctx;
> +
> +	drm_modeset_acquire_init(&ctx, 0);
> +
> +	contender->ret = drm_modeset_lock(&contender->lock, &ctx);
> +	complete(&contender->locked);
> +
> +	if (!contender->ret) {
> +		if (wait_for_completion_timeout(&contender->go, 5 * HZ))
> +			contender->ret =
> +				drm_modeset_lock(&contender->drm->mode_config.connection_mutex,
> +						 &ctx);
> +		else
> +			contender->ret = -ETIMEDOUT;
> +	}
> +
> +	drm_modeset_drop_locks(&ctx);

[Severity: Medium]
Can drm_modeset_lock(&contender->drm->mode_config.connection_mutex, &ctx)
return -EDEADLK when CONFIG_DEBUG_WW_MUTEX_SLOWPATH is enabled?

Acquiring connection_mutex is the second lock in ctx (ctx.ww_ctx.acquired
becomes 2), so ww_mutex_lock() runs ww_mutex_deadlock_injection().  When
(ctx.ww_ctx.stamp & 0xf) == 0, it injects -EDEADLK after the probe
context backs off and releases connection_mutex, setting ctx.contended.

Because drm_probe_helper_contender_fn() does not handle -EDEADLK,
drm_modeset_drop_locks(&ctx) hits WARN_ON(ctx->contended) and
drm_test_probe_helper_force_ctx_deadlock() fails KUNIT_ASSERT_EQ(test,
contender->ret, 0).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261114-drm-conn-hdmi-cleanup-v1-0-20e8a33a2286@collabora.com?part=25

      reply	other threads:[~2026-11-14 18:28 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14 18:03 [PATCH 00/25] drm: HDMI connector API cleanup and HDMI 2.0 test coverage Cristian Ciocaltea
2026-11-14 18:03 ` [PATCH 01/25] video/hdmi: Copy SPD vendor/product with strtomem_pad() Cristian Ciocaltea
2026-11-14 18:15   ` sashiko-bot
2026-11-14 18:03 ` [PATCH 02/25] video/hdmi: Define SPD InfoFrame vendor/product field lengths Cristian Ciocaltea
2026-11-14 18:03 ` [PATCH 03/25] drm/display: hdmi-state-helper: Drop drm_atomic_helper_connector_hdmi_force() Cristian Ciocaltea
2026-11-14 18:03 ` [PATCH 04/25] drm/display: hdmi-state-helper: Reject connectors lacking HDMI funcs Cristian Ciocaltea
2026-11-14 18:03 ` [PATCH 05/25] drm/tests: connector: Convert to drmm_connector_hdmi_init() Cristian Ciocaltea
2026-11-14 18:03 ` [PATCH 06/25] drm/tests: hdmi: " Cristian Ciocaltea
2026-11-14 18:14   ` sashiko-bot
2026-11-14 18:03 ` [PATCH 07/25] drm/connector: Remove drmm_connector_hdmi_ini2() Cristian Ciocaltea
2026-11-14 18:03 ` [PATCH 08/25] drm/connector: Drop redundant hdmi vendor/product fields Cristian Ciocaltea
2026-11-14 18:03 ` [PATCH 09/25] drm/connector: Drop redundant hdmi supported_formats field Cristian Ciocaltea
2026-11-14 18:03 ` [PATCH 10/25] drm/connector: Drop redundant max_bpc field Cristian Ciocaltea
2026-11-14 18:03 ` [PATCH 11/25] drm/connector: Use the SPD InfoFrame field length defines Cristian Ciocaltea
2026-11-14 18:03 ` [PATCH 12/25] drm/connector: Fix comment in drmm_connector_hdmi_init() Cristian Ciocaltea
2026-11-14 18:03 ` [PATCH 13/25] drm/tests: edid: Fix conformity for 1080p+4K YUV420 200MHz EDID Cristian Ciocaltea
2026-11-14 18:03 ` [PATCH 14/25] drm/tests: edid: Fix conformity for 4K RGB/YUV 340MHz EDID Cristian Ciocaltea
2026-11-14 18:03 ` [PATCH 15/25] drm/tests: edid: Add 4K@60Hz EDID with 600MHz TMDS Cristian Ciocaltea
2026-11-14 18:03 ` [PATCH 16/25] drm/tests: connector: Add HDMI max_tmds_char_rate init coverage Cristian Ciocaltea
2026-11-14 18:03 ` [PATCH 17/25] drm/tests: connector: Add HDMI source-side scrambler coverage Cristian Ciocaltea
2026-11-14 18:03 ` [PATCH 18/25] drm/tests: hdmi: Cover mode validation against connector max_tmds_char_rate Cristian Ciocaltea
2026-11-14 18:03 ` [PATCH 19/25] drm/tests: hdmi: Verify scrambler_needed computation Cristian Ciocaltea
2026-11-14 18:03 ` [PATCH 20/25] drm/tests: hdmi: Add SPD InfoFrame vendor/product coverage Cristian Ciocaltea
2026-11-14 18:03 ` [PATCH 21/25] drm/tests: hdmi: Add HDMI 2.0 scrambling helpers coverage Cristian Ciocaltea
2026-11-14 18:21   ` sashiko-bot
2026-11-14 18:03 ` [PATCH 22/25] drm/tests: hdmi: Verify SCDC resync on hotplug Cristian Ciocaltea
2026-11-14 18:22   ` sashiko-bot
2026-11-14 18:03 ` [PATCH 23/25] drm/tests: bridge: Set supported HDMI version Cristian Ciocaltea
2026-11-14 18:14   ` sashiko-bot
2026-11-14 18:03 ` [PATCH 24/25] drm/tests: bridge: Add HDMI 2.0 bridge connector coverage Cristian Ciocaltea
2026-11-14 18:03 ` [PATCH 25/25] drm/tests: probe-helper: Add .force_ctx() callback coverage Cristian Ciocaltea
2026-11-14 18:28   ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-214902@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=cristian.ciocaltea@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox