hw/vfio/common.c | 60 +++++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 24 deletions(-)
VFIO uses migration_file_set_error() in a couple of places where an
'Error **' parameter is not provided. In MemoryListener handlers :
vfio_listener_region_add
vfio_listener_log_global_stop
vfio_listener_log_sync
and in callback routines for IOMMU notifiers :
vfio_iommu_map_notify
vfio_iommu_map_dirty_notify
Hopefully, one day, we will be able to extend these callbacks with an
'Error **' parameter and avoid setting the global migration error.
Until then, it seems sensible to clearly identify the use cases, which
are limited, and open code vfio_migration_set_error(). One other
benefit is an improved error reporting when migration is running.
While at it, slightly modify error reporting to only report errors
when migration is not active and not always as is currently done.
Cc: Prasad Pandit <pjp@fedoraproject.org>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/vfio/common.c | 60 +++++++++++++++++++++++++++++-------------------
1 file changed, 36 insertions(+), 24 deletions(-)
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 1a0d9290f88c9774a98f65087a36b86922b21a73..a591ce5b97ff41cdc8249e9eeafc8dc347d45fac 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -149,13 +149,6 @@ bool vfio_viommu_preset(VFIODevice *vbasedev)
return vbasedev->bcontainer->space->as != &address_space_memory;
}
-static void vfio_set_migration_error(int ret)
-{
- if (migration_is_running()) {
- migration_file_set_error(ret, NULL);
- }
-}
-
bool vfio_device_state_is_running(VFIODevice *vbasedev)
{
VFIOMigration *migration = vbasedev->migration;
@@ -291,9 +284,14 @@ static void vfio_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb)
iova, iova + iotlb->addr_mask);
if (iotlb->target_as != &address_space_memory) {
- error_report("Wrong target AS \"%s\", only system memory is allowed",
- iotlb->target_as->name ? iotlb->target_as->name : "none");
- vfio_set_migration_error(-EINVAL);
+ error_setg(&local_err,
+ "Wrong target AS \"%s\", only system memory is allowed",
+ iotlb->target_as->name ? iotlb->target_as->name : "none");
+ if (migration_is_running()) {
+ migration_file_set_error(-EINVAL, local_err);
+ } else {
+ error_report_err(local_err);
+ }
return;
}
@@ -326,11 +324,16 @@ static void vfio_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb)
ret = vfio_container_dma_unmap(bcontainer, iova,
iotlb->addr_mask + 1, iotlb);
if (ret) {
- error_report("vfio_container_dma_unmap(%p, 0x%"HWADDR_PRIx", "
- "0x%"HWADDR_PRIx") = %d (%s)",
- bcontainer, iova,
- iotlb->addr_mask + 1, ret, strerror(-ret));
- vfio_set_migration_error(ret);
+ error_setg(&local_err,
+ "vfio_container_dma_unmap(%p, 0x%"HWADDR_PRIx", "
+ "0x%"HWADDR_PRIx") = %d (%s)",
+ bcontainer, iova,
+ iotlb->addr_mask + 1, ret, strerror(-ret));
+ if (migration_is_running()) {
+ migration_file_set_error(ret, local_err);
+ } else {
+ error_report_err(local_err);
+ }
}
}
out:
@@ -1112,8 +1115,11 @@ static void vfio_listener_log_global_stop(MemoryListener *listener)
if (ret) {
error_prepend(&local_err,
"vfio: Could not stop dirty page tracking - ");
- error_report_err(local_err);
- vfio_set_migration_error(ret);
+ if (migration_is_running()) {
+ migration_file_set_error(ret, local_err);
+ } else {
+ error_report_err(local_err);
+ }
}
}
@@ -1229,14 +1235,14 @@ static void vfio_iommu_map_dirty_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb)
trace_vfio_iommu_map_dirty_notify(iova, iova + iotlb->addr_mask);
if (iotlb->target_as != &address_space_memory) {
- error_report("Wrong target AS \"%s\", only system memory is allowed",
- iotlb->target_as->name ? iotlb->target_as->name : "none");
+ error_setg(&local_err,
+ "Wrong target AS \"%s\", only system memory is allowed",
+ iotlb->target_as->name ? iotlb->target_as->name : "none");
goto out;
}
rcu_read_lock();
if (!vfio_get_xlat_addr(iotlb, NULL, &translated_addr, NULL, &local_err)) {
- error_report_err(local_err);
goto out_unlock;
}
@@ -1247,7 +1253,6 @@ static void vfio_iommu_map_dirty_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb)
"vfio_iommu_map_dirty_notify(%p, 0x%"HWADDR_PRIx", "
"0x%"HWADDR_PRIx") failed - ", bcontainer, iova,
iotlb->addr_mask + 1);
- error_report_err(local_err);
}
out_unlock:
@@ -1255,7 +1260,11 @@ out_unlock:
out:
if (ret) {
- vfio_set_migration_error(ret);
+ if (migration_is_running()) {
+ migration_file_set_error(ret, local_err);
+ } else {
+ error_report_err(local_err);
+ }
}
}
@@ -1388,8 +1397,11 @@ static void vfio_listener_log_sync(MemoryListener *listener,
if (vfio_log_sync_needed(bcontainer)) {
ret = vfio_sync_dirty_bitmap(bcontainer, section, &local_err);
if (ret) {
- error_report_err(local_err);
- vfio_set_migration_error(ret);
+ if (migration_is_running()) {
+ migration_file_set_error(ret, local_err);
+ } else {
+ error_report_err(local_err);
+ }
}
}
}
--
2.49.0
On 24/03/2025 14:33, Cédric Le Goater wrote: > External email: Use caution opening links or attachments > > > VFIO uses migration_file_set_error() in a couple of places where an > 'Error **' parameter is not provided. In MemoryListener handlers : > > vfio_listener_region_add > vfio_listener_log_global_stop > vfio_listener_log_sync > > and in callback routines for IOMMU notifiers : > > vfio_iommu_map_notify > vfio_iommu_map_dirty_notify > > Hopefully, one day, we will be able to extend these callbacks with an > 'Error **' parameter and avoid setting the global migration error. > Until then, it seems sensible to clearly identify the use cases, which > are limited, and open code vfio_migration_set_error(). One other > benefit is an improved error reporting when migration is running. > > While at it, slightly modify error reporting to only report errors > when migration is not active and not always as is currently done. > > Cc: Prasad Pandit <pjp@fedoraproject.org> > Signed-off-by: Cédric Le Goater <clg@redhat.com> > --- > hw/vfio/common.c | 60 +++++++++++++++++++++++++++++------------------- > 1 file changed, 36 insertions(+), 24 deletions(-) > > diff --git a/hw/vfio/common.c b/hw/vfio/common.c > index 1a0d9290f88c9774a98f65087a36b86922b21a73..a591ce5b97ff41cdc8249e9eeafc8dc347d45fac 100644 > --- a/hw/vfio/common.c > +++ b/hw/vfio/common.c > @@ -149,13 +149,6 @@ bool vfio_viommu_preset(VFIODevice *vbasedev) > return vbasedev->bcontainer->space->as != &address_space_memory; > } > > -static void vfio_set_migration_error(int ret) > -{ > - if (migration_is_running()) { > - migration_file_set_error(ret, NULL); > - } > -} Wouldn't it be better to extend vfio_set_migration_error() to take also Error* instead of duplicating code? We can rename it to vfio_set_error() if it's not solely related to vfio migration anymore. Thanks. > - > bool vfio_device_state_is_running(VFIODevice *vbasedev) > { > VFIOMigration *migration = vbasedev->migration; > @@ -291,9 +284,14 @@ static void vfio_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb) > iova, iova + iotlb->addr_mask); > > if (iotlb->target_as != &address_space_memory) { > - error_report("Wrong target AS \"%s\", only system memory is allowed", > - iotlb->target_as->name ? iotlb->target_as->name : "none"); > - vfio_set_migration_error(-EINVAL); > + error_setg(&local_err, > + "Wrong target AS \"%s\", only system memory is allowed", > + iotlb->target_as->name ? iotlb->target_as->name : "none"); > + if (migration_is_running()) { > + migration_file_set_error(-EINVAL, local_err); > + } else { > + error_report_err(local_err); > + } > return; > } > > @@ -326,11 +324,16 @@ static void vfio_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb) > ret = vfio_container_dma_unmap(bcontainer, iova, > iotlb->addr_mask + 1, iotlb); > if (ret) { > - error_report("vfio_container_dma_unmap(%p, 0x%"HWADDR_PRIx", " > - "0x%"HWADDR_PRIx") = %d (%s)", > - bcontainer, iova, > - iotlb->addr_mask + 1, ret, strerror(-ret)); > - vfio_set_migration_error(ret); > + error_setg(&local_err, > + "vfio_container_dma_unmap(%p, 0x%"HWADDR_PRIx", " > + "0x%"HWADDR_PRIx") = %d (%s)", > + bcontainer, iova, > + iotlb->addr_mask + 1, ret, strerror(-ret)); > + if (migration_is_running()) { > + migration_file_set_error(ret, local_err); > + } else { > + error_report_err(local_err); > + } > } > } > out: > @@ -1112,8 +1115,11 @@ static void vfio_listener_log_global_stop(MemoryListener *listener) > if (ret) { > error_prepend(&local_err, > "vfio: Could not stop dirty page tracking - "); > - error_report_err(local_err); > - vfio_set_migration_error(ret); > + if (migration_is_running()) { > + migration_file_set_error(ret, local_err); > + } else { > + error_report_err(local_err); > + } > } > } > > @@ -1229,14 +1235,14 @@ static void vfio_iommu_map_dirty_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb) > trace_vfio_iommu_map_dirty_notify(iova, iova + iotlb->addr_mask); > > if (iotlb->target_as != &address_space_memory) { > - error_report("Wrong target AS \"%s\", only system memory is allowed", > - iotlb->target_as->name ? iotlb->target_as->name : "none"); > + error_setg(&local_err, > + "Wrong target AS \"%s\", only system memory is allowed", > + iotlb->target_as->name ? iotlb->target_as->name : "none"); > goto out; > } > > rcu_read_lock(); > if (!vfio_get_xlat_addr(iotlb, NULL, &translated_addr, NULL, &local_err)) { > - error_report_err(local_err); > goto out_unlock; > } > > @@ -1247,7 +1253,6 @@ static void vfio_iommu_map_dirty_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb) > "vfio_iommu_map_dirty_notify(%p, 0x%"HWADDR_PRIx", " > "0x%"HWADDR_PRIx") failed - ", bcontainer, iova, > iotlb->addr_mask + 1); > - error_report_err(local_err); > } > > out_unlock: > @@ -1255,7 +1260,11 @@ out_unlock: > > out: > if (ret) { > - vfio_set_migration_error(ret); > + if (migration_is_running()) { > + migration_file_set_error(ret, local_err); > + } else { > + error_report_err(local_err); > + } > } > } > > @@ -1388,8 +1397,11 @@ static void vfio_listener_log_sync(MemoryListener *listener, > if (vfio_log_sync_needed(bcontainer)) { > ret = vfio_sync_dirty_bitmap(bcontainer, section, &local_err); > if (ret) { > - error_report_err(local_err); > - vfio_set_migration_error(ret); > + if (migration_is_running()) { > + migration_file_set_error(ret, local_err); > + } else { > + error_report_err(local_err); > + } > } > } > } > -- > 2.49.0 > >
On 3/24/25 16:14, Avihai Horon wrote: > > On 24/03/2025 14:33, Cédric Le Goater wrote: >> External email: Use caution opening links or attachments >> >> >> VFIO uses migration_file_set_error() in a couple of places where an >> 'Error **' parameter is not provided. In MemoryListener handlers : >> >> vfio_listener_region_add >> vfio_listener_log_global_stop >> vfio_listener_log_sync >> >> and in callback routines for IOMMU notifiers : >> >> vfio_iommu_map_notify >> vfio_iommu_map_dirty_notify >> >> Hopefully, one day, we will be able to extend these callbacks with an >> 'Error **' parameter and avoid setting the global migration error. >> Until then, it seems sensible to clearly identify the use cases, which >> are limited, and open code vfio_migration_set_error(). One other >> benefit is an improved error reporting when migration is running. >> >> While at it, slightly modify error reporting to only report errors >> when migration is not active and not always as is currently done. >> >> Cc: Prasad Pandit <pjp@fedoraproject.org> >> Signed-off-by: Cédric Le Goater <clg@redhat.com> >> --- >> hw/vfio/common.c | 60 +++++++++++++++++++++++++++++------------------- >> 1 file changed, 36 insertions(+), 24 deletions(-) >> >> diff --git a/hw/vfio/common.c b/hw/vfio/common.c >> index 1a0d9290f88c9774a98f65087a36b86922b21a73..a591ce5b97ff41cdc8249e9eeafc8dc347d45fac 100644 >> --- a/hw/vfio/common.c >> +++ b/hw/vfio/common.c >> @@ -149,13 +149,6 @@ bool vfio_viommu_preset(VFIODevice *vbasedev) >> return vbasedev->bcontainer->space->as != &address_space_memory; >> } >> >> -static void vfio_set_migration_error(int ret) >> -{ >> - if (migration_is_running()) { >> - migration_file_set_error(ret, NULL); >> - } >> -} > > Wouldn't it be better to extend vfio_set_migration_error() to take also Error* instead of duplicating code? > We can rename it to vfio_set_error() if it's not solely related to vfio migration anymore. IMO, the vfio_set_migration_error() wrapper shadows the use of the migration routines and their context. I prefer to be explicit about it, open the code and work on removal. It is possible to add an 'Error **' parameter to log_global_stop handlers and to the IOMMU notifiers. It just takes time. Thanks, C. > > Thanks. > >> - >> bool vfio_device_state_is_running(VFIODevice *vbasedev) >> { >> VFIOMigration *migration = vbasedev->migration; >> @@ -291,9 +284,14 @@ static void vfio_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb) >> iova, iova + iotlb->addr_mask); >> >> if (iotlb->target_as != &address_space_memory) { >> - error_report("Wrong target AS \"%s\", only system memory is allowed", >> - iotlb->target_as->name ? iotlb->target_as->name : "none"); >> - vfio_set_migration_error(-EINVAL); >> + error_setg(&local_err, >> + "Wrong target AS \"%s\", only system memory is allowed", >> + iotlb->target_as->name ? iotlb->target_as->name : "none"); >> + if (migration_is_running()) { >> + migration_file_set_error(-EINVAL, local_err); >> + } else { >> + error_report_err(local_err); >> + } >> return; >> } >> >> @@ -326,11 +324,16 @@ static void vfio_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb) >> ret = vfio_container_dma_unmap(bcontainer, iova, >> iotlb->addr_mask + 1, iotlb); >> if (ret) { >> - error_report("vfio_container_dma_unmap(%p, 0x%"HWADDR_PRIx", " >> - "0x%"HWADDR_PRIx") = %d (%s)", >> - bcontainer, iova, >> - iotlb->addr_mask + 1, ret, strerror(-ret)); >> - vfio_set_migration_error(ret); >> + error_setg(&local_err, >> + "vfio_container_dma_unmap(%p, 0x%"HWADDR_PRIx", " >> + "0x%"HWADDR_PRIx") = %d (%s)", >> + bcontainer, iova, >> + iotlb->addr_mask + 1, ret, strerror(-ret)); >> + if (migration_is_running()) { >> + migration_file_set_error(ret, local_err); >> + } else { >> + error_report_err(local_err); >> + } >> } >> } >> out: >> @@ -1112,8 +1115,11 @@ static void vfio_listener_log_global_stop(MemoryListener *listener) >> if (ret) { >> error_prepend(&local_err, >> "vfio: Could not stop dirty page tracking - "); >> - error_report_err(local_err); >> - vfio_set_migration_error(ret); >> + if (migration_is_running()) { >> + migration_file_set_error(ret, local_err); >> + } else { >> + error_report_err(local_err); >> + } >> } >> } >> >> @@ -1229,14 +1235,14 @@ static void vfio_iommu_map_dirty_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb) >> trace_vfio_iommu_map_dirty_notify(iova, iova + iotlb->addr_mask); >> >> if (iotlb->target_as != &address_space_memory) { >> - error_report("Wrong target AS \"%s\", only system memory is allowed", >> - iotlb->target_as->name ? iotlb->target_as->name : "none"); >> + error_setg(&local_err, >> + "Wrong target AS \"%s\", only system memory is allowed", >> + iotlb->target_as->name ? iotlb->target_as->name : "none"); >> goto out; >> } >> >> rcu_read_lock(); >> if (!vfio_get_xlat_addr(iotlb, NULL, &translated_addr, NULL, &local_err)) { >> - error_report_err(local_err); >> goto out_unlock; >> } >> >> @@ -1247,7 +1253,6 @@ static void vfio_iommu_map_dirty_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb) >> "vfio_iommu_map_dirty_notify(%p, 0x%"HWADDR_PRIx", " >> "0x%"HWADDR_PRIx") failed - ", bcontainer, iova, >> iotlb->addr_mask + 1); >> - error_report_err(local_err); >> } >> >> out_unlock: >> @@ -1255,7 +1260,11 @@ out_unlock: >> >> out: >> if (ret) { >> - vfio_set_migration_error(ret); >> + if (migration_is_running()) { >> + migration_file_set_error(ret, local_err); >> + } else { >> + error_report_err(local_err); >> + } >> } >> } >> >> @@ -1388,8 +1397,11 @@ static void vfio_listener_log_sync(MemoryListener *listener, >> if (vfio_log_sync_needed(bcontainer)) { >> ret = vfio_sync_dirty_bitmap(bcontainer, section, &local_err); >> if (ret) { >> - error_report_err(local_err); >> - vfio_set_migration_error(ret); >> + if (migration_is_running()) { >> + migration_file_set_error(ret, local_err); >> + } else { >> + error_report_err(local_err); >> + } >> } >> } >> } >> -- >> 2.49.0 >> >> >
On 24/03/2025 17:25, Cédric Le Goater wrote: > External email: Use caution opening links or attachments > > > On 3/24/25 16:14, Avihai Horon wrote: >> >> On 24/03/2025 14:33, Cédric Le Goater wrote: >>> External email: Use caution opening links or attachments >>> >>> >>> VFIO uses migration_file_set_error() in a couple of places where an >>> 'Error **' parameter is not provided. In MemoryListener handlers : >>> >>> vfio_listener_region_add Nit: migration_file_set_error() is not used in vfio_listener_region_add. >>> vfio_listener_log_global_stop >>> vfio_listener_log_sync >>> >>> and in callback routines for IOMMU notifiers : >>> >>> vfio_iommu_map_notify >>> vfio_iommu_map_dirty_notify >>> >>> Hopefully, one day, we will be able to extend these callbacks with an >>> 'Error **' parameter and avoid setting the global migration error. >>> Until then, it seems sensible to clearly identify the use cases, which >>> are limited, and open code vfio_migration_set_error(). One other >>> benefit is an improved error reporting when migration is running. >>> >>> While at it, slightly modify error reporting to only report errors >>> when migration is not active and not always as is currently done. >>> >>> Cc: Prasad Pandit <pjp@fedoraproject.org> >>> Signed-off-by: Cédric Le Goater <clg@redhat.com> >>> --- >>> hw/vfio/common.c | 60 >>> +++++++++++++++++++++++++++++------------------- >>> 1 file changed, 36 insertions(+), 24 deletions(-) >>> >>> diff --git a/hw/vfio/common.c b/hw/vfio/common.c >>> index >>> 1a0d9290f88c9774a98f65087a36b86922b21a73..a591ce5b97ff41cdc8249e9eeafc8dc347d45fac >>> 100644 >>> --- a/hw/vfio/common.c >>> +++ b/hw/vfio/common.c >>> @@ -149,13 +149,6 @@ bool vfio_viommu_preset(VFIODevice *vbasedev) >>> return vbasedev->bcontainer->space->as != &address_space_memory; >>> } >>> >>> -static void vfio_set_migration_error(int ret) >>> -{ >>> - if (migration_is_running()) { >>> - migration_file_set_error(ret, NULL); >>> - } >>> -} >> >> Wouldn't it be better to extend vfio_set_migration_error() to take >> also Error* instead of duplicating code? >> We can rename it to vfio_set_error() if it's not solely related to >> vfio migration anymore. > > IMO, the vfio_set_migration_error() wrapper shadows the use of the > migration routines and their context. I prefer to be explicit about > it, open the code and work on removal. It is possible to add an > 'Error **' parameter to log_global_stop handlers and to the IOMMU > notifiers. It just takes time. I see, fair enough. Reviewed-by: Avihai Horon <avihaih@nvidia.com> > > Thanks, > > C. > >> >> Thanks. >> >>> - >>> bool vfio_device_state_is_running(VFIODevice *vbasedev) >>> { >>> VFIOMigration *migration = vbasedev->migration; >>> @@ -291,9 +284,14 @@ static void vfio_iommu_map_notify(IOMMUNotifier >>> *n, IOMMUTLBEntry *iotlb) >>> iova, iova + iotlb->addr_mask); >>> >>> if (iotlb->target_as != &address_space_memory) { >>> - error_report("Wrong target AS \"%s\", only system memory is >>> allowed", >>> - iotlb->target_as->name ? >>> iotlb->target_as->name : "none"); >>> - vfio_set_migration_error(-EINVAL); >>> + error_setg(&local_err, >>> + "Wrong target AS \"%s\", only system memory is >>> allowed", >>> + iotlb->target_as->name ? iotlb->target_as->name >>> : "none"); >>> + if (migration_is_running()) { >>> + migration_file_set_error(-EINVAL, local_err); >>> + } else { >>> + error_report_err(local_err); >>> + } >>> return; >>> } >>> >>> @@ -326,11 +324,16 @@ static void >>> vfio_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb) >>> ret = vfio_container_dma_unmap(bcontainer, iova, >>> iotlb->addr_mask + 1, iotlb); >>> if (ret) { >>> - error_report("vfio_container_dma_unmap(%p, >>> 0x%"HWADDR_PRIx", " >>> - "0x%"HWADDR_PRIx") = %d (%s)", >>> - bcontainer, iova, >>> - iotlb->addr_mask + 1, ret, strerror(-ret)); >>> - vfio_set_migration_error(ret); >>> + error_setg(&local_err, >>> + "vfio_container_dma_unmap(%p, >>> 0x%"HWADDR_PRIx", " >>> + "0x%"HWADDR_PRIx") = %d (%s)", >>> + bcontainer, iova, >>> + iotlb->addr_mask + 1, ret, strerror(-ret)); >>> + if (migration_is_running()) { >>> + migration_file_set_error(ret, local_err); >>> + } else { >>> + error_report_err(local_err); >>> + } >>> } >>> } >>> out: >>> @@ -1112,8 +1115,11 @@ static void >>> vfio_listener_log_global_stop(MemoryListener *listener) >>> if (ret) { >>> error_prepend(&local_err, >>> "vfio: Could not stop dirty page tracking - "); >>> - error_report_err(local_err); >>> - vfio_set_migration_error(ret); >>> + if (migration_is_running()) { >>> + migration_file_set_error(ret, local_err); >>> + } else { >>> + error_report_err(local_err); >>> + } >>> } >>> } >>> >>> @@ -1229,14 +1235,14 @@ static void >>> vfio_iommu_map_dirty_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb) >>> trace_vfio_iommu_map_dirty_notify(iova, iova + iotlb->addr_mask); >>> >>> if (iotlb->target_as != &address_space_memory) { >>> - error_report("Wrong target AS \"%s\", only system memory is >>> allowed", >>> - iotlb->target_as->name ? >>> iotlb->target_as->name : "none"); >>> + error_setg(&local_err, >>> + "Wrong target AS \"%s\", only system memory is >>> allowed", >>> + iotlb->target_as->name ? iotlb->target_as->name >>> : "none"); >>> goto out; >>> } >>> >>> rcu_read_lock(); >>> if (!vfio_get_xlat_addr(iotlb, NULL, &translated_addr, NULL, >>> &local_err)) { >>> - error_report_err(local_err); >>> goto out_unlock; >>> } >>> >>> @@ -1247,7 +1253,6 @@ static void >>> vfio_iommu_map_dirty_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb) >>> "vfio_iommu_map_dirty_notify(%p, >>> 0x%"HWADDR_PRIx", " >>> "0x%"HWADDR_PRIx") failed - ", bcontainer, >>> iova, >>> iotlb->addr_mask + 1); >>> - error_report_err(local_err); >>> } >>> >>> out_unlock: >>> @@ -1255,7 +1260,11 @@ out_unlock: >>> >>> out: >>> if (ret) { >>> - vfio_set_migration_error(ret); >>> + if (migration_is_running()) { >>> + migration_file_set_error(ret, local_err); >>> + } else { >>> + error_report_err(local_err); >>> + } >>> } >>> } >>> >>> @@ -1388,8 +1397,11 @@ static void >>> vfio_listener_log_sync(MemoryListener *listener, >>> if (vfio_log_sync_needed(bcontainer)) { >>> ret = vfio_sync_dirty_bitmap(bcontainer, section, >>> &local_err); >>> if (ret) { >>> - error_report_err(local_err); >>> - vfio_set_migration_error(ret); >>> + if (migration_is_running()) { >>> + migration_file_set_error(ret, local_err); >>> + } else { >>> + error_report_err(local_err); >>> + } >>> } >>> } >>> } >>> -- >>> 2.49.0 >>> >>> >> >
© 2016 - 2025 Red Hat, Inc.