Re: [PATCH] hostmem/shm: Allow shm memory backend serve as shared memory for coco-VMs

2025-07-21 Thread David Hildenbrand
and pass down RAM_GUEST_MEMFD when backend->guest_memfd is true, to allow shm memory backend serve as shared memory for coco-VMs. cc: Stefano Garzarella Signed-off-by: Xiaoyao Li Acked-by: David Hildenbrand -- Cheers, David / dhildenb

Re: [PATCH v1] vhost: Fix used memslot tracking when destroying a vhost device

2025-07-16 Thread David Hildenbrand
On 16.07.25 15:31, Michael Tokarev wrote: On 03.06.2025 14:13, David Hildenbrand wrote: When we unplug a vhost device, we end up calling vhost_dev_cleanup() where we do a memory_listener_unregister(). This memory_listener_unregister() call will end up disconnecting the listener from the

Re: [PATCH 0/4] target/s390x: Cleanups around s390_cpu_[un]halt()

2025-07-11 Thread David Hildenbrand
pull request. For these 3: Reviewed-by: David Hildenbrand -- Cheers, David / dhildenb

Re: [PATCH v7 0/5] Enable shared device assignment

2025-06-24 Thread David Hildenbrand
On 18.06.25 23:58, Peter Xu wrote: Hi, Chenyi, On Thu, Jun 12, 2025 at 04:27:41PM +0800, Chenyi Qiang wrote: Relationship with in-place conversion - In-place page conversion is the ongoing work to allow mmap() of guest_memfd to userspace so that both private

Re: [PATCH v5 2/7] vhost_user.rst: Align VhostUserMsg excerpt members

2025-06-10 Thread David Hildenbrand
On 09.06.25 16:47, Albert Esteve wrote: Add missing members to the VhostUserMsg excerpt in the vhost-user spec documentation. Reviewed-by: Stefan Hajnoczi Signed-off-by: Albert Esteve --- Reviewed-by: David Hildenbrand -- Cheers, David / dhildenb

Re: [PATCH v5 1/7] vhost-user: Add VirtIO Shared Memory map request

