drm/nouveau: Evict buffers in VRAM before freeing sgdma
authorLuca Barbieri <luca@luca-barbieri.com>
Sat, 16 Jan 2010 14:30:15 +0000 (15:30 +0100)
committerBen Skeggs <bskeggs@redhat.com>
Sun, 17 Jan 2010 23:56:13 +0000 (09:56 +1000)
Currently, we take down the sgdma engine without evicting all buffers
from VRAM.

The TTM device release will try to evict anything in VRAM to GART
memory, but this will fail since sgdma has already been taken down.

This causes an infinite loop in kernel mode on module unload.
It usually doesn't happen because there aren't any buffer on close.
However, if the GPU is locked up, this condition is easily triggered.

This patch fixes it in the simplest way possible by cleaning VRAM
right before cleaning SGDMA memory.

Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_mem.c
drivers/gpu/drm/nouveau/nouveau_state.c

index 186f34b01f2eb10cdb94fae035f8554bdd3ee3b0..8f3a12f614ed27e4bcade0cd1f76863af59c8d48 100644 (file)
@@ -386,7 +386,6 @@ void nouveau_mem_close(struct drm_device *dev)
        nouveau_bo_unpin(dev_priv->vga_ram);
        nouveau_bo_ref(NULL, &dev_priv->vga_ram);
 
-       ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_VRAM);
        ttm_bo_device_release(&dev_priv->ttm.bdev);
 
        nouveau_ttm_global_release(dev_priv);
index 09b9a46dfc0ec0337f1ecf60b04585b8fddddff4..f2d0187ba152fb8c7018b7c0d925c1cc60704cf6 100644 (file)
@@ -525,6 +525,7 @@ static void nouveau_card_takedown(struct drm_device *dev)
                engine->mc.takedown(dev);
 
                mutex_lock(&dev->struct_mutex);
+               ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_VRAM);
                ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_TT);
                mutex_unlock(&dev->struct_mutex);
                nouveau_sgdma_takedown(dev);
This page took 0.060896 seconds and 5 git commands to generate.