From: Jason Gunthorpe <jgg@nvidia.com>
To: Brett Creeley <brett.creeley@amd.com>
Cc: kvm@vger.kernel.org, netdev@vger.kernel.org,
alex.williamson@redhat.com, yishaih@nvidia.com,
shameerali.kolothum.thodi@huawei.com, kevin.tian@intel.com,
shannon.nelson@amd.com, drivers@pensando.io
Subject: Re: [PATCH v9 vfio 5/7] vfio/pds: Add support for dirty page tracking
Date: Thu, 4 May 2023 15:21:20 -0300 [thread overview]
Message-ID: <ZFP3oAFNoKNCv46R@nvidia.com> (raw)
In-Reply-To: <20230422010642.60720-6-brett.creeley@amd.com>
On Fri, Apr 21, 2023 at 06:06:40PM -0700, Brett Creeley wrote:
> +int
> +pds_vfio_dirty_status_cmd(struct pds_vfio_pci_device *pds_vfio,
> + u64 regions_dma, u8 *max_regions,
> + u8 *num_regions)
> +{
> + union pds_core_adminq_cmd cmd = {
> + .lm_dirty_status.opcode = PDS_LM_CMD_DIRTY_STATUS,
> + .lm_dirty_status.vf_id = cpu_to_le16(pds_vfio->vf_id),
> + };
You can write these as
.lm_dirty_status = {
.opcode = ..,
.vf_if = ..,
},
And save some stuttering
> +static int
> +pds_vfio_dirty_alloc_bitmaps(struct pds_vfio_dirty *dirty,
> + u32 nbits)
> +{
> + unsigned long *host_seq_bmp, *host_ack_bmp;
> +
> + host_seq_bmp = bitmap_zalloc(nbits, GFP_KERNEL);
> + if (!host_seq_bmp)
> + return -ENOMEM;
> +
> + host_ack_bmp = bitmap_zalloc(nbits, GFP_KERNEL);
> + if (!host_ack_bmp) {
> + bitmap_free(host_seq_bmp);
> + return -ENOMEM;
> + }
nbits looks way too big to call bitmap_zalloc?
> +static int
> +__pds_vfio_dirty_alloc_sgl(struct pds_vfio_pci_device *pds_vfio,
> + struct pds_vfio_bmp_info *bmp_info,
> + u32 page_count)
> +{
> + struct pci_dev *pdev = pds_vfio->vfio_coredev.pdev;
> + struct device *pdsc_dev = &pci_physfn(pdev)->dev;
> + struct pds_lm_sg_elem *sgl;
> + dma_addr_t sgl_addr;
> + size_t sgl_size;
> + u32 max_sge;
> +
> + max_sge = DIV_ROUND_UP(page_count, PAGE_SIZE * 8);
> + sgl_size = max_sge * sizeof(struct pds_lm_sg_elem);
> +
> + sgl = kzalloc(sgl_size, GFP_KERNEL);
> + if (!sgl)
> + return -ENOMEM;
> +
> + sgl_addr = dma_map_single(pdsc_dev, sgl, sgl_size, DMA_TO_DEVICE);
This needs to use the streaming API in pds_vfio_dirty_seq_ack()
Jason
next prev parent reply other threads:[~2023-05-04 18:21 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-22 1:06 [PATCH v9 vfio 0/7] pds_vfio driver Brett Creeley
2023-04-22 1:06 ` [PATCH v9 vfio 1/7] vfio: Commonize combine_ranges for use in other VFIO drivers Brett Creeley
2023-04-22 1:06 ` [PATCH v9 vfio 2/7] vfio/pds: Initial support for pds_vfio VFIO driver Brett Creeley
2023-05-04 17:26 ` Jason Gunthorpe
2023-05-04 20:20 ` Jakub Kicinski
2023-05-04 22:41 ` Jason Gunthorpe
2023-05-04 23:40 ` Jakub Kicinski
2023-05-05 13:29 ` Jason Gunthorpe
2023-05-05 15:35 ` Brett Creeley
2023-05-04 17:31 ` Jason Gunthorpe
2023-05-05 15:36 ` Brett Creeley
2023-06-02 22:05 ` Brett Creeley
2023-04-22 1:06 ` [PATCH v9 vfio 3/7] vfio/pds: register with the pds_core PF Brett Creeley
2023-04-22 1:06 ` [PATCH v9 vfio 4/7] vfio/pds: Add VFIO live migration support Brett Creeley
2023-05-04 17:34 ` Jason Gunthorpe
2023-05-05 15:37 ` Brett Creeley
2023-05-04 17:40 ` Jason Gunthorpe
2023-05-05 15:39 ` Brett Creeley
2023-05-04 17:50 ` Jason Gunthorpe
2023-05-05 15:42 ` Brett Creeley
2023-04-22 1:06 ` [PATCH v9 vfio 5/7] vfio/pds: Add support for dirty page tracking Brett Creeley
2023-05-04 18:21 ` Jason Gunthorpe [this message]
2023-04-22 1:06 ` [PATCH v9 vfio 6/7] vfio/pds: Add support for firmware recovery Brett Creeley
2023-04-22 1:06 ` [PATCH v9 vfio 7/7] vfio/pds: Add Kconfig and documentation Brett Creeley
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=ZFP3oAFNoKNCv46R@nvidia.com \
--to=jgg@nvidia.com \
--cc=alex.williamson@redhat.com \
--cc=brett.creeley@amd.com \
--cc=drivers@pensando.io \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.