diff mbox series

drm/i915/execlists: Prevent merging requests with conflicting flags

Message ID 20191009092852.27048-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series drm/i915/execlists: Prevent merging requests with conflicting flags | expand

Commit Message

Chris Wilson Oct. 9, 2019, 9:28 a.m. UTC
We set out-of-bound parameters inside the i915_requests.flags field,
such as disabling preemption or marking the end-of-context. We should
not coalesce consecutive requests if they have differing instructions
as we only inspect the last active request in a context. Thus if we
allow a later request to be merged into the same execution context, it
will mask any of the earlier flags.

References: 2a98f4e65bba ("drm/i915: add infrastructure to hold off preemption on a request")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_lrc.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Lionel Landwerlin Oct. 9, 2019, 1:56 p.m. UTC | #1
On 09/10/2019 12:28, Chris Wilson wrote:
> We set out-of-bound parameters inside the i915_requests.flags field,
> such as disabling preemption or marking the end-of-context. We should
> not coalesce consecutive requests if they have differing instructions
> as we only inspect the last active request in a context. Thus if we
> allow a later request to be merged into the same execution context, it
> will mask any of the earlier flags.
>
> References: 2a98f4e65bba ("drm/i915: add infrastructure to hold off preemption on a request")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>


Oops, I missed your patch :(

I guess this works too, potentially providing better timeslicing than 
the update I made.

I'll give it a go later, but it sounds like it should work.


Thanks,


-Lionel


> ---
>   drivers/gpu/drm/i915/gt/intel_lrc.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
> index 6db762c509b8..2e5192a9e796 100644
> --- a/drivers/gpu/drm/i915/gt/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
> @@ -1233,6 +1233,9 @@ static bool can_merge_rq(const struct i915_request *prev,
>   	if (i915_request_completed(next))
>   		return true;
>   
> +	if (unlikely(prev->flags ^ next->flags))
> +		return false;
> +
>   	if (!can_merge_ctx(prev->hw_context, next->hw_context))
>   		return false;
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
index 6db762c509b8..2e5192a9e796 100644
--- a/drivers/gpu/drm/i915/gt/intel_lrc.c
+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
@@ -1233,6 +1233,9 @@  static bool can_merge_rq(const struct i915_request *prev,
 	if (i915_request_completed(next))
 		return true;
 
+	if (unlikely(prev->flags ^ next->flags))
+		return false;
+
 	if (!can_merge_ctx(prev->hw_context, next->hw_context))
 		return false;