From: Joao Martins <joao.m.martins@oracle.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: kvm@vger.kernel.org, Alex Williamson <alex.williamson@redhat.com>,
Cornelia Huck <cohuck@redhat.com>,
Avihai Horon <avihaih@nvidia.com>,
Yishai Hadas <yishaih@nvidia.com>
Subject: Re: [PATCH v1 2/2] vfio/iova_bitmap: Fix PAGE_SIZE unaligned bitmaps
Date: Fri, 25 Nov 2022 14:31:12 +0000 [thread overview]
Message-ID: <295d7cf1-ee02-90e9-b271-f53a9ea85bb8@oracle.com> (raw)
In-Reply-To: <Y4C4ITz7oCFBmjWi@ziepe.ca>
On 25/11/2022 12:42, Jason Gunthorpe wrote:
> On Fri, Nov 25, 2022 at 10:37:39AM +0000, Joao Martins wrote:
>
>>> Yes, when we move this to iommufd the test suite should be included,
>>> either as integrated using the mock domain and the selftests or
>>> otherwise.
>>
>> So in iommufd counterpart I have already tests which exercise this. But not as
>> extensive.
>
> We are getting to the point where we should start posting the iommufd
> dirty tracking stuff. Do you have time to work on it for the next
> cycle? Meaning get it largely sorted out in the next 3 weeks for review?
>
I'll post it for the next cycle -- It has been a bit on crazy on my end this
past month or so.
>>> void iova_bitmap_set(struct iova_bitmap *bitmap,
>>> unsigned long iova, size_t length)
>>> {
>>> struct iova_bitmap_map *mapped = &bitmap->mapped;
>>> unsigned cur_bit =
>>> ((iova - mapped->iova) >> mapped->pgshift) + mapped->pgoff * 8;
>>> unsigned long last_bit =
>>> (((iova + length - 1) - mapped->iova) >> mapped->pgshift) +
>>> mapped->pgoff * 8;
>>>
>>> do {
>>> unsigned int page_idx = cur_bit / BITS_PER_PAGE;
>>> unsigned int nbits =
>>> min(BITS_PER_PAGE - cur_bit, last_bit - cur_bit + 1);
>
> min(BITS_PER_PAGE - (cur_bit % BITS_PER_PAGE), ...)
>
I actually had this already in my changeset :) as the earlier snip wasn't
passing my tests. Plus I need to account for less indexes with pgoff, contrary
to what I said earlier in the remaining() function calculation.
>> Not sure if the vfio tree is a rebasing tree (or not?) and can just send a new
>> version,
>
> It isn't, you should just post a new patch on top of Alex's current
> tree "rework iova_bitmap_et to handle all page crossings" and along
> the way revert the first bit
OK -- makes sense. The other fix wasn't incorrect either (as we need to account
for pgoff on the same function), this one though fixes the real issue of
iova_bitmap_set().
Also, I'll add your Signed-off-by+Co-developed-by -- let me know otherwise if I
should not.
Joao
next prev parent reply other threads:[~2022-11-25 14:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-25 19:31 [PATCH v1 0/2] vfio/iova_bitmap: bug fixes Joao Martins
2022-10-25 19:31 ` [PATCH v1 1/2] vfio/iova_bitmap: Explicitly include linux/slab.h Joao Martins
2022-10-25 19:31 ` [PATCH v1 2/2] vfio/iova_bitmap: Fix PAGE_SIZE unaligned bitmaps Joao Martins
2022-11-24 18:20 ` Jason Gunthorpe
2022-11-25 10:37 ` Joao Martins
2022-11-25 12:42 ` Jason Gunthorpe
2022-11-25 14:31 ` Joao Martins [this message]
2022-11-09 20:09 ` [PATCH v1 0/2] vfio/iova_bitmap: bug fixes Joao Martins
2022-11-10 20:16 ` 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=295d7cf1-ee02-90e9-b271-f53a9ea85bb8@oracle.com \
--to=joao.m.martins@oracle.com \
--cc=alex.williamson@redhat.com \
--cc=avihaih@nvidia.com \
--cc=cohuck@redhat.com \
--cc=jgg@ziepe.ca \
--cc=kvm@vger.kernel.org \
--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.