Skip to contentSkip to conversation

move bounce limits settings into the drivers

PATCH In review Christoph Hellwig 3 participants 18 messages Jun 19, 2017 – Jun 27, 2017

Subsystems (17)
lore
Share & tools
lore
#0 lore raw

Currently we still default to a bounce all highmem setting for block drivers. This series defaults to no bouncing and instead adds call
to blk_queue_bounce_limit to those drivers that need it. It also
has a few cleanups in that area.

#1 lore raw

PATCH 1/10 pktcdvd: remove the call to blk_queue_bounce

pktcdvd is a make_request based stacking driver and thus doesn't have any addressing limits on it's own. It also doesn't use bio_data() or page_address(), so it doesn't need a lowmem bounce either.

---
 drivers/block/pktcdvd.c | 2 --
 1 file changed, 2 deletions(-)
drivers/block/pktcdvd.c +0 -2
index 26c04baae967..7f2eca31eb6a 100644
@@ -2413,8 +2413,6 @@ static blk_qc_t pkt_make_request(struct request_queue *q, struct bio *bio)
 	char b[BDEVNAME_SIZE];
 	struct bio *split;
 
-	blk_queue_bounce(q, &bio);
-
 	blk_queue_split(q, &bio);
 
 	pd = q->queuedata;
Signature · 1 line
2.11.0
#7 lore raw

PATCH 2/10 blk-map: call blk_queue_bounce from blk_rq_append_bio

In reply to Christoph Hellwig

This makes moves the knowledge about bouncing out of the callers into the block core (just like we do for the normal I/O path), and allows to unexport blk_queue_bounce.

---
 block/blk-map.c                  | 7 +++----
 block/bounce.c                   | 2 --
 drivers/scsi/osd/osd_initiator.c | 5 +----
 3 files changed, 4 insertions(+), 10 deletions(-)
