blk-mq driver conversions and legacy path removal
Subsystems (20)
Jens Axboe
maintainercover blk-mq driver conversions and legacy path removal
The first round of this went into 4.20-rc, but we've still some of them pending. This patch series converts the remaining drivers to blk-mq. The ones that support dual paths (like SCSI and DM) have the non-mq path removed. At the end, legacy IO code and schedulers are killed off.
This patch series is on top of my for-linus branch. It can also be bound in my mq-conversions branch.
Documentation/block/biodoc.txt | 88 - Documentation/block/cfq-iosched.txt | 291 -- Documentation/scsi/scsi-parameters.txt | 5 - block/Kconfig | 6 - block/Kconfig.iosched | 61 - block/Makefile | 5 +- block/bfq-iosched.c | 1 - block/blk-cgroup.c | 55 - block/blk-core.c | 1860 +----------- block/blk-exec.c | 20 +- block/blk-flush.c | 154 +- block/blk-ioc.c | 46 +- block/blk-merge.c | 35 +- block/blk-mq-debugfs.c | 2 - block/blk-mq-tag.c | 6 +- block/blk-mq.c | 13 +- block/blk-settings.c | 49 - block/blk-softirq.c | 20 - block/blk-sysfs.c | 39 +- block/blk-tag.c | 378 --- block/blk-timeout.c | 99 +- block/blk-wbt.c | 3 +- block/blk.h | 60 +- block/bsg-lib.c | 131 +- block/cfq-iosched.c | 4916 -------------------------------- block/deadline-iosched.c | 560 ---- block/elevator.c | 447 +-- block/kyber-iosched.c | 1 - block/mq-deadline.c | 1 - block/noop-iosched.c | 124 - drivers/block/sunvdc.c | 149 +- drivers/ide/ide-atapi.c | 25 +- drivers/ide/ide-cd.c | 175 +- drivers/ide/ide-disk.c | 5 +- drivers/ide/ide-io.c | 101 +- drivers/ide/ide-park.c | 4 +- drivers/ide/ide-pm.c | 28 +- drivers/ide/ide-probe.c | 68 +- drivers/infiniband/ulp/srp/ib_srp.c | 7 - drivers/md/Kconfig | 11 - drivers/md/dm-core.h | 10 - drivers/md/dm-mpath.c | 18 +- drivers/md/dm-rq.c | 293 +- drivers/md/dm-rq.h | 4 - drivers/md/dm-sysfs.c | 3 +- drivers/md/dm-table.c | 36 +- drivers/md/dm.c | 21 +- drivers/md/dm.h | 1 - drivers/memstick/core/ms_block.c | 110 +- drivers/memstick/core/ms_block.h | 1 + drivers/memstick/core/mspro_block.c | 121 +- drivers/s390/block/dasd_ioctl.c | 22 +- drivers/scsi/Kconfig | 12 - drivers/scsi/cxlflash/main.c | 6 - drivers/scsi/hosts.c | 29 +- drivers/scsi/lpfc/lpfc_scsi.c | 2 +- drivers/scsi/osd/osd_initiator.c | 4 +- drivers/scsi/osst.c | 2 +- drivers/scsi/qedi/qedi_main.c | 3 +- drivers/scsi/qla2xxx/qla_os.c | 30 +- drivers/scsi/scsi.c | 5 +- drivers/scsi/scsi_debug.c | 3 +- drivers/scsi/scsi_error.c | 4 +- drivers/scsi/scsi_lib.c | 624 +--- drivers/scsi/scsi_priv.h | 1 - drivers/scsi/scsi_scan.c | 10 +- drivers/scsi/scsi_sysfs.c | 8 +- drivers/scsi/scsi_transport_fc.c | 72 +- drivers/scsi/scsi_transport_iscsi.c | 9 +- drivers/scsi/scsi_transport_sas.c | 10 +- drivers/scsi/sg.c | 2 +- drivers/scsi/st.c | 2 +- drivers/scsi/ufs/ufshcd.c | 6 - drivers/target/target_core_pscsi.c | 2 +- include/linux/blk-cgroup.h | 108 - include/linux/blkdev.h | 174 +- include/linux/bsg-lib.h | 3 +- include/linux/elevator.h | 90 +- include/linux/ide.h | 13 +- include/linux/init.h | 1 - include/scsi/scsi_host.h | 18 +- include/scsi/scsi_tcq.h | 14 +- init/do_mounts_initrd.c | 3 - init/initramfs.c | 6 - init/main.c | 12 - 85 files changed, 833 insertions(+), 11144 deletions(-)
Signature · 1 line
Jens Axboe
Jens Axboe
maintainerPATCH 1/28 sunvdc: convert to blk-mq
Convert from the old request_fn style driver to blk-mq.
--- drivers/block/sunvdc.c | 149 +++++++++++++++++++++++++++-------------- 1 file changed, 98 insertions(+), 51 deletions(-)
drivers/block/sunvdc.c +98 -51
@@ -6,7 +6,7 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> -#include <linux/blkdev.h> +#include <linux/blk-mq.h> #include <linux/hdreg.h> #include <linux/genhd.h> #include <linux/cdrom.h>
@@ -66,9 +66,10 @@ struct vdc_port {u64 max_xfer_size;u32 vdisk_block_size; +u32 drain;u64 ldc_timeout; -struct timer_list ldc_reset_timer; +struct delayed_work ldc_reset_timer_work;struct work_struct ldc_reset_work;/* The server fills these in for us in the disk attribute
@@ -80,12 +81,14 @@ struct vdc_port {u8 vdisk_mtype;u32 vdisk_phys_blksz; +struct blk_mq_tag_set tag_set; +char disk_name[32 ]; };static void vdc_ldc_reset (struct vdc_port *port);static void vdc_ldc_reset_work (struct work_struct *work); -static void vdc_ldc_reset_timer (struct timer_list *t); +static void vdc_ldc_reset_timer_work (struct work_struct *work);static inline struct vdc_port *to_vdc_port (struct vio_driver_state *vio) {
@@ -175,11 +178,8 @@ static void vdc_blk_queue_start(struct vdc_port *port)* handshake completes, so check for initial handshake before we've * allocated a disk. */ -if (port->disk &&blk_queue_stopped (port->disk->queue) && -vdc_tx_dring_avail (dr) *100 /VDC_TX_RING_SIZE >=50 ) { -blk_start_queue (port->disk->queue); - } - +if (port->disk &&vdc_tx_dring_avail (dr) *100 /VDC_TX_RING_SIZE >=50 ) +blk_mq_start_hw_queues (port->disk->queue); }static void vdc_finish (struct vio_driver_state *vio,int err,int waiting_for)
@@ -197,7 +197,7 @@ static void vdc_handshake_complete(struct vio_driver_state *vio) {struct vdc_port *port =to_vdc_port (vio); -del_timer (&port->ldc_reset_timer); +cancel_delayed_work (&port->ldc_reset_timer_work);vdc_finish (vio,0 ,WAITING_FOR_LINK_UP );vdc_blk_queue_start (port); }
@@ -320,7 +320,7 @@ static void vdc_end_one(struct vdc_port *port, struct vio_dring_state *dr, rqe->req =NULL ; -__blk_end_request (req, (desc->status ?BLK_STS_IOERR :0 ), desc->size); +blk_mq_end_request (req, desc->status ?BLK_STS_IOERR :0 );vdc_blk_queue_start (port); }
@@ -525,29 +525,40 @@ static int __send_request(struct request *req)return err; } -static void do_vdc_request (struct request_queue *rq) +static blk_status_t vdc_queue_rq (struct blk_mq_hw_ctx *hctx, +const struct blk_mq_queue_data *bd) { -struct request *req; +struct vdc_port *port = hctx->queue->queuedata; +struct vio_dring_state *dr; +unsigned long flags; -while ((req =blk_peek_request (rq)) !=NULL ) { -struct vdc_port *port; -struct vio_dring_state *dr; + dr = &port->vio.drings[VIO_DRIVER_TX_RING ]; - port = req->rq_disk->private_data; - dr = &port->vio.drings[VIO_DRIVER_TX_RING ]; -if (unlikely (vdc_tx_dring_avail (dr) <1 )) - goto wait; +blk_mq_start_request (bd->rq); -blk_start_request (req); +spin_lock_irqsave (&port->vio.lock, flags); -if (__send_request (req) <0 ) { -blk_requeue_request (rq, req); -wait: -/* Avoid pointless unplugs. */ -blk_stop_queue (rq); -break ; - } +/* +* Doing drain, just end the request in error +*/ +if (unlikely (port->drain)) { +spin_unlock_irqrestore (&port->vio.lock, flags); +return BLK_STS_IOERR ; } + +if (unlikely (vdc_tx_dring_avail (dr) <1 )) { +spin_unlock_irqrestore (&port->vio.lock, flags); +blk_mq_stop_hw_queue (hctx); +return BLK_STS_DEV_RESOURCE ; + } + +if (__send_request (bd->rq) <0 ) { +spin_unlock_irqrestore (&port->vio.lock, flags); +return BLK_STS_IOERR ; + } + +spin_unlock_irqrestore (&port->vio.lock, flags); +return BLK_STS_OK ; }static int generic_request (struct vdc_port *port,u8 op,void *buf,int len)
@@ -759,6 +770,32 @@ static void vdc_port_down(struct vdc_port *port)vio_ldc_free (&port->vio); } +static const struct blk_mq_ops vdc_mq_ops = { + .queue_rq = vdc_queue_rq, +}; + +static void cleanup_queue (struct request_queue *q) +{ +struct vdc_port *port = q->queuedata; + +blk_cleanup_queue (q); +blk_mq_free_tag_set (&port->tag_set); +} + +static struct request_queue *init_queue (struct vdc_port *port) +{ +struct request_queue *q; +int ret; + + q =blk_mq_init_sq_queue (&port->tag_set, &vdc_mq_ops,VDC_TX_RING_SIZE , +BLK_MQ_F_SHOULD_MERGE ); +if (IS_ERR (q)) +return q; + + q->queuedata = port; +return q; +} +static int probe_disk (struct vdc_port *port) {struct request_queue *q;
@@ -796,17 +833,17 @@ static int probe_disk(struct vdc_port *port) (u64)geom.num_sec); } - q =blk_init_queue (do_vdc_request, &port->vio.lock); -if (!q) { + q =init_queue (port); +if (IS_ERR (q)) { printk(KERN_ERR PFX "%s: Could not allocate queue.\n", port->vio.name); -return -ENOMEM ; +return PTR_ERR (q); } g =alloc_disk (1 <<PARTITION_SHIFT );if (!g) { printk(KERN_ERR PFX "%s: Could not allocate gendisk.\n", port->vio.name); -blk_cleanup_queue (q); +cleanup_queue (q);return -ENOMEM ; }
@@ -981,7 +1018,7 @@ static int vdc_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)*/ ldc_timeout =mdesc_get_property (hp, vdev->mp,"vdc-timeout" ,NULL ); port->ldc_timeout = ldc_timeout ? *ldc_timeout :0 ; -timer_setup (&port->ldc_reset_timer, vdc_ldc_reset_timer,0 ); +INIT_DELAYED_WORK (&port->ldc_reset_timer_work, vdc_ldc_reset_timer_work);INIT_WORK (&port->ldc_reset_work, vdc_ldc_reset_work); err = vio_driver_init(&port->vio, vdev, VDEV_DISK,
@@ -1034,18 +1071,14 @@ static int vdc_port_remove(struct vio_dev *vdev)struct vdc_port *port =dev_get_drvdata (&vdev->dev);if (port) { -unsigned long flags; - -spin_lock_irqsave (&port->vio.lock, flags); -blk_stop_queue (port->disk->queue); -spin_unlock_irqrestore (&port->vio.lock, flags); +blk_mq_stop_hw_queues (port->disk->queue);flush_work (&port->ldc_reset_work); -del_timer_sync (&port->ldc_reset_timer); +cancel_delayed_work_sync (&port->ldc_reset_timer_work);del_timer_sync (&port->vio.timer);del_gendisk (port->disk); -blk_cleanup_queue (port->disk->queue); +cleanup_queue (port->disk->queue);put_disk (port->disk); port->disk =NULL ;
@@ -1080,32 +1113,46 @@ static void vdc_requeue_inflight(struct vdc_port *port) } rqe->req =NULL ; -blk_requeue_request (port->disk->queue, req); +blk_mq_requeue_request (req, false); } }static void vdc_queue_drain (struct vdc_port *port) { -struct request *req; +struct request_queue *q = port->disk->queue; -while ((req =blk_fetch_request (port->disk->queue)) !=NULL ) -__blk_end_request_all (req,BLK_STS_IOERR ); +/* +* Mark the queue as draining, then freeze/quiesce to ensure +* that all existing requests are seen in ->queue_rq() and killed +*/ + port->drain =1 ; +spin_unlock_irq (&port->vio.lock); + +blk_mq_freeze_queue (q); +blk_mq_quiesce_queue (q); + +spin_lock_irq (&port->vio.lock); + port->drain =0 ; +blk_mq_unquiesce_queue (q); +blk_mq_unfreeze_queue (q); } -static void vdc_ldc_reset_timer (struct timer_list *t) +static void vdc_ldc_reset_timer_work (struct work_struct *work) { -struct vdc_port *port =from_timer (port, t, ldc_reset_timer); -struct vio_driver_state *vio = &port->vio; -unsigned long flags; +struct vdc_port *port; +struct vio_driver_state *vio; -spin_lock_irqsave (&vio->lock, flags); + port = container_of(work, struct vdc_port, ldc_reset_timer_work.work); + vio = &port->vio; + +spin_lock_irq (&vio->lock);if (!(port->vio.hs_state &VIO_HS_COMPLETE )) {pr_warn (PFX "%s ldc down %llu seconds, draining queue\n" , port->disk_name, port->ldc_timeout);vdc_queue_drain (port);vdc_blk_queue_start (port); } -spin_unlock_irqrestore (&vio->lock, flags); +spin_unlock_irq (&vio->lock); }static void vdc_ldc_reset_work (struct work_struct *work)
@@ -1129,7 +1176,7 @@ static void vdc_ldc_reset(struct vdc_port *port)assert_spin_locked (&port->vio.lock);pr_warn (PFX "%s ldc link reset\n" , port->disk_name); -blk_stop_queue (port->disk->queue); +blk_mq_stop_hw_queues (port->disk->queue);vdc_requeue_inflight (port);vdc_port_down (port);
@@ -1146,7 +1193,7 @@ static void vdc_ldc_reset(struct vdc_port *port) }if (port->ldc_timeout) -mod_timer (&port->ldc_reset_timer, +mod_delayed_work (system_wq, &port->ldc_reset_timer_work,round_jiffies (jiffies +HZ * port->ldc_timeout));mod_timer (&port->vio.timer,round_jiffies (jiffies +HZ ));return ;
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 2/28 ms_block: convert to blk-mq
In reply to Jens AxboeStraight forward conversion, room for optimization in how everything is punted to a work queue. Also looks plenty racy all over the map, with the state changes. I fixed a bunch of them up while doing the conversion, but there are surely more.
--- drivers/memstick/core/ms_block.c | 110 +++++++++++++++++-------------- drivers/memstick/core/ms_block.h | 1 + 2 files changed, 62 insertions(+), 49 deletions(-)
drivers/memstick/core/ms_block.c +61 -49
@@ -15,7 +15,7 @@#define pr_fmt (fmt) DRIVER_NAME ": " fmt#include <linux/module.h> -#include <linux/blkdev.h> +#include <linux/blk-mq.h> #include <linux/memstick.h> #include <linux/idr.h> #include <linux/hdreg.h>
@@ -1873,69 +1873,65 @@ static void msb_io_work(struct work_struct *work) struct msb_data *msb = container_of(work, struct msb_data, io_work);int page, error, len;sector_t lba; -unsigned long flags;struct scatterlist *sg = msb->prealloc_sg; +struct request *req;dbg_verbose ("IO: work started" );while (1 ) { -spin_lock_irqsave (&msb->q_lock, flags); +spin_lock_irq (&msb->q_lock);if (msb->need_flush_cache) { msb->need_flush_cache = false; -spin_unlock_irqrestore (&msb->q_lock, flags); +spin_unlock_irq (&msb->q_lock);msb_cache_flush (msb);continue ; } -if (!msb->req) { - msb->req =blk_fetch_request (msb->queue); -if (!msb->req) { -dbg_verbose ("IO: no more requests exiting" ); -spin_unlock_irqrestore (&msb->q_lock, flags); -return ; - } + req = msb->req; +if (!req) { +dbg_verbose ("IO: no more requests exiting" ); +spin_unlock_irq (&msb->q_lock); +return ; } -spin_unlock_irqrestore (&msb->q_lock, flags); - -/* If card was removed meanwhile */ -if (!msb->req) -return ; +spin_unlock_irq (&msb->q_lock);/* process the request */ dbg_verbose ("IO: processing new request" ); -blk_rq_map_sg (msb->queue, msb->req, sg); +blk_rq_map_sg (msb->queue, req, sg); - lba =blk_rq_pos (msb->req); + lba =blk_rq_pos (req);sector_div (lba, msb->page_size /512 ); page =sector_div (lba, msb->pages_in_block);if (rq_data_dir (msb->req) ==READ ) error =msb_do_read_request (msb, lba, page, sg, -blk_rq_bytes (msb->req), &len); +blk_rq_bytes (req), &len);else error =msb_do_write_request (msb, lba, page, sg, -blk_rq_bytes (msb->req), &len); - -spin_lock_irqsave (&msb->q_lock, flags); +blk_rq_bytes (req), &len); -if (len) -if (!__blk_end_request (msb->req,BLK_STS_OK , len)) - msb->req =NULL ; +if (len && !blk_update_request (req,BLK_STS_OK , len)) { +__blk_mq_end_request (req,BLK_STS_OK ); +spin_lock_irq (&msb->q_lock); + msb->req =NULL ; +spin_unlock_irq (&msb->q_lock); + }if (error && msb->req) {blk_status_t ret =errno_to_blk_status (error); +dbg_verbose ("IO: ending one sector of the request with error" ); -if (!__blk_end_request (msb->req, ret, msb->page_size)) - msb->req =NULL ; +blk_mq_end_request (req, ret); +spin_lock_irq (&msb->q_lock); + msb->req =NULL ; +spin_unlock_irq (&msb->q_lock); }if (msb->req)dbg_verbose ("IO: request still pending" ); - -spin_unlock_irqrestore (&msb->q_lock, flags); } }
@@ -2002,29 +1998,40 @@ static int msb_bd_getgeo(struct block_device *bdev,return 0 ; } -static void msb_submit_req (struct request_queue *q) +static blk_status_t msb_queue_rq (struct blk_mq_hw_ctx *hctx, +const struct blk_mq_queue_data *bd) { -struct memstick_dev *card = q->queuedata; +struct memstick_dev *card = hctx->queue->queuedata;struct msb_data *msb =memstick_get_drvdata (card); -struct request *req =NULL ; +struct request *req = bd->rq;dbg_verbose ("Submit request" ); +spin_lock_irq (&msb->q_lock); +if (msb->card_dead) {dbg ("Refusing requests on removed card" );WARN_ON (!msb->io_queue_stopped); -while ((req =blk_fetch_request (q)) !=NULL ) -__blk_end_request_all (req,BLK_STS_IOERR ); -return ; +spin_unlock_irq (&msb->q_lock); +blk_mq_start_request (req); +return BLK_STS_IOERR ; } -if (msb->req) -return ; +if (msb->req) { +spin_unlock_irq (&msb->q_lock); +return BLK_STS_DEV_RESOURCE ; + } + +blk_mq_start_request (req); + msb->req = req;if (!msb->io_queue_stopped)queue_work (msb->io_queue, &msb->io_work); + +spin_unlock_irq (&msb->q_lock); +return BLK_STS_OK ; }static int msb_check_card (struct memstick_dev *card)
@@ -2040,21 +2047,20 @@ static void msb_stop(struct memstick_dev *card)dbg ("Stopping all msblock IO" ); +blk_mq_stop_hw_queues (msb->queue);spin_lock_irqsave (&msb->q_lock, flags); -blk_stop_queue (msb->queue); msb->io_queue_stopped = true;spin_unlock_irqrestore (&msb->q_lock, flags);del_timer_sync (&msb->cache_flush_timer);flush_workqueue (msb->io_queue); +spin_lock_irqsave (&msb->q_lock, flags);if (msb->req) { -spin_lock_irqsave (&msb->q_lock, flags); -blk_requeue_request (msb->queue, msb->req); +blk_mq_requeue_request (msb->req, false); msb->req =NULL ; -spin_unlock_irqrestore (&msb->q_lock, flags); } - +spin_unlock_irqrestore (&msb->q_lock, flags); }static void msb_start (struct memstick_dev *card)
@@ -2077,9 +2083,7 @@ static void msb_start(struct memstick_dev *card) msb->need_flush_cache = true; msb->io_queue_stopped = false; -spin_lock_irqsave (&msb->q_lock, flags); -blk_start_queue (msb->queue); -spin_unlock_irqrestore (&msb->q_lock, flags); +blk_mq_start_hw_queues (msb->queue);queue_work (msb->io_queue, &msb->io_work);
@@ -2092,10 +2096,15 @@ static const struct block_device_operations msb_bdops = { .owner = THIS_MODULE }; +static const struct blk_mq_ops msb_mq_ops = { + .queue_rq = msb_queue_rq, +}; +/* Registers the block device */ static int msb_init_disk (struct memstick_dev *card) {struct msb_data *msb =memstick_get_drvdata (card); +struct blk_mq_tag_set *set =NULL ;int rc;unsigned long capacity;
@@ -2112,9 +2121,11 @@ static int msb_init_disk(struct memstick_dev *card) goto out_release_id; } - msb->queue =blk_init_queue (msb_submit_req, &msb->q_lock); -if (!msb->queue) { - rc = -ENOMEM ; + msb->queue =blk_mq_init_sq_queue (&msb->tag_set, &msb_mq_ops,2 , +BLK_MQ_F_SHOULD_MERGE ); +if (IS_ERR (msb->queue)) { + rc =PTR_ERR (msb->queue); + msb->queue =NULL ; goto out_put_disk; }
@@ -2202,12 +2213,13 @@ static void msb_remove(struct memstick_dev *card)/* Take care of unhandled + new requests from now on */ spin_lock_irqsave (&msb->q_lock, flags); msb->card_dead = true; -blk_start_queue (msb->queue);spin_unlock_irqrestore (&msb->q_lock, flags); +blk_mq_start_hw_queues (msb->queue);/* Remove the disk */ del_gendisk (msb->disk);blk_cleanup_queue (msb->queue); +blk_mq_free_tag_set (&msb->tag_set); msb->queue =NULL ;mutex_lock (&msb_disk_lock);
drivers/memstick/core/ms_block.h +1 -0
@@ -152,6 +152,7 @@ struct msb_data {struct gendisk *disk;struct request_queue *queue;spinlock_t q_lock; +struct blk_mq_tag_set tag_set;struct hd_geometry geometry;struct attribute_group attr_group;struct request *req;
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 3/28 mspro_block: convert to blk-mq
In reply to Jens AxboeStraight forward conversion, there's room for improvement.
--- drivers/memstick/core/mspro_block.c | 121 +++++++++++++++------------- 1 file changed, 66 insertions(+), 55 deletions(-)
drivers/memstick/core/mspro_block.c +66 -55
@@ -12,7 +12,7 @@* */ -#include <linux/blkdev.h> +#include <linux/blk-mq.h> #include <linux/idr.h> #include <linux/hdreg.h> #include <linux/kthread.h>
@@ -142,6 +142,7 @@ struct mspro_block_data {struct gendisk *disk;struct request_queue *queue;struct request *block_req; +struct blk_mq_tag_set tag_set;spinlock_t q_lock;unsigned short page_size;
@@ -152,7 +153,6 @@ struct mspro_block_data {unsigned char system; unsigned char read_only:1, eject:1, - has_request:1, data_dir:1, active:1;unsigned char transfer_cmd;
@@ -694,13 +694,12 @@ static void h_mspro_block_setup_cmd(struct memstick_dev *card, u64 offset,/*** Data transfer ***/ -static int mspro_block_issue_req (struct memstick_dev *card,int chunk) +static int mspro_block_issue_req (struct memstick_dev *card,bool chunk) {struct mspro_block_data *msb =memstick_get_drvdata (card);u64 t_off;unsigned int count; -try_again:while (chunk) { msb->current_page =0 ; msb->current_seg =0 ;
@@ -709,9 +708,17 @@ static int mspro_block_issue_req(struct memstick_dev *card, int chunk) msb->req_sg);if (!msb->seg_count) { - chunk =__blk_end_request_cur (msb->block_req, -BLK_STS_RESOURCE ); -continue ; +unsigned int bytes =blk_rq_cur_bytes (msb->block_req); + + chunk =blk_update_request (msb->block_req, +BLK_STS_RESOURCE , + bytes); +if (chunk) +continue ; +__blk_mq_end_request (msb->block_req, +BLK_STS_RESOURCE ); + msb->block_req =NULL ; +break ; } t_off =blk_rq_pos (msb->block_req);
@@ -729,30 +736,22 @@ static int mspro_block_issue_req(struct memstick_dev *card, int chunk)return 0 ; } -dev_dbg (&card->dev,"blk_fetch\n" ); - msb->block_req =blk_fetch_request (msb->queue); -if (!msb->block_req) { -dev_dbg (&card->dev,"issue end\n" ); -return -EAGAIN ; - } - -dev_dbg (&card->dev,"trying again\n" ); - chunk =1 ; - goto try_again; +return 1 ; }static int mspro_block_complete_req (struct memstick_dev *card,int error) {struct mspro_block_data *msb =memstick_get_drvdata (card); -int chunk, cnt; +int cnt; +bool chunk;unsigned int t_len =0 ;unsigned long flags;spin_lock_irqsave (&msb->q_lock, flags); -dev_dbg (&card->dev,"complete %d, %d\n" , msb->has_request ?1 :0 , +dev_dbg (&card->dev,"complete %d, %d\n" , msb->block_req ?1 :0 , error); -if (msb->has_request) { +if (msb->block_req) {/* Nothing to do - not really an error */ if (error == -EAGAIN ) error =0 ;
@@ -777,15 +776,17 @@ static int mspro_block_complete_req(struct memstick_dev *card, int error)if (error && !t_len) t_len =blk_rq_cur_bytes (msb->block_req); - chunk =__blk_end_request (msb->block_req, + chunk =blk_update_request (msb->block_req,errno_to_blk_status (error), t_len); - - error =mspro_block_issue_req (card, chunk); - -if (!error) - goto out; -else - msb->has_request =0 ; +if (chunk) { + error =mspro_block_issue_req (card, chunk); +if (!error) + goto out; + }else { +__blk_mq_end_request (msb->block_req, +errno_to_blk_status (error)); + msb->block_req =NULL ; + } }else {if (!error) error = -EAGAIN ;
@@ -806,8 +807,8 @@ static void mspro_block_stop(struct memstick_dev *card)while (1 ) {spin_lock_irqsave (&msb->q_lock, flags); -if (!msb->has_request) { -blk_stop_queue (msb->queue); +if (!msb->block_req) { +blk_mq_stop_hw_queues (msb->queue); rc =1 ; }spin_unlock_irqrestore (&msb->q_lock, flags);
@@ -822,32 +823,37 @@ static void mspro_block_stop(struct memstick_dev *card)static void mspro_block_start (struct memstick_dev *card) {struct mspro_block_data *msb =memstick_get_drvdata (card); -unsigned long flags; -spin_lock_irqsave (&msb->q_lock, flags); -blk_start_queue (msb->queue); -spin_unlock_irqrestore (&msb->q_lock, flags); +blk_mq_start_hw_queues (msb->queue); } -static void mspro_block_submit_req (struct request_queue *q) +static blk_status_t mspro_queue_rq (struct blk_mq_hw_ctx *hctx, +const struct blk_mq_queue_data *bd) { -struct memstick_dev *card = q->queuedata; +struct memstick_dev *card = hctx->queue->queuedata;struct mspro_block_data *msb =memstick_get_drvdata (card); -struct request *req =NULL ; -if (msb->has_request) -return ; +spin_lock_irq (&msb->q_lock); -if (msb->eject) { -while ((req =blk_fetch_request (q)) !=NULL ) -__blk_end_request_all (req,BLK_STS_IOERR ); +if (msb->block_req) { +spin_unlock_irq (&msb->q_lock); +return BLK_STS_DEV_RESOURCE ; + } -return ; +if (msb->eject) { +spin_unlock_irq (&msb->q_lock); +blk_mq_start_request (bd->rq); +return BLK_STS_IOERR ; } - msb->has_request =1 ; -if (mspro_block_issue_req (card,0 )) - msb->has_request =0 ; + msb->block_req = bd->rq; +blk_mq_start_request (bd->rq); + +if (mspro_block_issue_req (card, true)) + msb->block_req =NULL ; + +spin_unlock_irq (&msb->q_lock); +return BLK_STS_OK ; }/*** Initialization ***/
@@ -1167,6 +1173,10 @@ static int mspro_block_init_card(struct memstick_dev *card) } +static const struct blk_mq_ops mspro_mq_ops = { + .queue_rq = mspro_queue_rq, +}; +static int mspro_block_init_disk (struct memstick_dev *card) {struct mspro_block_data *msb =memstick_get_drvdata (card);
@@ -1206,9 +1216,11 @@ static int mspro_block_init_disk(struct memstick_dev *card) goto out_release_id; } - msb->queue =blk_init_queue (mspro_block_submit_req, &msb->q_lock); -if (!msb->queue) { - rc = -ENOMEM ; + msb->queue =blk_mq_init_sq_queue (&msb->tag_set, &mspro_mq_ops,2 , +BLK_MQ_F_SHOULD_MERGE ); +if (IS_ERR (msb->queue)) { + rc =PTR_ERR (msb->queue); + msb->queue =NULL ; goto out_put_disk; }
@@ -1318,13 +1330,14 @@ static void mspro_block_remove(struct memstick_dev *card)spin_lock_irqsave (&msb->q_lock, flags); msb->eject =1 ; -blk_start_queue (msb->queue);spin_unlock_irqrestore (&msb->q_lock, flags); +blk_mq_start_hw_queues (msb->queue);del_gendisk (msb->disk);dev_dbg (&card->dev,"mspro block remove\n" );blk_cleanup_queue (msb->queue); +blk_mq_free_tag_set (&msb->tag_set); msb->queue =NULL ;sysfs_remove_group (&card->dev.kobj, &msb->attr_group);
@@ -1344,8 +1357,9 @@ static int mspro_block_suspend(struct memstick_dev *card, pm_message_t state)struct mspro_block_data *msb =memstick_get_drvdata (card);unsigned long flags; +blk_mq_stop_hw_queues (msb->queue); +spin_lock_irqsave (&msb->q_lock, flags); -blk_stop_queue (msb->queue); msb->active =0 ;spin_unlock_irqrestore (&msb->q_lock, flags);
@@ -1355,7 +1369,6 @@ static int mspro_block_suspend(struct memstick_dev *card, pm_message_t state)static int mspro_block_resume (struct memstick_dev *card) {struct mspro_block_data *msb =memstick_get_drvdata (card); -unsigned long flags;int rc =0 ;#ifdef CONFIG_MEMSTICK_UNSAFE_RESUME
@@ -1401,9 +1414,7 @@ static int mspro_block_resume(struct memstick_dev *card)#endif /* CONFIG_MEMSTICK_UNSAFE_RESUME */ -spin_lock_irqsave (&msb->q_lock, flags); -blk_start_queue (msb->queue); -spin_unlock_irqrestore (&msb->q_lock, flags); +blk_mq_start_hw_queues (msb->queue);return rc; }
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 4/28 ide: convert to blk-mq
In reply to Jens Axboeide-disk and ide-cd tested as working just fine, ide-tape and ide-floppy haven't. But the latter don't require changes, so they should work without issue.
Add helper function to insert a request from a work queue, since we cannot invoke the blk-mq request insertion from IRQ context.
--- drivers/ide/ide-atapi.c | 25 ++++-- drivers/ide/ide-cd.c | 175 +++++++++++++++++++++------------------- drivers/ide/ide-disk.c | 5 +- drivers/ide/ide-io.c | 101 +++++++++++++---------- drivers/ide/ide-park.c | 4 +- drivers/ide/ide-pm.c | 28 ++----- drivers/ide/ide-probe.c | 68 +++++++++++----- include/linux/ide.h | 13 ++- 8 files changed, 240 insertions(+), 179 deletions(-)
drivers/ide/ide-atapi.c +17 -8
@@ -172,8 +172,8 @@ EXPORT_SYMBOL_GPL(ide_create_request_sense_cmd);void ide_prep_sense (ide_drive_t *drive,struct request *rq) {struct request_sense *sense = &drive->sense_data; -struct request *sense_rq = drive->sense_rq; -struct scsi_request *req =scsi_req (sense_rq); +struct request *sense_rq; +struct scsi_request *req;unsigned int cmd_len, sense_len;int err;
@@ -196,9 +196,16 @@ void ide_prep_sense(ide_drive_t *drive, struct request *rq)if (ata_sense_request (rq) || drive->sense_rq_armed)return ; + sense_rq = drive->sense_rq; +if (!sense_rq) { + sense_rq =blk_mq_alloc_request (drive->queue,REQ_OP_DRV_IN , +BLK_MQ_REQ_RESERVED |BLK_MQ_REQ_NOWAIT ); + drive->sense_rq = sense_rq; + } + req =scsi_req (sense_rq); +memset (sense,0 ,sizeof (*sense)); -blk_rq_init (rq->q, sense_rq);scsi_req_init (req); err = blk_rq_map_kern(drive->queue, sense_rq, sense, sense_len,
@@ -207,6 +214,8 @@ void ide_prep_sense(ide_drive_t *drive, struct request *rq)if (printk_ratelimit ()) printk(KERN_WARNING PFX "%s: failed to map sense ""buffer\n" , drive->name); +blk_mq_free_request (sense_rq); + drive->sense_rq =NULL ;return ; }
@@ -226,6 +235,8 @@ EXPORT_SYMBOL_GPL(ide_prep_sense);int ide_queue_sense_rq (ide_drive_t *drive,void *special) { +struct request *sense_rq = drive->sense_rq; +/* deferred failure from ide_prep_sense() */ if (!drive->sense_rq_armed) { printk(KERN_WARNING PFX "%s: error queuing a sense request\n",
@@ -233,12 +244,12 @@ int ide_queue_sense_rq(ide_drive_t *drive, void *special)return -ENOMEM ; } - drive->sense_rq->special = special; + sense_rq->special = special; drive->sense_rq_armed = false; drive->hwif->rq =NULL ; -elv_add_request (drive->queue, drive->sense_rq,ELEVATOR_INSERT_FRONT ); +ide_insert_request_head (drive, sense_rq);return 0 ; }EXPORT_SYMBOL_GPL (ide_queue_sense_rq);
@@ -270,10 +281,8 @@ void ide_retry_pc(ide_drive_t *drive)*/ drive->hwif->rq =NULL ;ide_requeue_and_plug (drive, failed_rq); -if (ide_queue_sense_rq (drive, pc)) { -blk_start_request (failed_rq); +if (ide_queue_sense_rq (drive, pc))ide_complete_rq (drive,BLK_STS_IOERR ,blk_rq_bytes (failed_rq)); - } }EXPORT_SYMBOL_GPL (ide_retry_pc);
drivers/ide/ide-cd.c +94 -81
227 lines not on this page · raw message
drivers/ide/ide-disk.c +2 -3
@@ -427,9 +427,8 @@ static void ide_disk_unlock_native_capacity(ide_drive_t *drive) drive->dev_flags |=IDE_DFLAG_NOHPA ;/* disable HPA on resume */ } -static int idedisk_prep_fn (struct request_queue *q,struct request *rq) +static int idedisk_prep_fn (ide_drive_t *drive,struct request *rq) { -ide_drive_t *drive = q->queuedata;struct ide_cmd *cmd;if (req_op (rq) !=REQ_OP_FLUSH )
@@ -548,7 +547,7 @@ static void update_flush(ide_drive_t *drive)if (barrier) { wc = true; -blk_queue_prep_rq (drive->queue, idedisk_prep_fn); + drive->prep_rq = idedisk_prep_fn; } }
drivers/ide/ide-io.c +57 -44
175 lines not on this page · raw message
drivers/ide/ide-park.c +2 -2
@@ -27,7 +27,7 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout)spin_unlock_irq (&hwif->lock);if (start_queue) -blk_run_queue (q); +blk_mq_run_hw_queues (q, true);return ; }spin_unlock_irq (&hwif->lock);
@@ -54,7 +54,7 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout)scsi_req (rq)->cmd[0 ] =REQ_UNPARK_HEADS ;scsi_req (rq)->cmd_len =1 ;ide_req (rq)->type =ATA_PRIV_MISC ; -elv_add_request (q, rq,ELEVATOR_INSERT_FRONT ); +ide_insert_request_head (drive, rq); out:return ;
drivers/ide/ide-pm.c +7 -21
@@ -40,32 +40,20 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg)return ret; } -static void ide_end_sync_rq (struct request *rq,blk_status_t error) -{ -complete (rq->end_io_data); -} -static int ide_pm_execute_rq (struct request *rq) {struct request_queue *q = rq->q; -DECLARE_COMPLETION_ONSTACK (wait); - - rq->end_io_data = &wait; - rq->end_io = ide_end_sync_rq;spin_lock_irq (q->queue_lock);if (unlikely (blk_queue_dying (q))) { rq->rq_flags |=RQF_QUIET ;scsi_req (rq)->result = -ENXIO ; -__blk_end_request_all (rq,BLK_STS_OK );spin_unlock_irq (q->queue_lock); +blk_mq_end_request (rq,BLK_STS_OK );return -ENXIO ; } -__elv_add_request (q, rq,ELEVATOR_INSERT_FRONT ); -__blk_run_queue_uncond (q);spin_unlock_irq (q->queue_lock); - -wait_for_completion_io (&wait); +blk_execute_rq (q,NULL , rq, true);return scsi_req (rq)->result ? -EIO :0 ; }
@@ -79,6 +67,8 @@ int generic_ide_resume(struct device *dev)struct ide_pm_state rqpm;int err; +blk_mq_start_stopped_hw_queues (drive->queue, true); +if (ide_port_acpi (hwif)) {/* call ACPI _PS0 / _STM only once */ if ((drive->dn &1 ) ==0 || pair ==NULL ) {
@@ -226,15 +216,14 @@ void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq)#endif spin_lock_irqsave (q->queue_lock, flags);if (ide_req (rq)->type ==ATA_PRIV_PM_SUSPEND ) -blk_stop_queue (q); +blk_mq_stop_hw_queues (q);else drive->dev_flags &= ~IDE_DFLAG_BLOCKED ;spin_unlock_irqrestore (q->queue_lock, flags); drive->hwif->rq =NULL ; -if (blk_end_request (rq,BLK_STS_OK ,0 )) -BUG (); +blk_mq_end_request (rq,BLK_STS_OK ); }void ide_check_pm_state (ide_drive_t *drive,struct request *rq)
@@ -260,7 +249,6 @@ void ide_check_pm_state(ide_drive_t *drive, struct request *rq)ide_hwif_t *hwif = drive->hwif;const struct ide_tp_ops *tp_ops = hwif->tp_ops;struct request_queue *q = drive->queue; -unsigned long flags;int rc;#ifdef DEBUG_PM printk ("%s: Wakeup request inited, waiting for !BSY...\n" , drive->name);
@@ -274,8 +262,6 @@ void ide_check_pm_state(ide_drive_t *drive, struct request *rq)if (rc)printk (KERN_WARNING "%s: drive not ready on wakeup\n" , drive->name); -spin_lock_irqsave (q->queue_lock, flags); -blk_start_queue (q); -spin_unlock_irqrestore (q->queue_lock, flags); +blk_mq_start_hw_queues (q); } }
drivers/ide/ide-probe.c +50 -18
135 lines not on this page · raw message
include/linux/ide.h +11 -2
@@ -10,7 +10,7 @@#include <linux/init.h> #include <linux/ioport.h> #include <linux/ata.h> -#include <linux/blkdev.h> +#include <linux/blk-mq.h> #include <linux/proc_fs.h> #include <linux/interrupt.h> #include <linux/bitops.h>
@@ -529,6 +529,10 @@ struct ide_drive_s {struct request_queue *queue;/* request queue */ +int (*prep_rq)(struct ide_drive_s *,struct request *); + +struct blk_mq_tag_set tag_set; +struct request *rq;/* current request */ void *driver_data;/* extra driver data */ u16 *id;/* identification info */
@@ -612,6 +616,10 @@ struct ide_drive_s {bool sense_rq_armed;struct request *sense_rq;struct request_sense sense_data; + +/* async sense insertion */ +struct work_struct rq_work; +struct list_head rq_list; };typedef struct ide_drive_s ide_drive_t ;
@@ -1089,6 +1097,7 @@ extern int ide_pci_clk;int ide_end_rq (ide_drive_t *,struct request *,blk_status_t ,unsigned int );void ide_kill_rq (ide_drive_t *,struct request *); +void ide_insert_request_head (ide_drive_t *,struct request *);void __ide_set_handler (ide_drive_t *,ide_handler_t *,unsigned int );void ide_set_handler (ide_drive_t *,ide_handler_t *,unsigned int );
@@ -1208,7 +1217,7 @@ extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout);extern void ide_timer_expiry (struct timer_list *t);extern irqreturn_t ide_intr (int irq,void *dev_id); -extern void do_ide_request (struct request_queue *); +extern blk_status_t ide_queue_rq (struct blk_mq_hw_ctx *,const struct blk_mq_queue_data *);extern void ide_requeue_and_plug (ide_drive_t *drive,struct request *rq);void ide_init_disk (struct gendisk *,ide_drive_t *);
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 5/28 IB/srp: remove old request_fn_active check
In reply to Jens AxboeThis check is only viable for non scsi-mq. Since that is going away, kill this legacy check.
--- drivers/infiniband/ulp/srp/ib_srp.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/infiniband/ulp/srp/ib_srp.c +0 -7
@@ -1334,13 +1334,6 @@ static void srp_terminate_io(struct srp_rport *rport)struct scsi_device *sdev;int i, j; -/* -* Invoking srp_terminate_io() while srp_queuecommand() is running -* is not safe. Hence the warning statement below. -*/ -shost_for_each_device (sdev, shost) -WARN_ON_ONCE (sdev->request_queue->request_fn_active); -for (i =0 ; i < target->ch_count; i++) { ch = &target->ch[i];
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 6/28 blk-mq: remove the request_list usage
In reply to Jens AxboeWe don't do anything with it, that's just the legacy path.
--- block/blk-mq.c | 5 ----- 1 file changed, 5 deletions(-)
block/blk-mq.c +0 -5
@@ -510,9 +510,6 @@ void blk_mq_free_request(struct request *rq)rq_qos_done (q, rq); -if (blk_rq_rl (rq)) -blk_put_rl (blk_rq_rl (rq)); -WRITE_ONCE (rq->state,MQ_RQ_IDLE );if (refcount_dec_and_test (&rq->ref))__blk_mq_free_request (rq);
@@ -1675,8 +1672,6 @@ static void blk_mq_bio_to_request(struct request *rq, struct bio *bio) {blk_init_request_from_bio (rq, bio); -blk_rq_set_rl (rq,blk_get_rl (rq->q, bio)); -blk_account_io_start (rq, true); }
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 7/28 blk-mq: remove legacy check in queue blk_freeze_queue()
In reply to Jens Axboe--- block/blk-mq.c | 2 -- 1 file changed, 2 deletions(-)
block/blk-mq.c +0 -2
@@ -177,8 +177,6 @@ void blk_freeze_queue(struct request_queue *q)* exported to drivers as the only user for unfreeze is blk_mq. */ blk_freeze_queue_start (q); -if (!q->mq_ops) -blk_drain_queue (q);blk_mq_freeze_queue_wait (q); }
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 8/28 scsi: kill off the legacy IO path
In reply to Jens Axboe--- Documentation/scsi/scsi-parameters.txt | 5 - drivers/scsi/Kconfig | 12 - drivers/scsi/cxlflash/main.c | 6 - drivers/scsi/hosts.c | 29 +- drivers/scsi/lpfc/lpfc_scsi.c | 2 +- drivers/scsi/qedi/qedi_main.c | 3 +- drivers/scsi/qla2xxx/qla_os.c | 30 +- drivers/scsi/scsi.c | 5 +- drivers/scsi/scsi_debug.c | 3 +- drivers/scsi/scsi_error.c | 2 +- drivers/scsi/scsi_lib.c | 624 ++----------------------- drivers/scsi/scsi_priv.h | 1 - drivers/scsi/scsi_scan.c | 10 +- drivers/scsi/scsi_sysfs.c | 8 +- drivers/scsi/ufs/ufshcd.c | 6 - include/scsi/scsi_host.h | 18 +- include/scsi/scsi_tcq.h | 14 +- 17 files changed, 73 insertions(+), 705 deletions(-)
Documentation/scsi/scsi-parameters.txt +0 -5
@@ -97,11 +97,6 @@ parameters may be changed at runtime by the command allowing boot to proceed. none ignores them, expecting user space to do the scan. - scsi_mod.use_blk_mq= - [SCSI] use blk-mq I/O path by default - See SCSI_MQ_DEFAULT in drivers/scsi/Kconfig. - Format: <y/n> - sim710= [SCSI,HW] See header of drivers/scsi/sim710.c.
drivers/scsi/Kconfig +0 -12
@@ -50,18 +50,6 @@ config SCSI_NETLINK default n depends on NET -config SCSI_MQ_DEFAULT - bool "SCSI: use blk-mq I/O path by default" - default y - depends on SCSI - ---help--- - This option enables the blk-mq based I/O path for SCSI devices by - default. With this option the scsi_mod.use_blk_mq module/boot - option defaults to Y, without it to N, but it can still be - overridden either way. - - If unsure say Y. - config SCSI_PROC_FS bool "legacy /proc/scsi/ support" depends on SCSI && PROC_FS
drivers/scsi/cxlflash/main.c +0 -6
@@ -3088,12 +3088,6 @@ static ssize_t hwq_mode_store(struct device *dev,return -EINVAL ; } -if ((mode ==HWQ_MODE_TAG ) && !shost_use_blk_mq (shost)) { -dev_info (cfgdev,"SCSI-MQ is not enabled, use a different " -"HWQ steering mode.\n" ); -return -EINVAL ; - } - afu->hwq_mode = mode;return count;
drivers/scsi/hosts.c +6 -23
@@ -222,18 +222,9 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,if (error) goto fail; -if (shost_use_blk_mq (shost)) { - error =scsi_mq_setup_tags (shost); -if (error) - goto fail; - }else { - shost->bqt =blk_init_tags (shost->can_queue, - shost->hostt->tag_alloc_policy); -if (!shost->bqt) { - error = -ENOMEM ; - goto fail; - } - } + error =scsi_mq_setup_tags (shost); +if (error) + goto fail;if (!shost->shost_gendev.parent) shost->shost_gendev.parent = dev ? dev : &platform_bus;
@@ -309,8 +300,7 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,pm_runtime_disable (&shost->shost_gendev);pm_runtime_set_suspended (&shost->shost_gendev);pm_runtime_put_noidle (&shost->shost_gendev); -if (shost_use_blk_mq (shost)) -scsi_mq_destroy_tags (shost); +scsi_mq_destroy_tags (shost); fail:return error; }
@@ -344,13 +334,8 @@ static void scsi_host_dev_release(struct device *dev)kfree (dev_name (&shost->shost_dev)); } -if (shost_use_blk_mq (shost)) { -if (shost->tag_set.tags) -scsi_mq_destroy_tags (shost); - }else { -if (shost->bqt) -blk_free_tags (shost->bqt); - } +if (shost->tag_set.tags) +scsi_mq_destroy_tags (shost);kfree (shost->shost_data);
@@ -472,8 +457,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)else shost->dma_boundary =0xffffffff ; - shost->use_blk_mq = scsi_use_blk_mq || shost->hostt->force_blk_mq; -device_initialize (&shost->shost_gendev);dev_set_name (&shost->shost_gendev,"host%d" , shost->host_no); shost->shost_gendev.bus = &scsi_bus_type;
drivers/scsi/lpfc/lpfc_scsi.c +1 -1
@@ -3914,7 +3914,7 @@ int lpfc_sli4_scmd_to_wqidx_distr(struct lpfc_hba *phba,uint32_t tag;uint16_t hwq; -if (cmnd &&shost_use_blk_mq (cmnd->device->host)) { +if (cmnd) { tag =blk_mq_unique_tag (cmnd->request); hwq =blk_mq_unique_tag_to_hwq (tag);
drivers/scsi/qedi/qedi_main.c +1 -2
@@ -644,8 +644,7 @@ static struct qedi_ctx *qedi_host_alloc(struct pci_dev *pdev) qedi->max_active_conns =ISCSI_MAX_SESS_PER_HBA ; qedi->max_sqes =QEDI_SQ_SIZE ; -if (shost_use_blk_mq (shost)) - shost->nr_hw_queues =MIN_NUM_CPUS_MSIX (qedi); + shost->nr_hw_queues =MIN_NUM_CPUS_MSIX (qedi);pci_set_drvdata (pdev, qedi);
drivers/scsi/qla2xxx/qla_os.c +9 -21
@@ -857,13 +857,9 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) }if (ha->mqenable) { -if (shost_use_blk_mq (vha->host)) { - tag =blk_mq_unique_tag (cmd->request); - hwq =blk_mq_unique_tag_to_hwq (tag); - qpair = ha->queue_pair_map[hwq]; - }else if (vha->vp_idx && vha->qpair) { - qpair = vha->qpair; - } + tag =blk_mq_unique_tag (cmd->request); + hwq =blk_mq_unique_tag_to_hwq (tag); + qpair = ha->queue_pair_map[hwq];if (qpair)return qla2xxx_mqueuecommand (host, cmd, qpair);
@@ -3153,7 +3149,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) goto probe_failed; } -if (ha->mqenable &&shost_use_blk_mq (host)) { +if (ha->mqenable) {/* number of hardware queues supported by blk/scsi-mq*/ host->nr_hw_queues = ha->max_qpairs;
@@ -3265,25 +3261,17 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) base_vha->mgmt_svr_loop_id, host->sg_tablesize);if (ha->mqenable) { -bool mq = false;bool startit = false; -if (QLA_TGT_MODE_ENABLED ()) { - mq = true; +if (QLA_TGT_MODE_ENABLED ()) startit = false; - } -if ((ql2x_ini_mode ==QLA2XXX_INI_MODE_ENABLED ) && -shost_use_blk_mq (host)) { - mq = true; +if (ql2x_ini_mode ==QLA2XXX_INI_MODE_ENABLED ) startit = true; - } -if (mq) { -/* Create start of day qpairs for Block MQ */ -for (i =0 ; i < ha->max_qpairs; i++) -qla2xxx_create_qpair (base_vha,5 ,0 , startit); - } +/* Create start of day qpairs for Block MQ */ +for (i =0 ; i < ha->max_qpairs; i++) +qla2xxx_create_qpair (base_vha,5 ,0 , startit); }if (ha->flags.running_gold_fw)
drivers/scsi/scsi.c +1 -4
@@ -780,11 +780,8 @@ MODULE_LICENSE("GPL");module_param (scsi_logging_level, int,S_IRUGO |S_IWUSR );MODULE_PARM_DESC (scsi_logging_level,"a bit mask of logging levels" ); -#ifdef CONFIG_SCSI_MQ_DEFAULT +/* Kill module parameter */ bool scsi_use_blk_mq = true; -#else -bool scsi_use_blk_mq = false; -#endif module_param_named (use_blk_mq, scsi_use_blk_mq, bool,S_IWUSR |S_IRUGO );static int __init init_scsi (void )
drivers/scsi/scsi_debug.c +1 -2
@@ -5881,8 +5881,7 @@ static int sdebug_driver_probe(struct device *dev) }/* Decide whether to tell scsi subsystem that we want mq */ /* Following should give the same answer for each host */ -if (shost_use_blk_mq (hpnt)) - hpnt->nr_hw_queues = submit_queues; + hpnt->nr_hw_queues = submit_queues; sdbg_host->shost = hpnt; *((struct sdebug_host_info **)hpnt->hostdata) = sdbg_host;
drivers/scsi/scsi_error.c +1 -1
@@ -308,7 +308,7 @@ enum blk_eh_timer_return scsi_times_out(struct request *req)* error handler. In that case we can return immediately as no * further action is required. */ -if (req->q->mq_ops && !blk_mq_mark_complete (req)) +if (!blk_mq_mark_complete (req))return rtn;if (scsi_abort_command (scmd) !=SUCCESS ) {set_host_byte (scmd,DID_TIME_OUT );
drivers/scsi/scsi_lib.c +38 -586
761 lines not on this page · raw message
drivers/scsi/scsi_priv.h +0 -1
@@ -92,7 +92,6 @@ extern void scsi_queue_insert(struct scsi_cmnd *cmd, int reason);extern void scsi_io_completion (struct scsi_cmnd *,unsigned int );extern void scsi_run_host_queues (struct Scsi_Host *shost);extern void scsi_requeue_run_queue (struct work_struct *work); -extern struct request_queue *scsi_old_alloc_queue (struct scsi_device *sdev);extern struct request_queue *scsi_mq_alloc_queue (struct scsi_device *sdev);extern void scsi_start_queue (struct scsi_device *sdev);extern int scsi_mq_setup_tags (struct Scsi_Host *shost);
drivers/scsi/scsi_scan.c +1 -9
@@ -266,10 +266,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,*/ sdev->borken =1 ; -if (shost_use_blk_mq (shost)) - sdev->request_queue =scsi_mq_alloc_queue (sdev); -else - sdev->request_queue =scsi_old_alloc_queue (sdev); + sdev->request_queue =scsi_mq_alloc_queue (sdev);if (!sdev->request_queue) {/* release fn is set up in scsi_sysfs_device_initialise, so * have to free and put manually here */
@@ -280,11 +277,6 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,WARN_ON_ONCE (!blk_get_queue (sdev->request_queue)); sdev->request_queue->queuedata = sdev; -if (!shost_use_blk_mq (sdev->host)) { -blk_queue_init_tags (sdev->request_queue, - sdev->host->cmd_per_lun, shost->bqt, - shost->hostt->tag_alloc_policy); - }scsi_change_queue_depth (sdev, sdev->host->cmd_per_lun ? sdev->host->cmd_per_lun :1 );
drivers/scsi/scsi_sysfs.c +7 -1
@@ -367,7 +367,6 @@ store_shost_eh_deadline(struct device *dev, struct device_attribute *attr, static DEVICE_ATTR(eh_deadline, S_IRUGO | S_IWUSR, show_shost_eh_deadline, store_shost_eh_deadline); -shost_rd_attr (use_blk_mq,"%d\n" );shost_rd_attr (unique_id,"%u\n" );shost_rd_attr (cmd_per_lun,"%hd\n" );shost_rd_attr (can_queue,"%hd\n" );
@@ -386,6 +385,13 @@ show_host_busy(struct device *dev, struct device_attribute *attr, char *buf) } static DEVICE_ATTR(host_busy, S_IRUGO, show_host_busy, NULL); +static ssize_t +show_use_blk_mq (struct device *dev,struct device_attribute *attr,char *buf) +{ +return snprintf (buf,20 ,"1\n" ); +} +static DEVICE_ATTR(use_blk_mq, S_IRUGO, show_use_blk_mq, NULL); +static struct attribute *scsi_sysfs_shost_attrs[] = { &dev_attr_use_blk_mq.attr, &dev_attr_unique_id.attr,
drivers/scsi/ufs/ufshcd.c +0 -6
@@ -8100,12 +8100,6 @@ int ufshcd_alloc_host(struct device *dev, struct ufs_hba **hba_handle) goto out_error; } -/* -* Do not use blk-mq at this time because blk-mq does not support -* runtime pm. -*/ - host->use_blk_mq = false; - hba =shost_priv (host); hba->host = host; hba->dev = dev;
include/scsi/scsi_host.h +2 -16
@@ -11,7 +11,6 @@#include <linux/blk-mq.h> #include <scsi/scsi.h> -struct request_queue ;struct block_device ;struct completion ;struct module ;
@@ -22,7 +21,6 @@ struct scsi_target;struct Scsi_Host ;struct scsi_host_cmd_pool ;struct scsi_transport_template ; -struct blk_queue_tags ;/*
@@ -547,14 +545,8 @@ struct Scsi_Host {struct scsi_host_template *hostt;struct scsi_transport_template *transportt; -/* -* Area to keep a shared tag map (if needed, will be -* NULL if not). -*/ -union { -struct blk_queue_tag *bqt; -struct blk_mq_tag_set tag_set; - }; +/* Area to keep a shared tag map */ +struct blk_mq_tag_set tag_set;atomic_t host_busy;/* commands actually active on low-level */ atomic_t host_blocked;
@@ -648,7 +640,6 @@ struct Scsi_Host {/* The controller does not support WRITE SAME */ unsigned no_write_same:1; - unsigned use_blk_mq:1; unsigned use_cmd_list:1;/* Host responded with short (<36 bytes) INQUIRY result */
@@ -742,11 +733,6 @@ static inline int scsi_host_in_recovery(struct Scsi_Host *shost) shost->tmf_in_progress; } -static inline bool shost_use_blk_mq (struct Scsi_Host *shost) -{ -return shost->use_blk_mq; -} -extern int scsi_queue_work (struct Scsi_Host *,struct work_struct *);extern void scsi_flush_work (struct Scsi_Host *);
include/scsi/scsi_tcq.h +5 -9
@@ -23,19 +23,15 @@ static inline struct scsi_cmnd *scsi_host_find_tag(struct Scsi_Host *shost, int tag) {struct request *req =NULL ; +u16 hwq;if (tag ==SCSI_NO_TAG )return NULL ; -if (shost_use_blk_mq (shost)) { -u16 hwq =blk_mq_unique_tag_to_hwq (tag); - -if (hwq < shost->tag_set.nr_hw_queues) { - req =blk_mq_tag_to_rq (shost->tag_set.tags[hwq], -blk_mq_unique_tag_to_tag (tag)); - } - }else { - req =blk_map_queue_find_tag (shost->bqt, tag); + hwq =blk_mq_unique_tag_to_hwq (tag); +if (hwq < shost->tag_set.nr_hw_queues) { + req =blk_mq_tag_to_rq (shost->tag_set.tags[hwq], +blk_mq_unique_tag_to_tag (tag)); }if (!req)
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 9/28 dm: remove legacy IO path
In reply to Jens Axboedm supports both, and since we're killing off the legacy path in general, get rid of it in dm as well.
--- drivers/md/Kconfig | 11 -- drivers/md/dm-core.h | 10 -- drivers/md/dm-mpath.c | 14 +- drivers/md/dm-rq.c | 293 ++++-------------------------------------- drivers/md/dm-rq.h | 4 - drivers/md/dm-sysfs.c | 3 +- drivers/md/dm-table.c | 36 +----- drivers/md/dm.c | 21 +-- drivers/md/dm.h | 1 - 9 files changed, 35 insertions(+), 358 deletions(-)
drivers/md/Kconfig +0 -11
@@ -215,17 +215,6 @@ config BLK_DEV_DM If unsure, say N. -config DM_MQ_DEFAULT - bool "request-based DM: use blk-mq I/O path by default" - depends on BLK_DEV_DM - ---help--- - This option enables the blk-mq based I/O path for request-based - DM devices by default. With the option the dm_mod.use_blk_mq - module/boot option defaults to Y, without it to N, but it can - still be overriden either way. - - If unsure say N. - config DM_DEBUG bool "Device mapper debugging support" depends on BLK_DEV_DM
drivers/md/dm-core.h +0 -10
@@ -112,18 +112,8 @@ struct mapped_device {struct dm_stats stats; -struct kthread_worker kworker; -struct task_struct *kworker_task; - -/* for request-based merge heuristic in dm_request_fn() */ -unsigned seq_rq_merge_deadline_usecs; -int last_rq_rw; -sector_t last_rq_pos; -ktime_t last_rq_start_time; -/* for blk-mq request-based DM support */ struct blk_mq_tag_set *tag_set; - bool use_blk_mq:1; bool init_tio_pdu:1;struct srcu_struct io_barrier;
drivers/md/dm-mpath.c +2 -12
@@ -203,14 +203,7 @@ static struct multipath *alloc_multipath(struct dm_target *ti)static int alloc_multipath_stage2 (struct dm_target *ti,struct multipath *m) {if (m->queue_mode ==DM_TYPE_NONE ) { -/* -* Default to request-based. -*/ -if (dm_use_blk_mq (dm_table_get_md (ti->table))) - m->queue_mode =DM_TYPE_MQ_REQUEST_BASED ; -else - m->queue_mode =DM_TYPE_REQUEST_BASED ; - + m->queue_mode =DM_TYPE_MQ_REQUEST_BASED ; }else if (m->queue_mode ==DM_TYPE_BIO_BASED ) {INIT_WORK (&m->process_queued_bios, process_queued_bios);/*
@@ -537,10 +530,7 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq,* get the queue busy feedback (via BLK_STS_RESOURCE), * otherwise I/O merging can suffer. */ -if (q->mq_ops) -return DM_MAPIO_REQUEUE ; -else -return DM_MAPIO_DELAY_REQUEUE ; +return DM_MAPIO_REQUEUE ; } clone->bio = clone->biotail =NULL ; clone->rq_disk = bdev->bd_disk;
drivers/md/dm-rq.c +25 -268
409 lines not on this page · raw message
drivers/md/dm-rq.h +0 -4
@@ -46,10 +46,6 @@ struct dm_rq_clone_bio_info {struct bio clone; }; -bool dm_use_blk_mq_default (void ); -bool dm_use_blk_mq (struct mapped_device *md); - -int dm_old_init_request_queue (struct mapped_device *md,struct dm_table *t);int dm_mq_init_request_queue (struct mapped_device *md,struct dm_table *t);void dm_mq_cleanup_mapped_device (struct mapped_device *md);
drivers/md/dm-sysfs.c +2 -1
@@ -92,7 +92,8 @@ static ssize_t dm_attr_suspended_show(struct mapped_device *md, char *buf)static ssize_t dm_attr_use_blk_mq_show (struct mapped_device *md,char *buf) { -sprintf (buf,"%d\n" ,dm_use_blk_mq (md)); +/* Purely for userspace compatibility */ +sprintf (buf,"%d\n" , true);return strlen (buf); }
drivers/md/dm-table.c +5 -31
@@ -47,7 +47,6 @@ struct dm_table { bool integrity_supported:1; bool singleton:1; - bool all_blk_mq:1; unsigned integrity_added:1;/*
@@ -921,10 +920,7 @@ static int device_is_rq_based(struct dm_target *ti, struct dm_dev *dev,struct request_queue *q =bdev_get_queue (dev->bdev);struct verify_rq_based_data *v = data; -if (q->mq_ops) - v->mq_count++; -else - v->sq_count++; + v->mq_count++;return queue_is_rq_based (q); }
@@ -1022,11 +1018,9 @@ static int dm_table_determine_type(struct dm_table *t)int srcu_idx;struct dm_table *live_table =dm_get_live_table (t->md, &srcu_idx); -/* inherit live table's type and all_blk_mq */ -if (live_table) { +/* inherit live table's type */ +if (live_table) t->type = live_table->type; - t->all_blk_mq = live_table->all_blk_mq; - }dm_put_live_table (t->md, srcu_idx);return 0 ; }
@@ -1050,13 +1044,6 @@ static int dm_table_determine_type(struct dm_table *t)DMERR ("table load rejected: not all devices are blk-mq request-stackable" );return -EINVAL ; } - t->all_blk_mq = v.mq_count >0 ; - -if (!t->all_blk_mq && - (t->type ==DM_TYPE_MQ_REQUEST_BASED || t->type ==DM_TYPE_NVME_BIO_BASED )) { -DMERR ("table load rejected: all devices are not blk-mq request-stackable" ); -return -EINVAL ; - }return 0 ; }
@@ -1105,11 +1092,6 @@ bool dm_table_request_based(struct dm_table *t)return __table_type_request_based (dm_table_get_type (t)); } -bool dm_table_all_blk_mq_devices (struct dm_table *t) -{ -return t->all_blk_mq; -} -static int dm_table_alloc_md_mempools (struct dm_table *t,struct mapped_device *md) {enum dm_queue_mode type =dm_table_get_type (t);
@@ -2093,22 +2075,14 @@ void dm_table_run_md_queue_async(struct dm_table *t) {struct mapped_device *md;struct request_queue *queue; -unsigned long flags;if (!dm_table_request_based (t))return ; md =dm_table_get_md (t); queue =dm_get_md_queue (md); -if (queue) { -if (queue->mq_ops) -blk_mq_run_hw_queues (queue, true); -else { -spin_lock_irqsave (queue->queue_lock, flags); -blk_run_queue_async (queue); -spin_unlock_irqrestore (queue->queue_lock, flags); - } - } +if (queue) +blk_mq_run_hw_queues (queue, true); }EXPORT_SYMBOL (dm_table_run_md_queue_async);
drivers/md/dm.c +1 -20
@@ -1806,8 +1806,6 @@ static void dm_wq_work(struct work_struct *work);static void dm_init_normal_md_queue (struct mapped_device *md) { - md->use_blk_mq = false; -/* * Initialize aspects of queue that aren't relevant for blk-mq */
@@ -1818,8 +1816,6 @@ static void cleanup_mapped_device(struct mapped_device *md) {if (md->wq)destroy_workqueue (md->wq); -if (md->kworker_task) -kthread_stop (md->kworker_task);bioset_exit (&md->bs);bioset_exit (&md->io_bs);
@@ -1886,7 +1882,6 @@ static struct mapped_device *alloc_dev(int minor) goto bad_io_barrier; md->numa_node_id = numa_node_id; - md->use_blk_mq =dm_use_blk_mq_default (); md->init_tio_pdu = false; md->type =DM_TYPE_NONE ;mutex_init (&md->suspend_lock);
@@ -1917,7 +1912,6 @@ static struct mapped_device *alloc_dev(int minor)INIT_WORK (&md->work, dm_wq_work);init_waitqueue_head (&md->eventq);init_completion (&md->kobj_holder.completion); - md->kworker_task =NULL ; md->disk->major = _major; md->disk->first_minor = minor;
@@ -2217,13 +2211,6 @@ int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t)switch (type) {case DM_TYPE_REQUEST_BASED : -dm_init_normal_md_queue (md); - r =dm_old_init_request_queue (md, t); -if (r) { -DMERR ("Cannot initialize queue for request-based mapped device" ); -return r; - } -break ;case DM_TYPE_MQ_REQUEST_BASED : r =dm_mq_init_request_queue (md, t);if (r) {
@@ -2329,9 +2316,6 @@ static void __dm_destroy(struct mapped_device *md, bool wait)blk_set_queue_dying (md->queue); -if (dm_request_based (md) && md->kworker_task) -kthread_flush_worker (&md->kworker); -/* * Take suspend_lock so that presuspend and postsuspend methods * do not race with internal suspend.
@@ -2584,11 +2568,8 @@ static int __dm_suspend(struct mapped_device *md, struct dm_table *map,* Stop md->queue before flushing md->wq in case request-based * dm defers requests to md->wq from md->queue. */ -if (dm_request_based (md)) { +if (dm_request_based (md))dm_stop_queue (md->queue); -if (md->kworker_task) -kthread_flush_worker (&md->kworker); - }flush_workqueue (md->wq);
drivers/md/dm.h +0 -1
@@ -70,7 +70,6 @@ struct dm_target *dm_table_get_immutable_target(struct dm_table *t);struct dm_target *dm_table_get_wildcard_target (struct dm_table *t);bool dm_table_bio_based (struct dm_table *t);bool dm_table_request_based (struct dm_table *t); -bool dm_table_all_blk_mq_devices (struct dm_table *t);void dm_table_free_md_mempools (struct dm_table *t);struct dm_md_mempools *dm_table_get_md_mempools (struct dm_table *t);
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 10/28 dasd: remove dead code
In reply to Jens AxboeSince e443343e509a we haven't had a request_fn attached to this driver, hence any code inside an if (q->request_fn) is unreachable.
--- drivers/s390/block/dasd_ioctl.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-)
drivers/s390/block/dasd_ioctl.c +5 -17
@@ -412,6 +412,7 @@ static int dasd_ioctl_information(struct dasd_block *block,struct ccw_dev_id dev_id;struct dasd_device *base;struct ccw_device *cdev; +struct list_head *l;unsigned long flags;int rc;
@@ -462,23 +463,10 @@ static int dasd_ioctl_information(struct dasd_block *block,memcpy (dasd_info->type, base->discipline->name,4 ); -if (block->request_queue->request_fn) { -struct list_head *l; -#ifdef DASD_EXTENDED_PROFILING - { -struct list_head *l; -spin_lock_irqsave (&block->lock, flags); -list_for_each (l, &block->request_queue->queue_head) - dasd_info->req_queue_len++; -spin_unlock_irqrestore (&block->lock, flags); - } -#endif /* DASD_EXTENDED_PROFILING */ -spin_lock_irqsave (get_ccwdev_lock (base->cdev), flags); -list_for_each (l, &base->ccw_queue) - dasd_info->chanq_len++; -spin_unlock_irqrestore (get_ccwdev_lock (base->cdev), - flags); - } +spin_lock_irqsave (&block->queue_lock, flags); +list_for_each (l, &base->ccw_queue) + dasd_info->chanq_len++; +spin_unlock_irqrestore (&block->queue_lock, flags); rc =0 ; if (copy_to_user(argp, dasd_info,
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 11/28 bsg: pass in desired timeout handler
In reply to Jens AxboeThis will ease in the conversion to blk-mq, where we can't set a timeout handler after queue init.
--- block/bsg-lib.c | 3 ++- drivers/scsi/scsi_transport_fc.c | 7 +++---- drivers/scsi/scsi_transport_iscsi.c | 2 +- drivers/scsi/scsi_transport_sas.c | 4 ++-- include/linux/bsg-lib.h | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-)
block/bsg-lib.c +2 -1
@@ -304,7 +304,7 @@ static void bsg_exit_rq(struct request_queue *q, struct request *req)* @dd_job_size: size of LLD data needed for each job */ struct request_queue *bsg_setup_queue (struct device *dev,const char *name, -bsg_job_fn *job_fn,int dd_job_size) +bsg_job_fn *job_fn,rq_timed_out_fn *timeout,int dd_job_size) {struct request_queue *q;int ret;
@@ -327,6 +327,7 @@ struct request_queue *bsg_setup_queue(struct device *dev, const char *name,blk_queue_flag_set (QUEUE_FLAG_BIDI , q);blk_queue_softirq_done (q, bsg_softirq_done);blk_queue_rq_timeout (q,BLK_DEFAULT_SG_TIMEOUT ); +blk_queue_rq_timed_out (q, timeout); ret =bsg_register_queue (q, dev, name, &bsg_transport_ops);if (ret) {
drivers/scsi/scsi_transport_fc.c +3 -4
@@ -3780,7 +3780,8 @@ fc_bsg_hostadd(struct Scsi_Host *shost, struct fc_host_attrs *fc_host)snprintf (bsg_name,sizeof (bsg_name),"fc_host%d" , shost->host_no); - q =bsg_setup_queue (dev, bsg_name, fc_bsg_dispatch, i->f->dd_bsg_size); + q =bsg_setup_queue (dev, bsg_name, fc_bsg_dispatch, fc_bsg_job_timeout, + i->f->dd_bsg_size);if (IS_ERR (q)) { dev_err(dev, "fc_host%d: bsg interface failed to initialize - setup queue\n",
@@ -3788,7 +3789,6 @@ fc_bsg_hostadd(struct Scsi_Host *shost, struct fc_host_attrs *fc_host)return PTR_ERR (q); }__scsi_init_queue (shost, q); -blk_queue_rq_timed_out (q, fc_bsg_job_timeout);blk_queue_rq_timeout (q,FC_DEFAULT_BSG_TIMEOUT ); fc_host->rqst_q = q;return 0 ;
@@ -3826,14 +3826,13 @@ fc_bsg_rportadd(struct Scsi_Host *shost, struct fc_rport *rport)return -ENOTSUPP ; q =bsg_setup_queue (dev,dev_name (dev), fc_bsg_dispatch, - i->f->dd_bsg_size); + fc_bsg_job_timeout, i->f->dd_bsg_size);if (IS_ERR (q)) {dev_err (dev,"failed to setup bsg queue\n" );return PTR_ERR (q); }__scsi_init_queue (shost, q);blk_queue_prep_rq (q, fc_bsg_rport_prep); -blk_queue_rq_timed_out (q, fc_bsg_job_timeout);blk_queue_rq_timeout (q,BLK_DEFAULT_SG_TIMEOUT ); rport->rqst_q = q;return 0 ;
drivers/scsi/scsi_transport_iscsi.c +1 -1
@@ -1542,7 +1542,7 @@ iscsi_bsg_host_add(struct Scsi_Host *shost, struct iscsi_cls_host *ihost)return -ENOTSUPP ;snprintf (bsg_name,sizeof (bsg_name),"iscsi_host%d" , shost->host_no); - q =bsg_setup_queue (dev, bsg_name, iscsi_bsg_host_dispatch,0 ); + q =bsg_setup_queue (dev, bsg_name, iscsi_bsg_host_dispatch,NULL ,0 );if (IS_ERR (q)) {shost_printk (KERN_ERR , shost,"bsg interface failed to " "initialize - no request queue\n" );
drivers/scsi/scsi_transport_sas.c +2 -2
@@ -198,7 +198,7 @@ static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy)if (rphy) { q =bsg_setup_queue (&rphy->dev,dev_name (&rphy->dev), - sas_smp_dispatch,0 ); + sas_smp_dispatch,NULL ,0 );if (IS_ERR (q))return PTR_ERR (q); rphy->q = q;
@@ -207,7 +207,7 @@ static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy)snprintf (name,sizeof (name),"sas_host%d" , shost->host_no); q =bsg_setup_queue (&shost->shost_gendev, name, - sas_smp_dispatch,0 ); + sas_smp_dispatch,NULL ,0 );if (IS_ERR (q))return PTR_ERR (q);to_sas_host_attrs (shost)->q = q;
include/linux/bsg-lib.h +1 -1
@@ -72,7 +72,7 @@ struct bsg_job {void bsg_job_done (struct bsg_job *job,int result,unsigned int reply_payload_rcv_len);struct request_queue *bsg_setup_queue (struct device *dev,const char *name, -bsg_job_fn *job_fn,int dd_job_size); +bsg_job_fn *job_fn,rq_timed_out_fn *timeout,int dd_job_size);void bsg_job_put (struct bsg_job *job);int __must_check bsg_job_get (struct bsg_job *job);
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 12/28 bsg: provide bsg_remove_queue() helper
In reply to Jens AxboeAll drivers do unregister + cleanup, provide a helper for that.
--- block/bsg-lib.c | 7 +++++++ drivers/scsi/scsi_transport_fc.c | 6 ++---- drivers/scsi/scsi_transport_iscsi.c | 7 +++---- drivers/scsi/scsi_transport_sas.c | 6 ++---- include/linux/bsg-lib.h | 1 + 5 files changed, 15 insertions(+), 12 deletions(-)
block/bsg-lib.c +7 -0
@@ -296,6 +296,13 @@ static void bsg_exit_rq(struct request_queue *q, struct request *req)kfree (job->reply); } +void bsg_remove_queue (struct request_queue *q) +{ +bsg_unregister_queue (q); +blk_cleanup_queue (q); +} +EXPORT_SYMBOL_GPL (bsg_remove_queue); +/** * bsg_setup_queue - Create and add the bsg hooks so we can receive requests * @dev: device to attach bsg device to
drivers/scsi/scsi_transport_fc.c +2 -4
@@ -3851,10 +3851,8 @@ fc_bsg_rportadd(struct Scsi_Host *shost, struct fc_rport *rport)static void fc_bsg_remove (struct request_queue *q) { -if (q) { -bsg_unregister_queue (q); -blk_cleanup_queue (q); - } +if (q) +bsg_remove_queue (q); }
drivers/scsi/scsi_transport_iscsi.c +3 -4
@@ -1576,10 +1576,9 @@ static int iscsi_remove_host(struct transport_container *tc,struct Scsi_Host *shost =dev_to_shost (dev);struct iscsi_cls_host *ihost = shost->shost_data; -if (ihost->bsg_q) { -bsg_unregister_queue (ihost->bsg_q); -blk_cleanup_queue (ihost->bsg_q); - } +if (ihost->bsg_q) +bsg_remove_queue (ihost->bsg_q); +return 0 ; }
drivers/scsi/scsi_transport_sas.c +2 -4
@@ -246,10 +246,8 @@ static int sas_host_remove(struct transport_container *tc, struct device *dev,struct Scsi_Host *shost =dev_to_shost (dev);struct request_queue *q =to_sas_host_attrs (shost)->q; -if (q) { -bsg_unregister_queue (q); -blk_cleanup_queue (q); - } +if (q) +bsg_remove_queue (q);return 0 ; }
include/linux/bsg-lib.h +1 -0
@@ -73,6 +73,7 @@ void bsg_job_done(struct bsg_job *job, int result, unsigned int reply_payload_rcv_len);struct request_queue *bsg_setup_queue (struct device *dev,const char *name,bsg_job_fn *job_fn,rq_timed_out_fn *timeout,int dd_job_size); +void bsg_remove_queue (struct request_queue *q);void bsg_job_put (struct bsg_job *job);int __must_check bsg_job_get (struct bsg_job *job);
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 13/28 bsg: convert to use blk-mq
In reply to Jens AxboeRequires a few changes to the FC transport class as well.
--- block/bsg-lib.c | 123 +++++++++++++++++++------------ drivers/scsi/scsi_transport_fc.c | 59 +++++++++------ 2 files changed, 110 insertions(+), 72 deletions(-)
block/bsg-lib.c +75 -48
@@ -21,7 +21,7 @@* */ #include <linux/slab.h> -#include <linux/blkdev.h> +#include <linux/blk-mq.h> #include <linux/delay.h> #include <linux/scatterlist.h> #include <linux/bsg-lib.h>
@@ -129,7 +129,7 @@ static void bsg_teardown_job(struct kref *kref)kfree (job->request_payload.sg_list);kfree (job->reply_payload.sg_list); -blk_end_request_all (rq,BLK_STS_OK ); +blk_mq_end_request (rq,BLK_STS_OK ); }void bsg_job_put (struct bsg_job *job)
@@ -157,15 +157,15 @@ void bsg_job_done(struct bsg_job *job, int result, { job->result = result; job->reply_payload_rcv_len = reply_payload_rcv_len; -blk_complete_request (blk_mq_rq_from_pdu (job)); +blk_mq_complete_request (blk_mq_rq_from_pdu (job)); }EXPORT_SYMBOL_GPL (bsg_job_done);/** -* bsg_softirq_done - softirq done routine for destroying the bsg requests +* bsg_complete - softirq done routine for destroying the bsg requests * @rq: BSG request that holds the job to be destroyed */ -static void bsg_softirq_done (struct request *rq) +static void bsg_complete (struct request *rq) {struct bsg_job *job =blk_mq_rq_to_pdu (rq);
@@ -224,54 +224,46 @@ static bool bsg_prepare_job(struct device *dev, struct request *req) }/** -* bsg_request_fn - generic handler for bsg requests -* @q: request queue to manage +* bsg_queue_rq - generic handler for bsg requests +* @hctx: hardware queue +* @bd: queue data * * On error the create_bsg_job function should return a -Exyz error value * that will be set to ->result. * * Drivers/subsys should pass this to the queue init function. */ -static void bsg_request_fn (struct request_queue *q) - __releases(q->queue_lock) - __acquires(q->queue_lock) +static blk_status_t bsg_queue_rq (struct blk_mq_hw_ctx *hctx, +const struct blk_mq_queue_data *bd) { +struct request_queue *q = hctx->queue;struct device *dev = q->queuedata; -struct request *req; +struct request *req = bd->rq;int ret; +blk_mq_start_request (req); +if (!get_device (dev)) -return ; - -while (1 ) { - req =blk_fetch_request (q); -if (!req) -break ; -spin_unlock_irq (q->queue_lock); - -if (!bsg_prepare_job (dev, req)) { -blk_end_request_all (req,BLK_STS_OK ); -spin_lock_irq (q->queue_lock); -continue ; - } - - ret = q->bsg_job_fn (blk_mq_rq_to_pdu (req)); -spin_lock_irq (q->queue_lock); -if (ret) -break ; - } +return BLK_STS_IOERR ; + +if (!bsg_prepare_job (dev, req)) +return BLK_STS_IOERR ; + + ret = q->bsg_job_fn (blk_mq_rq_to_pdu (req)); +if (ret) +return BLK_STS_IOERR ; -spin_unlock_irq (q->queue_lock);put_device (dev); -spin_lock_irq (q->queue_lock); +return BLK_STS_OK ; }/* called right after the request is allocated for the request_queue */ -static int bsg_init_rq (struct request_queue *q,struct request *req,gfp_t gfp) +static int bsg_init_rq (struct blk_mq_tag_set *set,struct request *req, +unsigned int hctx_idx,unsigned int numa_node) {struct bsg_job *job =blk_mq_rq_to_pdu (req); - job->reply =kzalloc (SCSI_SENSE_BUFFERSIZE , gfp); + job->reply =kzalloc (SCSI_SENSE_BUFFERSIZE ,GFP_KERNEL );if (!job->reply)return -ENOMEM ;return 0 ;
@@ -289,7 +281,8 @@ static void bsg_initialize_rq(struct request *req) job->dd_data = job +1 ; } -static void bsg_exit_rq (struct request_queue *q,struct request *req) +static void bsg_exit_rq (struct blk_mq_tag_set *set,struct request *req, +unsigned int hctx_idx) {struct bsg_job *job =blk_mq_rq_to_pdu (req);
@@ -298,11 +291,35 @@ static void bsg_exit_rq(struct request_queue *q, struct request *req)void bsg_remove_queue (struct request_queue *q) { +struct blk_mq_tag_set *set = q->tag_set; +bsg_unregister_queue (q);blk_cleanup_queue (q); +blk_mq_free_tag_set (set); +kfree (set); }EXPORT_SYMBOL_GPL (bsg_remove_queue); +static enum blk_eh_timer_return bsg_timeout (struct request *rq,bool reserved) +{ +enum blk_eh_timer_return ret =BLK_EH_DONE ; +struct request_queue *q = rq->q; + +if (q->rq_timed_out_fn) + ret = q->rq_timed_out_fn (rq); + +return ret; +} + +static const struct blk_mq_ops bsg_mq_ops = { + .queue_rq = bsg_queue_rq, + .init_request = bsg_init_rq, + .exit_request = bsg_exit_rq, + .initialize_rq_fn = bsg_initialize_rq, + .complete = bsg_complete, + .timeout = bsg_timeout, +}; +/** * bsg_setup_queue - Create and add the bsg hooks so we can receive requests * @dev: device to attach bsg device to
@@ -313,28 +330,34 @@ EXPORT_SYMBOL_GPL(bsg_remove_queue);struct request_queue *bsg_setup_queue (struct device *dev,const char *name,bsg_job_fn *job_fn,rq_timed_out_fn *timeout,int dd_job_size) { +struct blk_mq_tag_set *set;struct request_queue *q; -int ret; +int ret = -ENOMEM ; - q =blk_alloc_queue (GFP_KERNEL ); -if (!q) + set =kzalloc (sizeof (*set),GFP_KERNEL ); +if (!set)return ERR_PTR (-ENOMEM ); - q->cmd_size =sizeof (struct bsg_job ) + dd_job_size; - q->init_rq_fn = bsg_init_rq; - q->exit_rq_fn = bsg_exit_rq; - q->initialize_rq_fn = bsg_initialize_rq; - q->request_fn = bsg_request_fn; - ret =blk_init_allocated_queue (q); -if (ret) - goto out_cleanup_queue; + set->ops = &bsg_mq_ops, + set->nr_hw_queues =1 ; + set->queue_depth =128 ; + set->numa_node =NUMA_NO_NODE ; + set->cmd_size =sizeof (struct bsg_job ) + dd_job_size; + set->flags =BLK_MQ_F_NO_SCHED |BLK_MQ_F_BLOCKING ; +if (blk_mq_alloc_tag_set (set)) + goto out_tag_set; + + q =blk_mq_init_queue (set); +if (IS_ERR (q)) { + ret =PTR_ERR (q); + goto out_queue; + } q->queuedata = dev; q->bsg_job_fn = job_fn;blk_queue_flag_set (QUEUE_FLAG_BIDI , q); -blk_queue_softirq_done (q, bsg_softirq_done);blk_queue_rq_timeout (q,BLK_DEFAULT_SG_TIMEOUT ); -blk_queue_rq_timed_out (q, timeout); + q->rq_timed_out_fn = timeout; ret =bsg_register_queue (q, dev, name, &bsg_transport_ops);if (ret) {
@@ -346,6 +369,10 @@ struct request_queue *bsg_setup_queue(struct device *dev, const char *name,return q; out_cleanup_queue:blk_cleanup_queue (q); +out_queue: +blk_mq_free_tag_set (set); +out_tag_set: +kfree (set);return ERR_PTR (ret); }EXPORT_SYMBOL_GPL (bsg_setup_queue);
drivers/scsi/scsi_transport_fc.c +35 -24
96 lines not on this page · raw message
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 14/28 block: remove blk_complete_request()
In reply to Jens AxboeIt's now unused.
--- block/blk-softirq.c | 20 -------------------- include/linux/blkdev.h | 1 - 2 files changed, 21 deletions(-)
block/blk-softirq.c +0 -20
@@ -145,26 +145,6 @@ void __blk_complete_request(struct request *req) }EXPORT_SYMBOL (__blk_complete_request); -/** -* blk_complete_request - end I/O on a request -* @req: the request being processed -* -* Description: -* Ends all I/O on a request. It does not handle partial completions, -* unless the driver actually implements this in its completion callback -* through requeueing. The actual completion happens out-of-order, -* through a softirq handler. The user must have registered a completion -* callback through blk_queue_softirq_done(). -**/ -void blk_complete_request (struct request *req) -{ -if (unlikely (blk_should_fake_timeout (req->q))) -return ; -if (!blk_mark_rq_complete (req)) -__blk_complete_request (req); -} -EXPORT_SYMBOL (blk_complete_request); -static __init int blk_softirq_init (void ) {int i;
include/linux/blkdev.h +0 -1
@@ -1205,7 +1205,6 @@ extern bool __blk_end_request(struct request *rq, blk_status_t error,extern void __blk_end_request_all (struct request *rq,blk_status_t error);extern bool __blk_end_request_cur (struct request *rq,blk_status_t error); -extern void blk_complete_request (struct request *);extern void __blk_complete_request (struct request *);extern void blk_abort_request (struct request *);extern void blk_unprep_request (struct request *);
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 15/28 blk-wbt: kill check for legacy queue type
In reply to Jens AxboeEverything is blk-mq at this point, so it doesn't make any sense to have this option available as it does nothing.
--- block/Kconfig | 6 ------ block/blk-wbt.c | 3 +-- 2 files changed, 1 insertion(+), 8 deletions(-)
block/Kconfig +0 -6
@@ -155,12 +155,6 @@ config BLK_CGROUP_IOLATENCY Note, this is an experimental interface and could be changed someday. -config BLK_WBT_SQ - bool "Single queue writeback throttling" - depends on BLK_WBT - ---help--- - Enable writeback throttling by default on legacy single queue devices - config BLK_WBT_MQ bool "Multiqueue writeback throttling" default y
block/blk-wbt.c +1 -2
@@ -709,8 +709,7 @@ void wbt_enable_default(struct request_queue *q)if (!test_bit (QUEUE_FLAG_REGISTERED , &q->queue_flags))return ; -if ((q->mq_ops &&IS_ENABLED (CONFIG_BLK_WBT_MQ )) || - (q->request_fn &&IS_ENABLED (CONFIG_BLK_WBT_SQ ))) +if (IS_ENABLED (CONFIG_BLK_WBT_MQ ))wbt_init (q); }EXPORT_SYMBOL_GPL (wbt_enable_default);
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 16/28 blk-cgroup: remove legacy queue bypassing
In reply to Jens AxboeWe only support mq devices now.
--- block/blk-cgroup.c | 8 -------- 1 file changed, 8 deletions(-)
block/blk-cgroup.c +0 -8
@@ -1446,8 +1446,6 @@ int blkcg_activate_policy(struct request_queue *q,if (q->mq_ops)blk_mq_freeze_queue (q); -else -blk_queue_bypass_start (q); pd_prealloc:if (!pd_prealloc) { pd_prealloc = pol->pd_alloc_fn (GFP_KERNEL , q->node);
@@ -1487,8 +1485,6 @@ int blkcg_activate_policy(struct request_queue *q, out_bypass_end:if (q->mq_ops)blk_mq_unfreeze_queue (q); -else -blk_queue_bypass_end (q);if (pd_prealloc) pol->pd_free_fn (pd_prealloc);return ret;
@@ -1513,8 +1509,6 @@ void blkcg_deactivate_policy(struct request_queue *q,if (q->mq_ops)blk_mq_freeze_queue (q); -else -blk_queue_bypass_start (q);spin_lock_irq (q->queue_lock);
@@ -1533,8 +1527,6 @@ void blkcg_deactivate_policy(struct request_queue *q,if (q->mq_ops)blk_mq_unfreeze_queue (q); -else -blk_queue_bypass_end (q); }EXPORT_SYMBOL_GPL (blkcg_deactivate_policy);
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 17/28 block: remove legacy rq tagging
In reply to Jens AxboeIt's now unused, kill it.
--- Documentation/block/biodoc.txt | 88 -------- block/Makefile | 2 +- block/blk-core.c | 6 - block/blk-mq-debugfs.c | 2 - block/blk-mq-tag.c | 6 +- block/blk-sysfs.c | 3 - block/blk-tag.c | 378 --------------------------------- include/linux/blkdev.h | 35 --- 8 files changed, 3 insertions(+), 517 deletions(-) delete mode 100644 block/blk-tag.c
Documentation/block/biodoc.txt +0 -88
@@ -65,7 +65,6 @@ Description of Contents: 3.2.3 I/O completion 3.2.4 Implications for drivers that do not interpret bios (don't handle multiple segments) - 3.2.5 Request command tagging 3.3 I/O submission 4. The I/O scheduler 5. Scalability related changes
@@ -708,93 +707,6 @@ is crossed on completion of a transfer. (The end*request* functions should be used if only if the request has come down from block/bio path, not for direct access requests which only specify rq->buffer without a valid rq->bio) -3.2.5 Generic request command tagging - -3.2.5.1 Tag helpers - -Block now offers some simple generic functionality to help support command -queueing (typically known as tagged command queueing), ie manage more than -one outstanding command on a queue at any given time. - - blk_queue_init_tags(struct request_queue *q, int depth) - - Initialize internal command tagging structures for a maximum - depth of 'depth'. - - blk_queue_free_tags((struct request_queue *q) - - Teardown tag info associated with the queue. This will be done - automatically by block if blk_queue_cleanup() is called on a queue - that is using tagging. - -The above are initialization and exit management, the main helpers during -normal operations are: - - blk_queue_start_tag(struct request_queue *q, struct request *rq) - - Start tagged operation for this request. A free tag number between - 0 and 'depth' is assigned to the request (rq->tag holds this number), - and 'rq' is added to the internal tag management. If the maximum depth - for this queue is already achieved (or if the tag wasn't started for - some other reason), 1 is returned. Otherwise 0 is returned. - - blk_queue_end_tag(struct request_queue *q, struct request *rq) - - End tagged operation on this request. 'rq' is removed from the internal - book keeping structures. - -To minimize struct request and queue overhead, the tag helpers utilize some -of the same request members that are used for normal request queue management. -This means that a request cannot both be an active tag and be on the queue -list at the same time. blk_queue_start_tag() will remove the request, but -the driver must remember to call blk_queue_end_tag() before signalling -completion of the request to the block layer. This means ending tag -operations before calling end_that_request_last()! For an example of a user -of these helpers, see the IDE tagged command queueing support. - -3.2.5.2 Tag info - -Some block functions exist to query current tag status or to go from a -tag number to the associated request. These are, in no particular order: - - blk_queue_tagged(q) - - Returns 1 if the queue 'q' is using tagging, 0 if not. - - blk_queue_tag_request(q, tag) - - Returns a pointer to the request associated with tag 'tag'. - - blk_queue_tag_depth(q) - - Return current queue depth. - - blk_queue_tag_queue(q) - - Returns 1 if the queue can accept a new queued command, 0 if we are - at the maximum depth already. - - blk_queue_rq_tagged(rq) - - Returns 1 if the request 'rq' is tagged. - -3.2.5.2 Internal structure - -Internally, block manages tags in the blk_queue_tag structure: - - struct blk_queue_tag { - struct request **tag_index; /* array or pointers to rq */ - unsigned long *tag_map; /* bitmap of free tags */ - struct list_head busy_list; /* fifo list of busy tags */ - int busy; /* queue depth */ - int max_depth; /* max queue depth */ - }; - -Most of the above is simple and straight forward, however busy_list may need -a bit of explaining. Normally we don't care too much about request ordering, -but in the event of any barrier requests in the tag queue we need to ensure -that requests are restarted in the order they were queue. - 3.3 I/O Submission The routine submit_bio() is used to submit a single io. Higher level i/o
block/Makefile +1 -1
@@ -3,7 +3,7 @@ # Makefile for the kernel block layer # -obj-$(CONFIG_BLOCK) := bio.o elevator.o blk-core.o blk-tag.o blk-sysfs.o \ +obj-$(CONFIG_BLOCK) := bio.o elevator.o blk-core.o blk-sysfs.o \ blk-flush.o blk-settings.o blk-ioc.o blk-map.o \ blk-exec.o blk-merge.o blk-softirq.o blk-timeout.o \ blk-lib.o blk-mq.o blk-mq-tag.o blk-stat.o \
block/blk-core.c +0 -6
@@ -1655,9 +1655,6 @@ void blk_requeue_request(struct request_queue *q, struct request *rq)trace_block_rq_requeue (q, rq);rq_qos_requeue (q, rq); -if (rq->rq_flags &RQF_QUEUED ) -blk_queue_end_tag (q, rq); -BUG_ON (blk_queued_rq (rq));elv_requeue_request (q, rq);
@@ -3172,9 +3169,6 @@ void blk_finish_request(struct request *req, blk_status_t error)if (req->rq_flags &RQF_STATS )blk_stat_add (req, now); -if (req->rq_flags &RQF_QUEUED ) -blk_queue_end_tag (q, req); -BUG_ON (blk_queued_rq (req));if (unlikely (laptop_mode) && !blk_rq_is_passthrough (req))
block/blk-mq-debugfs.c +0 -2
@@ -112,7 +112,6 @@ static int queue_pm_only_show(void *data, struct seq_file *m)#define QUEUE_FLAG_NAME (name) [QUEUE_FLAG_##name] = #namestatic const char *const blk_queue_flag_name[] = { -QUEUE_FLAG_NAME (QUEUED ),QUEUE_FLAG_NAME (STOPPED ),QUEUE_FLAG_NAME (DYING ),QUEUE_FLAG_NAME (BYPASS ),
@@ -318,7 +317,6 @@ static const char *const cmd_flag_name[] = {static const char *const rqf_name[] = {RQF_NAME (SORTED ),RQF_NAME (STARTED ), -RQF_NAME (QUEUED ),RQF_NAME (SOFTBARRIER ),RQF_NAME (FLUSH_SEQ ),RQF_NAME (MIXED_MERGE ),
block/blk-mq-tag.c +2 -4
@@ -530,10 +530,8 @@ u32 blk_mq_unique_tag(struct request *rq)struct blk_mq_hw_ctx *hctx;int hwq =0 ; -if (q->mq_ops) { - hctx =blk_mq_map_queue (q, rq->mq_ctx->cpu); - hwq = hctx->queue_num; - } + hctx =blk_mq_map_queue (q, rq->mq_ctx->cpu); + hwq = hctx->queue_num;return (hwq <<BLK_MQ_UNIQUE_TAG_BITS ) | (rq->tag &BLK_MQ_UNIQUE_TAG_MASK );
block/blk-sysfs.c +0 -3
@@ -849,9 +849,6 @@ static void __blk_release_queue(struct work_struct *work)blk_exit_rl (q, &q->root_rl); -if (q->queue_tags) -__blk_queue_free_tags (q); -blk_queue_free_zone_bitmaps (q);if (!q->mq_ops) {
block/blk-tag.c deleted +0 -378
378 lines not on this page · raw message
include/linux/blkdev.h +0 -35
@@ -85,8 +85,6 @@ typedef __u32 __bitwise req_flags_t;#define RQF_SORTED ((__force req_flags_t)(1 << 0))/* drive already may have started this one */ #define RQF_STARTED ((__force req_flags_t)(1 << 1)) -/* uses tagged queueing */ -#define RQF_QUEUED ((__force req_flags_t)(1 << 2))/* may not be passed by ioscheduler */ #define RQF_SOFTBARRIER ((__force req_flags_t)(1 << 3))/* request for flush sequence */
@@ -337,15 +335,6 @@ enum blk_queue_state { Queue_up, }; -struct blk_queue_tag { -struct request **tag_index;/* map of busy tags */ -unsigned long *tag_map;/* bit map of free/busy tags */ -int max_depth;/* what we will send to device */ -int real_max_depth;/* what the array can hold */ -atomic_t refcnt;/* map can be shared */ -int alloc_policy;/* tag allocation policy */ -int next_tag;/* next tag */ -};#define BLK_TAG_ALLOC_FIFO 0/* allocate starting from 0 */ #define BLK_TAG_ALLOC_RR 1/* allocate starting from last allocated tag */
@@ -570,8 +559,6 @@ struct request_queue {unsigned int dma_pad_mask;unsigned int dma_alignment; -struct blk_queue_tag *queue_tags; -unsigned int nr_sorted;unsigned int in_flight[2 ];
@@ -682,7 +669,6 @@ struct request_queue {u64 write_hints[BLK_MAX_WRITE_HINTS ]; }; -#define QUEUE_FLAG_QUEUED 0/* uses generic tag queueing */ #define QUEUE_FLAG_STOPPED 1/* queue is stopped */ #define QUEUE_FLAG_DYING 2/* queue being torn down */ #define QUEUE_FLAG_BYPASS 3/* act as dumb FIFO queue */
@@ -726,7 +712,6 @@ void blk_queue_flag_clear(unsigned int flag, struct request_queue *q);bool blk_queue_flag_test_and_set (unsigned int flag,struct request_queue *q);bool blk_queue_flag_test_and_clear (unsigned int flag,struct request_queue *q); -#define blk_queue_tagged (q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)#define blk_queue_stopped (q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)#define blk_queue_dying (q) test_bit(QUEUE_FLAG_DYING, &(q)->queue_flags)#define blk_queue_dead (q) test_bit(QUEUE_FLAG_DEAD, &(q)->queue_flags)
@@ -1362,26 +1347,6 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk) !list_empty(&plug->cb_list)); } -/* -* tag stuff -*/ -extern int blk_queue_start_tag (struct request_queue *,struct request *); -extern struct request *blk_queue_find_tag (struct request_queue *,int ); -extern void blk_queue_end_tag (struct request_queue *,struct request *); -extern int blk_queue_init_tags (struct request_queue *,int ,struct blk_queue_tag *,int ); -extern void blk_queue_free_tags (struct request_queue *); -extern int blk_queue_resize_tags (struct request_queue *,int ); -extern struct blk_queue_tag *blk_init_tags (int ,int ); -extern void blk_free_tags (struct blk_queue_tag *); - -static inline struct request *blk_map_queue_find_tag (struct blk_queue_tag *bqt, -int tag) -{ -if (unlikely (bqt ==NULL || tag >= bqt->real_max_depth)) -return NULL ; -return bqt->tag_index[tag]; -} -extern int blkdev_issue_flush (struct block_device *,gfp_t ,sector_t *);extern int blkdev_issue_write_same (struct block_device *bdev,sector_t sector,sector_t nr_sects,gfp_t gfp_mask,struct page *page);
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 18/28 block: remove non mq parts from the flush code
In reply to Jens Axboe--- block/blk-flush.c | 154 +++++++++------------------------------------- block/blk.h | 4 +- 2 files changed, 31 insertions(+), 127 deletions(-)
block/blk-flush.c +30 -124
@@ -134,16 +134,8 @@ static void blk_flush_restore_request(struct request *rq)static bool blk_flush_queue_rq (struct request *rq,bool add_front) { -if (rq->q->mq_ops) { -blk_mq_add_to_requeue_list (rq, add_front, true); -return false; - }else { -if (add_front) -list_add (&rq->queuelist, &rq->q->queue_head); -else -list_add_tail (&rq->queuelist, &rq->q->queue_head); -return true; - } +blk_mq_add_to_requeue_list (rq, add_front, true); +return false; }/**
@@ -204,10 +196,7 @@ static bool blk_flush_complete_seq(struct request *rq,BUG_ON (!list_empty (&rq->queuelist));list_del_init (&rq->flush.list);blk_flush_restore_request (rq); -if (q->mq_ops) -blk_mq_end_request (rq, error); -else -__blk_end_request_all (rq, error); +blk_mq_end_request (rq, error);break ;default :
@@ -226,20 +215,17 @@ static void flush_end_io(struct request *flush_rq, blk_status_t error)struct request *rq, *n;unsigned long flags =0 ;struct blk_flush_queue *fq =blk_get_flush_queue (q, flush_rq->mq_ctx); +struct blk_mq_hw_ctx *hctx; -if (q->mq_ops) { -struct blk_mq_hw_ctx *hctx; - -/* release the tag's ownership to the req cloned from */ -spin_lock_irqsave (&fq->mq_flush_lock, flags); - hctx =blk_mq_map_queue (q, flush_rq->mq_ctx->cpu); -if (!q->elevator) { -blk_mq_tag_set_rq (hctx, flush_rq->tag, fq->orig_rq); - flush_rq->tag =-1 ; - }else { -blk_mq_put_driver_tag_hctx (hctx, flush_rq); - flush_rq->internal_tag =-1 ; - } +/* release the tag's ownership to the req cloned from */ +spin_lock_irqsave (&fq->mq_flush_lock, flags); + hctx =blk_mq_map_queue (q, flush_rq->mq_ctx->cpu); +if (!q->elevator) { +blk_mq_tag_set_rq (hctx, flush_rq->tag, fq->orig_rq); + flush_rq->tag =-1 ; + }else { +blk_mq_put_driver_tag_hctx (hctx, flush_rq); + flush_rq->internal_tag =-1 ; } running = &fq->flush_queue[fq->flush_running_idx];
@@ -248,9 +234,6 @@ static void flush_end_io(struct request *flush_rq, blk_status_t error)/* account completion of the flush request */ fq->flush_running_idx ^=1 ; -if (!q->mq_ops) -elv_completed_request (q, flush_rq); -/* and push the waiting requests to the next stage */ list_for_each_entry_safe (rq, n, running, flush.list) {unsigned int seq =blk_flush_cur_seq (rq);
@@ -259,24 +242,8 @@ static void flush_end_io(struct request *flush_rq, blk_status_t error) queued |=blk_flush_complete_seq (rq, fq, seq, error); } -/* -* Kick the queue to avoid stall for two cases: -* 1. Moving a request silently to empty queue_head may stall the -* queue. -* 2. When flush request is running in non-queueable queue, the -* queue is hold. Restart the queue after flush request is finished -* to avoid stall. -* This function is called from request completion path and calling -* directly into request_fn may confuse the driver. Always use -* kblockd. -*/ -if (queued || fq->flush_queue_delayed) { -WARN_ON (q->mq_ops); -blk_run_queue_async (q); - } fq->flush_queue_delayed =0 ; -if (q->mq_ops) -spin_unlock_irqrestore (&fq->mq_flush_lock, flags); +spin_unlock_irqrestore (&fq->mq_flush_lock, flags); }/**
@@ -301,6 +268,7 @@ static bool blk_kick_flush(struct request_queue *q, struct blk_flush_queue *fq,struct request *first_rq = list_first_entry(pending, struct request, flush.list);struct request *flush_rq = fq->flush_rq; +struct blk_mq_hw_ctx *hctx;/* C1 described at the top of this file */ if (fq->flush_pending_idx != fq->flush_running_idx ||list_empty (pending))
@@ -334,19 +302,15 @@ static bool blk_kick_flush(struct request_queue *q, struct blk_flush_queue *fq,* In case of IO scheduler, flush rq need to borrow scheduler tag * just for cheating put/get driver tag. */ -if (q->mq_ops) { -struct blk_mq_hw_ctx *hctx; - - flush_rq->mq_ctx = first_rq->mq_ctx; - -if (!q->elevator) { - fq->orig_rq = first_rq; - flush_rq->tag = first_rq->tag; - hctx =blk_mq_map_queue (q, first_rq->mq_ctx->cpu); -blk_mq_tag_set_rq (hctx, first_rq->tag, flush_rq); - }else { - flush_rq->internal_tag = first_rq->internal_tag; - } + flush_rq->mq_ctx = first_rq->mq_ctx; + +if (!q->elevator) { + fq->orig_rq = first_rq; + flush_rq->tag = first_rq->tag; + hctx =blk_mq_map_queue (q, first_rq->mq_ctx->cpu); +blk_mq_tag_set_rq (hctx, first_rq->tag, flush_rq); + }else { + flush_rq->internal_tag = first_rq->internal_tag; } flush_rq->cmd_flags =REQ_OP_FLUSH |REQ_PREFLUSH ;
@@ -358,49 +322,6 @@ static bool blk_kick_flush(struct request_queue *q, struct blk_flush_queue *fq,return blk_flush_queue_rq (flush_rq, false); } -static void flush_data_end_io (struct request *rq,blk_status_t error) -{ -struct request_queue *q = rq->q; -struct blk_flush_queue *fq =blk_get_flush_queue (q,NULL ); - -lockdep_assert_held (q->queue_lock); - -/* -* Updating q->in_flight[] here for making this tag usable -* early. Because in blk_queue_start_tag(), -* q->in_flight[BLK_RW_ASYNC] is used to limit async I/O and -* reserve tags for sync I/O. -* -* More importantly this way can avoid the following I/O -* deadlock: -* -* - suppose there are 40 fua requests comming to flush queue -* and queue depth is 31 -* - 30 rqs are scheduled then blk_queue_start_tag() can't alloc -* tag for async I/O any more -* - all the 30 rqs are completed before FLUSH_PENDING_TIMEOUT -* and flush_data_end_io() is called -* - the other rqs still can't go ahead if not updating -* q->in_flight[BLK_RW_ASYNC] here, meantime these rqs -* are held in flush data queue and make no progress of -* handling post flush rq -* - only after the post flush rq is handled, all these rqs -* can be completed -*/ - -elv_completed_request (q, rq); - -/* for avoiding double accounting */ - rq->rq_flags &= ~RQF_STARTED ; - -/* -* After populating an empty queue, kick it to avoid stall. Read -* the comment in flush_end_io(). -*/ -if (blk_flush_complete_seq (rq, fq,REQ_FSEQ_DATA , error)) -blk_run_queue_async (q); -} -static void mq_flush_data_end_io (struct request *rq,blk_status_t error) {struct request_queue *q = rq->q;
@@ -443,9 +364,6 @@ void blk_insert_flush(struct request *rq)unsigned int policy =blk_flush_policy (fflags, rq);struct blk_flush_queue *fq =blk_get_flush_queue (q, rq->mq_ctx); -if (!q->mq_ops) -lockdep_assert_held (q->queue_lock); -/* * @policy now records what operations need to be done. Adjust * REQ_PREFLUSH and FUA for the driver.
@@ -468,10 +386,7 @@ void blk_insert_flush(struct request *rq)* complete the request. */ if (!policy) { -if (q->mq_ops) -blk_mq_end_request (rq,0 ); -else -__blk_end_request (rq,0 ,0 ); +blk_mq_end_request (rq,0 );return ; }
@@ -484,10 +399,7 @@ void blk_insert_flush(struct request *rq)*/ if ((policy &REQ_FSEQ_DATA ) && !(policy & (REQ_FSEQ_PREFLUSH |REQ_FSEQ_POSTFLUSH ))) { -if (q->mq_ops) -blk_mq_request_bypass_insert (rq, false); -else -list_add_tail (&rq->queuelist, &q->queue_head); +blk_mq_request_bypass_insert (rq, false);return ; }
@@ -499,17 +411,12 @@ void blk_insert_flush(struct request *rq)INIT_LIST_HEAD (&rq->flush.list); rq->rq_flags |=RQF_FLUSH_SEQ ; rq->flush.saved_end_io = rq->end_io;/* Usually NULL */ -if (q->mq_ops) { - rq->end_io = mq_flush_data_end_io; -spin_lock_irq (&fq->mq_flush_lock); -blk_flush_complete_seq (rq, fq,REQ_FSEQ_ACTIONS & ~policy,0 ); -spin_unlock_irq (&fq->mq_flush_lock); -return ; - } - rq->end_io = flush_data_end_io; + rq->end_io = mq_flush_data_end_io; +spin_lock_irq (&fq->mq_flush_lock);blk_flush_complete_seq (rq, fq,REQ_FSEQ_ACTIONS & ~policy,0 ); +spin_unlock_irq (&fq->mq_flush_lock); }/**
@@ -575,8 +482,7 @@ struct blk_flush_queue *blk_alloc_flush_queue(struct request_queue *q,if (!fq) goto fail; -if (q->mq_ops) -spin_lock_init (&fq->mq_flush_lock); +spin_lock_init (&fq->mq_flush_lock); rq_sz =round_up (rq_sz + cmd_size,cache_line_size ()); fq->flush_rq =kzalloc_node (rq_sz, flags, node);
block/blk.h +1 -3
@@ -114,9 +114,7 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)static inline struct blk_flush_queue *blk_get_flush_queue (struct request_queue *q,struct blk_mq_ctx *ctx) { -if (q->mq_ops) -return blk_mq_map_queue (q, ctx->cpu)->fq; -return q->fq; +return blk_mq_map_queue (q, ctx->cpu)->fq; }static inline void __blk_get_queue (struct request_queue *q)
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 19/28 block: remove legacy IO schedulers
In reply to Jens AxboeRetain the deadline documentation, as that carries over to mq-deadline as well.
--- Documentation/block/cfq-iosched.txt | 291 -- block/Kconfig.iosched | 61 - block/Makefile | 3 - block/cfq-iosched.c | 4916 --------------------------- block/deadline-iosched.c | 560 --- block/elevator.c | 70 - block/noop-iosched.c | 124 - 7 files changed, 6025 deletions(-) delete mode 100644 Documentation/block/cfq-iosched.txt delete mode 100644 block/cfq-iosched.c delete mode 100644 block/deadline-iosched.c delete mode 100644 block/noop-iosched.c
Documentation/block/cfq-iosched.txt deleted +0 -291
@@ -1,291 +0,0 @@ -CFQ (Complete Fairness Queueing) -=============================== - -The main aim of CFQ scheduler is to provide a fair allocation of the disk -I/O bandwidth for all the processes which requests an I/O operation. - -CFQ maintains the per process queue for the processes which request I/O -operation(synchronous requests). In case of asynchronous requests, all the -requests from all the processes are batched together according to their -process's I/O priority. - -CFQ ioscheduler tunables -======================== - -slice_idle ----------- -This specifies how long CFQ should idle for next request on certain cfq queues -(for sequential workloads) and service trees (for random workloads) before -queue is expired and CFQ selects next queue to dispatch from. - -By default slice_idle is a non-zero value. That means by default we idle on -queues/service trees. This can be very helpful on highly seeky media like -single spindle SATA/SAS disks where we can cut down on overall number of -seeks and see improved throughput. - -Setting slice_idle to 0 will remove all the idling on queues/service tree -level and one should see an overall improved throughput on faster storage -devices like multiple SATA/SAS disks in hardware RAID configuration. The down -side is that isolation provided from WRITES also goes down and notion of -IO priority becomes weaker. - -So depending on storage and workload, it might be useful to set slice_idle=0. -In general I think for SATA/SAS disks and software RAID of SATA/SAS disks -keeping slice_idle enabled should be useful. For any configurations where -there are multiple spindles behind single LUN (Host based hardware RAID -controller or for storage arrays), setting slice_idle=0 might end up in better -throughput and acceptable latencies. - -back_seek_max -------------- -This specifies, given in Kbytes, the maximum "distance" for backward seeking. -The distance is the amount of space from the current head location to the -sectors that are backward in terms of distance. - -This parameter allows the scheduler to anticipate requests in the "backward" -direction and consider them as being the "next" if they are within this -distance from the current head location. - -back_seek_penalty ------------------ -This parameter is used to compute the cost of backward seeking. If the -backward distance of request is just 1/back_seek_penalty from a "front" -request, then the seeking cost of two requests is considered equivalent. - -So scheduler will not bias toward one or the other request (otherwise scheduler -will bias toward front request). Default value of back_seek_penalty is 2. - -fifo_expire_async ------------------ -This parameter is used to set the timeout of asynchronous requests. Default -value of this is 248ms. - -fifo_expire_sync ----------------- -This parameter is used to set the timeout of synchronous requests. Default -value of this is 124ms. In case to favor synchronous requests over asynchronous -one, this value should be decreased relative to fifo_expire_async. - -group_idle ------------ -This parameter forces idling at the CFQ group level instead of CFQ -queue level. This was introduced after a bottleneck was observed -in higher end storage due to idle on sequential queue and allow dispatch -from a single queue. The idea with this parameter is that it can be run with -slice_idle=0 and group_idle=8, so that idling does not happen on individual -queues in the group but happens overall on the group and thus still keeps the -IO controller working. -Not idling on individual queues in the group will dispatch requests from -multiple queues in the group at the same time and achieve higher throughput -on higher end storage. - -Default value for this parameter is 8ms. - -low_latency ------------ -This parameter is used to enable/disable the low latency mode of the CFQ -scheduler. If enabled, CFQ tries to recompute the slice time for each process -based on the target_latency set for the system. This favors fairness over -throughput. Disabling low latency (setting it to 0) ignores target latency, -allowing each process in the system to get a full time slice. - -By default low latency mode is enabled. - -target_latency --------------- -This parameter is used to calculate the time slice for a process if cfq's -latency mode is enabled. It will ensure that sync requests have an estimated -latency. But if sequential workload is higher(e.g. sequential read), -then to meet the latency constraints, throughput may decrease because of less -time for each process to issue I/O request before the cfq queue is switched. - -Though this can be overcome by disabling the latency_mode, it may increase -the read latency for some applications. This parameter allows for changing -target_latency through the sysfs interface which can provide the balanced -throughput and read latency. - -Default value for target_latency is 300ms. - -slice_async ------------ -This parameter is same as of slice_sync but for asynchronous queue. The -default value is 40ms. - -slice_async_rq --------------- -This parameter is used to limit the dispatching of asynchronous request to -device request queue in queue's slice time. The maximum number of request that -are allowed to be dispatched also depends upon the io priority. Default value -for this is 2. - -slice_sync ----------- -When a queue is selected for execution, the queues IO requests are only -executed for a certain amount of time(time_slice) before switching to another -queue. This parameter is used to calculate the time slice of synchronous -queue. - -time_slice is computed using the below equation:- -time_slice = slice_sync + (slice_sync/5 * (4 - prio)). To increase the -time_slice of synchronous queue, increase the value of slice_sync. Default -value is 100ms. - -quantum -------- -This specifies the number of request dispatched to the device queue. In a -queue's time slice, a request will not be dispatched if the number of request -in the device exceeds this parameter. This parameter is used for synchronous -request. - -In case of storage with several disk, this setting can limit the parallel -processing of request. Therefore, increasing the value can improve the -performance although this can cause the latency of some I/O to increase due -to more number of requests. - -CFQ Group scheduling -==================== - -CFQ supports blkio cgroup and has "blkio." prefixed files in each -blkio cgroup directory. It is weight-based and there are four knobs -for configuration - weight[_device] and leaf_weight[_device]. -Internal cgroup nodes (the ones with children) can also have tasks in -them, so the former two configure how much proportion the cgroup as a -whole is entitled to at its parent's level while the latter two -configure how much proportion the tasks in the cgroup have compared to -its direct children. - -Another way to think about it is assuming that each internal node has -an implicit leaf child node which hosts all the tasks whose weight is -configured by leaf_weight[_device]. Let's assume a blkio hierarchy -composed of five cgroups - root, A, B, AA and AB - with the following -weights where the names represent the hierarchy. - - weight leaf_weight - root : 125 125 - A : 500 750 - B : 250 500 - AA : 500 500 - AB : 1000 500 - -root never has a parent making its weight is meaningless. For backward -compatibility, weight is always kept in sync with leaf_weight. B, AA -and AB have no child and thus its tasks have no children cgroup to -compete with. They always get 100% of what the cgroup won at the -parent level. Considering only the weights which matter, the hierarchy -looks like the following. - - root - / | \ - A B leaf - 500 250 125 - / | \ - AA AB leaf - 500 1000 750 - -If all cgroups have active IOs and competing with each other, disk -time will be distributed like the following. - -Distribution below root. The total active weight at this level is -A:500 + B:250 + C:125 = 875. - - root-leaf : 125 / 875 =~ 14% - A : 500 / 875 =~ 57% - B(-leaf) : 250 / 875 =~ 28% - -A has children and further distributes its 57% among the children and -the implicit leaf node. The total active weight at this level is -AA:500 + AB:1000 + A-leaf:750 = 2250. - - A-leaf : ( 750 / 2250) * A =~ 19% - AA(-leaf) : ( 500 / 2250) * A =~ 12% - AB(-leaf) : (1000 / 2250) * A =~ 25% - -CFQ IOPS Mode for group scheduling -=================================== -Basic CFQ design is to provide priority based time slices. Higher priority -process gets bigger time slice and lower priority process gets smaller time -slice. Measuring time becomes harder if storage is fast and supports NCQ and -it would be better to dispatch multiple requests from multiple cfq queues in -request queue at a time. In such scenario, it is not possible to measure time -consumed by single queue accurately. - -What is possible though is to measure number of requests dispatched from a -single queue and also allow dispatch from multiple cfq queue at the same time. -This effectively becomes the fairness in terms of IOPS (IO operations per -second). - -If one sets slice_idle=0 and if storage supports NCQ, CFQ internally switches -to IOPS mode and starts providing fairness in terms of number of requests -dispatched. Note that this mode switching takes effect only for group -scheduling. For non-cgroup users nothing should change. - -CFQ IO scheduler Idling Theory -=============================== -Idling on a queue is primarily about waiting for the next request to come -on same queue after completion of a request. In this process CFQ will not -dispatch requests from other cfq queues even if requests are pending there. - -The rationale behind idling is that it can cut down on number of seeks -on rotational media. For example, if a process is doing dependent -sequential reads (next read will come on only after completion of previous -one), then not dispatching request from other queue should help as we -did not move the disk head and kept on dispatching sequential IO from -one queue. - -CFQ has following service trees and various queues are put on these trees. - - sync-idle sync-noidle async - -All cfq queues doing synchronous sequential IO go on to sync-idle tree. -On this tree we idle on each queue individually. - -All synchronous non-sequential queues go on sync-noidle tree. Also any -synchronous write request which is not marked with REQ_IDLE goes on this -service tree. On this tree we do not idle on individual queues instead idle -on the whole group of queues or the tree. So if there are 4 queues waiting -for IO to dispatch we will idle only once last queue has dispatched the IO -and there is no more IO on this service tree. - -All async writes go on async service tree. There is no idling on async -queues. - -CFQ has some optimizations for SSDs and if it detects a non-rotational -media which can support higher queue depth (multiple requests at in -flight at a time), then it cuts down on idling of individual queues and -all the queues move to sync-noidle tree and only tree idle remains. This -tree idling provides isolation with buffered write queues on async tree. - -FAQ -=== -Q1. Why to idle at all on queues not marked with REQ_IDLE. - -A1. We only do tree idle (all queues on sync-noidle tree) on queues not marked - with REQ_IDLE. This helps in providing isolation with all the sync-idle - queues. Otherwise in presence of many sequential readers, other - synchronous IO might not get fair share of disk. - - For example, if there are 10 sequential readers doing IO and they get - 100ms each. If a !REQ_IDLE request comes in, it will be scheduled - roughly after 1 second. If after completion of !REQ_IDLE request we - do not idle, and after a couple of milli seconds a another !REQ_IDLE - request comes in, again it will be scheduled after 1second. Repeat it - and notice how a workload can lose its disk share and suffer due to - multiple sequential readers. - - fsync can generate dependent IO where bunch of data is written in the - context of fsync, and later some journaling data is written. Journaling - data comes in only after fsync has finished its IO (atleast for ext4 - that seemed to be the case). Now if one decides not to idle on fsync - thread due to !REQ_IDLE, then next journaling write will not get - scheduled for another second. A process doing small fsync, will suffer - badly in presence of multiple sequential readers. - - Hence doing tree idling on threads using !REQ_IDLE flag on requests - provides isolation from multiple sequential readers and at the same - time we do not idle on individual threads. - -Q2. When to specify REQ_IDLE -A2. I would think whenever one is doing synchronous write and expecting - more writes to be dispatched from same context soon, should be able - to specify REQ_IDLE on writes and that probably should work well for - most of the cases.
block/Kconfig.iosched +0 -61
67 lines not on this page · raw message
block/Makefile +0 -3
@@ -18,9 +18,6 @@ obj-$(CONFIG_BLK_DEV_BSGLIB) += bsg-lib.o obj-$(CONFIG_BLK_CGROUP) += blk-cgroup.o obj-$(CONFIG_BLK_DEV_THROTTLING) += blk-throttle.o obj-$(CONFIG_BLK_CGROUP_IOLATENCY) += blk-iolatency.o -obj-$(CONFIG_IOSCHED_NOOP) += noop-iosched.o -obj-$(CONFIG_IOSCHED_DEADLINE) += deadline-iosched.o -obj-$(CONFIG_IOSCHED_CFQ) += cfq-iosched.o obj-$(CONFIG_MQ_IOSCHED_DEADLINE) += mq-deadline.o obj-$(CONFIG_MQ_IOSCHED_KYBER) += kyber-iosched.o bfq-y := bfq-iosched.o bfq-wf2q.o bfq-cgroup.o
block/cfq-iosched.c deleted +0 -4916
2,633 lines not on this page · raw message
block/deadline-iosched.c deleted +0 -560
560 lines not on this page · raw message
block/elevator.c +0 -70
70 lines not on this page · raw message
block/noop-iosched.c deleted +0 -124
124 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.17.1
Part of the diff is not shown here. View the raw message.
Jens Axboe
maintainerPATCH 20/28 block: remove dead elevator code
In reply to Jens AxboeThis removes a bunch of core and elevator related code. On the core front, we remove anything related to queue running, draining, initialization, plugging, and congestions. We also kill anything related to request allocation, merging, retrieval, and completion.
Remove any checking for single queue IO schedulers, as they no longer exist. This means we can also delete a bunch of code related to request issue, adding, completion, etc - and all the SQ related ops and helpers.
Also kill the load_default_modules(), as all that did was provide for a way to load the default single queue elevator.
--- block/bfq-iosched.c | 1 - block/blk-core.c | 1749 +------------------------------------- block/blk-exec.c | 20 +- block/blk-ioc.c | 46 +- block/blk-merge.c | 5 - block/blk-settings.c | 36 - block/blk-sysfs.c | 36 +- block/blk.h | 51 -- block/elevator.c | 377 +------- block/kyber-iosched.c | 1 - block/mq-deadline.c | 1 - include/linux/blkdev.h | 93 +- include/linux/elevator.h | 90 +- include/linux/init.h | 1 - init/do_mounts_initrd.c | 3 - init/initramfs.c | 6 - init/main.c | 12 - 17 files changed, 73 insertions(+), 2455 deletions(-)
block/bfq-iosched.c +0 -1
@@ -5745,7 +5745,6 @@ static struct elevator_type iosched_bfq_mq = { .exit_sched = bfq_exit_queue, }, - .uses_mq = true, .icq_size = sizeof(struct bfq_io_cq), .icq_align = __alignof__(struct bfq_io_cq), .elevator_attrs = bfq_attrs,
block/blk-core.c +34 -1715
1,905 lines not on this page · raw message
block/blk-exec.c +1 -19
@@ -48,8 +48,6 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk, struct request *rq, int at_head, rq_end_io_fn *done) { - int where = at_head ? ELEVATOR_INSERT_FRONT : ELEVATOR_INSERT_BACK; -WARN_ON (irqs_disabled ());WARN_ON (!blk_rq_is_passthrough (rq));
@@ -60,23 +58,7 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk,* don't check dying flag for MQ because the request won't * be reused after dying flag is set */ -if (q->mq_ops) { -blk_mq_sched_insert_request (rq, at_head, true, false); -return ; - } - -spin_lock_irq (q->queue_lock); - -if (unlikely (blk_queue_dying (q))) { - rq->rq_flags |=RQF_QUIET ; -__blk_end_request_all (rq,BLK_STS_IOERR ); -spin_unlock_irq (q->queue_lock); -return ; - } - -__elv_add_request (q, rq, where); -__blk_run_queue (q); -spin_unlock_irq (q->queue_lock); +blk_mq_sched_insert_request (rq, at_head, true, false); }EXPORT_SYMBOL_GPL (blk_execute_rq_nowait);
block/blk-ioc.c +4 -42
84 lines not on this page · raw message
block/blk-merge.c +0 -5
@@ -835,13 +835,8 @@ struct request *attempt_front_merge(struct request_queue *q, struct request *rq)int blk_attempt_req_merge (struct request_queue *q,struct request *rq,struct request *next) { -struct elevator_queue *e = q->elevator;struct request *free; -if (!e->uses_mq && e->type->ops.sq.elevator_allow_rq_merge_fn) -if (!e->type->ops.sq.elevator_allow_rq_merge_fn (q, rq, next)) -return 0 ; - free =attempt_merge (q, rq, next);if (free) {__blk_put_request (q, free);
block/blk-settings.c +0 -36
@@ -20,40 +20,6 @@ EXPORT_SYMBOL(blk_max_low_pfn);unsigned long blk_max_pfn; -/** -* blk_queue_prep_rq - set a prepare_request function for queue -* @q: queue -* @pfn: prepare_request function -* -* It's possible for a queue to register a prepare_request callback which -* is invoked before the request is handed to the request_fn. The goal of -* the function is to prepare a request for I/O, it can be used to build a -* cdb from the request data for instance. -* -*/ -void blk_queue_prep_rq (struct request_queue *q,prep_rq_fn *pfn) -{ - q->prep_rq_fn = pfn; -} -EXPORT_SYMBOL (blk_queue_prep_rq); - -/** -* blk_queue_unprep_rq - set an unprepare_request function for queue -* @q: queue -* @ufn: unprepare_request function -* -* It's possible for a queue to register an unprepare_request callback -* which is invoked before the request is finally completed. The goal -* of the function is to deallocate any data that was allocated in the -* prepare_request callback. -* -*/ -void blk_queue_unprep_rq (struct request_queue *q,unprep_rq_fn *ufn) -{ - q->unprep_rq_fn = ufn; -} -EXPORT_SYMBOL (blk_queue_unprep_rq); -void blk_queue_softirq_done (struct request_queue *q,softirq_done_fn *fn) { q->softirq_done_fn = fn;
@@ -169,8 +135,6 @@ void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn) q->make_request_fn = mfn;blk_queue_dma_alignment (q,511 ); -blk_queue_congestion_threshold (q); - q->nr_batching =BLK_BATCH_REQ ;blk_set_default_limits (&q->limits); }
block/blk-sysfs.c +9 -27
@@ -68,7 +68,7 @@ queue_requests_store(struct request_queue *q, const char *page, size_t count)unsigned long nr;int ret, err; -if (!q->request_fn && !q->mq_ops) +if (!q->mq_ops)return -EINVAL ; ret =queue_var_store (&nr, page, count);
@@ -78,11 +78,7 @@ queue_requests_store(struct request_queue *q, const char *page, size_t count)if (nr <BLKDEV_MIN_RQ ) nr =BLKDEV_MIN_RQ ; -if (q->request_fn) - err =blk_update_nr_requests (q, nr); -else - err =blk_mq_update_nr_requests (q, nr); - + err =blk_mq_update_nr_requests (q, nr);if (err)return err;
@@ -463,20 +459,14 @@ static ssize_t queue_wb_lat_store(struct request_queue *q, const char *page,* ends up either enabling or disabling wbt completely. We can't * have IO inflight if that happens. */ -if (q->mq_ops) { -blk_mq_freeze_queue (q); -blk_mq_quiesce_queue (q); - }else -blk_queue_bypass_start (q); +blk_mq_freeze_queue (q); +blk_mq_quiesce_queue (q);wbt_set_min_lat (q, val);wbt_update_limits (q); -if (q->mq_ops) { -blk_mq_unquiesce_queue (q); -blk_mq_unfreeze_queue (q); - }else -blk_queue_bypass_end (q); +blk_mq_unquiesce_queue (q); +blk_mq_unfreeze_queue (q);return count; }
@@ -847,17 +837,10 @@ static void __blk_release_queue(struct work_struct *work)blk_free_queue_stats (q->stats); -blk_exit_rl (q, &q->root_rl); -blk_queue_free_zone_bitmaps (q); -if (!q->mq_ops) { -if (q->exit_rq_fn) - q->exit_rq_fn (q, q->fq->flush_rq); -blk_free_flush_queue (q->fq); - }else { +if (q->mq_ops)blk_mq_release (q); - }blk_trace_shutdown (q);
@@ -920,7 +903,6 @@ int blk_register_queue(struct gendisk *disk)if (!blk_queue_init_done (q)) {queue_flag_set_unlocked (QUEUE_FLAG_INIT_DONE , q);percpu_ref_switch_to_percpu (&q->q_usage_counter); -blk_queue_bypass_end (q); } ret =blk_trace_init_sysfs (dev);
@@ -947,7 +929,7 @@ int blk_register_queue(struct gendisk *disk)blk_throtl_register_queue (q); -if (q->request_fn || (q->mq_ops && q->elevator)) { +if ((q->mq_ops && q->elevator)) { ret =elv_register_queue (q);if (ret) {mutex_unlock (&q->sysfs_lock);
@@ -1007,7 +989,7 @@ void blk_unregister_queue(struct gendisk *disk)rq_qos_exit (q);mutex_lock (&q->sysfs_lock); -if (q->request_fn || (q->mq_ops && q->elevator)) +if (q->mq_ops && q->elevator)elv_unregister_queue (q);mutex_unlock (&q->sysfs_lock);
block/blk.h +0 -51
83 lines not on this page · raw message
block/elevator.c +22 -355
512 lines not on this page · raw message
block/kyber-iosched.c +0 -1
@@ -1032,7 +1032,6 @@ static struct elevator_type kyber_sched = { .dispatch_request = kyber_dispatch_request, .has_work = kyber_has_work, }, - .uses_mq = true,#ifdef CONFIG_BLK_DEBUG_FS .queue_debugfs_attrs = kyber_queue_debugfs_attrs, .hctx_debugfs_attrs = kyber_hctx_debugfs_attrs,
block/mq-deadline.c +0 -1
@@ -777,7 +777,6 @@ static struct elevator_type mq_deadline = { .exit_sched = dd_exit_queue, }, - .uses_mq = true,#ifdef CONFIG_BLK_DEBUG_FS .queue_debugfs_attrs = deadline_queue_debugfs_attrs,#endif
include/linux/blkdev.h +2 -91
217 lines not on this page · raw message
include/linux/elevator.h +1 -89
90 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.17.1
Part of the diff is not shown here. View the raw message.
Jens Axboe
maintainerPATCH 21/28 block: remove __blk_put_request()
In reply to Jens AxboeNow there's no difference between blk_put_request() and __blk_put_request() anymore, get rid of the underscore version and convert the few callers.
--- block/blk-core.c | 9 --------- block/blk-merge.c | 2 +- drivers/scsi/osd/osd_initiator.c | 4 ++-- drivers/scsi/osst.c | 2 +- drivers/scsi/scsi_error.c | 2 +- drivers/scsi/sg.c | 2 +- drivers/scsi/st.c | 2 +- drivers/target/target_core_pscsi.c | 2 +- include/linux/blkdev.h | 1 - 9 files changed, 8 insertions(+), 18 deletions(-)
block/blk-core.c +0 -9
@@ -800,15 +800,6 @@ void part_round_stats(struct request_queue *q, int cpu, struct hd_struct *part) }EXPORT_SYMBOL_GPL (part_round_stats); -void __blk_put_request (struct request_queue *q,struct request *req) -{ -if (unlikely (!q)) -return ; - -blk_mq_free_request (req); -} -EXPORT_SYMBOL_GPL (__blk_put_request); -void blk_put_request (struct request *req) {blk_mq_free_request (req);
block/blk-merge.c +1 -1
@@ -839,7 +839,7 @@ int blk_attempt_req_merge(struct request_queue *q, struct request *rq, free =attempt_merge (q, rq, next);if (free) { -__blk_put_request (q, free); +blk_put_request (free);return 1 ; }
drivers/scsi/osd/osd_initiator.c +2 -2
@@ -506,11 +506,11 @@ static void osd_request_async_done(struct request *req, blk_status_t error)_set_error_resid (or, req, error);if (req->next_rq) { -__blk_put_request (req->q, req->next_rq); +blk_put_request (req->next_rq); req->next_rq =NULL ; } -__blk_put_request (req->q, req); +blk_put_request (req); or->request =NULL ; or->in.req =NULL ; or->out.req =NULL ;
drivers/scsi/osst.c +1 -1
@@ -341,7 +341,7 @@ static void osst_end_async(struct request *req, blk_status_t status)blk_rq_unmap_user (SRpnt->bio); } -__blk_put_request (req->q, req); +blk_put_request (req); }/* osst_request memory management */
drivers/scsi/scsi_error.c +1 -1
@@ -1932,7 +1932,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)static void eh_lock_door_done (struct request *req,blk_status_t status) { -__blk_put_request (req->q, req); +blk_put_request (req); }/**
drivers/scsi/sg.c +1 -1
@@ -1390,7 +1390,7 @@ sg_rq_end_io(struct request *rq, blk_status_t status)*/ srp->rq =NULL ;scsi_req_free_cmd (scsi_req (rq)); -__blk_put_request (rq->q, rq); +blk_put_request (rq);write_lock_irqsave (&sfp->rq_list_lock, iflags);if (unlikely (srp->orphan)) {
drivers/scsi/st.c +1 -1
@@ -530,7 +530,7 @@ static void st_scsi_execute_end(struct request *req, blk_status_t status)complete (SRpnt->waiting);blk_rq_unmap_user (tmp); -__blk_put_request (req->q, req); +blk_put_request (req); } static int st_scsi_execute(struct st_request *SRpnt, const unsigned char *cmd,
drivers/target/target_core_pscsi.c +1 -1
@@ -1094,7 +1094,7 @@ static void pscsi_req_done(struct request *req, blk_status_t status)break ; } -__blk_put_request (req->q, req); +blk_put_request (req);kfree (pt); }
include/linux/blkdev.h +0 -1
@@ -908,7 +908,6 @@ extern blk_qc_t direct_make_request(struct bio *bio);extern void blk_rq_init (struct request_queue *q,struct request *rq);extern void blk_init_request_from_bio (struct request *req,struct bio *bio);extern void blk_put_request (struct request *); -extern void __blk_put_request (struct request_queue *,struct request *);extern struct request *blk_get_request (struct request_queue *,unsigned int op,blk_mq_req_flags_t flags);extern int blk_lld_busy (struct request_queue *q);
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 22/28 block: kill legacy parts of timeout handling
In reply to Jens AxboeThe only user of legacy timing now is BSG, which is invoked from the mq timeout handler. Kill the legacy code, and rename the q->rq_timed_out_fn to q->bsg_job_timeout_fn.
--- block/blk-core.c | 1 - block/blk-settings.c | 7 --- block/blk-timeout.c | 99 +++--------------------------------------- block/blk.h | 1 - block/bsg-lib.c | 6 +-- include/linux/blkdev.h | 4 +- 6 files changed, 11 insertions(+), 107 deletions(-)
block/blk-core.c +0 -1
@@ -653,7 +653,6 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id, laptop_mode_timer_fn, 0);timer_setup (&q->timeout, blk_rq_timed_out_timer,0 );INIT_WORK (&q->timeout_work,NULL ); -INIT_LIST_HEAD (&q->timeout_list);INIT_LIST_HEAD (&q->icq_list);#ifdef CONFIG_BLK_CGROUP INIT_LIST_HEAD (&q->blkg_list);
block/blk-settings.c +0 -7
@@ -32,13 +32,6 @@ void blk_queue_rq_timeout(struct request_queue *q, unsigned int timeout) }EXPORT_SYMBOL_GPL (blk_queue_rq_timeout); -void blk_queue_rq_timed_out (struct request_queue *q,rq_timed_out_fn *fn) -{ -WARN_ON_ONCE (q->mq_ops); - q->rq_timed_out_fn = fn; -} -EXPORT_SYMBOL_GPL (blk_queue_rq_timed_out); -void blk_queue_lld_busy (struct request_queue *q,lld_busy_fn *fn) { q->lld_busy_fn = fn;
block/blk-timeout.c +7 -92
123 lines not on this page · raw message
block/blk.h +0 -1
@@ -224,7 +224,6 @@ static inline bool bio_integrity_endio(struct bio *bio) }#endif /* CONFIG_BLK_DEV_INTEGRITY */ -void blk_timeout_work (struct work_struct *work);unsigned long blk_rq_timeout (unsigned long timeout);void blk_add_timer (struct request *req);void blk_delete_timer (struct request *);
block/bsg-lib.c +3 -3
@@ -305,8 +305,8 @@ static enum blk_eh_timer_return bsg_timeout(struct request *rq, bool reserved)enum blk_eh_timer_return ret =BLK_EH_DONE ;struct request_queue *q = rq->q; -if (q->rq_timed_out_fn) - ret = q->rq_timed_out_fn (rq); +if (q->bsg_job_timeout_fn) + ret = q->bsg_job_timeout_fn (rq);return ret; }
@@ -355,9 +355,9 @@ struct request_queue *bsg_setup_queue(struct device *dev, const char *name, q->queuedata = dev; q->bsg_job_fn = job_fn; + q->bsg_job_timeout_fn = timeout;blk_queue_flag_set (QUEUE_FLAG_BIDI , q);blk_queue_rq_timeout (q,BLK_DEFAULT_SG_TIMEOUT ); - q->rq_timed_out_fn = timeout; ret =bsg_register_queue (q, dev, name, &bsg_transport_ops);if (ret) {
include/linux/blkdev.h +1 -3
@@ -442,7 +442,6 @@ struct request_queue {make_request_fn *make_request_fn;poll_q_fn *poll_fn;softirq_done_fn *softirq_done_fn; -rq_timed_out_fn *rq_timed_out_fn;dma_drain_needed_fn *dma_drain_needed;lld_busy_fn *lld_busy_fn;/* Called just after a request is allocated */
@@ -543,7 +542,6 @@ struct request_queue {struct timer_list timeout;struct work_struct timeout_work; -struct list_head timeout_list;struct list_head icq_list;#ifdef CONFIG_BLK_CGROUP
@@ -603,6 +601,7 @@ struct request_queue {#if defined(CONFIG_BLK_DEV_BSG )bsg_job_fn *bsg_job_fn; +rq_timed_out_fn *bsg_job_timeout_fn;struct bsg_class_device bsg_dev;#endif
@@ -1159,7 +1158,6 @@ extern void blk_queue_virt_boundary(struct request_queue *, unsigned long);extern void blk_queue_dma_alignment (struct request_queue *,int );extern void blk_queue_update_dma_alignment (struct request_queue *,int );extern void blk_queue_softirq_done (struct request_queue *,softirq_done_fn *); -extern void blk_queue_rq_timed_out (struct request_queue *,rq_timed_out_fn *);extern void blk_queue_rq_timeout (struct request_queue *,unsigned int );extern void blk_queue_flush_queueable (struct request_queue *q,bool queueable);extern void blk_queue_write_cache (struct request_queue *q,bool enabled,bool fua);
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 23/28 block: kill lld busy
In reply to Jens AxboeNobody sets the helper, so we always return 0. Kill it.
--- block/blk-core.c | 28 ---------------------------- block/blk-settings.c | 6 ------ drivers/md/dm-mpath.c | 4 +--- include/linux/blkdev.h | 4 ---- 4 files changed, 1 insertion(+), 41 deletions(-)
block/blk-core.c +0 -28
@@ -1795,34 +1795,6 @@ void rq_flush_dcache_pages(struct request *rq)EXPORT_SYMBOL_GPL (rq_flush_dcache_pages);#endif -/** -* blk_lld_busy - Check if underlying low-level drivers of a device are busy -* @q : the queue of the device being checked -* -* Description: -* Check if underlying low-level drivers of a device are busy. -* If the drivers want to export their busy state, they must set own -* exporting function using blk_queue_lld_busy() first. -* -* Basically, this function is used only by request stacking drivers -* to stop dispatching requests to underlying devices when underlying -* devices are busy. This behavior helps more I/O merging on the queue -* of the request stacking driver and prevents I/O throughput regression -* on burst I/O load. -* -* Return: -* 0 - Not busy (The request stacking driver should dispatch request) -* 1 - Busy (The request stacking driver should stop dispatching request) -*/ -int blk_lld_busy (struct request_queue *q) -{ -if (q->lld_busy_fn) -return q->lld_busy_fn (q); - -return 0 ; -} -EXPORT_SYMBOL_GPL (blk_lld_busy); -/** * blk_rq_unprep_clone - Helper function to free all bios in a cloned request * @rq: the clone request to be cleaned up
block/blk-settings.c +0 -6
@@ -32,12 +32,6 @@ void blk_queue_rq_timeout(struct request_queue *q, unsigned int timeout) }EXPORT_SYMBOL_GPL (blk_queue_rq_timeout); -void blk_queue_lld_busy (struct request_queue *q,lld_busy_fn *fn) -{ - q->lld_busy_fn = fn; -} -EXPORT_SYMBOL_GPL (blk_queue_lld_busy); -/** * blk_set_default_limits - reset limits to default values * @lim: the queue_limits structure to reset
drivers/md/dm-mpath.c +1 -3
@@ -1936,9 +1936,7 @@ static int multipath_iterate_devices(struct dm_target *ti,static int pgpath_busy (struct pgpath *pgpath) { -struct request_queue *q =bdev_get_queue (pgpath->path.dev->bdev); - -return blk_lld_busy (q); +return 0 ; }/*
include/linux/blkdev.h +0 -4
@@ -312,7 +312,6 @@ typedef bool (poll_q_fn) (struct request_queue *q, blk_qc_t);struct bio_vec ;typedef void (softirq_done_fn )(struct request *);typedef int (dma_drain_needed_fn )(struct request *); -typedef int (lld_busy_fn ) (struct request_queue *q);typedef int (bsg_job_fn ) (struct bsg_job *);typedef int (init_rq_fn )(struct request_queue *,struct request *,gfp_t );typedef void (exit_rq_fn )(struct request_queue *,struct request *);
@@ -443,7 +442,6 @@ struct request_queue {poll_q_fn *poll_fn;softirq_done_fn *softirq_done_fn;dma_drain_needed_fn *dma_drain_needed; -lld_busy_fn *lld_busy_fn;/* Called just after a request is allocated */ init_rq_fn *init_rq_fn;/* Called just before a request is freed */
@@ -909,7 +907,6 @@ extern void blk_init_request_from_bio(struct request *req, struct bio *bio);extern void blk_put_request (struct request *);extern struct request *blk_get_request (struct request_queue *,unsigned int op,blk_mq_req_flags_t flags); -extern int blk_lld_busy (struct request_queue *q); extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src, struct bio_set *bs, gfp_t gfp_mask, int (*bio_ctr)(struct bio *, struct bio *, void *),
@@ -1152,7 +1149,6 @@ extern void blk_queue_update_dma_pad(struct request_queue *, unsigned int);extern int blk_queue_dma_drain (struct request_queue *q,dma_drain_needed_fn *dma_drain_needed,void *buf,unsigned int size); -extern void blk_queue_lld_busy (struct request_queue *q,lld_busy_fn *fn);extern void blk_queue_segment_boundary (struct request_queue *,unsigned long );extern void blk_queue_virt_boundary (struct request_queue *,unsigned long );extern void blk_queue_dma_alignment (struct request_queue *,int );
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 24/28 block: remove request_list code
In reply to Jens AxboeIt's now dead code, nobody uses it.
--- block/blk-cgroup.c | 47 ---------------- block/blk-core.c | 75 -------------------------- block/blk-mq.c | 4 -- block/blk.h | 3 -- include/linux/blk-cgroup.h | 108 ------------------------------------- include/linux/blkdev.h | 34 ------------ 6 files changed, 271 deletions(-)
block/blk-cgroup.c +0 -47
@@ -76,9 +76,6 @@ static void blkg_free(struct blkcg_gq *blkg)if (blkg->pd[i]) blkcg_policy[i]->pd_free_fn (blkg->pd[i]); -if (blkg->blkcg != &blkcg_root) -blk_exit_rl (blkg->q, &blkg->rl); -blkg_rwstat_exit (&blkg->stat_ios);blkg_rwstat_exit (&blkg->stat_bytes);kfree (blkg);
@@ -142,13 +139,6 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q,INIT_LIST_HEAD (&blkg->q_node); blkg->blkcg = blkcg; -/* root blkg uses @q->root_rl, init rl only for !root blkgs */ -if (blkcg != &blkcg_root) { -if (blk_init_rl (&blkg->rl, q, gfp_mask)) - goto err_free; - blkg->rl.blkg = blkg; - } -for (i =0 ; i <BLKCG_MAX_POLS ; i++) {struct blkcg_policy *pol = blkcg_policy[i];struct blkg_policy_data *pd;
@@ -448,42 +438,6 @@ static void blkg_destroy_all(struct request_queue *q) } q->root_blkg =NULL ; - q->root_rl.blkg =NULL ; -} - -/* -* The next function used by blk_queue_for_each_rl(). It's a bit tricky -* because the root blkg uses @q->root_rl instead of its own rl. -*/ -struct request_list *__blk_queue_next_rl (struct request_list *rl, -struct request_queue *q) -{ -struct list_head *ent; -struct blkcg_gq *blkg; - -/* -* Determine the current blkg list_head. The first entry is -* root_rl which is off @q->blkg_list and mapped to the head. -*/ -if (rl == &q->root_rl) { - ent = &q->blkg_list; -/* There are no more block groups, hence no request lists */ -if (list_empty (ent)) -return NULL ; - }else { - blkg = container_of(rl, struct blkcg_gq, rl); - ent = &blkg->q_node; - } - -/* walk to the next list_head, skip root blkcg */ - ent = ent->next; -if (ent == &q->root_blkg->q_node) - ent = ent->next; -if (ent == &q->blkg_list) -return NULL ; - - blkg = container_of(ent, struct blkcg_gq, q_node); -return &blkg->rl; } static int blkcg_reset_stats(struct cgroup_subsys_state *css,
@@ -1278,7 +1232,6 @@ int blkcg_init_queue(struct request_queue *q)if (IS_ERR (blkg)) goto err_unlock; q->root_blkg = blkg; - q->root_rl.blkg = blkg;spin_unlock_irq (q->queue_lock);rcu_read_unlock ();
block/blk-core.c +0 -75
81 lines not on this page · raw message
block/blk-mq.c +0 -4
@@ -326,10 +326,6 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data, rq->end_io_data =NULL ; rq->next_rq =NULL ; -#ifdef CONFIG_BLK_CGROUP - rq->rl =NULL ; -#endif - data->ctx->rq_dispatched[op_is_sync (op)]++;refcount_set (&rq->ref,1 );return rq;
block/blk.h +0 -3
@@ -120,9 +120,6 @@ struct blk_flush_queue *blk_alloc_flush_queue(struct request_queue *q, int node, int cmd_size, gfp_t flags);void blk_free_flush_queue (struct blk_flush_queue *q); -int blk_init_rl (struct request_list *rl,struct request_queue *q, -gfp_t gfp_mask); -void blk_exit_rl (struct request_queue *q,struct request_list *rl);void blk_exit_queue (struct request_queue *q);void blk_rq_bio_prep (struct request_queue *q,struct request *rq,struct bio *bio);
include/linux/blk-cgroup.h +0 -108
126 lines not on this page · raw message
include/linux/blkdev.h +0 -34
@@ -58,22 +58,6 @@ struct blk_stat_callback;typedef void (rq_end_io_fn )(struct request *,blk_status_t ); -struct request_list { -struct request_queue *q;/* the queue this rl belongs to */ -#ifdef CONFIG_BLK_CGROUP -struct blkcg_gq *blkg;/* blkg this request pool belongs to */ -#endif -/* -* count[], starved[], and wait[] are indexed by -* BLK_RW_SYNC/BLK_RW_ASYNC -*/ -int count[2 ]; -int starved[2 ]; -mempool_t *rq_pool; -wait_queue_head_t wait[2 ]; -unsigned int flags; -}; -/* * request flags */ typedef __u32 __bitwise req_flags_t ;
@@ -259,10 +243,6 @@ struct request {/* for bidi */ struct request *next_rq; - -#ifdef CONFIG_BLK_CGROUP -struct request_list *rl;/* rl this rq is alloced from */ -#endif };static inline bool blk_op_is_scsi (unsigned int op)
@@ -313,8 +293,6 @@ struct bio_vec;typedef void (softirq_done_fn )(struct request *);typedef int (dma_drain_needed_fn )(struct request *);typedef int (bsg_job_fn ) (struct bsg_job *); -typedef int (init_rq_fn )(struct request_queue *,struct request *,gfp_t ); -typedef void (exit_rq_fn )(struct request_queue *,struct request *);enum blk_eh_timer_return {BLK_EH_DONE ,/* drivers has completed the command */
@@ -430,22 +408,10 @@ struct request_queue {struct blk_queue_stats *stats;struct rq_qos *rq_qos; -/* -* If blkcg is not used, @q->root_rl serves all requests. If blkcg -* is used, root blkg allocates from @q->root_rl and all other -* blkgs from their own blkg->rl. Which one to use should be -* determined using bio_request_list(). -*/ -struct request_list root_rl; -make_request_fn *make_request_fn;poll_q_fn *poll_fn;softirq_done_fn *softirq_done_fn;dma_drain_needed_fn *dma_drain_needed; -/* Called just after a request is allocated */ -init_rq_fn *init_rq_fn; -/* Called just before a request is freed */ -exit_rq_fn *exit_rq_fn;const struct blk_mq_ops *mq_ops;
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 25/28 block: kill request slab cache
In reply to Jens Axboe--- block/blk-core.c | 8 -------- block/blk.h | 1 - 2 files changed, 9 deletions(-)
block/blk-core.c +0 -8
@@ -57,11 +57,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(block_unplug);DEFINE_IDA (blk_queue_ida); -/* -* For the allocated request tables -*/ -struct kmem_cache *request_cachep; -/* * For queue allocation */
@@ -1941,9 +1936,6 @@ int __init blk_dev_init(void)if (!kblockd_workqueue)panic ("Failed to create kblockd\n" ); - request_cachep =kmem_cache_create ("blkdev_requests" , -sizeof (struct request ),0 ,SLAB_PANIC ,NULL ); - blk_requestq_cachep =kmem_cache_create ("request_queue" ,sizeof (struct request_queue ),0 ,SLAB_PANIC ,NULL );
block/blk.h +0 -1
@@ -32,7 +32,6 @@ struct blk_flush_queue { };extern struct kmem_cache *blk_requestq_cachep; -extern struct kmem_cache *request_cachep;extern struct kobj_type blk_queue_ktype;extern struct ida blk_queue_ida;
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 26/28 block: remove req_no_special_merge() from merging code
In reply to Jens AxboeIt'll always be false at this point, just remove it.
--- block/blk-merge.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-)
block/blk-merge.c +3 -22
@@ -595,17 +595,6 @@ int ll_front_merge_fn(struct request_queue *q, struct request *req,return ll_new_hw_segment (q, req, bio); } -/* -* blk-mq uses req->special to carry normal driver per-request payload, it -* does not indicate a prepared command that we cannot merge with. -*/ -static bool req_no_special_merge (struct request *req) -{ -struct request_queue *q = req->q; - -return !q->mq_ops && req->special; -} -static bool req_attempt_discard_merge (struct request_queue *q,struct request *req,struct request *next) {
@@ -631,13 +620,6 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,unsigned int seg_size = req->biotail->bi_seg_back_size + next->bio->bi_seg_front_size; -/* -* First check if the either of the requests are re-queued -* requests. Can't merge them if they are. -*/ -if (req_no_special_merge (req) ||req_no_special_merge (next)) -return 0 ; -if (req_gap_back_merge (req, next->bio))return 0 ;
@@ -738,8 +720,7 @@ static struct request *attempt_merge(struct request_queue *q,return NULL ;if (rq_data_dir (req) !=rq_data_dir (next) - || req->rq_disk != next->rq_disk - ||req_no_special_merge (next)) + || req->rq_disk != next->rq_disk)return NULL ; if (req_op(req) == REQ_OP_WRITE_SAME &&
@@ -858,8 +839,8 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)if (bio_data_dir (bio) !=rq_data_dir (rq))return false; -/* must be same device and not a special request */ -if (rq->rq_disk != bio->bi_disk ||req_no_special_merge (rq)) +/* must be same device */ +if (rq->rq_disk != bio->bi_disk)return false;/* only merge integrity protected bio into ditto rq */
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 27/28 blk-merge: kill dead queue lock held check
In reply to Jens AxboeThis is dead code, any queue reaching this part has mq_ops attached.
--- block/blk-merge.c | 3 --- 1 file changed, 3 deletions(-)
block/blk-merge.c +0 -3
@@ -704,9 +704,6 @@ static void blk_account_io_merge(struct request *req)static struct request *attempt_merge (struct request_queue *q,struct request *req,struct request *next) { -if (!q->mq_ops) -lockdep_assert_held (q->queue_lock); -if (!rq_mergeable (req) || !rq_mergeable (next))return NULL ;
Signature · 1 line
2.17.1
Jens Axboe
maintainerPATCH 28/28 block: get rid of blk_queued_rq()
In reply to Jens AxboeNo point in hiding what this does, just open code it in the one spot where we are still using it.
--- block/blk-mq.c | 2 +- include/linux/blkdev.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
block/blk-mq.c +1 -1
@@ -692,7 +692,7 @@ void blk_mq_requeue_request(struct request *rq, bool kick_requeue_list)/* this request will be re-inserted to io scheduler queue */ blk_mq_sched_requeue_request (rq); -BUG_ON (blk_queued_rq (rq)); +BUG_ON (!list_empty (&rq->queuelist));blk_mq_add_to_requeue_list (rq, true, kick_requeue_list); }EXPORT_SYMBOL (blk_mq_requeue_request);
include/linux/blkdev.h +0 -2
@@ -678,8 +678,6 @@ static inline bool blk_account_rq(struct request *rq)#define blk_rq_cpu_valid (rq) ((rq)->cpu != -1)#define blk_bidi_rq (rq) ((rq)->next_rq != NULL) -/* rq->queuelist of dequeued request must be list_empty() */ -#define blk_queued_rq (rq) (!list_empty(&(rq)->queuelist))#define list_entry_rq (ptr) list_entry((ptr), struct request, queuelist)
Signature · 1 line
2.17.1
Bart Van Assche
maintainerRe: [PATCH 05/28] IB/srp: remove old request_fn_active check
In reply to Jens AxboeQuoted 19 lines · Jens Axboe
This check is only viable for non scsi-mq. Since that is going away, kill this legacy check.
Cc Bart Van Assche <[email protected]>>Cc: Parav Pandit <[email protected]>>Cc: [email protected]Signed-off-by Jens Axboe <[email protected]>>---
drivers/infiniband/ulp/srp/ib_srp.c|7 -------1 file changed, 7 deletions(-)drivers/infiniband/ulp/srp/ib_srp.c +1
-1--- a/drivers/infiniband/ulp/srp/ib_srp.c +-+-+- b/drivers/infiniband/ulp/srp/ib_srp.c@@-1334,13 +-1334,6 @@static void
srp_terminate_io(struct srp_rport *rport)
structscsi_device*sdev;> int i, j;>drivers/infiniband/ulp/srp/ib_srp.c +0
-5-/*>- *Invoking srp_terminate_io() while srp_queuecommand() is running -*is not safe. Hence the warning statement below. -*/ -shost_for_each_device (sdev, shost) - WARN_ON_ONCE(sdev->request_queue->request_fn_active);>-
Quoted 1 line
for (i =0;i <target->ch_count;i+-+-) {> ch =&target->ch[i];It seems like Hannes' and my Signed-off-by/Reviewed-by tags are missing? See also https://marc.info/?l=linux-scsi&m=153970174514608.
Bart.
Jens Axboe
maintainerRe: [PATCH 05/28] IB/srp: remove old request_fn_active check
Quoted 20 lines · Bart Van Assche
Quoted 19 lines · Jens Axboe
This check is only viable for non scsi-mq. Since that is going away, kill this legacy check.
Cc Bart Van Assche <[email protected]>Cc Parav Pandit <[email protected]>Signed-off-by Jens Axboe <[email protected]>--- drivers/infiniband/ulp/srp/ib_srp.c | 7 ------- 1 file changed, 7 deletions(-)drivers/infiniband/ulp/srp/ib_srp.c +0
-0@@ -1334,13 +1334,6 @@ static void srp_terminate_io(struct srp_rport *rport)struct scsi_device *sdev;int i, j;
Quoted 12 lines
drivers/infiniband/ulp/srp/ib_srp.c static void srp_terminate_io(struct srp_rport *rport) · line 1338
Quoted 9 lines
drivers/infiniband/ulp/srp/ib_srp.c +0
-7-/* -* Invoking srp_terminate_io() while srp_queuecommand() is running -* is not safe. Hence the warning statement below. -*/ -shost_for_each_device (sdev, shost) -WARN_ON_ONCE (sdev->request_queue->request_fn_active); -for (i =0 ; i < target->ch_count; i++) { ch = &target->ch[i];It seems like Hannes' and my Signed-off-by/Reviewed-by tags are missing? See also https://marc.info/?l=linux-scsi&m=153970174514608.
Sorry, forgot to update that one. I'll do that for v2. Thanks for letting me know.
Signature · 1 line
Jens Axboe
Bart Van Assche
maintainerRe: [PATCH 08/28] scsi: kill off the legacy IO path
In reply to Jens AxboeQuoted 12 lines · Jens Axboe
@@-3265,25 +-3261,17 @@qla2x00_probe_one(struct
pci_dev*pdev, const structpci_device_id*id)base_vha->mgmt_svr_loop_id, host->sg_tablesize);> if (ha->mqenable) {>- bool mq =false;> bool startit =false;>(quoted diff) +0
-1- if (QLA_TGT_MODE_ENABLED()) {>- mq =true;>+- if (QLA_TGT_MODE_ENABLED())startit =false;>- }>(quoted diff) +0
-1- if ((ql2x_ini_mode ==QLA2XXX_INI_MODE_ENABLED) &&>- shost_use_blk_mq(host)) {>- mq =true;>+- if (ql2x_ini_mode ==QLA2XXX_INI_MODE_ENABLED)startit =true;>- }>(quoted diff) +2
-3- if (mq) {>- /*Create start of day qpairs for Block MQ */ - for (i =0;i <ha->max_qpairs;i+-+-) - qla2xxx_create_qpair(base_vha, 5, 0, startit);>- }>+- /*Create start of day qpairs for Block MQ */ +- for (i =0;i <ha->max_qpairs;i+-+-) +- qla2xxx_create_qpair(base_vha, 5, 0, startit);> }>
Quoted 1 line
if (ha->flags.running_gold_fw)
(+-Himanshu)
Since I'm not sure that "mq"in the above code refers to "scsi-mq"nor that it refers to "blk-mq" I'm not sure the above changes should be included in this patch. Himanshu, can you have a look?
Quoted 3 lines
+-static ssize_t
+-show_use_blk_mq(struct device *dev, struct device_attribute *attr, char *buf)
+-{>+- return snprintf(buf, 20, "1\n";>+-}>+-static DEVICE_ATTR(use_blk_mq, S_IRUGO, show_use_blk_mq, NULL);The pattern "snprintf(buf, 20, ...)"looks like cargo-cult programming to me. Please consider changing "snprintf(buf, 20, "into "sprintf(buf, "
Thanks,
Bart.
Bart Van Assche
maintainerRe: [PATCH 23/28] block: kill lld busy
In reply to Jens AxboeQuoted 1 line · Jens Axboe
Nobody sets the helper, so we always return 0. Kill it.
How about changing the description of this patch into something like "Now that the blk_lld_busy() and blk_queue_lld_busy() callers have been removed, also remove the implementations of these functions."
Thanks,
Bart.
Jens Axboe
maintainerRe: [PATCH 08/28] scsi: kill off the legacy IO path
In reply to Bart Van AsscheQuoted 31 lines · Bart Van Assche
Quoted 30 lines · Jens Axboe
drivers/scsi/qla2xxx/qla_os.c +5
-13@@ -3265,25 +3261,17 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) base_vha->mgmt_svr_loop_id, host->sg_tablesize);if (ha->mqenable) { -bool mq = false;bool startit = false; -if (QLA_TGT_MODE_ENABLED ()) { - mq = true; +if (QLA_TGT_MODE_ENABLED ()) startit = false; - } -if ((ql2x_ini_mode ==QLA2XXX_INI_MODE_ENABLED ) && -shost_use_blk_mq (host)) { - mq = true; +if (ql2x_ini_mode ==QLA2XXX_INI_MODE_ENABLED ) startit = true; - } -if (mq) { -/* Create start of day qpairs for Block MQ */ -for (i =0 ; i < ha->max_qpairs; i++) -qla2xxx_create_qpair (base_vha,5 ,0 , startit); - } +/* Create start of day qpairs for Block MQ */ +for (i =0 ; i < ha->max_qpairs; i++) +qla2xxx_create_qpair (base_vha,5 ,0 , startit); }
Quoted 7 lines
drivers/scsi/qla2xxx/qla_os.c qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · line 3277
Quoted 1 line
drivers/scsi/qla2xxx/qla_os.c +0
-0if (ha->flags.running_gold_fw)(+Himanshu)
Since I'm not sure that "mq" in the above code refers to "scsi-mq" nor that it refers to "blk-mq", I'm not sure the above changes should be included in this patch. Himanshu, can you have a look?
There's literally a comment there that says "for Block MQ" :-)
Quoted 9 lines
drivers/scsi/scsi_sysfs.c show_host_busy(struct device *dev, struct device_attribute *attr, char *buf) · line 393
Quoted 6 lines
drivers/scsi/scsi_sysfs.c +6
-0+static ssize_t +show_use_blk_mq (struct device *dev,struct device_attribute *attr,char *buf) +{ +return snprintf (buf,20 ,"1\n" ); +} +static DEVICE_ATTR(use_blk_mq, S_IRUGO, show_use_blk_mq, NULL);The pattern "
snprintf(buf, 20, ...)" looks like cargo-cult programming to me. Please consider changing "snprintf(buf, 20, " into "sprintf(buf, ".
Good point, I'll do that.
Signature · 1 line
Jens Axboe
Jens Axboe
maintainerRe: [PATCH 23/28] block: kill lld busy
In reply to Bart Van AsscheQuoted 6 lines · Bart Van Assche
Quoted 1 line · Jens Axboe
Nobody sets the helper, so we always return 0. Kill it.
How about changing the description of this patch into something like "Now that the
blk_lld_busy()andblk_queue_lld_busy()callers have been removed, also remove the implementations of these functions."?
Sure, I can improve the commit message.
Signature · 1 line
Jens Axboe
Re: [PATCH 08/28] scsi: kill off the legacy IO path
In reply to Jens AxboeJens,=20
Quoted 7 lines · Jens Axboe
=20
External Email
=20Quoted 2 lines · Bart Van Assche
Review qla2x00_probe_one(struct pci_dev *pdev, const s=
Quoted 1 line · Jens Axboe
(quoted diff) +0
-0@@ -3265,25 +3261,17 @@ qla2x00_probe_one(struct pci_dev *pdev, const s=
truct pci_device_id *id)
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
drivers/scsi/qla2xxx/qla_os.c +0
-0base_vha->mgmt_svr_loop_id, host->sg_tablesize);=20
if (ha->mqenable) { - bool mq =3D false; bool startit =3D false;=20
drivers/scsi/qla2xxx/qla_os.c +1
-3-if (QLA_TGT_MODE_ENABLED ()) { - mq =3D true; +if (QLA_TGT_MODE_ENABLED ()) startit =3D false; - }=20
(quoted diff) +0
-3- if ((ql2x_ini_mode =3D=3D QLA2XXX_INI_MODE_ENABLED) && - shost_use_blk_mq(host)) { - mq =3D true;
Quoted 8 lines
Quoted 8 lines
drivers/scsi/qla2xxx/qla_os.c qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
Quoted 8 lines
(quoted diff) +1
-1+ if (ql2x_ini_mode =3D=3D QLA2XXX_INI_MODE_ENABLED) startit =3D true; - }=20
drivers/scsi/qla2xxx/qla_os.c +0
-4- if (mq) { - /* Create start of day qpairs for Block MQ */ - for (i =3D 0; i < ha->max_qpairs; i++) - qla2xxx_create_qpair(base_vha, 5, 0, start=
it);
Quoted 11 lines
Quoted 11 lines
Quoted 7 lines
drivers/scsi/qla2xxx/qla_os.c +3
-1- } +/* Create start of day qpairs for Block MQ */ + for (i =3D 0; i < ha->max_qpairs; i++) +qla2xxx_create_qpair (base_vha,5 ,0 , startit); }=20
if (ha->flags.running_gold_fw)=20
(+Himanshu)
=20
Since I'm not sure that "mq" in the above code refers to "scsi-mq" nor t=
hat it
Quoted 1 line
Quoted 1 line
refers to "blk-mq", I'm not sure the above changes should be included in=
this
Quoted 3 lines
Quoted 1 line
patch. Himanshu, can you have a look?
=20
There's literally a comment there that says "for Block MQ" :-)
This change is Good.
We were using mq boolean to determine if we are in Target mode or Initiator=
with BLK-MQ on
to create qpair in firmware.
Since this patch is removing shost_use_blk_mq)(), so the mq boolean becomes=
no-op.=20
Quoted 2 lines
Quoted 2 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+static ssize_t +show_use_blk_mq(struct device *dev, struct device_attribute *attr, cha=
r *buf)
Quoted 6 lines
Quoted 6 lines
drivers/scsi/scsi_sysfs.c show_host_busy(struct device *dev, struct device_attribute *attr, char *buf) · line 393
Quoted 4 lines
drivers/scsi/scsi_sysfs.c +4
-0+{ +return snprintf (buf,20 ,"1\n" ); +} +static DEVICE_ATTR(use_blk_mq, S_IRUGO, show_use_blk_mq, NULL);=20
The pattern "snprintf(buf, 20, ...)" looks like cargo-cult programming t=
o me.
Quoted 7 lines
Quoted 1 line
Please consider changing "snprintf(buf, 20, " into "sprintf(buf, ".
=20
Good point, I'll do that.
=20
--
Jens Axboe
=20
Thanks,
- Himanshu
Jens Axboe
maintainerRe: [PATCH 08/28] scsi: kill off the legacy IO path
Quoted 46 lines · Himanshu
Jens,
Quoted 44 lines · Jens Axboe
External Email
Quoted 38 lines · Bart Van Assche
Quoted 21 lines · Jens Axboe
drivers/scsi/qla2xxx/qla_os.c +2
-9@@ -3265,25 +3261,17 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) base_vha->mgmt_svr_loop_id, host->sg_tablesize);if (ha->mqenable) { -bool mq = false;bool startit = false; -if (QLA_TGT_MODE_ENABLED ()) { - mq = true; +if (QLA_TGT_MODE_ENABLED ()) startit = false; - } -if ((ql2x_ini_mode ==QLA2XXX_INI_MODE_ENABLED ) && -shost_use_blk_mq (host)) { - mq = true; +if (ql2x_ini_mode ==QLA2XXX_INI_MODE_ENABLED ) startit = true; - } -if (mq) {drivers/scsi/qla2xxx/qla_os.c qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · line 3277
Quoted 10 lines
drivers/scsi/qla2xxx/qla_os.c +3
-4-/* Create start of day qpairs for Block MQ */ -for (i =0 ; i < ha->max_qpairs; i++) -qla2xxx_create_qpair (base_vha,5 ,0 , startit); - } +/* Create start of day qpairs for Block MQ */ +for (i =0 ; i < ha->max_qpairs; i++) +qla2xxx_create_qpair (base_vha,5 ,0 , startit); }if (ha->flags.running_gold_fw)(+Himanshu)
Since I'm not sure that "mq" in the above code refers to "scsi-mq" nor that it refers to "blk-mq", I'm not sure the above changes should be included in this patch. Himanshu, can you have a look?
Quoted 8 lines
Quoted 1 line
There's literally a comment there that says "for Block MQ" :-)
This change is Good.
We were using mq boolean to determine if we are in Target mode or Initiator with BLK-MQ on to create qpair in firmware.
Since this patch is removing shost_use_blk_mq)(), so the mq boolean becomes no-op.
Thanks for checking. Can I add your acked-by or reviewed-by to the patch?
Signature · 1 line
Jens Axboe
Madhani, Himanshu
Acked-byRe: [PATCH 08/28] scsi: kill off the legacy IO path
Quoted 8 lines · Jens Axboe
=20
External Email
=20Quoted 2 lines · Himanshu
Jens,
=20
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines · Jens Axboe
=20
External Email
=20Quoted 2 lines · Bart Van Assche
Review qla2x00_probe_one(struct pci_dev *pdev, const=
Quoted 1 line · Jens Axboe
(quoted diff) +0
-0@@ -3265,25 +3261,17 @@ qla2x00_probe_one(struct pci_dev *pdev, const=
struct pci_device_id *id)
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
drivers/scsi/qla2xxx/qla_os.c +0
-0base_vha->mgmt_svr_loop_id, host->sg_tablesize);=20
if (ha->mqenable) {- bool mq =3D false; bool startit =3D false;=20
drivers/scsi/qla2xxx/qla_os.c +1
-3-if (QLA_TGT_MODE_ENABLED ()) { - mq =3D true; +if (QLA_TGT_MODE_ENABLED ()) startit =3D false; - }=20
(quoted diff) +0
-3- if ((ql2x_ini_mode =3D=3D QLA2XXX_INI_MODE_ENABLED) && - shost_use_blk_mq(host)) { - mq =3D true;
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/scsi/qla2xxx/qla_os.c qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
Quoted 8 lines
(quoted diff) +1
-1+ if (ql2x_ini_mode =3D=3D QLA2XXX_INI_MODE_ENABLED) startit =3D true; - }=20
drivers/scsi/qla2xxx/qla_os.c +0
-4- if (mq) { - /* Create start of day qpairs for Block MQ */ - for (i =3D 0; i < ha->max_qpairs; i++) - qla2xxx_create_qpair(base_vha, 5, 0, sta=
rtit);
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 7 lines
drivers/scsi/qla2xxx/qla_os.c +3
-1- } +/* Create start of day qpairs for Block MQ */ + for (i =3D 0; i < ha->max_qpairs; i++) +qla2xxx_create_qpair (base_vha,5 ,0 , startit); }=20
if (ha->flags.running_gold_fw)=20
(+Himanshu)
=20
Since I'm not sure that "mq" in the above code refers to "scsi-mq" nor=
that it
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
refers to "blk-mq", I'm not sure the above changes should be included =
in this
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
patch. Himanshu, can you have a look?
=20
There's literally a comment there that says "for Block MQ" :-)=20
This change is Good.
=20
We were using mq boolean to determine if we are in Target mode or Initia=
tor with BLK-MQ on
Quoted 3 lines
Quoted 3 lines
to create qpair in firmware.
=20
Since this patch is removing shost_use_blk_mq)(), so the mq boolean beco=
mes no-op.
Quoted 3 lines
=20
Thanks for checking. Can I add your acked-by or reviewed-by to the patch? =20
Yes, for qla2xxx changes
Quoted 2 lines
--
Jens Axboe
Thanks,
- Himanshu
Bart Van Assche
maintainerQuoted 8 lines · Jens Axboe
The first round of this went into 4.20-rc, but we've still some of them pending. This patch series converts the remaining drivers to blk-mq. The ones that support dual paths (like SCSI and DM) have the non-mq path removed. At the end, legacy IO code and schedulers are killed off.
This patch series is on top of my for-linus branch. It can also be bound in my mq-conversions branch.
Hi Jens,
I cloned your mq-conversions branch and ran the block, srp and nvmeof-mp test groups from the blktests project. The result of these tests on my setup is the same as with kernel v4.19: except for a few false positive lockdep complaints, all tests pass. The most recent commit that is involved in the false positive lockdep complaints I encountered is 87915adc3f0a ("workqueue: re-add lockdep dependencies for flushing". Patches are being discussed to address these false positives.
Bart.
Jens Axboe
maintainerQuoted 12 lines · Bart Van Assche
Quoted 8 lines · Jens Axboe
The first round of this went into 4.20-rc, but we've still some of them pending. This patch series converts the remaining drivers to blk-mq. The ones that support dual paths (like SCSI and DM) have the non-mq path removed. At the end, legacy IO code and schedulers are killed off.
This patch series is on top of my for-linus branch. It can also be bound in my mq-conversions branch.
Hi Jens,
Quoted 7 lines
I cloned your mq-conversions branch and ran the block, srp and nvmeof-mp test groups from the blktests project. The result of these tests on my setup is the same as with kernel v4.19: except for a few false positive lockdep complaints, all tests pass. The most recent commit that is involved in the false positive lockdep complaints I encountered is
87915adc3f0a("workqueue: re-add lockdep dependencies for flushing"). Patches are being discussed to address these false positives.
Great, thanks for doing this testing, Bart!
Signature · 1 line
Jens Axboe
Re: [PATCH 05/28] IB/srp: remove old request_fn_active check
In reply to Jens AxboeQuoted 20 lines · Jens Axboe
This check is only viable for non scsi-mq. Since that is going away, kill this legacy check.
Cc Bart Van Assche <[email protected]>Cc Parav Pandit <[email protected]>Signed-off-by Jens Axboe <[email protected]>--- drivers/infiniband/ulp/srp/ib_srp.c | 7 ------- 1 file changed, 7 deletions(-)drivers/infiniband/ulp/srp/ib_srp.c +0
-0@@ -1334,13 +1334,6 @@ static void srp_terminate_io(struct srp_rport *rport)struct scsi_device *sdev;int i, j;
drivers/infiniband/ulp/srp/ib_srp.c static void srp_terminate_io(struct srp_rport *rport) · line 1339
Quoted 10 lines
drivers/infiniband/ulp/srp/ib_srp.c +0
-7-/* -* Invoking srp_terminate_io() while srp_queuecommand() is running -* is not safe. Hence the warning statement below. -*/ -shost_for_each_device (sdev, shost) -WARN_ON_ONCE (sdev->request_queue->request_fn_active); -for (i =0 ; i < target->ch_count; i++) { ch = &target->ch[i];
I _think_ I've already killed that one; please do check the latest tree from Doug Ledford.
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
Jens Axboe
maintainerRe: [PATCH 05/28] IB/srp: remove old request_fn_active check
Quoted 20 lines · Hannes Reinecke
Quoted 19 lines · Jens Axboe
This check is only viable for non scsi-mq. Since that is going away, kill this legacy check.
Cc Bart Van Assche <[email protected]>Cc Parav Pandit <[email protected]>Signed-off-by Jens Axboe <[email protected]>--- drivers/infiniband/ulp/srp/ib_srp.c | 7 ------- 1 file changed, 7 deletions(-)drivers/infiniband/ulp/srp/ib_srp.c +0
-0@@ -1334,13 +1334,6 @@ static void srp_terminate_io(struct srp_rport *rport)struct scsi_device *sdev;int i, j;
Quoted 13 lines
drivers/infiniband/ulp/srp/ib_srp.c static void srp_terminate_io(struct srp_rport *rport) · line 1339
Quoted 11 lines
drivers/infiniband/ulp/srp/ib_srp.c +0
-7-/* -* Invoking srp_terminate_io() while srp_queuecommand() is running -* is not safe. Hence the warning statement below. -*/ -shost_for_each_device (sdev, shost) -WARN_ON_ONCE (sdev->request_queue->request_fn_active); -for (i =0 ; i < target->ch_count; i++) { ch = &target->ch[i];I _think_ I've already killed that one; please do check the latest tree from Doug Ledford.
I don't know which tree is Doug's, but as long as it's queued up for mainline, that's all I care about. I'm still rebasing this branch, so it'll just get dropped when it shows up in mainline.
Signature · 1 line
Jens Axboe
Bart Van Assche
maintainerRe: [PATCH 05/28] IB/srp: remove old request_fn_active check
Quoted 27 lines · Jens Axboe
Quoted 9 lines · Hannes Reinecke
Quoted 8 lines · Jens Axboe
This check is only viable for non scsi-mq. Since that is going away, kill this legacy check.
Cc Bart Van Assche <[email protected]>>>>Cc: Parav Pandit <[email protected]>>>>Cc: [email protected]Signed-off-by Jens Axboe <[email protected]>>>>---drivers/infiniband/ulp/srp/ib_srp.c |7 ------- 1 file changed, 7 deletions(-)Quoted 16 lines
drivers/infiniband/ulp/srp/ib_srp.c
Quoted 13 lines
drivers/infiniband/ulp/srp/ib_srp.c +1
-1--- a/drivers/infiniband/ulp/srp/ib_srp.c +-+-+- b/drivers/infiniband/ulp/srp/ib_srp.c@@-1334,13 +-1334,6 @@static void
srp_terminate_io(struct srp_rport *rport)drivers/infiniband/ulp/srp/ib_srp.c +0
-5struct scsi_device *sdev;>>> int i, j;>>> -/*>>>- *Invoking srp_terminate_io() while srp_queuecommand() is running -*is not safe. Hence the warning statement below. -*/ -shost_for_each_device (sdev, shost) - WARN_ON_ONCE(sdev->request_queue->request_fn_active);>>>- for (i =0;i <target->ch_count;i+-+-) {>>> ch =&target->ch[i];>>>I _think_I've already killed that one;please do check the latest tree from Doug Ledford.
Quoted 3 lines
I don't know which tree is Doug's, but as long as it's queued up for mainline, that's all I care about. I'm still rebasing this branch, so it'll just get dropped when it shows up in mainline.
Doug and Jason share a git repository. I think this is the git repository they ask Linus to pull from: git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git.
Although Doug had reported to have queued the above patch I haven't found that patch in the RDMA git repository.
Bart.
Re: [PATCH 01/28] sunvdc: convert to blk-mq
In reply to Jens AxboeQuoted 8 lines · Jens Axboe
Convert from the old
request_fnstyle driver to blk-mq.Cc David Miller <[email protected]>Signed-off-by Jens Axboe <[email protected]>--- drivers/block/sunvdc.c | 149 +++++++++++++++++++++++++++-------------- 1 file changed, 98 insertions(+), 51 deletions(-)
Cheers,
Hannes
Re: [PATCH 02/28] ms_block: convert to blk-mq
In reply to Jens AxboeQuoted 5 lines · Jens Axboe
Straight forward conversion, room for optimization in how everything is punted to a work queue. Also looks plenty racy all over the map, with the state changes. I fixed a bunch of them up while doing the conversion, but there are surely more.
Quoted 7 lines
Cc Maxim Levitsky <[email protected]>Signed-off-by Jens Axboe <[email protected]>--- drivers/memstick/core/ms_block.c | 110 +++++++++++++++++-------------- drivers/memstick/core/ms_block.h | 1 + 2 files changed, 62 insertions(+), 49 deletions(-)
Cheers,
Hannes
Re: [PATCH 03/28] mspro_block: convert to blk-mq
In reply to Jens AxboeQuoted 7 lines · Jens Axboe
Straight forward conversion, there's room for improvement.
Signed-off-by Jens Axboe <[email protected]>--- drivers/memstick/core/mspro_block.c | 121 +++++++++++++++------------- 1 file changed, 66 insertions(+), 55 deletions(-)
Cheers,
Hannes
Re: [PATCH 04/28] ide: convert to blk-mq
In reply to Jens AxboeQuoted 9 lines · Jens Axboe
ide-disk and ide-cd tested as working just fine, ide-tape and ide-floppy haven't. But the latter don't require changes, so they should work without issue.
Add helper function to insert a request from a work queue, since we cannot invoke the blk-mq request insertion from IRQ context.
Cc David Miller <[email protected]>Signed-off-by Jens Axboe <[email protected]>
Quoted 11 lines
--- drivers/ide/ide-atapi.c | 25 ++++-- drivers/ide/ide-cd.c | 175 +++++++++++++++++++++------------------- drivers/ide/ide-disk.c | 5 +- drivers/ide/ide-io.c | 101 +++++++++++++---------- drivers/ide/ide-park.c | 4 +- drivers/ide/ide-pm.c | 28 ++----- drivers/ide/ide-probe.c | 68 +++++++++++----- include/linux/ide.h | 13 ++- 8 files changed, 240 insertions(+), 179 deletions(-)
There are some things here which are curious (like always setting the queue depth to 32, and the insert_head thingie), but as this is legacy anyway:
Cheers,
Hannes
Re: [PATCH 06/28] blk-mq: remove the request_list usage
In reply to Jens AxboeQuoted 7 lines · Jens Axboe
We don't do anything with it, that's just the legacy path.
Signed-off-by Jens Axboe <[email protected]>--- block/blk-mq.c | 5 ----- 1 file changed, 5 deletions(-)
Cheers,
Hannes
Re: [PATCH 07/28] blk-mq: remove legacy check in queue blk_freeze_queue()
In reply to Jens AxboeQuoted 11 lines · Jens Axboe
Signed-off-by Jens Axboe <[email protected]>--- block/blk-mq.c | 2 -- 1 file changed, 2 deletions(-)block/blk-mq.c +0
-0
block/blk-mq.c void blk_freeze_queue(struct request_queue *q) · line 182
Quoted 8 lines
block/blk-mq.c +0
-2@@ -177,8 +177,6 @@ void blk_freeze_queue(struct request_queue *q)* exported to drivers as the only user for unfreeze is blk_mq. */ blk_freeze_queue_start (q); -if (!q->mq_ops) -blk_drain_queue (q);blk_mq_freeze_queue_wait (q); }
Cheers,
Hannes
Jens Axboe
maintainerRe: [PATCH 04/28] ide: convert to blk-mq
In reply to Hannes ReineckeQuoted 21 lines · Hannes Reinecke
Quoted 9 lines · Jens Axboe
ide-disk and ide-cd tested as working just fine, ide-tape and ide-floppy haven't. But the latter don't require changes, so they should work without issue.
Add helper function to insert a request from a work queue, since we cannot invoke the blk-mq request insertion from IRQ context.
Cc David Miller <[email protected]>Signed-off-by Jens Axboe <[email protected]>Quoted 11 lines
--- drivers/ide/ide-atapi.c | 25 ++++-- drivers/ide/ide-cd.c | 175 +++++++++++++++++++++------------------- drivers/ide/ide-disk.c | 5 +- drivers/ide/ide-io.c | 101 +++++++++++++---------- drivers/ide/ide-park.c | 4 +- drivers/ide/ide-pm.c | 28 ++----- drivers/ide/ide-probe.c | 68 +++++++++++----- include/linux/ide.h | 13 ++- 8 files changed, 240 insertions(+), 179 deletions(-)
Quoted 3 lines
There are some things here which are curious (like always setting the queue depth to 32, and the
insert_headthingie), but as this is legacy anyway:
The insert head addition is needed, the alternative would be making the blk-mq locks irq safe. And that would be a performance hit that isn't acceptable. Perhaps I should make that clearer in the commit message...
The 32 hard code is a bit strange, but I doubt it matters that much. It's enough to saturate the drive for sure, and it'll be twice that number if a scheduler is attached, ensuring we have plenty of request to get the merging we want.
Quoted 1 line
Reviewed-by Hannes Reinecke <[email protected]>
Thanks!
Signature · 1 line
Jens Axboe
Re: [PATCH 11/28] bsg: pass in desired timeout handler
In reply to Jens AxboeQuoted 2 lines · Jens Axboe
This will ease in the conversion to blk-mq, where we can't set a timeout handler after queue init.
On thing I hoped to archive with the last round of bsg cleanups is to isolate the users of bsg from even knowing there is a struct request underneath. Based on that it would be nice to pass the struct bsg_job to the actual timeout handlers instead of struct request.
Re: [PATCH 12/28] bsg: provide bsg_remove_queue() helper
In reply to Jens AxboeQuoted 1 line · Jens Axboe
All drivers do unregister + cleanup, provide a helper for that.
Nice cleanup,
Re: [PATCH 13/28] bsg: convert to use blk-mq
In reply to Jens AxboeReview
Quoted 9 lines
(quoted diff) +9
-0+static enum blk_eh_timer_return bsg_timeout(struct request *rq, bool reserved) +{ + enum blk_eh_timer_return ret = BLK_EH_DONE; + struct request_queue *q = rq->q; + + if (q->rq_timed_out_fn) + ret = q->rq_timed_out_fn(rq); + + return ret;
This is pretty awkward. I guess it is ok as an intermediate step, but I really don't want to keep rq_timed_out_fn to just for bsg.
I think we should do something like this ontop of your series to move all the bsg-lib bits outside struct request_queue:
block/bsg-lib.c +22 -12
@@ -31,6 +31,12 @@#define uptr64 (val) ((void __user *)(uintptr_t)(val)) +struct bsg_set { +struct blk_mq_tag_set tag_set; +bsg_job_fn *job_fn; +bsg_timeout_fn *timeout_fn; +}; +static int bsg_transport_check_proto (struct sg_io_v4 *hdr) { if (hdr->protocol != BSG_PROTOCOL_SCSI ||
@@ -239,6 +245,8 @@ static blk_status_t bsg_queue_rq(struct blk_mq_hw_ctx *hctx,struct request_queue *q = hctx->queue;struct device *dev = q->queuedata;struct request *req = bd->rq; +struct bsg_set *bset = + container_of(q->tag_set, struct bsg_set, tag_set);int ret;blk_mq_start_request (req);
@@ -249,7 +257,7 @@ static blk_status_t bsg_queue_rq(struct blk_mq_hw_ctx *hctx,if (!bsg_prepare_job (dev, req))return BLK_STS_IOERR ; - ret = q->bsg_job_fn (blk_mq_rq_to_pdu (req)); + ret = bset->job_fn (blk_mq_rq_to_pdu (req));if (ret)return BLK_STS_IOERR ;
@@ -302,13 +310,12 @@ EXPORT_SYMBOL_GPL(bsg_remove_queue);static enum blk_eh_timer_return bsg_timeout (struct request *rq,bool reserved) { -enum blk_eh_timer_return ret =BLK_EH_DONE ; -struct request_queue *q = rq->q; - -if (q->bsg_job_timeout_fn) - ret = q->bsg_job_timeout_fn (rq); +struct bsg_set *bset = + container_of(rq->q->tag_set, struct bsg_set, tag_set); -return ret; +if (!bset->timeout_fn) +return BLK_EH_DONE ; +return bset->timeout_fn (rq); }static const struct blk_mq_ops bsg_mq_ops = {
@@ -328,16 +335,21 @@ static const struct blk_mq_ops bsg_mq_ops = {* @dd_job_size: size of LLD data needed for each job */ struct request_queue *bsg_setup_queue (struct device *dev,const char *name, -bsg_job_fn *job_fn,rq_timed_out_fn *timeout,int dd_job_size) +bsg_job_fn *job_fn,bsg_timeout_fn *timeout,int dd_job_size) { +struct bsg_set *bset;struct blk_mq_tag_set *set;struct request_queue *q;int ret = -ENOMEM ; - set =kzalloc (sizeof (*set),GFP_KERNEL ); -if (!set) + bset =kzalloc (sizeof (*bset),GFP_KERNEL ); +if (!bset)return ERR_PTR (-ENOMEM ); + bset->job_fn = job_fn; + bset->timeout_fn = timeout; + + set = &bset->tag_set; set->ops = &bsg_mq_ops, set->nr_hw_queues =1 ; set->queue_depth =128 ;
@@ -354,8 +366,6 @@ struct request_queue *bsg_setup_queue(struct device *dev, const char *name, } q->queuedata = dev; - q->bsg_job_fn = job_fn; - q->bsg_job_timeout_fn = timeout;blk_queue_flag_set (QUEUE_FLAG_BIDI , q);blk_queue_rq_timeout (q,BLK_DEFAULT_SG_TIMEOUT );
include/linux/blkdev.h +0 -5
@@ -292,15 +292,12 @@ typedef bool (poll_q_fn) (struct request_queue *q, blk_qc_t);struct bio_vec ;typedef void (softirq_done_fn )(struct request *);typedef int (dma_drain_needed_fn )(struct request *); -typedef int (bsg_job_fn ) (struct bsg_job *);enum blk_eh_timer_return {BLK_EH_DONE ,/* drivers has completed the command */ BLK_EH_RESET_TIMER ,/* reset timer and try again */ }; -typedef enum blk_eh_timer_return (rq_timed_out_fn )(struct request *); -enum blk_queue_state { Queue_down, Queue_up,
@@ -564,8 +561,6 @@ struct request_queue {atomic_t mq_freeze_depth;#if defined(CONFIG_BLK_DEV_BSG ) -bsg_job_fn *bsg_job_fn; -rq_timed_out_fn *bsg_job_timeout_fn;struct bsg_class_device bsg_dev;#endif
include/linux/bsg-lib.h +4 -1
@@ -31,6 +31,9 @@ struct device;struct scatterlist ;struct request_queue ; +typedef int (bsg_job_fn ) (struct bsg_job *); +typedef enum blk_eh_timer_return (bsg_timeout_fn )(struct request *); +struct bsg_buffer {unsigned int payload_len;int sg_cnt;
@@ -72,7 +75,7 @@ struct bsg_job {void bsg_job_done (struct bsg_job *job,int result,unsigned int reply_payload_rcv_len);struct request_queue *bsg_setup_queue (struct device *dev,const char *name, -bsg_job_fn *job_fn,rq_timed_out_fn *timeout,int dd_job_size); +bsg_job_fn *job_fn,bsg_timeout_fn *timeout,int dd_job_size);void bsg_remove_queue (struct request_queue *q);void bsg_job_put (struct bsg_job *job);int __must_check bsg_job_get (struct bsg_job *job);
Jens Axboe
maintainerRe: [PATCH 11/28] bsg: pass in desired timeout handler
In reply to Christoph HellwigQuoted 9 lines · Christoph Hellwig
Quoted 2 lines · Jens Axboe
This will ease in the conversion to blk-mq, where we can't set a timeout handler after queue init.
On thing I hoped to archive with the last round of bsg cleanups is to isolate the users of bsg from even knowing there is a struct request underneath. Based on that it would be nice to pass the struct
bsg_jobto the actual timeout handlers instead of struct request.
Makes sense, I can make that change.
Signature · 1 line
Jens Axboe
Jens Axboe
maintainerRe: [PATCH 13/28] bsg: convert to use blk-mq
In reply to Christoph HellwigQuoted 4 lines · Christoph Hellwig
Quoted 4 lines
(quoted diff) +4
-0+static enum blk_eh_timer_return bsg_timeout(struct request *rq, bool reserved) +{ + enum blk_eh_timer_return ret = BLK_EH_DONE; + struct request_queue *q = rq->q;
Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ + if (q->rq_timed_out_fn) + ret = q->rq_timed_out_fn(rq); + + return ret;This is pretty awkward. I guess it is ok as an intermediate step, but I really don't want to keep
rq_timed_out_fnto just for bsg.
Me neither.
Quoted 2 lines
I think we should do something like this ontop of your series to move all the bsg-lib bits outside struct
request_queue:
Looks good to me, I'll queue this up after this patch to clean things up nicely.
I added this incremental on top, you missed some error handling and cleanup bits. Care to send as a proper patch?
block/bsg-lib.c +5 -4
@@ -299,12 +299,13 @@ static void bsg_exit_rq(struct blk_mq_tag_set *set, struct request *req,void bsg_remove_queue (struct request_queue *q) { -struct blk_mq_tag_set *set = q->tag_set; +struct bsg_set *bset = + container_of(q->tag_set, struct bsg_set, tag_set);bsg_unregister_queue (q);blk_cleanup_queue (q); -blk_mq_free_tag_set (set); -kfree (set); +blk_mq_free_tag_set (&bset->tag_set); +kfree (bset); }EXPORT_SYMBOL_GPL (bsg_remove_queue);
@@ -382,7 +383,7 @@ struct request_queue *bsg_setup_queue(struct device *dev, const char *name, out_queue:blk_mq_free_tag_set (set); out_tag_set: -kfree (set); +kfree (bset);return ERR_PTR (ret); }EXPORT_SYMBOL_GPL (bsg_setup_queue);
Signature · 1 line
Jens Axboe
Re: [PATCH 08/28] scsi: kill off the legacy IO path
In reply to Jens AxboeQuoted 13 lines · Jens Axboe
Signed-off-by Jens Axboe <[email protected]>--- Documentation/scsi/scsi-parameters.txt | 5 - drivers/scsi/Kconfig | 12 - drivers/scsi/cxlflash/main.c | 6 - drivers/scsi/hosts.c | 29 +- drivers/scsi/lpfc/lpfc_scsi.c | 2 +- drivers/scsi/qedi/qedi_main.c | 3 +- drivers/scsi/qla2xxx/qla_os.c | 30 +- drivers/scsi/scsi.c | 5 +- drivers/scsi/scsi_debug.c | 3 +- drivers/scsi/scsi_error.c | 2 +-
Quoted 9 lines
drivers/scsi/scsi_lib.c | 624 ++----------------------- drivers/scsi/scsi_priv.h | 1 - drivers/scsi/scsi_scan.c | 10 +- drivers/scsi/scsi_sysfs.c | 8 +- drivers/scsi/ufs/ufshcd.c | 6 - include/scsi/scsi_host.h | 18 +- include/scsi/scsi_tcq.h | 14 +- 17 files changed, 73 insertions(+), 705 deletions(-)
Cheers,
Hannes
Re: [PATCH 09/28] dm: remove legacy IO path
In reply to Jens AxboeQuoted 16 lines · Jens Axboe
dm supports both, and since we're killing off the legacy path in general, get rid of it in dm as well.
Signed-off-by Jens Axboe <[email protected]>--- drivers/md/Kconfig | 11 -- drivers/md/dm-core.h | 10 -- drivers/md/dm-mpath.c | 14 +- drivers/md/dm-rq.c | 293 ++++-------------------------------------- drivers/md/dm-rq.h | 4 - drivers/md/dm-sysfs.c | 3 +- drivers/md/dm-table.c | 36 +----- drivers/md/dm.c | 21 +-- drivers/md/dm.h | 1 - 9 files changed, 35 insertions(+), 358 deletions(-)
[ .. ]
drivers/md/dm-rq.c int dm_mq_init_request_queue(struct mapped_device *md, struct dm_table *t) · line 555
Quoted 12 lines
drivers/md/dm-rq.c +0
-5@@ -790,11 +550,6 @@ int dm_mq_init_request_queue(struct mapped_device *md, struct dm_table *t)struct dm_target *immutable_tgt;int err; -if (!dm_table_all_blk_mq_devices (t)) { -DMERR ("request-based dm-mq may only be stacked on blk-mq device(s)" ); -return -EINVAL ; - } - md->tag_set =kzalloc_node (sizeof (struct blk_mq_tag_set ),GFP_KERNEL , md->numa_node_id);if (!md->tag_set)return -ENOMEM ;
That warnint is still valid, no?
[ .. ]
Quoted 4 lines
drivers/md/dm.c +0
-0@@ -2217,13 +2211,6 @@ int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t)switch (type) {case DM_TYPE_REQUEST_BASED :
drivers/md/dm.c int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t) · line 2216
Quoted 10 lines
drivers/md/dm.c +0
-7-dm_init_normal_md_queue (md); - r =dm_old_init_request_queue (md, t); -if (r) { -DMERR ("Cannot initialize queue for request-based mapped device" ); -return r; - } -break ;case DM_TYPE_MQ_REQUEST_BASED : r =dm_mq_init_request_queue (md, t);if (r) {
I'd love to kill DM_TYPE_REQUEST_BASED completely, seeing that it's referring to the now-defunct legacy I/O path. Mike?
Cheers,
Hannes
Re: [PATCH 10/28] dasd: remove dead code
In reply to Jens AxboeQuoted 44 lines · Jens Axboe
Since
e443343e509awe haven't had arequest_fnattached to this driver, hence any code inside an if (q->request_fn) is unreachable.Fixes e443343e509a ("s390/dasd: blk-mq conversion")[sth: Keep and fix the dasd_info->chanq_len counter.]Reviewed-by Jan Hoeppner <[email protected]>Signed-off-by Stefan Haberland <[email protected]>Signed-off-by Jens Axboe <[email protected]>--- drivers/s390/block/dasd_ioctl.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-)drivers/s390/block/dasd_ioctl.c +1
-14@@ -412,6 +412,7 @@ static int dasd_ioctl_information(struct dasd_block *block,struct ccw_dev_id dev_id;struct dasd_device *base;struct ccw_device *cdev; +struct list_head *l;unsigned long flags;int rc;@@ -462,23 +463,10 @@ static int dasd_ioctl_information(struct dasd_block *block,memcpy (dasd_info->type, base->discipline->name,4 ); -if (block->request_queue->request_fn) { -struct list_head *l; -#ifdef DASD_EXTENDED_PROFILING - { -struct list_head *l; -spin_lock_irqsave (&block->lock, flags); -list_for_each (l, &block->request_queue->queue_head) - dasd_info->req_queue_len++; -spin_unlock_irqrestore (&block->lock, flags); - } -#endif /* DASD_EXTENDED_PROFILING */ -spin_lock_irqsave (get_ccwdev_lock (base->cdev), flags); -list_for_each (l, &base->ccw_queue) - dasd_info->chanq_len++;
drivers/s390/block/dasd_ioctl.c static int dasd_ioctl_information(struct dasd_block *block, · line 472
Quoted 10 lines
drivers/s390/block/dasd_ioctl.c +4
-3-spin_unlock_irqrestore (get_ccwdev_lock (base->cdev), - flags); - } +spin_lock_irqsave (&block->queue_lock, flags); +list_for_each (l, &base->ccw_queue) + dasd_info->chanq_len++; +spin_unlock_irqrestore (&block->queue_lock, flags); rc =0 ; if (copy_to_user(argp, dasd_info,
Cheers,
Hannes
Re: [PATCH 11/28] bsg: pass in desired timeout handler
In reply to Jens AxboeQuoted 7 lines · Jens Axboe
This will ease in the conversion to blk-mq, where we can't set a timeout handler after queue init.
Cc Johannes Thumshirn <[email protected]>Cc Benjamin Block <[email protected]>Signed-off-by Jens Axboe <[email protected]>
Quoted 8 lines
--- block/bsg-lib.c | 3 ++- drivers/scsi/scsi_transport_fc.c | 7 +++---- drivers/scsi/scsi_transport_iscsi.c | 2 +- drivers/scsi/scsi_transport_sas.c | 4 ++-- include/linux/bsg-lib.h | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-)
Cheers,
Hannes
Re: [PATCH 12/28] bsg: provide bsg_remove_queue() helper
In reply to Jens AxboeQuoted 6 lines · Jens Axboe
All drivers do unregister + cleanup, provide a helper for that.
Cc Johannes Thumshirn <[email protected]>Cc Benjamin Block <[email protected]>Signed-off-by Jens Axboe <[email protected]>
Quoted 8 lines
--- block/bsg-lib.c | 7 +++++++ drivers/scsi/scsi_transport_fc.c | 6 ++---- drivers/scsi/scsi_transport_iscsi.c | 7 +++---- drivers/scsi/scsi_transport_sas.c | 6 ++---- include/linux/bsg-lib.h | 1 + 5 files changed, 15 insertions(+), 12 deletions(-)
Cheers,
Hannes
Re: [PATCH 13/28] bsg: convert to use blk-mq
In reply to Jens AxboeQuoted 11 lines · Jens Axboe
Requires a few changes to the FC transport class as well.
Cc Johannes Thumshirn <[email protected]>Cc Benjamin Block <[email protected]>Signed-off-by Jens Axboe <[email protected]>--- block/bsg-lib.c | 123 +++++++++++++++++++------------ drivers/scsi/scsi_transport_fc.c | 59 +++++++++------ 2 files changed, 110 insertions(+), 72 deletions(-)
Cheers,
Hannes
Re: [PATCH 14/28] block: remove blk_complete_request()
In reply to Jens AxboeQuoted 8 lines · Jens Axboe
It's now unused.
Signed-off-by Jens Axboe <[email protected]>--- block/blk-softirq.c | 20 -------------------- include/linux/blkdev.h | 1 - 2 files changed, 21 deletions(-)
Cheers,
Hannes
Re: [PATCH 15/28] blk-wbt: kill check for legacy queue type
In reply to Jens AxboeQuoted 9 lines · Jens Axboe
Everything is blk-mq at this point, so it doesn't make any sense to have this option available as it does nothing.
Signed-off-by Jens Axboe <[email protected]>--- block/Kconfig | 6 ------ block/blk-wbt.c | 3 +-- 2 files changed, 1 insertion(+), 8 deletions(-)
Cheers,
Hannes
Re: [PATCH 16/28] blk-cgroup: remove legacy queue bypassing
In reply to Jens AxboeQuoted 7 lines · Jens Axboe
We only support mq devices now.
Signed-off-by Jens Axboe <[email protected]>--- block/blk-cgroup.c | 8 -------- 1 file changed, 8 deletions(-)
Cheers,
Hannes
Re: [PATCH 17/28] block: remove legacy rq tagging
In reply to Jens AxboeQuoted 13 lines · Jens Axboe
It's now unused, kill it.
Signed-off-by Jens Axboe <[email protected]>--- Documentation/block/biodoc.txt | 88 -------- block/Makefile | 2 +- block/blk-core.c | 6 - block/blk-mq-debugfs.c | 2 - block/blk-mq-tag.c | 6 +- block/blk-sysfs.c | 3 - block/blk-tag.c | 378 --------------------------------- include/linux/blkdev.h | 35 --- 8 files changed, 3 insertions(+), 517 deletions(-)
Quoted 2 lines
delete mode 100644
block/blk-tag.c
Cheers,
Hannes
Re: [PATCH 18/28] block: remove non mq parts from the flush code
In reply to Jens AxboeQuoted 6 lines · Jens Axboe
Signed-off-by Jens Axboe <[email protected]>--- block/blk-flush.c | 154 +++++++++------------------------------------- block/blk.h | 4 +- 2 files changed, 31 insertions(+), 127 deletions(-)
Cheers,
Hannes
Re: [PATCH 21/28] block: remove __blk_put_request()
In reply to Jens AxboeQuoted 5 lines · Jens Axboe
Now there's no difference between
blk_put_request()and__blk_put_request()anymore, get rid of the underscore version and convert the few callers.Signed-off-by Jens Axboe <[email protected]>
Quoted 12 lines
--- block/blk-core.c | 9 --------- block/blk-merge.c | 2 +- drivers/scsi/osd/osd_initiator.c | 4 ++-- drivers/scsi/osst.c | 2 +- drivers/scsi/scsi_error.c | 2 +- drivers/scsi/sg.c | 2 +- drivers/scsi/st.c | 2 +- drivers/target/target_core_pscsi.c | 2 +- include/linux/blkdev.h | 1 - 9 files changed, 8 insertions(+), 18 deletions(-)
Cheers,
Hannes
Re: [PATCH 22/28] block: kill legacy parts of timeout handling
In reply to Jens AxboeQuoted 5 lines · Jens Axboe
The only user of legacy timing now is BSG, which is invoked from the mq timeout handler. Kill the legacy code, and rename the
q->rq_timed_out_fntoq->bsg_job_timeout_fn.Signed-off-by Jens Axboe <[email protected]>
Quoted 9 lines
--- block/blk-core.c | 1 - block/blk-settings.c | 7 --- block/blk-timeout.c | 99 +++--------------------------------------- block/blk.h | 1 - block/bsg-lib.c | 6 +-- include/linux/blkdev.h | 4 +- 6 files changed, 11 insertions(+), 107 deletions(-)
Cheers,
Hannes
Re: [PATCH 23/28] block: kill lld busy
In reply to Jens AxboeQuoted 71 lines · Jens Axboe
Nobody sets the helper, so we always return 0. Kill it.
Signed-off-by Jens Axboe <[email protected]>--- block/blk-core.c | 28 ---------------------------- block/blk-settings.c | 6 ------ drivers/md/dm-mpath.c | 4 +--- include/linux/blkdev.h | 4 ---- 4 files changed, 1 insertion(+), 41 deletions(-)block/blk-core.c +0
-28@@ -1795,34 +1795,6 @@ void rq_flush_dcache_pages(struct request *rq)EXPORT_SYMBOL_GPL (rq_flush_dcache_pages);#endif -/** -* blk_lld_busy - Check if underlying low-level drivers of a device are busy -* @q : the queue of the device being checked -* -* Description: -* Check if underlying low-level drivers of a device are busy. -* If the drivers want to export their busy state, they must set own -* exporting function using blk_queue_lld_busy() first. -* -* Basically, this function is used only by request stacking drivers -* to stop dispatching requests to underlying devices when underlying -* devices are busy. This behavior helps more I/O merging on the queue -* of the request stacking driver and prevents I/O throughput regression -* on burst I/O load. -* -* Return: -* 0 - Not busy (The request stacking driver should dispatch request) -* 1 - Busy (The request stacking driver should stop dispatching request) -*/ -int blk_lld_busy (struct request_queue *q) -{ -if (q->lld_busy_fn) -return q->lld_busy_fn (q); - -return 0 ; -} -EXPORT_SYMBOL_GPL (blk_lld_busy); -/** * blk_rq_unprep_clone - Helper function to free all bios in a cloned request * @rq: the clone request to be cleaned up block/blk-settings.c +0
-6@@ -32,12 +32,6 @@ void blk_queue_rq_timeout(struct request_queue *q, unsigned int timeout) }EXPORT_SYMBOL_GPL (blk_queue_rq_timeout); -void blk_queue_lld_busy (struct request_queue *q,lld_busy_fn *fn) -{ - q->lld_busy_fn = fn; -} -EXPORT_SYMBOL_GPL (blk_queue_lld_busy); -/** * blk_set_default_limits - reset limits to default values * @lim: the queue_limits structure to reset drivers/md/dm-mpath.c +0
-0
drivers/md/dm-mpath.c static int multipath_iterate_devices(struct dm_target *ti, · line 1942
Quoted 10 lines
drivers/md/dm-mpath.c +1
-3@@ -1936,9 +1936,7 @@ static int multipath_iterate_devices(struct dm_target *ti,static int pgpath_busy (struct pgpath *pgpath) { -struct request_queue *q =bdev_get_queue (pgpath->path.dev->bdev); - -return blk_lld_busy (q); +return 0 ; }/*
Actually, I'm not quite sure this is correct; dm-mpath needs to return a busy status (via the '->busy' callback) to allow for back-pressure on the upper layers. Just disabling the callback will disable this.
Shouldn't we check if the tagmap is busy here?
Cheers,
Hannes
Re: [PATCH 24/28] block: remove request_list code
In reply to Jens AxboeQuoted 12 lines · Jens Axboe
It's now dead code, nobody uses it.
Signed-off-by Jens Axboe <[email protected]>--- block/blk-cgroup.c | 47 ---------------- block/blk-core.c | 75 -------------------------- block/blk-mq.c | 4 -- block/blk.h | 3 -- include/linux/blk-cgroup.h | 108 ------------------------------------- include/linux/blkdev.h | 34 ------------ 6 files changed, 271 deletions(-)
Cheers,
Hannes
Re: [PATCH 25/28] block: kill request slab cache
In reply to Jens AxboeQuoted 6 lines · Jens Axboe
Signed-off-by Jens Axboe <[email protected]>--- block/blk-core.c | 8 -------- block/blk.h | 1 - 2 files changed, 9 deletions(-)
Cheers,
Hannes
Re: [PATCH 26/28] block: remove req_no_special_merge() from merging code
In reply to Jens AxboeQuoted 7 lines · Jens Axboe
It'll always be false at this point, just remove it.
Signed-off-by Jens Axboe <[email protected]>--- block/blk-merge.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-)
Cheers,
Hannes
Re: [PATCH 27/28] blk-merge: kill dead queue lock held check
In reply to Jens AxboeQuoted 14 lines · Jens Axboe
This is dead code, any queue reaching this part has
mq_opsattached.Signed-off-by Jens Axboe <[email protected]>--- block/blk-merge.c | 3 --- 1 file changed, 3 deletions(-)block/blk-merge.c +0
-0
block/blk-merge.c static void blk_account_io_merge(struct request *req) · line 709
Quoted 9 lines
block/blk-merge.c +0
-3@@ -704,9 +704,6 @@ static void blk_account_io_merge(struct request *req)static struct request *attempt_merge (struct request_queue *q,struct request *req,struct request *next) { -if (!q->mq_ops) -lockdep_assert_held (q->queue_lock); -if (!rq_mergeable (req) || !rq_mergeable (next))return NULL ;
Cheers,
Hannes
Re: [PATCH 28/28] block: get rid of blk_queued_rq()
In reply to Jens AxboeQuoted 9 lines · Jens Axboe
No point in hiding what this does, just open code it in the one spot where we are still using it.
Signed-off-by Jens Axboe <[email protected]>--- block/blk-mq.c | 2 +- include/linux/blkdev.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
Cheers,
Hannes
Re: [PATCH 12/28] bsg: provide bsg_remove_queue() helper
In reply to Jens AxboeQuoted 37 lines · Jens Axboe
All drivers do unregister + cleanup, provide a helper for that.
Cc Johannes Thumshirn <[email protected]>Cc Benjamin Block <[email protected]>Signed-off-by Jens Axboe <[email protected]>--- block/bsg-lib.c | 7 +++++++ drivers/scsi/scsi_transport_fc.c | 6 ++---- drivers/scsi/scsi_transport_iscsi.c | 7 +++---- drivers/scsi/scsi_transport_sas.c | 6 ++---- include/linux/bsg-lib.h | 1 + 5 files changed, 15 insertions(+), 12 deletions(-)block/bsg-lib.c +7
-0@@ -296,6 +296,13 @@ static void bsg_exit_rq(struct request_queue *q, struct request *req)kfree (job->reply); } +void bsg_remove_queue (struct request_queue *q) +{ +bsg_unregister_queue (q); +blk_cleanup_queue (q); +} +EXPORT_SYMBOL_GPL (bsg_remove_queue); +/** * bsg_setup_queue - Create and add the bsg hooks so we can receive requests * @dev: device to attach bsg device to drivers/scsi/scsi_transport_fc.c +0
-0
drivers/scsi/scsi_transport_fc.c fc_bsg_rportadd(struct Scsi_Host *shost, struct fc_rport *rport) · line 3856
Quoted 10 lines
drivers/scsi/scsi_transport_fc.c +2
-4@@ -3851,10 +3851,8 @@ fc_bsg_rportadd(struct Scsi_Host *shost, struct fc_rport *rport)static void fc_bsg_remove (struct request_queue *q) { -if (q) { -bsg_unregister_queue (q); -blk_cleanup_queue (q); - } +if (q) +bsg_remove_queue (q); }
Not sure if I'm too late to the game, but as all callers do a "if (q)" check, can't we just move it into bsg_remove_queue()?
Otherwise:
Signature · 6 lines
Johannes Thumshirn SUSE Labs [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 16/28] blk-cgroup: remove legacy queue bypassing
In reply to Jens AxboeHi Jens,
On 25/10/18 23:10, Jens Axboe wrote:
[...]
block/blk-cgroup.c int blkcg_activate_policy(struct request_queue *q, · line 1490
Quoted 9 lines
block/blk-cgroup.c +0
-2@@ -1487,8 +1485,6 @@ int blkcg_activate_policy(struct request_queue *q, out_bypass_end:if (q->mq_ops)blk_mq_unfreeze_queue (q); -else -blk_queue_bypass_end (q);
Now that we only have mq, do we still need all these checks for q->mq_ops?
Signature · 6 lines
Johannes Thumshirn SUSE Labs [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Quoted 87 lines · Jens Axboe
The first round of this went into 4.20-rc, but we've still some of them pending. This patch series converts the remaining drivers to blk-mq. The ones that support dual paths (like SCSI and DM) have the non-mq path removed. At the end, legacy IO code and schedulers are killed off.
This patch series is on top of my for-linus branch. It can also be bound in my mq-conversions branch.
Documentation/block/biodoc.txt | 88 - Documentation/block/cfq-iosched.txt | 291 -- Documentation/scsi/scsi-parameters.txt | 5 - block/Kconfig | 6 - block/Kconfig.iosched | 61 - block/Makefile | 5 +- block/bfq-iosched.c | 1 - block/blk-cgroup.c | 55 - block/blk-core.c | 1860 +----------- block/blk-exec.c | 20 +- block/blk-flush.c | 154 +- block/blk-ioc.c | 46 +- block/blk-merge.c | 35 +- block/blk-mq-debugfs.c | 2 - block/blk-mq-tag.c | 6 +- block/blk-mq.c | 13 +- block/blk-settings.c | 49 - block/blk-softirq.c | 20 - block/blk-sysfs.c | 39 +- block/blk-tag.c | 378 --- block/blk-timeout.c | 99 +- block/blk-wbt.c | 3 +- block/blk.h | 60 +- block/bsg-lib.c | 131 +- block/cfq-iosched.c | 4916 -------------------------------- block/deadline-iosched.c | 560 ---- block/elevator.c | 447 +-- block/kyber-iosched.c | 1 - block/mq-deadline.c | 1 - block/noop-iosched.c | 124 - drivers/block/sunvdc.c | 149 +- drivers/ide/ide-atapi.c | 25 +- drivers/ide/ide-cd.c | 175 +- drivers/ide/ide-disk.c | 5 +- drivers/ide/ide-io.c | 101 +- drivers/ide/ide-park.c | 4 +- drivers/ide/ide-pm.c | 28 +- drivers/ide/ide-probe.c | 68 +- drivers/infiniband/ulp/srp/ib_srp.c | 7 - drivers/md/Kconfig | 11 - drivers/md/dm-core.h | 10 - drivers/md/dm-mpath.c | 18 +- drivers/md/dm-rq.c | 293 +- drivers/md/dm-rq.h | 4 - drivers/md/dm-sysfs.c | 3 +- drivers/md/dm-table.c | 36 +- drivers/md/dm.c | 21 +- drivers/md/dm.h | 1 - drivers/memstick/core/ms_block.c | 110 +- drivers/memstick/core/ms_block.h | 1 + drivers/memstick/core/mspro_block.c | 121 +- drivers/s390/block/dasd_ioctl.c | 22 +- drivers/scsi/Kconfig | 12 - drivers/scsi/cxlflash/main.c | 6 - drivers/scsi/hosts.c | 29 +- drivers/scsi/lpfc/lpfc_scsi.c | 2 +- drivers/scsi/osd/osd_initiator.c | 4 +- drivers/scsi/osst.c | 2 +- drivers/scsi/qedi/qedi_main.c | 3 +- drivers/scsi/qla2xxx/qla_os.c | 30 +- drivers/scsi/scsi.c | 5 +- drivers/scsi/scsi_debug.c | 3 +- drivers/scsi/scsi_error.c | 4 +- drivers/scsi/scsi_lib.c | 624 +--- drivers/scsi/scsi_priv.h | 1 - drivers/scsi/scsi_scan.c | 10 +- drivers/scsi/scsi_sysfs.c | 8 +- drivers/scsi/scsi_transport_fc.c | 72 +- drivers/scsi/scsi_transport_iscsi.c | 9 +- drivers/scsi/scsi_transport_sas.c | 10 +- drivers/scsi/sg.c | 2 +- drivers/scsi/st.c | 2 +- drivers/scsi/ufs/ufshcd.c | 6 - drivers/target/target_core_pscsi.c | 2 +- include/linux/blk-cgroup.h | 108 - include/linux/blkdev.h | 174 +- include/linux/bsg-lib.h | 3 +- include/linux/elevator.h | 90 +-
Quoted 8 lines
include/linux/ide.h | 13 +- include/linux/init.h | 1 - include/scsi/scsi_host.h | 18 +- include/scsi/scsi_tcq.h | 14 +- init/do_mounts_initrd.c | 3 - init/initramfs.c | 6 - init/main.c | 12 - 85 files changed, 833 insertions(+), 11144 deletions(-)
Hi Jens,
Kernel oops[2] is triggered when running elevator switch stress test[1].
[1] https://people.redhat.com/~minlei/tests/tools/elv-switch
[2] kernel oops
[ 399.702365] scsi 8:0:0:0: Direct-Access Linux scsi_debug 0188 PQ: 0 ANSI: 7 [ 399.703603] sd 8:0:0:0: Power-on or device reset occurred [ 399.709833] sd 8:0:0:0: [sdd] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB) [ 399.711745] sd 8:0:0:0: [sdd] Write Protect is off [ 399.712395] sd 8:0:0:0: [sdd] Mode Sense: 73 00 10 08 [ 399.715119] sd 8:0:0:0: [sdd] Write cache: enabled, read cache: enabled, supports DPO and FUA [ 399.803561] sd 8:0:0:0: [sdd] Attached SCSI disk [ 399.844825] sd 8:0:0:0: [sdd] Synchronizing SCSI cache [ 399.968945] scsi 8:0:0:0: Direct-Access Linux scsi_debug 0188 PQ: 0 ANSI: 7 [ 399.970077] sd 8:0:0:0: Power-on or device reset occurred [ 399.972904] sd 8:0:0:0: [sdd] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB) [ 399.974823] sd 8:0:0:0: [sdd] Write Protect is off [ 399.975411] sd 8:0:0:0: [sdd] Mode Sense: 73 00 10 08 [ 399.978052] sd 8:0:0:0: [sdd] Write cache: enabled, read cache: enabled, supports DPO and FUA [ 400.030588] BUG: unable to handle kernel NULL pointer dereference at 0000000000000500 [ 400.032195] PGD 0 P4D 0 [ 400.032482] Oops: 0000 [#1] PREEMPT SMP PTI [ 400.032945] CPU: 2 PID: 318 Comm: kworker/u8:5 Not tainted 4.19.0_0ffdea6679a9_mq-conversions+ #1 [ 400.033927] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.10.2-2.fc27 04/01/2014 [ 400.034915] Workqueue: events_unbound async_run_entry_fn [ 400.035536] RIP: 0010:bfq_reset_rate_computation+0x52/0x85 [ 400.036177] Code: 00 48 89 83 b0 00 00 00 8b 45 20 c1 e8 09 89 83 d8 00 00 00 48 89 83 d0 00 00 00 eb 0a c7 87 c8 00 00 00 00 00 00 00 48 8b 03 <48> 8b b8 00 05 00 00 48 85 ff 74 24 8b 8b c8 00 00 00 4c 8b 8b d0 [ 400.038300] RSP: 0018:ffffc90000a47c50 EFLAGS: 00010046 [ 400.038915] RAX: 0000000000000000 RBX: ffff88017ac2bc00 RCX: 0000000017d6067a [ 400.039746] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88017ac2bc00 [ 400.040573] RBP: ffff88017ac2bc00 R08: 00000000f461e6ac R09: 0000000000000006 [ 400.041361] R10: 000000000000020f R11: 0000000000000000 R12: ffff88016c130000 [ 400.042127] R13: 0000005d1c095013 R14: ffff88017ac2bf78 R15: 0000000000000020 [ 400.042957] FS: 0000000000000000(0000) GS:ffff88017bb00000(0000) knlGS:0000000000000000 [ 400.043895] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 400.044518] CR2: 0000000000000500 CR3: 0000000179c32004 CR4: 0000000000760ee0 [ 400.045294] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 400.046070] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 400.046843] PKRU: 55555554 [ 400.047144] Call Trace: [ 400.047438] bfq_finish_requeue_request+0x145/0x2fd [ 400.047977] blk_mq_free_request+0x49/0xea [ 400.048429] __scsi_execute+0x16c/0x17b [ 400.048885] scsi_mode_sense+0x113/0x265 [ 400.049356] sd_revalidate_disk+0xb5b/0x109a [sd_mod] [ 400.049947] ? __device_add_disk+0x3d2/0x3f6 [ 400.050415] sd_probe_async+0x10d/0x18b [sd_mod] [ 400.050924] async_run_entry_fn+0x6d/0x12b [ 400.051374] process_one_work+0x1da/0x313 [ 400.051841] ? rescuer_thread+0x282/0x282 [ 400.052313] worker_thread+0x1ca/0x295 [ 400.052769] kthread+0x115/0x11d [ 400.053127] ? kthread_park+0x76/0x76 [ 400.053531] ret_from_fork+0x35/0x40 [ 400.053929] Modules linked in: scsi_debug null_blk isofs iTCO_wdt iTCO_vendor_support i2c_i801 i2c_core lpc_ich mfd_core ip_tables sr_mod cdrom usb_storage sd_mod ahci libahci crc32c_intel libata virtio_scsi qemu_fw_cfg dm_mirror dm_region_hash dm_log dm_mod [last unloaded: null_blk] [ 400.056640] Dumping ftrace buffer: [ 400.057022] (ftrace buffer empty) [ 400.057418] CR2: 0000000000000500 [ 400.057820] ---[ end trace 812cbc0fe8802fdd ]---
Signature · 1 line
Ming
Jens Axboe
maintainerRe: [PATCH 12/28] bsg: provide bsg_remove_queue() helper
In reply to Johannes ThumshirnQuoted 43 lines · Johannes Thumshirn
Quoted 42 lines · Jens Axboe
All drivers do unregister + cleanup, provide a helper for that.
Cc Johannes Thumshirn <[email protected]>Cc Benjamin Block <[email protected]>Signed-off-by Jens Axboe <[email protected]>--- block/bsg-lib.c | 7 +++++++ drivers/scsi/scsi_transport_fc.c | 6 ++---- drivers/scsi/scsi_transport_iscsi.c | 7 +++---- drivers/scsi/scsi_transport_sas.c | 6 ++---- include/linux/bsg-lib.h | 1 + 5 files changed, 15 insertions(+), 12 deletions(-)block/bsg-lib.c +7
-0@@ -296,6 +296,13 @@ static void bsg_exit_rq(struct request_queue *q, struct request *req)kfree (job->reply); } +void bsg_remove_queue (struct request_queue *q) +{ +bsg_unregister_queue (q); +blk_cleanup_queue (q); +} +EXPORT_SYMBOL_GPL (bsg_remove_queue); +/** * bsg_setup_queue - Create and add the bsg hooks so we can receive requests * @dev: device to attach bsg device to drivers/scsi/scsi_transport_fc.c +0
-2@@ -3851,10 +3851,8 @@ fc_bsg_rportadd(struct Scsi_Host *shost, struct fc_rport *rport)static void fc_bsg_remove (struct request_queue *q) { -if (q) { -bsg_unregister_queue (q);
Quoted 8 lines
drivers/scsi/scsi_transport_fc.c fc_bsg_rportadd(struct Scsi_Host *shost, struct fc_rport *rport) · line 3856
Quoted 5 lines
drivers/scsi/scsi_transport_fc.c +2
-2-blk_cleanup_queue (q); - } +if (q) +bsg_remove_queue (q); }Not sure if I'm too late to the game, but as all callers do a "if (q)" check, can't we just move it into
bsg_remove_queue()?
Not too late, I'll make that change.
Signature · 1 line
Jens Axboe
Jens Axboe
maintainerRe: [PATCH 09/28] dm: remove legacy IO path
In reply to Hannes ReineckeQuoted 36 lines · Hannes Reinecke
Quoted 16 lines · Jens Axboe
dm supports both, and since we're killing off the legacy path in general, get rid of it in dm as well.
Signed-off-by Jens Axboe <[email protected]>--- drivers/md/Kconfig | 11 -- drivers/md/dm-core.h | 10 -- drivers/md/dm-mpath.c | 14 +- drivers/md/dm-rq.c | 293 ++++-------------------------------------- drivers/md/dm-rq.h | 4 - drivers/md/dm-sysfs.c | 3 +- drivers/md/dm-table.c | 36 +----- drivers/md/dm.c | 21 +-- drivers/md/dm.h | 1 - 9 files changed, 35 insertions(+), 358 deletions(-)[ .. ]
drivers/md/dm-rq.c int dm_mq_init_request_queue(struct mapped_device *md, struct dm_table *t) · line 555
Quoted 12 lines
drivers/md/dm-rq.c +0
-5@@ -790,11 +550,6 @@ int dm_mq_init_request_queue(struct mapped_device *md, struct dm_table *t)struct dm_target *immutable_tgt;int err; -if (!dm_table_all_blk_mq_devices (t)) { -DMERR ("request-based dm-mq may only be stacked on blk-mq device(s)" ); -return -EINVAL ; - } - md->tag_set =kzalloc_node (sizeof (struct blk_mq_tag_set ),GFP_KERNEL , md->numa_node_id);if (!md->tag_set)return -ENOMEM ;That warnint is still valid, no?
[ .. ]
Quoted 2 lines
(quoted diff) +0
-0@@ -2217,13 +2211,6 @@ int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t)
Quoted 15 lines
drivers/md/dm.c int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t) · line 2216
Quoted 12 lines
drivers/md/dm.c +0
-7switch (type) {case DM_TYPE_REQUEST_BASED : -dm_init_normal_md_queue (md); - r =dm_old_init_request_queue (md, t); -if (r) { -DMERR ("Cannot initialize queue for request-based mapped device" ); -return r; - } -break ;case DM_TYPE_MQ_REQUEST_BASED : r =dm_mq_init_request_queue (md, t);if (r) {I'd love to kill
DM_TYPE_REQUEST_BASEDcompletely, seeing that it's referring to the now-defunct legacy I/O path.
Mike?
For both of these, Mike carried a version that had some of those bits unified, and it's now in mainline. I have just dropped this version, was just carrying to resolve that dependency until mainline had it dropped.
Signature · 1 line
Jens Axboe
Jens Axboe
maintainerRe: [PATCH 16/28] blk-cgroup: remove legacy queue bypassing
In reply to Johannes ThumshirnQuoted 14 lines · Johannes Thumshirn
Hi Jens,
On 25/10/18 23:10, Jens Axboe wrote:
[...]block/blk-cgroup.c int blkcg_activate_policy(struct request_queue *q, · line 1490
Quoted 9 lines
block/blk-cgroup.c +0
-2@@ -1487,8 +1485,6 @@ int blkcg_activate_policy(struct request_queue *q, out_bypass_end:if (q->mq_ops)blk_mq_unfreeze_queue (q); -else -blk_queue_bypass_end (q);
Quoted 1 line
Now that we only have mq, do we still need all these checks for
q->mq_ops?
We need it for the cases where we can be passing in a stacked driver or an mq driver, or for cases where we explicitly register mq attributes, and that sort of thing.
Signature · 1 line
Jens Axboe
Re: [PATCH 16/28] blk-cgroup: remove legacy queue bypassing
Quoted 15 lines · Jens Axboe
Quoted 14 lines · Johannes Thumshirn
Hi Jens,
On 25/10/18 23:10, Jens Axboe wrote:
[...]Quoted 9 lines
block/blk-cgroup.c +0
-2@@ -1487,8 +1485,6 @@ int blkcg_activate_policy(struct request_queue *q, out_bypass_end:if (q->mq_ops)blk_mq_unfreeze_queue (q); -else -blk_queue_bypass_end (q);
Quoted 6 lines
Quoted 1 line
Now that we only have mq, do we still need all these checks for
q->mq_ops?We need it for the cases where we can be passing in a stacked driver or an mq driver, or for cases where we explicitly register mq attributes, and that sort of thing.
Ah ok. Guess we'll have to live with it then.
Johannes
Signature · 6 lines
Johannes Thumshirn SUSE Labs [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Jens Axboe
maintainerRe: [PATCH 23/28] block: kill lld busy
In reply to Hannes ReineckeQuoted 81 lines · Hannes Reinecke
Quoted 80 lines · Jens Axboe
Nobody sets the helper, so we always return 0. Kill it.
Signed-off-by Jens Axboe <[email protected]>--- block/blk-core.c | 28 ---------------------------- block/blk-settings.c | 6 ------ drivers/md/dm-mpath.c | 4 +--- include/linux/blkdev.h | 4 ---- 4 files changed, 1 insertion(+), 41 deletions(-)block/blk-core.c +0
-28@@ -1795,34 +1795,6 @@ void rq_flush_dcache_pages(struct request *rq)EXPORT_SYMBOL_GPL (rq_flush_dcache_pages);#endif -/** -* blk_lld_busy - Check if underlying low-level drivers of a device are busy -* @q : the queue of the device being checked -* -* Description: -* Check if underlying low-level drivers of a device are busy. -* If the drivers want to export their busy state, they must set own -* exporting function using blk_queue_lld_busy() first. -* -* Basically, this function is used only by request stacking drivers -* to stop dispatching requests to underlying devices when underlying -* devices are busy. This behavior helps more I/O merging on the queue -* of the request stacking driver and prevents I/O throughput regression -* on burst I/O load. -* -* Return: -* 0 - Not busy (The request stacking driver should dispatch request) -* 1 - Busy (The request stacking driver should stop dispatching request) -*/ -int blk_lld_busy (struct request_queue *q) -{ -if (q->lld_busy_fn) -return q->lld_busy_fn (q); - -return 0 ; -} -EXPORT_SYMBOL_GPL (blk_lld_busy); -/** * blk_rq_unprep_clone - Helper function to free all bios in a cloned request * @rq: the clone request to be cleaned up block/blk-settings.c +0
-6@@ -32,12 +32,6 @@ void blk_queue_rq_timeout(struct request_queue *q, unsigned int timeout) }EXPORT_SYMBOL_GPL (blk_queue_rq_timeout); -void blk_queue_lld_busy (struct request_queue *q,lld_busy_fn *fn) -{ - q->lld_busy_fn = fn; -} -EXPORT_SYMBOL_GPL (blk_queue_lld_busy); -/** * blk_set_default_limits - reset limits to default values * @lim: the queue_limits structure to reset drivers/md/dm-mpath.c +1
-3@@ -1936,9 +1936,7 @@ static int multipath_iterate_devices(struct dm_target *ti,static int pgpath_busy (struct pgpath *pgpath) { -struct request_queue *q =bdev_get_queue (pgpath->path.dev->bdev); - -return blk_lld_busy (q); +return 0 ; }
Quoted 6 lines
drivers/md/dm-mpath.c static int multipath_iterate_devices(struct dm_target *ti, · line 1942
Quoted 1 line
drivers/md/dm-mpath.c +0
-0/* Actually, I'm not quite sure this is correct; dm-mpath needs to return a busy status (via the '->busy' callback) to allow for back-pressure on the upper layers.
Just disabling the callback will disable this.
Shouldn't we check if the tagmap is busy here?
Mike? We can pretty easily make it just check for busy tags.
Signature · 1 line
Jens Axboe
Jens Axboe
maintainerQuoted 151 lines · Ming Lei
Quoted 87 lines · Jens Axboe
The first round of this went into 4.20-rc, but we've still some of them pending. This patch series converts the remaining drivers to blk-mq. The ones that support dual paths (like SCSI and DM) have the non-mq path removed. At the end, legacy IO code and schedulers are killed off.
This patch series is on top of my for-linus branch. It can also be bound in my mq-conversions branch.
Documentation/block/biodoc.txt | 88 - Documentation/block/cfq-iosched.txt | 291 -- Documentation/scsi/scsi-parameters.txt | 5 - block/Kconfig | 6 - block/Kconfig.iosched | 61 - block/Makefile | 5 +- block/bfq-iosched.c | 1 - block/blk-cgroup.c | 55 - block/blk-core.c | 1860 +----------- block/blk-exec.c | 20 +- block/blk-flush.c | 154 +- block/blk-ioc.c | 46 +- block/blk-merge.c | 35 +- block/blk-mq-debugfs.c | 2 - block/blk-mq-tag.c | 6 +- block/blk-mq.c | 13 +- block/blk-settings.c | 49 - block/blk-softirq.c | 20 - block/blk-sysfs.c | 39 +- block/blk-tag.c | 378 --- block/blk-timeout.c | 99 +- block/blk-wbt.c | 3 +- block/blk.h | 60 +- block/bsg-lib.c | 131 +- block/cfq-iosched.c | 4916 -------------------------------- block/deadline-iosched.c | 560 ---- block/elevator.c | 447 +-- block/kyber-iosched.c | 1 - block/mq-deadline.c | 1 - block/noop-iosched.c | 124 - drivers/block/sunvdc.c | 149 +- drivers/ide/ide-atapi.c | 25 +- drivers/ide/ide-cd.c | 175 +- drivers/ide/ide-disk.c | 5 +- drivers/ide/ide-io.c | 101 +- drivers/ide/ide-park.c | 4 +- drivers/ide/ide-pm.c | 28 +- drivers/ide/ide-probe.c | 68 +- drivers/infiniband/ulp/srp/ib_srp.c | 7 - drivers/md/Kconfig | 11 - drivers/md/dm-core.h | 10 - drivers/md/dm-mpath.c | 18 +- drivers/md/dm-rq.c | 293 +- drivers/md/dm-rq.h | 4 - drivers/md/dm-sysfs.c | 3 +- drivers/md/dm-table.c | 36 +- drivers/md/dm.c | 21 +- drivers/md/dm.h | 1 - drivers/memstick/core/ms_block.c | 110 +- drivers/memstick/core/ms_block.h | 1 + drivers/memstick/core/mspro_block.c | 121 +- drivers/s390/block/dasd_ioctl.c | 22 +- drivers/scsi/Kconfig | 12 - drivers/scsi/cxlflash/main.c | 6 - drivers/scsi/hosts.c | 29 +- drivers/scsi/lpfc/lpfc_scsi.c | 2 +- drivers/scsi/osd/osd_initiator.c | 4 +- drivers/scsi/osst.c | 2 +- drivers/scsi/qedi/qedi_main.c | 3 +- drivers/scsi/qla2xxx/qla_os.c | 30 +- drivers/scsi/scsi.c | 5 +- drivers/scsi/scsi_debug.c | 3 +- drivers/scsi/scsi_error.c | 4 +- drivers/scsi/scsi_lib.c | 624 +--- drivers/scsi/scsi_priv.h | 1 - drivers/scsi/scsi_scan.c | 10 +- drivers/scsi/scsi_sysfs.c | 8 +- drivers/scsi/scsi_transport_fc.c | 72 +- drivers/scsi/scsi_transport_iscsi.c | 9 +- drivers/scsi/scsi_transport_sas.c | 10 +- drivers/scsi/sg.c | 2 +- drivers/scsi/st.c | 2 +- drivers/scsi/ufs/ufshcd.c | 6 - drivers/target/target_core_pscsi.c | 2 +- include/linux/blk-cgroup.h | 108 - include/linux/blkdev.h | 174 +- include/linux/bsg-lib.h | 3 +- include/linux/elevator.h | 90 +-Quoted 8 lines
include/linux/ide.h | 13 +- include/linux/init.h | 1 - include/scsi/scsi_host.h | 18 +- include/scsi/scsi_tcq.h | 14 +- init/do_mounts_initrd.c | 3 - init/initramfs.c | 6 - init/main.c | 12 - 85 files changed, 833 insertions(+), 11144 deletions(-)Hi Jens,
Kernel oops[2] is triggered when running elevator switch stress test[1].
[1] https://people.redhat.com/~minlei/tests/tools/elv-switch
[2] kernel oops
[ 399.702365] scsi 8:0:0:0: Direct-Access Linux scsi_debug 0188 PQ: 0 ANSI: 7 [ 399.703603] sd 8:0:0:0: Power-on or device reset occurred [ 399.709833] sd 8:0:0:0: [sdd] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB) [ 399.711745] sd 8:0:0:0: [sdd] Write Protect is off [ 399.712395] sd 8:0:0:0: [sdd] Mode Sense: 73 00 10 08 [ 399.715119] sd 8:0:0:0: [sdd] Write cache: enabled, read cache: enabled, supports DPO and FUA [ 399.803561] sd 8:0:0:0: [sdd] Attached SCSI disk [ 399.844825] sd 8:0:0:0: [sdd] Synchronizing SCSI cache [ 399.968945] scsi 8:0:0:0: Direct-Access Linux scsi_debug 0188 PQ: 0 ANSI: 7 [ 399.970077] sd 8:0:0:0: Power-on or device reset occurred [ 399.972904] sd 8:0:0:0: [sdd] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB) [ 399.974823] sd 8:0:0:0: [sdd] Write Protect is off [ 399.975411] sd 8:0:0:0: [sdd] Mode Sense: 73 00 10 08 [ 399.978052] sd 8:0:0:0: [sdd] Write cache: enabled, read cache: enabled, supports DPO and FUA [ 400.030588] BUG: unable to handle kernel NULL pointer dereference at 0000000000000500 [ 400.032195] PGD 0 P4D 0 [ 400.032482] Oops: 0000 [#1] PREEMPT SMP PTI [ 400.032945] CPU: 2 PID: 318 Comm: kworker/u8:5 Not tainted 4.19.0_0ffdea6679a9_mq-conversions+ #1 [ 400.033927] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.10.2-2.fc27 04/01/2014 [ 400.034915] Workqueue: events_unbound async_run_entry_fn [ 400.035536] RIP: 0010:bfq_reset_rate_computation+0x52/0x85 [ 400.036177] Code: 00 48 89 83 b0 00 00 00 8b 45 20 c1 e8 09 89 83 d8 00 00 00 48 89 83 d0 00 00 00 eb 0a c7 87 c8 00 00 00 00 00 00 00 48 8b 03 <48> 8b b8 00 05 00 00 48 85 ff 74 24 8b 8b c8 00 00 00 4c 8b 8b d0 [ 400.038300] RSP: 0018:ffffc90000a47c50 EFLAGS: 00010046 [ 400.038915] RAX: 0000000000000000 RBX: ffff88017ac2bc00 RCX: 0000000017d6067a [ 400.039746] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88017ac2bc00 [ 400.040573] RBP: ffff88017ac2bc00 R08: 00000000f461e6ac R09: 0000000000000006 [ 400.041361] R10: 000000000000020f R11: 0000000000000000 R12: ffff88016c130000 [ 400.042127] R13: 0000005d1c095013 R14: ffff88017ac2bf78 R15: 0000000000000020 [ 400.042957] FS: 0000000000000000(0000) GS:ffff88017bb00000(0000) knlGS:0000000000000000 [ 400.043895] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 400.044518] CR2: 0000000000000500 CR3: 0000000179c32004 CR4: 0000000000760ee0 [ 400.045294] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 400.046070] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 400.046843] PKRU: 55555554 [ 400.047144] Call Trace: [ 400.047438] bfq_finish_requeue_request+0x145/0x2fd [ 400.047977] blk_mq_free_request+0x49/0xea [ 400.048429] __scsi_execute+0x16c/0x17b [ 400.048885] scsi_mode_sense+0x113/0x265 [ 400.049356] sd_revalidate_disk+0xb5b/0x109a [sd_mod] [ 400.049947] ? __device_add_disk+0x3d2/0x3f6 [ 400.050415] sd_probe_async+0x10d/0x18b [sd_mod] [ 400.050924] async_run_entry_fn+0x6d/0x12b [ 400.051374] process_one_work+0x1da/0x313 [ 400.051841] ? rescuer_thread+0x282/0x282 [ 400.052313] worker_thread+0x1ca/0x295
Quoted 8 lines
[ 400.052769] kthread+0x115/0x11d [ 400.053127] ? kthread_park+0x76/0x76 [ 400.053531] ret_from_fork+0x35/0x40 [ 400.053929] Modules linked in: scsi_debug null_blk isofs iTCO_wdt iTCO_vendor_support i2c_i801 i2c_core lpc_ich mfd_core ip_tables sr_mod cdrom usb_storage sd_mod ahci libahci crc32c_intel libata virtio_scsi qemu_fw_cfg dm_mirror dm_region_hash dm_log dm_mod [last unloaded: null_blk] [ 400.056640] Dumping ftrace buffer: [ 400.057022] (ftrace buffer empty) [ 400.057418] CR2: 0000000000000500 [ 400.057820] ---[ end trace 812cbc0fe8802fdd ]---
Doesn't look related to the series, more like a bug in BFQ. Are you sure it passes on current -git? Or maybe the bug is exposed by the series.
I'll try and reproduce it here and see what happens.
Signature · 1 line
Jens Axboe
Jens Axboe
maintainerRe: [PATCH 16/28] blk-cgroup: remove legacy queue bypassing
In reply to Johannes ThumshirnQuoted 16 lines · Johannes Thumshirn
Quoted 15 lines · Jens Axboe
Quoted 14 lines · Johannes Thumshirn
Hi Jens,
On 25/10/18 23:10, Jens Axboe wrote:
[...]Quoted 9 lines
block/blk-cgroup.c +0
-2@@ -1487,8 +1485,6 @@ int blkcg_activate_policy(struct request_queue *q, out_bypass_end:if (q->mq_ops)blk_mq_unfreeze_queue (q); -else -blk_queue_bypass_end (q);
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Now that we only have mq, do we still need all these checks for
q->mq_ops?We need it for the cases where we can be passing in a stacked driver or an mq driver, or for cases where we explicitly register mq attributes, and that sort of thing.
Ah ok. Guess we'll have to live with it then.
At this point the check should be equivalent to queue_is_rq_based(), fwiw.
Signature · 1 line
Jens Axboe
Jens Axboe
maintainerQuoted 161 lines · Jens Axboe
Quoted 151 lines · Ming Lei
Quoted 87 lines · Jens Axboe
The first round of this went into 4.20-rc, but we've still some of them pending. This patch series converts the remaining drivers to blk-mq. The ones that support dual paths (like SCSI and DM) have the non-mq path removed. At the end, legacy IO code and schedulers are killed off.
This patch series is on top of my for-linus branch. It can also be bound in my mq-conversions branch.
Documentation/block/biodoc.txt | 88 - Documentation/block/cfq-iosched.txt | 291 -- Documentation/scsi/scsi-parameters.txt | 5 - block/Kconfig | 6 - block/Kconfig.iosched | 61 - block/Makefile | 5 +- block/bfq-iosched.c | 1 - block/blk-cgroup.c | 55 - block/blk-core.c | 1860 +----------- block/blk-exec.c | 20 +- block/blk-flush.c | 154 +- block/blk-ioc.c | 46 +- block/blk-merge.c | 35 +- block/blk-mq-debugfs.c | 2 - block/blk-mq-tag.c | 6 +- block/blk-mq.c | 13 +- block/blk-settings.c | 49 - block/blk-softirq.c | 20 - block/blk-sysfs.c | 39 +- block/blk-tag.c | 378 --- block/blk-timeout.c | 99 +- block/blk-wbt.c | 3 +- block/blk.h | 60 +- block/bsg-lib.c | 131 +- block/cfq-iosched.c | 4916 -------------------------------- block/deadline-iosched.c | 560 ---- block/elevator.c | 447 +-- block/kyber-iosched.c | 1 - block/mq-deadline.c | 1 - block/noop-iosched.c | 124 - drivers/block/sunvdc.c | 149 +- drivers/ide/ide-atapi.c | 25 +- drivers/ide/ide-cd.c | 175 +- drivers/ide/ide-disk.c | 5 +- drivers/ide/ide-io.c | 101 +- drivers/ide/ide-park.c | 4 +- drivers/ide/ide-pm.c | 28 +- drivers/ide/ide-probe.c | 68 +- drivers/infiniband/ulp/srp/ib_srp.c | 7 - drivers/md/Kconfig | 11 - drivers/md/dm-core.h | 10 - drivers/md/dm-mpath.c | 18 +- drivers/md/dm-rq.c | 293 +- drivers/md/dm-rq.h | 4 - drivers/md/dm-sysfs.c | 3 +- drivers/md/dm-table.c | 36 +- drivers/md/dm.c | 21 +- drivers/md/dm.h | 1 - drivers/memstick/core/ms_block.c | 110 +- drivers/memstick/core/ms_block.h | 1 + drivers/memstick/core/mspro_block.c | 121 +- drivers/s390/block/dasd_ioctl.c | 22 +- drivers/scsi/Kconfig | 12 - drivers/scsi/cxlflash/main.c | 6 - drivers/scsi/hosts.c | 29 +- drivers/scsi/lpfc/lpfc_scsi.c | 2 +- drivers/scsi/osd/osd_initiator.c | 4 +- drivers/scsi/osst.c | 2 +- drivers/scsi/qedi/qedi_main.c | 3 +- drivers/scsi/qla2xxx/qla_os.c | 30 +- drivers/scsi/scsi.c | 5 +- drivers/scsi/scsi_debug.c | 3 +- drivers/scsi/scsi_error.c | 4 +- drivers/scsi/scsi_lib.c | 624 +--- drivers/scsi/scsi_priv.h | 1 - drivers/scsi/scsi_scan.c | 10 +- drivers/scsi/scsi_sysfs.c | 8 +- drivers/scsi/scsi_transport_fc.c | 72 +- drivers/scsi/scsi_transport_iscsi.c | 9 +- drivers/scsi/scsi_transport_sas.c | 10 +- drivers/scsi/sg.c | 2 +- drivers/scsi/st.c | 2 +- drivers/scsi/ufs/ufshcd.c | 6 - drivers/target/target_core_pscsi.c | 2 +- include/linux/blk-cgroup.h | 108 - include/linux/blkdev.h | 174 +- include/linux/bsg-lib.h | 3 +- include/linux/elevator.h | 90 +-Quoted 8 lines
include/linux/ide.h | 13 +- include/linux/init.h | 1 - include/scsi/scsi_host.h | 18 +- include/scsi/scsi_tcq.h | 14 +- init/do_mounts_initrd.c | 3 - init/initramfs.c | 6 - init/main.c | 12 - 85 files changed, 833 insertions(+), 11144 deletions(-)Hi Jens,
Kernel oops[2] is triggered when running elevator switch stress test[1].
[1] https://people.redhat.com/~minlei/tests/tools/elv-switch
[2] kernel oops
[ 399.702365] scsi 8:0:0:0: Direct-Access Linux scsi_debug 0188 PQ: 0 ANSI: 7 [ 399.703603] sd 8:0:0:0: Power-on or device reset occurred [ 399.709833] sd 8:0:0:0: [sdd] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB) [ 399.711745] sd 8:0:0:0: [sdd] Write Protect is off [ 399.712395] sd 8:0:0:0: [sdd] Mode Sense: 73 00 10 08 [ 399.715119] sd 8:0:0:0: [sdd] Write cache: enabled, read cache: enabled, supports DPO and FUA [ 399.803561] sd 8:0:0:0: [sdd] Attached SCSI disk [ 399.844825] sd 8:0:0:0: [sdd] Synchronizing SCSI cache [ 399.968945] scsi 8:0:0:0: Direct-Access Linux scsi_debug 0188 PQ: 0 ANSI: 7 [ 399.970077] sd 8:0:0:0: Power-on or device reset occurred [ 399.972904] sd 8:0:0:0: [sdd] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB) [ 399.974823] sd 8:0:0:0: [sdd] Write Protect is off [ 399.975411] sd 8:0:0:0: [sdd] Mode Sense: 73 00 10 08 [ 399.978052] sd 8:0:0:0: [sdd] Write cache: enabled, read cache: enabled, supports DPO and FUA [ 400.030588] BUG: unable to handle kernel NULL pointer dereference at 0000000000000500 [ 400.032195] PGD 0 P4D 0 [ 400.032482] Oops: 0000 [#1] PREEMPT SMP PTI [ 400.032945] CPU: 2 PID: 318 Comm: kworker/u8:5 Not tainted 4.19.0_0ffdea6679a9_mq-conversions+ #1 [ 400.033927] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.10.2-2.fc27 04/01/2014 [ 400.034915] Workqueue: events_unbound async_run_entry_fn [ 400.035536] RIP: 0010:bfq_reset_rate_computation+0x52/0x85 [ 400.036177] Code: 00 48 89 83 b0 00 00 00 8b 45 20 c1 e8 09 89 83 d8 00 00 00 48 89 83 d0 00 00 00 eb 0a c7 87 c8 00 00 00 00 00 00 00 48 8b 03 <48> 8b b8 00 05 00 00 48 85 ff 74 24 8b 8b c8 00 00 00 4c 8b 8b d0 [ 400.038300] RSP: 0018:ffffc90000a47c50 EFLAGS: 00010046 [ 400.038915] RAX: 0000000000000000 RBX: ffff88017ac2bc00 RCX: 0000000017d6067a [ 400.039746] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88017ac2bc00 [ 400.040573] RBP: ffff88017ac2bc00 R08: 00000000f461e6ac R09: 0000000000000006 [ 400.041361] R10: 000000000000020f R11: 0000000000000000 R12: ffff88016c130000 [ 400.042127] R13: 0000005d1c095013 R14: ffff88017ac2bf78 R15: 0000000000000020 [ 400.042957] FS: 0000000000000000(0000) GS:ffff88017bb00000(0000) knlGS:0000000000000000 [ 400.043895] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 400.044518] CR2: 0000000000000500 CR3: 0000000179c32004 CR4: 0000000000760ee0 [ 400.045294] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 400.046070] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 400.046843] PKRU: 55555554 [ 400.047144] Call Trace: [ 400.047438] bfq_finish_requeue_request+0x145/0x2fd [ 400.047977] blk_mq_free_request+0x49/0xea [ 400.048429] __scsi_execute+0x16c/0x17b [ 400.048885] scsi_mode_sense+0x113/0x265 [ 400.049356] sd_revalidate_disk+0xb5b/0x109a [sd_mod] [ 400.049947] ? __device_add_disk+0x3d2/0x3f6 [ 400.050415] sd_probe_async+0x10d/0x18b [sd_mod] [ 400.050924] async_run_entry_fn+0x6d/0x12b [ 400.051374] process_one_work+0x1da/0x313 [ 400.051841] ? rescuer_thread+0x282/0x282 [ 400.052313] worker_thread+0x1ca/0x295Quoted 8 lines
[ 400.052769] kthread+0x115/0x11d [ 400.053127] ? kthread_park+0x76/0x76 [ 400.053531] ret_from_fork+0x35/0x40 [ 400.053929] Modules linked in: scsi_debug null_blk isofs iTCO_wdt iTCO_vendor_support i2c_i801 i2c_core lpc_ich mfd_core ip_tables sr_mod cdrom usb_storage sd_mod ahci libahci crc32c_intel libata virtio_scsi qemu_fw_cfg dm_mirror dm_region_hash dm_log dm_mod [last unloaded: null_blk] [ 400.056640] Dumping ftrace buffer: [ 400.057022] (ftrace buffer empty) [ 400.057418] CR2: 0000000000000500 [ 400.057820] ---[ end trace 812cbc0fe8802fdd ]---
Quoted 5 lines
Doesn't look related to the series, more like a bug in BFQ. Are you sure it passes on current -git? Or maybe the bug is exposed by the series.
I'll try and reproduce it here and see what happens.
I think I see the error, it is introduced by my series. This incremental should help, I'm going to test it now.
block/blk-ioc.c +17 -0
@@ -212,6 +212,21 @@ void exit_io_context(struct task_struct *task)put_io_context_active (ioc); } +static void __ioc_clear_queue (struct list_head *icq_list) +{ +unsigned long flags; + +while (!list_empty (icq_list)) { +struct io_cq *icq =list_entry (icq_list->next, + struct io_cq, q_node); +struct io_context *ioc = icq->ioc; + +spin_lock_irqsave (&ioc->lock, flags); +ioc_destroy_icq (icq); +spin_unlock_irqrestore (&ioc->lock, flags); + } +} +/** * ioc_clear_queue - break any ioc association with the specified queue * @q: request_queue being cleared
@@ -225,6 +240,8 @@ void ioc_clear_queue(struct request_queue *q)spin_lock_irq (q->queue_lock);list_splice_init (&q->icq_list, &icq_list);spin_unlock_irq (q->queue_lock); + +__ioc_clear_queue (&icq_list); }int create_task_io_context (struct task_struct *task,gfp_t gfp_flags,int node)
Signature · 1 line
Jens Axboe
Quoted 161 lines · Jens Axboe
Quoted 151 lines · Ming Lei
Quoted 87 lines · Jens Axboe
The first round of this went into 4.20-rc, but we've still some of them pending. This patch series converts the remaining drivers to blk-mq. The ones that support dual paths (like SCSI and DM) have the non-mq path removed. At the end, legacy IO code and schedulers are killed off.
This patch series is on top of my for-linus branch. It can also be bound in my mq-conversions branch.
Documentation/block/biodoc.txt | 88 - Documentation/block/cfq-iosched.txt | 291 -- Documentation/scsi/scsi-parameters.txt | 5 - block/Kconfig | 6 - block/Kconfig.iosched | 61 - block/Makefile | 5 +- block/bfq-iosched.c | 1 - block/blk-cgroup.c | 55 - block/blk-core.c | 1860 +----------- block/blk-exec.c | 20 +- block/blk-flush.c | 154 +- block/blk-ioc.c | 46 +- block/blk-merge.c | 35 +- block/blk-mq-debugfs.c | 2 - block/blk-mq-tag.c | 6 +- block/blk-mq.c | 13 +- block/blk-settings.c | 49 - block/blk-softirq.c | 20 - block/blk-sysfs.c | 39 +- block/blk-tag.c | 378 --- block/blk-timeout.c | 99 +- block/blk-wbt.c | 3 +- block/blk.h | 60 +- block/bsg-lib.c | 131 +- block/cfq-iosched.c | 4916 -------------------------------- block/deadline-iosched.c | 560 ---- block/elevator.c | 447 +-- block/kyber-iosched.c | 1 - block/mq-deadline.c | 1 - block/noop-iosched.c | 124 - drivers/block/sunvdc.c | 149 +- drivers/ide/ide-atapi.c | 25 +- drivers/ide/ide-cd.c | 175 +- drivers/ide/ide-disk.c | 5 +- drivers/ide/ide-io.c | 101 +- drivers/ide/ide-park.c | 4 +- drivers/ide/ide-pm.c | 28 +- drivers/ide/ide-probe.c | 68 +- drivers/infiniband/ulp/srp/ib_srp.c | 7 - drivers/md/Kconfig | 11 - drivers/md/dm-core.h | 10 - drivers/md/dm-mpath.c | 18 +- drivers/md/dm-rq.c | 293 +- drivers/md/dm-rq.h | 4 - drivers/md/dm-sysfs.c | 3 +- drivers/md/dm-table.c | 36 +- drivers/md/dm.c | 21 +- drivers/md/dm.h | 1 - drivers/memstick/core/ms_block.c | 110 +- drivers/memstick/core/ms_block.h | 1 + drivers/memstick/core/mspro_block.c | 121 +- drivers/s390/block/dasd_ioctl.c | 22 +- drivers/scsi/Kconfig | 12 - drivers/scsi/cxlflash/main.c | 6 - drivers/scsi/hosts.c | 29 +- drivers/scsi/lpfc/lpfc_scsi.c | 2 +- drivers/scsi/osd/osd_initiator.c | 4 +- drivers/scsi/osst.c | 2 +- drivers/scsi/qedi/qedi_main.c | 3 +- drivers/scsi/qla2xxx/qla_os.c | 30 +- drivers/scsi/scsi.c | 5 +- drivers/scsi/scsi_debug.c | 3 +- drivers/scsi/scsi_error.c | 4 +- drivers/scsi/scsi_lib.c | 624 +--- drivers/scsi/scsi_priv.h | 1 - drivers/scsi/scsi_scan.c | 10 +- drivers/scsi/scsi_sysfs.c | 8 +- drivers/scsi/scsi_transport_fc.c | 72 +- drivers/scsi/scsi_transport_iscsi.c | 9 +- drivers/scsi/scsi_transport_sas.c | 10 +- drivers/scsi/sg.c | 2 +- drivers/scsi/st.c | 2 +- drivers/scsi/ufs/ufshcd.c | 6 - drivers/target/target_core_pscsi.c | 2 +- include/linux/blk-cgroup.h | 108 - include/linux/blkdev.h | 174 +- include/linux/bsg-lib.h | 3 +- include/linux/elevator.h | 90 +-Quoted 8 lines
include/linux/ide.h | 13 +- include/linux/init.h | 1 - include/scsi/scsi_host.h | 18 +- include/scsi/scsi_tcq.h | 14 +- init/do_mounts_initrd.c | 3 - init/initramfs.c | 6 - init/main.c | 12 - 85 files changed, 833 insertions(+), 11144 deletions(-)Hi Jens,
Kernel oops[2] is triggered when running elevator switch stress test[1].
[1] https://people.redhat.com/~minlei/tests/tools/elv-switch
[2] kernel oops
[ 399.702365] scsi 8:0:0:0: Direct-Access Linux scsi_debug 0188 PQ: 0 ANSI: 7 [ 399.703603] sd 8:0:0:0: Power-on or device reset occurred [ 399.709833] sd 8:0:0:0: [sdd] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB) [ 399.711745] sd 8:0:0:0: [sdd] Write Protect is off [ 399.712395] sd 8:0:0:0: [sdd] Mode Sense: 73 00 10 08 [ 399.715119] sd 8:0:0:0: [sdd] Write cache: enabled, read cache: enabled, supports DPO and FUA [ 399.803561] sd 8:0:0:0: [sdd] Attached SCSI disk [ 399.844825] sd 8:0:0:0: [sdd] Synchronizing SCSI cache [ 399.968945] scsi 8:0:0:0: Direct-Access Linux scsi_debug 0188 PQ: 0 ANSI: 7 [ 399.970077] sd 8:0:0:0: Power-on or device reset occurred [ 399.972904] sd 8:0:0:0: [sdd] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB) [ 399.974823] sd 8:0:0:0: [sdd] Write Protect is off [ 399.975411] sd 8:0:0:0: [sdd] Mode Sense: 73 00 10 08 [ 399.978052] sd 8:0:0:0: [sdd] Write cache: enabled, read cache: enabled, supports DPO and FUA [ 400.030588] BUG: unable to handle kernel NULL pointer dereference at 0000000000000500 [ 400.032195] PGD 0 P4D 0 [ 400.032482] Oops: 0000 [#1] PREEMPT SMP PTI [ 400.032945] CPU: 2 PID: 318 Comm: kworker/u8:5 Not tainted 4.19.0_0ffdea6679a9_mq-conversions+ #1 [ 400.033927] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.10.2-2.fc27 04/01/2014 [ 400.034915] Workqueue: events_unbound async_run_entry_fn [ 400.035536] RIP: 0010:bfq_reset_rate_computation+0x52/0x85 [ 400.036177] Code: 00 48 89 83 b0 00 00 00 8b 45 20 c1 e8 09 89 83 d8 00 00 00 48 89 83 d0 00 00 00 eb 0a c7 87 c8 00 00 00 00 00 00 00 48 8b 03 <48> 8b b8 00 05 00 00 48 85 ff 74 24 8b 8b c8 00 00 00 4c 8b 8b d0 [ 400.038300] RSP: 0018:ffffc90000a47c50 EFLAGS: 00010046 [ 400.038915] RAX: 0000000000000000 RBX: ffff88017ac2bc00 RCX: 0000000017d6067a [ 400.039746] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88017ac2bc00 [ 400.040573] RBP: ffff88017ac2bc00 R08: 00000000f461e6ac R09: 0000000000000006 [ 400.041361] R10: 000000000000020f R11: 0000000000000000 R12: ffff88016c130000 [ 400.042127] R13: 0000005d1c095013 R14: ffff88017ac2bf78 R15: 0000000000000020 [ 400.042957] FS: 0000000000000000(0000) GS:ffff88017bb00000(0000) knlGS:0000000000000000 [ 400.043895] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 400.044518] CR2: 0000000000000500 CR3: 0000000179c32004 CR4: 0000000000760ee0 [ 400.045294] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 400.046070] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 400.046843] PKRU: 55555554 [ 400.047144] Call Trace: [ 400.047438] bfq_finish_requeue_request+0x145/0x2fd [ 400.047977] blk_mq_free_request+0x49/0xea [ 400.048429] __scsi_execute+0x16c/0x17b [ 400.048885] scsi_mode_sense+0x113/0x265 [ 400.049356] sd_revalidate_disk+0xb5b/0x109a [sd_mod] [ 400.049947] ? __device_add_disk+0x3d2/0x3f6 [ 400.050415] sd_probe_async+0x10d/0x18b [sd_mod] [ 400.050924] async_run_entry_fn+0x6d/0x12b [ 400.051374] process_one_work+0x1da/0x313 [ 400.051841] ? rescuer_thread+0x282/0x282 [ 400.052313] worker_thread+0x1ca/0x295Quoted 8 lines
[ 400.052769] kthread+0x115/0x11d [ 400.053127] ? kthread_park+0x76/0x76 [ 400.053531] ret_from_fork+0x35/0x40 [ 400.053929] Modules linked in: scsi_debug null_blk isofs iTCO_wdt iTCO_vendor_support i2c_i801 i2c_core lpc_ich mfd_core ip_tables sr_mod cdrom usb_storage sd_mod ahci libahci crc32c_intel libata virtio_scsi qemu_fw_cfg dm_mirror dm_region_hash dm_log dm_mod [last unloaded: null_blk] [ 400.056640] Dumping ftrace buffer: [ 400.057022] (ftrace buffer empty) [ 400.057418] CR2: 0000000000000500 [ 400.057820] ---[ end trace 812cbc0fe8802fdd ]---
Quoted 5 lines
Doesn't look related to the series, more like a bug in BFQ. Are you sure it passes on current -git? Or maybe the bug is exposed by the series.
I'll try and reproduce it here and see what happens.
Look it is only observed on mq-conversion, and not see it on for-linus, will double check it tomorrow.
Thanks,
Ming
Re: [PATCH 23/28] block: kill lld busy
In reply to Jens AxboeQuoted 82 lines · Jens Axboe
Quoted 81 lines · Hannes Reinecke
Quoted 80 lines · Jens Axboe
Nobody sets the helper, so we always return 0. Kill it.
Signed-off-by Jens Axboe <[email protected]>--- block/blk-core.c | 28 ---------------------------- block/blk-settings.c | 6 ------ drivers/md/dm-mpath.c | 4 +--- include/linux/blkdev.h | 4 ---- 4 files changed, 1 insertion(+), 41 deletions(-)block/blk-core.c +0
-28@@ -1795,34 +1795,6 @@ void rq_flush_dcache_pages(struct request *rq)EXPORT_SYMBOL_GPL (rq_flush_dcache_pages);#endif -/** -* blk_lld_busy - Check if underlying low-level drivers of a device are busy -* @q : the queue of the device being checked -* -* Description: -* Check if underlying low-level drivers of a device are busy. -* If the drivers want to export their busy state, they must set own -* exporting function using blk_queue_lld_busy() first. -* -* Basically, this function is used only by request stacking drivers -* to stop dispatching requests to underlying devices when underlying -* devices are busy. This behavior helps more I/O merging on the queue -* of the request stacking driver and prevents I/O throughput regression -* on burst I/O load. -* -* Return: -* 0 - Not busy (The request stacking driver should dispatch request) -* 1 - Busy (The request stacking driver should stop dispatching request) -*/ -int blk_lld_busy (struct request_queue *q) -{ -if (q->lld_busy_fn) -return q->lld_busy_fn (q); - -return 0 ; -} -EXPORT_SYMBOL_GPL (blk_lld_busy); -/** * blk_rq_unprep_clone - Helper function to free all bios in a cloned request * @rq: the clone request to be cleaned up block/blk-settings.c +0
-6@@ -32,12 +32,6 @@ void blk_queue_rq_timeout(struct request_queue *q, unsigned int timeout) }EXPORT_SYMBOL_GPL (blk_queue_rq_timeout); -void blk_queue_lld_busy (struct request_queue *q,lld_busy_fn *fn) -{ - q->lld_busy_fn = fn; -} -EXPORT_SYMBOL_GPL (blk_queue_lld_busy); -/** * blk_set_default_limits - reset limits to default values * @lim: the queue_limits structure to reset drivers/md/dm-mpath.c +1
-3@@ -1936,9 +1936,7 @@ static int multipath_iterate_devices(struct dm_target *ti,static int pgpath_busy (struct pgpath *pgpath) { -struct request_queue *q =bdev_get_queue (pgpath->path.dev->bdev); - -return blk_lld_busy (q); +return 0 ; }
Quoted 8 lines
Quoted 6 lines
drivers/md/dm-mpath.c static int multipath_iterate_devices(struct dm_target *ti, · line 1942
Quoted 1 line
drivers/md/dm-mpath.c +0
-0/* Actually, I'm not quite sure this is correct; dm-mpath needs to return a busy status (via the '->busy' callback) to allow for back-pressure on the upper layers.
Just disabling the callback will disable this.
Shouldn't we check if the tagmap is busy here?Mike? We can pretty easily make it just check for busy tags.
OK, please feel free to do so.
Happy to pick the patch up or provide review so you can stage it in your 4.21 oriented tree.
Thanks,
Mike
Jens Axboe
maintainerRe: [PATCH 23/28] block: kill lld busy
Quoted 92 lines · Mike Snitzer
Quoted 89 lines · Jens Axboe
Quoted 87 lines · Hannes Reinecke
Quoted 71 lines · Jens Axboe
Nobody sets the helper, so we always return 0. Kill it.
Signed-off-by Jens Axboe <[email protected]>--- block/blk-core.c | 28 ---------------------------- block/blk-settings.c | 6 ------ drivers/md/dm-mpath.c | 4 +--- include/linux/blkdev.h | 4 ---- 4 files changed, 1 insertion(+), 41 deletions(-)block/blk-core.c +0
-28@@ -1795,34 +1795,6 @@ void rq_flush_dcache_pages(struct request *rq)EXPORT_SYMBOL_GPL (rq_flush_dcache_pages);#endif -/** -* blk_lld_busy - Check if underlying low-level drivers of a device are busy -* @q : the queue of the device being checked -* -* Description: -* Check if underlying low-level drivers of a device are busy. -* If the drivers want to export their busy state, they must set own -* exporting function using blk_queue_lld_busy() first. -* -* Basically, this function is used only by request stacking drivers -* to stop dispatching requests to underlying devices when underlying -* devices are busy. This behavior helps more I/O merging on the queue -* of the request stacking driver and prevents I/O throughput regression -* on burst I/O load. -* -* Return: -* 0 - Not busy (The request stacking driver should dispatch request) -* 1 - Busy (The request stacking driver should stop dispatching request) -*/ -int blk_lld_busy (struct request_queue *q) -{ -if (q->lld_busy_fn) -return q->lld_busy_fn (q); - -return 0 ; -} -EXPORT_SYMBOL_GPL (blk_lld_busy); -/** * blk_rq_unprep_clone - Helper function to free all bios in a cloned request * @rq: the clone request to be cleaned up block/blk-settings.c +0
-6@@ -32,12 +32,6 @@ void blk_queue_rq_timeout(struct request_queue *q, unsigned int timeout) }EXPORT_SYMBOL_GPL (blk_queue_rq_timeout); -void blk_queue_lld_busy (struct request_queue *q,lld_busy_fn *fn) -{ - q->lld_busy_fn = fn; -} -EXPORT_SYMBOL_GPL (blk_queue_lld_busy); -/** * blk_set_default_limits - reset limits to default values * @lim: the queue_limits structure to reset drivers/md/dm-mpath.c +0
-0drivers/md/dm-mpath.c static int multipath_iterate_devices(struct dm_target *ti, · line 1942
Quoted 10 lines
drivers/md/dm-mpath.c +1
-3@@ -1936,9 +1936,7 @@ static int multipath_iterate_devices(struct dm_target *ti,static int pgpath_busy (struct pgpath *pgpath) { -struct request_queue *q =bdev_get_queue (pgpath->path.dev->bdev); - -return blk_lld_busy (q); +return 0 ; }/* Actually, I'm not quite sure this is correct; dm-mpath needs to return a busy status (via the '->busy' callback) to allow for back-pressure on the upper layers.
Just disabling the callback will disable this.
Shouldn't we check if the tagmap is busy here?
Quoted 6 lines
Quoted 1 line
Mike? We can pretty easily make it just check for busy tags.
OK, please feel free to do so.
Happy to pick the patch up or provide review so you can stage it in your 4.21 oriented tree.
I reshuffled a bit and made SCSI provide an mq variant of the target busy. So blk_lld_busy() remains, just with an mq handler instead. This means that dm-mpath won't need any changing, I think we're good.
Signature · 1 line
Jens Axboe
Quoted 199 lines · Jens Axboe
Quoted 161 lines · Jens Axboe
Quoted 151 lines · Ming Lei
Quoted 87 lines · Jens Axboe
The first round of this went into 4.20-rc, but we've still some of them pending. This patch series converts the remaining drivers to blk-mq. The ones that support dual paths (like SCSI and DM) have the non-mq path removed. At the end, legacy IO code and schedulers are killed off.
This patch series is on top of my for-linus branch. It can also be bound in my mq-conversions branch.
Documentation/block/biodoc.txt | 88 - Documentation/block/cfq-iosched.txt | 291 -- Documentation/scsi/scsi-parameters.txt | 5 - block/Kconfig | 6 - block/Kconfig.iosched | 61 - block/Makefile | 5 +- block/bfq-iosched.c | 1 - block/blk-cgroup.c | 55 - block/blk-core.c | 1860 +----------- block/blk-exec.c | 20 +- block/blk-flush.c | 154 +- block/blk-ioc.c | 46 +- block/blk-merge.c | 35 +- block/blk-mq-debugfs.c | 2 - block/blk-mq-tag.c | 6 +- block/blk-mq.c | 13 +- block/blk-settings.c | 49 - block/blk-softirq.c | 20 - block/blk-sysfs.c | 39 +- block/blk-tag.c | 378 --- block/blk-timeout.c | 99 +- block/blk-wbt.c | 3 +- block/blk.h | 60 +- block/bsg-lib.c | 131 +- block/cfq-iosched.c | 4916 -------------------------------- block/deadline-iosched.c | 560 ---- block/elevator.c | 447 +-- block/kyber-iosched.c | 1 - block/mq-deadline.c | 1 - block/noop-iosched.c | 124 - drivers/block/sunvdc.c | 149 +- drivers/ide/ide-atapi.c | 25 +- drivers/ide/ide-cd.c | 175 +- drivers/ide/ide-disk.c | 5 +- drivers/ide/ide-io.c | 101 +- drivers/ide/ide-park.c | 4 +- drivers/ide/ide-pm.c | 28 +- drivers/ide/ide-probe.c | 68 +- drivers/infiniband/ulp/srp/ib_srp.c | 7 - drivers/md/Kconfig | 11 - drivers/md/dm-core.h | 10 - drivers/md/dm-mpath.c | 18 +- drivers/md/dm-rq.c | 293 +- drivers/md/dm-rq.h | 4 - drivers/md/dm-sysfs.c | 3 +- drivers/md/dm-table.c | 36 +- drivers/md/dm.c | 21 +- drivers/md/dm.h | 1 - drivers/memstick/core/ms_block.c | 110 +- drivers/memstick/core/ms_block.h | 1 + drivers/memstick/core/mspro_block.c | 121 +- drivers/s390/block/dasd_ioctl.c | 22 +- drivers/scsi/Kconfig | 12 - drivers/scsi/cxlflash/main.c | 6 - drivers/scsi/hosts.c | 29 +- drivers/scsi/lpfc/lpfc_scsi.c | 2 +- drivers/scsi/osd/osd_initiator.c | 4 +- drivers/scsi/osst.c | 2 +- drivers/scsi/qedi/qedi_main.c | 3 +- drivers/scsi/qla2xxx/qla_os.c | 30 +- drivers/scsi/scsi.c | 5 +- drivers/scsi/scsi_debug.c | 3 +- drivers/scsi/scsi_error.c | 4 +- drivers/scsi/scsi_lib.c | 624 +--- drivers/scsi/scsi_priv.h | 1 - drivers/scsi/scsi_scan.c | 10 +- drivers/scsi/scsi_sysfs.c | 8 +- drivers/scsi/scsi_transport_fc.c | 72 +- drivers/scsi/scsi_transport_iscsi.c | 9 +- drivers/scsi/scsi_transport_sas.c | 10 +- drivers/scsi/sg.c | 2 +- drivers/scsi/st.c | 2 +- drivers/scsi/ufs/ufshcd.c | 6 - drivers/target/target_core_pscsi.c | 2 +- include/linux/blk-cgroup.h | 108 - include/linux/blkdev.h | 174 +- include/linux/bsg-lib.h | 3 +- include/linux/elevator.h | 90 +-Quoted 8 lines
include/linux/ide.h | 13 +- include/linux/init.h | 1 - include/scsi/scsi_host.h | 18 +- include/scsi/scsi_tcq.h | 14 +- init/do_mounts_initrd.c | 3 - init/initramfs.c | 6 - init/main.c | 12 - 85 files changed, 833 insertions(+), 11144 deletions(-)Hi Jens,
Kernel oops[2] is triggered when running elevator switch stress test[1].
[1] https://people.redhat.com/~minlei/tests/tools/elv-switch
[2] kernel oops
[ 399.702365] scsi 8:0:0:0: Direct-Access Linux scsi_debug 0188 PQ: 0 ANSI: 7 [ 399.703603] sd 8:0:0:0: Power-on or device reset occurred [ 399.709833] sd 8:0:0:0: [sdd] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB) [ 399.711745] sd 8:0:0:0: [sdd] Write Protect is off [ 399.712395] sd 8:0:0:0: [sdd] Mode Sense: 73 00 10 08 [ 399.715119] sd 8:0:0:0: [sdd] Write cache: enabled, read cache: enabled, supports DPO and FUA [ 399.803561] sd 8:0:0:0: [sdd] Attached SCSI disk [ 399.844825] sd 8:0:0:0: [sdd] Synchronizing SCSI cache [ 399.968945] scsi 8:0:0:0: Direct-Access Linux scsi_debug 0188 PQ: 0 ANSI: 7 [ 399.970077] sd 8:0:0:0: Power-on or device reset occurred [ 399.972904] sd 8:0:0:0: [sdd] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB) [ 399.974823] sd 8:0:0:0: [sdd] Write Protect is off [ 399.975411] sd 8:0:0:0: [sdd] Mode Sense: 73 00 10 08 [ 399.978052] sd 8:0:0:0: [sdd] Write cache: enabled, read cache: enabled, supports DPO and FUA [ 400.030588] BUG: unable to handle kernel NULL pointer dereference at 0000000000000500 [ 400.032195] PGD 0 P4D 0 [ 400.032482] Oops: 0000 [#1] PREEMPT SMP PTI [ 400.032945] CPU: 2 PID: 318 Comm: kworker/u8:5 Not tainted 4.19.0_0ffdea6679a9_mq-conversions+ #1 [ 400.033927] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.10.2-2.fc27 04/01/2014 [ 400.034915] Workqueue: events_unbound async_run_entry_fn [ 400.035536] RIP: 0010:bfq_reset_rate_computation+0x52/0x85 [ 400.036177] Code: 00 48 89 83 b0 00 00 00 8b 45 20 c1 e8 09 89 83 d8 00 00 00 48 89 83 d0 00 00 00 eb 0a c7 87 c8 00 00 00 00 00 00 00 48 8b 03 <48> 8b b8 00 05 00 00 48 85 ff 74 24 8b 8b c8 00 00 00 4c 8b 8b d0 [ 400.038300] RSP: 0018:ffffc90000a47c50 EFLAGS: 00010046 [ 400.038915] RAX: 0000000000000000 RBX: ffff88017ac2bc00 RCX: 0000000017d6067a [ 400.039746] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88017ac2bc00 [ 400.040573] RBP: ffff88017ac2bc00 R08: 00000000f461e6ac R09: 0000000000000006 [ 400.041361] R10: 000000000000020f R11: 0000000000000000 R12: ffff88016c130000 [ 400.042127] R13: 0000005d1c095013 R14: ffff88017ac2bf78 R15: 0000000000000020 [ 400.042957] FS: 0000000000000000(0000) GS:ffff88017bb00000(0000) knlGS:0000000000000000 [ 400.043895] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 400.044518] CR2: 0000000000000500 CR3: 0000000179c32004 CR4: 0000000000760ee0 [ 400.045294] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 400.046070] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 400.046843] PKRU: 55555554 [ 400.047144] Call Trace: [ 400.047438] bfq_finish_requeue_request+0x145/0x2fd [ 400.047977] blk_mq_free_request+0x49/0xea [ 400.048429] __scsi_execute+0x16c/0x17b [ 400.048885] scsi_mode_sense+0x113/0x265 [ 400.049356] sd_revalidate_disk+0xb5b/0x109a [sd_mod] [ 400.049947] ? __device_add_disk+0x3d2/0x3f6 [ 400.050415] sd_probe_async+0x10d/0x18b [sd_mod] [ 400.050924] async_run_entry_fn+0x6d/0x12b [ 400.051374] process_one_work+0x1da/0x313 [ 400.051841] ? rescuer_thread+0x282/0x282 [ 400.052313] worker_thread+0x1ca/0x295Quoted 8 lines
[ 400.052769] kthread+0x115/0x11d [ 400.053127] ? kthread_park+0x76/0x76 [ 400.053531] ret_from_fork+0x35/0x40 [ 400.053929] Modules linked in: scsi_debug null_blk isofs iTCO_wdt iTCO_vendor_support i2c_i801 i2c_core lpc_ich mfd_core ip_tables sr_mod cdrom usb_storage sd_mod ahci libahci crc32c_intel libata virtio_scsi qemu_fw_cfg dm_mirror dm_region_hash dm_log dm_mod [last unloaded: null_blk] [ 400.056640] Dumping ftrace buffer: [ 400.057022] (ftrace buffer empty) [ 400.057418] CR2: 0000000000000500 [ 400.057820] ---[ end trace 812cbc0fe8802fdd ]---Quoted 5 lines
Doesn't look related to the series, more like a bug in BFQ. Are you sure it passes on current -git? Or maybe the bug is exposed by the series.
I'll try and reproduce it here and see what happens.
I think I see the error, it is introduced by my series. This incremental should help, I'm going to test it now.
block/blk-ioc.c +15
-0@@ -212,6 +212,21 @@ void exit_io_context(struct task_struct *task)put_io_context_active (ioc); } +static void __ioc_clear_queue (struct list_head *icq_list) +{ +unsigned long flags; + +while (!list_empty (icq_list)) { +struct io_cq *icq =list_entry (icq_list->next, + struct io_cq, q_node); +struct io_context *ioc = icq->ioc; + +spin_lock_irqsave (&ioc->lock, flags); +ioc_destroy_icq (icq); +spin_unlock_irqrestore (&ioc->lock, flags); + } +} +/** * ioc_clear_queue - break any ioc association with the specified queue * @q: request_queue being cleared
block/blk-ioc.c void ioc_clear_queue(struct request_queue *q) · line 247
Quoted 8 lines
block/blk-ioc.c +2
-0@@ -225,6 +240,8 @@ void ioc_clear_queue(struct request_queue *q)spin_lock_irq (q->queue_lock);list_splice_init (&q->icq_list, &icq_list);spin_unlock_irq (q->queue_lock); + +__ioc_clear_queue (&icq_list); }int create_task_io_context (struct task_struct *task,gfp_t gfp_flags,int node)
Not see such issue anymore on today's mq-conversions.
Signature · 1 line
Ming
Jens Axboe
maintainerQuoted 207 lines · Ming Lei
Quoted 206 lines · Jens Axboe
Quoted 161 lines · Jens Axboe
Quoted 151 lines · Ming Lei
Quoted 87 lines · Jens Axboe
The first round of this went into 4.20-rc, but we've still some of them pending. This patch series converts the remaining drivers to blk-mq. The ones that support dual paths (like SCSI and DM) have the non-mq path removed. At the end, legacy IO code and schedulers are killed off.
This patch series is on top of my for-linus branch. It can also be bound in my mq-conversions branch.
Documentation/block/biodoc.txt | 88 - Documentation/block/cfq-iosched.txt | 291 -- Documentation/scsi/scsi-parameters.txt | 5 - block/Kconfig | 6 - block/Kconfig.iosched | 61 - block/Makefile | 5 +- block/bfq-iosched.c | 1 - block/blk-cgroup.c | 55 - block/blk-core.c | 1860 +----------- block/blk-exec.c | 20 +- block/blk-flush.c | 154 +- block/blk-ioc.c | 46 +- block/blk-merge.c | 35 +- block/blk-mq-debugfs.c | 2 - block/blk-mq-tag.c | 6 +- block/blk-mq.c | 13 +- block/blk-settings.c | 49 - block/blk-softirq.c | 20 - block/blk-sysfs.c | 39 +- block/blk-tag.c | 378 --- block/blk-timeout.c | 99 +- block/blk-wbt.c | 3 +- block/blk.h | 60 +- block/bsg-lib.c | 131 +- block/cfq-iosched.c | 4916 -------------------------------- block/deadline-iosched.c | 560 ---- block/elevator.c | 447 +-- block/kyber-iosched.c | 1 - block/mq-deadline.c | 1 - block/noop-iosched.c | 124 - drivers/block/sunvdc.c | 149 +- drivers/ide/ide-atapi.c | 25 +- drivers/ide/ide-cd.c | 175 +- drivers/ide/ide-disk.c | 5 +- drivers/ide/ide-io.c | 101 +- drivers/ide/ide-park.c | 4 +- drivers/ide/ide-pm.c | 28 +- drivers/ide/ide-probe.c | 68 +- drivers/infiniband/ulp/srp/ib_srp.c | 7 - drivers/md/Kconfig | 11 - drivers/md/dm-core.h | 10 - drivers/md/dm-mpath.c | 18 +- drivers/md/dm-rq.c | 293 +- drivers/md/dm-rq.h | 4 - drivers/md/dm-sysfs.c | 3 +- drivers/md/dm-table.c | 36 +- drivers/md/dm.c | 21 +- drivers/md/dm.h | 1 - drivers/memstick/core/ms_block.c | 110 +- drivers/memstick/core/ms_block.h | 1 + drivers/memstick/core/mspro_block.c | 121 +- drivers/s390/block/dasd_ioctl.c | 22 +- drivers/scsi/Kconfig | 12 - drivers/scsi/cxlflash/main.c | 6 - drivers/scsi/hosts.c | 29 +- drivers/scsi/lpfc/lpfc_scsi.c | 2 +- drivers/scsi/osd/osd_initiator.c | 4 +- drivers/scsi/osst.c | 2 +- drivers/scsi/qedi/qedi_main.c | 3 +- drivers/scsi/qla2xxx/qla_os.c | 30 +- drivers/scsi/scsi.c | 5 +- drivers/scsi/scsi_debug.c | 3 +- drivers/scsi/scsi_error.c | 4 +- drivers/scsi/scsi_lib.c | 624 +--- drivers/scsi/scsi_priv.h | 1 - drivers/scsi/scsi_scan.c | 10 +- drivers/scsi/scsi_sysfs.c | 8 +- drivers/scsi/scsi_transport_fc.c | 72 +- drivers/scsi/scsi_transport_iscsi.c | 9 +- drivers/scsi/scsi_transport_sas.c | 10 +- drivers/scsi/sg.c | 2 +- drivers/scsi/st.c | 2 +- drivers/scsi/ufs/ufshcd.c | 6 - drivers/target/target_core_pscsi.c | 2 +- include/linux/blk-cgroup.h | 108 - include/linux/blkdev.h | 174 +- include/linux/bsg-lib.h | 3 +- include/linux/elevator.h | 90 +-Quoted 8 lines
include/linux/ide.h | 13 +- include/linux/init.h | 1 - include/scsi/scsi_host.h | 18 +- include/scsi/scsi_tcq.h | 14 +- init/do_mounts_initrd.c | 3 - init/initramfs.c | 6 - init/main.c | 12 - 85 files changed, 833 insertions(+), 11144 deletions(-)Hi Jens,
Kernel oops[2] is triggered when running elevator switch stress test[1].
[1] https://people.redhat.com/~minlei/tests/tools/elv-switch
[2] kernel oops
[ 399.702365] scsi 8:0:0:0: Direct-Access Linux scsi_debug 0188 PQ: 0 ANSI: 7 [ 399.703603] sd 8:0:0:0: Power-on or device reset occurred [ 399.709833] sd 8:0:0:0: [sdd] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB) [ 399.711745] sd 8:0:0:0: [sdd] Write Protect is off [ 399.712395] sd 8:0:0:0: [sdd] Mode Sense: 73 00 10 08 [ 399.715119] sd 8:0:0:0: [sdd] Write cache: enabled, read cache: enabled, supports DPO and FUA [ 399.803561] sd 8:0:0:0: [sdd] Attached SCSI disk [ 399.844825] sd 8:0:0:0: [sdd] Synchronizing SCSI cache [ 399.968945] scsi 8:0:0:0: Direct-Access Linux scsi_debug 0188 PQ: 0 ANSI: 7 [ 399.970077] sd 8:0:0:0: Power-on or device reset occurred [ 399.972904] sd 8:0:0:0: [sdd] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB) [ 399.974823] sd 8:0:0:0: [sdd] Write Protect is off [ 399.975411] sd 8:0:0:0: [sdd] Mode Sense: 73 00 10 08 [ 399.978052] sd 8:0:0:0: [sdd] Write cache: enabled, read cache: enabled, supports DPO and FUA [ 400.030588] BUG: unable to handle kernel NULL pointer dereference at 0000000000000500 [ 400.032195] PGD 0 P4D 0 [ 400.032482] Oops: 0000 [#1] PREEMPT SMP PTI [ 400.032945] CPU: 2 PID: 318 Comm: kworker/u8:5 Not tainted 4.19.0_0ffdea6679a9_mq-conversions+ #1 [ 400.033927] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.10.2-2.fc27 04/01/2014 [ 400.034915] Workqueue: events_unbound async_run_entry_fn [ 400.035536] RIP: 0010:bfq_reset_rate_computation+0x52/0x85 [ 400.036177] Code: 00 48 89 83 b0 00 00 00 8b 45 20 c1 e8 09 89 83 d8 00 00 00 48 89 83 d0 00 00 00 eb 0a c7 87 c8 00 00 00 00 00 00 00 48 8b 03 <48> 8b b8 00 05 00 00 48 85 ff 74 24 8b 8b c8 00 00 00 4c 8b 8b d0 [ 400.038300] RSP: 0018:ffffc90000a47c50 EFLAGS: 00010046 [ 400.038915] RAX: 0000000000000000 RBX: ffff88017ac2bc00 RCX: 0000000017d6067a [ 400.039746] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88017ac2bc00 [ 400.040573] RBP: ffff88017ac2bc00 R08: 00000000f461e6ac R09: 0000000000000006 [ 400.041361] R10: 000000000000020f R11: 0000000000000000 R12: ffff88016c130000 [ 400.042127] R13: 0000005d1c095013 R14: ffff88017ac2bf78 R15: 0000000000000020 [ 400.042957] FS: 0000000000000000(0000) GS:ffff88017bb00000(0000) knlGS:0000000000000000 [ 400.043895] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 400.044518] CR2: 0000000000000500 CR3: 0000000179c32004 CR4: 0000000000760ee0 [ 400.045294] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 400.046070] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 400.046843] PKRU: 55555554 [ 400.047144] Call Trace: [ 400.047438] bfq_finish_requeue_request+0x145/0x2fd [ 400.047977] blk_mq_free_request+0x49/0xea [ 400.048429] __scsi_execute+0x16c/0x17b [ 400.048885] scsi_mode_sense+0x113/0x265 [ 400.049356] sd_revalidate_disk+0xb5b/0x109a [sd_mod] [ 400.049947] ? __device_add_disk+0x3d2/0x3f6 [ 400.050415] sd_probe_async+0x10d/0x18b [sd_mod] [ 400.050924] async_run_entry_fn+0x6d/0x12b [ 400.051374] process_one_work+0x1da/0x313 [ 400.051841] ? rescuer_thread+0x282/0x282 [ 400.052313] worker_thread+0x1ca/0x295Quoted 8 lines
[ 400.052769] kthread+0x115/0x11d [ 400.053127] ? kthread_park+0x76/0x76 [ 400.053531] ret_from_fork+0x35/0x40 [ 400.053929] Modules linked in: scsi_debug null_blk isofs iTCO_wdt iTCO_vendor_support i2c_i801 i2c_core lpc_ich mfd_core ip_tables sr_mod cdrom usb_storage sd_mod ahci libahci crc32c_intel libata virtio_scsi qemu_fw_cfg dm_mirror dm_region_hash dm_log dm_mod [last unloaded: null_blk] [ 400.056640] Dumping ftrace buffer: [ 400.057022] (ftrace buffer empty) [ 400.057418] CR2: 0000000000000500 [ 400.057820] ---[ end trace 812cbc0fe8802fdd ]---Quoted 5 lines
Doesn't look related to the series, more like a bug in BFQ. Are you sure it passes on current -git? Or maybe the bug is exposed by the series.
I'll try and reproduce it here and see what happens.
I think I see the error, it is introduced by my series. This incremental should help, I'm going to test it now.
block/blk-ioc.c +17
-0@@ -212,6 +212,21 @@ void exit_io_context(struct task_struct *task)put_io_context_active (ioc); } +static void __ioc_clear_queue (struct list_head *icq_list) +{ +unsigned long flags; + +while (!list_empty (icq_list)) { +struct io_cq *icq =list_entry (icq_list->next, + struct io_cq, q_node); +struct io_context *ioc = icq->ioc; + +spin_lock_irqsave (&ioc->lock, flags); +ioc_destroy_icq (icq); +spin_unlock_irqrestore (&ioc->lock, flags); + } +} +/** * ioc_clear_queue - break any ioc association with the specified queue * @q: request_queue being cleared @@ -225,6 +240,8 @@ void ioc_clear_queue(struct request_queue *q)spin_lock_irq (q->queue_lock);list_splice_init (&q->icq_list, &icq_list);spin_unlock_irq (q->queue_lock); + +__ioc_clear_queue (&icq_list); }
Quoted 3 lines
block/blk-ioc.c void ioc_clear_queue(struct request_queue *q) · line 247
Quoted 1 line
block/blk-ioc.c +0
-0int create_task_io_context (struct task_struct *task,gfp_t gfp_flags,int node)Not see such issue anymore on today's mq-conversions.
Great, thanks for retesting.
Signature · 1 line
Jens Axboe