Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/xe/guc: Limit sleep while waiting for H2G credits

Instead of endlessly increasing the sleep timeout while waiting
for the H2G credits, use exponential increase only up to the given
limit, like it was initially done in the GuC submission code.

While here, fix the actual timeout to the 1s as it was documented.

Suggested-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20260127193727.601-4-michal.wajdeczko@intel.com

+7 -5
+7 -5
drivers/gpu/drm/xe/xe_guc_ct.c
··· 32 32 #include "xe_guc_tlb_inval.h" 33 33 #include "xe_map.h" 34 34 #include "xe_pm.h" 35 + #include "xe_sleep.h" 35 36 #include "xe_sriov_vf.h" 36 37 #include "xe_trace_guc.h" 37 38 ··· 1102 1101 */ 1103 1102 static bool guc_ct_send_wait_for_retry(struct xe_guc_ct *ct, u32 len, 1104 1103 u32 g2h_len, struct g2h_fence *g2h_fence, 1105 - unsigned int *sleep_period_ms) 1104 + unsigned int *sleep_period_ms, 1105 + unsigned int *sleep_total_ms) 1106 1106 { 1107 1107 struct xe_device *xe = ct_to_xe(ct); 1108 1108 ··· 1117 1115 if (!h2g_has_room(ct, len + GUC_CTB_HDR_LEN)) { 1118 1116 struct guc_ctb *h2g = &ct->ctbs.h2g; 1119 1117 1120 - if (*sleep_period_ms == 1024) 1118 + if (*sleep_total_ms > 1000) 1121 1119 return false; 1122 1120 1123 1121 trace_xe_guc_ct_h2g_flow_control(xe, h2g->info.head, h2g->info.tail, 1124 1122 h2g->info.size, 1125 1123 h2g->info.space, 1126 1124 len + GUC_CTB_HDR_LEN); 1127 - msleep(*sleep_period_ms); 1128 - *sleep_period_ms <<= 1; 1125 + xe_sleep_exponential_ms(sleep_period_ms, 64); 1129 1126 } else { 1130 1127 struct xe_device *xe = ct_to_xe(ct); 1131 1128 struct guc_ctb *g2h = &ct->ctbs.g2h; ··· 1162 1161 { 1163 1162 struct xe_gt *gt = ct_to_gt(ct); 1164 1163 unsigned int sleep_period_ms = 1; 1164 + unsigned int sleep_total_ms = 0; 1165 1165 int ret; 1166 1166 1167 1167 xe_gt_assert(gt, !g2h_len || !g2h_fence); ··· 1175 1173 1176 1174 if (unlikely(ret == -EBUSY)) { 1177 1175 if (!guc_ct_send_wait_for_retry(ct, len, g2h_len, g2h_fence, 1178 - &sleep_period_ms)) 1176 + &sleep_period_ms, &sleep_total_ms)) 1179 1177 goto broken; 1180 1178 goto try_again; 1181 1179 }