netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Brett Creeley <bcreeley@amd.com>
Cc: Brett Creeley <brett.creeley@amd.com>,
	kvm@vger.kernel.org, netdev@vger.kernel.org, jgg@nvidia.com,
	yishaih@nvidia.com, shameerali.kolothum.thodi@huawei.com,
	kevin.tian@intel.com, horms@kernel.org, shannon.nelson@amd.com
Subject: Re: [PATCH v14 vfio 6/8] vfio/pds: Add support for dirty page tracking
Date: Wed, 9 Aug 2023 11:33:00 -0600	[thread overview]
Message-ID: <20230809113300.2c4b0888.alex.williamson@redhat.com> (raw)
In-Reply-To: <01a8ee12-7a95-7245-3a00-2745aa846fca@amd.com>

On Wed, 9 Aug 2023 08:44:44 -0700
Brett Creeley <bcreeley@amd.com> wrote:

> On 8/8/2023 3:27 PM, Alex Williamson wrote:
> > Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> > 
> > 
> > On Mon, 7 Aug 2023 13:57:53 -0700
> > Brett Creeley <brett.creeley@amd.com> wrote:
> > ...  
> >> +static int pds_vfio_dirty_enable(struct pds_vfio_pci_device *pds_vfio,
> >> +                              struct rb_root_cached *ranges, u32 nnodes,
> >> +                              u64 *page_size)
> >> +{
> >> +     struct pci_dev *pdev = pds_vfio->vfio_coredev.pdev;
> >> +     struct device *pdsc_dev = &pci_physfn(pdev)->dev;
> >> +     struct pds_vfio_dirty *dirty = &pds_vfio->dirty;
> >> +     u64 region_start, region_size, region_page_size;
> >> +     struct pds_lm_dirty_region_info *region_info;
> >> +     struct interval_tree_node *node = NULL;
> >> +     u8 max_regions = 0, num_regions;
> >> +     dma_addr_t regions_dma = 0;
> >> +     u32 num_ranges = nnodes;
> >> +     u32 page_count;
> >> +     u16 len;
> >> +     int err;
> >> +
> >> +     dev_dbg(&pdev->dev, "vf%u: Start dirty page tracking\n",
> >> +             pds_vfio->vf_id);
> >> +
> >> +     if (pds_vfio_dirty_is_enabled(pds_vfio))
> >> +             return -EINVAL;
> >> +
> >> +     /* find if dirty tracking is disabled, i.e. num_regions == 0 */
> >> +     err = pds_vfio_dirty_status_cmd(pds_vfio, 0, &max_regions,
> >> +                                     &num_regions);
> >> +     if (err < 0) {
> >> +             dev_err(&pdev->dev, "Failed to get dirty status, err %pe\n",
> >> +                     ERR_PTR(err));
> >> +             return err;
> >> +     } else if (num_regions) {
> >> +             dev_err(&pdev->dev,
> >> +                     "Dirty tracking already enabled for %d regions\n",
> >> +                     num_regions);
> >> +             return -EEXIST;
> >> +     } else if (!max_regions) {
> >> +             dev_err(&pdev->dev,
> >> +                     "Device doesn't support dirty tracking, max_regions %d\n",
> >> +                     max_regions);
> >> +             return -EOPNOTSUPP;
> >> +     }
> >> +
> >> +     /*
> >> +      * Only support 1 region for now. If there are any large gaps in the
> >> +      * VM's address regions, then this would be a waste of memory as we are
> >> +      * generating 2 bitmaps (ack/seq) from the min address to the max
> >> +      * address of the VM's address regions. In the future, if we support
> >> +      * more than one region in the device/driver we can split the bitmaps
> >> +      * on the largest address region gaps. We can do this split up to the
> >> +      * max_regions times returned from the dirty_status command.
> >> +      */  
> > 
> > Isn't this a pretty unfortunately limitation given QEMU makes a 1TB
> > hole on AMD hosts?  Or maybe I misunderstand.
> > 
> > https://gitlab.com/qemu-project/qemu/-/commit/8504f129450b909c88e199ca44facd35d38ba4de
> > 
> > Thanks,
> > Alex
> >   
> 
> Yes, this is currently an unfortunate limitation. However, our device is 
> flexible enough to support >1 regions. There has been some work in this 
> area, but we aren't quite there yet. The goal was to get this initial 
> support accepted and submit follow on work to support >1 regions.

Ok, good that this is temporary.

Shameer, Kevin, Jason, Yishai, I'm hoping one or more of you can
approve this series as well.  Thanks,

Alex


  reply	other threads:[~2023-08-09 17:33 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07 20:57 [PATCH v14 vfio 0/8] pds-vfio-pci driver Brett Creeley
2023-08-07 20:57 ` [PATCH v14 vfio 1/8] vfio: Commonize combine_ranges for use in other VFIO drivers Brett Creeley
2023-08-07 20:57 ` [PATCH v14 vfio 2/8] vfio/pds: Initial support for pds VFIO driver Brett Creeley
2023-08-07 20:57 ` [PATCH v14 vfio 3/8] pds_core: Require callers of register/unregister to pass PF drvdata Brett Creeley
2023-08-07 20:57 ` [PATCH v14 vfio 4/8] vfio/pds: register with the pds_core PF Brett Creeley
2023-08-07 20:57 ` [PATCH v14 vfio 5/8] vfio/pds: Add VFIO live migration support Brett Creeley
2023-08-08 22:27   ` Alex Williamson
2023-08-09 15:44     ` Brett Creeley
2023-08-07 20:57 ` [PATCH v14 vfio 6/8] vfio/pds: Add support for dirty page tracking Brett Creeley
2023-08-08 22:27   ` Alex Williamson
2023-08-09 15:44     ` Brett Creeley
2023-08-09 17:33       ` Alex Williamson [this message]
2023-08-09 18:06         ` Jason Gunthorpe
2023-08-10  2:47           ` Tian, Kevin
2023-08-10 16:47             ` Alex Williamson
2023-08-10 17:19               ` Jason Gunthorpe
2023-08-10 17:40                 ` Alex Williamson
2023-08-10 17:43                   ` Jason Gunthorpe
2023-08-10 17:54                     ` Alex Williamson
2023-08-10 18:11                       ` Jason Gunthorpe
2023-08-11  3:25                         ` Tian, Kevin
2023-08-14 18:41                           ` Brett Creeley
2023-08-15  2:45                             ` Tian, Kevin
2023-08-11 15:53                         ` Alex Williamson
2023-08-12 10:49                 ` Christoph Hellwig
2023-08-14 22:51                   ` Brett Creeley
2023-08-07 20:57 ` [PATCH v14 vfio 7/8] vfio/pds: Add support for firmware recovery Brett Creeley
2023-08-07 20:57 ` [PATCH v14 vfio 8/8] vfio/pds: Add Kconfig and documentation Brett Creeley
2023-08-10  8:32 ` [PATCH v14 vfio 0/8] pds-vfio-pci driver Shameerali Kolothum Thodi
2023-08-15  2:47 ` Tian, Kevin
2023-08-17 17:53 ` Alex Williamson

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=20230809113300.2c4b0888.alex.williamson@redhat.com \
    --to=alex.williamson@redhat.com \
    --cc=bcreeley@amd.com \
    --cc=brett.creeley@amd.com \
    --cc=horms@kernel.org \
    --cc=jgg@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=shannon.nelson@amd.com \
    --cc=yishaih@nvidia.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).