block/blk-map.c +3 -4
index 3b5cb863318f..2547016aa7aa 100644
@@ -16,6 +16,8 @@
  */
 int blk_rq_append_bio(struct request *rq, struct bio *bio)
 {
+	blk_queue_bounce(rq->q, &bio);
+
 	if (!rq->bio) {
 		blk_rq_bio_prep(rq->q, rq, bio);
 	} else {
@@ -72,15 +74,13 @@ static int __blk_rq_map_user_iov(struct request *rq,
 		map_data->offset += bio->bi_iter.bi_size;
 
 	orig_bio = bio;
-	blk_queue_bounce(q, &bio);
 
 	/*
 	 * We link the bounce buffer in and could have to traverse it
 	 * later so we have to get a ref to prevent it from being freed
 	 */
-	bio_get(bio);
-
 	ret = blk_rq_append_bio(rq, bio);
+	bio_get(bio);
 	if (ret) {
 		bio_endio(bio);
 		__blk_rq_unmap_user(orig_bio);
@@ -249,7 +249,6 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf,
 		return ret;
 	}
 
-	blk_queue_bounce(q, &rq->bio);
 	return 0;
 }
 EXPORT_SYMBOL(blk_rq_map_kern);
block/bounce.c +0 -2
index 17d77613c471..b7e44bd59d7c 100644
@@ -284,5 +284,3 @@ void blk_queue_bounce(struct request_queue *q, struct bio **bio_orig)
 	 */
 	__blk_queue_bounce(q, bio_orig, pool);
 }
-
-EXPORT_SYMBOL(blk_queue_bounce);
drivers/scsi/osd/osd_initiator.c +1 -4
index 1e69a43b279d..3754888dc7dd 100644
@@ -1577,10 +1577,7 @@ static struct request *_make_request(struct request_queue *q, bool has_write,
 	scsi_req_init(req);
 
 	for_each_bio(bio) {
-		struct bio *bounce_bio = bio;
-
-		blk_queue_bounce(req->q, &bounce_bio);
-		ret = blk_rq_append_bio(req, bounce_bio);
+		ret = blk_rq_append_bio(req, bio);
 		if (ret)
 			return ERR_PTR(ret);
 	}
Signature · 1 line
2.11.0
#8 lore raw

PATCH 3/10 block: move bounce declarations to block/blk.h

In reply to Christoph Hellwig
---
 block/blk.h            | 13 +++++++++++++
 block/bounce.c         |  1 +
 include/linux/blkdev.h | 13 -------------
 3 files changed, 14 insertions(+), 13 deletions(-)
block/blk.h +13 -0
index 83c8e1100525..4576fb5a8006 100644
@@ -334,4 +334,17 @@ static inline void blk_throtl_bio_endio(struct bio *bio) { }
 static inline void blk_throtl_stat_add(struct request *rq, u64 time) { }
 #endif
 
+#ifdef CONFIG_BOUNCE
+extern int init_emergency_isa_pool(void);
+extern void blk_queue_bounce(struct request_queue *q, struct bio **bio);
+#else
+static inline int init_emergency_isa_pool(void)
+{
+	return 0;
+}
+static inline void blk_queue_bounce(struct request_queue *q, struct bio **bio)
+{
+}
+#endif /* CONFIG_BOUNCE */
+
 #endif /* BLK_INTERNAL_H */
block/bounce.c +1 -0
index b7e44bd59d7c..fc79dd3e0f20 100644
@@ -22,6 +22,7 @@
 #include <asm/tlbflush.h>
 
 #include <trace/events/block.h>
+#include "blk.h"
 
 #define POOL_SIZE	64
 #define ISA_POOL_SIZE	16
include/linux/blkdev.h +0 -13
index 22cfba64ce81..f1a5f82a4d97 100644
@@ -863,19 +863,6 @@ extern unsigned long blk_max_low_pfn, blk_max_pfn;
 #define BLK_DEFAULT_SG_TIMEOUT	(60 * HZ)
 #define BLK_MIN_SG_TIMEOUT	(7 * HZ)
 
-#ifdef CONFIG_BOUNCE
-extern int init_emergency_isa_pool(void);
-extern void blk_queue_bounce(struct request_queue *q, struct bio **bio);
-#else
-static inline int init_emergency_isa_pool(void)
-{
-	return 0;
-}
-static inline void blk_queue_bounce(struct request_queue *q, struct bio **bio)
-{
-}
-#endif /* CONFIG_MMU */
-
 struct rq_map_data {
 	struct page **pages;
 	int page_order;
Signature · 1 line
2.11.0
#9 lore raw

PATCH 4/10 block: remove the queue_bounce_pfn helper

In reply to Christoph Hellwig

Only used inside the bounce code, and opencoding it makes it more obvious what is going on.

---
 block/bounce.c         | 6 +++---
 include/linux/blkdev.h | 5 -----
 2 files changed, 3 insertions(+), 8 deletions(-)
block/bounce.c +3 -3
index fc79dd3e0f20..f2b4361fff81 100644
@@ -203,7 +203,7 @@ static void __blk_queue_bounce(struct request_queue *q, struct bio **bio_orig,
 	bio_for_each_segment(from, *bio_orig, iter) {
 		if (i++ < BIO_MAX_PAGES)
 			sectors += from.bv_len >> 9;
-		if (page_to_pfn(from.bv_page) > queue_bounce_pfn(q))
+		if (page_to_pfn(from.bv_page) > q->limits.bounce_pfn)
 			bounce = true;
 	}
 	if (!bounce)
@@ -220,7 +220,7 @@ static void __blk_queue_bounce(struct request_queue *q, struct bio **bio_orig,
 	bio_for_each_segment_all(to, bio, i) {
 		struct page *page = to->bv_page;
 
-		if (page_to_pfn(page) <= queue_bounce_pfn(q))
+		if (page_to_pfn(page) <= q->limits.bounce_pfn)
 			continue;
 
 		to->bv_page = mempool_alloc(pool, q->bounce_gfp);
@@ -272,7 +272,7 @@ void blk_queue_bounce(struct request_queue *q, struct bio **bio_orig)
 	 * don't waste time iterating over bio segments
 	 */
 	if (!(q->bounce_gfp & GFP_DMA)) {
-		if (queue_bounce_pfn(q) >= blk_max_pfn)
+		if (q->limits.bounce_pfn >= blk_max_pfn)
 			return;
 		pool = page_pool;
 	} else {
include/linux/blkdev.h +0 -5
index f1a5f82a4d97..db2b7a7450bd 100644
@@ -1363,11 +1363,6 @@ enum blk_default_limits {
 
 #define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist)
 
-static inline unsigned long queue_bounce_pfn(struct request_queue *q)
-{
-	return q->limits.bounce_pfn;
-}
-
 static inline unsigned long queue_segment_boundary(struct request_queue *q)
 {
 	return q->limits.seg_boundary_mask;
Signature · 1 line
2.11.0
#10 lore raw

PATCH 5/10 block: don't bother with bounce limits for make_request drivers

In reply to Christoph Hellwig

We only call blk_queue_bounce for request-based drivers, so stop messing with it for make_request based drivers.

---
 block/blk-core.c               | 5 +++++
 block/blk-mq.c                 | 5 +++++
 block/blk-settings.c           | 5 -----
 drivers/block/brd.c            | 1 -
 drivers/block/drbd/drbd_main.c | 1 -
 drivers/block/rsxx/dev.c       | 1 -
 drivers/nvdimm/blk.c           | 1 -
 drivers/nvdimm/btt.c           | 1 -
 drivers/nvdimm/pmem.c          | 1 -
 9 files changed, 10 insertions(+), 11 deletions(-)
block/blk-core.c +5 -0
index 62cf92550512..07b26853ce1e 100644
@@ -954,6 +954,11 @@ int blk_init_allocated_queue(struct request_queue *q)
 	 */
 	blk_queue_make_request(q, blk_queue_bio);
 
+	/*
+	 * by default assume old behaviour and bounce for any highmem page
+	 */
+	blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH);
+
 	q->sg_reserved_size = INT_MAX;
 
 	/* Protect q->elevator from elevator_change */
block/blk-mq.c +5 -0
index dd276a9e138e..e26b7435e245 100644
@@ -2300,6 +2300,11 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
 	blk_queue_make_request(q, blk_mq_make_request);
 
 	/*
+	 * by default assume old behaviour and bounce for any highmem page
+	 */
+	blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH);
+
+	/*
 	 * Do this after blk_queue_make_request() overrides it...
 	 */
 	q->nr_requests = set->queue_depth;
block/blk-settings.c +0 -5
index 4fa81ed383ca..be1f115b538b 100644
@@ -172,11 +172,6 @@ void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn)
 	q->nr_batching = BLK_BATCH_REQ;
 
 	blk_set_default_limits(&q->limits);
-
-	/*
-	 * by default assume old behaviour and bounce for any highmem page
-	 */
-	blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH);
 }
 EXPORT_SYMBOL(blk_queue_make_request);
 
drivers/block/brd.c +0 -1
index 57b574f2f66a..6112e99bedf7 100644
@@ -418,7 +418,6 @@ static struct brd_device *brd_alloc(int i)
 
 	blk_queue_make_request(brd->brd_queue, brd_make_request);
 	blk_queue_max_hw_sectors(brd->brd_queue, 1024);
-	blk_queue_bounce_limit(brd->brd_queue, BLK_BOUNCE_ANY);
 
 	/* This is so fdisk will align partitions on 4k, because of
 	 * direct_access API needing 4k alignment, returning a PFN
drivers/block/drbd/drbd_main.c +0 -1
index 90680034ef57..5fb99e06ebe4 100644
@@ -2850,7 +2850,6 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig
 	/* Setting the max_hw_sectors to an odd value of 8kibyte here
 	   This triggers a max_bio_size message upon first attach or connect */
 	blk_queue_max_hw_sectors(q, DRBD_MAX_BIO_SIZE_SAFE >> 8);
-	blk_queue_bounce_limit(q, BLK_BOUNCE_ANY);
 	q->queue_lock = &resource->req_lock;
 
 	device->md_io.page = alloc_page(GFP_KERNEL);
drivers/block/rsxx/dev.c +0 -1
index 4e8bdfa0aa31..7f4acebf4657 100644
@@ -284,7 +284,6 @@ int rsxx_setup_dev(struct rsxx_cardinfo *card)
 	}
 
 	blk_queue_make_request(card->queue, rsxx_make_request);
-	blk_queue_bounce_limit(card->queue, BLK_BOUNCE_ANY);
 	blk_queue_max_hw_sectors(card->queue, blkdev_max_hw_sectors);
 	blk_queue_physical_block_size(card->queue, RSXX_HW_BLK_SIZE);
 
drivers/nvdimm/blk.c +0 -1
index 79eb9fb358d5..f12d23c49771 100644
@@ -273,7 +273,6 @@ static int nsblk_attach_disk(struct nd_namespace_blk *nsblk)
 
 	blk_queue_make_request(q, nd_blk_make_request);
 	blk_queue_max_hw_sectors(q, UINT_MAX);
-	blk_queue_bounce_limit(q, BLK_BOUNCE_ANY);
 	blk_queue_logical_block_size(q, nsblk_sector_size(nsblk));
 	queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q);
 	q->queuedata = nsblk;
drivers/nvdimm/btt.c +0 -1
index 31b2d14e210d..b6ba0618ea46 100644
@@ -1297,7 +1297,6 @@ static int btt_blk_init(struct btt *btt)
 	blk_queue_make_request(btt->btt_queue, btt_make_request);
 	blk_queue_logical_block_size(btt->btt_queue, btt->sector_size);
 	blk_queue_max_hw_sectors(btt->btt_queue, UINT_MAX);
-	blk_queue_bounce_limit(btt->btt_queue, BLK_BOUNCE_ANY);
 	queue_flag_set_unlocked(QUEUE_FLAG_NONROT, btt->btt_queue);
 	btt->btt_queue->queuedata = btt;
 
drivers/nvdimm/pmem.c +0 -1
index 7bd383aeea14..6b577afb1d44 100644
@@ -343,7 +343,6 @@ static int pmem_attach_disk(struct device *dev,
 	blk_queue_make_request(q, pmem_make_request);
 	blk_queue_physical_block_size(q, PAGE_SIZE);
 	blk_queue_max_hw_sectors(q, UINT_MAX);
-	blk_queue_bounce_limit(q, BLK_BOUNCE_ANY);
 	queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q);
 	queue_flag_set_unlocked(QUEUE_FLAG_DAX, q);
 	q->queuedata = pmem;
Signature · 1 line
2.11.0
#11 lore raw

PATCH 6/10 blk-mq: don't bounce by default

In reply to Christoph Hellwig

For historical reasons we default to bouncing highmem pages for all block queues. But the blk-mq drivers are easy to audit to ensure that we don't need this - scsi and mtip32xx set explicit limits and everyone else doesn't have any particular ones.

---
 block/blk-mq.c               | 5 -----
 drivers/block/virtio_blk.c   | 3 ---
 drivers/block/xen-blkfront.c | 3 ---
 3 files changed, 11 deletions(-)
block/blk-mq.c +0 -5
index e26b7435e245..dd276a9e138e 100644
@@ -2300,11 +2300,6 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
 	blk_queue_make_request(q, blk_mq_make_request);
 
 	/*
-	 * by default assume old behaviour and bounce for any highmem page
-	 */
-	blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH);
-
-	/*
 	 * Do this after blk_queue_make_request() overrides it...
 	 */
 	q->nr_requests = set->queue_depth;
drivers/block/virtio_blk.c +0 -3
index e59bd4549a8a..0297ad7c1452 100644
@@ -720,9 +720,6 @@ static int virtblk_probe(struct virtio_device *vdev)
 	/* We can handle whatever the host told us to handle. */
 	blk_queue_max_segments(q, vblk->sg_elems-2);
 
-	/* No need to bounce any requests */
-	blk_queue_bounce_limit(q, BLK_BOUNCE_ANY);
-
 	/* No real sector limit. */
 	blk_queue_max_hw_sectors(q, -1U);
 
drivers/block/xen-blkfront.c +0 -3
index ac90093fcb25..c852ed3c01d5 100644
@@ -953,9 +953,6 @@ static void blkif_set_queue_limits(struct blkfront_info *info)
 
 	/* Make sure buffer addresses are sector-aligned. */
 	blk_queue_dma_alignment(rq, 511);
-
-	/* Make sure we don't use bounce buffers. */
-	blk_queue_bounce_limit(rq, BLK_BOUNCE_ANY);
 }
 
 static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size,
