From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: kvm@vger.kernel.org, iommu@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, joro@8bytes.org, jroedel@suse.de
Subject: Re: [PATCH v3] vfio/type1: Adopt fast IOTLB flush interface when unmap IOVAs
Date: Wed, 24 Jan 2018 17:00:18 +0700 [thread overview]
Message-ID: <abb9f471-9a77-85f7-4afb-a46b86f4e11a@amd.com> (raw)
In-Reply-To: <20180123150452.03a42c53@w520.home>
Alex / Joerg,
On 1/24/18 5:04 AM, Alex Williamson wrote:
>> @@ -648,12 +685,40 @@ static int vfio_iommu_type1_unpin_pages(void *iommu_data,
>> return i > npage ? npage : (i > 0 ? i : -EINVAL);
>> }
>>
>> +static size_t try_unmap_unpin_fast(struct vfio_domain *domain, dma_addr_t iova,
>> + size_t len, phys_addr_t phys,
>> + struct list_head *unmapped_regions)
>> +{
>> + struct vfio_regions *entry;
>> + size_t unmapped;
>> +
>> + entry = kzalloc(sizeof(*entry), GFP_KERNEL);
>> + if (!entry)
>> + return -ENOMEM;
>> +
>> + unmapped = iommu_unmap_fast(domain->domain, iova, len);
>> + if (WARN_ON(!unmapped)) {
>> + kfree(entry);
>> + return -EINVAL;
>> + }
> Not sure about the handling of this, the zero check is just a
> consistency validation. If there's nothing mapped where we think there
> should be something mapped, we warn and throw out the whole vfio_dma.
> After this patch, such an error gets warned twice, which doesn't
> really seem to be an improvement.
>
Since iommu_unmap() and iommu_unmap_fast() can return errors, instead of just zero check,
we should also check for errors, warn, and bail out the whole vfio_dma.
Thanks,
Suravee
prev parent reply other threads:[~2018-01-24 10:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-22 4:29 [PATCH v3] vfio/type1: Adopt fast IOTLB flush interface when unmap IOVAs Suravee Suthikulpanit
2018-01-23 22:04 ` Alex Williamson
2018-01-24 4:38 ` Suravee Suthikulpanit
2018-01-24 10:00 ` Suravee Suthikulpanit [this message]
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=abb9f471-9a77-85f7-4afb-a46b86f4e11a@amd.com \
--to=suravee.suthikulpanit@amd.com \
--cc=alex.williamson@redhat.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=jroedel@suse.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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).