libhsakmt: Set CWSR SVM range MADV_DONTFORK

fork process copy-on-write MMU nitifier on CWSR range will evict user
queues, and then update GPU mapping and resume queues, use MADV_DONTFORK
to avoid COW MMU notifier callback on CWSR SVM range.

Use mmap to alloc SVM range for CWSR because posix_memalign don't alloc
new range in child process, this fails to register svm range as range is
invalid address in forked child process.

Change-Id: Ibaea56a691dd6f577ed2e1f2d43f4a3500b8316f
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
This commit is contained in:
Philip Yang
2022-08-16 09:36:11 -04:00
parent b2691c359d
commit 093cf898fb
3 changed files with 25 additions and 9 deletions
+2 -3
View File
@@ -706,9 +706,8 @@ static void *reserved_aperture_allocate_aligned(manageable_aperture_t *app,
return start;
}
static void *mmap_allocate_aligned(int prot, int flags, uint64_t size,
uint64_t align, uint64_t guard_size,
void *aper_base, void *aper_limit)
void *mmap_allocate_aligned(int prot, int flags, uint64_t size, uint64_t align,
uint64_t guard_size, void *aper_base, void *aper_limit)
{
void *addr, *aligned_addr, *aligned_end, *mapping_end;
uint64_t aligned_padded_size;