Signature · 1 line
2.11.0
#12 lore raw

PATCH 7/10 block: don't set bounce limit in blk_init_allocated_queue

In reply to Christoph Hellwig

And just move it into scsi_transport_sas which needs it due to low-level drivers directly derferencing bio_data, and into blk_init_queue_node, which will need a further push into the callers.

---
 block/blk-core.c                  | 10 +++++-----
 drivers/scsi/scsi_transport_sas.c |  5 +++++
 2 files changed, 10 insertions(+), 5 deletions(-)
block/blk-core.c +5 -5
index 07b26853ce1e..ef82164c6d82 100644
@@ -927,6 +927,11 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id)
 		return NULL;
 	}
 
+	/*
+	 * by default assume old behaviour and bounce for any highmem page
+	 */
+	blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH);
+
 	return q;
 }
 EXPORT_SYMBOL(blk_init_queue_node);
@@ -954,11 +959,6 @@ int blk_init_allocated_queue(struct request_queue *q)
 	 */
 	blk_queue_make_request(q, blk_queue_bio);
 
-	/*
-	 * by default assume old behaviour and bounce for any highmem page
-	 */
-	blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH);
-
 	q->sg_reserved_size = INT_MAX;
 
 	/* Protect q->elevator from elevator_change */
drivers/scsi/scsi_transport_sas.c +5 -0
index cc970c811bcb..87ea904f0700 100644
@@ -249,6 +249,11 @@ static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy)
 	if (error)
 		goto out_cleanup_queue;
 
