public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/4] drm/i915: Fix serialisation of pipecontrol write vs semaphore signal
Date: Thu, 14 Apr 2016 17:29:31 +0300	[thread overview]
Message-ID: <20160414142931.GP4329@intel.com> (raw)
In-Reply-To: <20160411090628.GE31938@nuc-i3427.alporthouse.com>

On Mon, Apr 11, 2016 at 10:06:28AM +0100, Chris Wilson wrote:
> On Mon, Apr 11, 2016 at 11:34:54AM +0300, Ville Syrjälä wrote:
> > On Sat, Apr 09, 2016 at 11:14:44AM +0100, Chris Wilson wrote:
> > > In order for the MI_SEMAPHORE_SIGNAL command to wait until after the
> > > pipecontrol writing the signal value is complete, we have to pause the
> > > CS inside the PIPE_CONTROL with the CS_STALL bit.
> > > 
> > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > ---
> > >  drivers/gpu/drm/i915/intel_ringbuffer.c | 3 +--
> > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> > > index 556924ee47f9..62d09cf2ea8f 100644
> > > --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> > > +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> > > @@ -1301,7 +1301,7 @@ static int gen8_rcs_signal(struct drm_i915_gem_request *signaller_req,
> > >  		intel_ring_emit(signaller, GFX_OP_PIPE_CONTROL(6));
> > >  		intel_ring_emit(signaller, PIPE_CONTROL_GLOBAL_GTT_IVB |
> > >  					   PIPE_CONTROL_QW_WRITE |
> > > -					   PIPE_CONTROL_FLUSH_ENABLE);
> > > +					   PIPE_CONTROL_CS_STALL);
> > 
> > Doesn't this just stall when parsing the pipe control? Shouldn't
> > we intead make sure the post-sync write is issued before the semaphore
> > is signalled? (pipe_control /w post-sync write + second pipe control w/
> > flush enable?)
> 
> No, afaik and can determine experimentally. The stall is after the
> post-sync write. The pipe-control dosn't emit the write until it has
> done the flush/invalidate and will not complete until the write is
> commited (in theory, until it is coherent). The CS stall prevents the
> command parser advancing until the pipecontrol is finished.

OK, so I did a quick experiemnt here doing something like:

for i=0-128:
	pipe_control w/ qw write data=0xdead0000+i offset=(i%8)*8
for i=0-8:
	pipe_control w/ qw write data=i offset=(i%8)*8
	mi_lrm reg=0x2310+(i%8)*4 offset=(i%8)*8

and then check the regs afterwards.

If I use CS stall in the second pipe control, it does seem to wait for
the post-sync operation initiated by itself. So seems you are right
about that. So the register values I saw were:
 (0x00002310): 0x00000001
 (0x00002314): 0x00000002
 (0x00002318): 0x00000003
 (0x0000231c): 0x00000004
 (0x00002320): 0x00000005
 (0x00002324): 0x00000006
 (0x00002328): 0x00000007
 (0x0000232c): 0x00000008

I also noticed something about the "pipe control flush" (bit 7). It
only really seems to wait for already initiated post-sync operations.
If the pipe control that is going to initiate the post-sync op itself
is still in the pipeline, bit 7 won't actually wait for it. Or at
least that's how I would interpret these results:

bit 7 == 0:
 (0x00002310): 0xdead0058
 (0x00002314): 0xdead0059
 (0x00002318): 0xdead0062
 (0x0000231c): 0xdead0063
 (0x00002320): 0xdead006c
 (0x00002324): 0xdead006d
 (0x00002328): 0xdead006e
 (0x0000232c): 0xdead0077

bit 7 == 1:
 (0x00002310): 0xdead0078
 (0x00002314): 0xdead0079
 (0x00002318): 0xdead007a
 (0x0000231c): 0xdead007b
 (0x00002320): 0xdead007c
 (0x00002324): 0xdead007d
 (0x00002328): 0xdead007e
 (0x0000232c): 0xdead007f

So even with bit 7 == 1 I didn't see the value the previous pipe control
would write.

So not sure what good that bit really is then since you always need a
CS stall to make sure that previous pipe controls have reached the end
of the pipe, and CS stall anyway seems to wait for the post-sync
operations, so adding bit 7 to the mix seems redundant.

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-04-14 14:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-09 10:14 Finish gen8 legacy semaphores Chris Wilson
2016-04-09 10:14 ` [PATCH 1/4] drm/i915: Fix gen8 semaphores id for legacy mode Chris Wilson
2016-04-11  8:26   ` Ville Syrjälä
2016-04-09 10:14 ` [PATCH 2/4] drm/i915: Fix serialisation of pipecontrol write vs semaphore signal Chris Wilson
2016-04-11  8:34   ` Ville Syrjälä
2016-04-11  9:06     ` Chris Wilson
2016-04-14 14:29       ` Ville Syrjälä [this message]
2016-04-14 14:33         ` Ville Syrjälä
2016-04-14 16:09         ` Chris Wilson
2016-04-09 10:14 ` [PATCH 3/4] drm/i915: Reload PD tables after semaphore wait on gen8 Chris Wilson
2016-04-11  7:34   ` Ville Syrjälä
2016-04-11  8:16     ` Chris Wilson
2016-04-11  8:37       ` Ville Syrjälä
2016-04-09 10:14 ` [PATCH 4/4] drm/i915: Enable semaphores for legacy submission " Chris Wilson
2016-04-09 11:02 ` ✗ Fi.CI.BAT: warning for series starting with [1/4] drm/i915: Fix gen8 semaphores id for legacy mode Patchwork

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=20160414142931.GP4329@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /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