Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KVM: SVM: CSV: fix CSV3 launch failures because of concurrent longter…
…m pin hygon inclusion category: bugfix CVE: NA --------------------------- If a large number of CMA memory are configured in system (for example, the CMA memory accounts for 50% of the system memory), starting a virtual machine with device passthrough, it will call pin_user_pages_remote(..., FOLL_LONGTERM, ...) to pin memory. Normally if a page is present and in CMA area, pin_user_pages_remote() will migrate the page from CMA area to non-CMA area because of FOLL_LONGTERM flag. But the current code will cause the migration failure due to unexpected page refcounts, and eventually cause the virtual machine fail to start. During CSV3 virtual machine startup, it will also call pin_user_pages_fast(..., FOLL_LONGTERM, ...) to pin shared memory in #NPF handler. If pin_user_pages_remote() and pin_user_pages_fast() pin a same page concurrently, it may lead to unexpected page refcounts. To solve the problem above, we use mmap_write_lock/unlock() to serialize the execution of pin_user_pages_remote() and pin_user_pages_fast(). Signed-off-by: yangge <[email protected]> Signed-off-by: hanliyang <[email protected]>
- Loading branch information