+	/*
+	 * by default assume old behaviour and bounce for any highmem page
+	 */
+	blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH);
+
 	error = bsg_register_queue(q, dev, name, release);
 	if (error)
 		goto out_cleanup_queue;
Signature · 1 line
2.11.0
#13 lore raw

PATCH 8/10 block: don't set bounce limit in blk_init_queue

In reply to Christoph Hellwig

Instead move it to the callers. Those that either don't use bio_data() or page_address() or are specific to architectures that do not support highmem are skipped.

---
 block/blk-core.c            | 5 -----
 drivers/block/aoe/aoeblk.c  | 1 +
 drivers/block/floppy.c      | 1 +
 drivers/block/paride/pcd.c  | 1 +
 drivers/block/paride/pd.c   | 1 +
 drivers/block/paride/pf.c   | 1 +
 drivers/block/skd_main.c    | 1 +
 drivers/block/swim.c        | 2 ++
 drivers/block/swim3.c       | 1 +
 drivers/block/xsysace.c     | 1 +
 drivers/cdrom/gdrom.c       | 1 +
 drivers/mtd/mtd_blkdevs.c   | 1 +
 drivers/sbus/char/jsflash.c | 1 +
 13 files changed, 13 insertions(+), 5 deletions(-)
block/blk-core.c +0 -5
index ef82164c6d82..62cf92550512 100644
@@ -927,11 +927,6 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id)
 		return NULL;
 	}
 
