]> git.baikalelectronics.ru Git - kernel.git/commit
drm/ttm: fix two regressions since move_notify changes
authorBen Skeggs <bskeggs@redhat.com>
Wed, 25 Jan 2012 05:34:22 +0000 (15:34 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 25 Jan 2012 18:54:28 +0000 (18:54 +0000)
commit8d2afd4620dd056c2ba8b05673ec3d9c6e92c7e6
tree4df8c894d3444f277243c8e32d58eca31496f679
parent40a56fe0d2d495d9128b0423590b03c1ce50710b
drm/ttm: fix two regressions since move_notify changes

Both changes in 018061a849a66bbe0bcd5c1e5f12f901564cea48 cause serious
regressions in the nouveau driver.

move_notify() was originally able to presume that bo->mem is the old node,
and new_mem is the new node.  The above commit moves the call to
move_notify() to after move() has been done, which means that now, sometimes,
new_mem isn't the new node at all, bo->mem is, and new_mem points at a
stale, possibly-just-been-killed-by-move node.

This is clearly not a good situation.  This patch reverts this change, and
replaces it with a cleanup in the move() failure path instead.

The second issue is that the call to move_notify() from cleanup_memtype_use()
causes the TTM ghost objects to get passed into the driver.  This is clearly
bad as the driver knows nothing about these "fake" TTM BOs, and ends up
accessing uninitialised memory.

I worked around this in nouveau's move_notify() hook by ensuring the BO
destructor was nouveau's.  I don't particularly like this solution, and
would rather TTM never pass the driver these objects.  However, I don't
clearly understand the reason why we're calling move_notify() here anyway
and am happy to work around the problem in nouveau instead of breaking the
behaviour expected by other drivers.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Jerome Glisse <j.glisse@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/nouveau/nouveau_bo.c
drivers/gpu/drm/ttm/ttm_bo.c