Re: [PATCH v3 07/19] iommufd: Dirty tracking data support

Joao Martins
2023-10-17T17:31:09Z

On 17/10/2023 18:13, Jason Gunthorpe wrote:
> On Tue, Oct 17, 2023 at 05:51:49PM +0100, Joao Martins wrote:
>
>> Perhaps that could be rewritten as e.g.
>>
>> ret = -EINVAL;
>> iopt_for_each_contig_area(&iter, area, iopt, iova, last_iova) {
>> // do iommu_read_and_clear_dirty();
>> }
>>
>> // else fail.
>>
>> Though OTOH, the places you wrote as to fail are skipped instead.
>
> Yeah, if consolidating the areas isn't important (it probably isn't)
> then this is the better API
>

Doing it in a single iommu_read_and_clear_dirty() saves me from manipulating the
bitmap address in an atypical way. Considering that the first bit in each u8 is
the iova we initialize the bitmap, so if I call it in multiple times in a single
IOVA range (in each individual area as I think you suggested) then I need to
align down the iova-length to the minimum granularity of the bitmap, which is an
u8 (32k).

Joao