drm/xe: Enhance CT_DEAD for production builds
Subsystems (2)
Matthew Brost
maintainerPATCH 1/1 drm/xe: Enhance CT_DEAD for production builds
If the CT fails on production builds, log its state to dmesg for quick analysis. Also, log the CT state if a G2H fence times out.
Cc Daniele Ceraolo Spurio <[email protected]>
Signed-off-by Matthew Brost <[email protected]>
--- drivers/gpu/drm/xe/xe_guc_ct.c | 35 ++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-)
drivers/gpu/drm/xe/xe_guc_ct.c +29 -6
@@ -41,8 +41,8 @@ static void safe_mode_worker_func(struct work_struct *w);static void ct_exit_safe_mode (struct xe_guc_ct *ct);static void guc_ct_change_state (struct xe_guc_ct *ct,enum xe_guc_ct_state state); +static void xe_guc_ct_print_err_state (struct xe_guc_ct *ct,int reason); -#if IS_ENABLED (CONFIG_DRM_XE_DEBUG )enum {/* Internal states, not error conditions */ CT_DEAD_STATE_REARM ,/* 0x0001 */
@@ -63,18 +63,21 @@ enum {CT_DEAD_PARSE_G2H_ORIGIN ,/* 0x2000 */ CT_DEAD_PARSE_G2H_TYPE ,/* 0x4000 */ CT_DEAD_CRASH ,/* 0x8000 */ + CT_DEAD_G2H_TIMEOUT, /* 0x10000 */ }; +#if IS_ENABLED (CONFIG_DRM_XE_DEBUG )static void ct_dead_worker_func (struct work_struct *w);static void ct_dead_capture (struct xe_guc_ct *ct,struct guc_ctb *ctb,u32 reason_code);#define CT_DEAD (ct, ctb, reason_code) ct_dead_capture((ct), (ctb), CT_DEAD_##reason_code)#else -#define CT_DEAD (ct, ctb, reason) \ - do { \ - struct guc_ctb *_ctb = (ctb); \ - if (_ctb) \ - _ctb->info.broken = true; \ +#define CT_DEAD (ct, ctb, reason_code) \ + do { \ + struct guc_ctb *_ctb = (ctb); \ + xe_guc_ct_print_err_state(ct, CT_DEAD_##reason_code); \ + if (_ctb) \ + _ctb->info.broken = true; \ } while (0)#endif
@@ -2016,6 +2019,26 @@ void xe_guc_ct_print(struct xe_guc_ct *ct, struct drm_printer *p, bool want_ctb)xe_guc_ct_snapshot_free (snapshot); } +static void xe_guc_ct_print_err_state (struct xe_guc_ct *ct,int reason) +{ +struct xe_device *xe =ct_to_xe (ct); +struct xe_gt *gt =ct_to_gt (ct); +struct guc_ctb *h2g = &ct->ctbs.h2g; +struct guc_ctb *g2h = &ct->ctbs.g2h; + +/* Don't spam dmesg, only print first failure */ +if (h2g->info.broken || g2h->info.broken) +return ; + +xe_gt_err (gt,"CT_DEAD: reason=%d\n" , reason); +xe_gt_err (gt,"H2G.head=%d, H2G.tail=%d, H2G.status=%d\n" , +desc_read (xe, h2g, head),desc_read (xe, h2g, tail), +desc_read (xe, h2g, status)); +xe_gt_err (gt,"G2H.head=%d, G2H.tail=%d, G2H.status=%d\n" , +desc_read (xe, g2h, head),desc_read (xe, g2h, tail), +desc_read (xe, g2h, status)); +} +#if IS_ENABLED (CONFIG_DRM_XE_DEBUG )#ifdef CONFIG_FUNCTION_ERROR_INJECTION
Signature · 1 line
2.34.1