From 47e2db0ba8ae3fbcdf58cba26c58ec0932b4c90b Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 30 May 2012 10:37:22 +0100 Subject: [PATCH] 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 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50393 Signed-off-by: Chris Wilson --- src/sna/kgem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sna/kgem.c b/src/sna/kgem.c index 85879368..828df037 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -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);