On 30.05.25 10:32, Chenyi Qiang wrote:
A new field, attributes, was introduced in RAMBlock to link to a
RamBlockAttributes object, which centralizes all guest_memfd related
information (such as fd and shared bitmap) within a RAMBlock.

Create and initialize the RamBlockAttributes object upon ram_block_add().
Meanwhile, register the object in the target RAMBlock's MemoryRegion.
After that, guest_memfd-backed RAMBlock is associated with the
RamDiscardManager interface, and the users can execute RamDiscardManager
specific handling. For example, VFIO will register the
RamDiscardListener and get notifications when the state_change() helper
invokes.

As coordinate discarding of RAM with guest_memfd is now supported, only
block uncoordinated discard.

Signed-off-by: Chenyi Qiang <chenyi.qi...@intel.com>
---
Changes in v6:
     - Squash the unblocking of cooridnate discard into this commit.
     - Remove the checks in migration path.

Changes in v5:
     - Revert to use RamDiscardManager interface.
     - Move the object_new() into the ram_block_attribute_create()
       helper.
     - Add some check in migration path.

Changes in v4:
     - Remove the replay operations for attribute changes which will be
       handled in a listener in following patches.
     - Add some comment in the error path of realize() to remind the
       future development of the unified error path.

Changes in v3:
     - Use ram_discard_manager_reply_populated/discarded() to set the
       memory attribute and add the undo support if state_change()
       failed.
     - Didn't add Reviewed-by from Alexey due to the new changes in this
       commit.
---

Acked-by: David Hildenbrand <da...@redhat.com>

--
Cheers,

David / dhildenb


Reply via email to