drm/i915/perf: use DRM_DEBUG for userspace issues
Subsystems (2)
PATCH 1/1 drm/i915/perf: use DRM_DEBUG for userspace issues
Avoid using DRM_ERROR for conditions userspace can trigger with a bad config when opening a stream or from not reading data in a timely fashion (whereby the OA buffer fills up). These conditions are tested by i-g-t which treats error messages as failures if using the test runner. This wasn't an issue while the i915-perf igt tests were being run in isolation.
One message relating to seeing a spurious zeroed report was changed to use DRM_NOTE instead of DRM_ERROR. Ideally this warning shouldn't be seen, but it's not a serious problem if it is. Considering that the tail margin mechanism is only a heuristic it's possible we might see this from time to time.
fix i915_perf dbg messages
--- drivers/gpu/drm/i915/i915_perf.c | 42 ++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-)
drivers/gpu/drm/i915/i915_perf.c +21 -21
@@ -474,7 +474,7 @@ static int gen7_append_oa_reports(struct i915_perf_stream *stream,* copying it to userspace... */ if (report32[0 ] ==0 ) { -DRM_ERROR ("Skipping spurious, invalid OA report\n" ); +DRM_NOTE ("Skipping spurious, invalid OA report\n" );continue ; }
@@ -551,7 +551,7 @@ static int gen7_oa_read(struct i915_perf_stream *stream,if (ret)return ret; -DRM_ERROR ("OA buffer overflow: force restart\n" ); +DRM_DEBUG ("OA buffer overflow: force restart\n" ); dev_priv->perf.oa.ops.oa_disable (dev_priv); dev_priv->perf.oa.ops.oa_enable (dev_priv);
@@ -1000,17 +1000,17 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,* IDs */ if (!dev_priv->perf.metrics_kobj) { -DRM_ERROR ("OA metrics weren't advertised via sysfs\n" ); +DRM_DEBUG ("OA metrics weren't advertised via sysfs\n" );return -EINVAL ; }if (!(props->sample_flags &SAMPLE_OA_REPORT )) { -DRM_ERROR ("Only OA report sampling supported\n" ); +DRM_DEBUG ("Only OA report sampling supported\n" );return -EINVAL ; }if (!dev_priv->perf.oa.ops.init_oa_buffer) { -DRM_ERROR ("OA unit not supported\n" ); +DRM_DEBUG ("OA unit not supported\n" );return -ENODEV ; }
@@ -1019,17 +1019,17 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,* we currently only allow exclusive access */ if (dev_priv->perf.oa.exclusive_stream) { -DRM_ERROR ("OA unit already in use\n" ); +DRM_DEBUG ("OA unit already in use\n" );return -EBUSY ; }if (!props->metrics_set) { -DRM_ERROR ("OA metric set not specified\n" ); +DRM_DEBUG ("OA metric set not specified\n" );return -EINVAL ; }if (!props->oa_format) { -DRM_ERROR ("OA report format not specified\n" ); +DRM_DEBUG ("OA report format not specified\n" );return -EINVAL ; }
@@ -1384,7 +1384,7 @@ i915_perf_open_ioctl_locked(struct drm_i915_private *dev_priv,if (IS_ERR (specific_ctx)) { ret =PTR_ERR (specific_ctx);if (ret != -EINTR ) -DRM_ERROR ("Failed to look up context with ID %u for opening perf stream\n" , +DRM_DEBUG ("Failed to look up context with ID %u for opening perf stream\n" , ctx_handle); goto err; }
@@ -1397,7 +1397,7 @@ i915_perf_open_ioctl_locked(struct drm_i915_private *dev_priv,*/ if (!specific_ctx && i915_perf_stream_paranoid && !capable (CAP_SYS_ADMIN )) { -DRM_ERROR ("Insufficient privileges to open system-wide i915 perf stream\n" ); +DRM_DEBUG ("Insufficient privileges to open system-wide i915 perf stream\n" ); ret = -EACCES ; goto err_ctx; }
@@ -1476,7 +1476,7 @@ static int read_properties_unlocked(struct drm_i915_private *dev_priv,memset (props,0 ,sizeof (struct perf_open_properties ));if (!n_props) { -DRM_ERROR ("No i915 perf properties given" ); +DRM_DEBUG ("No i915 perf properties given\n" );return -EINVAL ; }
@@ -1487,7 +1487,7 @@ static int read_properties_unlocked(struct drm_i915_private *dev_priv,* from userspace. */ if (n_props >=DRM_I915_PERF_PROP_MAX ) { -DRM_ERROR ("More i915 perf properties specified than exist" ); +DRM_DEBUG ("More i915 perf properties specified than exist\n" );return -EINVAL ; }
@@ -1515,26 +1515,26 @@ static int read_properties_unlocked(struct drm_i915_private *dev_priv,case DRM_I915_PERF_PROP_OA_METRICS_SET :if (value ==0 || value > dev_priv->perf.oa.n_builtin_sets) { -DRM_ERROR ("Unknown OA metric set ID" ); +DRM_DEBUG ("Unknown OA metric set ID\n" );return -EINVAL ; } props->metrics_set = value;break ;case DRM_I915_PERF_PROP_OA_FORMAT :if (value ==0 || value >=I915_OA_FORMAT_MAX ) { -DRM_ERROR ("Invalid OA report format\n" ); +DRM_DEBUG ("Invalid OA report format\n" );return -EINVAL ; }if (!dev_priv->perf.oa.oa_formats[value].size) { -DRM_ERROR ("Invalid OA report format\n" ); +DRM_DEBUG ("Invalid OA report format\n" );return -EINVAL ; } props->oa_format = value;break ;case DRM_I915_PERF_PROP_OA_EXPONENT :if (value >OA_EXPONENT_MAX ) { -DRM_ERROR ("OA timer exponent too high (> %u)\n" , -OA_EXPONENT_MAX ); +DRM_DEBUG ("OA timer exponent too high (> %u)\n" , +OA_EXPONENT_MAX );return -EINVAL ; }
@@ -1565,7 +1565,7 @@ static int read_properties_unlocked(struct drm_i915_private *dev_priv,if (oa_freq_hz > i915_oa_max_sample_rate && !capable (CAP_SYS_ADMIN )) { -DRM_ERROR ("OA exponent would exceed the max sampling frequency (sysctl dev.i915.oa_max_sample_rate) %uHz without root privileges\n" , +DRM_DEBUG ("OA exponent would exceed the max sampling frequency (sysctl dev.i915.oa_max_sample_rate) %uHz without root privileges\n" , i915_oa_max_sample_rate);return -EACCES ; }
@@ -1575,7 +1575,7 @@ static int read_properties_unlocked(struct drm_i915_private *dev_priv,break ;default :MISSING_CASE (id); -DRM_ERROR ("Unknown i915 perf property ID" ); +DRM_DEBUG ("Unknown i915 perf property ID\n" );return -EINVAL ; }
@@ -1595,7 +1595,7 @@ int i915_perf_open_ioctl(struct drm_device *dev, void *data,int ret;if (!dev_priv->perf.initialized) { -DRM_ERROR ("i915 perf interface not available for this system" ); +DRM_DEBUG ("i915 perf interface not available for this system\n" );return -ENOTSUPP ; }
@@ -1603,7 +1603,7 @@ int i915_perf_open_ioctl(struct drm_device *dev, void *data,I915_PERF_FLAG_FD_NONBLOCK |I915_PERF_FLAG_DISABLED ;if (param->flags & ~known_open_flags) { -DRM_ERROR ("Unknown drm_i915_perf_open_param flag\n" ); +DRM_DEBUG ("Unknown drm_i915_perf_open_param flag\n" );return -EINVAL ; }
Signature · 6 lines
2.10.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915/perf: use DRM_DEBUG for userspace issues
== Series Details ==
== Series Details ==
Series: drm/i915/perf: use DRM_DEBUG for userspace issues
URL : https://patchwork.freedesktop.org/series/16236/
State : success
== Summary ==
Series 16236v1 drm/i915/perf: use DRM_DEBUG for userspace issues
https://patchwork.freedesktop.org/api/1.0/series/16236/revisions/1/mbox/
fi-bdw-5557u total:245 pass:226 dwarn:0 dfail:0 fail:4 skip:15 fi-bsw-n3050 total:245 pass:203 dwarn:0 dfail:0 fail:2 skip:40 fi-bxt-t5700 total:245 pass:213 dwarn:0 dfail:0 fail:4 skip:28 fi-byt-j1900 total:245 pass:214 dwarn:0 dfail:0 fail:3 skip:28 fi-byt-n2820 total:245 pass:210 dwarn:0 dfail:0 fail:3 skip:32 fi-hsw-4770 total:245 pass:221 dwarn:0 dfail:0 fail:4 skip:20 fi-hsw-4770r total:245 pass:221 dwarn:0 dfail:0 fail:4 skip:20 fi-ilk-650 total:245 pass:189 dwarn:0 dfail:0 fail:3 skip:53 fi-ivb-3520m total:245 pass:219 dwarn:0 dfail:0 fail:4 skip:22 fi-ivb-3770 total:245 pass:219 dwarn:0 dfail:0 fail:4 skip:22 fi-kbl-7500u total:245 pass:219 dwarn:0 dfail:0 fail:4 skip:22 fi-skl-6260u total:245 pass:227 dwarn:0 dfail:0 fail:4 skip:14 fi-skl-6700hq total:245 pass:220 dwarn:0 dfail:0 fail:4 skip:21 fi-skl-6700k total:245 pass:219 dwarn:1 dfail:0 fail:4 skip:21 fi-skl-6770hq total:245 pass:227 dwarn:0 dfail:0 fail:4 skip:14 fi-snb-2520m total:245 pass:210 dwarn:0 dfail:0 fail:3 skip:32 fi-snb-2600 total:245 pass:209 dwarn:0 dfail:0 fail:3 skip:33
15f4397c9b50b0212dcb99fb2b5b8a3867133e81 drm-tip: 2016y-12m-01d-13h-26m-26s UTC integration manifest e0bdfdc drm/i915/perf: use DRM_DEBUG for userspace issues
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3165/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 26 lines · Robert Bragg
Avoid using
DRM_ERRORfor conditions userspace can trigger with a bad config when opening a stream or from not reading data in a timely fashion (whereby the OA buffer fills up). These conditions are tested by i-g-t which treats error messages as failures if using the test runner. This wasn't an issue while the i915-perf igt tests were being run in isolation.One message relating to seeing a spurious zeroed report was changed to use
DRM_NOTEinstead ofDRM_ERROR. Ideally this warning shouldn't be seen, but it's not a serious problem if it is. Considering that the tail margin mechanism is only a heuristic it's possible we might see this from time to time.Signed-off-by Robert Bragg <[email protected]:Cc Daniel Vetter <[email protected]>fix
i915_perfdbg messages--- drivers/gpu/drm/i915/i915_perf.c | 42 ++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-)drivers/gpu/drm/i915/i915_perf.c +0
-0
drivers/gpu/drm/i915/i915_perf.c static int gen7_append_oa_reports(struct i915_perf_stream *stream, · line 478
Quoted 6 lines
drivers/gpu/drm/i915/i915_perf.c +1
-1@@ -474,7 +474,7 @@ static int gen7_append_oa_reports(struct i915_perf_stream *stream,* copying it to userspace... */ if (report32[0 ] ==0 ) { -DRM_ERROR ("Skipping spurious, invalid OA report\n" ); +DRM_NOTE ("Skipping spurious, invalid OA report\n" );continue ;
The above looks like a genuine hw/kernel fail, which we shouldn't put under the carpet. I'd leave it at DRM_ERROR - I can bikeshed that while applying if you're ok. Otherwise lgtm, will apply as soon as we've clarified that.
-Daniel
Quoted 164 lines
drivers/gpu/drm/i915/i915_perf.c +20
-20}@@ -551,7 +551,7 @@ static int gen7_oa_read(struct i915_perf_stream *stream,if (ret)return ret; -DRM_ERROR ("OA buffer overflow: force restart\n" ); +DRM_DEBUG ("OA buffer overflow: force restart\n" ); dev_priv->perf.oa.ops.oa_disable (dev_priv); dev_priv->perf.oa.ops.oa_enable (dev_priv);@@ -1000,17 +1000,17 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,* IDs */ if (!dev_priv->perf.metrics_kobj) { -DRM_ERROR ("OA metrics weren't advertised via sysfs\n" ); +DRM_DEBUG ("OA metrics weren't advertised via sysfs\n" );return -EINVAL ; }if (!(props->sample_flags &SAMPLE_OA_REPORT )) { -DRM_ERROR ("Only OA report sampling supported\n" ); +DRM_DEBUG ("Only OA report sampling supported\n" );return -EINVAL ; }if (!dev_priv->perf.oa.ops.init_oa_buffer) { -DRM_ERROR ("OA unit not supported\n" ); +DRM_DEBUG ("OA unit not supported\n" );return -ENODEV ; }@@ -1019,17 +1019,17 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,* we currently only allow exclusive access */ if (dev_priv->perf.oa.exclusive_stream) { -DRM_ERROR ("OA unit already in use\n" ); +DRM_DEBUG ("OA unit already in use\n" );return -EBUSY ; }if (!props->metrics_set) { -DRM_ERROR ("OA metric set not specified\n" ); +DRM_DEBUG ("OA metric set not specified\n" );return -EINVAL ; }if (!props->oa_format) { -DRM_ERROR ("OA report format not specified\n" ); +DRM_DEBUG ("OA report format not specified\n" );return -EINVAL ; }@@ -1384,7 +1384,7 @@ i915_perf_open_ioctl_locked(struct drm_i915_private *dev_priv,if (IS_ERR (specific_ctx)) { ret =PTR_ERR (specific_ctx);if (ret != -EINTR ) -DRM_ERROR ("Failed to look up context with ID %u for opening perf stream\n" , +DRM_DEBUG ("Failed to look up context with ID %u for opening perf stream\n" , ctx_handle); goto err; }@@ -1397,7 +1397,7 @@ i915_perf_open_ioctl_locked(struct drm_i915_private *dev_priv,*/ if (!specific_ctx && i915_perf_stream_paranoid && !capable (CAP_SYS_ADMIN )) { -DRM_ERROR ("Insufficient privileges to open system-wide i915 perf stream\n" ); +DRM_DEBUG ("Insufficient privileges to open system-wide i915 perf stream\n" ); ret = -EACCES ; goto err_ctx; }@@ -1476,7 +1476,7 @@ static int read_properties_unlocked(struct drm_i915_private *dev_priv,memset (props,0 ,sizeof (struct perf_open_properties ));if (!n_props) { -DRM_ERROR ("No i915 perf properties given" ); +DRM_DEBUG ("No i915 perf properties given\n" );return -EINVAL ; }@@ -1487,7 +1487,7 @@ static int read_properties_unlocked(struct drm_i915_private *dev_priv,* from userspace. */ if (n_props >=DRM_I915_PERF_PROP_MAX ) { -DRM_ERROR ("More i915 perf properties specified than exist" ); +DRM_DEBUG ("More i915 perf properties specified than exist\n" );return -EINVAL ; }@@ -1515,26 +1515,26 @@ static int read_properties_unlocked(struct drm_i915_private *dev_priv,case DRM_I915_PERF_PROP_OA_METRICS_SET :if (value ==0 || value > dev_priv->perf.oa.n_builtin_sets) { -DRM_ERROR ("Unknown OA metric set ID" ); +DRM_DEBUG ("Unknown OA metric set ID\n" );return -EINVAL ; } props->metrics_set = value;break ;case DRM_I915_PERF_PROP_OA_FORMAT :if (value ==0 || value >=I915_OA_FORMAT_MAX ) { -DRM_ERROR ("Invalid OA report format\n" ); +DRM_DEBUG ("Invalid OA report format\n" );return -EINVAL ; }if (!dev_priv->perf.oa.oa_formats[value].size) { -DRM_ERROR ("Invalid OA report format\n" ); +DRM_DEBUG ("Invalid OA report format\n" );return -EINVAL ; } props->oa_format = value;break ;case DRM_I915_PERF_PROP_OA_EXPONENT :if (value >OA_EXPONENT_MAX ) { -DRM_ERROR ("OA timer exponent too high (> %u)\n" , -OA_EXPONENT_MAX ); +DRM_DEBUG ("OA timer exponent too high (> %u)\n" , +OA_EXPONENT_MAX );return -EINVAL ; }@@ -1565,7 +1565,7 @@ static int read_properties_unlocked(struct drm_i915_private *dev_priv,if (oa_freq_hz > i915_oa_max_sample_rate && !capable (CAP_SYS_ADMIN )) { -DRM_ERROR ("OA exponent would exceed the max sampling frequency (sysctl dev.i915.oa_max_sample_rate) %uHz without root privileges\n" , +DRM_DEBUG ("OA exponent would exceed the max sampling frequency (sysctl dev.i915.oa_max_sample_rate) %uHz without root privileges\n" , i915_oa_max_sample_rate);return -EACCES ; }@@ -1575,7 +1575,7 @@ static int read_properties_unlocked(struct drm_i915_private *dev_priv,break ;default :MISSING_CASE (id); -DRM_ERROR ("Unknown i915 perf property ID" ); +DRM_DEBUG ("Unknown i915 perf property ID\n" );return -EINVAL ; }@@ -1595,7 +1595,7 @@ int i915_perf_open_ioctl(struct drm_device *dev, void *data,int ret;if (!dev_priv->perf.initialized) { -DRM_ERROR ("i915 perf interface not available for this system" ); +DRM_DEBUG ("i915 perf interface not available for this system\n" );return -ENOTSUPP ; }@@ -1603,7 +1603,7 @@ int i915_perf_open_ioctl(struct drm_device *dev, void *data,I915_PERF_FLAG_FD_NONBLOCK |I915_PERF_FLAG_DISABLED ;if (param->flags & ~known_open_flags) { -DRM_ERROR ("Unknown drm_i915_perf_open_param flag\n" ); +DRM_DEBUG ("Unknown drm_i915_perf_open_param flag\n" );return -EINVAL ; }Signature · 6 lines
2.10.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 34 lines · Daniel Vetter
Quoted 13 lines · Robert Bragg
Avoid using
DRM_ERRORfor conditions userspace can trigger with a bad config when opening a stream or from not reading data in a timely fashion (whereby the OA buffer fills up). These conditions are tested by i-g-t which treats error messages as failures if using the test runner. This wasn't an issue while the i915-perf igt tests were being run in isolation.One message relating to seeing a spurious zeroed report was changed to use
DRM_NOTEinstead ofDRM_ERROR. Ideally this warning shouldn't be seen, but it's not a serious problem if it is. Considering that the tail margin mechanism is only a heuristic it's possible we might see this from time to time.Quoted 6 lines
Signed-off-by Robert Bragg <[email protected]:Cc Daniel Vetter <[email protected]>fix
i915_perfdbg messages--- drivers/gpu/drm/i915/i915_perf.c | 42 ++++++++++++++++++++--------------------
Review
Quoted 3 lines
1 file changed, 21 insertions(+), 21 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/i915_perf.cdrivers/gpu/drm/i915/i915_perf.c static int gen7_append_oa_reports(struct
Quoted 4 lines
index 9551282..5705005 100644
drivers/gpu/drm/i915/i915_perf.c +0
-0@@ -474,7 +474,7 @@ static int gen7_append_oa_reports(struct
i915_perf_stream*stream,drivers/gpu/drm/i915/i915_perf.c static int gen7_append_oa_reports(struct i915_perf_stream *stream,
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-1* copying it to userspace... */ if (report32[0 ] ==0 ) { - DRM_ERROR("Skipping spurious, invalid OA
Quoted 9 lines
report\n");
drivers/gpu/drm/i915/i915_perf.c static int gen7_append_oa_reports(struct i915_perf_stream *stream, · line 478
Quoted 2 lines
drivers/gpu/drm/i915/i915_perf.c +1
-0+DRM_NOTE ("Skipping spurious, invalid OA report\n" );continue ;The above looks like a genuine hw/kernel fail, which we shouldn't put under the carpet. I'd leave it at
DRM_ERROR- I can bikeshed that while applying if you're ok. Otherwise lgtm, will apply as soon as we've clarified that.
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.
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.
We wouldn't want i-g-t failing in this case, so that's why I was changing it.
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.
Regards,
- Robert
Quoted 193 lines
-Daniel
drivers/gpu/drm/i915/i915_perf.c static int gen7_oa_read(struct i915_perf_stream
Quoted 3 lines
drivers/gpu/drm/i915/i915_perf.c +0
-0}@@ -551,7 +551,7 @@ static int gen7_oa_read(struct i915_perf_stream*stream,
drivers/gpu/drm/i915/i915_perf.c static int i915_oa_stream_init(struct
Quoted 9 lines
drivers/gpu/drm/i915/i915_perf.c +1
-1if (ret)return ret; -DRM_ERROR ("OA buffer overflow: force restart\n" ); +DRM_DEBUG ("OA buffer overflow: force restart\n" ); dev_priv->perf.oa.ops.oa_disable (dev_priv); dev_priv->perf.oa.ops.oa_enable (dev_priv);@@ -1000,17 +1000,17 @@ static int i915_oa_stream_init(struct
i915_perf_stream*stream,drivers/gpu/drm/i915/i915_perf.c static int i915_oa_stream_init(struct
Quoted 21 lines
drivers/gpu/drm/i915/i915_perf.c +3
-3* IDs */ if (!dev_priv->perf.metrics_kobj) { -DRM_ERROR ("OA metrics weren't advertised via sysfs\n" ); +DRM_DEBUG ("OA metrics weren't advertised via sysfs\n" );return -EINVAL ; }if (!(props->sample_flags &SAMPLE_OA_REPORT )) { -DRM_ERROR ("Only OA report sampling supported\n" ); +DRM_DEBUG ("Only OA report sampling supported\n" );return -EINVAL ; }if (!dev_priv->perf.oa.ops.init_oa_buffer) { -DRM_ERROR ("OA unit not supported\n" ); +DRM_DEBUG ("OA unit not supported\n" );return -ENODEV ; }@@ -1019,17 +1019,17 @@ static int i915_oa_stream_init(struct
i915_perf_stream*stream,drivers/gpu/drm/i915/i915_perf.c i915_perf_open_ioctl_locked(struct
Quoted 21 lines
drivers/gpu/drm/i915/i915_perf.c +3
-3* we currently only allow exclusive access */ if (dev_priv->perf.oa.exclusive_stream) { -DRM_ERROR ("OA unit already in use\n" ); +DRM_DEBUG ("OA unit already in use\n" );return -EBUSY ; }if (!props->metrics_set) { -DRM_ERROR ("OA metric set not specified\n" ); +DRM_DEBUG ("OA metric set not specified\n" );return -EINVAL ; }if (!props->oa_format) { -DRM_ERROR ("OA report format not specified\n" ); +DRM_DEBUG ("OA report format not specified\n" );return -EINVAL ; }@@ -1384,7 +1384,7 @@ i915_perf_open_ioctl_locked(struct
drm_i915_private*dev_priv,drivers/gpu/drm/i915/i915_perf.c i915_perf_open_ioctl_locked(struct drm_i915_private *dev_priv,
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-1if (IS_ERR (specific_ctx)) { ret =PTR_ERR (specific_ctx);if (ret != -EINTR ) - DRM_ERROR("Failed to look up context withID %u for opening perf stream\n",
drivers/gpu/drm/i915/i915_perf.c i915_perf_open_ioctl_locked(struct · line 1387
Quoted 1 line
drivers/gpu/drm/i915/i915_perf.c +1
-0+ DRM_DEBUG("Failed to look up context withID %u for opening perf stream\n",
drivers/gpu/drm/i915/i915_perf.c i915_perf_open_ioctl_locked(struct
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-0ctx_handle); goto err; }@@ -1397,7 +1397,7 @@ i915_perf_open_ioctl_locked(struct
drm_i915_private*dev_priv,drivers/gpu/drm/i915/i915_perf.c i915_perf_open_ioctl_locked(struct drm_i915_private *dev_priv,
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-1*/ if (!specific_ctx && i915_perf_stream_paranoid && !capable (CAP_SYS_ADMIN )) { - DRM_ERROR("Insufficient privileges to open system-widei915 perf stream\n");
drivers/gpu/drm/i915/i915_perf.c i915_perf_open_ioctl_locked(struct · line 1400
Quoted 1 line
drivers/gpu/drm/i915/i915_perf.c +1
-0+ DRM_DEBUG("Insufficient privileges to open system-widei915 perf stream\n");
drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-0ret = -EACCES ; goto err_ctx; }@@ -1476,7 +1476,7 @@ static int read_properties_unlocked(struct
drm_i915_private*dev_priv,drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct
Quoted 9 lines
drivers/gpu/drm/i915/i915_perf.c +1
-1memset (props,0 ,sizeof (struct perf_open_properties ));if (!n_props) { -DRM_ERROR ("No i915 perf properties given" ); +DRM_DEBUG ("No i915 perf properties given\n" );return -EINVAL ; }@@ -1487,7 +1487,7 @@ static int read_properties_unlocked(struct
drm_i915_private*dev_priv,drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct drm_i915_private *dev_priv,
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-1* from userspace. */ if (n_props >=DRM_I915_PERF_PROP_MAX ) { - DRM_ERROR("More i915 perf properties specified thanexist");
drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct · line 1490
Quoted 1 line
drivers/gpu/drm/i915/i915_perf.c +1
-0+ DRM_DEBUG("More i915 perf properties specified thanexist\n");
drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-0return -EINVAL ; }@@ -1515,26 +1515,26 @@ static int read_properties_unlocked(struct
drm_i915_private*dev_priv,Quoted 15 lines
drivers/gpu/drm/i915/i915_perf.c +2
-2case DRM_I915_PERF_PROP_OA_METRICS_SET :if (value ==0 || value > dev_priv->perf.oa.n_builtin_sets) { -DRM_ERROR ("Unknown OA metric set ID" ); +DRM_DEBUG ("Unknown OA metric set ID\n" );return -EINVAL ; } props->metrics_set = value;break ;case DRM_I915_PERF_PROP_OA_FORMAT :if (value ==0 || value >=I915_OA_FORMAT_MAX ) { -DRM_ERROR ("Invalid OA report format\n" ); +DRM_DEBUG ("Invalid OA report format\n" );return -EINVAL ; }drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct drm_i915_private *dev_priv,
Quoted 10 lines
drivers/gpu/drm/i915/i915_perf.c +1
-2if (!dev_priv->perf.oa.oa_formats[value].size) { -DRM_ERROR ("Invalid OA report format\n" ); +DRM_DEBUG ("Invalid OA report format\n" );return -EINVAL ; } props->oa_format = value;break ;case DRM_I915_PERF_PROP_OA_EXPONENT :if (value >OA_EXPONENT_MAX ) { - DRM_ERROR("OA timer exponent too high (>%u)\n",
drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct · line 1536
Quoted 2 lines
drivers/gpu/drm/i915/i915_perf.c +1
-1- OA_EXPONENT_MAX); + DRM_DEBUG("OA timer exponent too high (>%u)\n",
drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct
Quoted 5 lines
drivers/gpu/drm/i915/i915_perf.c +1
-0+ OA_EXPONENT_MAX);return -EINVAL ; }@@ -1565,7 +1565,7 @@ static int read_properties_unlocked(struct
drm_i915_private*dev_priv,drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct drm_i915_private *dev_priv,
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-1if (oa_freq_hz > i915_oa_max_sample_rate && !capable (CAP_SYS_ADMIN )) { - DRM_ERROR("OA exponent would exceed themax sampling frequency (sysctl dev.i915.oa_max_sample_rate) %uHz without root privileges\n",
drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct · line 1567
Quoted 1 line
drivers/gpu/drm/i915/i915_perf.c +1
-0+ DRM_DEBUG("OA exponent would exceed themax sampling frequency (sysctl dev.i915.oa_max_sample_rate) %uHz without root privileges\n",
drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-0i915_oa_max_sample_rate);return -EACCES ; }@@ -1575,7 +1575,7 @@ static int read_properties_unlocked(struct
drm_i915_private*dev_priv,drivers/gpu/drm/i915/i915_perf.c int i915_perf_open_ioctl(struct drm_device *dev,
Quoted 9 lines
drivers/gpu/drm/i915/i915_perf.c +1
-1break ;default :MISSING_CASE (id); -DRM_ERROR ("Unknown i915 perf property ID" ); +DRM_DEBUG ("Unknown i915 perf property ID\n" );return -EINVAL ; }@@ -1595,7 +1595,7 @@ int i915_perf_open_ioctl(struct drm_device *dev,void *data,
drivers/gpu/drm/i915/i915_perf.c int i915_perf_open_ioctl(struct drm_device *dev, void *data,
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-1int ret;if (!dev_priv->perf.initialized) { - DRM_ERROR("i915 perf interface not available for thissystem");
drivers/gpu/drm/i915/i915_perf.c int i915_perf_open_ioctl(struct drm_device *dev, · line 1598
Quoted 1 line
drivers/gpu/drm/i915/i915_perf.c +1
-0+ DRM_DEBUG("i915 perf interface not available for thissystem\n");
drivers/gpu/drm/i915/i915_perf.c int i915_perf_open_ioctl(struct drm_device *dev,
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-0return -ENOTSUPP ; }@@ -1603,7 +1603,7 @@ int i915_perf_open_ioctl(struct drm_device *dev,void *data,
Quoted 11 lines
drivers/gpu/drm/i915/i915_perf.c +1
-2I915_PERF_FLAG_FD_NONBLOCK |I915_PERF_FLAG_DISABLED ;if (param->flags & ~known_open_flags) { -DRM_ERROR ("Unknown drm_i915_perf_open_param flag\n" ); +DRM_DEBUG ("Unknown drm_i915_perf_open_param flag\n" );return -EINVAL ; } --2.10.2
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 5 lines
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 56 lines · Robert Bragg
Quoted 34 lines · Daniel Vetter
Quoted 13 lines · Robert Bragg
Avoid using
DRM_ERRORfor conditions userspace can trigger with a bad config when opening a stream or from not reading data in a timely fashion (whereby the OA buffer fills up). These conditions are tested by i-g-t which treats error messages as failures if using the test runner. This wasn't an issue while the i915-perf igt tests were being run in isolation.One message relating to seeing a spurious zeroed report was changed to use
DRM_NOTEinstead ofDRM_ERROR. Ideally this warning shouldn't be seen, but it's not a serious problem if it is. Considering that the tail margin mechanism is only a heuristic it's possible we might see this from time to time.Quoted 6 lines
Signed-off-by Robert Bragg <[email protected]:Cc Daniel Vetter <[email protected]>fix
i915_perfdbg messages--- drivers/gpu/drm/i915/i915_perf.c | 42 ++++++++++++++++++++--------------------
Review
Quoted 3 lines
1 file changed, 21 insertions(+), 21 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/i915_perf.cdrivers/gpu/drm/i915/i915_perf.c static int gen7_append_oa_reports(struct
Quoted 4 lines
index 9551282..5705005 100644
drivers/gpu/drm/i915/i915_perf.c +0
-0@@ -474,7 +474,7 @@ static int gen7_append_oa_reports(struct
i915_perf_stream*stream,drivers/gpu/drm/i915/i915_perf.c static int gen7_append_oa_reports(struct i915_perf_stream *stream,
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-1* copying it to userspace... */ if (report32[0 ] ==0 ) { - DRM_ERROR("Skipping spurious, invalid OAQuoted 9 lines
report\n");
drivers/gpu/drm/i915/i915_perf.c static int gen7_append_oa_reports(struct i915_perf_stream *stream, · line 478
Quoted 2 lines
drivers/gpu/drm/i915/i915_perf.c +1
-0+DRM_NOTE ("Skipping spurious, invalid OA report\n" );continue ;The above looks like a genuine hw/kernel fail, which we shouldn't put under the carpet. I'd leave it at
DRM_ERROR- I can bikeshed that while applying if you're ok. Otherwise lgtm, will apply as soon as we've clarified that.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.
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.
Quoted 8 lines
We wouldn't want i-g-t failing in this case, so that's why I was changing it.
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.
Ok makes sense, patch applied.
-Daniel
Quoted 203 lines
Regards,
- RobertQuoted 198 lines
-Daniel
drivers/gpu/drm/i915/i915_perf.c static int gen7_oa_read(struct i915_perf_stream
Quoted 3 lines
drivers/gpu/drm/i915/i915_perf.c +0
-0}@@ -551,7 +551,7 @@ static int gen7_oa_read(struct i915_perf_stream*stream,
drivers/gpu/drm/i915/i915_perf.c static int i915_oa_stream_init(struct
Quoted 9 lines
drivers/gpu/drm/i915/i915_perf.c +1
-1if (ret)return ret; -DRM_ERROR ("OA buffer overflow: force restart\n" ); +DRM_DEBUG ("OA buffer overflow: force restart\n" ); dev_priv->perf.oa.ops.oa_disable (dev_priv); dev_priv->perf.oa.ops.oa_enable (dev_priv);@@ -1000,17 +1000,17 @@ static int i915_oa_stream_init(struct
i915_perf_stream*stream,drivers/gpu/drm/i915/i915_perf.c static int i915_oa_stream_init(struct
Quoted 21 lines
drivers/gpu/drm/i915/i915_perf.c +3
-3* IDs */ if (!dev_priv->perf.metrics_kobj) { -DRM_ERROR ("OA metrics weren't advertised via sysfs\n" ); +DRM_DEBUG ("OA metrics weren't advertised via sysfs\n" );return -EINVAL ; }if (!(props->sample_flags &SAMPLE_OA_REPORT )) { -DRM_ERROR ("Only OA report sampling supported\n" ); +DRM_DEBUG ("Only OA report sampling supported\n" );return -EINVAL ; }if (!dev_priv->perf.oa.ops.init_oa_buffer) { -DRM_ERROR ("OA unit not supported\n" ); +DRM_DEBUG ("OA unit not supported\n" );return -ENODEV ; }@@ -1019,17 +1019,17 @@ static int i915_oa_stream_init(struct
i915_perf_stream*stream,drivers/gpu/drm/i915/i915_perf.c i915_perf_open_ioctl_locked(struct
Quoted 21 lines
drivers/gpu/drm/i915/i915_perf.c +3
-3* we currently only allow exclusive access */ if (dev_priv->perf.oa.exclusive_stream) { -DRM_ERROR ("OA unit already in use\n" ); +DRM_DEBUG ("OA unit already in use\n" );return -EBUSY ; }if (!props->metrics_set) { -DRM_ERROR ("OA metric set not specified\n" ); +DRM_DEBUG ("OA metric set not specified\n" );return -EINVAL ; }if (!props->oa_format) { -DRM_ERROR ("OA report format not specified\n" ); +DRM_DEBUG ("OA report format not specified\n" );return -EINVAL ; }@@ -1384,7 +1384,7 @@ i915_perf_open_ioctl_locked(struct
drm_i915_private*dev_priv,drivers/gpu/drm/i915/i915_perf.c i915_perf_open_ioctl_locked(struct drm_i915_private *dev_priv,
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-1if (IS_ERR (specific_ctx)) { ret =PTR_ERR (specific_ctx);if (ret != -EINTR ) - DRM_ERROR("Failed to look up context withID %u for opening perf stream\n",
drivers/gpu/drm/i915/i915_perf.c i915_perf_open_ioctl_locked(struct · line 1387
Quoted 1 line
drivers/gpu/drm/i915/i915_perf.c +1
-0+ DRM_DEBUG("Failed to look up context withID %u for opening perf stream\n",
drivers/gpu/drm/i915/i915_perf.c i915_perf_open_ioctl_locked(struct
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-0ctx_handle); goto err; }@@ -1397,7 +1397,7 @@ i915_perf_open_ioctl_locked(struct
drm_i915_private*dev_priv,drivers/gpu/drm/i915/i915_perf.c i915_perf_open_ioctl_locked(struct drm_i915_private *dev_priv,
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-1*/ if (!specific_ctx && i915_perf_stream_paranoid && !capable (CAP_SYS_ADMIN )) { - DRM_ERROR("Insufficient privileges to open system-widei915 perf stream\n");
drivers/gpu/drm/i915/i915_perf.c i915_perf_open_ioctl_locked(struct · line 1400
Quoted 1 line
drivers/gpu/drm/i915/i915_perf.c +1
-0+ DRM_DEBUG("Insufficient privileges to open system-widei915 perf stream\n");
drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-0ret = -EACCES ; goto err_ctx; }@@ -1476,7 +1476,7 @@ static int read_properties_unlocked(struct
drm_i915_private*dev_priv,drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct
Quoted 9 lines
drivers/gpu/drm/i915/i915_perf.c +1
-1memset (props,0 ,sizeof (struct perf_open_properties ));if (!n_props) { -DRM_ERROR ("No i915 perf properties given" ); +DRM_DEBUG ("No i915 perf properties given\n" );return -EINVAL ; }@@ -1487,7 +1487,7 @@ static int read_properties_unlocked(struct
drm_i915_private*dev_priv,drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct drm_i915_private *dev_priv,
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-1* from userspace. */ if (n_props >=DRM_I915_PERF_PROP_MAX ) { - DRM_ERROR("More i915 perf properties specified thanexist");
drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct · line 1490
Quoted 1 line
drivers/gpu/drm/i915/i915_perf.c +1
-0+ DRM_DEBUG("More i915 perf properties specified thanexist\n");
drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-0return -EINVAL ; }@@ -1515,26 +1515,26 @@ static int read_properties_unlocked(struct
drm_i915_private*dev_priv,Quoted 15 lines
drivers/gpu/drm/i915/i915_perf.c +2
-2case DRM_I915_PERF_PROP_OA_METRICS_SET :if (value ==0 || value > dev_priv->perf.oa.n_builtin_sets) { -DRM_ERROR ("Unknown OA metric set ID" ); +DRM_DEBUG ("Unknown OA metric set ID\n" );return -EINVAL ; } props->metrics_set = value;break ;case DRM_I915_PERF_PROP_OA_FORMAT :if (value ==0 || value >=I915_OA_FORMAT_MAX ) { -DRM_ERROR ("Invalid OA report format\n" ); +DRM_DEBUG ("Invalid OA report format\n" );return -EINVAL ; }drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct drm_i915_private *dev_priv,
Quoted 10 lines
drivers/gpu/drm/i915/i915_perf.c +1
-2if (!dev_priv->perf.oa.oa_formats[value].size) { -DRM_ERROR ("Invalid OA report format\n" ); +DRM_DEBUG ("Invalid OA report format\n" );return -EINVAL ; } props->oa_format = value;break ;case DRM_I915_PERF_PROP_OA_EXPONENT :if (value >OA_EXPONENT_MAX ) { - DRM_ERROR("OA timer exponent too high (>%u)\n",
drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct · line 1536
Quoted 2 lines
drivers/gpu/drm/i915/i915_perf.c +1
-1- OA_EXPONENT_MAX); + DRM_DEBUG("OA timer exponent too high (>%u)\n",
drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct
Quoted 5 lines
drivers/gpu/drm/i915/i915_perf.c +1
-0+ OA_EXPONENT_MAX);return -EINVAL ; }@@ -1565,7 +1565,7 @@ static int read_properties_unlocked(struct
drm_i915_private*dev_priv,drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct drm_i915_private *dev_priv,
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-1if (oa_freq_hz > i915_oa_max_sample_rate && !capable (CAP_SYS_ADMIN )) { - DRM_ERROR("OA exponent would exceed themax sampling frequency (sysctl dev.i915.oa_max_sample_rate) %uHz without root privileges\n",
drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct · line 1567
Quoted 1 line
drivers/gpu/drm/i915/i915_perf.c +1
-0+ DRM_DEBUG("OA exponent would exceed themax sampling frequency (sysctl dev.i915.oa_max_sample_rate) %uHz without root privileges\n",
drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-0i915_oa_max_sample_rate);return -EACCES ; }@@ -1575,7 +1575,7 @@ static int read_properties_unlocked(struct
drm_i915_private*dev_priv,drivers/gpu/drm/i915/i915_perf.c int i915_perf_open_ioctl(struct drm_device *dev,
Quoted 9 lines
drivers/gpu/drm/i915/i915_perf.c +1
-1break ;default :MISSING_CASE (id); -DRM_ERROR ("Unknown i915 perf property ID" ); +DRM_DEBUG ("Unknown i915 perf property ID\n" );return -EINVAL ; }@@ -1595,7 +1595,7 @@ int i915_perf_open_ioctl(struct drm_device *dev,void *data,
drivers/gpu/drm/i915/i915_perf.c int i915_perf_open_ioctl(struct drm_device *dev, void *data,
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-1int ret;if (!dev_priv->perf.initialized) { - DRM_ERROR("i915 perf interface not available for thissystem");
drivers/gpu/drm/i915/i915_perf.c int i915_perf_open_ioctl(struct drm_device *dev, · line 1598
Quoted 1 line
drivers/gpu/drm/i915/i915_perf.c +1
-0+ DRM_DEBUG("i915 perf interface not available for thissystem\n");
drivers/gpu/drm/i915/i915_perf.c int i915_perf_open_ioctl(struct drm_device *dev,
Quoted 4 lines
drivers/gpu/drm/i915/i915_perf.c +0
-0return -ENOTSUPP ; }@@ -1603,7 +1603,7 @@ int i915_perf_open_ioctl(struct drm_device *dev,void *data,
Quoted 11 lines
drivers/gpu/drm/i915/i915_perf.c +1
-2I915_PERF_FLAG_FD_NONBLOCK |I915_PERF_FLAG_DISABLED ;if (param->flags & ~known_open_flags) { -DRM_ERROR ("Unknown drm_i915_perf_open_param flag\n" ); +DRM_DEBUG ("Unknown drm_i915_perf_open_param flag\n" );return -EINVAL ; } --2.10.2
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx