iris: check memory with INTEL_DEBUG=mem
After this commit, INTEL_DEBUG=mem will make iris over-allocate a page for every GEM buffer requested, write a pattern to the unused end area - which we refer to as the red zone - and check for integrity of the pattern when the buffer is not used anymore. Once a problem is found, we dump the buffer and assert(false). Notice that the red zone is not only the extra page we over-allocate, but it also includes the padding caused by iris' allocation buckets and page rounding: even if our tool didn't over-allocate anything (i.e., if we define RED_ZONE_BUFFER_EXTENSION to zero), the tool would still be doing helpful work.
I was able to use this tool to discover issues with the calculation of render buffer compression resource sizes, detect a Kernel regression and find an extra issue on ICL. The Mesa issues are still under investigation.
I also plan to extend the subsystem to also check for use-after-free issues in later patches, but first I want to work on the bugs that red zoning was already able to catch.
Signed-off-by: Paulo Zanoni