[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH V2] memory: RAM_NAMED_FILE flag
From: |
Steven Sistare |
Subject: |
Re: [PATCH V2] memory: RAM_NAMED_FILE flag |
Date: |
Wed, 8 Feb 2023 13:34:18 -0500 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 |
On 2/7/2023 3:23 PM, Peter Xu wrote:
> On Tue, Feb 07, 2023 at 11:03:33AM -0800, Steve Sistare wrote:
>> migrate_ignore_shared() is an optimization that avoids copying memory
>> that is visible and can be mapped on the target. However, a
>> memory-backend-ram or a memory-backend-memfd block with the RAM_SHARED
>> flag set is not migrated when migrate_ignore_shared() is true. This is
>> wrong, because the block has no named backing store, and its contents will
>> be lost. To fix, ignore shared memory iff it is a named file. Define a
>> new flag RAM_NAMED_FILE to distinguish this case.
>
> There's also TYPE_MEMORY_BACKEND_EPC. Reading the commit message it seems
> it can still be used in similar ways. Pasting commit message from c6c0232:
>
> Because of its unique requirements, Linux manages EPC separately from
> normal memory. Similar to memfd, the device /dev/sgx_vepc can be
> opened to obtain a file descriptor which can in turn be used to mmap()
> EPC memory.
>
> I'm not sure whether it means that should apply for RAM_NAMED_FILE too,
> neither do I think it's super important.. Still better to define it
> properly.
The RAM_NAMED_FILE flag will be false for TYPE_MEMORY_BACKEND_EPC, so
ramblock_is_ignored will return false, and the contents will be copied
over the socket to the target, and the segment will be recreated there.
However, perhaps I do not understand your point.
> Another comment is, AFAIK this patch will modify senamtics of the old
> capability "x-ignore-shared". But I'd say in a sensible way. Maybe worth
> directly modify qapi/migration.json to reflect it (especially it's x-
> prefixed) to something like:
>
> # @x-ignore-shared: If enabled, QEMU will not migrate named shared memory
> # (since 4.0)
Good idea. I propose:
# @x-ignore-shared: If enabled, QEMU will not migrate shared memory that is
# accessible on the target. (since 4.0)
- Steve