qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v7 00/14] KVM: mm: fd-based approach for supporting KVM guest


From: Nikunj A. Dadhania
Subject: Re: [PATCH v7 00/14] KVM: mm: fd-based approach for supporting KVM guest private memory
Date: Fri, 12 Aug 2022 14:18:43 +0530
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0


On 12/08/22 12:48, Gupta, Pankaj wrote:
> 
>>>>>>
>>>>>> However, fallocate() preallocates full guest memory before starting the 
>>>>>> guest.
>>>>>> With this behaviour guest memory is *not* demand pinned. Is there a way 
>>>>>> to
>>>>>> prevent fallocate() from reserving full guest memory?
>>>>>
>>>>> Isn't the pinning being handled by the corresponding host memory backend 
>>>>> with mmu > notifier and architecture support while doing the memory 
>>>>> operations e.g page> migration and swapping/reclaim (not supported 
>>>>> currently AFAIU). But yes, we need> to allocate entire guest memory with 
>>>>> the new flags MEMFILE_F_{UNMOVABLE, UNRECLAIMABLE etc}.
>>>>
>>>> That is correct, but the question is when does the memory allocated, as 
>>>> these flags are set,
>>>> memory is neither moved nor reclaimed. In current scenario, if I start a 
>>>> 32GB guest, all 32GB is
>>>> allocated.
>>>
>>> I guess so if guest memory is private by default.
>>>
>>> Other option would be to allocate memory as shared by default and
>>> handle on demand allocation and RMPUPDATE with page state change event. But 
>>> still that would be done at guest boot time, IIUC.
>>
>> Sorry! Don't want to hijack the other thread so replying here.
>>
>> I thought the question is for SEV SNP. For SEV, maybe the hypercall with the 
>> page state information can be used to allocate memory as we use it or 
>> something like quota based memory allocation (just thinking).
> 
> But all this would have considerable performance overhead (if by default 
> memory is shared) and used mostly at boot time. 

> So, preallocating memory (default memory private) seems better approach for 
> both SEV & SEV SNP with later page management (pinning, reclaim) taken care 
> by host memory backend & architecture together.

I am not sure how will pre-allocating memory help, even if guest would not use 
full memory it will be pre-allocated. Which if I understand correctly is not 
expected.

Regards
Nikunj



reply via email to

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