From: Joerg Roedel <joro@8bytes.org>
To: Christoph Hellwig <hch@lst.de>
Cc: "Michael S . Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Jens Axboe <axboe@kernel.dk>,
virtualization@lists.linux-foundation.org,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
iommu@lists.linux-foundation.org, jfehlig@suse.com,
jon.grimm@amd.com, brijesh.singh@amd.com, jroedel@suse.de
Subject: Re: [PATCH 5/5] virtio-blk: Consider virtio_max_dma_size() for maximum segment size
Date: Thu, 24 Jan 2019 10:51:51 +0100 [thread overview]
Message-ID: <20190124095150.GL32526@8bytes.org> (raw)
In-Reply-To: <20190124084221.GB19441@lst.de>
On Thu, Jan 24, 2019 at 09:42:21AM +0100, Christoph Hellwig wrote:
> Yes. But more importantly it would fix the limit for all other block
> drivers that set large segment sizes when running over swiotlb.
True, so it would be something like the diff below? I havn't worked on
the block layer, so I don't know if that needs additional checks for
->dev or anything.
diff --git a/block/blk-settings.c b/block/blk-settings.c
index 3e7038e475ee..9a927280c904 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -1,6 +1,7 @@
/*
* Functions related to setting various queue properties from drivers
*/
+#include <linux/dma-mapping.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -303,13 +304,17 @@ EXPORT_SYMBOL_GPL(blk_queue_max_discard_segments);
**/
void blk_queue_max_segment_size(struct request_queue *q, unsigned int max_size)
{
+ unsigned int dma_max_size;
+
if (max_size < PAGE_SIZE) {
max_size = PAGE_SIZE;
printk(KERN_INFO "%s: set to minimum %d\n",
__func__, max_size);
}
- q->limits.max_segment_size = max_size;
+ dma_max_size = dma_max_mapping_size(q->backing_dev_info->dev);
+
+ q->limits.max_segment_size = min(max_size, dma_max_size);
}
EXPORT_SYMBOL(blk_queue_max_segment_size);
next prev parent reply other threads:[~2019-01-24 9:51 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-23 16:30 [PATCH 0/5 v3] Fix virtio-blk issue with SWIOTLB Joerg Roedel
2019-01-23 16:30 ` [PATCH 1/5] swiotlb: Introduce swiotlb_max_mapping_size() Joerg Roedel
2019-01-23 21:28 ` Christoph Hellwig
2019-01-24 8:24 ` Joerg Roedel
2019-01-24 8:47 ` Christoph Hellwig
2019-01-23 16:30 ` [PATCH 2/5] swiotlb: Add is_swiotlb_active() function Joerg Roedel
2019-01-23 21:27 ` Christoph Hellwig
2019-01-24 8:29 ` Joerg Roedel
2019-01-24 8:41 ` Christoph Hellwig
2019-01-24 15:00 ` Joerg Roedel
2019-01-28 17:19 ` Michael S. Tsirkin
2019-01-23 16:30 ` [PATCH 3/5] dma: Introduce dma_max_mapping_size() Joerg Roedel
2019-01-23 21:29 ` Christoph Hellwig
2019-01-23 16:30 ` [PATCH 4/5] virtio: Introduce virtio_max_dma_size() Joerg Roedel
2019-01-23 16:30 ` [PATCH 5/5] virtio-blk: Consider virtio_max_dma_size() for maximum segment size Joerg Roedel
2019-01-23 21:31 ` Christoph Hellwig
2019-01-23 22:25 ` Michael S. Tsirkin
2019-01-24 8:40 ` Joerg Roedel
2019-01-24 8:42 ` Christoph Hellwig
2019-01-24 9:51 ` Joerg Roedel [this message]
2019-01-28 8:05 ` Christoph Hellwig
2019-01-28 17:14 ` Michael S. Tsirkin
2019-01-29 7:38 ` Christoph Hellwig
2019-01-23 17:09 ` [PATCH 0/5 v3] Fix virtio-blk issue with SWIOTLB Konrad Rzeszutek Wilk
2019-01-23 18:51 ` Michael S. Tsirkin
2019-01-23 21:14 ` Konrad Rzeszutek Wilk
2019-01-28 15:20 ` Michael S. Tsirkin
2019-01-28 15:53 ` Konrad Rzeszutek Wilk
-- strict thread matches above, loose matches on Subject: below --
2019-01-29 8:43 [PATCH 0/5 v4] " Joerg Roedel
2019-01-29 8:43 ` [PATCH 5/5] virtio-blk: Consider virtio_max_dma_size() for maximum segment size Joerg Roedel
2019-01-29 17:13 ` Christoph Hellwig
2019-01-30 16:40 [PATCH 0/5 v5] Fix virtio-blk issue with SWIOTLB Joerg Roedel
2019-01-30 16:40 ` [PATCH 5/5] virtio-blk: Consider virtio_max_dma_size() for maximum segment size Joerg Roedel
2019-01-31 16:33 [PATCH 0/5 v6] Fix virtio-blk issue with SWIOTLB Joerg Roedel
2019-01-31 16:34 ` [PATCH 5/5] virtio-blk: Consider virtio_max_dma_size() for maximum segment size Joerg Roedel
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=20190124095150.GL32526@8bytes.org \
--to=joro@8bytes.org \
--cc=axboe@kernel.dk \
--cc=brijesh.singh@amd.com \
--cc=hch@lst.de \
--cc=iommu@lists.linux-foundation.org \
--cc=jasowang@redhat.com \
--cc=jfehlig@suse.com \
--cc=jon.grimm@amd.com \
--cc=jroedel@suse.de \
--cc=konrad.wilk@oracle.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux-foundation.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