[Nouveau] [RFC] fifo: only reboot engines if they have a ref

Karol Herbst kherbst at redhat.com
Wed Oct 7 15:13:56 UTC 2020


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?

Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
 drm/nouveau/nvkm/engine/fifo/gk104.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drm/nouveau/nvkm/engine/fifo/gk104.c b/drm/nouveau/nvkm/engine/fifo/gk104.c
index 441483325..669153fba 100644
--- a/drm/nouveau/nvkm/engine/fifo/gk104.c
+++ b/drm/nouveau/nvkm/engine/fifo/gk104.c
@@ -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);
 		}
 	}
 
-- 
2.26.2



More information about the Nouveau mailing list