[Intel-gfx] [PATCH 3/3] drm/dp/mst: Track available time slots in DP Multi-Stream Transport Packet

Daniel Vetter daniel at ffwll.ch
Fri Nov 18 08:44:42 UTC 2016


On Fri, Nov 18, 2016 at 06:57:01AM +0000, Chris Wilson wrote:
> On Thu, Nov 17, 2016 at 06:03:48PM -0800, Dhinakaran Pandiyan wrote:
> >  static int drm_dp_init_vcpi(struct drm_dp_mst_topology_mgr *mgr,
> >  			    struct drm_dp_vcpi *vcpi, int pbn)
> >  {
> > -	int num_slots;
> > +	int req_slots;
> >  	int ret;
> >  
> > -	num_slots = DIV_ROUND_UP(pbn, mgr->pbn_div);
> > +	req_slots = DIV_ROUND_UP(pbn, mgr->pbn_div);
> >  
> > -	if (num_slots > mgr->avail_slots)
> > -		return -ENOSPC;
> > +	mutex_lock(&mgr->lock);
> > +	if (req_slots > mgr->avail_slots) {
> > +		ret = -ENOSPC;
> > +		goto out;
> > +	}
> 
> You are not atomically reducing the mgr->avail_slots, leading to
> possible overallocation of multiple streams?

Yup, see my lenghty reply to patch 1 for what needs to be done here to fix
this correctly.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list