<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 2, 2016 at 8:35 AM, Daniel Vetter <span dir="ltr"><<a href="mailto:daniel@ffwll.ch" target="_blank">daniel@ffwll.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Thu, Dec 01, 2016 at 05:21:52PM +0000, Robert Bragg wrote:<br>
> Avoid using DRM_ERROR for conditions userspace can trigger with a bad<br>
> config when opening a stream or from not reading data in a timely<br>
> fashion (whereby the OA buffer fills up). These conditions are tested<br>
> by i-g-t which treats error messages as failures if using the test<br>
> runner. This wasn't an issue while the i915-perf igt tests were being<br>
> run in isolation.<br>
><br>
> One message relating to seeing a spurious zeroed report was changed to<br>
> use DRM_NOTE instead of DRM_ERROR. Ideally this warning shouldn't be<br>
> seen, but it's not a serious problem if it is. Considering that the<br>
> tail margin mechanism is only a heuristic it's possible we might see<br>
> this from time to time.<br>
><br>
> Signed-off-by: Robert Bragg <<a href="mailto:robert@sixbynine.org">robert@sixbynine.org</a>:<br>
> Cc: Daniel Vetter <<a href="mailto:daniel.vetter@ffwll.ch">daniel.vetter@ffwll.ch</a>><br>
><br>
> fix i915_perf dbg messages<br>
> ---<br>
>  drivers/gpu/drm/i915/i915_<wbr>perf.c | 42 ++++++++++++++++++++----------<wbr>----------<br>
>  1 file changed, 21 insertions(+), 21 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/i915/i915_<wbr>perf.c b/drivers/gpu/drm/i915/i915_<wbr>perf.c<br>
> index 9551282..5705005 100644<br>
> --- a/drivers/gpu/drm/i915/i915_<wbr>perf.c<br>
> +++ b/drivers/gpu/drm/i915/i915_<wbr>perf.c<br>
> @@ -474,7 +474,7 @@ static int gen7_append_oa_reports(struct i915_perf_stream *stream,<br>
>                * copying it to userspace...<br>
>                */<br>
>               if (report32[0] == 0) {<br>
> -                     DRM_ERROR("Skipping spurious, invalid OA report\n");<br>
> +                     DRM_NOTE("Skipping spurious, invalid OA report\n");<br>
>                       continue;<br>
<br>
</div></div>The above looks like a genuine hw/kernel fail, which we shouldn't put<br>
under the carpet. I'd leave it at DRM_ERROR - I can bikeshed that while<br>
applying if you're ok. Otherwise lgtm, will apply as soon as we've<br>
clarified that.<br></blockquote><div><br></div><div>It's something that is unfortunately expected to be possible from time to time due to a hardware race condition between the OA unit updating the tail pointer for a new report and that report actually becoming visible to the cpu in memory.<br><br></div><div>If/when it happens it's not really a significant problem for userspace (assuming it's rare/intermittent given what the driver does as a best-effort workaround here). Userspace sees a briefly lower sampling resolution but the metrics can still be normalized.<br><br></div><div>We wouldn't want i-g-t failing in this case, so that's why I was changing it.<br><br></div><div>It's not really something you want to see ideally (it implies our heuristic-based software workaround isn't perfect). If it's seen a lot then that certainly should be considered a warning that we need to try and improve how we workaround the race condition. If you see it rarely then is somewhere between a note, and a warning I suppose.<br><br></div><div>Regards,<br></div><div>- Robert<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-Daniel<br>
<div><div class="h5"><br>
>               }<br>
><br>
> @@ -551,7 +551,7 @@ static int gen7_oa_read(struct i915_perf_stream *stream,<br>
>               if (ret)<br>
>                       return ret;<br>
><br>
> -             DRM_ERROR("OA buffer overflow: force restart\n");<br>
> +             DRM_DEBUG("OA buffer overflow: force restart\n");<br>
><br>
>               dev_priv->perf.oa.ops.oa_<wbr>disable(dev_priv);<br>
>               dev_priv->perf.oa.ops.oa_<wbr>enable(dev_priv);<br>
> @@ -1000,17 +1000,17 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,<br>
>        * IDs<br>
>        */<br>
>       if (!dev_priv->perf.metrics_kobj) {<br>
> -             DRM_ERROR("OA metrics weren't advertised via sysfs\n");<br>
> +             DRM_DEBUG("OA metrics weren't advertised via sysfs\n");<br>
>               return -EINVAL;<br>
>       }<br>
><br>
>       if (!(props->sample_flags & SAMPLE_OA_REPORT)) {<br>
> -             DRM_ERROR("Only OA report sampling supported\n");<br>
> +             DRM_DEBUG("Only OA report sampling supported\n");<br>
>               return -EINVAL;<br>
>       }<br>
><br>
>       if (!dev_priv->perf.oa.ops.init_<wbr>oa_buffer) {<br>
> -             DRM_ERROR("OA unit not supported\n");<br>
> +             DRM_DEBUG("OA unit not supported\n");<br>
>               return -ENODEV;<br>
>       }<br>
><br>
> @@ -1019,17 +1019,17 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,<br>
>        * we currently only allow exclusive access<br>
>        */<br>
>       if (dev_priv->perf.oa.exclusive_<wbr>stream) {<br>
> -             DRM_ERROR("OA unit already in use\n");<br>
> +             DRM_DEBUG("OA unit already in use\n");<br>
>               return -EBUSY;<br>
>       }<br>
><br>
>       if (!props->metrics_set) {<br>
> -             DRM_ERROR("OA metric set not specified\n");<br>
> +             DRM_DEBUG("OA metric set not specified\n");<br>
>               return -EINVAL;<br>
>       }<br>
><br>
>       if (!props->oa_format) {<br>
> -             DRM_ERROR("OA report format not specified\n");<br>
> +             DRM_DEBUG("OA report format not specified\n");<br>
>               return -EINVAL;<br>
>       }<br>
><br>
> @@ -1384,7 +1384,7 @@ i915_perf_open_ioctl_locked(<wbr>struct drm_i915_private *dev_priv,<br>
>               if (IS_ERR(specific_ctx)) {<br>
>                       ret = PTR_ERR(specific_ctx);<br>
>                       if (ret != -EINTR)<br>
> -                             DRM_ERROR("Failed to look up context with ID %u for opening perf stream\n",<br>
> +                             DRM_DEBUG("Failed to look up context with ID %u for opening perf stream\n",<br>
>                                         ctx_handle);<br>
>                       goto err;<br>
>               }<br>
> @@ -1397,7 +1397,7 @@ i915_perf_open_ioctl_locked(<wbr>struct drm_i915_private *dev_priv,<br>
>        */<br>
>       if (!specific_ctx &&<br>
>           i915_perf_stream_paranoid && !capable(CAP_SYS_ADMIN)) {<br>
> -             DRM_ERROR("Insufficient privileges to open system-wide i915 perf stream\n");<br>
> +             DRM_DEBUG("Insufficient privileges to open system-wide i915 perf stream\n");<br>
>               ret = -EACCES;<br>
>               goto err_ctx;<br>
>       }<br>
> @@ -1476,7 +1476,7 @@ static int read_properties_unlocked(<wbr>struct drm_i915_private *dev_priv,<br>
>       memset(props, 0, sizeof(struct perf_open_properties));<br>
><br>
>       if (!n_props) {<br>
> -             DRM_ERROR("No i915 perf properties given");<br>
> +             DRM_DEBUG("No i915 perf properties given\n");<br>
>               return -EINVAL;<br>
>       }<br>
><br>
> @@ -1487,7 +1487,7 @@ static int read_properties_unlocked(<wbr>struct drm_i915_private *dev_priv,<br>
>        * from userspace.<br>
>        */<br>
>       if (n_props >= DRM_I915_PERF_PROP_MAX) {<br>
> -             DRM_ERROR("More i915 perf properties specified than exist");<br>
> +             DRM_DEBUG("More i915 perf properties specified than exist\n");<br>
>               return -EINVAL;<br>
>       }<br>
><br>
> @@ -1515,26 +1515,26 @@ static int read_properties_unlocked(<wbr>struct drm_i915_private *dev_priv,<br>
>               case DRM_I915_PERF_PROP_OA_METRICS_<wbr>SET:<br>
>                       if (value == 0 ||<br>
>                           value > dev_priv->perf.oa.n_builtin_<wbr>sets) {<br>
> -                             DRM_ERROR("Unknown OA metric set ID");<br>
> +                             DRM_DEBUG("Unknown OA metric set ID\n");<br>
>                               return -EINVAL;<br>
>                       }<br>
>                       props->metrics_set = value;<br>
>                       break;<br>
>               case DRM_I915_PERF_PROP_OA_FORMAT:<br>
>                       if (value == 0 || value >= I915_OA_FORMAT_MAX) {<br>
> -                             DRM_ERROR("Invalid OA report format\n");<br>
> +                             DRM_DEBUG("Invalid OA report format\n");<br>
>                               return -EINVAL;<br>
>                       }<br>
>                       if (!dev_priv->perf.oa.oa_<wbr>formats[value].size) {<br>
> -                             DRM_ERROR("Invalid OA report format\n");<br>
> +                             DRM_DEBUG("Invalid OA report format\n");<br>
>                               return -EINVAL;<br>
>                       }<br>
>                       props->oa_format = value;<br>
>                       break;<br>
>               case DRM_I915_PERF_PROP_OA_<wbr>EXPONENT:<br>
>                       if (value > OA_EXPONENT_MAX) {<br>
> -                             DRM_ERROR("OA timer exponent too high (> %u)\n",<br>
> -                                       OA_EXPONENT_MAX);<br>
> +                             DRM_DEBUG("OA timer exponent too high (> %u)\n",<br>
> +                                      OA_EXPONENT_MAX);<br>
>                               return -EINVAL;<br>
>                       }<br>
><br>
> @@ -1565,7 +1565,7 @@ static int read_properties_unlocked(<wbr>struct drm_i915_private *dev_priv,<br>
><br>
>                       if (oa_freq_hz > i915_oa_max_sample_rate &&<br>
>                           !capable(CAP_SYS_ADMIN)) {<br>
> -                             DRM_ERROR("OA exponent would exceed the max sampling frequency (sysctl dev.i915.oa_max_sample_rate) %uHz without root privileges\n",<br>
> +                             DRM_DEBUG("OA exponent would exceed the max sampling frequency (sysctl dev.i915.oa_max_sample_rate) %uHz without root privileges\n",<br>
>                                         i915_oa_max_sample_rate);<br>
>                               return -EACCES;<br>
>                       }<br>
> @@ -1575,7 +1575,7 @@ static int read_properties_unlocked(<wbr>struct drm_i915_private *dev_priv,<br>
>                       break;<br>
>               default:<br>
>                       MISSING_CASE(id);<br>
> -                     DRM_ERROR("Unknown i915 perf property ID");<br>
> +                     DRM_DEBUG("Unknown i915 perf property ID\n");<br>
>                       return -EINVAL;<br>
>               }<br>
><br>
> @@ -1595,7 +1595,7 @@ int i915_perf_open_ioctl(struct drm_device *dev, void *data,<br>
>       int ret;<br>
><br>
>       if (!dev_priv->perf.initialized) {<br>
> -             DRM_ERROR("i915 perf interface not available for this system");<br>
> +             DRM_DEBUG("i915 perf interface not available for this system\n");<br>
>               return -ENOTSUPP;<br>
>       }<br>
><br>
> @@ -1603,7 +1603,7 @@ int i915_perf_open_ioctl(struct drm_device *dev, void *data,<br>
>                          I915_PERF_FLAG_FD_NONBLOCK |<br>
>                          I915_PERF_FLAG_DISABLED;<br>
>       if (param->flags & ~known_open_flags) {<br>
> -             DRM_ERROR("Unknown drm_i915_perf_open_param flag\n");<br>
> +             DRM_DEBUG("Unknown drm_i915_perf_open_param flag\n");<br>
>               return -EINVAL;<br>
>       }<br>
><br>
> --<br>
> 2.10.2<br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> Intel-gfx mailing list<br>
> <a href="mailto:Intel-gfx@lists.freedesktop.org">Intel-gfx@lists.freedesktop.<wbr>org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/intel-gfx" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/intel-gfx</a><br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Daniel Vetter<br>
Software Engineer, Intel Corporation<br>
<a href="http://blog.ffwll.ch" rel="noreferrer" target="_blank">http://blog.ffwll.ch</a><br>
</font></span></blockquote></div><br></div></div>