-	/*
-	 * by default assume old behaviour and bounce for any highmem page
-	 */
-	blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH);
-
 	return q;
 }
 EXPORT_SYMBOL(blk_init_queue_node);
drivers/block/aoe/aoeblk.c +1 -0
index 027b876370bc..6797e6c23c8a 100644
@@ -388,6 +388,7 @@ aoeblk_gdalloc(void *vp)
 			d->aoemajor, d->aoeminor);
 		goto err_mempool;
 	}
+	blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH);
 
 	spin_lock_irqsave(&d->lock, flags);
 	WARN_ON(!(d->flags & DEVFL_GD_NOW));
drivers/block/floppy.c +1 -0
index 9e3cb32e365d..ce823647a9c4 100644
@@ -4203,6 +4203,7 @@ static int __init do_floppy_init(void)
 			goto out_put_disk;
 		}
 
+		blk_queue_bounce_limit(disks[drive]->queue, BLK_BOUNCE_HIGH);
 		blk_queue_max_hw_sectors(disks[drive]->queue, 64);
 		disks[drive]->major = FLOPPY_MAJOR;
 		disks[drive]->first_minor = TOMINOR(drive);
drivers/block/paride/pcd.c +1 -0
index cffe42d80ce9..7b8c6368beb7 100644
@@ -305,6 +305,7 @@ static void pcd_init_units(void)
 			put_disk(disk);
 			continue;
 		}
