All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Gordon <david.s.gordon@intel.com>
To: Yu Dai <yu.dai@intel.com>,
	Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: daniel.vetter@ffwll.ch
Subject: Re: [PATCH] drm/i915/guc: Set init value for cached work queue head
Date: Mon, 15 Feb 2016 15:01:27 +0000	[thread overview]
Message-ID: <56C1E847.4090707@intel.com> (raw)
In-Reply-To: <56BB9E0B.8040805@intel.com>

On 10/02/16 20:31, Yu Dai wrote:
>
>
> On 02/10/2016 09:30 AM, Tvrtko Ursulin wrote:
>> Hi,
>>
>> On 10/02/16 00:05, yu.dai@intel.com wrote:
>> > From: Alex Dai <yu.dai@intel.com>
>> >
>> > The cached work queue header pointer is set to last byte of work
>> > queue buffer. It will make sure the whole work queue buffer is
>> > available after coming back from reset or init.

[snip]

>> > @@ -730,6 +728,8 @@ static struct i915_guc_client
>> *guc_client_alloc(struct drm_device *dev,
>> >       client->client_obj = obj;
>> >       client->wq_offset = GUC_DB_SIZE;
>> >       client->wq_size = GUC_WQ_SIZE;
>> > +    client->wq_head = GUC_WQ_SIZE - 1;
>> > +    client->wq_tail = 0;
>> >
>> >       client->doorbell_offset = select_doorbell_cacheline(guc);
>>
>> This one I can't really figure out without I suppose knowing more about
>> the code design. How come it was OK when it was zero (apart after reset)?
>>
>> The value is otherwise only updated from the GuC shared page and a
>> driver does not appear to modify it. Perhaps just a better commit
>> message to explain things?
>
> The way this kernel CIRC_xx works is it leaves one byte free and treat
> head == tail case as empty. So, there won't be a problem if this head
> happens to be 0. If it comes with some random number between [1,
> sizeof(WQ item)], there will be a SW dead looping in driver.

Actually, I think it works like this:

if both wq_tail and wq_head (which is a CACHE of the GuC's WQ tail) are 
initialised to 0, the driver thinks the WQ is empty, which is correct at 
startup but not necessarily after a GPU reset.

By initialising them as above, the driver will at first think the WQ is 
FULL, and will then refresh the actual value from the GuC's process 
descriptor. This should ensure that it doesn't assume more WQ space than 
the GuC thinks there is.

It's very much the same sort of issue as (re)initialising the CSB 
pointers after a reset, because the CS h/w (or in this case the GuC 
firmware) has internally set them to a new value and the driver needs to 
get in sync.

Anyway all of this is superseded by Alex's later patch that leaves the 
client permanently kmapped, 'cos that gets rid of wq_head entirely :)

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

      reply	other threads:[~2016-02-15 15:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-10  0:05 [PATCH] drm/i915/guc: Set init value for cached work queue head yu.dai
2016-02-10  8:49 ` ✗ Fi.CI.BAT: warning for " Patchwork
2016-02-10 17:30 ` [PATCH] " Tvrtko Ursulin
2016-02-10 20:31   ` Yu Dai
2016-02-15 15:01     ` Dave Gordon [this message]

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=56C1E847.4090707@intel.com \
    --to=david.s.gordon@intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=tvrtko.ursulin@linux.intel.com \
    --cc=yu.dai@intel.com \
    /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.