netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joao Martins <joao.m.martins@oracle.com>
To: Alex Williamson <alex.williamson@redhat.com>,
	Yishai Hadas <yishaih@nvidia.com>
Cc: jgg@nvidia.com, saeedm@nvidia.com, kvm@vger.kernel.org,
	netdev@vger.kernel.org, kuba@kernel.org, kevin.tian@intel.com,
	leonro@nvidia.com, maorg@nvidia.com, cohuck@redhat.com
Subject: Re: [PATCH V4 vfio 05/10] vfio: Introduce the DMA logging feature support
Date: Thu, 25 Aug 2022 23:26:04 +0100	[thread overview]
Message-ID: <8342117f-87ab-d38e-6fcd-aaa947dbeaaf@oracle.com> (raw)
In-Reply-To: <20220825144944.237eb78f.alex.williamson@redhat.com>

On 8/25/22 21:49, Alex Williamson wrote:
> On Mon, 15 Aug 2022 18:11:04 +0300
> Yishai Hadas <yishaih@nvidia.com> wrote:
>> +static int
>> +vfio_ioctl_device_feature_logging_report(struct vfio_device *device,
>> +					 u32 flags, void __user *arg,
>> +					 size_t argsz)
>> +{
>> +	size_t minsz =
>> +		offsetofend(struct vfio_device_feature_dma_logging_report,
>> +			    bitmap);
>> +	struct vfio_device_feature_dma_logging_report report;
>> +	struct iova_bitmap_iter iter;
>> +	int ret;
>> +
>> +	if (!device->log_ops)
>> +		return -ENOTTY;
>> +
>> +	ret = vfio_check_feature(flags, argsz,
>> +				 VFIO_DEVICE_FEATURE_GET,
>> +				 sizeof(report));
>> +	if (ret != 1)
>> +		return ret;
>> +
>> +	if (copy_from_user(&report, arg, minsz))
>> +		return -EFAULT;
>> +
>> +	if (report.page_size < PAGE_SIZE || !is_power_of_2(report.page_size))
> 
> Why is PAGE_SIZE a factor here?  I'm under the impression that
> iova_bitmap is intended to handle arbitrary page sizes.  Thanks,

Arbritary page sizes ... which are powers of 2. We use page shift in iova bitmap.
While it's not hard to lose this restriction (trading a shift over a slower mul)
... I am not sure it is worth supporting said use considering that there aren't
non-powers of 2 page sizes right now?

The PAGE_SIZE restriction might be that it's supposed to be the lowest possible page_size.

> 
> Alex
> 
>> +		return -EINVAL;
>> +
>> +	ret = iova_bitmap_iter_init(&iter, report.iova, report.length,
>> +				    report.page_size,
>> +				    u64_to_user_ptr(report.bitmap));
>> +	if (ret)
>> +		return ret;
>> +
>> +	for (; !iova_bitmap_iter_done(&iter) && !ret;
>> +	     ret = iova_bitmap_iter_advance(&iter)) {
>> +		ret = device->log_ops->log_read_and_clear(device,
>> +			iova_bitmap_iova(&iter),
>> +			iova_bitmap_length(&iter), &iter.dirty);
>> +		if (ret)
>> +			break;
>> +	}
>> +
>> +	iova_bitmap_iter_free(&iter);
>> +	return ret;
>> +}
> 

  reply	other threads:[~2022-08-25 22:27 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-15 15:10 [PATCH V4 vfio 00/10] Add device DMA logging support for mlx5 driver Yishai Hadas
2022-08-15 15:11 ` [PATCH V4 vfio 01/10] net/mlx5: Introduce ifc bits for page tracker Yishai Hadas
2022-08-15 15:11 ` [PATCH V4 vfio 02/10] net/mlx5: Query ADV_VIRTUALIZATION capabilities Yishai Hadas
2022-08-15 15:11 ` [PATCH V4 vfio 03/10] vfio: Introduce DMA logging uAPIs Yishai Hadas
2022-08-15 15:11 ` [PATCH V4 vfio 04/10] vfio: Add an IOVA bitmap support Yishai Hadas
2022-08-25 19:27   ` Alex Williamson
2022-08-25 22:24     ` Joao Martins
2022-08-25 23:15       ` Alex Williamson
2022-08-26  9:37         ` Joao Martins
2022-08-26 12:02           ` Alex Williamson
2022-08-26 12:10             ` Joao Martins
2022-08-26 13:01           ` Jason Gunthorpe
2022-08-26 12:58     ` Jason Gunthorpe
2022-08-15 15:11 ` [PATCH V4 vfio 05/10] vfio: Introduce the DMA logging feature support Yishai Hadas
2022-08-25 20:49   ` Alex Williamson
2022-08-25 22:26     ` Joao Martins [this message]
2022-08-25 22:46       ` Alex Williamson
2022-08-26 12:52         ` Jason Gunthorpe
2022-08-28 13:29           ` Yishai Hadas
2022-08-15 15:11 ` [PATCH V4 vfio 06/10] vfio/mlx5: Init QP based resources for dirty tracking Yishai Hadas
2022-08-15 15:11 ` [PATCH V4 vfio 07/10] vfio/mlx5: Create and destroy page tracker object Yishai Hadas
2022-08-15 15:11 ` [PATCH V4 vfio 08/10] vfio/mlx5: Report dirty pages from tracker Yishai Hadas
2022-08-15 15:11 ` [PATCH V4 vfio 09/10] vfio/mlx5: Manage error scenarios on tracker Yishai Hadas
2022-08-15 15:11 ` [PATCH V4 vfio 10/10] vfio/mlx5: Set the driver DMA logging callbacks Yishai Hadas
2022-08-25 11:13 ` [PATCH V4 vfio 00/10] Add device DMA logging support for mlx5 driver Yishai Hadas
2022-08-25 19:37   ` 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=8342117f-87ab-d38e-6fcd-aaa947dbeaaf@oracle.com \
    --to=joao.m.martins@oracle.com \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=kuba@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=leonro@nvidia.com \
    --cc=maorg@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.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).