On Mon, Jun 22, 2015 at 03:25:06PM +0530, sourab.gupta@xxxxxxxxx wrote: > +void i915_gen_pmu_wait_gpu(struct drm_i915_private *dev_priv) > +{ > + struct drm_i915_ts_queue_header *hdr = > + (struct drm_i915_ts_queue_header *) > + dev_priv->gen_pmu.buffer.addr; > + struct drm_i915_ts_node *first_node, *node; > + int head, tail, num_nodes, ret; > + struct drm_i915_gem_request *req; > + > + first_node = (struct drm_i915_ts_node *) > + ((char *)hdr + hdr->data_offset); > + num_nodes = (hdr->size_in_bytes - hdr->data_offset) / > + sizeof(*node); > + > + tail = hdr->node_count; > + head = dev_priv->gen_pmu.buffer.head; > + > + /* wait for all requests to complete*/ > + while ((head % num_nodes) != (tail % num_nodes)) { > + node = &first_node[head % num_nodes]; > + req = node->node_info.req; > + if (req) { > + if (!i915_gem_request_completed(req, true)) { > + ret = i915_wait_request(req); > + if (ret) > + DRM_DEBUG_DRIVER( > + "gen pmu: failed to wait\n"); > + } > + i915_gem_request_assign(&node->node_info.req, NULL); > + } > + head++; > + } You can, sorry must, rewrite this to avoid the struct mutex, and handle the *likely* errors correctly, and even remove the superfluous i915_gem_request_completed. -Chris -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx