* [PATCH 1/2] drm: Add DRM_ERROR_ON replacement for WARN_ON
@ 2015-07-27 9:17 Chris Wilson
2015-07-27 9:17 ` [PATCH 2/2] drm/i915: Switch a couple of BUG_ONs in the cmdparser over to DRM_ERROR Chris Wilson
0 siblings, 1 reply; 3+ messages in thread
From: Chris Wilson @ 2015-07-27 9:17 UTC (permalink / raw)
To: dri-devel, intel-gfx
i915 has a habit of using WARN_ON and spewing stacktraces into the
kernel logs and beyond. For the majority of cases, we do not care about
the stacktrace, we know precisely where and when the error occurs so
hunting down the exact instance is not a concern, we only need the
content of the error.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
include/drm/drmP.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 4717449d6aa9..b76af322d812 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -164,6 +164,23 @@ void drm_err(const char *format, ...);
drm_err(fmt, ##__VA_ARGS__)
/**
+ * Assertion-esque error output.
+ *
+ * \param cond condition on which to *fail*
+ * \param fmt printf() like format string.
+ * \param arg arguments
+ *
+ * This is similar to WARN_ON but only prints a DRM_ERROR rather than a whole
+ * stacktrace.
+ */
+#define DRM_ERROR_ON(cond, fmt, ...) ({ \
+ bool __cond = !!(cond); \
+ if (unlikely(__cond)) \
+ drm_err("assertion failed, %s: " fmt, #cond, ##__VA_ARGS__); \
+ unlikely(__cond); \
+})
+
+/**
* Rate limited error output. Like DRM_ERROR() but won't flood the log.
*
* \param fmt printf() like format string.
--
2.4.6
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] drm/i915: Switch a couple of BUG_ONs in the cmdparser over to DRM_ERROR
2015-07-27 9:17 [PATCH 1/2] drm: Add DRM_ERROR_ON replacement for WARN_ON Chris Wilson
@ 2015-07-27 9:17 ` Chris Wilson
2015-07-28 8:46 ` shuang.he
0 siblings, 1 reply; 3+ messages in thread
From: Chris Wilson @ 2015-07-27 9:17 UTC (permalink / raw)
To: dri-devel, intel-gfx
No need to break module and system loading due to a programming bug.
Remove the BUG_ON and replace with a gentler DRM_ERROR_ON and error
return.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_cmd_parser.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_cmd_parser.c b/drivers/gpu/drm/i915/i915_cmd_parser.c
index fd9abe6e0ab1..dcd096536119 100644
--- a/drivers/gpu/drm/i915/i915_cmd_parser.c
+++ b/drivers/gpu/drm/i915/i915_cmd_parser.c
@@ -738,11 +738,16 @@ int i915_cmd_parser_init_ring(struct intel_engine_cs *ring)
default:
DRM_ERROR("CMD: cmd_parser_init with unknown ring: %d\n",
ring->id);
- BUG();
+ return -ENODEV;
}
- BUG_ON(!validate_cmds_sorted(ring, cmd_tables, cmd_table_count));
- BUG_ON(!validate_regs_sorted(ring));
+ if (DRM_ERROR_ON(!validate_cmds_sorted(ring, cmd_tables, cmd_table_count),
+ "command parser table is not sorted - required for bisetion searching\n"))
+ return -ENODEV;
+
+ if (DRM_ERROR_ON(!validate_regs_sorted(ring),
+ "register lists are not sorted - required for bisection searching\n"))
+ return -ENODEV;
WARN_ON(!hash_empty(ring->cmd_hash));
--
2.4.6
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] drm/i915: Switch a couple of BUG_ONs in the cmdparser over to DRM_ERROR
2015-07-27 9:17 ` [PATCH 2/2] drm/i915: Switch a couple of BUG_ONs in the cmdparser over to DRM_ERROR Chris Wilson
@ 2015-07-28 8:46 ` shuang.he
0 siblings, 0 replies; 3+ messages in thread
From: shuang.he @ 2015-07-28 8:46 UTC (permalink / raw)
To: shuang.he, julianx.dumez, christophe.sureau, lei.a.liu, intel-gfx,
chris
Tested-By: Intel Graphics QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
Task id: 6871
-------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
ILK 297/297 297/297
SNB 315/315 315/315
IVB 342/342 342/342
BYT 284/284 284/284
HSW 378/378 378/378
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-28 8:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-27 9:17 [PATCH 1/2] drm: Add DRM_ERROR_ON replacement for WARN_ON Chris Wilson
2015-07-27 9:17 ` [PATCH 2/2] drm/i915: Switch a couple of BUG_ONs in the cmdparser over to DRM_ERROR Chris Wilson
2015-07-28 8:46 ` shuang.he
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox