From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
"iommu@lists.linux-foundation.org"
<iommu@lists.linux-foundation.org>
Subject: RE: How to resolve an issue in swiotlb environment?
Date: Fri, 7 Jun 2019 12:00:26 +0000 [thread overview]
Message-ID: <OSAPR01MB3089D50DBDAA6C7D427E72EED8100@OSAPR01MB3089.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <OSAPR01MB3089B381AF2F687526E63EEAD8140@OSAPR01MB3089.jpnprd01.prod.outlook.com>
Hi Christoph,
I think we should continue to discuss on this email thread instead of the fixed DMA-API.txt patch [1]
[1]
https://marc.info/?t=155989412200001&r=1&w=2
> From: Yoshihiro Shimoda, Sent: Monday, June 3, 2019 3:42 PM
>
> Hi linux-block and iommu mailing lists,
>
> I have an issue that a USB SSD with xHCI on R-Car H3 causes "swiotlb is full" like below.
>
> [ 36.745286] xhci-hcd ee000000.usb: swiotlb buffer is full (sz: 524288 bytes), total 32768 (slots), used 1338 (slots)
>
> I have investigated this issue by using git bisect, and then I found the following commit:
>
> ---
> commit 09324d32d2a0843e66652a087da6f77924358e62
> Author: Christoph Hellwig <hch@lst.de>
> Date: Tue May 21 09:01:41 2019 +0200
>
> block: force an unlimited segment size on queues with a virt boundary
> ---
Thank you for your comment on other email thread [2] like below:
---
Turns out it isn't as simple as I thought, as there doesn't seem to
be an easy way to get to the struct device used for DMA mapping
from USB drivers. I'll need to think a bit more how to handle that
best.
---
[2]
https://marc.info/?l=linux-doc&m=155989651620473&w=2
I'm not sure this is a correct way, but the issue disappears if I applied a patch below
to USB storage driver. Especially, WARNING happened on blk_queue_max_segment_size().
Maybe we need to expand the argument "struct device *" of blk_queue_virt_boundary() to
call dma_max_mapping_size()?
---
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 59190d8..fa37b39 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -28,6 +28,7 @@
* status of a command.
*/
+#include <linux/dma-mapping.h>
#include <linux/module.h>
#include <linux/mutex.h>
@@ -83,6 +84,15 @@ static int slave_alloc (struct scsi_device *sdev)
maxp = usb_maxpacket(us->pusb_dev, us->recv_bulk_pipe, 0);
blk_queue_virt_boundary(sdev->request_queue, maxp - 1);
+{
+ struct device *dev = us->pusb_dev->bus->controller;
+
+ dev_info(dev, "%s: size = %zu\n", __func__, dma_max_mapping_size(dev));
+ blk_queue_max_segment_size(sdev->request_queue,
+ dma_max_mapping_size(dev));
+}
+
+
/*
* Some host controllers may have alignment requirements.
* We'll play it safe by requiring 512-byte alignment always.
---
Best regards,
Yoshihiro Shimoda
next prev parent reply other threads:[~2019-06-07 12:00 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-03 6:42 How to resolve an issue in swiotlb environment? Yoshihiro Shimoda
2019-06-07 12:00 ` Yoshihiro Shimoda [this message]
2019-06-10 7:31 ` Biju Das
2019-06-10 11:13 ` Yoshihiro Shimoda
2019-06-10 12:32 ` Christoph Hellwig
2019-06-10 18:46 ` Alan Stern
2019-06-11 6:41 ` Christoph Hellwig
2019-06-11 14:51 ` Alan Stern
2019-06-12 7:30 ` Christoph Hellwig
2019-06-12 8:52 ` Yoshihiro Shimoda
2019-06-12 11:31 ` Christoph Hellwig
2019-06-13 4:52 ` Yoshihiro Shimoda
2019-06-12 11:46 ` Oliver Neukum
2019-06-12 12:06 ` Christoph Hellwig
2019-06-12 14:43 ` Alan Stern
2019-06-13 7:39 ` Christoph Hellwig
2019-06-13 16:57 ` Martin K. Petersen
2019-06-13 17:16 ` Alan Stern
2019-06-13 18:18 ` Greg KH
2019-06-13 23:01 ` shuah
2019-06-14 14:44 ` Alan Stern
2019-06-18 15:28 ` shuah
2019-06-19 20:23 ` shuah
2019-06-19 21:05 ` Alan Stern
2019-06-21 17:43 ` Suwan Kim
2019-06-11 6:49 ` Yoshihiro Shimoda
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=OSAPR01MB3089D50DBDAA6C7D427E72EED8100@OSAPR01MB3089.jpnprd01.prod.outlook.com \
--to=yoshihiro.shimoda.uh@renesas.com \
--cc=hch@lst.de \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-renesas-soc@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).