qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Auger <eric.auger@redhat.com>
To: Joao Martins <joao.m.martins@oracle.com>, qemu-devel@nongnu.org
Cc: Yi Liu <yi.l.liu@intel.com>,
	Zhenzhong Duan <zhenzhong.duan@intel.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 v6 9/9] vfio/common: Allow disabling device dirty page tracking
Date: Tue, 23 Jul 2024 12:11:46 +0200	[thread overview]
Message-ID: <56733016-7b46-420c-ac76-fa9038d42e9d@redhat.com> (raw)
In-Reply-To: <e24b17fe-d1c1-44a2-b6b0-64e7ddccb9b9@oracle.com>



On 7/23/24 10:42, Joao Martins wrote:
> On 23/07/2024 09:31, Eric Auger wrote:
>>
>> On 7/22/24 23:13, Joao Martins wrote:
>>> The property 'x-pre-copy-dirty-page-tracking' allows disabling the whole
>>> tracking of VF pre-copy phase of dirty page tracking, though it means
>>> that it will only be used at the start of the switchover phase.
>>>
>>> Add an option that disables the VF dirty page tracking, and fall
>>> back into container-based dirty page tracking. This also allows to
>>> use IOMMU dirty tracking even on VFs with their own dirty
>>> tracker scheme.
>> Forced ON value isn't really meaningful though. I mean only valid values
>> are AUTO and OFF, correct?
>>
> It's more like 'on' if supported.
>
> You could argue that AUTO_AUTO is the right value considering that device may or
> may not support. But really both AUTO/ON are the same as the property that
> outlines device dirty tracking is ::dirty_tracking for the VF which is
> eventually seeded from VFIO pci feature. So this is mostly to override the
> default and hence AUTO_OFF is the only thing that it's tested against in the
> various places.
>
> Me picking AUTO_ON just mirrored how it's already done for
> x-pre-copy-dirty-page-tracking (and I see used e.g. kernel_irqchip and others)

OK

Thanks

