diff mbox

drm/i915: Enable inject_load_failure only in DEBUG config

Message ID 20180201173248.3912-1-michal.wajdeczko@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michal Wajdeczko Feb. 1, 2018, 5:32 p.m. UTC
We're using i915_inject_load_failure() to inject dummy
faults during driver load, but since this is debug utility
we shouldn't expose it in default config as it consumes
both code and data.

add/remove: 0/1 grow/shrink: 0/2 up/down: 0/-302 (-302)
Function                                     old     new   delta
__i915_inject_load_failure                    61       -     -61
i915_gem_init                               1331    1268     -63
i915_driver_load                            5923    5745    -178
Total: Before=1177454, After=1177152, chg -0.03%

add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-4 (-4)
Data                                         old     new   delta
i915_load_fail_count                           4       -      -4
Total: Before=56762, After=56758, chg -0.01%

add/remove: 4/8 grow/shrink: 0/1 up/down: 245/-591 (-346)
RO Data                                      old     new   delta
__param_str_inject_load_failure               20       -     -20
__UNIQUE_ID_inject_load_failuretype200        34       -     -34
__param_inject_load_failure                   40       -     -40
__func__                                    4998    4896    -102
__UNIQUE_ID_inject_load_failure201           150       -    -150
Total: Before=119095, After=118749, chg -0.29%

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_drv.c    | 6 ++++++
 drivers/gpu/drm/i915/i915_drv.h    | 4 ++++
 drivers/gpu/drm/i915/i915_params.c | 2 ++
 3 files changed, 12 insertions(+)

Comments

Chris Wilson Feb. 1, 2018, 5:42 p.m. UTC | #1
Quoting Michal Wajdeczko (2018-02-01 17:32:48)
> We're using i915_inject_load_failure() to inject dummy
> faults during driver load, but since this is debug utility
> we shouldn't expose it in default config as it consumes
> both code and data.
> 
> add/remove: 0/1 grow/shrink: 0/2 up/down: 0/-302 (-302)
> Function                                     old     new   delta
> __i915_inject_load_failure                    61       -     -61
> i915_gem_init                               1331    1268     -63
> i915_driver_load                            5923    5745    -178
> Total: Before=1177454, After=1177152, chg -0.03%
> 
> add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-4 (-4)
> Data                                         old     new   delta
> i915_load_fail_count                           4       -      -4
> Total: Before=56762, After=56758, chg -0.01%
> 
> add/remove: 4/8 grow/shrink: 0/1 up/down: 245/-591 (-346)
> RO Data                                      old     new   delta
> __param_str_inject_load_failure               20       -     -20
> __UNIQUE_ID_inject_load_failuretype200        34       -     -34
> __param_inject_load_failure                   40       -     -40
> __func__                                    4998    4896    -102
> __UNIQUE_ID_inject_load_failure201           150       -    -150
> Total: Before=119095, After=118749, chg -0.29%
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_drv.c    | 6 ++++++
>  drivers/gpu/drm/i915/i915_drv.h    | 4 ++++
>  drivers/gpu/drm/i915/i915_params.c | 2 ++

git add for i915_params.h ? ;)
-Chris
Michal Wajdeczko Feb. 1, 2018, 5:45 p.m. UTC | #2
On Thu, 01 Feb 2018 18:42:00 +0100, Chris Wilson  
<chris@chris-wilson.co.uk> wrote:

> Quoting Michal Wajdeczko (2018-02-01 17:32:48)
>> We're using i915_inject_load_failure() to inject dummy
>> faults during driver load, but since this is debug utility
>> we shouldn't expose it in default config as it consumes
>> both code and data.
>>
>> add/remove: 0/1 grow/shrink: 0/2 up/down: 0/-302 (-302)
>> Function                                     old     new   delta
>> __i915_inject_load_failure                    61       -     -61
>> i915_gem_init                               1331    1268     -63
>> i915_driver_load                            5923    5745    -178
>> Total: Before=1177454, After=1177152, chg -0.03%
>>
>> add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-4 (-4)
>> Data                                         old     new   delta
>> i915_load_fail_count                           4       -      -4
>> Total: Before=56762, After=56758, chg -0.01%
>>
>> add/remove: 4/8 grow/shrink: 0/1 up/down: 245/-591 (-346)
>> RO Data                                      old     new   delta
>> __param_str_inject_load_failure               20       -     -20
>> __UNIQUE_ID_inject_load_failuretype200        34       -     -34
>> __param_inject_load_failure                   40       -     -40
>> __func__                                    4998    4896    -102
>> __UNIQUE_ID_inject_load_failure201           150       -    -150
>> Total: Before=119095, After=118749, chg -0.29%
>>
>> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>> ---
>>  drivers/gpu/drm/i915/i915_drv.c    | 6 ++++++
>>  drivers/gpu/drm/i915/i915_drv.h    | 4 ++++
>>  drivers/gpu/drm/i915/i915_params.c | 2 ++
>
> git add for i915_params.h ? ;)

No,

It looks that we leave corresponding internal member unchanged.
See "error_capture" param that is also guarded by the config.

