[PATCH] tests/xe: Add system_allocator test

Matthew Brost matthew.brost at intel.com
Wed Apr 16 18:36:28 UTC 2025


On Wed, Apr 16, 2025 at 07:09:40PM +0200, Thomas Hellström wrote:
> Hi, Matt,
> 
> On Tue, 2025-04-15 at 19:20 -0700, Matthew Brost wrote:
> > Test various uses of system allocator in single thread, multiple
> > threads, and multiple processes.
> > 
> > Features tested:
> >  - Malloc with various size
> >  - Mmap with various sizes and flags including file backed mappings
> >  - Mixing BO allocations with system allocator
> >  - Various page sizes
> >  - Dynamically freeing / unmapping memory
> >  - Sharing VM across threads
> >  - Faults racing on different hardware engines / GTs / Tiles
> >  - GPU faults and CPU faults racing
> >  - CPU faults on multiple threads racing
> >  - CPU faults on multiple process racing
> >  - GPU faults of memory not faulted in by CPU
> >  - Partial unmap of allocations
> >  - Attempting to unmap system allocations when GPU has mappings
> >  - Eviction of both system allocations and BOs
> >  - Forking child processes and reading data from VRAM
> >  - mremap data in VRAM
> >  - Protection changes
> >  - Multiple faults per execbuf
> > 
> > Running on LNL, BMG, PVC 1 tile, and PVC 2 tile.
> > 
> > v2:
> >  - Rebase
> >  - Fix memory allocation to not interfear with malloc (Thomas)
> > 
> > Signed-off-by: Matthew Brost <matthew.brost at intel.com>
> 
> Did you have a chance to look at the memory (or rather virtual
> adddress) leaks on the tests as well?  
> With the old version it would exceed 1GB after some time, which I
> believe caused some slowdown.
> 

I have not looked at that - rather just fixed mmaping mallocs which
would eventually cause the test to fail with -ENOSPC (e.g. if just ran
xe_exec_system_alloc eventually everything started to fail whereas now I
can run xe_exec_system_alloc to completion).

I wonder if the way I changed memory allocation fixed the leaks, let me
try running under valgrind and see if anything pops.

Matt

> Unfortunately the igt library funcs also leaks memory so running the
> test under valgrind was a bit noisy, but helped to some extent.
> 
> /Thomas
> 


More information about the igt-dev mailing list