2025-06-10 Thread David Hildenbrand
On 09.06.25 16:47, Albert Esteve wrote: Add SHMEM_MAP/UNMAP requests to vhost-user to handle VIRTIO Shared Memory mappings. This request allows backends to dynamically map fds into a VIRTIO Shared Memory Region indentified by its `shmid`. The map is performed by calling `memory_region_init_ram_f

Re: [PATCH v2 2/5] virtio-pmem: Fix definition of VirtIOPMEMClass

2025-06-04 Thread David Hildenbrand
On 04.06.25 13:53, Zhenzhong Duan wrote: VirtIOPMEMClass's parent is VirtioDeviceClass rather than VirtIODevice. Fixes: 5f503cd9f388 ("virtio-pmem: add virtio device") Suggested-by: David Hildenbrand Reported-by: might be better, with Closes: linking to my mail Signed-of

Re: [PATCH v6 5/5] physmem: Support coordinated discarding of RAM with guest_memfd

2025-06-04 Thread David Hildenbrand
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 -- Cheers, David / dhildenb

Re: [PATCH] virtio-mem: Fix definition of VirtIOMEMClass

2025-06-04 Thread David Hildenbrand
On 04.06.25 10:47, Zhenzhong Duan wrote: Parent of VirtIOMEMClass is VirtioDeviceClass rather than VirtIODevice. Fixes: 910b25766b33 ("virtio-mem: Paravirtualized memory hot(un)plug") Signed-off-by: Zhenzhong Duan --- include/hw/virtio/virtio-mem.h | 2 +- 1 file changed, 1 insertion(+), 1 d

Re: [PATCH] virtio-mem: Fix definition of VirtIOMEMClass

2025-06-04 Thread David Hildenbrand
/* private */ -VirtIODevice parent; +VirtioDeviceClass parent; Reviewed-by: David Hildenbrand I assume it's not currently a real problem because VirtIODevice is bigger than VirtioDeviceClass? Or are you aware of any existing problems with that? -- Cheers, David / dhildenb

[PATCH v1] vhost: Fix used memslot tracking when destroying a vhost device

2025-06-03 Thread David Hildenbrand
ghao Link: https://lore.kernel.org/qemu-devel/20241121060755.164310-1-yuanm...@chinatelecom.cn/ Fixes: 2ce68e4cf5be ("vhost: add vhost_has_free_slot() interface") Cc: Igor Mammedov Cc: Michael S. Tsirkin Cc: Stefano Garzarella Signed-off-by: David Hildenbrand --- I assume the pro

Re: [PATCH 1/1] vhost: do not reset used_memslots when destroying vhost dev

2025-06-03 Thread David Hildenbrand
On 30.05.25 13:36, Michael S. Tsirkin wrote: On Fri, May 30, 2025 at 01:28:58PM +0200, David Hildenbrand wrote: On 30.05.25 13:18, Michael S. Tsirkin wrote: On Wed, May 14, 2025 at 11:26:05AM +0200, David Hildenbrand wrote: On 14.05.25 11:12, Igor Mammedov wrote: On Tue, 13 May 2025 15:12:11

Re: [PATCH v6 4/5] ram-block-attributes: Introduce RamBlockAttributes to manage RAMBlock with guest_memfd

2025-06-03 Thread David Hildenbrand
On 03.06.25 09:17, Gupta, Pankaj wrote: +CC Tony & Kishen In this patch series we are only maintaining the bitmap for Ram discard/ populate state not for regular guest_memfd private/shared? As mentioned in changelog, "In the context of RamDiscardManager, shared state is analogous to populated

Re: [PATCH v6 4/5] ram-block-attributes: Introduce RamBlockAttributes to manage RAMBlock with guest_memfd

2025-06-02 Thread David Hildenbrand
On 30.05.25 10:32, Chenyi Qiang wrote: Commit 852f0048f3 ("RAMBlock: make guest_memfd require uncoordinated discard") highlighted that subsystems like VFIO may disable RAM block discard. However, guest_memfd relies on discard operations for page conversion between private and shared memory, poten

Re: [PATCH 1/1] vhost: do not reset used_memslots when destroying vhost dev

2025-05-30 Thread David Hildenbrand
On 30.05.25 13:18, Michael S. Tsirkin wrote: On Wed, May 14, 2025 at 11:26:05AM +0200, David Hildenbrand wrote: On 14.05.25 11:12, Igor Mammedov wrote: On Tue, 13 May 2025 15:12:11 +0200 David Hildenbrand wrote: On 13.05.25 14:13, Igor Mammedov wrote: On Mon, 3 Mar 2025 13:02:17 -0500

Re: [PATCH v5 10/10] ram-block-attribute: Add more error handling during state changes

2025-05-27 Thread David Hildenbrand
If something went wrong... well, on my AMD machine this usually means the fw is really unhappy and recovery is hardly possible and the machine needs reboot. Probably stopping the VM would make more sense for now (or stop the device so the user could save work from the VM, dunno). My current

Re: [PATCH v5 07/10] RAMBlock: Make guest_memfd require coordinate discard

2025-05-27 Thread David Hildenbrand
On 27.05.25 07:47, Chenyi Qiang wrote: On 5/26/2025 5:08 PM, David Hildenbrand wrote: On 20.05.25 12:28, Chenyi Qiang wrote: As guest_memfd is now managed by RamBlockAttribute with RamDiscardManager, only block uncoordinated discard. Signed-off-by: Chenyi Qiang --- Changes in v5

Re: [PATCH v5 10/10] ram-block-attribute: Add more error handling during state changes

2025-05-26 Thread David Hildenbrand
On 26.05.25 12:19, Chenyi Qiang wrote: On 5/26/2025 5:17 PM, David Hildenbrand wrote: On 20.05.25 12:28, Chenyi Qiang wrote: The current error handling is simple with the following assumption: - QEMU will quit instead of resuming the guest if kvm_convert_memory()    fails, thus no need to

Re: [PATCH v5 10/10] ram-block-attribute: Add more error handling during state changes

2025-05-26 Thread David Hildenbrand
On 20.05.25 12:28, Chenyi Qiang wrote: The current error handling is simple with the following assumption: - QEMU will quit instead of resuming the guest if kvm_convert_memory() fails, thus no need to do rollback. - The convert range is required to be in the desired state. It is not allowed

Re: [PATCH v5 09/10] KVM: Introduce RamDiscardListener for attribute changes during memory conversions

2025-05-26 Thread David Hildenbrand
On 20.05.25 12:28, Chenyi Qiang wrote: With the introduction of the RamBlockAttribute object to manage RAMBlocks with guest_memfd, it is more elegant to move KVM set attribute into a RamDiscardListener. The KVM attribute change RamDiscardListener is registered/unregistered for each memory region

Re: [PATCH v5 07/10] RAMBlock: Make guest_memfd require coordinate discard

2025-05-26 Thread David Hildenbrand
On 20.05.25 12:28, Chenyi Qiang wrote: As guest_memfd is now managed by RamBlockAttribute with RamDiscardManager, only block uncoordinated discard. Signed-off-by: Chenyi Qiang --- Changes in v5: - Revert to use RamDiscardManager. Changes in v4: - Modify commit message (RamDiscardMana

Re: [PATCH v5 06/10] memory: Attach RamBlockAttribute to guest_memfd-backed RAMBlocks

2025-05-26 Thread David Hildenbrand
On 20.05.25 12:28, Chenyi Qiang wrote: A new field, ram_shared, was introduced in RAMBlock to link to a RamBlockAttribute object, which centralizes all guest_memfd state information (such as fd and shared_bitmap) within a RAMBlock. Create and initialize the RamBlockAttribute object upon ram_bloc

Re: [PATCH v5 05/10] ram-block-attribute: Introduce a helper to notify shared/private state changes

2025-05-26 Thread David Hildenbrand
On 20.05.25 12:28, Chenyi Qiang wrote: A new state_change() helper is introduced for RamBlockAttribute to efficiently notify all registered RamDiscardListeners, including VFIO listeners, about memory conversion events in guest_memfd. The VFIO listener can dynamically DMA map/unmap shared pages ba

Re: [PATCH v5 04/10] ram-block-attribute: Introduce RamBlockAttribute to manage RAMBlock with guest_memfd

2025-05-26 Thread David Hildenbrand
On 20.05.25 12:28, Chenyi Qiang wrote: Commit 852f0048f3 ("RAMBlock: make guest_memfd require uncoordinated discard") highlighted that subsystems like VFIO may disable RAM block discard. However, guest_memfd relies on discard operations for page conversion between private and shared memory, poten

Re: [PATCH v5 03/10] memory: Unify the definiton of ReplayRamPopulate() and ReplayRamDiscard()

2025-05-26 Thread David Hildenbrand
VirtIOMEMReplayData, which makes it cleaner. Signed-off-by: Chenyi Qiang Reviewed-by: David Hildenbrand -- Cheers, David / dhildenb

Re: [PATCH v5 02/10] memory: Change memory_region_set_ram_discard_manager() to return the result

2025-05-26 Thread David Hildenbrand
at present. Suggested-by: David Hildenbrand Signed-off-by: Chenyi Qiang --- Reviewed-by: David Hildenbrand -- Cheers, David / dhildenb

Re: [PATCH V4] vfio: return mr from vfio_get_xlat_addr

2025-05-19 Thread David Hildenbrand
On 17.05.25 15:55, Steven Sistare wrote: On 5/16/2025 4:50 PM, David Hildenbrand wrote: On 16.05.25 21:26, Steven Sistare wrote: On 5/16/2025 2:58 PM, David Hildenbrand wrote: On 16.05.25 19:13, Steve Sistare wrote: Modify memory_get_xlat_addr and vfio_get_xlat_addr to return the memory

Re: [PATCH V4] vfio: return mr from vfio_get_xlat_addr

2025-05-16 Thread David Hildenbrand
On 16.05.25 21:26, Steven Sistare wrote: On 5/16/2025 2:58 PM, David Hildenbrand wrote: On 16.05.25 19:13, Steve Sistare wrote: Modify memory_get_xlat_addr and vfio_get_xlat_addr to return the memory region that the translated address is found in.  This will be needed by CPR in a subsequent

Re: [PATCH V4] vfio: return mr from vfio_get_xlat_addr

2025-05-16 Thread David Hildenbrand
r, errp); -if (ret && mr_has_discard_manager) { +mr = memory_translate_iotlb(iotlb, xlat_p, errp); +if (!mr && memory_region_has_ram_discard_manager(mr)) { Pretty sue this should be if (mr && ...) otherwise we'd be dereferencing NULL :) Apart from tha

Re: [PATCH 8/9] target/s390x/kvm/pv: Consolidate OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES

2025-05-16 Thread David Hildenbrand
On 16.05.25 05:23, Zhao Liu wrote: On Thu, May 15, 2025 at 05:11:56PM +0100, Daniel P. Berrangé wrote: Date: Thu, 15 May 2025 17:11:56 +0100 From: "Daniel P. Berrangé" Subject: Re: [PATCH 8/9] target/s390x/kvm/pv: Consolidate OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES On Thu, May 15, 2025 at

Re: [PATCH V3 26/42] vfio: return mr from vfio_get_xlat_addr

2025-05-15 Thread David Hildenbrand
On 14.05.25 19:03, Cédric Le Goater wrote: + Paolo + David + Peter + Phil On 5/12/25 22:51, John Levon wrote: On Mon, May 12, 2025 at 08:32:37AM -0700, Steve Sistare wrote: Modify memory_get_xlat_addr and vfio_get_xlat_addr to return the memory region that the translated address is found in.

Re: live-migration performance regression when using pmem

2025-05-14 Thread David Hildenbrand
On 13.05.25 22:11, Michael S. Tsirkin wrote: On Tue, May 13, 2025 at 07:21:36PM +0200, David Hildenbrand wrote: On 12.05.25 17:16, Chaney, Ben wrote: Hello, When live migrating to a destination host with pmem there is a very long downtime where the guest is paused. In some cases

Re: [PATCH 1/1] vhost: do not reset used_memslots when destroying vhost dev

2025-05-14 Thread David Hildenbrand
On 14.05.25 11:12, Igor Mammedov wrote: On Tue, 13 May 2025 15:12:11 +0200 David Hildenbrand wrote: On 13.05.25 14:13, Igor Mammedov wrote: On Mon, 3 Mar 2025 13:02:17 -0500 yuanminghao wrote: Global used_memslots or used_shared_memslots is updated to 0 unexpectly it shouldn't

Re: [PATCH 8/9] target/s390x/kvm/pv: Consolidate OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES

2025-05-14 Thread David Hildenbrand
Pasic Cc: Christian Borntraeger Cc: Thomas Huth Cc: Richard Henderson Cc: David Hildenbrand Cc: Ilya Leoshkevich Cc: qemu-s3...@nongnu.org Signed-off-by: Zhao Liu --- target/s390x/kvm/pv.c | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/target/s390x/

Re: live-migration performance regression when using pmem

2025-05-13 Thread David Hildenbrand
On 12.05.25 17:16, Chaney, Ben wrote: Hello, When live migrating to a destination host with pmem there is a very long downtime where the guest is paused. In some cases, this can be as high as 5 minutes, compared to less than one second in the good case. Profiling suggests v

Re: [PATCH 1/1] vhost: do not reset used_memslots when destroying vhost dev

2025-05-13 Thread David Hildenbrand
On 13.05.25 14:13, Igor Mammedov wrote: On Mon, 3 Mar 2025 13:02:17 -0500 yuanminghao wrote: Global used_memslots or used_shared_memslots is updated to 0 unexpectly it shouldn't be 0 in practice, as it comes from number of RAM regions VM has. It's likely a bug somewhere else. I haven't to

Re: [PATCH v4 18/23] target/s390x: call plugin trap callbacks

2025-05-12 Thread David Hildenbrand
ugin_vcpu_interrupt_cb() just after an interrupt got delivered? `qemu_plugin_vcpu_interrupt_cb` or `qemu_plugin_vcpu_exception_cb` need to be called after the CPU was set up (that is, after PC and any other relevant register was set) and before the next instruction is executed. So, yes, more or less. Okay, thanks for the clarification! Acked-by: David Hildenbrand -- Cheers, David / dhildenb

Re: [PATCH v2 01/20] memory: Adjust event ranges to fit within notifier boundaries

2025-05-12 Thread David Hildenbrand
65506.31315-6-epere...@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin I think this change here is fine, but it would be good getting Pete Xu's opinion. Acked-by: David Hildenbrand -- Cheers, David / dhildenb

Re: [PATCH v4 10/13] memory: Change NotifyStateClear() definition to return the result

2025-05-12 Thread David Hildenbrand
On 09.05.25 12:04, Chenyi Qiang wrote: On 5/9/2025 4:22 PM, Baolu Lu wrote: On 4/27/2025 10:26 AM, Chenyi Qiang wrote: Hi David, Any thought on patch 10-12, which is to move the change attribute into a priority listener. A problem is how to handle the error handling of private_to_shared fail

Re: [PATCH v4 18/23] target/s390x: call plugin trap callbacks

2025-05-12 Thread David Hildenbrand
On 11.05.25 15:14, Julian Ganz wrote: We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places hooks for IBM Syste

Re: [PATCH v4 10/13] memory: Change NotifyStateClear() definition to return the result

2025-05-09 Thread David Hildenbrand
On 09.05.25 04:38, Chao Gao wrote: On Sun, Apr 27, 2025 at 10:26:52AM +0800, Chenyi Qiang wrote: Hi David, Any thought on patch 10-12, which is to move the change attribute into a priority listener. A problem is how to handle the error handling of private_to_shared failure. Previously, we thoug

Re: [PATCH v4 07/13] ram-block-attribute: Introduce RamBlockAttribute to manage RAMBLock with guest_memfd

2025-05-09 Thread David Hildenbrand
Signed-off-by: Chenyi Qiang <...> + +int ram_block_attribute_realize(RamBlockAttribute *attr, MemoryRegion *mr) +{ +    uint64_t shared_bitmap_size; +    const int block_size  = qemu_real_host_page_size(); +    int ret; + +    shared_bitmap_size = ROUND_UP(mr->size, block_size) / block_size;

Re: [PATCH v3 5/5] hw/virtio: Compile virtio-mem.c once

2025-05-05 Thread David Hildenbrand
On 02.05.25 23:45, Philippe Mathieu-Daudé wrote: Remove unused "system/ram_addr.h" header. This file doesn't use any target specific definitions anymore, compile it once by moving it to system_virtio_ss[]. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: David Hildenbrand

Re: [PATCH v3 4/5] hw/virtio/virtio-mem: Convert VIRTIO_MEM_HAS_LEGACY_GUESTS to runtime

2025-05-05 Thread David Hildenbrand
runtime. Signed-off-by: Philippe Mathieu-Daudé --- Acked-by: David Hildenbrand -- Cheers, David / dhildenb

Re: [PATCH v3 3/5] hw/virtio/virtio-mem: Convert VIRTIO_MEM_USABLE_EXTENT to runtime

2025-05-05 Thread David Hildenbrand
On 02.05.25 23:45, Philippe Mathieu-Daudé wrote: Use target_system_arch() to check at runtime which target architecture is being run. Note, since TARGET_ARM is defined for TARGET_AARCH64, we check for both ARM & AARCH64 enum values. Signed-off-by: Philippe Mathieu-Daudé --- Acked-by: D

Re: [PATCH v3 1/1] system: optimizing info mtree printing for monitors

2025-04-30 Thread David Hildenbrand
On 30.04.25 11:58, Philippe Mathieu-Daudé wrote: Hi Chao, On 30/4/25 11:02, Chao Liu wrote: Make the hierarchical relationship between nodes clearer by adding characters W.r.t. $Subject, it isn't really about "optimization" but making output clearer, as you describe. e.g. qemu-system-risc

Re: [PATCH v1 1/1] system: optimizing info mtree printing for monitors

2025-04-30 Thread David Hildenbrand
On 30.04.25 06:02, Chao Liu wrote: Make the hierarchical relationship between nodes clearer by adding characters You should probably move most of your cover letter, including the example, in here. Signed-off-by: Chao Liu --- system/memory.c | 34 +++--- 1 file

Re: [PATCH v4 05/13] memory: Introduce PrivateSharedManager Interface as child of GenericStateManager

2025-04-29 Thread David Hildenbrand
On 27.04.25 03:40, Chenyi Qiang wrote: On 4/25/2025 8:57 PM, David Hildenbrand wrote: On 07.04.25 09:49, Chenyi Qiang wrote: To manage the private and shared RAM states in confidential VMs, introduce a new class of PrivateShareManager as a child of GenericStateManager, which inherits the six

Re: [PATCH] s390x: Clear RAM on diag308 subcode 3 reset

2025-04-29 Thread David Hildenbrand
On 29.04.25 07:20, Nicholas Miehlbradt wrote: The reset performed by subcode 3 of the diag308 instruction specifies that system memory should be reset. This patch implements that behaviour. Introduce S390_RESET_REIPL_CLEAR to differentiate between subcode 3 and subcode 4 resets. When doing a cl

Re: [PATCH v4 05/13] memory: Introduce PrivateSharedManager Interface as child of GenericStateManager

2025-04-25 Thread David Hildenbrand
On 07.04.25 09:49, Chenyi Qiang wrote: To manage the private and shared RAM states in confidential VMs, introduce a new class of PrivateShareManager as a child of GenericStateManager, which inherits the six interface callbacks. With a different interface type, it can be distinguished from the Ram

Re: [PATCH v4 04/13] memory: Introduce generic state change parent class for RamDiscardManager

2025-04-25 Thread David Hildenbrand
On 16.04.25 05:32, Chenyi Qiang wrote: On 4/10/2025 9:44 AM, Chenyi Qiang wrote: On 4/10/2025 8:11 AM, Alexey Kardashevskiy wrote: On 9/4/25 22:57, Chenyi Qiang wrote: On 4/9/2025 5:56 PM, Alexey Kardashevskiy wrote: On 7/4/25 17:49, Chenyi Qiang wrote: RamDiscardManager is an inte

Re: [PATCH v4 04/13] memory: Introduce generic state change parent class for RamDiscardManager

2025-04-25 Thread David Hildenbrand
On 09.04.25 11:56, Alexey Kardashevskiy wrote: On 7/4/25 17:49, Chenyi Qiang wrote: RamDiscardManager is an interface used by virtio-mem to adjust VFIO mappings in relation to VM page assignment. It manages the state of populated and discard for the RAM. To accommodate future scnarios for mana

Re: [PATCH v4 03/13] memory: Unify the definiton of ReplayRamPopulate() and ReplayRamDiscard()

2025-04-25 Thread David Hildenbrand
On 09.04.25 07:43, Alexey Kardashevskiy wrote: On 7/4/25 17:49, Chenyi Qiang wrote: Update ReplayRamDiscard() function to return the result and unify the ReplayRamPopulate() and ReplayRamDiscard() to ReplayStateChange() at the same time due to their identical definitions. This unification simp

Re: [PATCH v4 03/13] memory: Unify the definiton of ReplayRamPopulate() and ReplayRamDiscard()

2025-04-25 Thread David Hildenbrand
On 07.04.25 09:49, Chenyi Qiang wrote: Update ReplayRamDiscard() function to return the result and unify the ReplayRamPopulate() and ReplayRamDiscard() to ReplayStateChange() at the same time due to their identical definitions. This unification simplifies related structures, such as VirtIOMEMRepl

Re: [PATCH v4 02/13] memory: Change memory_region_set_ram_discard_manager() to return the result

2025-04-25 Thread David Hildenbrand
  RamDiscardManager *rdm);>>>     /**    * memory_region_find: translate an address/size relative to a diff --git a/system/memory.c b/system/memory.c index b17b5538ff..62d6b410f0 100644 --- a/system/memory.c +++ b/system/memory.c @@ -2115,12 +2115,16 @@ RamDiscardMan

Re: [PATCH] system/memory: Remove DEVICE_HOST_ENDIAN definition

2025-04-23 Thread David Hildenbrand
ned-off-by: Philippe Mathieu-Daudé --- Reviewed-by: David Hildenbrand -- Cheers, David / dhildenb

Re: Management applications and CPU feature flags

2025-04-11 Thread David Hildenbrand
On 11.04.25 13:43, Markus Armbruster wrote: Daniel P. Berrangé writes: On Fri, Apr 11, 2025 at 12:40:46PM +0200, Markus Armbruster wrote: Daniel P. Berrangé writes: On Wed, Apr 09, 2025 at 09:58:13AM +0200, Peter Krempa via Devel wrote: On Wed, Apr 09, 2025 at 09:39:02 +0200, Markus Armbr

Re: [PATCH 0/2] exec: Restrict memory-internal.h to system/

2025-03-17 Thread David Hildenbrand
On 17.03.25 17:13, Philippe Mathieu-Daudé wrote: Only file units within the system/ directory need access to "memory-internal.h". Move it to system/ to restrict its scope. Based-on: <20250314173139.2122904-1-pierrick.bouv...@linaro.org> Reviewed-by: David Hildenbrand -

Re: [PATCH v3 4/7] memory-attribute-manager: Introduce MemoryAttributeManager to manage RAMBLock with guest_memfd

2025-03-17 Thread David Hildenbrand
On 17.03.25 03:54, Chenyi Qiang wrote: On 3/14/2025 8:11 PM, Gupta, Pankaj wrote: On 3/10/2025 9:18 AM, Chenyi Qiang wrote: As the commit 852f0048f3 ("RAMBlock: make guest_memfd require uncoordinated discard") highlighted, some subsystems like VFIO may disable ram block discard. However, gues

Re: [PATCH v3 6/7] memory: Attach MemoryAttributeManager to guest_memfd-backed RAMBlocks

2025-03-15 Thread David Hildenbrand
On 14.03.25 10:30, Chenyi Qiang wrote: On 3/14/2025 5:00 PM, David Hildenbrand wrote: On 14.03.25 09:21, Chenyi Qiang wrote: Hi David & Alexey, Hi, To keep the bitmap aligned, I add the undo operation for set_memory_attributes() and use the bitmap + replay callback t

Re: [PATCH 0/2] gdb invalid memory access handling improvements

2025-03-14 Thread David Hildenbrand
ugger. Nothing jumped at me, with Richard's suggestion of keeping the new function limited in scope Reviewed-by: David Hildenbrand -- Cheers, David / dhildenb

Re: [PATCH v3 6/7] memory: Attach MemoryAttributeManager to guest_memfd-backed RAMBlocks

2025-03-14 Thread David Hildenbrand
On 14.03.25 09:21, Chenyi Qiang wrote: Hi David & Alexey, Hi, To keep the bitmap aligned, I add the undo operation for set_memory_attributes() and use the bitmap + replay callback to do set_memory_attributes(). Does this change make sense? I assume you mean this hunk: +ret = memory_a

Re: [PATCH-for-10.0 v3 1/8] system: Declare qemu_[min/max]rampagesize() in 'system/hostmem.h'

2025-03-11 Thread David Hildenbrand
prototype declaration to "system/hostmem.h". Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Pierrick Bouvier Reviewed-by: Eric Auger Message-Id: <20250308230917.18907-7-phi...@linaro.org> --- Acked-by: David Hildenbrand -- Cheers, David / dhildenb

Re: [PATCH 5/7] hw/virtio/virtio-mem: Convert VIRTIO_MEM_USABLE_EXTENT to runtime

2025-03-07 Thread David Hildenbrand
On 07.03.25 17:49, Philippe Mathieu-Daudé wrote: On 7/3/25 17:38, Alex Bennée wrote: Philippe Mathieu-Daudé writes: Use qemu_arch_available() to check at runtime if a target architecture is built in. Signed-off-by: Philippe Mathieu-Daudé --- hw/virtio/virtio-mem.c | 20 --

Re: [PATCH 7/7] hw/virtio: Compile virtio-mem.c once

2025-03-07 Thread David Hildenbrand
On 07.03.25 16:15, Philippe Mathieu-Daudé wrote: Remove unused "exec/ram_addr.h" header. This file doesn't use any target specific definitions anymore, compile it once by moving it to system_virtio_ss[]. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: David Hildenbrand --

Re: [PATCH 6/7] hw/virtio/virtio-mem: Convert VIRTIO_MEM_HAS_LEGACY_GUESTS to runtime

2025-03-07 Thread David Hildenbrand
-Daudé --- Reviewed-by: David Hildenbrand -- Cheers, David / dhildenb

Re: [PATCH 4/7] hw/virtio/virtio-mem: Remove CONFIG_DEVICES include

2025-03-07 Thread David Hildenbrand
On 07.03.25 16:15, Philippe Mathieu-Daudé wrote: Rather than checking ACPI availability at compile time by checking the CONFIG_ACPI definition from CONFIG_DEVICES, check at runtime via acpi_builtin(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: David Hildenbrand -- Cheers, David

Re: [PATCH] tests/functional/test_virtio_balloon: Only use KVM for running this test

2025-03-07 Thread David Hildenbrand
rnel) have already been marked to work only with KVM in the past, so those other tests are skipped on the shared gitlab CI runners. As long as the problem isn't fully understood and fixed, let's do the same with the virtio_balloon test to avoid that the CI is failing here. Reviewed-b

Re: [PATCH] tests/functional: fix race in virtio balloon test

2025-03-07 Thread David Hildenbrand
;. To fix the latter, retry the stats query until seeing fresh data. Adding 'quiet' to the kernel command line reduces serial output which otherwise slows boot, making it less likely to hit the former race too. Signed-off-by: Daniel P. Berrangé Reviewed-by: David Hildenbrand -- Cheers, David / dhildenb

Re: [PATCH v7 03/16] backends/igvm: Add IGVM loader and configuration

2025-03-03 Thread David Hildenbrand
On 27.02.25 14:44, Roy Hopkins wrote: Adds an IGVM loader to QEMU which processes a given IGVM file and applies the directives within the file to the current guest configuration. The IGVM loader can be used to configure both confidential and non-confidential guests. For confidential guests, the

Re: [PATCH v5 1/2] s390x/pci: add support for guests that request direct mapping

2025-02-27 Thread David Hildenbrand
to be of the format guest_phys+sdma, allowing them to be used as lookup into the host iommu table. Reviewed-by: David Hildenbrand -- Cheers, David / dhildenb

Re: [RFC 1/2] system/memory: Allow creating IOMMU mappings from RAM discard populate notifiers

2025-02-27 Thread David Hildenbrand
On 27.02.25 04:26, Chenyi Qiang wrote: On 2/26/2025 8:43 PM, Chenyi Qiang wrote: On 2/25/2025 5:41 PM, David Hildenbrand wrote: On 25.02.25 03:00, Chenyi Qiang wrote: On 2/21/2025 6:04 PM, Chenyi Qiang wrote: On 2/21/2025 4:09 PM, David Hildenbrand wrote: On 21.02.25 03:25, Chenyi

Re: [PATCH v4 0/9] vhost-user: Add SHMEM_MAP/UNMAP requests

2025-02-26 Thread David Hildenbrand
As commented offline, maybe one would want the option to enable the alternative mode, where such updates (in the SHM region) are not sent to vhost-user devices. In such a configuration, the MEM_READ / MEM_WRITE would be unavoidable. At first, I remember we discussed two options, having update me

Re: [PATCH V4] migration: ram block cpr blockers

2025-02-25 Thread David Hildenbrand
+/* Ram device is remapped in new QEMU */ +if (memory_region_is_ram_device(mr)) { +return true; +} + +/* Named files are remapped in new QEMU, same contents if shared (no COW) */ +if (qemu_ram_is_shared(rb) && qemu_ram_is_named_file(rb)) { +return true; +}

Re: [PATCH V3] migration: ram block cpr blockers

2025-02-25 Thread David Hildenbrand
In general Reviewed-by: David Hildenbrand just one more question: + +/* A file descriptor is remapped in new QEMU */ +if (rb->fd >= 0) { +return true; This looks odd / wrong. Assume we have !qemu_ram_is_shared(rb) || !qemu_ram_is_named_file(rb) (negated condition a

Re: [RFC 1/2] system/memory: Allow creating IOMMU mappings from RAM discard populate notifiers

2025-02-25 Thread David Hildenbrand
On 25.02.25 03:00, Chenyi Qiang wrote: On 2/21/2025 6:04 PM, Chenyi Qiang wrote: On 2/21/2025 4:09 PM, David Hildenbrand wrote: On 21.02.25 03:25, Chenyi Qiang wrote: On 2/21/2025 3:39 AM, David Hildenbrand wrote: On 20.02.25 17:13, Jean-Philippe Brucker wrote: For Arm CCA we'd

Re: [PATCH v4 0/9] vhost-user: Add SHMEM_MAP/UNMAP requests

2025-02-24 Thread David Hildenbrand
On 24.02.25 14:41, Albert Esteve wrote: On Mon, Feb 24, 2025 at 10:49 AM David Hildenbrand wrote: On 24.02.25 10:35, Albert Esteve wrote: On Mon, Feb 24, 2025 at 10:16 AM David Hildenbrand wrote: On 24.02.25 09:54, Albert Esteve wrote: On Mon, Feb 17, 2025 at 9:01 PM David Hildenbrand

Re: [PATCH v4 0/9] vhost-user: Add SHMEM_MAP/UNMAP requests

2025-02-24 Thread David Hildenbrand
On 24.02.25 10:35, Albert Esteve wrote: On Mon, Feb 24, 2025 at 10:16 AM David Hildenbrand wrote: On 24.02.25 09:54, Albert Esteve wrote: On Mon, Feb 17, 2025 at 9:01 PM David Hildenbrand wrote: On 17.02.25 17:40, Albert Esteve wrote: Hi all, Hi, looks like our debugging session was

Re: [PATCH v4 0/9] vhost-user: Add SHMEM_MAP/UNMAP requests

2025-02-24 Thread David Hildenbrand
On 24.02.25 09:54, Albert Esteve wrote: On Mon, Feb 17, 2025 at 9:01 PM David Hildenbrand wrote: On 17.02.25 17:40, Albert Esteve wrote: Hi all, Hi, looks like our debugging session was successfu :) One question below. v3->v4 - Change mmap strategy to use RAM blocks and subregi

Re: [PATCH v2 0/2] s390x: support virtio-mem-pci

2025-02-21 Thread David Hildenbrand
On 21.02.25 09:26, David Hildenbrand wrote: On 21.02.25 00:24, Michael S. Tsirkin wrote: On Tue, Jan 28, 2025 at 07:57:03PM +0100, David Hildenbrand wrote: This is based-on [1], which adds MSI-X support to virtio-balloon-pci, but can be applied independently. Turns out it is fairly easy to

Re: [PATCH v2 0/2] s390x: support virtio-mem-pci

2025-02-21 Thread David Hildenbrand
On 21.02.25 00:24, Michael S. Tsirkin wrote: On Tue, Jan 28, 2025 at 07:57:03PM +0100, David Hildenbrand wrote: This is based-on [1], which adds MSI-X support to virtio-balloon-pci, but can be applied independently. Turns out it is fairly easy to get virtio-mem-pci running on s390x. We only

Re: [RFC 1/2] system/memory: Allow creating IOMMU mappings from RAM discard populate notifiers

2025-02-21 Thread David Hildenbrand
On 21.02.25 03:25, Chenyi Qiang wrote: On 2/21/2025 3:39 AM, David Hildenbrand wrote: On 20.02.25 17:13, Jean-Philippe Brucker wrote: For Arm CCA we'd like the guest_memfd discard notifier to call the IOMMU notifiers and create e.g. VFIO mappings. The default VFIO discard notifier

Re: [RFC 1/2] system/memory: Allow creating IOMMU mappings from RAM discard populate notifiers

2025-02-20 Thread David Hildenbrand
On 20.02.25 17:13, Jean-Philippe Brucker wrote: For Arm CCA we'd like the guest_memfd discard notifier to call the IOMMU notifiers and create e.g. VFIO mappings. The default VFIO discard notifier isn't sufficient for CCA because the DMA addresses need a translation (even without vIOMMU). At the

Re: [PATCH] physmem: replace assertion with error

2025-02-18 Thread David Hildenbrand
object_get_typename(OBJECT(current_machine->cgs))); +goto out_free; +} assert(new_block->guest_memfd < 0); ret = ram_block_discard_require(true); Reviewed-by: David Hildenbrand -- Cheers, David / dhildenb

Re: [PATCH v2 2/6] memory: Change memory_region_set_ram_discard_manager() to return the result

2025-02-18 Thread David Hildenbrand
instance is allowed to be set for a MemoryRegion at present. Suggested-by: David Hildenbrand Signed-off-by: Chenyi Qiang --- Changes in v2: - newly added. --- hw/virtio/virtio-mem.c | 30 +- include/exec/memory.h | 6 +++--- system/memory.c| 11

Re: [PATCH v4 0/9] vhost-user: Add SHMEM_MAP/UNMAP requests

2025-02-17 Thread David Hildenbrand
On 17.02.25 17:40, Albert Esteve wrote: Hi all, Hi, looks like our debugging session was successfu :) One question below. v3->v4 - Change mmap strategy to use RAM blocks and subregions. - Add new bitfield to qmp feature map - Followed most review comments from last iteration. - Merge

Re: [PATCH V2] migration: ram block cpr blockers

2025-02-14 Thread David Hildenbrand
On 14.02.25 21:12, Steve Sistare wrote: Unlike cpr-reboot mode, cpr-transfer mode cannot save volatile ram blocks in the migration stream file and recreate them later, because the physical memory for the blocks is pinned and registered for vfio. Add a blocker for volatile ram blocks. Also add a

Re: [PATCH] target/loongarch: Add full type support for query-cpu-model-expansion

2025-02-13 Thread David Hildenbrand
On 13.02.25 17:17, Igor Mammedov wrote: On Thu, 13 Feb 2025 12:48:30 +0100 Markus Armbruster wrote: gaosong writes: Cc: Markus hi, Markus What is the difference between CPU_MODEL_EXPANSION_TYPE_STATIC and CPU_MODEL_EXPANSION_TYPE_FULL? the only difference is that 'static' expansion will

Re: [PATCH v3 0/7] physmem: teach cpu_memory_rw_debug() to write to more memory regions

2025-02-13 Thread David Hildenbrand
On 13.02.25 00:26, Stefan Zabka wrote: Sorry for the delayed engagement, I failed to apply the patch set from the mailing list and had to remember that David had published this change set on GitHub. Tested-by: Stefan Zabka This addresses my initial use case of being able to write to a single M

Re: [PATCH v3 5/7] memory: pass MemTxAttrs to memory_access_is_direct()

2025-02-12 Thread David Hildenbrand
On 12.02.25 16:21, Peter Xu wrote: On Mon, Feb 10, 2025 at 09:46:46AM +0100, David Hildenbrand wrote: We want to pass another flag that will be stored in MemTxAttrs. So pass MemTxAttrs directly. Reviewed-by: Peter Xu Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: David Hildenbrand

Re: [PATCH v4 1/2] s390x/pci: add support for guests that request direct mapping

2025-02-10 Thread David Hildenbrand
On 07.02.25 21:56, Matthew Rosato wrote: When receiving a guest mpcifc(4) or mpcifc(6) instruction without the T bit set, treat this as a request to perform direct mapping instead of address translation. In order to facilitate this, pin the entirety of guest memory into the host iommu. Pinning

[PATCH v3 7/7] physmem: teach cpu_memory_rw_debug() to write to more memory regions

2025-02-10 Thread David Hildenbrand
zUr6AY3X=x...@mail.gmail.com/ Resolves: https://gitlab.com/qemu-project/qemu/-/issues/213 Reviewed-by: Peter Xu Signed-off-by: David Hildenbrand --- hw/core/cpu-system.c| 13 + include/exec/memattrs.h | 5 - include/exec/memory.h | 3 ++- system/physmem.c| 9 ++--

[PATCH v3 6/7] hmp: use cpu_get_phys_page_debug() in hmp_gva2gpa()

2025-02-10 Thread David Hildenbrand
We don't need the MemTxAttrs, so let's simply use the simpler function variant. Reviewed-by: Peter Xu Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: David Hildenbrand --- monitor/hmp-cmds-target.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/monito

[PATCH v3 5/7] memory: pass MemTxAttrs to memory_access_is_direct()

2025-02-10 Thread David Hildenbrand
We want to pass another flag that will be stored in MemTxAttrs. So pass MemTxAttrs directly. Reviewed-by: Peter Xu Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: David Hildenbrand --- hw/core/loader.c | 2 +- hw/remote/vfio-user-obj.c | 2 +- include/exec/memory.h | 5

[PATCH v3 3/7] physmem: factor out direct access check into memory_region_supports_direct_access()

2025-02-10 Thread David Hildenbrand
E. Reviewed-by: Peter Xu Signed-off-by: David Hildenbrand --- include/exec/memory.h | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index cb35c38402..4e2cf95ab6 100644 --- a/include/exec/memory.h +++ b/include/exec/memo

[PATCH v3 2/7] physmem: factor out RAM/ROMD check in memory_access_is_direct()

2025-02-10 Thread David Hildenbrand
EVICE regions are also RAM regions, so we can check for RAM+ROMD first. This is a preparation for further changes. Reviewed-by: Peter Xu Signed-off-by: David Hildenbrand --- include/exec/memory.h | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/exec/

[PATCH v3 4/7] physmem: disallow direct access to RAM DEVICE in address_space_write_rom()

2025-02-10 Thread David Hildenbrand
to write to these (and IO) regions. This is a preparation for further changes. Cc: Alex Williamson Reviewed-by: Peter Xu Signed-off-by: David Hildenbrand --- system/physmem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/system/physmem.c b/system/physmem.c index 67c9db9

[PATCH v3 1/7] physmem: factor out memory_region_is_ram_device() check in memory_access_is_direct()

2025-02-10 Thread David Hildenbrand
Peter Xu Signed-off-by: David Hildenbrand --- include/exec/memory.h | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 9f73b59867..5cd7574c60 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -2997

[PATCH v3 0/7] physmem: teach cpu_memory_rw_debug() to write to more memory regions

2025-02-10 Thread David Hildenbrand
hieu-Daudé Cc: Peter Maydell Cc: Alex Bennée Cc: Alex Williamson Cc: Eduardo Habkost Cc: Marcel Apfelbaum Cc: Elena Ufimtseva Cc: Jagannathan Raman Cc: "Dr. David Alan Gilbert" Cc: Stefan Zabka David Hildenbrand (7): physmem: factor out memory_region_is_ram_device() check

Re: [PATCH v7 6/6] hostmem: Handle remapping of RAM

2025-02-04 Thread David Hildenbrand
On 04.02.25 18:58, Peter Xu wrote: On Tue, Feb 04, 2025 at 06:50:17PM +0100, David Hildenbrand wrote: /* @@ -595,6 +628,7 @@ static const TypeInfo host_memory_backend_info = { .instance_size = sizeof(HostMemoryBackend), .instance_init = host_memory_backend_init

  1   2   3   4   5   6   7   8   9   10   >