+		blk_queue_bounce_limit(disk->queue, BLK_BOUNCE_HIGH);
 		cd->disk = disk;
 		cd->pi = &cd->pia;
 		cd->present = 0;
drivers/block/paride/pd.c +1 -0
index c98983be4f9c..27a44b97393a 100644
@@ -863,6 +863,7 @@ static void pd_probe_drive(struct pd_unit *disk)
 		return;
 	}
 	blk_queue_max_hw_sectors(p->queue, cluster);
+	blk_queue_bounce_limit(p->queue, BLK_BOUNCE_HIGH);
 
 	if (disk->drive == -1) {
 		for (disk->drive = 0; disk->drive <= 1; disk->drive++)
drivers/block/paride/pf.c +1 -0
index 5f46da8d05cd..eef7a91f667d 100644
@@ -293,6 +293,7 @@ static void __init pf_init_units(void)
 			return;
 		}
 		blk_queue_max_segments(disk->queue, cluster);
+		blk_queue_bounce_limit(disk->queue, BLK_BOUNCE_HIGH);
 		pf->disk = disk;
 		pf->pi = &pf->pia;
 		pf->media_status = PF_NM;
drivers/block/skd_main.c +1 -0
index e6c526861703..d0368682bd43 100644
@@ -4273,6 +4273,7 @@ static int skd_cons_disk(struct skd_device *skdev)
 		rc = -ENOMEM;
 		goto err_out;
 	}
+	blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH);
 
 	skdev->queue = q;
 	disk->queue = q;
drivers/block/swim.c +2 -0
index 1633aaf24060..84434d3ea19b 100644
@@ -864,6 +864,8 @@ static int swim_floppy_init(struct swim_priv *swd)
 			put_disk(swd->unit[drive].disk);
 			goto exit_put_disks;
 		}
+		blk_queue_bounce_limit(swd->unit[drive].disk->queue,
+				BLK_BOUNCE_HIGH);
 		swd->unit[drive].disk->queue->queuedata = swd;
 		swd->unit[drive].swd = swd;
 	}
drivers/block/swim3.c +1 -0
index e3399a138335..9f931f8f6b4c 100644
@@ -1223,6 +1223,7 @@ static int swim3_attach(struct macio_dev *mdev,
 		put_disk(disk);
 		return -ENOMEM;
 	}
