From: Lu Baolu <baolu.lu@linux.intel.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: alan.cox@intel.com, Christoph Hellwig <hch@lst.de>,
Stefano Stabellini <sstabellini@kernel.org>,
ashok.raj@intel.com, Jonathan Corbet <corbet@lwn.net>,
pengfei.xu@intel.com, Ingo Molnar <mingo@redhat.com>,
David Woodhouse <dwmw2@infradead.org>,
kevin.tian@intel.com, Steven Rostedt <rostedt@goodmis.org>,
Bjorn Helgaas <bhelgaas@google.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
mika.westerberg@linux.intel.com, Juergen Gross <jgross@suse.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
jacob.jun.pan@intel.com, Robin Murphy <robin.murphy@arm.com>
Subject: Re: [PATCH v9 1/5] swiotlb: Split size parameter to map/unmap APIs
Date: Wed, 11 Sep 2019 14:16:07 +0800 [thread overview]
Message-ID: <0b939480-cb99-46fe-374e-a31441d21486@linux.intel.com> (raw)
In-Reply-To: <20190910151544.GA7585@char.us.oracle.com>
Hi,
On 9/10/19 11:15 PM, Konrad Rzeszutek Wilk wrote:
> On Fri, Sep 06, 2019 at 02:14:48PM +0800, Lu Baolu wrote:
>> This splits the size parameter to swiotlb_tbl_map_single() and
>> swiotlb_tbl_unmap_single() into an alloc_size and a mapping_size
>> parameter, where the latter one is rounded up to the iommu page
>> size.
> It does a bit more too. You have the WARN_ON. Can you make it be
> more verbose (as in details of which device requested it) and also use printk_once or so please?
How about this change?
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 89066efa3840..22a7848caca3 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -466,8 +466,11 @@ phys_addr_t swiotlb_tbl_map_single(struct device
*hwdev,
pr_warn_once("%s is active and system is using DMA
bounce buffers\n",
sme_active() ? "SME" : "SEV");
- if (WARN_ON(mapping_size > alloc_size))
+ if (mapping_size > alloc_size) {
+ dev_warn_once(hwdev, "Invalid sizes (mapping: %zd bytes,
alloc: %zd bytes)",
+ mapping_size, alloc_size);
return (phys_addr_t)DMA_MAPPING_ERROR;
+ }
mask = dma_get_seg_boundary(hwdev);
@@ -584,9 +587,6 @@ void swiotlb_tbl_unmap_single(struct device *hwdev,
phys_addr_t tlb_addr,
int index = (tlb_addr - io_tlb_start) >> IO_TLB_SHIFT;
phys_addr_t orig_addr = io_tlb_orig_addr[index];
- if (WARN_ON(mapping_size > alloc_size))
- return;
-
/*
* First, sync the memory before unmapping the entry
*/
Best regards,
Baolu
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2019-09-11 6:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-06 6:14 [PATCH v9 0/5] iommu: Bounce page for untrusted devices Lu Baolu
2019-09-06 6:14 ` [PATCH v9 1/5] swiotlb: Split size parameter to map/unmap APIs Lu Baolu
2019-09-10 15:15 ` Konrad Rzeszutek Wilk
2019-09-11 6:16 ` Lu Baolu [this message]
2019-09-11 10:35 ` Joerg Roedel
2019-09-06 6:14 ` [PATCH v9 2/5] iommu/vt-d: Check whether device requires bounce buffer Lu Baolu
2019-09-06 6:14 ` [PATCH v9 3/5] iommu/vt-d: Don't switch off swiotlb if bounce page is used Lu Baolu
2019-09-06 6:14 ` [PATCH v9 4/5] iommu/vt-d: Add trace events for device dma map/unmap Lu Baolu
2019-09-06 6:14 ` [PATCH v9 5/5] iommu/vt-d: Use bounce buffer for untrusted devices Lu Baolu
2019-09-10 14:53 ` [PATCH v9 0/5] iommu: Bounce page " Joerg Roedel
2019-09-10 15:21 ` Konrad Rzeszutek Wilk
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=0b939480-cb99-46fe-374e-a31441d21486@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=alan.cox@intel.com \
--cc=ashok.raj@intel.com \
--cc=bhelgaas@google.com \
--cc=boris.ostrovsky@oracle.com \
--cc=corbet@lwn.net \
--cc=dwmw2@infradead.org \
--cc=gregkh@linuxfoundation.org \
--cc=hch@lst.de \
--cc=iommu@lists.linux-foundation.org \
--cc=jacob.jun.pan@intel.com \
--cc=jgross@suse.com \
--cc=kevin.tian@intel.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=mingo@redhat.com \
--cc=pengfei.xu@intel.com \
--cc=robin.murphy@arm.com \
--cc=rostedt@goodmis.org \
--cc=sstabellini@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).