sna: Replace FREELIKE_BLOCK with MAKE_MEM_NOACCESS

And similarly for MALLOCLIKE_BLOCK. The issue being that valgrind may
overwrite such blocks with alloc-fill and free-fill values, but when in
fact they are defined and still in use by the GPU. This can lead to the
GPU processing garbage, and GPU hangs.

Reported-by: Zdenek Kabelac <zdenek.kabelac@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50393
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-05-30 10:37:22 +01:00
parent 08a630dc5e
commit 47e2db0ba8
1 changed files with 3 additions and 3 deletions

View File

@ -984,7 +984,7 @@ static void kgem_bo_release_map(struct kgem *kgem, struct kgem_bo *bo)
__FUNCTION__, type ? "CPU" : "GTT",
bo->handle, kgem->vma[type].count));
VG(if (type) VALGRIND_FREELIKE_BLOCK(MAP(bo->map), 0));
VG(if (type) VALGRIND_MAKE_MEM_NOACCESS(MAP(bo->map), bytes(bo)));
munmap(MAP(bo->map), bytes(bo));
bo->map = NULL;
@ -3194,7 +3194,7 @@ static void kgem_trim_vma_cache(struct kgem *kgem, int type, int bucket)
assert(bo->map);
assert(bo->rq == NULL);
VG(if (type) VALGRIND_FREELIKE_BLOCK(MAP(bo->map), 0));
VG(if (type) VALGRIND_MAKE_MEM_NOACCESS(MAP(bo->map), bytes(bo)));
munmap(MAP(bo->map), bytes(bo));
bo->map = NULL;
list_del(&bo->vma);
@ -3348,7 +3348,7 @@ retry:
return NULL;
}
VG(VALGRIND_MALLOCLIKE_BLOCK(mmap_arg.addr_ptr, bytes(bo), 0, 1));
VG(VALGRIND_MAKE_MEM_DEFINED(mmap_arg.addr_ptr, bytes(bo)));
DBG(("%s: caching CPU vma for %d\n", __FUNCTION__, bo->handle));
bo->map = MAKE_CPU_MAP(mmap_arg.addr_ptr);