[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/9] vfio/migration: Add vfio_devices_all_dirty_tracking_star
From: |
Joao Martins |
Subject: |
Re: [PATCH 4/9] vfio/migration: Add vfio_devices_all_dirty_tracking_started() helper |
Date: |
Mon, 16 Dec 2024 12:54:18 +0000 |
On 16/12/2024 09:46, Avihai Horon wrote:
> vfio_devices_all_dirty_tracking() and vfio_dma_unmap_dirty_sync_needed()
> share the same code that checks if dirty page tracking has been started.
>
> Extract it to a common helper vfio_devices_all_dirty_tracking_started().
>
> Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
> ---
> hw/vfio/common.c | 25 +++++++++++++------------
> 1 file changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
> index 81fba81a6f..45783982c9 100644
> --- a/hw/vfio/common.c
> +++ b/hw/vfio/common.c
> @@ -184,16 +184,22 @@ static bool
> vfio_devices_all_device_dirty_tracking_started(
> return true;
> }
>
> +static bool
> +vfio_devices_all_dirty_tracking_started(const VFIOContainerBase *bcontainer)
> +{
> + if (!migration_is_running()) {
> + return false;
> + }
> +
> + return vfio_devices_all_device_dirty_tracking_started(bcontainer) ||
> + bcontainer->dirty_pages_started;
> +}
> +
> static bool vfio_devices_all_dirty_tracking(VFIOContainerBase *bcontainer)
> {
> VFIODevice *vbasedev;
>
> - if (!migration_is_running()) {
> - return false;
> - }
> -
> - if (!(vfio_devices_all_device_dirty_tracking_started(bcontainer) ||
> - bcontainer->dirty_pages_started)) {
> + if (!vfio_devices_all_dirty_tracking_started(bcontainer)) {
> return false;
> }
>
> @@ -231,12 +237,7 @@ bool vfio_devices_all_device_dirty_tracking(const
> VFIOContainerBase *bcontainer)
>
> bool vfio_dma_unmap_dirty_sync_needed(const VFIOContainerBase *bcontainer)
> {
> - if (!migration_is_running()) {
> - return false;
> - }
> -
> - return vfio_devices_all_device_dirty_tracking_started(bcontainer) ||
> - bcontainer->dirty_pages_started;
> + return vfio_devices_all_dirty_tracking_started(bcontainer);
> }
>
> static bool vfio_listener_skipped_section(MemoryRegionSection *section)
- Re: [PATCH 2/9] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic, (continued)
[PATCH 3/9] vfio/migration: Refactor vfio_devices_all_running_and_mig_active() logic, Avihai Horon, 2024/12/16
[PATCH 4/9] vfio/migration: Add vfio_devices_all_dirty_tracking_started() helper, Avihai Horon, 2024/12/16
- Re: [PATCH 4/9] vfio/migration: Add vfio_devices_all_dirty_tracking_started() helper,
Joao Martins <=
[PATCH 5/9] vfio/migration: Drop vfio_dma_unmap_dirty_sync_needed(), Avihai Horon, 2024/12/16
[PATCH 7/9] system/dirtylimit: Don't use migration_is_active(), Avihai Horon, 2024/12/16
[PATCH 8/9] migration: Drop migration_is_device(), Avihai Horon, 2024/12/16