qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Joao Martins <joao.m.martins@oracle.com>
To: "Duan, Zhenzhong" <zhenzhong.duan@intel.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "Liu, Yi L" <yi.l.liu@intel.com>,
	Eric Auger <eric.auger@redhat.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Cedric Le Goater <clg@redhat.com>,
	Jason Gunthorpe <jgg@nvidia.com>,
	Avihai Horon <avihaih@nvidia.com>
Subject: Re: [PATCH v3 09/10] vfio/migration: Don't block migration device dirty tracking is unsupported
Date: Wed, 10 Jul 2024 11:59:23 +0100	[thread overview]
Message-ID: <e6281062-8c27-48f6-a24c-b728b07c4053@oracle.com> (raw)
In-Reply-To: <SJ0PR11MB674411D22DA888BD5222B8AE92A42@SJ0PR11MB6744.namprd11.prod.outlook.com>

On 10/07/2024 11:38, Duan, Zhenzhong wrote:
> 
> 
>> -----Original Message-----
>> From: Joao Martins <joao.m.martins@oracle.com>
>> Subject: [PATCH v3 09/10] vfio/migration: Don't block migration device dirty
>> tracking is unsupported
>>
>> By default VFIO migration is set to auto, which will support live
>> migration if the migration capability is set *and* also dirty page
>> tracking is supported.
>>
>> For testing purposes one can force enable without dirty page tracking
>> via enable-migration=on, but that option is generally left for testing
>> purposes.
>>
>> So starting with IOMMU dirty tracking it can use to acomodate the lack of
>> VF dirty page tracking allowing us to minimize the VF requirements for
>> migration and thus enabling migration by default for those.
>>
>> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
>> ---
>> hw/vfio/migration.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
>> index 34d4be2ce1b1..89195928666f 100644
>> --- a/hw/vfio/migration.c
>> +++ b/hw/vfio/migration.c
>> @@ -1012,6 +1012,7 @@ void vfio_reset_bytes_transferred(void)
>>  */
>> bool vfio_migration_realize(VFIODevice *vbasedev, Error **errp)
>> {
>> +    HostIOMMUDeviceClass *hiodc =
>> HOST_IOMMU_DEVICE_GET_CLASS(vbasedev->hiod);
>>     Error *err = NULL;
>>     int ret;
>>
>> @@ -1036,7 +1037,10 @@ bool vfio_migration_realize(VFIODevice
>> *vbasedev, Error **errp)
>>         return !vfio_block_migration(vbasedev, err, errp);
>>     }
>>
>> -    if (!vbasedev->dirty_pages_supported) {
>> +    if (!vbasedev->dirty_pages_supported &&
>> +        (vbasedev->iommufd &&
>> +         !hiodc->get_cap(vbasedev->hiod,
>> +                         HOST_IOMMU_DEVICE_CAP_DIRTY_TRACKING, NULL))) {
> 
> What about below, this can avoid a new CAP define.
> 
> --- a/hw/vfio/migration.c
> +++ b/hw/vfio/migration.c
> @@ -1036,7 +1036,7 @@ bool vfio_migration_realize(VFIODevice *vbasedev, Error **errp)
>          return !vfio_block_migration(vbasedev, err, errp);
>      }
> 
> -    if (!vbasedev->dirty_pages_supported) {
> +    if (!vbasedev->dirty_pages_supported && !vbasedev->bcontainer->dirty_pages_supported) {
>          if (vbasedev->enable_migration == ON_OFF_AUTO_AUTO) {
>              error_setg(&err,
>                         "%s: VFIO device doesn't support device dirty tracking",
> 

From the kernel POV this is supposedly device specific, and the
container::dirty_pages_supported doesn't quite capture a case where the system
is less homogeneous (aka more than one hwpt where one has dirty tracking and the
other doesn't). So asking the HostIOMMUDevice sort of futureproof it (and better
represents the kernel interface). But I don't know of systems like this. And
furthemore mix and match of device dirty tracker with IOMMU dirty tracker isn't
supported in code, so for now I can look at bcontainer::dirty_pages_supported
and I'll remove the CAP addition.

	Joao


  reply	other threads:[~2024-07-10 11:01 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-08 14:34 [PATCH v3 00/10] hw/vfio: IOMMUFD Dirty Tracking Joao Martins
2024-07-08 14:34 ` [PATCH v3 01/10] vfio/iommufd: Don't fail to realize on IOMMU_GET_HW_INFO failure Joao Martins
2024-07-09  3:43   ` Duan, Zhenzhong
2024-07-09  8:56     ` Joao Martins
2024-07-09 11:45       ` Joao Martins
2024-07-09 11:50         ` Joao Martins
2024-07-10  2:53           ` Duan, Zhenzhong
2024-07-10  9:29             ` Joao Martins
2024-07-10  9:54               ` Duan, Zhenzhong
2024-07-10  9:56                 ` Joao Martins
2024-07-08 14:34 ` [PATCH v3 02/10] backends/iommufd: Extend iommufd_backend_get_device_info() to fetch HW capabilities Joao Martins
2024-07-09  6:13   ` Duan, Zhenzhong
2024-07-08 14:34 ` [PATCH v3 03/10] vfio/iommufd: Return errno in iommufd_cdev_attach_ioas_hwpt() Joao Martins
2024-07-08 15:28   ` Cédric Le Goater
2024-07-08 15:32     ` Joao Martins
2024-07-08 16:28       ` Joao Martins
2024-07-09  6:20       ` Cédric Le Goater
2024-07-09  8:56         ` Joao Martins
2024-07-08 14:34 ` [PATCH v3 04/10] vfio/iommufd: Introduce auto domain creation Joao Martins
2024-07-09  6:26   ` Duan, Zhenzhong
2024-07-09  9:00     ` Joao Martins
2024-07-09  6:50   ` Cédric Le Goater
2024-07-09  9:09     ` Joao Martins
2024-07-08 14:34 ` [PATCH v3 05/10] vfio/iommufd: Probe and request hwpt dirty tracking capability Joao Martins
2024-07-09  6:28   ` Cédric Le Goater
2024-07-09  9:04     ` Joao Martins
2024-07-09 12:47       ` Joao Martins
2024-07-09 16:53         ` Joao Martins
2024-07-08 14:34 ` [PATCH v3 06/10] vfio/iommufd: Implement VFIOIOMMUClass::set_dirty_tracking support Joao Martins
2024-07-09  7:07   ` Cédric Le Goater
2024-07-09  9:13     ` Joao Martins
2024-07-08 14:34 ` [PATCH v3 07/10] vfio/iommufd: Implement VFIOIOMMUClass::query_dirty_bitmap support Joao Martins
2024-07-09  7:05   ` Cédric Le Goater
2024-07-09  9:13     ` Joao Martins
2024-07-09 12:41       ` Joao Martins
2024-07-08 14:34 ` [PATCH v3 08/10] vfio/iommufd: Parse hw_caps and store dirty tracking support Joao Martins
2024-07-08 14:34 ` [PATCH v3 09/10] vfio/migration: Don't block migration device dirty tracking is unsupported Joao Martins
2024-07-09  7:02   ` Cédric Le Goater
2024-07-09  9:09     ` Joao Martins
2024-07-10 10:38   ` Duan, Zhenzhong
2024-07-10 10:59     ` Joao Martins [this message]
2024-07-08 14:34 ` [PATCH v3 10/10] vfio/common: Allow disabling device dirty page tracking Joao Martins
2024-07-10 10:42   ` Duan, Zhenzhong
2024-07-10 10:51     ` Joao Martins
2024-07-11  7:41 ` [PATCH v3 00/10] hw/vfio: IOMMUFD Dirty Tracking Cédric Le Goater
2024-07-11  8:33   ` Joao Martins
2024-07-11 10:22     ` Duan, Zhenzhong
2024-07-11 10:44       ` Joao Martins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e6281062-8c27-48f6-a24c-b728b07c4053@oracle.com \
    --to=joao.m.martins@oracle.com \
    --cc=alex.williamson@redhat.com \
    --cc=avihaih@nvidia.com \
    --cc=clg@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yi.l.liu@intel.com \
    --cc=zhenzhong.duan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).