intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Manasi Navare <manasi.d.navare@intel.com>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 5/5] drm/i915: Implement Link Rate fallback on Link training failure
Date: Fri, 11 Nov 2016 07:56:03 -0800	[thread overview]
Message-ID: <20161111155603.GB22863@intel.com> (raw)
In-Reply-To: <87y40qcq0t.fsf@intel.com>

On Fri, Nov 11, 2016 at 11:41:22AM +0200, Jani Nikula wrote:
> On Thu, 10 Nov 2016, Daniel Vetter <daniel@ffwll.ch> wrote:
> > On Wed, Nov 09, 2016 at 08:42:08PM -0800, Manasi Navare wrote:
> >> @@ -5692,6 +5751,39 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
> >>  	return false;
> >>  }
> >>  
> >> +static void intel_dp_modeset_retry_work_fn(struct work_struct *work)
> >> +{
> >> +	struct intel_connector *intel_connector;
> >> +	struct drm_connector *connector;
> >> +	struct drm_display_mode *mode;
> >> +	bool verbose_prune = true;
> >> +
> >> +	intel_connector = container_of(work, typeof(*intel_connector),
> >> +				       modeset_retry_work);
> >> +	connector = &intel_connector->base;
> >> +
> >> +	/* Grab the locks before changing connector property*/
> >> +	mutex_lock(&connector->dev->mode_config.mutex);
> >> +	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
> >> +		      connector->name);
> >> +	list_for_each_entry(mode, &connector->modes, head) {
> >> +		mode->status = intel_dp_mode_valid(connector,
> >> +						   mode);
> >> +	}
> >> +	drm_mode_prune_invalid(connector->dev, &connector->modes,
> >> +			       verbose_prune);
> >> +
> >> +	/* Set connector link status to BAD and send a Uevent to notify
> >> +	 * userspace to do a modeset.
> >> +	 */
> >> +	intel_dp_set_link_status_property(connector,
> >> +					  DRM_MODE_LINK_STATUS_BAD);
> >> +	mutex_unlock(&connector->dev->mode_config.mutex);
> >> +
> >> +	/* Send Hotplug uevent so userspace can reprobe */
> >> +	drm_kms_helper_hotplug_event(connector->dev);
> >
> > One downside of keeping all the signalling logic here in i915 is that we
> > don't have a good spot to put the kerneldoc for this new link status
> > property within drm_connector.c for others to easily spot. My suggestion
> > would be to extract function with the following rough pseudo-code:
> 
> Thanks for this. I wanted Manasi to keep the work struct and function
> within i915, but I fell short of coming up with this division.
> 
> BR,
> Jani.
> 
>

Jani, so we ar elooking at two functions going in core,
1. that does mode validation and pruning
2. set link status property

These should be in a separate patch right after declaring the
drm connector property, what do you think?

Regards
Manasi

 
> 
> >
> > drm_connector_set_link_status(connector, status)
> > {
> > 	mutex_lock(mode_config.mutex);
> >
> > 	/* what intel_dp_set_link_status_property() does */
> > 	
> > 	mutex_unlock(mode_config.mutex);
> > 	drm_kms_helper_hotplug_event()
> > }
> >
> > Within intel_dp_modeset_retry_work_fn we'd then first need to drop the
> > lock, and then call this function. The lock drop&reacquire is a bit ugly,
> > but:
> > - it doesn't matter from a performance pov, this is a slow, asynchronous
> >   work.
> > - it doesn't matter for correctnes, the only thing we need is to drop the
> >   lock before calling drm_kms_helper_hotplug_event, and that we update the
> >   link status and the mode list before that too.
> > - long term I expect that properties will get separate locks to protect
> >   their values, and restrict mode_config.mutex to just mode probing. Which
> >   means drm_connnector_set_link_status will use a different lock anyway.
> > - it nicely encapsulates stuff imo.
> >
> > Kerneldoc for drm_connector_set_link_status should mention that this needs
> > to be run from some async work item, and ofc have the full explanation
> > (maybe even quote some pseudo-code, see e.g. drm_modeset_lock.c comments)
> > of how this should be used.
> >
> > Since this is late-stage polish definitely wait for more feedback and for
> > the design to fully settle first.
> > -Daniel
> 
> -- 
> Jani Nikula, Intel Open Source Technology Center
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-11-11 15:56 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-10  4:42 [PATCH 0/5] Handle Link Training Failure during modeset Manasi Navare
2016-11-10  4:42 ` [PATCH 1/5] drm: Add a new connector property for link status Manasi Navare
2016-11-10  4:42 ` [PATCH 2/5] drm/i915: Set link status property for DP connector Manasi Navare
2016-11-10  4:42 ` [PATCH 3/5] drm/i915: Update CRTC state if connector link status property changed Manasi Navare
2016-11-10  4:42 ` [PATCH 4/5] drm/i915: Find fallback link rate/lane count Manasi Navare
2016-11-10  4:42 ` [PATCH 5/5] drm/i915: Implement Link Rate fallback on Link training failure Manasi Navare
2016-11-10 20:58   ` [Intel-gfx] " Daniel Vetter
2016-11-11  9:41     ` Jani Nikula
2016-11-11 15:56       ` Manasi Navare [this message]
2016-11-11 14:08     ` [Intel-gfx] " Ville Syrjälä
2016-11-11 15:43       ` Manasi Navare
2016-11-10  5:25 ` ✗ Fi.CI.BAT: failure for Handle Link Training Failure during modeset Patchwork
2016-11-10 18:19 ` [PATCH 0/5] " Jani Nikula
2016-11-10 18:42   ` [Intel-gfx] " Deucher, Alexander
2016-11-10 18:51     ` Cheng, Tony
2016-11-11 14:05       ` Ville Syrjälä
2016-11-11 16:21         ` Cheng, Tony
2016-11-11 16:43           ` Ville Syrjälä
2016-11-11 19:42             ` Cheng, Tony
2016-11-14  7:43               ` Manasi Navare
2016-11-14  8:04                 ` Daniel Vetter
2016-11-14 14:45                   ` Cheng, Tony
2016-11-14 17:51                     ` [Intel-gfx] " Manasi Navare
2016-11-14 20:13                       ` Cheng, Tony
2016-11-15  1:07 ` Harry Wentland
2016-11-15  1:14   ` Manasi Navare

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=20161111155603.GB22863@intel.com \
    --to=manasi.d.navare@intel.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).