Eric
>
>> Eric
>>> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
>>> ---
>>>  include/hw/vfio/vfio-common.h | 1 +
>>>  hw/vfio/common.c              | 3 +++
>>>  hw/vfio/migration.c           | 4 +++-
>>>  hw/vfio/pci.c                 | 3 +++
>>>  4 files changed, 10 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
>>> index 1e02c98b09ba..fed499b199f0 100644
>>> --- a/include/hw/vfio/vfio-common.h
>>> +++ b/include/hw/vfio/vfio-common.h
>>> @@ -138,6 +138,7 @@ typedef struct VFIODevice {
>>>      VFIOMigration *migration;
>>>      Error *migration_blocker;
>>>      OnOffAuto pre_copy_dirty_page_tracking;
>>> +    OnOffAuto device_dirty_page_tracking;
>>>      bool dirty_pages_supported;
>>>      bool dirty_tracking;
>>>      bool iommu_dirty_tracking;
>>> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
>>> index da12cbd56408..36d0cf6585b2 100644
>>> --- a/hw/vfio/common.c
>>> +++ b/hw/vfio/common.c
>>> @@ -199,6 +199,9 @@ bool vfio_devices_all_device_dirty_tracking(const VFIOContainerBase *bcontainer)
>>>      VFIODevice *vbasedev;
>>>  
>>>      QLIST_FOREACH(vbasedev, &bcontainer->device_list, container_next) {
>>> +        if (vbasedev->device_dirty_page_tracking == ON_OFF_AUTO_OFF) {
>>> +            return false;
>>> +        }
>>>          if (!vbasedev->dirty_pages_supported) {
>>>              return false;
>>>          }
>>> diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
>>> index cbfaef7afffe..262d42a46e58 100644
>>> --- a/hw/vfio/migration.c
>>> +++ b/hw/vfio/migration.c
>>> @@ -1036,7 +1036,9 @@ bool vfio_migration_realize(VFIODevice *vbasedev, Error **errp)
>>>          return !vfio_block_migration(vbasedev, err, errp);
>>>      }
>>>  
>>> -    if (!vbasedev->dirty_pages_supported && !vbasedev->iommu_dirty_tracking) {
>>> +    if ((!vbasedev->dirty_pages_supported ||
>>> +         vbasedev->device_dirty_page_tracking == ON_OFF_AUTO_OFF) &&
>>> +        !vbasedev->iommu_dirty_tracking) {
>>>          if (vbasedev->enable_migration == ON_OFF_AUTO_AUTO) {
>>>              error_setg(&err,
>>>                         "%s: VFIO device doesn't support device and "
>>> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
>>> index 8c0f212a163e..a0767de54b8d 100644
>>> --- a/hw/vfio/pci.c
>>> +++ b/hw/vfio/pci.c
>>> @@ -3364,6 +3364,9 @@ static Property vfio_pci_dev_properties[] = {
>>>      DEFINE_PROP_ON_OFF_AUTO("x-pre-copy-dirty-page-tracking", VFIOPCIDevice,
>>>                              vbasedev.pre_copy_dirty_page_tracking,
>>>                              ON_OFF_AUTO_ON),
>>> +    DEFINE_PROP_ON_OFF_AUTO("x-device-dirty-page-tracking", VFIOPCIDevice,
>>> +                            vbasedev.device_dirty_page_tracking,
>>> +                            ON_OFF_AUTO_ON),
>>>      DEFINE_PROP_ON_OFF_AUTO("display", VFIOPCIDevice,
>>>                              display, ON_OFF_AUTO_OFF),
>>>      DEFINE_PROP_UINT32("xres", VFIOPCIDevice, display_xres, 0),



  reply	other threads:[~2024-07-23 10:12 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-22 21:13 [PATCH v6 0/9] hw/iommufd: IOMMUFD Dirty Tracking Joao Martins
2024-07-22 21:13 ` [PATCH v6 1/9] vfio/iommufd: Introduce auto domain creation Joao Martins
2024-07-23  4:38   ` Duan, Zhenzhong
2024-07-23  6:57     ` Cédric Le Goater
2024-07-23  7:18   ` Eric Auger
2024-07-22 21:13 ` [PATCH v6 2/9] vfio/{iommufd,container}: Remove caps::aw_bits Joao Martins
2024-07-23  7:21   ` Eric Auger
2024-07-22 21:13 ` [PATCH v6 3/9] vfio/iommufd: Add hw_caps field to HostIOMMUDeviceCaps Joao Martins
2024-07-23  5:11   ` Duan, Zhenzhong
2024-07-23  7:26   ` Eric Auger
2024-07-22 21:13 ` [PATCH v6 4/9] vfio/{iommufd, container}: Invoke HostIOMMUDevice::realize() during attach_device() Joao Martins via
2024-07-23  7:38   ` [PATCH v6 4/9] vfio/{iommufd,container}: " Eric Auger
2024-07-23  7:44     ` Cédric Le Goater
2024-07-23  7:55       ` Eric Auger
2024-07-23  8:05         ` Joao Martins
2024-07-23  8:08           ` Cédric Le Goater
2024-07-23  8:10           ` Eric Auger
2024-07-23  8:20           ` Duan, Zhenzhong
2024-07-23  8:24             ` Eric Auger
2024-07-23  8:26               ` Joao Martins
2024-07-23  7:53     ` Joao Martins
2024-07-23  8:00       ` Cédric Le Goater
2024-07-22 21:13 ` [PATCH v6 5/9] vfio/iommufd: Probe and request hwpt dirty tracking capability Joao Martins
2024-07-23  5:11   ` Duan, Zhenzhong
2024-07-23  6:13     ` Joao Martins
2024-07-23  6:57       ` Cédric Le Goater
2024-07-23  7:02         ` Duan, Zhenzhong
2024-07-23  7:50   ` Eric Auger
2024-07-23  8:00     ` Joao Martins
2024-07-23  8:09       ` Eric Auger
2024-07-23  8:17         ` Joao Martins
2024-07-23 11:59         ` Jason Gunthorpe
2024-07-22 21:13 ` [PATCH v6 6/9] vfio/iommufd: Implement VFIOIOMMUClass::set_dirty_tracking support Joao Martins
2024-07-23  8:03   ` Eric Auger
2024-07-23  8:14     ` Joao Martins
2024-07-23  8:17       ` Eric Auger
2024-07-22 21:13 ` [PATCH v6 7/9] vfio/iommufd: Implement VFIOIOMMUClass::query_dirty_bitmap support Joao Martins
2024-07-22 21:13 ` [PATCH v6 8/9] vfio/migration: Don't block migration device dirty tracking is unsupported Joao Martins
2024-07-23  4:45   ` Duan, Zhenzhong
2024-07-23  8:22   ` Eric Auger
2024-07-22 21:13 ` [PATCH v6 9/9] vfio/common: Allow disabling device dirty page tracking Joao Martins
2024-07-23  5:05   ` Duan, Zhenzhong
2024-07-23  8:31   ` Eric Auger
2024-07-23  8:42     ` Joao Martins
2024-07-23 10:11       ` Eric Auger [this message]
2024-07-23  8:35 ` [PATCH v6 0/9] hw/iommufd: IOMMUFD Dirty Tracking Cédric Le Goater
2024-07-23  8:56   ` Joao Martins
2024-07-23  9:08     ` Cédric Le Goater
2024-07-23 14:23 ` Yi Liu
2024-07-23 14:21   ` Joao Martins
2024-07-23 14:24   ` Cédric Le Goater

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=56733016-7b46-420c-ac76-fa9038d42e9d@redhat.com \
    --to=eric.auger@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=avihaih@nvidia.com \
    --cc=clg@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=joao.m.martins@oracle.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).