public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org,
	Joonas Lahtinen <joonas.lahtinen@intel.com>,
	Jon Bloomfield <jon.bloomfield@intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 2/7] igt: Use COND_BBEND for busy spinning on gen9
Date: Wed, 13 Nov 2019 19:19:06 +0200	[thread overview]
Message-ID: <87lfsj7kz9.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <157366095141.22201.144353485906370147@skylake-alporthouse-com>

Chris Wilson <chris@chris-wilson.co.uk> writes:

> Quoting Mika Kuoppala (2019-11-13 15:49:08)
>> From: Jon Bloomfield <jon.bloomfield@intel.com>
>> 
>> gen9+ introduces a cmdparser for the BLT engine which copies the
>> incoming BB to a kmd owned buffer for submission (to prevent changes
>> being made after the bb has been safely scanned). This breaks the
>> spin functionality because it relies on changing the submitted spin
>> buffers in order to terminate them.
>> 
>> Instead, for gen9+, we change the semantics by introducing a COND_BB_END
>> into the infinite loop, to wait until a memory flag (in anothe bo) is
>> cleared.
>> 
>> v2: Correct nop length to avoid overwriting bb_end instr when using
>>     a dependency bo (cork)
>> v3: fix conflicts on igt_dummyload (Mika)
>> v4: s/bool running/uint32_t running, fix r->delta (Mika)
>> v5: remove overzealous assert (Mika)
>> v6: rebase on top of lib changes (Mika)
>> v7: rework on top of public igt lib changes (Mika)
>> v8: rebase
>> 
>> Signed-off-by: Jon Bloomfield <jon.bloomfield@intel.com> (v2)
>> Cc: Joonas Lahtinen <joonas.lahtinen@intel.com>
>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>> Cc: Mika Kuoppala <mika.kuoppala@intel.com>
>> Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
>> ---
>>  lib/i830_reg.h                          |  2 +-
>>  lib/igt_dummyload.c                     | 46 +++++++++++++++++++++++--
>>  lib/igt_dummyload.h                     |  3 ++
>>  lib/intel_reg.h                         |  3 ++
>>  tests/i915/gem_double_irq_loop.c        |  2 --
>>  tests/i915/gem_write_read_ring_switch.c |  2 +-
>>  6 files changed, 52 insertions(+), 6 deletions(-)
>> 
>> diff --git a/lib/i830_reg.h b/lib/i830_reg.h
>> index a57691c7..41020256 100644
>> --- a/lib/i830_reg.h
>> +++ b/lib/i830_reg.h
>> @@ -43,7 +43,7 @@
>>  /* broadwater flush bits */
>>  #define BRW_MI_GLOBAL_SNAPSHOT_RESET   (1 << 3)
>>  
>> -#define MI_COND_BATCH_BUFFER_END       (0x36<<23 | 1)
>> +#define MI_COND_BATCH_BUFFER_END       (0x36 << 23)
>>  #define MI_DO_COMPARE                  (1<<21)
>>  
>>  #define MI_BATCH_BUFFER_END    (0xA << 23)
>> diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
>> index c079bd04..a88c8582 100644
>> --- a/lib/igt_dummyload.c
>> +++ b/lib/igt_dummyload.c
>> @@ -130,7 +130,15 @@ emit_recursive_batch(igt_spin_t *spin,
>>         spin->poll_handle = poll->handle;
>>         execbuf->buffer_count++;
>>  
>> -       if (opts->flags & IGT_SPIN_POLL_RUN) {
>> +       /*
>> +        * For gen9+ we use a conditional loop rather than an
>> +        * infinite loop, because we are unable to modify the
>> +        * BB's once they have been scanned by the cmdparser
>> +        * We share the poll buffer for the conditional test
>> +        * and is always the first buffer in the batch list
>> +        */
>> +
>> +       if (gen >= 9 || (opts->flags & IGT_SPIN_POLL_RUN)) {
>
> Nah, you could just sample the batch buffer rather than always adding
> the poll buffer (since the cmdparser implicitly creates the second buffer
> for you). Using the comparison value of MI_BATCH_BUFFER_END you wouldn't
> even have to worry about altering callers.

That is a neat trick! bb start is greater than bb end so
we have that opportunity. Might lead also to much less fixing
on mutables.

-Mika
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-11-13 17:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-13 15:49 [Intel-gfx] [PATCH i-g-t 1/7] lib/igt_dummyload: Send batch as first Mika Kuoppala
2019-11-13 15:49 ` [igt-dev] [PATCH i-g-t 2/7] igt: Use COND_BBEND for busy spinning on gen9 Mika Kuoppala
2019-11-13 16:02   ` [Intel-gfx] " Chris Wilson
2019-11-13 17:19     ` Mika Kuoppala [this message]
2019-11-13 15:49 ` [igt-dev] [PATCH i-g-t 3/7] lib/i915: Add query to detect if engine accepts only ro batches Mika Kuoppala
2019-11-13 23:44   ` [igt-dev] [Intel-gfx] " Chris Wilson
2019-11-13 23:55   ` Chris Wilson
2019-11-13 15:49 ` [igt-dev] [PATCH i-g-t 4/7] tests/i915: Skip if secure batches is not available Mika Kuoppala
2019-11-13 15:49 ` [igt-dev] [PATCH i-g-t 5/7] Add tests/gem_blt_parse Mika Kuoppala
2019-11-13 16:14   ` Chris Wilson
2019-11-13 16:37     ` Mika Kuoppala
2019-11-14  8:41   ` Daniel Vetter
2019-11-13 15:49 ` [igt-dev] [PATCH i-g-t 6/7] lib/igt_aux: Add helper to query suspend-to-mem modes Mika Kuoppala
2019-11-13 15:49 ` [Intel-gfx] [PATCH i-g-t 7/7] test/i915: Add i915_rc6_ctx_corruption Mika Kuoppala
2019-11-13 16:18   ` [igt-dev] " Chris Wilson
2019-11-13 15:57 ` [Intel-gfx] [PATCH i-g-t 1/7] lib/igt_dummyload: Send batch as first Chris Wilson

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=87lfsj7kz9.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jon.bloomfield@intel.com \
    --cc=joonas.lahtinen@intel.com \
    --cc=rodrigo.vivi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox