Skip to content

Commit e2c719b

Browse files
robclarkdanvet
authored andcommitted
drm/i915: tame the chattermouth (v2)
Many distro's have mechanism in place to collect and automatically file bugs for failed WARN()s. And since i915 has a lot of hw state sanity checks which result in WARN(), it generates quite a lot of noise which is somewhat disconcerting to the end user. Separate out the internal hw-is-in-the-state-I-expected checks into I915_STATE_WARN()s and allow configuration via i915.verbose_checks module param about whether this will generate a full blown stacktrace or just DRM_ERROR(). The new moduleparam defaults to true, so by default there is no change in behavior. And even when disabled, you will still get an error message logged. v2: paint the macro names blue, clarify that the default behavior remains the same as before Signed-off-by: Rob Clark <robdclark@gmail.com> Acked-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent e6c1abb commit e2c719b

File tree

5 files changed

+105
-70
lines changed

5 files changed

+105
-70
lines changed

drivers/gpu/drm/i915/i915_drv.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,35 @@
7272
#define MISSING_CASE(x) WARN(1, "Missing switch case (%lu) in %s\n", \
7373
(long) (x), __func__);
7474

75+
/* Use I915_STATE_WARN(x) and I915_STATE_WARN_ON() (rather than WARN() and
76+
* WARN_ON()) for hw state sanity checks to check for unexpected conditions
77+
* which may not necessarily be a user visible problem. This will either
78+
* WARN() or DRM_ERROR() depending on the verbose_checks moduleparam, to
79+
* enable distros and users to tailor their preferred amount of i915 abrt
80+
* spam.
81+
*/
82+
#define I915_STATE_WARN(condition, format...) ({ \
83+
int __ret_warn_on = !!(condition); \
84+
if (unlikely(__ret_warn_on)) { \
85+
if (i915.verbose_state_checks) \
86+
__WARN_printf(format); \
87+
else \
88+
DRM_ERROR(format); \
89+
} \
90+
unlikely(__ret_warn_on); \
91+
})
92+
93+
#define I915_STATE_WARN_ON(condition) ({ \
94+
int __ret_warn_on = !!(condition); \
95+
if (unlikely(__ret_warn_on)) { \
96+
if (i915.verbose_state_checks) \
97+
__WARN_printf("WARN_ON(" #condition ")\n"); \
98+
else \
99+
DRM_ERROR("WARN_ON(" #condition ")\n"); \
100+
} \
101+
unlikely(__ret_warn_on); \
102+
})
103+
75104
enum pipe {
76105
INVALID_PIPE = -1,
77106
PIPE_A = 0,
@@ -2401,6 +2430,7 @@ struct i915_params {
24012430
bool disable_vtd_wa;
24022431
int use_mmio_flip;
24032432
bool mmio_debug;
2433+
bool verbose_state_checks;
24042434
};
24052435
extern struct i915_params i915 __read_mostly;
24062436

drivers/gpu/drm/i915/i915_params.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ struct i915_params i915 __read_mostly = {
5151
.disable_vtd_wa = 0,
5252
.use_mmio_flip = 0,
5353
.mmio_debug = 0,
54+
.verbose_state_checks = 1,
5455
};
5556

5657
module_param_named(modeset, i915.modeset, int, 0400);
@@ -173,3 +174,7 @@ module_param_named(mmio_debug, i915.mmio_debug, bool, 0600);
173174
MODULE_PARM_DESC(mmio_debug,
174175
"Enable the MMIO debug code (default: false). This may negatively "
175176
"affect performance.");
177+
178+
module_param_named(verbose_state_checks, i915.verbose_state_checks, bool, 0600);
179+
MODULE_PARM_DESC(verbose_state_checks,
180+
"Enable verbose logs (ie. WARN_ON()) in case of unexpected hw state conditions.");

0 commit comments

Comments
 (0)