+	blk_queue_bounce_limit(disk->queue, BLK_BOUNCE_HIGH);
 	disk->queue->queuedata = &floppy_states[index];
 
 	if (index == 0) {
drivers/block/xsysace.c +1 -0
index 977fdf066017..14459d66ef0c 100644
@@ -993,6 +993,7 @@ static int ace_setup(struct ace_device *ace)
 	if (ace->queue == NULL)
 		goto err_blk_initq;
 	blk_queue_logical_block_size(ace->queue, 512);
+	blk_queue_bounce_limit(ace->queue, BLK_BOUNCE_HIGH);
 
 	/*
 	 * Allocate and initialize GD structure
drivers/cdrom/gdrom.c +1 -0
index 53f8278e66f7..6495b03f576c 100644
@@ -813,6 +813,7 @@ static int probe_gdrom(struct platform_device *devptr)
 		err = -ENOMEM;
 		goto probe_fail_requestq;
 	}
+	blk_queue_bounce_limit(gd.gdrom_rq, BLK_BOUNCE_HIGH);
 
 	err = probe_gdrom_setupqueue();
 	if (err)
drivers/mtd/mtd_blkdevs.c +1 -0
index 91c17fba7659..f336a9b85576 100644
@@ -417,6 +417,7 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
 	new->rq->queuedata = new;
 	blk_queue_logical_block_size(new->rq, tr->blksize);
 
+	blk_queue_bounce_limit(new->rq, BLK_BOUNCE_HIGH);
 	queue_flag_set_unlocked(QUEUE_FLAG_NONROT, new->rq);
 	queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, new->rq);
 
drivers/sbus/char/jsflash.c +1 -0
index 35a69949f92d..14f377ac1280 100644
@@ -592,6 +592,7 @@ static int jsfd_init(void)
 			put_disk(disk);
 			goto out;
 		}
+		blk_queue_bounce_limit(disk->queue, BLK_BOUNCE_HIGH);
 		jsfd_disk[i] = disk;
 	}
 
Signature · 1 line
2.11.0
#14 lore raw

PATCH 9/10 dm: don't set bounce limit

In reply to Christoph Hellwig

Now all queues allocators come without abounce limit by default, dm doesn't have to override this anymore.

---
 drivers/md/dm.c | 1 -
 1 file changed, 1 deletion(-)
drivers/md/dm.c +0 -1
index fbd06b9f9467..402946035308 100644
@@ -1534,7 +1534,6 @@ void dm_init_normal_md_queue(struct mapped_device *md)
 	 * Initialize aspects of queue that aren't relevant for blk-mq
 	 */
 	md->queue->backing_dev_info->congested_fn = dm_any_congested;
-	blk_queue_bounce_limit(md->queue, BLK_BOUNCE_ANY);
 }
 
 static void cleanup_mapped_device(struct mapped_device *md)
Signature · 1 line
2.11.0
#15 lore raw

PATCH 10/10 mmc/block: remove a call to blk_queue_bounce_limit

In reply to Christoph Hellwig

BLK_BOUNCE_ANY is the defauly now, so the call is superflous.

---
 drivers/mmc/core/queue.c | 1 -
 1 file changed, 1 deletion(-)
drivers/mmc/core/queue.c +0 -1
index 7f20298d892b..b659a28c8018 100644
@@ -388,7 +388,6 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
 		mmc_queue_setup_discard(mq->queue, card);
 
 	if (card->bouncesz) {
-		blk_queue_bounce_limit(mq->queue, BLK_BOUNCE_ANY);
 		blk_queue_max_hw_sectors(mq->queue, card->bouncesz / 512);
 		blk_queue_max_segments(mq->queue, card->bouncesz / 512);
 		blk_queue_max_segment_size(mq->queue, card->bouncesz);
Signature · 1 line
2.11.0
#2 lore raw

Re: [PATCH 01/10] pktcdvd: remove the call to blk_queue_bounce

In reply to Christoph Hellwig
Quoted 23 lines · Christoph Hellwig

pktcdvd is a make_request based stacking driver and thus doesn't have any addressing limits on it's own. It also doesn't use bio_data() or page_address(), so it doesn't need a lowmem bounce either.

---
 drivers/block/pktcdvd.c | 2 --
 1 file changed, 2 deletions(-)
drivers/block/pktcdvd.c +0 -3
index 26c04baae967..7f2eca31eb6a 100644
@@ -2413,8 +2413,6 @@ static blk_qc_t pkt_make_request(struct request_queue *q, struct bio *bio)
        char b[BDEVNAME_SIZE];
        struct bio *split;
 
-       blk_queue_bounce(q, &bio);
-
        blk_queue_split(q, &bio);
 
        pd = q->queuedata;
--
Quoted 2 lines

2.11.0

blk_queue_make_request() sets bounce for any highmem page for long time, and in theory this patch might cause regression on 32bit arch, when the controller can't handle higmem page really(especially in case of PAE), so we may need to be careful about this change, especially on some old hardware.

thanks,
Ming Lei

#3 lore raw

Re: [PATCH 01/10] pktcdvd: remove the call to blk_queue_bounce

Quoted 4 lines · Ming Lei

blk_queue_make_request() sets bounce for any highmem page for long time, and in theory this patch might cause regression on 32bit arch, when the controller can't handle higmem page really(especially in case of PAE), so we may need to be careful about this change, especially on some old hardware.

Which controller?

#4 lore raw

Re: [PATCH 01/10] pktcdvd: remove the call to blk_queue_bounce

Quoted 7 lines · Christoph Hellwig
Quoted 4 lines · Ming Lei

blk_queue_make_request() sets bounce for any highmem page for long time, and in theory this patch might cause regression on 32bit arch, when the controller can't handle higmem page really(especially in case of PAE), so we may need to be careful about this change, especially on some old hardware.

Which controller?

I don't know.

IMO, we can't just remove it because it is a bio based driver, the bounce is not related with
a bio or req based driver, and it depends if the controller can handle highmem page.

Actually the bounce for highmem is here from v2.6.12, and looks you might need to
investigate why it is introduced from start before the removing, :-)

