* [PATCH] vfio/container: set error on cpr failure
@ 2025-08-13 14:17 Steve Sistare
2025-08-13 15:05 ` Philippe Mathieu-Daudé
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Steve Sistare @ 2025-08-13 14:17 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Williamson, Cedric Le Goater, Zhenzhong Duan, Steve Sistare
Set an error message if vfio_cpr_ram_discard_register_listener fails so
the fail label gets a valid error object.
Reported-by: Cédric Le Goater <clg@redhat.com>
Fixes: eba1f657cbb1 ("vfio/container: recover from unmap-all-vaddr failure")
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
hw/vfio/listener.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
index f498e23..5ebafaa 100644
--- a/hw/vfio/listener.c
+++ b/hw/vfio/listener.c
@@ -574,6 +574,9 @@ void vfio_container_region_add(VFIOContainerBase *bcontainer,
vfio_ram_discard_register_listener(bcontainer, section);
} else if (!vfio_cpr_ram_discard_register_listener(bcontainer,
section)) {
+ error_setg(&err,
+ "vfio_cpr_ram_discard_register_listener for %s failed",
+ memory_region_name(section->mr));
goto fail;
}
return;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] vfio/container: set error on cpr failure
2025-08-13 14:17 [PATCH] vfio/container: set error on cpr failure Steve Sistare
@ 2025-08-13 15:05 ` Philippe Mathieu-Daudé
2025-08-14 3:21 ` Duan, Zhenzhong
2025-09-08 14:15 ` Cédric Le Goater
2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-08-13 15:05 UTC (permalink / raw)
To: qemu-devel, Markus Armbruster, David Hildenbrand
Cc: Alex Williamson, Cedric Le Goater, Zhenzhong Duan, Peter Xu,
Michael S. Tsirkin, Paolo Bonzini, Steve Sistare
On 13/8/25 16:17, Steve Sistare wrote:
> Set an error message if vfio_cpr_ram_discard_register_listener fails so
> the fail label gets a valid error object.
>
> Reported-by: Cédric Le Goater <clg@redhat.com>
> Fixes: eba1f657cbb1 ("vfio/container: recover from unmap-all-vaddr failure")
> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
> ---
> hw/vfio/listener.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
> index f498e23..5ebafaa 100644
> --- a/hw/vfio/listener.c
> +++ b/hw/vfio/listener.c
> @@ -574,6 +574,9 @@ void vfio_container_region_add(VFIOContainerBase *bcontainer,
> vfio_ram_discard_register_listener(bcontainer, section);
> } else if (!vfio_cpr_ram_discard_register_listener(bcontainer,
> section)) {
Looking at commit 8947d7fc4e7 ("memory: Introduce RamDiscardManager for
RAM memory regions"):
typedef int (*NotifyRamPopulate)(RamDiscardListener *rdl,
MemoryRegionSection *section);
/*
* @notify_populate:
*
* Notification that previously discarded memory is about to get
* populated.
* Listeners are able to object. If any listener objects, already
* successfully notified listeners are notified about a discard
* again.
*
* @rdl: the #RamDiscardListener getting notified
* @section: the #MemoryRegionSection to get populated. The section
* is aligned within the memory region to the minimum
* granularity unless it would exceed the registered
* section.
*
* Returns 0 on success. If the notification is rejected by the
* listener, an error is returned.
*/
NotifyRamPopulate notify_populate;
Not sure what error is returned by this prototype (errno?), but if what
error is not relevant, maybe it should take an Error** parameter and
return a boolean value instead.
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] vfio/container: set error on cpr failure
2025-08-13 14:17 [PATCH] vfio/container: set error on cpr failure Steve Sistare
2025-08-13 15:05 ` Philippe Mathieu-Daudé
@ 2025-08-14 3:21 ` Duan, Zhenzhong
2025-09-08 14:15 ` Cédric Le Goater
2 siblings, 0 replies; 4+ messages in thread
From: Duan, Zhenzhong @ 2025-08-14 3:21 UTC (permalink / raw)
To: Steve Sistare, qemu-devel@nongnu.org; +Cc: Alex Williamson, Cedric Le Goater
>-----Original Message-----
>From: Steve Sistare <steven.sistare@oracle.com>
>Subject: [PATCH] vfio/container: set error on cpr failure
>
>Set an error message if vfio_cpr_ram_discard_register_listener fails so
>the fail label gets a valid error object.
>
>Reported-by: Cédric Le Goater <clg@redhat.com>
>Fixes: eba1f657cbb1 ("vfio/container: recover from unmap-all-vaddr failure")
>Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Zhenzhong
>---
> hw/vfio/listener.c | 3 +++
> 1 file changed, 3 insertions(+)
>
>diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
>index f498e23..5ebafaa 100644
>--- a/hw/vfio/listener.c
>+++ b/hw/vfio/listener.c
>@@ -574,6 +574,9 @@ void vfio_container_region_add(VFIOContainerBase
>*bcontainer,
> vfio_ram_discard_register_listener(bcontainer, section);
> } else if (!vfio_cpr_ram_discard_register_listener(bcontainer,
>
>section)) {
>+ error_setg(&err,
>+ "vfio_cpr_ram_discard_register_listener for %s
>failed",
>+ memory_region_name(section->mr));
> goto fail;
> }
> return;
>--
>1.8.3.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] vfio/container: set error on cpr failure
2025-08-13 14:17 [PATCH] vfio/container: set error on cpr failure Steve Sistare
2025-08-13 15:05 ` Philippe Mathieu-Daudé
2025-08-14 3:21 ` Duan, Zhenzhong
@ 2025-09-08 14:15 ` Cédric Le Goater
2 siblings, 0 replies; 4+ messages in thread
From: Cédric Le Goater @ 2025-09-08 14:15 UTC (permalink / raw)
To: Steve Sistare, qemu-devel; +Cc: Alex Williamson, Zhenzhong Duan
On 8/13/25 16:17, Steve Sistare wrote:
> Set an error message if vfio_cpr_ram_discard_register_listener fails so
> the fail label gets a valid error object.
>
> Reported-by: Cédric Le Goater <clg@redhat.com>
> Fixes: eba1f657cbb1 ("vfio/container: recover from unmap-all-vaddr failure")
> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
> ---
> hw/vfio/listener.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
> index f498e23..5ebafaa 100644
> --- a/hw/vfio/listener.c
> +++ b/hw/vfio/listener.c
> @@ -574,6 +574,9 @@ void vfio_container_region_add(VFIOContainerBase *bcontainer,
> vfio_ram_discard_register_listener(bcontainer, section);
> } else if (!vfio_cpr_ram_discard_register_listener(bcontainer,
> section)) {
> + error_setg(&err,
> + "vfio_cpr_ram_discard_register_listener for %s failed",
> + memory_region_name(section->mr));
> goto fail;
> }
> return;
Applied to vfio-next.
Thanks,
C.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-09-08 14:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-13 14:17 [PATCH] vfio/container: set error on cpr failure Steve Sistare
2025-08-13 15:05 ` Philippe Mathieu-Daudé
2025-08-14 3:21 ` Duan, Zhenzhong
2025-09-08 14:15 ` Cédric Le Goater
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).