Michal
Chris Wilson Feb. 1, 2018, 5:49 p.m. UTC | #3
Quoting Michal Wajdeczko (2018-02-01 17:45:52)
> On Thu, 01 Feb 2018 18:42:00 +0100, Chris Wilson  
> <chris@chris-wilson.co.uk> wrote:
> 
> > Quoting Michal Wajdeczko (2018-02-01 17:32:48)
> >> We're using i915_inject_load_failure() to inject dummy
> >> faults during driver load, but since this is debug utility
> >> we shouldn't expose it in default config as it consumes
> >> both code and data.
> >>
> >> add/remove: 0/1 grow/shrink: 0/2 up/down: 0/-302 (-302)
> >> Function                                     old     new   delta
> >> __i915_inject_load_failure                    61       -     -61
> >> i915_gem_init                               1331    1268     -63
> >> i915_driver_load                            5923    5745    -178
> >> Total: Before=1177454, After=1177152, chg -0.03%
> >>
> >> add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-4 (-4)
> >> Data                                         old     new   delta
> >> i915_load_fail_count                           4       -      -4
> >> Total: Before=56762, After=56758, chg -0.01%
> >>
> >> add/remove: 4/8 grow/shrink: 0/1 up/down: 245/-591 (-346)
> >> RO Data                                      old     new   delta
> >> __param_str_inject_load_failure               20       -     -20
> >> __UNIQUE_ID_inject_load_failuretype200        34       -     -34
> >> __param_inject_load_failure                   40       -     -40
> >> __func__                                    4998    4896    -102
> >> __UNIQUE_ID_inject_load_failure201           150       -    -150
> >> Total: Before=119095, After=118749, chg -0.29%
> >>
> >> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> >> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> >> ---
> >>  drivers/gpu/drm/i915/i915_drv.c    | 6 ++++++
> >>  drivers/gpu/drm/i915/i915_drv.h    | 4 ++++
> >>  drivers/gpu/drm/i915/i915_params.c | 2 ++
> >
> > git add for i915_params.h ? ;)
> 
> No,
> 
> It looks that we leave corresponding internal member unchanged.
> See "error_capture" param that is also guarded by the config.

Hmm, macros within macros. Ah yes. Fair enough, everything else looked
good and I was just checking if there might be any other possible changes,
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
Chris Wilson Feb. 2, 2018, 2:22 p.m. UTC | #4
Quoting Michal Wajdeczko (2018-02-01 17:32:48)
> We're using i915_inject_load_failure() to inject dummy
> faults during driver load, but since this is debug utility
> we shouldn't expose it in default config as it consumes
> both code and data.
> 
> add/remove: 0/1 grow/shrink: 0/2 up/down: 0/-302 (-302)
> Function                                     old     new   delta
> __i915_inject_load_failure                    61       -     -61
> i915_gem_init                               1331    1268     -63
> i915_driver_load                            5923    5745    -178
> Total: Before=1177454, After=1177152, chg -0.03%
> 
> add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-4 (-4)
> Data                                         old     new   delta
> i915_load_fail_count                           4       -      -4
> Total: Before=56762, After=56758, chg -0.01%
> 
> add/remove: 4/8 grow/shrink: 0/1 up/down: 245/-591 (-346)
> RO Data                                      old     new   delta
> __param_str_inject_load_failure               20       -     -20
> __UNIQUE_ID_inject_load_failuretype200        34       -     -34
> __param_inject_load_failure                   40       -     -40
> __func__                                    4998    4896    -102
> __UNIQUE_ID_inject_load_failure201           150       -    -150
> Total: Before=119095, After=118749, chg -0.29%
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>

No objections, pushed. Thanks for the patch,
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 1ec12ad..6e7e933 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -55,6 +55,7 @@ 
 
 static struct drm_driver driver;
 
+#if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
 static unsigned int i915_load_fail_count;
 
 bool __i915_inject_load_failure(const char *func, int line)
@@ -70,6 +71,7 @@  bool __i915_inject_load_failure(const char *func, int line)
 
 	return false;
 }
+#endif
 
 #define FDO_BUG_URL "https://bugs.freedesktop.org/enter_bug.cgi?product=DRI"
 #define FDO_BUG_MSG "Please file a bug at " FDO_BUG_URL " against DRM/Intel " \
@@ -107,8 +109,12 @@  bool __i915_inject_load_failure(const char *func, int line)
 
 static bool i915_error_injected(struct drm_i915_private *dev_priv)
 {
+#if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
 	return i915_modparams.inject_load_failure &&
 	       i915_load_fail_count == i915_modparams.inject_load_failure;
+#else
+	return false;
+#endif
 }
 
 #define i915_load_error(dev_priv, fmt, ...)				     \
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index c676269..8344ecb 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -104,9 +104,13 @@ 
 #define I915_STATE_WARN_ON(x)						\
 	I915_STATE_WARN((x), "%s", "WARN_ON(" __stringify(x) ")")
 
+#if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
 bool __i915_inject_load_failure(const char *func, int line);
 #define i915_inject_load_failure() \
 	__i915_inject_load_failure(__func__, __LINE__)
+#else
+#define i915_inject_load_failure() false
+#endif
 
 typedef struct {
 	uint32_t val;
diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
index 0b553a8..08108ce 100644
--- a/drivers/gpu/drm/i915/i915_params.c
+++ b/drivers/gpu/drm/i915/i915_params.c
@@ -167,8 +167,10 @@  struct i915_params i915_modparams __read_mostly = {
 i915_param_named_unsafe(enable_dp_mst, bool, 0600,
 	"Enable multi-stream transport (MST) for new DisplayPort sinks. (default: true)");
 
+#if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
 i915_param_named_unsafe(inject_load_failure, uint, 0400,
 	"Force an error after a number of failure check points (0:disabled (default), N:force failure at the Nth failure check point)");
+#endif
 
 i915_param_named(enable_dpcd_backlight, bool, 0600,
 	"Enable support for DPCD backlight control (default:false)");