Skip to content

Commit ad40098

Browse files
mwajdeczThomas Hellström
authored andcommitted
drm/xe/guc: Explicitly exit CT safe mode on unwind
During driver probe we might be briefly using CT safe mode, which is based on a delayed work, but usually we are able to stop this once we have IRQ fully operational. However, if we abort the probe quite early then during unwind we might try to destroy the workqueue while there is still a pending delayed work that attempts to restart itself which triggers a WARN. This was recently observed during unsuccessful VF initialization: [ ] xe 0000:00:02.1: probe with driver xe failed with error -62 [ ] ------------[ cut here ]------------ [ ] workqueue: cannot queue safe_mode_worker_func [xe] on wq xe-g2h-wq [ ] WARNING: CPU: 9 PID: 0 at kernel/workqueue.c:2257 __queue_work+0x287/0x710 [ ] RIP: 0010:__queue_work+0x287/0x710 [ ] Call Trace: [ ] delayed_work_timer_fn+0x19/0x30 [ ] call_timer_fn+0xa1/0x2a0 Exit the CT safe mode on unwind to avoid that warning. Fixes: 09b2869 ("drm/xe/guc: Allow CTB G2H processing without G2H IRQ") Signed-off-by: Michal Wajdeczko <[email protected]> Cc: Matthew Brost <[email protected]> Reviewed-by: Matthew Brost <[email protected]> Link: https://lore.kernel.org/r/[email protected] (cherry picked from commit 2ddbb73) Signed-off-by: Thomas Hellström <[email protected]>
1 parent f16873f commit ad40098

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/gpu/drm/xe/xe_guc_ct.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
#include "xe_pm.h"
3535
#include "xe_trace_guc.h"
3636

37+
static void receive_g2h(struct xe_guc_ct *ct);
38+
static void g2h_worker_func(struct work_struct *w);
39+
static void safe_mode_worker_func(struct work_struct *w);
40+
static void ct_exit_safe_mode(struct xe_guc_ct *ct);
41+
3742
#if IS_ENABLED(CONFIG_DRM_XE_DEBUG)
3843
enum {
3944
/* Internal states, not error conditions */
@@ -186,14 +191,11 @@ static void guc_ct_fini(struct drm_device *drm, void *arg)
186191
{
187192
struct xe_guc_ct *ct = arg;
188193

194+
ct_exit_safe_mode(ct);
189195
destroy_workqueue(ct->g2h_wq);
190196
xa_destroy(&ct->fence_lookup);
191197
}
192198

193-
static void receive_g2h(struct xe_guc_ct *ct);
194-
static void g2h_worker_func(struct work_struct *w);
195-
static void safe_mode_worker_func(struct work_struct *w);
196-
197199
static void primelockdep(struct xe_guc_ct *ct)
198200
{
199201
if (!IS_ENABLED(CONFIG_LOCKDEP))

0 commit comments

Comments
 (0)