qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 4/5] Add vfio_listerner_log_sync to mark dirty p


From: Dr. David Alan Gilbert
Subject: Re: [Qemu-devel] [PATCH 4/5] Add vfio_listerner_log_sync to mark dirty pages
Date: Thu, 22 Nov 2018 20:00:40 +0000
User-agent: Mutt/1.10.1 (2018-07-13)

* Kirti Wankhede (address@hidden) wrote:
> vfio_listerner_log_sync gets list of dirty pages from vendor driver and mark
> those pages dirty.
> 
> Signed-off-by: Kirti Wankhede <address@hidden>
> Reviewed-by: Neo Jia <address@hidden>
> ---
>  hw/vfio/common.c | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
> index fb396cf00ac4..338aad7426f0 100644
> --- a/hw/vfio/common.c
> +++ b/hw/vfio/common.c
> @@ -697,9 +697,41 @@ static void vfio_listener_region_del(MemoryListener 
> *listener,
>      }
>  }
>  
> +static void vfio_listerner_log_sync(MemoryListener *listener,
> +                                    MemoryRegionSection *section)
> +{
> +    uint64_t start_addr, size, pfn_count;
> +    VFIOGroup *group;
> +    VFIODevice *vbasedev;
> +
> +    QLIST_FOREACH(group, &vfio_group_list, next) {
> +        QLIST_FOREACH(vbasedev, &group->device_list, next) {
> +            switch (vbasedev->device_state) {
> +            case VFIO_DEVICE_STATE_MIGRATION_PRECOPY:
> +            case VFIO_DEVICE_STATE_MIGRATION_STOPNCOPY:
> +                    continue;
> +
> +            default:
> +                    return;
> +            }
> +        }
> +    }

Is that big loop just trying to find devices not in migration?
Some comments would be good.

Dave

> +    start_addr = TARGET_PAGE_ALIGN(section->offset_within_address_space);
> +    size = int128_get64(section->size);
> +    pfn_count = size >> TARGET_PAGE_BITS;
> +
> +    QLIST_FOREACH(group, &vfio_group_list, next) {
> +        QLIST_FOREACH(vbasedev, &group->device_list, next) {
> +            vfio_get_dirty_page_list(vbasedev, start_addr, pfn_count);
> +        }
> +    }
> +}
> +
>  static const MemoryListener vfio_memory_listener = {
>      .region_add = vfio_listener_region_add,
>      .region_del = vfio_listener_region_del,
> +    .log_sync = vfio_listerner_log_sync,
>  };
>  
>  static void vfio_listener_release(VFIOContainer *container)
> -- 
> 2.7.0
> 
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK



reply via email to

[Prev in Thread] Current Thread [Next in Thread]