[Mesa-dev] [PATCH] i965: Use VALGRIND_MAKE_MEM_x in place of MALLOCLIKE/FREELIKE

Kenneth Graunke kenneth at whitecape.org
Tue Jul 11 21:08:16 UTC 2017


On Tuesday, July 11, 2017 8:54:25 AM PDT Chris Wilson wrote:
> Valgrind doesn't actually implement VALGRIND_FREELIKE_BLOCK as the
> exact inverse of VALGRIND_MALLOCLIKE_BLOCK. It makes the block
> inaccessible, but still leaves it defined in its allocation tracker i.e.
> it will report the mmap as lost despite the call to FREELIKE!
> 
> Instead of treating the mmap as an allocation, treat it as changing the
> access bits upon the memory, i.e. that it becomes defined (because of
> the buffer objects always contain valid content from the user's
> perspective) upon mmap and inaccessible upon munmap. This makes memcheck
> happy without leaving it thinking there is a very large leak.
> 
> Finally for consistency, we treat all the mmap/munmap paths the same
> even though valgrind can intercept the regular mmap used for GTT. We
> could move this in the drm_mmap/drm_munmap macros, but that quickly
> looks ugly given the desire for those to support different OSes, but I
> didn't try that hard!

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

and pushed:

To ssh://git.freedesktop.org/git/mesa/mesa
   314879f7fec..cead51a0c63  master -> master
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170711/00571058/attachment.sig>


More information about the mesa-dev mailing list