qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] hw/virtio/virtio-mem: Prohibit unplugging when size <= reque


From: David Hildenbrand
Subject: Re: [PATCH] hw/virtio/virtio-mem: Prohibit unplugging when size <= requested_size
Date: Sat, 30 Nov 2024 20:19:46 +0100
User-agent: Mozilla Thunderbird

On 30.11.24 13:48, Wei Chen wrote:
 > That doesn't explain the full story about MIGRATE_UNMOVABLE. I assume
 > one precondition is missing in your explanation.

I have double-checked the source code. My initial description of the
process seems somewhat imprecise. vIOMMU does not convert pages to
UNMOVABLE during pinning, it is that pinning causes page faults, and the
fault handler allocates UNMOVABLE pages. (vaddr_get_pfns() calls
__gup_longterm_locked(), who then calls memalloc_pin_save(), and it
implicitly removes the __GFP_MOVABLE flag.)

Ah, that makes sense! I forgot about memalloc_pin_save(), which we primarily added to avoid allocation+immediate migration during longterm pinning IIRC.


Therefore, there is no requirement of ZONE_MOVABLE and MIGRATE_CMA.

Indeed. On systems without that, one workaround would be driving virtio-mem in "prealloc" mode (prealloc=on in QEMU on the device), whereby we first preallocate the memory using MADV_POPULATW_WRITE, to then longterm pin it.

--
Cheers,

David / dhildenb




reply via email to

[Prev in Thread] Current Thread [Next in Thread]