qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH V2 05/22] vl: memfd-alloc option


From: Steven Sistare
Subject: Re: [PATCH V2 05/22] vl: memfd-alloc option
Date: Wed, 6 Jan 2021 11:36:51 -0500
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0

On 1/5/2021 11:27 AM, Daniel P. Berrangé wrote:
> On Tue, Jan 05, 2021 at 07:41:53AM -0800, Steve Sistare wrote:
>> Allocate anonymous memory using memfd_create if the memfd-alloc option is
>> set.
>>
>> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
>> ---
>>  exec.c                  | 38 ++++++++++++++++++++++++++++++--------
>>  include/sysemu/sysemu.h |  1 +
>>  qemu-options.hx         | 11 +++++++++++
>>  softmmu/vl.c            |  4 ++++
>>  trace-events            |  1 +
>>  5 files changed, 47 insertions(+), 8 deletions(-)
> 
>> diff --git a/qemu-options.hx b/qemu-options.hx
>> index 708583b..455b43b7 100644
>> --- a/qemu-options.hx
>> +++ b/qemu-options.hx
>> @@ -4094,6 +4094,17 @@ SRST
>>      an unmigratable state.
>>  ERST
>>  
>> +#ifdef __linux__
>> +DEF("memfd-alloc", 0,  QEMU_OPTION_memfd_alloc, \
>> +    "-memfd-alloc         allocate anonymous memory using memfd_create\n",
>> +    QEMU_ARCH_ALL)
>> +#endif
>> +
>> +SRST
>> +``-memfd-alloc``
>> +    Allocate anonymous memory using memfd_create (Linux only).
>> +ERST
> 
> Do we really need a new arg for this ? It is already possible to request
> use of memfd for the guest RAM using
> 
>   -object memory-backend-memfd,id=ram-node0,size=NNNN
> 
> this memory backend object framework was intended to remove the need to
> add new ad-hoc CLI args for controlling memory allocation.

Yes, I considered that, but there are other memory regions that cannot be 
controlled
by the command line but which must be preserved, such as vram, bios, and rom.  
If vram
is not preserved, parts of the screen will be blank until the user performs 
some action
which refreshes the display.  bios and rom should be preserved rather than 
re-recreated
with potentially different contents from the firmware images in the updated 
qemu package.

However, your comment reminds me that I must add a few lines of code to 
preserve the 
memory-backend-memfd.

- Steve



reply via email to

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