<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 4, 2016 at 10:09 AM, Martin Peres <span dir="ltr"><<a href="mailto:martin.peres@linux.intel.com" target="_blank">martin.peres@linux.intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 03/05/16 23:03, Robert Bragg wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
<br>
On Tue, May 3, 2016 at 8:34 PM, Robert Bragg <<a href="mailto:robert@sixbynine.org" target="_blank">robert@sixbynine.org</a><br></span><span class="">
<mailto:<a href="mailto:robert@sixbynine.org" target="_blank">robert@sixbynine.org</a>>> wrote:<br>
<br>
Sorry for the delay replying to this, I missed it.<br>
<br>
On Sat, Apr 23, 2016 at 11:34 AM, Martin Peres <<a href="mailto:martin.peres@free.fr" target="_blank">martin.peres@free.fr</a><br></span><span class="">
<mailto:<a href="mailto:martin.peres@free.fr" target="_blank">martin.peres@free.fr</a>>> wrote:<br>
<br>
On 20/04/16 17:23, Robert Bragg wrote:<br>
<br>
Gen graphics hardware can be set up to periodically write<br>
snapshots of<br>
performance counters into a circular buffer via its Observation<br>
Architecture and this patch exposes that capability to<br>
userspace via the<br>
i915 perf interface.<br>
<br>
Cc: Chris Wilson <<a href="mailto:chris@chris-wilson.co.uk" target="_blank">chris@chris-wilson.co.uk</a><br></span>
<mailto:<a href="mailto:chris@chris-wilson.co.uk" target="_blank">chris@chris-wilson.co.uk</a>>><br>
Signed-off-by: Robert Bragg <<a href="mailto:robert@sixbynine.org" target="_blank">robert@sixbynine.org</a><br>
<mailto:<a href="mailto:robert@sixbynine.org" target="_blank">robert@sixbynine.org</a>>><br>
Signed-off-by: Zhenyu Wang <<a href="mailto:zhenyuw@linux.intel.com" target="_blank">zhenyuw@linux.intel.com</a><br>
<mailto:<a href="mailto:zhenyuw@linux.intel.com" target="_blank">zhenyuw@linux.intel.com</a>>><div><div class="h5"><br>
---<br>
drivers/gpu/drm/i915/i915_drv.h | 56 +-<br>
drivers/gpu/drm/i915/i915_gem_context.c | 24 +-<br>
drivers/gpu/drm/i915/i915_perf.c | 940<br>
+++++++++++++++++++++++++++++++-<br>
drivers/gpu/drm/i915/i915_reg.h | 338 ++++++++++++<br>
include/uapi/drm/i915_drm.h | 70 ++-<br>
5 files changed, 1408 insertions(+), 20 deletions(-)<br>
<br>
+<br>
+<br>
+ /* It takes a fairly long time for a new MUX<br>
configuration to<br>
+ * be be applied after these register writes. This delay<br>
+ * duration was derived empirically based on the<br>
render_basic<br>
+ * config but hopefully it covers the maximum<br>
configuration<br>
+ * latency...<br>
+ */<br>
+ mdelay(100);<br>
<br>
<br>
With such a HW and SW design, how can we ever expose hope to get any<br>
kind of performance when we are trying to monitor different<br>
metrics on each<br>
draw call? This may be acceptable for system monitoring, but it<br>
is problematic<br>
for the GL extensions :s<br>
<br>
<br>
Since it seems like we are going for a perf API, it means that<br>
for every change<br>
of metrics, we need to flush the commands, wait for the GPU to<br>
be done, then<br>
program the new set of metrics via an IOCTL, wait 100 ms, and<br>
then we may<br>
resume rendering ... until the next change. We are talking about<br>
a latency of<br>
6-7 frames at 60 Hz here... this is non-negligeable...<br>
<br>
<br>
I understand that we have a ton of counters and we may hide<br>
latency by not<br>
allowing using more than half of the counters for every draw<br>
call or frame, but<br>
even then, this 100ms delay is killing this approach altogether.<br>
<br>
<br>
<br>
<br>
So revisiting this to double check how things fail with my latest<br>
driver/tests without the delay, I apparently can't reproduce test<br>
failures without the delay any more...<br>
<br>
I think the explanation is that since first adding the delay to the<br>
driver I also made the the driver a bit more careful to not forward<br>
spurious reports that look invalid due to a zeroed report id field, and<br>
that mechanism keeps the unit tests happy, even though there are still<br>
some number of invalid reports generated if we don't wait.<br>
<br>
One problem with simply having no delay is that the driver prints an<br>
error if it sees an invalid reports so I get a lot of 'Skipping<br>
spurious, invalid OA report' dmesg spam. Also this was intended more as<br>
a last resort mechanism, and I wouldn't feel too happy about squashing<br>
the error message and potentially sweeping other error cases under the<br>
carpet.<br>
<br>
Experimenting to see if the delay can at least be reduced, I brought the<br>
delay up in millisecond increments and found that although I still see a<br>
lot of spurious reports only waiting 1 or 5 milliseconds, at 10<br>
milliseconds its reduced quite a bit and at 15 milliseconds I don't seem<br>
to have any errors.<br>
<br>
15 milliseconds is still a long time, but at least not as long as 100.<br>
</div></div></blockquote>
<br>
OK, so the issue does not come from the HW after all, great!<br></blockquote><div><br></div><div>Erm, I'm not sure that's a conclusion we can make here...<br><br>The upshot here was really just reducing the delay from 100ms to 15ms. Previously I arrived at a workable delay by jumping the delay in orders of magnitude with 10ms failing, 100ms passing and I didn't try and refine it further. Here I've looked at delays between 10 and 100ms.<br><br></div><div>The other thing is observing that because the kernel is checking for invalid reports (generated by the hardware) before forwarding to userspace the lack of a delay no longer triggers i-g-t failures because the invalid data won't reach i-g-t any more - though the invalid reports are still a thing to avoid.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Now, my main question is, why are spurious events generated when changing the MUX's value? I can understand that we would need to ignore the reading that came right after the change, but other than this, I am a bit at a loss.<br></blockquote><div><br></div><div>The MUX selects 16 signals that the OA unit can turn into 16 separate counters by basically counting the signal changes. (there's some fancy fixed function logic that can affect this but that's the general idea).<br></div><div><br></div><div>If the MUX is in the middle of being re-programmed then some subset of those 16 signals are for who knows what.<br><br></div><div>After programming the MUX we will go on to configure the OA unit and the tests will enable periodic sampling which (if we have no delay) will sample the OA counters that are currently being fed by undefined signals.<br><br></div><div>So as far as that goes it makes sense to me to expect bad data if we don't wait for the MUX config to land properly. Something I don't really know is how come we're seemingly lucky to have the reports be cleanly invalid with a zero report-id, instead of just having junk data that would be harder to recognise.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I am a bit swamped with other tasks right now, but I would love to spend more time reviewing your code as I really want to see this upstream!<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>No worries.<br><br></div><div>I can hopefully send out my i-g-t tests this afternoon too which should hopefully give us all the pieces to be able seriously consider hopefully landing things soon.<br><br></div><div>Regards,<br></div><div>- Robert<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">
<br>
Martin<br>
</font></span></blockquote></div><br></div></div>