Re: [PATCH v5 08/10] memory: Change NotifyRamDiscard() definition to return the result

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

 



On 5/26/25 12:36, Cédric Le Goater wrote:
On 5/20/25 12:28, Chenyi Qiang wrote:
So that the caller can check the result of NotifyRamDiscard() handler if
the operation fails.

Signed-off-by: Chenyi Qiang <chenyi.qiang@xxxxxxxxx>
---
Changes in v5:
     - Revert to use of NotifyRamDiscard()

Changes in v4:
     - Newly added.
---
  hw/vfio/listener.c           | 6 ++++--
  include/system/memory.h      | 4 ++--
  system/ram-block-attribute.c | 3 +--
  3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
index bfacb3d8d9..06454e0584 100644
--- a/hw/vfio/listener.c
+++ b/hw/vfio/listener.c
@@ -190,8 +190,8 @@ out:
      rcu_read_unlock();
  }
-static void vfio_ram_discard_notify_discard(RamDiscardListener *rdl,
-                                            MemoryRegionSection *section)
+static int vfio_ram_discard_notify_discard(RamDiscardListener *rdl,
+                                           MemoryRegionSection *section)
  {
      VFIORamDiscardListener *vrdl = container_of(rdl, VFIORamDiscardListener,
                                                  listener);
@@ -206,6 +206,8 @@ static void vfio_ram_discard_notify_discard(RamDiscardListener *rdl,
          error_report("%s: vfio_container_dma_unmap() failed: %s", __func__,
                       strerror(-ret));
      }
+
+    return ret;
  }

vfio_ram_discard_notify_populate() should also be modified
to return this value.

Nope. It should not. This is a rollback path in case of error. All good.

Thanks,

C.





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux