All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Gil Dekel <gildekel@chromium.org>
Cc: intel-gfx@lists.freedesktop.org, seanpaul@chromium.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v4 5/6] drm/i915/dp_link_training: Set all downstream MST ports to BAD before retrying
Date: Fri, 1 Sep 2023 14:55:19 -0400	[thread overview]
Message-ID: <ZPIzl/a60uD4FTRI@intel.com> (raw)
In-Reply-To: <20230824205335.500163-6-gildekel@chromium.org>

On Thu, Aug 24, 2023 at 04:50:20PM -0400, Gil Dekel wrote:
> Before sending a uevent to userspace in order to trigger a corrective
> modeset, we change the failing connector's link-status to BAD. However,
> the downstream MST branch ports are left in their original GOOD state.
> 
> This patch utilizes the drm helper function
> drm_dp_set_mst_topology_link_status() to rectify this and set all
> downstream MST connectors' link-status to BAD before emitting the uevent
> to userspace.
> 
> Signed-off-by: Gil Dekel <gildekel@chromium.org>
> ---
>  drivers/gpu/drm/i915/display/intel_dp.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 42353b1ac487..e8b10f59e141 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -5995,16 +5995,20 @@ static void intel_dp_modeset_retry_work_fn(struct work_struct *work)
>  	struct intel_dp *intel_dp =
>  		container_of(work, typeof(*intel_dp), modeset_retry_work);
>  	struct drm_connector *connector = &intel_dp->attached_connector->base;
> -	drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s]\n", connector->base.id,
> -		    connector->name);
> 
> -	/* Grab the locks before changing connector property*/
> -	mutex_lock(&connector->dev->mode_config.mutex);
> -	/* Set connector link status to BAD and send a Uevent to notify
> -	 * userspace to do a modeset.
> +	/* Set the connector's (and possibly all its downstream MST ports') link
> +	 * status to BAD.
>  	 */
> +	mutex_lock(&connector->dev->mode_config.mutex);
> +	drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] link status %d -> %d\n",
> +		    connector->base.id, connector->name,
> +		    connector->state->link_status, DRM_MODE_LINK_STATUS_BAD);
>  	drm_connector_set_link_status_property(connector,
>  					       DRM_MODE_LINK_STATUS_BAD);
> +	if (intel_dp->is_mst) {
> +		drm_dp_set_mst_topology_link_status(&intel_dp->mst_mgr,
> +						    DRM_MODE_LINK_STATUS_BAD);

Something is weird with the locking here.
I noticed that on patch 3 this new function also gets the same
mutex_lock(&connector->dev->mode_config.mutex);

Since you didn't reach the deadlock, I'm clearly missing something
on the flow. But regardless of what I could be missing, I believe
this is totally not future proof and we will for sure hit dead-lock
cases.

> +	}
>  	mutex_unlock(&connector->dev->mode_config.mutex);
>  	/* Send Hotplug uevent so userspace can reprobe */
>  	drm_kms_helper_connector_hotplug_event(connector);
> --
> Gil Dekel, Software Engineer, Google / ChromeOS Display and Graphics

  reply	other threads:[~2023-09-01 18:55 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-24 20:50 [Intel-gfx] [PATCH v4 0/6] drm/i915/dp_link_training: Define a final failure state when link training fails Gil Dekel
2023-08-24 20:50 ` Gil Dekel
2023-08-24 20:50 ` [Intel-gfx] [PATCH v4 1/6] drm/i915/dp_link_training: Add a final failing state to link training fallback Gil Dekel
2023-08-24 20:50   ` Gil Dekel
2023-09-01 18:57   ` [Intel-gfx] " Rodrigo Vivi
2023-09-01 22:51     ` Gil Dekel
2023-08-24 20:50 ` [Intel-gfx] [PATCH v4 2/6] drm/i915/dp_link_training: Add a final failing state to link training fallback for MST Gil Dekel
2023-08-24 20:50   ` Gil Dekel
2023-08-24 20:50 ` [Intel-gfx] [PATCH v4 3/6] drm/dp_mst: Add drm_dp_set_mst_topology_link_status() Gil Dekel
2023-08-24 20:50   ` Gil Dekel
2023-08-30 21:32   ` [Intel-gfx] " Lyude Paul
2023-08-30 21:32     ` Lyude Paul
2023-08-24 20:50 ` [Intel-gfx] [PATCH v4 4/6] drm/i915: Move DP modeset_retry_work into intel_dp Gil Dekel
2023-08-24 20:50   ` Gil Dekel
2023-08-24 20:50 ` [Intel-gfx] [PATCH v4 5/6] drm/i915/dp_link_training: Set all downstream MST ports to BAD before retrying Gil Dekel
2023-08-24 20:50   ` Gil Dekel
2023-09-01 18:55   ` Rodrigo Vivi [this message]
2023-09-01 21:13     ` [Intel-gfx] " Gil Dekel
2023-09-01 23:24       ` Gil Dekel
2023-08-24 20:50 ` [Intel-gfx] [PATCH v4 6/6] drm/i915/dp_link_training: Emit a link-status=Bad uevent with trigger property Gil Dekel
2023-08-24 20:50   ` Gil Dekel
2023-09-01 23:22   ` [Intel-gfx] " Manasi Navare
2023-09-01 23:22     ` Manasi Navare
2023-08-24 22:10 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/dp_link_training: Define a final failure state when link training fails (rev2) Patchwork
2023-08-24 22:10 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-08-24 22:29 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2023-08-30 21:41 ` [Intel-gfx] [PATCH v4 0/6] drm/i915/dp_link_training: Define a final failure state when link training fails Lyude Paul
2023-08-30 21:41   ` Lyude Paul
2023-09-01 18:38   ` [Intel-gfx] " Rodrigo Vivi
2023-09-01 19:05     ` Rodrigo Vivi
2023-09-01 19:25       ` Gil Dekel

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=ZPIzl/a60uD4FTRI@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gildekel@chromium.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=seanpaul@chromium.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.