Skip to contentSkip to conversation

fifo: only reboot engines if they have a ref

RFC New Karol Herbst 1 participant 1 message Oct 7, 2020

lore
Share & tools
lore
#0 lore raw

RFC 1/1 fifo: only reboot engines if they have a ref

this prevents double fini/init on engines and also fixes the "gr: fecs falcon already acquired by gr!" error I was seeing.

RFC comment: not sure if this is the right solution, but it does fix the issue for me. And I guess if this is a valid approach older/newer chipset might need similiar fixes?

---
 drm/nouveau/nvkm/engine/fifo/gk104.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drm/nouveau/nvkm/engine/fifo/gk104.c +6 -2
index 441483325..669153fba 100644
@@ -292,8 +292,12 @@ gk104_fifo_recover_work(struct work_struct *w)
 
 	for (todo = engm; engn = __ffs(todo), todo; todo &= ~BIT(engn)) {
 		if ((engine = fifo->engine[engn].engine)) {
-			nvkm_subdev_fini(&engine->subdev, false);
-			WARN_ON(nvkm_subdev_init(&engine->subdev));
+			mutex_lock(&engine->subdev.mutex);
+			if (engine->usecount) {
+				nvkm_subdev_fini(&engine->subdev, false);
+				WARN_ON(nvkm_subdev_init(&engine->subdev));
+			}
+			mutex_unlock(&engine->subdev.mutex);
 		}
 	}
 
Signature · 1 line
2.26.2