[Intel-gfx] [PATCH 3/3] drm/dp/mst: Track available time slots in DP Multi-Stream Transport Packet
Chris Wilson
chris at chris-wilson.co.uk
Fri Nov 18 06:57:01 UTC 2016
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?
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list