All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Harrison <John.C.Harrison@Intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, Intel-GFX@Lists.FreeDesktop.Org
Subject: Re: [PATCH v8 1/6] drm/i915: Add per context timelines to fence object
Date: Fri, 13 May 2016 10:16:17 +0100	[thread overview]
Message-ID: <57359B61.5000800@Intel.com> (raw)
In-Reply-To: <20160513073909.GH23271@nuc-i3427.alporthouse.com>

On 13/05/2016 08:39, Chris Wilson wrote:
> On Thu, May 12, 2016 at 10:06:31PM +0100, John.C.Harrison@Intel.com wrote:
>> From: John Harrison <John.C.Harrison@Intel.com>
>>
>> The fence object used inside the request structure requires a sequence
>> number. Although this is not used by the i915 driver itself, it could
>> potentially be used by non-i915 code if the fence is passed outside of
>> the driver. This is the intention as it allows external kernel drivers
>> and user applications to wait on batch buffer completion
>> asynchronously via the dma-buff fence API.
>>
>> To ensure that such external users are not confused by strange things
>> happening with the seqno, this patch adds in a per context timeline
>> that can provide a guaranteed in-order seqno value for the fence. This
>> is safe because the scheduler will not re-order batch buffers within a
>> context - they are considered to be mutually dependent.
>>
>> v2: New patch in series.
>>
>> v3: Renamed/retyped timeline structure fields after review comments by
>> Tvrtko Ursulin.
>>
>> Added context information to the timeline's name string for better
>> identification in debugfs output.
>>
>> v5: Line wrapping and other white space fixes to keep style checker
>> happy.
>>
>> v7: Updated to newer nightly (lots of ring -> engine renaming).
>>
>> v8: Moved to earlier in patch series so no longer needs to remove the
>> quick hack timeline that was being added before.
>>
>> For: VIZ-5190
>> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
>> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> ---
>>   drivers/gpu/drm/i915/i915_drv.h         | 14 ++++++++++++
>>   drivers/gpu/drm/i915/i915_gem.c         | 40 +++++++++++++++++++++++++++++++++
>>   drivers/gpu/drm/i915/i915_gem_context.c | 14 ++++++++++++
>>   drivers/gpu/drm/i915/intel_lrc.c        |  8 +++++++
>>   4 files changed, 76 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
>> index d5496ab..520480b 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.h
>> +++ b/drivers/gpu/drm/i915/i915_drv.h
>> @@ -818,6 +818,19 @@ struct i915_ctx_hang_stats {
>>   	bool banned;
>>   };
>>   
>> +struct i915_fence_timeline {
>> +	char        name[32];
>> +	unsigned    fence_context;
>> +	unsigned    next;
>> +
>> +	struct intel_context *ctx;
>> +	struct intel_engine_cs *engine;
>> +};
>> +
>> +int i915_create_fence_timeline(struct drm_device *dev,
>> +			       struct intel_context *ctx,
>> +			       struct intel_engine_cs *ring);
>> +
>>   /* This must match up with the value previously used for execbuf2.rsvd1. */
>>   #define DEFAULT_CONTEXT_HANDLE 0
>>   
>> @@ -869,6 +882,7 @@ struct intel_context {
>>   		u64 lrc_desc;
>>   		uint32_t *lrc_reg_state;
>>   		bool initialised;
>> +		struct i915_fence_timeline fence_timeline;
> This is still fundamentally wrong. This i915_fence_timeline is both the
> fence context and timeline. Our timelines are singular per vm, with a
> fence context under each timeline per engine.
As I said last time you mentioned 'per vm', please explain. Where does a 
virtual machine come in? Or is that not what you mean? What is the 
purpose of having multiple fence contexts within a single timeline? It 
will stop external uses attempting to combine fences but it won't stop 
them from actually being out of order. The timeline needs to be per 
hardware context not simply per engine because the whole point is that 
requests should not be re-ordered once they have been allocated a point 
on a timeline. However, the purpose of the scheduler (which is what this 
series is preparation for) is to re-order requests between contexts. 
Thus the timeline must be per context to prevent requests ending up with 
out of order completions.


> Please complete the legacy/execlists unification first so that we can
> have timelines work correctly for the whole driver.
No. That is a much larger task that people are working towards. However, 
we urgently need a scheduler for specific customers to use right now. 
That means we need to get something working right now not in some random 
number of years time. If an intermediate step is less than perfect but 
still functional that is better than not having anything at all.

> -Chris
>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-05-13  9:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-12 21:06 [PATCH v8 0/6] Convert requests to use struct fence John.C.Harrison
2016-05-12 21:06 ` [PATCH v8 1/6] drm/i915: Add per context timelines to fence object John.C.Harrison
2016-05-13  7:39   ` Chris Wilson
2016-05-13  9:16     ` John Harrison [this message]
2016-05-18 12:22       ` Maarten Lankhorst
2016-05-18 12:49         ` John Harrison
2016-05-18 13:20           ` Maarten Lankhorst
2016-05-12 21:06 ` [PATCH v8 2/6] drm/i915: Convert requests to use struct fence John.C.Harrison
2016-05-12 21:06 ` [PATCH v8 3/6] drm/i915: Removed now redundant parameter to i915_gem_request_completed() John.C.Harrison
2016-05-12 21:06 ` [PATCH v8 4/6] drm/i915: Interrupt driven fences John.C.Harrison
2016-05-13  7:27   ` Chris Wilson
2016-05-13  9:19     ` John Harrison
2016-05-19  9:47       ` Chris Wilson
2016-05-19  9:24   ` Maarten Lankhorst
2016-05-12 21:06 ` [PATCH v8 5/6] drm/i915: Updated request structure tracing John.C.Harrison
2016-05-12 21:06 ` [PATCH v8 6/6] drm/i915: Cache last IRQ seqno to reduce IRQ overhead John.C.Harrison
2016-05-13  7:41   ` Chris Wilson
2016-05-12 21:10 ` ✗ Ro.CI.BAT: failure for Convert requests to use struct fence (rev5) Patchwork
2016-05-13  7:44 ` [PATCH v8 0/6] Convert requests to use struct fence Chris Wilson
2016-05-13 10:11   ` John Harrison

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=57359B61.5000800@Intel.com \
    --to=john.c.harrison@intel.com \
    --cc=Intel-GFX@Lists.FreeDesktop.Org \
    --cc=chris@chris-wilson.co.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.