Thanks,
Ming Lei

#5 lore raw

Re: [PATCH 01/10] pktcdvd: remove the call to blk_queue_bounce

Quoted 7 lines · Ming Lei
Quoted 6 lines · Christoph Hellwig
Quoted 4 lines · Ming Lei

blk_queue_make_request() sets bounce for any highmem page for long time, and in theory this patch might cause regression on 32bit arch, when the controller can't handle higmem page really(especially in case of PAE), so we may need to be careful about this change, especially on some old hardware.

Quoted 8 lines
Quoted 1 line

Which controller?

I don't know.

IMO, we can't just remove it because it is a bio based driver, the bounce is not related with
a bio or req based driver, and it depends if the controller can handle highmem page.

pktcdvd is a stacking driver and forwards all data through either generic_make_request or blk_rq_map_kern + blk_execute_rq, both of which call blk_queue_bounce internally.

#6 lore raw

Re: [PATCH 01/10] pktcdvd: remove the call to blk_queue_bounce

Quoted 12 lines · Christoph Hellwig
Quoted 11 lines · Ming Lei
Quoted 7 lines · Christoph Hellwig
Quoted 4 lines · Ming Lei

blk_queue_make_request() sets bounce for any highmem page for long time, and in theory this patch might cause regression on 32bit arch, when the controller can't handle higmem page really(especially in case of PAE), so we may need to be careful about this change, especially on some old hardware.

Which controller?

I don't know.

Quoted 8 lines
Quoted 4 lines

IMO, we can't just remove it because it is a bio based driver, the bounce is not related with
a bio or req based driver, and it depends if the controller can handle highmem page.

pktcdvd is a stacking driver and forwards all data through either generic_make_request or blk_rq_map_kern + blk_execute_rq, both of which call blk_queue_bounce internally.

OK, thanks for explaining, then looks it isn't needed from the start.

Thanks,
Ming Lei

#16 lore raw
In reply to Christoph Hellwig

ping?

Quoted 4 lines · Christoph Hellwig

Currently we still default to a bounce all highmem setting for block drivers. This series defaults to no bouncing and instead adds call
to blk_queue_bounce_limit to those drivers that need it. It also
has a few cleanups in that area.

---end quoted text---

maintainer
#17 lore raw
In reply to Christoph Hellwig
Quoted 4 lines · Christoph Hellwig

Currently we still default to a bounce all highmem setting for block drivers. This series defaults to no bouncing and instead adds call
to blk_queue_bounce_limit to those drivers that need it. It also
has a few cleanups in that area.

Looks straight forward and trivial to me, I'll pull it in for 4.13.

Signature · 1 line
Jens Axboe