intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Manasi Navare <manasi.d.navare@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 5/5] drm/i915: Implement Link Rate fallback on Link training failure
Date: Fri, 11 Nov 2016 07:43:18 -0800	[thread overview]
Message-ID: <20161111154318.GA22863@intel.com> (raw)
In-Reply-To: <20161111140826.GI31595@intel.com>

On Fri, Nov 11, 2016 at 04:08:26PM +0200, Ville Syrjälä wrote:
> On Thu, Nov 10, 2016 at 09:58:31PM +0100, Daniel Vetter 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:
> > 
> > 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:
> 
> The mode re-validation should be done in the core as well. Not sure if
> we could just stuff it all into one place, and then there would be no
> need for any lock dropping.
>

I can move the moderevalidation to the core as well, but then the function name
has to be something else than just drm_set_link_status_property(),cant think
of a name that combines mode revalidation and setting link sttaus property,
any suggestions?

Manasi 
> > - 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
> > -- 
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Ville Syrjälä
> Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

Thread overview: 35+ 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       ` [Intel-gfx] " Manasi Navare
2016-11-11 14:08     ` Ville Syrjälä
2016-11-11 15:43       ` Manasi Navare [this message]
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
  -- strict thread matches above, loose matches on Subject: below --
2016-11-15  3:13 [PATCH 0/5] Handle link training failure " Manasi Navare
2016-11-15  3:13 ` [PATCH 5/5] drm/i915: Implement Link Rate fallback on Link training failure Manasi Navare
2016-11-16 17:34   ` Manasi Navare
2016-11-17 12:49   ` Jani Nikula
2016-11-17 19:55     ` Manasi Navare
2016-11-18  7:13 [PATCH 0/5] Link Training failure handling during modeset Manasi Navare
2016-11-18  7:13 ` [PATCH 5/5] drm/i915: Implement Link Rate fallback on Link training failure Manasi Navare
2016-11-18  7:29   ` Manasi Navare
2016-11-18 13:31     ` Jani Nikula
2016-11-18 15:29       ` Manasi Navare
2016-11-19  2:58 [PATCH 0/5] Clean series for Link training failure handling Manasi Navare
2016-11-19  2:59 ` [PATCH 5/5] drm/i915: Implement Link Rate fallback on Link training failure 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=20161111154318.GA22863@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=ville.syrjala@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).