* [PATCH v4 0/6] Fixup mtip32xx for scheduling
@ 2017-04-28 16:54 Jens Axboe
2017-04-28 16:54 ` [PATCH 1/6] mtip32xx: get rid of 'atomic' argument to mtip_exec_internal_command() Jens Axboe
` (6 more replies)
0 siblings, 7 replies; 23+ messages in thread
From: Jens Axboe @ 2017-04-28 16:54 UTC (permalink / raw)
To: linux-block; +Cc: ming.lei, hch
OK, I think we're getting there now. I dropped the RQF_RESERVED
and the tag helper, since mtip32xx can just call
blk_rq_is_passthrough() and know it's an internal request.
We can do another cleanup series of mtip32xx making the
internal requests use the normal blk end_io infrastructure,
and use the provider helpers for mapping data. I think
that should be done separately as a cleanup, keeping this series
as a straight forward conversion.
I've tested this on the following card:
[ 56.394162] mtip32xx 0000:81:00.0: Model: P320h-MTFDGAR350SAH
and it works fine for me.
--
Jens Axboe
^ permalink raw reply [flat|nested] 23+ messages in thread* [PATCH 1/6] mtip32xx: get rid of 'atomic' argument to mtip_exec_internal_command() 2017-04-28 16:54 [PATCH v4 0/6] Fixup mtip32xx for scheduling Jens Axboe @ 2017-04-28 16:54 ` Jens Axboe 2017-04-28 16:54 ` [PATCH 2/6] mtip32xx: kill atomic argument to mtip_quiesce_io() Jens Axboe ` (5 subsequent siblings) 6 siblings, 0 replies; 23+ messages in thread From: Jens Axboe @ 2017-04-28 16:54 UTC (permalink / raw) To: linux-block; +Cc: ming.lei, hch, Jens Axboe All callers can safely block. Kill the atomic/block argument, and remove the argument from all callers. Reviewed-by: Bart Van Assche <Bart.VanAssche@sandisk.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com> --- drivers/block/mtip32xx/mtip32xx.c | 148 +++++++++++--------------------------- 1 file changed, 43 insertions(+), 105 deletions(-) diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 02804cc79d82..d81d797ee65d 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -609,11 +609,6 @@ static void mtip_completion(struct mtip_port *port, complete(waiting); } -static void mtip_null_completion(struct mtip_port *port, - int tag, struct mtip_cmd *command, int status) -{ -} - static int mtip_read_log_page(struct mtip_port *port, u8 page, u16 *buffer, dma_addr_t buffer_dma, unsigned int sectors); static int mtip_get_smart_attr(struct mtip_port *port, unsigned int id, @@ -1117,7 +1112,6 @@ static int mtip_exec_internal_command(struct mtip_port *port, dma_addr_t buffer, int buf_len, u32 opts, - gfp_t atomic, unsigned long timeout) { struct mtip_cmd_sg *command_sg; @@ -1146,30 +1140,22 @@ static int mtip_exec_internal_command(struct mtip_port *port, clear_bit(MTIP_PF_DM_ACTIVE_BIT, &port->flags); - if (atomic == GFP_KERNEL) { - if (fis->command != ATA_CMD_STANDBYNOW1) { - /* wait for io to complete if non atomic */ - if (mtip_quiesce_io(port, - MTIP_QUIESCE_IO_TIMEOUT_MS, atomic) < 0) { - dev_warn(&dd->pdev->dev, - "Failed to quiesce IO\n"); - mtip_put_int_command(dd, int_cmd); - clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); - wake_up_interruptible(&port->svc_wait); - return -EBUSY; - } + if (fis->command != ATA_CMD_STANDBYNOW1) { + /* wait for io to complete if non atomic */ + if (mtip_quiesce_io(port, + MTIP_QUIESCE_IO_TIMEOUT_MS, GFP_KERNEL) < 0) { + dev_warn(&dd->pdev->dev, "Failed to quiesce IO\n"); + mtip_put_int_command(dd, int_cmd); + clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); + wake_up_interruptible(&port->svc_wait); + return -EBUSY; } - - /* Set the completion function and data for the command. */ - int_cmd->comp_data = &wait; - int_cmd->comp_func = mtip_completion; - - } else { - /* Clear completion - we're going to poll */ - int_cmd->comp_data = NULL; - int_cmd->comp_func = mtip_null_completion; } + /* Set the completion function and data for the command. */ + int_cmd->comp_data = &wait; + int_cmd->comp_func = mtip_completion; + /* Copy the command to the command table */ memcpy(int_cmd->command, fis, fis_len*4); @@ -1198,81 +1184,41 @@ static int mtip_exec_internal_command(struct mtip_port *port, /* Issue the command to the hardware */ mtip_issue_non_ncq_command(port, MTIP_TAG_INTERNAL); - if (atomic == GFP_KERNEL) { - /* Wait for the command to complete or timeout. */ - if ((rv = wait_for_completion_interruptible_timeout( - &wait, - msecs_to_jiffies(timeout))) <= 0) { - - if (rv == -ERESTARTSYS) { /* interrupted */ - dev_err(&dd->pdev->dev, - "Internal command [%02X] was interrupted after %u ms\n", - fis->command, - jiffies_to_msecs(jiffies - start)); - rv = -EINTR; - goto exec_ic_exit; - } else if (rv == 0) /* timeout */ - dev_err(&dd->pdev->dev, - "Internal command did not complete [%02X] within timeout of %lu ms\n", - fis->command, timeout); - else - dev_err(&dd->pdev->dev, - "Internal command [%02X] wait returned code [%d] after %lu ms - unhandled\n", - fis->command, rv, timeout); - - if (mtip_check_surprise_removal(dd->pdev) || - test_bit(MTIP_DDF_REMOVE_PENDING_BIT, - &dd->dd_flag)) { - dev_err(&dd->pdev->dev, - "Internal command [%02X] wait returned due to SR\n", - fis->command); - rv = -ENXIO; - goto exec_ic_exit; - } - mtip_device_reset(dd); /* recover from timeout issue */ - rv = -EAGAIN; + /* Wait for the command to complete or timeout. */ + rv = wait_for_completion_interruptible_timeout(&wait, + msecs_to_jiffies(timeout)); + if (rv <= 0) { + if (rv == -ERESTARTSYS) { /* interrupted */ + dev_err(&dd->pdev->dev, + "Internal command [%02X] was interrupted after %u ms\n", + fis->command, + jiffies_to_msecs(jiffies - start)); + rv = -EINTR; goto exec_ic_exit; - } - } else { - u32 hba_stat, port_stat; - - /* Spin for <timeout> checking if command still outstanding */ - timeout = jiffies + msecs_to_jiffies(timeout); - while ((readl(port->cmd_issue[MTIP_TAG_INTERNAL]) - & (1 << MTIP_TAG_INTERNAL)) - && time_before(jiffies, timeout)) { - if (mtip_check_surprise_removal(dd->pdev)) { - rv = -ENXIO; - goto exec_ic_exit; - } - if ((fis->command != ATA_CMD_STANDBYNOW1) && - test_bit(MTIP_DDF_REMOVE_PENDING_BIT, - &dd->dd_flag)) { - rv = -ENXIO; - goto exec_ic_exit; - } - port_stat = readl(port->mmio + PORT_IRQ_STAT); - if (!port_stat) - continue; + } else if (rv == 0) /* timeout */ + dev_err(&dd->pdev->dev, + "Internal command did not complete [%02X] within timeout of %lu ms\n", + fis->command, timeout); + else + dev_err(&dd->pdev->dev, + "Internal command [%02X] wait returned code [%d] after %lu ms - unhandled\n", + fis->command, rv, timeout); - if (port_stat & PORT_IRQ_ERR) { - dev_err(&dd->pdev->dev, - "Internal command [%02X] failed\n", - fis->command); - mtip_device_reset(dd); - rv = -EIO; - goto exec_ic_exit; - } else { - writel(port_stat, port->mmio + PORT_IRQ_STAT); - hba_stat = readl(dd->mmio + HOST_IRQ_STAT); - if (hba_stat) - writel(hba_stat, - dd->mmio + HOST_IRQ_STAT); - } - break; + if (mtip_check_surprise_removal(dd->pdev) || + test_bit(MTIP_DDF_REMOVE_PENDING_BIT, + &dd->dd_flag)) { + dev_err(&dd->pdev->dev, + "Internal command [%02X] wait returned due to SR\n", + fis->command); + rv = -ENXIO; + goto exec_ic_exit; } + mtip_device_reset(dd); /* recover from timeout issue */ + rv = -EAGAIN; + goto exec_ic_exit; } + rv = 0; if (readl(port->cmd_issue[MTIP_TAG_INTERNAL]) & (1 << MTIP_TAG_INTERNAL)) { rv = -ENXIO; @@ -1391,7 +1337,6 @@ static int mtip_get_identify(struct mtip_port *port, void __user *user_buffer) port->identify_dma, sizeof(u16) * ATA_ID_WORDS, 0, - GFP_KERNEL, MTIP_INT_CMD_TIMEOUT_MS) < 0) { rv = -1; @@ -1477,7 +1422,6 @@ static int mtip_standby_immediate(struct mtip_port *port) 0, 0, 0, - GFP_ATOMIC, timeout); dbg_printk(MTIP_DRV_NAME "Time taken to complete standby cmd: %d ms\n", jiffies_to_msecs(jiffies - start)); @@ -1523,7 +1467,6 @@ static int mtip_read_log_page(struct mtip_port *port, u8 page, u16 *buffer, buffer_dma, sectors * ATA_SECT_SIZE, 0, - GFP_ATOMIC, MTIP_INT_CMD_TIMEOUT_MS); } @@ -1558,7 +1501,6 @@ static int mtip_get_smart_data(struct mtip_port *port, u8 *buffer, buffer_dma, ATA_SECT_SIZE, 0, - GFP_ATOMIC, 15000); } @@ -1686,7 +1628,6 @@ static int mtip_send_trim(struct driver_data *dd, unsigned int lba, dma_addr, ATA_SECT_SIZE, 0, - GFP_KERNEL, MTIP_TRIM_TIMEOUT_MS) < 0) rv = -EIO; @@ -1850,7 +1791,6 @@ static int exec_drive_task(struct mtip_port *port, u8 *command) 0, 0, 0, - GFP_KERNEL, to) < 0) { return -1; } @@ -1946,7 +1886,6 @@ static int exec_drive_command(struct mtip_port *port, u8 *command, (xfer_sz ? dma_addr : 0), (xfer_sz ? ATA_SECT_SIZE * xfer_sz : 0), 0, - GFP_KERNEL, to) < 0) { rv = -EFAULT; @@ -2189,7 +2128,6 @@ static int exec_drive_taskfile(struct driver_data *dd, dma_buffer, transfer_size, 0, - GFP_KERNEL, timeout) < 0) { err = -EIO; goto abort; -- 2.7.4 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 2/6] mtip32xx: kill atomic argument to mtip_quiesce_io() 2017-04-28 16:54 [PATCH v4 0/6] Fixup mtip32xx for scheduling Jens Axboe 2017-04-28 16:54 ` [PATCH 1/6] mtip32xx: get rid of 'atomic' argument to mtip_exec_internal_command() Jens Axboe @ 2017-04-28 16:54 ` Jens Axboe 2017-04-28 16:54 ` [PATCH 3/6] mtip32xx: abstract out "are any commands active" helper Jens Axboe ` (4 subsequent siblings) 6 siblings, 0 replies; 23+ messages in thread From: Jens Axboe @ 2017-04-28 16:54 UTC (permalink / raw) To: linux-block; +Cc: ming.lei, hch, Jens Axboe All callers now pass in GFP_KERNEL, get rid of the argument. Reviewed-by: Bart Van Assche <Bart.VanAssche@sandisk.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com> --- drivers/block/mtip32xx/mtip32xx.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index d81d797ee65d..36f3d34f2156 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -1035,14 +1035,12 @@ static bool mtip_pause_ncq(struct mtip_port *port, * * @port Pointer to port data structure * @timeout Max duration to wait (ms) - * @atomic gfp_t flag to indicate blockable context or not * * return value * 0 Success * -EBUSY Commands still active */ -static int mtip_quiesce_io(struct mtip_port *port, unsigned long timeout, - gfp_t atomic) +static int mtip_quiesce_io(struct mtip_port *port, unsigned long timeout) { unsigned long to; unsigned int n; @@ -1053,18 +1051,12 @@ static int mtip_quiesce_io(struct mtip_port *port, unsigned long timeout, to = jiffies + msecs_to_jiffies(timeout); do { if (test_bit(MTIP_PF_SVC_THD_ACTIVE_BIT, &port->flags) && - test_bit(MTIP_PF_ISSUE_CMDS_BIT, &port->flags) && - atomic == GFP_KERNEL) { + test_bit(MTIP_PF_ISSUE_CMDS_BIT, &port->flags)) { msleep(20); continue; /* svc thd is actively issuing commands */ } - if (atomic == GFP_KERNEL) - msleep(100); - else { - cpu_relax(); - udelay(100); - } + msleep(100); if (mtip_check_surprise_removal(port->dd->pdev)) goto err_fault; @@ -1142,8 +1134,7 @@ static int mtip_exec_internal_command(struct mtip_port *port, if (fis->command != ATA_CMD_STANDBYNOW1) { /* wait for io to complete if non atomic */ - if (mtip_quiesce_io(port, - MTIP_QUIESCE_IO_TIMEOUT_MS, GFP_KERNEL) < 0) { + if (mtip_quiesce_io(port, MTIP_QUIESCE_IO_TIMEOUT_MS) < 0) { dev_warn(&dd->pdev->dev, "Failed to quiesce IO\n"); mtip_put_int_command(dd, int_cmd); clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); @@ -4106,8 +4097,7 @@ static int mtip_block_remove(struct driver_data *dd) * Explicitly wait here for IOs to quiesce, * as mtip_standby_drive usually won't wait for IOs. */ - if (!mtip_quiesce_io(dd->port, MTIP_QUIESCE_IO_TIMEOUT_MS, - GFP_KERNEL)) + if (!mtip_quiesce_io(dd->port, MTIP_QUIESCE_IO_TIMEOUT_MS)) mtip_standby_drive(dd); } else -- 2.7.4 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 3/6] mtip32xx: abstract out "are any commands active" helper 2017-04-28 16:54 [PATCH v4 0/6] Fixup mtip32xx for scheduling Jens Axboe 2017-04-28 16:54 ` [PATCH 1/6] mtip32xx: get rid of 'atomic' argument to mtip_exec_internal_command() Jens Axboe 2017-04-28 16:54 ` [PATCH 2/6] mtip32xx: kill atomic argument to mtip_quiesce_io() Jens Axboe @ 2017-04-28 16:54 ` Jens Axboe 2017-04-28 16:54 ` [PATCH 4/6] mtip32xx: convert internal command issue to block IO path Jens Axboe ` (3 subsequent siblings) 6 siblings, 0 replies; 23+ messages in thread From: Jens Axboe @ 2017-04-28 16:54 UTC (permalink / raw) To: linux-block; +Cc: ming.lei, hch, Jens Axboe This is a prep patch for backoff in ->queue_rq() for non-ncq commands. Reviewed-by: Bart Van Assche <Bart.VanAssche@sandisk.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com> --- drivers/block/mtip32xx/mtip32xx.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 36f3d34f2156..aee94f260725 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -1030,6 +1030,22 @@ static bool mtip_pause_ncq(struct mtip_port *port, return false; } +static bool mtip_commands_active(struct mtip_port *port) +{ + unsigned int active; + unsigned int n; + + /* + * Ignore s_active bit 0 of array element 0. + * This bit will always be set + */ + active = readl(port->s_active[0]) & 0xFFFFFFFE; + for (n = 1; n < port->dd->slot_groups; n++) + active |= readl(port->s_active[n]); + + return active != 0; +} + /* * Wait for port to quiesce * @@ -1043,8 +1059,7 @@ static bool mtip_pause_ncq(struct mtip_port *port, static int mtip_quiesce_io(struct mtip_port *port, unsigned long timeout) { unsigned long to; - unsigned int n; - unsigned int active = 1; + bool active = true; blk_mq_stop_hw_queues(port->dd->queue); @@ -1061,14 +1076,7 @@ static int mtip_quiesce_io(struct mtip_port *port, unsigned long timeout) if (mtip_check_surprise_removal(port->dd->pdev)) goto err_fault; - /* - * Ignore s_active bit 0 of array element 0. - * This bit will always be set - */ - active = readl(port->s_active[0]) & 0xFFFFFFFE; - for (n = 1; n < port->dd->slot_groups; n++) - active |= readl(port->s_active[n]); - + active = mtip_commands_active(port); if (!active) break; } while (time_before(jiffies, to)); -- 2.7.4 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 4/6] mtip32xx: convert internal command issue to block IO path 2017-04-28 16:54 [PATCH v4 0/6] Fixup mtip32xx for scheduling Jens Axboe ` (2 preceding siblings ...) 2017-04-28 16:54 ` [PATCH 3/6] mtip32xx: abstract out "are any commands active" helper Jens Axboe @ 2017-04-28 16:54 ` Jens Axboe 2017-05-02 7:28 ` Christoph Hellwig 2017-04-28 16:54 ` [PATCH 5/6] blk-mq-sched: remove hack that bypasses scheduler for reserved requests Jens Axboe ` (2 subsequent siblings) 6 siblings, 1 reply; 23+ messages in thread From: Jens Axboe @ 2017-04-28 16:54 UTC (permalink / raw) To: linux-block; +Cc: ming.lei, hch, Jens Axboe The driver special cases certain things for command issue, depending on whether it's an internal command or not. Make the internal commands use the regular infrastructure for issuing IO. Since this is an 8-group souped up AHCI variant, we have to deal with NCQ vs non-queueable commands. Do this from the queue_rq handler, by backing off unless the drive is idle. Signed-off-by: Jens Axboe <axboe@fb.com> --- drivers/block/mtip32xx/mtip32xx.c | 103 +++++++++++++++++++++++++++----------- 1 file changed, 73 insertions(+), 30 deletions(-) diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index aee94f260725..9749b099a914 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -195,7 +195,7 @@ static struct mtip_cmd *mtip_get_int_command(struct driver_data *dd) if (mtip_check_surprise_removal(dd->pdev)) return NULL; - rq = blk_mq_alloc_request(dd->queue, 0, BLK_MQ_REQ_RESERVED); + rq = blk_mq_alloc_request(dd->queue, REQ_OP_DRV_IN, BLK_MQ_REQ_RESERVED); if (IS_ERR(rq)) return NULL; @@ -1088,6 +1088,13 @@ static int mtip_quiesce_io(struct mtip_port *port, unsigned long timeout) return -EFAULT; } +struct mtip_int_cmd { + int fis_len; + dma_addr_t buffer; + int buf_len; + u32 opts; +}; + /* * Execute an internal command and wait for the completion. * @@ -1114,10 +1121,16 @@ static int mtip_exec_internal_command(struct mtip_port *port, u32 opts, unsigned long timeout) { - struct mtip_cmd_sg *command_sg; DECLARE_COMPLETION_ONSTACK(wait); struct mtip_cmd *int_cmd; struct driver_data *dd = port->dd; + struct request *rq; + struct mtip_int_cmd icmd = { + .fis_len = fis_len, + .buffer = buffer, + .buf_len = buf_len, + .opts = opts + }; int rv = 0; unsigned long start; @@ -1132,6 +1145,8 @@ static int mtip_exec_internal_command(struct mtip_port *port, dbg_printk(MTIP_DRV_NAME "Unable to allocate tag for PIO cmd\n"); return -EFAULT; } + rq = blk_mq_rq_from_pdu(int_cmd); + rq->end_io_data = &icmd; set_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); @@ -1158,35 +1173,16 @@ static int mtip_exec_internal_command(struct mtip_port *port, /* Copy the command to the command table */ memcpy(int_cmd->command, fis, fis_len*4); - /* Populate the SG list */ - int_cmd->command_header->opts = - __force_bit2int cpu_to_le32(opts | fis_len); - if (buf_len) { - command_sg = int_cmd->command + AHCI_CMD_TBL_HDR_SZ; - - command_sg->info = - __force_bit2int cpu_to_le32((buf_len-1) & 0x3FFFFF); - command_sg->dba = - __force_bit2int cpu_to_le32(buffer & 0xFFFFFFFF); - command_sg->dba_upper = - __force_bit2int cpu_to_le32((buffer >> 16) >> 16); - - int_cmd->command_header->opts |= - __force_bit2int cpu_to_le32((1 << 16)); - } - - /* Populate the command header */ - int_cmd->command_header->byte_count = 0; - start = jiffies; + rq->timeout = timeout; - /* Issue the command to the hardware */ - mtip_issue_non_ncq_command(port, MTIP_TAG_INTERNAL); + /* insert request and run queue */ + blk_execute_rq_nowait(rq->q, NULL, rq, true, NULL); + + wait_for_completion(&wait); + rv = int_cmd->status; - /* Wait for the command to complete or timeout. */ - rv = wait_for_completion_interruptible_timeout(&wait, - msecs_to_jiffies(timeout)); - if (rv <= 0) { + if (rv < 0) { if (rv == -ERESTARTSYS) { /* interrupted */ dev_err(&dd->pdev->dev, "Internal command [%02X] was interrupted after %u ms\n", @@ -1217,7 +1213,6 @@ static int mtip_exec_internal_command(struct mtip_port *port, goto exec_ic_exit; } - rv = 0; if (readl(port->cmd_issue[MTIP_TAG_INTERNAL]) & (1 << MTIP_TAG_INTERNAL)) { rv = -ENXIO; @@ -3762,6 +3757,44 @@ static bool mtip_check_unal_depth(struct blk_mq_hw_ctx *hctx, return false; } +static int mtip_issue_reserved_cmd(struct blk_mq_hw_ctx *hctx, + struct request *rq) +{ + struct driver_data *dd = hctx->queue->queuedata; + struct mtip_int_cmd *icmd = rq->end_io_data; + struct mtip_cmd *cmd = blk_mq_rq_to_pdu(rq); + struct mtip_cmd_sg *command_sg; + + if (mtip_commands_active(dd->port)) + return BLK_MQ_RQ_QUEUE_BUSY; + + rq->end_io_data = NULL; + + /* Populate the SG list */ + cmd->command_header->opts = + __force_bit2int cpu_to_le32(icmd->opts | icmd->fis_len); + if (icmd->buf_len) { + command_sg = cmd->command + AHCI_CMD_TBL_HDR_SZ; + + command_sg->info = + __force_bit2int cpu_to_le32((icmd->buf_len-1) & 0x3FFFFF); + command_sg->dba = + __force_bit2int cpu_to_le32(icmd->buffer & 0xFFFFFFFF); + command_sg->dba_upper = + __force_bit2int cpu_to_le32((icmd->buffer >> 16) >> 16); + + cmd->command_header->opts |= + __force_bit2int cpu_to_le32((1 << 16)); + } + + /* Populate the command header */ + cmd->command_header->byte_count = 0; + + blk_mq_start_request(rq); + mtip_issue_non_ncq_command(dd->port, rq->tag); + return BLK_MQ_RQ_QUEUE_OK; +} + static int mtip_queue_rq(struct blk_mq_hw_ctx *hctx, const struct blk_mq_queue_data *bd) { @@ -3770,6 +3803,9 @@ static int mtip_queue_rq(struct blk_mq_hw_ctx *hctx, mtip_init_cmd_header(rq); + if (blk_rq_is_passthrough(rq)) + return mtip_issue_reserved_cmd(hctx, rq); + if (unlikely(mtip_check_unal_depth(hctx, rq))) return BLK_MQ_RQ_QUEUE_BUSY; @@ -3825,8 +3861,14 @@ static enum blk_eh_timer_return mtip_cmd_timeout(struct request *req, { struct driver_data *dd = req->q->queuedata; - if (reserved) + if (reserved) { + struct mtip_cmd *cmd = blk_mq_rq_to_pdu(req); + + cmd->status = -ETIME; + if (cmd->comp_func) + cmd->comp_func(dd->port, MTIP_TAG_INTERNAL, cmd, -ETIME); goto exit_handler; + } if (test_bit(req->tag, dd->port->cmds_to_issue)) goto exit_handler; @@ -4063,6 +4105,7 @@ static void mtip_no_dev_cleanup(struct request *rq, void *data, bool reserv) } else if (test_bit(MTIP_PF_IC_ACTIVE_BIT, &dd->port->flags)) { cmd = mtip_cmd_from_tag(dd, MTIP_TAG_INTERNAL); + cmd->status = -ENODEV; if (cmd->comp_func) cmd->comp_func(dd->port, MTIP_TAG_INTERNAL, cmd, -ENODEV); -- 2.7.4 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH 4/6] mtip32xx: convert internal command issue to block IO path 2017-04-28 16:54 ` [PATCH 4/6] mtip32xx: convert internal command issue to block IO path Jens Axboe @ 2017-05-02 7:28 ` Christoph Hellwig 2017-05-02 13:53 ` Jens Axboe 0 siblings, 1 reply; 23+ messages in thread From: Christoph Hellwig @ 2017-05-02 7:28 UTC (permalink / raw) To: Jens Axboe; +Cc: linux-block, ming.lei, hch Looks fine for now: Reviewed-by: Christoph Hellwig <hch@lst.de> But rather sooner than later we need to make this path at least go through the normal end_request processing. Without that we're just bound to run into problems like we had with the tag changes again when the driver is using the block layer APIs incompletely. ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 4/6] mtip32xx: convert internal command issue to block IO path 2017-05-02 7:28 ` Christoph Hellwig @ 2017-05-02 13:53 ` Jens Axboe 2017-05-02 14:47 ` Jens Axboe 0 siblings, 1 reply; 23+ messages in thread From: Jens Axboe @ 2017-05-02 13:53 UTC (permalink / raw) To: Christoph Hellwig; +Cc: linux-block, ming.lei On 05/02/2017 01:28 AM, Christoph Hellwig wrote: > Looks fine for now: > > Reviewed-by: Christoph Hellwig <hch@lst.de> > > But rather sooner than later we need to make this path at least go > through the normal end_request processing. Without that we're just > bound to run into problems like we had with the tag changes again > when the driver is using the block layer APIs incompletely. I completely agree, I'll see if I can find some time to do that soon. -- Jens Axboe ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 4/6] mtip32xx: convert internal command issue to block IO path 2017-05-02 13:53 ` Jens Axboe @ 2017-05-02 14:47 ` Jens Axboe 2017-05-02 15:09 ` Jens Axboe 0 siblings, 1 reply; 23+ messages in thread From: Jens Axboe @ 2017-05-02 14:47 UTC (permalink / raw) To: Christoph Hellwig; +Cc: linux-block, ming.lei On 05/02/2017 07:53 AM, Jens Axboe wrote: > On 05/02/2017 01:28 AM, Christoph Hellwig wrote: >> Looks fine for now: >> >> Reviewed-by: Christoph Hellwig <hch@lst.de> >> >> But rather sooner than later we need to make this path at least go >> through the normal end_request processing. Without that we're just >> bound to run into problems like we had with the tag changes again >> when the driver is using the block layer APIs incompletely. > > I completely agree, I'll see if I can find some time to do that > soon. Seems like a fine thing to do over morning coffee. How about something like the below? It's on top of the previous series. Basically this kills the private completion handler and data, which were basically redundant as they did nothing but spew a warning in case of an error. It'd be nice to unify the INTERNAL and regular commands, but we don't have to do that to use the block layer APIs. If someone else wants to do that, be my guest. It compiles and loads fine on my setup, did some basic testing it that went fine. Would be nice if someone else could look it over as well, to verify that I didn't drop any of the 0-vs-error setting. I think it's fine, we just need to ensure that cmd->status is always set to the appropriate error, then we propagate that through the mtip32xx softirq handler to the block layer. mtip32xx.c | 194 +++++++++---------------------------------------------------- mtip32xx.h | 10 --- 2 files changed, 29 insertions(+), 175 deletions(-) diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 96fe6500e941..60b62a72bc22 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -205,66 +205,12 @@ static struct mtip_cmd *mtip_get_int_command(struct driver_data *dd) return blk_mq_rq_to_pdu(rq); } -static void mtip_put_int_command(struct driver_data *dd, struct mtip_cmd *cmd) -{ - blk_put_request(blk_mq_rq_from_pdu(cmd)); -} - -/* - * Once we add support for one hctx per mtip group, this will change a bit - */ -static struct request *mtip_rq_from_tag(struct driver_data *dd, - unsigned int tag) -{ - struct blk_mq_hw_ctx *hctx = dd->queue->queue_hw_ctx[0]; - - return blk_mq_tag_to_rq(hctx->tags, tag); -} - static struct mtip_cmd *mtip_cmd_from_tag(struct driver_data *dd, unsigned int tag) { - struct request *rq = mtip_rq_from_tag(dd, tag); - - return blk_mq_rq_to_pdu(rq); -} - -/* - * IO completion function. - * - * This completion function is called by the driver ISR when a - * command that was issued by the kernel completes. It first calls the - * asynchronous completion function which normally calls back into the block - * layer passing the asynchronous callback data, then unmaps the - * scatter list associated with the completed command, and finally - * clears the allocated bit associated with the completed command. - * - * @port Pointer to the port data structure. - * @tag Tag of the command. - * @data Pointer to driver_data. - * @status Completion status. - * - * return value - * None - */ -static void mtip_async_complete(struct mtip_port *port, - int tag, struct mtip_cmd *cmd, int status) -{ - struct driver_data *dd = port->dd; - struct request *rq; - - if (unlikely(!dd) || unlikely(!port)) - return; - - if (unlikely(status == PORT_IRQ_TF_ERR)) { - dev_warn(&port->dd->pdev->dev, - "Command tag %d failed due to TFE\n", tag); - } - - rq = mtip_rq_from_tag(dd, tag); + struct blk_mq_hw_ctx *hctx = dd->queue->queue_hw_ctx[0]; - cmd->status = status; - blk_mq_complete_request(rq); + return blk_mq_rq_to_pdu(blk_mq_tag_to_rq(hctx->tags, tag)); } /* @@ -581,38 +527,18 @@ static void print_tags(struct driver_data *dd, "%d command(s) %s: tagmap [%s]", cnt, msg, tagmap); } -/* - * Internal command completion callback function. - * - * This function is normally called by the driver ISR when an internal - * command completed. This function signals the command completion by - * calling complete(). - * - * @port Pointer to the port data structure. - * @tag Tag of the command that has completed. - * @data Pointer to a completion structure. - * @status Completion status. - * - * return value - * None - */ -static void mtip_completion(struct mtip_port *port, - int tag, struct mtip_cmd *command, int status) -{ - struct completion *waiting = command->comp_data; - if (unlikely(status == PORT_IRQ_TF_ERR)) - dev_warn(&port->dd->pdev->dev, - "Internal command %d completed with TFE\n", tag); - - command->comp_func = NULL; - command->comp_data = NULL; - complete(waiting); -} - static int mtip_read_log_page(struct mtip_port *port, u8 page, u16 *buffer, dma_addr_t buffer_dma, unsigned int sectors); static int mtip_get_smart_attr(struct mtip_port *port, unsigned int id, struct smart_attr *attrib); + +static void mtip_complete_command(struct mtip_cmd *cmd) +{ + struct request *req = blk_mq_rq_from_pdu(cmd); + + blk_mq_complete_request(req); +} + /* * Handle an error. * @@ -641,11 +567,7 @@ static void mtip_handle_tfe(struct driver_data *dd) if (test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags)) { cmd = mtip_cmd_from_tag(dd, MTIP_TAG_INTERNAL); dbg_printk(MTIP_DRV_NAME " TFE for the internal command\n"); - - if (cmd->comp_data && cmd->comp_func) { - cmd->comp_func(port, MTIP_TAG_INTERNAL, - cmd, PORT_IRQ_TF_ERR); - } + mtip_complete_command(cmd); return; } @@ -672,19 +594,9 @@ static void mtip_handle_tfe(struct driver_data *dd) continue; cmd = mtip_cmd_from_tag(dd, tag); - if (likely(cmd->comp_func)) { - set_bit(tag, tagaccum); - cmd_cnt++; - cmd->comp_func(port, tag, cmd, 0); - } else { - dev_err(&port->dd->pdev->dev, - "Missing completion func for tag %d", - tag); - if (mtip_check_surprise_removal(dd->pdev)) { - /* don't proceed further */ - return; - } - } + mtip_complete_command(cmd); + set_bit(tag, tagaccum); + cmd_cnt++; } } @@ -754,10 +666,8 @@ static void mtip_handle_tfe(struct driver_data *dd) tag, fail_reason != NULL ? fail_reason : "unknown"); - if (cmd->comp_func) { - cmd->comp_func(port, tag, - cmd, -ENODATA); - } + cmd->status = -ENODATA; + mtip_complete_command(cmd); continue; } } @@ -780,12 +690,8 @@ static void mtip_handle_tfe(struct driver_data *dd) dev_warn(&port->dd->pdev->dev, "retiring tag %d\n", tag); - if (cmd->comp_func) - cmd->comp_func(port, tag, cmd, PORT_IRQ_TF_ERR); - else - dev_warn(&port->dd->pdev->dev, - "Bad completion for tag %d\n", - tag); + cmd->status = -EIO; + mtip_complete_command(cmd); } } print_tags(dd, "reissued (TFE)", tagaccum, cmd_cnt); @@ -818,18 +724,7 @@ static inline void mtip_workq_sdbfx(struct mtip_port *port, int group, continue; command = mtip_cmd_from_tag(dd, tag); - if (likely(command->comp_func)) - command->comp_func(port, tag, command, 0); - else { - dev_dbg(&dd->pdev->dev, - "Null completion for tag %d", - tag); - - if (mtip_check_surprise_removal( - dd->pdev)) { - return; - } - } + mtip_complete_command(command); } completed >>= 1; } @@ -850,10 +745,7 @@ static inline void mtip_process_legacy(struct driver_data *dd, u32 port_stat) if (test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags) && (cmd != NULL) && !(readl(port->cmd_issue[MTIP_TAG_INTERNAL]) & (1 << MTIP_TAG_INTERNAL))) { - if (cmd->comp_func) { - cmd->comp_func(port, MTIP_TAG_INTERNAL, cmd, 0); - return; - } + mtip_complete_command(cmd); } return; @@ -1121,7 +1013,6 @@ static int mtip_exec_internal_command(struct mtip_port *port, u32 opts, unsigned long timeout) { - DECLARE_COMPLETION_ONSTACK(wait); struct mtip_cmd *int_cmd; struct driver_data *dd = port->dd; struct request *rq; @@ -1146,7 +1037,7 @@ static int mtip_exec_internal_command(struct mtip_port *port, return -EFAULT; } rq = blk_mq_rq_from_pdu(int_cmd); - rq->end_io_data = &icmd; + rq->special = &icmd; set_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); @@ -1159,17 +1050,13 @@ static int mtip_exec_internal_command(struct mtip_port *port, /* wait for io to complete if non atomic */ if (mtip_quiesce_io(port, MTIP_QUIESCE_IO_TIMEOUT_MS) < 0) { dev_warn(&dd->pdev->dev, "Failed to quiesce IO\n"); - mtip_put_int_command(dd, int_cmd); + blk_mq_free_request(rq); clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); wake_up_interruptible(&port->svc_wait); return -EBUSY; } } - /* Set the completion function and data for the command. */ - int_cmd->comp_data = &wait; - int_cmd->comp_func = mtip_completion; - /* Copy the command to the command table */ memcpy(int_cmd->command, fis, fis_len*4); @@ -1177,11 +1064,9 @@ static int mtip_exec_internal_command(struct mtip_port *port, rq->timeout = timeout; /* insert request and run queue */ - blk_execute_rq_nowait(rq->q, NULL, rq, true, NULL); + blk_execute_rq(rq->q, NULL, rq, true); - wait_for_completion(&wait); rv = int_cmd->status; - if (rv < 0) { if (rv == -ERESTARTSYS) { /* interrupted */ dev_err(&dd->pdev->dev, @@ -1223,7 +1108,7 @@ static int mtip_exec_internal_command(struct mtip_port *port, } exec_ic_exit: /* Clear the allocated and active bits for the internal command. */ - mtip_put_int_command(dd, int_cmd); + blk_mq_free_request(rq); clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); if (rv >= 0 && mtip_pause_ncq(port, fis)) { /* NCQ paused */ @@ -2378,12 +2263,6 @@ static void mtip_hw_submit_io(struct driver_data *dd, struct request *rq, (nents << 16) | 5 | AHCI_CMD_PREFETCH); command->command_header->byte_count = 0; - /* - * Set the completion function and data for the command - * within this layer. - */ - command->comp_data = dd; - command->comp_func = mtip_async_complete; command->direction = dma_dir; /* @@ -3761,15 +3640,13 @@ static int mtip_issue_reserved_cmd(struct blk_mq_hw_ctx *hctx, struct request *rq) { struct driver_data *dd = hctx->queue->queuedata; - struct mtip_int_cmd *icmd = rq->end_io_data; + struct mtip_int_cmd *icmd = rq->special; struct mtip_cmd *cmd = blk_mq_rq_to_pdu(rq); struct mtip_cmd_sg *command_sg; if (mtip_commands_active(dd->port)) return BLK_MQ_RQ_QUEUE_BUSY; - rq->end_io_data = NULL; - /* Populate the SG list */ cmd->command_header->opts = __force_bit2int cpu_to_le32(icmd->opts | icmd->fis_len); @@ -3857,9 +3734,7 @@ static enum blk_eh_timer_return mtip_cmd_timeout(struct request *req, struct mtip_cmd *cmd = blk_mq_rq_to_pdu(req); cmd->status = -ETIME; - if (cmd->comp_func) - cmd->comp_func(dd->port, MTIP_TAG_INTERNAL, cmd, -ETIME); - goto exit_handler; + return BLK_EH_HANDLED; } if (test_bit(req->tag, dd->port->cmds_to_issue)) @@ -4087,21 +3962,10 @@ static int mtip_block_initialize(struct driver_data *dd) static void mtip_no_dev_cleanup(struct request *rq, void *data, bool reserv) { - struct driver_data *dd = (struct driver_data *)data; - struct mtip_cmd *cmd; - - if (likely(!reserv)) { - cmd = blk_mq_rq_to_pdu(rq); - cmd->status = -ENODEV; - blk_mq_complete_request(rq); - } else if (test_bit(MTIP_PF_IC_ACTIVE_BIT, &dd->port->flags)) { + struct mtip_cmd *cmd = blk_mq_rq_to_pdu(rq); - cmd = mtip_cmd_from_tag(dd, MTIP_TAG_INTERNAL); - cmd->status = -ENODEV; - if (cmd->comp_func) - cmd->comp_func(dd->port, MTIP_TAG_INTERNAL, - cmd, -ENODEV); - } + cmd->status = -ENODEV; + blk_mq_complete_request(rq); } /* diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h index 57b41528a824..37b8e3e0bb78 100644 --- a/drivers/block/mtip32xx/mtip32xx.h +++ b/drivers/block/mtip32xx/mtip32xx.h @@ -333,16 +333,6 @@ struct mtip_cmd { dma_addr_t command_dma; /* corresponding physical address */ - void *comp_data; /* data passed to completion function comp_func() */ - /* - * Completion function called by the ISR upon completion of - * a command. - */ - void (*comp_func)(struct mtip_port *port, - int tag, - struct mtip_cmd *cmd, - int status); - int scatter_ents; /* Number of scatter list entries used */ int unaligned; /* command is unaligned on 4k boundary */ -- Jens Axboe ^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH 4/6] mtip32xx: convert internal command issue to block IO path 2017-05-02 14:47 ` Jens Axboe @ 2017-05-02 15:09 ` Jens Axboe 2017-05-02 15:16 ` Christoph Hellwig 0 siblings, 1 reply; 23+ messages in thread From: Jens Axboe @ 2017-05-02 15:09 UTC (permalink / raw) To: Christoph Hellwig; +Cc: linux-block, ming.lei On 05/02/2017 08:47 AM, Jens Axboe wrote: > On 05/02/2017 07:53 AM, Jens Axboe wrote: >> On 05/02/2017 01:28 AM, Christoph Hellwig wrote: >>> Looks fine for now: >>> >>> Reviewed-by: Christoph Hellwig <hch@lst.de> >>> >>> But rather sooner than later we need to make this path at least go >>> through the normal end_request processing. Without that we're just >>> bound to run into problems like we had with the tag changes again >>> when the driver is using the block layer APIs incompletely. >> >> I completely agree, I'll see if I can find some time to do that >> soon. > > Seems like a fine thing to do over morning coffee. How about something > like the below? It's on top of the previous series. Basically this kills > the private completion handler and data, which were basically redundant > as they did nothing but spew a warning in case of an error. > > It'd be nice to unify the INTERNAL and regular commands, but we don't > have to do that to use the block layer APIs. If someone else wants to do > that, be my guest. > > It compiles and loads fine on my setup, did some basic testing it that > went fine. Would be nice if someone else could look it over as well, to > verify that I didn't drop any of the 0-vs-error setting. I think it's > fine, we just need to ensure that cmd->status is always set to the > appropriate error, then we propagate that through the mtip32xx softirq > handler to the block layer. Looks like I was missing one error conversion, on the internal request path for taskfile TFE. Changed mtip_complete_command() to take a status argument, and fixup that case too. diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 96fe6500e941..63a64123b3cb 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -205,66 +205,12 @@ static struct mtip_cmd *mtip_get_int_command(struct driver_data *dd) return blk_mq_rq_to_pdu(rq); } -static void mtip_put_int_command(struct driver_data *dd, struct mtip_cmd *cmd) -{ - blk_put_request(blk_mq_rq_from_pdu(cmd)); -} - -/* - * Once we add support for one hctx per mtip group, this will change a bit - */ -static struct request *mtip_rq_from_tag(struct driver_data *dd, - unsigned int tag) -{ - struct blk_mq_hw_ctx *hctx = dd->queue->queue_hw_ctx[0]; - - return blk_mq_tag_to_rq(hctx->tags, tag); -} - static struct mtip_cmd *mtip_cmd_from_tag(struct driver_data *dd, unsigned int tag) { - struct request *rq = mtip_rq_from_tag(dd, tag); - - return blk_mq_rq_to_pdu(rq); -} - -/* - * IO completion function. - * - * This completion function is called by the driver ISR when a - * command that was issued by the kernel completes. It first calls the - * asynchronous completion function which normally calls back into the block - * layer passing the asynchronous callback data, then unmaps the - * scatter list associated with the completed command, and finally - * clears the allocated bit associated with the completed command. - * - * @port Pointer to the port data structure. - * @tag Tag of the command. - * @data Pointer to driver_data. - * @status Completion status. - * - * return value - * None - */ -static void mtip_async_complete(struct mtip_port *port, - int tag, struct mtip_cmd *cmd, int status) -{ - struct driver_data *dd = port->dd; - struct request *rq; - - if (unlikely(!dd) || unlikely(!port)) - return; - - if (unlikely(status == PORT_IRQ_TF_ERR)) { - dev_warn(&port->dd->pdev->dev, - "Command tag %d failed due to TFE\n", tag); - } - - rq = mtip_rq_from_tag(dd, tag); + struct blk_mq_hw_ctx *hctx = dd->queue->queue_hw_ctx[0]; - cmd->status = status; - blk_mq_complete_request(rq); + return blk_mq_rq_to_pdu(blk_mq_tag_to_rq(hctx->tags, tag)); } /* @@ -581,38 +527,19 @@ static void print_tags(struct driver_data *dd, "%d command(s) %s: tagmap [%s]", cnt, msg, tagmap); } -/* - * Internal command completion callback function. - * - * This function is normally called by the driver ISR when an internal - * command completed. This function signals the command completion by - * calling complete(). - * - * @port Pointer to the port data structure. - * @tag Tag of the command that has completed. - * @data Pointer to a completion structure. - * @status Completion status. - * - * return value - * None - */ -static void mtip_completion(struct mtip_port *port, - int tag, struct mtip_cmd *command, int status) -{ - struct completion *waiting = command->comp_data; - if (unlikely(status == PORT_IRQ_TF_ERR)) - dev_warn(&port->dd->pdev->dev, - "Internal command %d completed with TFE\n", tag); - - command->comp_func = NULL; - command->comp_data = NULL; - complete(waiting); -} - static int mtip_read_log_page(struct mtip_port *port, u8 page, u16 *buffer, dma_addr_t buffer_dma, unsigned int sectors); static int mtip_get_smart_attr(struct mtip_port *port, unsigned int id, struct smart_attr *attrib); + +static void mtip_complete_command(struct mtip_cmd *cmd, int status) +{ + struct request *req = blk_mq_rq_from_pdu(cmd); + + cmd->status = status; + blk_mq_complete_request(req); +} + /* * Handle an error. * @@ -641,11 +568,7 @@ static void mtip_handle_tfe(struct driver_data *dd) if (test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags)) { cmd = mtip_cmd_from_tag(dd, MTIP_TAG_INTERNAL); dbg_printk(MTIP_DRV_NAME " TFE for the internal command\n"); - - if (cmd->comp_data && cmd->comp_func) { - cmd->comp_func(port, MTIP_TAG_INTERNAL, - cmd, PORT_IRQ_TF_ERR); - } + mtip_complete_command(cmd, -EIO); return; } @@ -672,19 +595,9 @@ static void mtip_handle_tfe(struct driver_data *dd) continue; cmd = mtip_cmd_from_tag(dd, tag); - if (likely(cmd->comp_func)) { - set_bit(tag, tagaccum); - cmd_cnt++; - cmd->comp_func(port, tag, cmd, 0); - } else { - dev_err(&port->dd->pdev->dev, - "Missing completion func for tag %d", - tag); - if (mtip_check_surprise_removal(dd->pdev)) { - /* don't proceed further */ - return; - } - } + mtip_complete_command(cmd, 0); + set_bit(tag, tagaccum); + cmd_cnt++; } } @@ -754,10 +667,7 @@ static void mtip_handle_tfe(struct driver_data *dd) tag, fail_reason != NULL ? fail_reason : "unknown"); - if (cmd->comp_func) { - cmd->comp_func(port, tag, - cmd, -ENODATA); - } + mtip_complete_command(cmd, -ENODATA); continue; } } @@ -780,12 +690,7 @@ static void mtip_handle_tfe(struct driver_data *dd) dev_warn(&port->dd->pdev->dev, "retiring tag %d\n", tag); - if (cmd->comp_func) - cmd->comp_func(port, tag, cmd, PORT_IRQ_TF_ERR); - else - dev_warn(&port->dd->pdev->dev, - "Bad completion for tag %d\n", - tag); + mtip_complete_command(cmd, -EIO); } } print_tags(dd, "reissued (TFE)", tagaccum, cmd_cnt); @@ -818,18 +723,7 @@ static inline void mtip_workq_sdbfx(struct mtip_port *port, int group, continue; command = mtip_cmd_from_tag(dd, tag); - if (likely(command->comp_func)) - command->comp_func(port, tag, command, 0); - else { - dev_dbg(&dd->pdev->dev, - "Null completion for tag %d", - tag); - - if (mtip_check_surprise_removal( - dd->pdev)) { - return; - } - } + mtip_complete_command(command, 0); } completed >>= 1; } @@ -850,13 +744,8 @@ static inline void mtip_process_legacy(struct driver_data *dd, u32 port_stat) if (test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags) && (cmd != NULL) && !(readl(port->cmd_issue[MTIP_TAG_INTERNAL]) & (1 << MTIP_TAG_INTERNAL))) { - if (cmd->comp_func) { - cmd->comp_func(port, MTIP_TAG_INTERNAL, cmd, 0); - return; - } + mtip_complete_command(cmd, 0); } - - return; } /* @@ -864,7 +753,6 @@ static inline void mtip_process_legacy(struct driver_data *dd, u32 port_stat) */ static inline void mtip_process_errors(struct driver_data *dd, u32 port_stat) { - if (unlikely(port_stat & PORT_IRQ_CONNECT)) { dev_warn(&dd->pdev->dev, "Clearing PxSERR.DIAG.x\n"); @@ -991,8 +879,7 @@ static irqreturn_t mtip_irq_handler(int irq, void *instance) static void mtip_issue_non_ncq_command(struct mtip_port *port, int tag) { - writel(1 << MTIP_TAG_BIT(tag), - port->cmd_issue[MTIP_TAG_INDEX(tag)]); + writel(1 << MTIP_TAG_BIT(tag), port->cmd_issue[MTIP_TAG_INDEX(tag)]); } static bool mtip_pause_ncq(struct mtip_port *port, @@ -1121,7 +1008,6 @@ static int mtip_exec_internal_command(struct mtip_port *port, u32 opts, unsigned long timeout) { - DECLARE_COMPLETION_ONSTACK(wait); struct mtip_cmd *int_cmd; struct driver_data *dd = port->dd; struct request *rq; @@ -1146,7 +1032,7 @@ static int mtip_exec_internal_command(struct mtip_port *port, return -EFAULT; } rq = blk_mq_rq_from_pdu(int_cmd); - rq->end_io_data = &icmd; + rq->special = &icmd; set_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); @@ -1159,17 +1045,13 @@ static int mtip_exec_internal_command(struct mtip_port *port, /* wait for io to complete if non atomic */ if (mtip_quiesce_io(port, MTIP_QUIESCE_IO_TIMEOUT_MS) < 0) { dev_warn(&dd->pdev->dev, "Failed to quiesce IO\n"); - mtip_put_int_command(dd, int_cmd); + blk_mq_free_request(rq); clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); wake_up_interruptible(&port->svc_wait); return -EBUSY; } } - /* Set the completion function and data for the command. */ - int_cmd->comp_data = &wait; - int_cmd->comp_func = mtip_completion; - /* Copy the command to the command table */ memcpy(int_cmd->command, fis, fis_len*4); @@ -1177,11 +1059,9 @@ static int mtip_exec_internal_command(struct mtip_port *port, rq->timeout = timeout; /* insert request and run queue */ - blk_execute_rq_nowait(rq->q, NULL, rq, true, NULL); + blk_execute_rq(rq->q, NULL, rq, true); - wait_for_completion(&wait); rv = int_cmd->status; - if (rv < 0) { if (rv == -ERESTARTSYS) { /* interrupted */ dev_err(&dd->pdev->dev, @@ -1223,7 +1103,7 @@ static int mtip_exec_internal_command(struct mtip_port *port, } exec_ic_exit: /* Clear the allocated and active bits for the internal command. */ - mtip_put_int_command(dd, int_cmd); + blk_mq_free_request(rq); clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); if (rv >= 0 && mtip_pause_ncq(port, fis)) { /* NCQ paused */ @@ -2378,12 +2258,6 @@ static void mtip_hw_submit_io(struct driver_data *dd, struct request *rq, (nents << 16) | 5 | AHCI_CMD_PREFETCH); command->command_header->byte_count = 0; - /* - * Set the completion function and data for the command - * within this layer. - */ - command->comp_data = dd; - command->comp_func = mtip_async_complete; command->direction = dma_dir; /* @@ -3761,15 +3635,13 @@ static int mtip_issue_reserved_cmd(struct blk_mq_hw_ctx *hctx, struct request *rq) { struct driver_data *dd = hctx->queue->queuedata; - struct mtip_int_cmd *icmd = rq->end_io_data; + struct mtip_int_cmd *icmd = rq->special; struct mtip_cmd *cmd = blk_mq_rq_to_pdu(rq); struct mtip_cmd_sg *command_sg; if (mtip_commands_active(dd->port)) return BLK_MQ_RQ_QUEUE_BUSY; - rq->end_io_data = NULL; - /* Populate the SG list */ cmd->command_header->opts = __force_bit2int cpu_to_le32(icmd->opts | icmd->fis_len); @@ -3857,9 +3729,7 @@ static enum blk_eh_timer_return mtip_cmd_timeout(struct request *req, struct mtip_cmd *cmd = blk_mq_rq_to_pdu(req); cmd->status = -ETIME; - if (cmd->comp_func) - cmd->comp_func(dd->port, MTIP_TAG_INTERNAL, cmd, -ETIME); - goto exit_handler; + return BLK_EH_HANDLED; } if (test_bit(req->tag, dd->port->cmds_to_issue)) @@ -4087,21 +3957,10 @@ static int mtip_block_initialize(struct driver_data *dd) static void mtip_no_dev_cleanup(struct request *rq, void *data, bool reserv) { - struct driver_data *dd = (struct driver_data *)data; - struct mtip_cmd *cmd; - - if (likely(!reserv)) { - cmd = blk_mq_rq_to_pdu(rq); - cmd->status = -ENODEV; - blk_mq_complete_request(rq); - } else if (test_bit(MTIP_PF_IC_ACTIVE_BIT, &dd->port->flags)) { + struct mtip_cmd *cmd = blk_mq_rq_to_pdu(rq); - cmd = mtip_cmd_from_tag(dd, MTIP_TAG_INTERNAL); - cmd->status = -ENODEV; - if (cmd->comp_func) - cmd->comp_func(dd->port, MTIP_TAG_INTERNAL, - cmd, -ENODEV); - } + cmd->status = -ENODEV; + blk_mq_complete_request(rq); } /* diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h index 57b41528a824..37b8e3e0bb78 100644 --- a/drivers/block/mtip32xx/mtip32xx.h +++ b/drivers/block/mtip32xx/mtip32xx.h @@ -333,16 +333,6 @@ struct mtip_cmd { dma_addr_t command_dma; /* corresponding physical address */ - void *comp_data; /* data passed to completion function comp_func() */ - /* - * Completion function called by the ISR upon completion of - * a command. - */ - void (*comp_func)(struct mtip_port *port, - int tag, - struct mtip_cmd *cmd, - int status); - int scatter_ents; /* Number of scatter list entries used */ int unaligned; /* command is unaligned on 4k boundary */ -- Jens Axboe ^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH 4/6] mtip32xx: convert internal command issue to block IO path 2017-05-02 15:09 ` Jens Axboe @ 2017-05-02 15:16 ` Christoph Hellwig 2017-05-02 15:25 ` Jens Axboe 0 siblings, 1 reply; 23+ messages in thread From: Christoph Hellwig @ 2017-05-02 15:16 UTC (permalink / raw) To: Jens Axboe; +Cc: Christoph Hellwig, linux-block, ming.lei This looks reasonable to me, although of course I don't have a way to test it. Any reason for the move from ->end_io_data to ->special? I thought that ->special was something we'd get rid of sooner or later now that we can have additional per-cmd data even for !mq. ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 4/6] mtip32xx: convert internal command issue to block IO path 2017-05-02 15:16 ` Christoph Hellwig @ 2017-05-02 15:25 ` Jens Axboe 2017-05-02 15:42 ` Bart Van Assche 0 siblings, 1 reply; 23+ messages in thread From: Jens Axboe @ 2017-05-02 15:25 UTC (permalink / raw) To: Christoph Hellwig; +Cc: linux-block, ming.lei On 05/02/2017 09:16 AM, Christoph Hellwig wrote: > This looks reasonable to me, although of course I don't have a way > to test it. I've got a few cards at least. > Any reason for the move from ->end_io_data to ->special? I thought > that ->special was something we'd get rid of sooner or later now > that we can have additional per-cmd data even for !mq. With the switch to blk_execute_rq(), we can't be using end_io_data and end_io, as we use that internally for the wakeup. So I have to stuff it somewhere. The obvious option would be to move it to mtip_cmd, but we can't safely access that prior to having a driver tag assigned, which doesn't happen until we end up in our ->queue_rq(). So we need to stuff it somewhere. -- Jens Axboe ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 4/6] mtip32xx: convert internal command issue to block IO path 2017-05-02 15:25 ` Jens Axboe @ 2017-05-02 15:42 ` Bart Van Assche 2017-05-02 16:00 ` Jens Axboe 0 siblings, 1 reply; 23+ messages in thread From: Bart Van Assche @ 2017-05-02 15:42 UTC (permalink / raw) To: hch@lst.de, axboe@kernel.dk Cc: linux-block@vger.kernel.org, ming.lei@redhat.com On Tue, 2017-05-02 at 09:25 -0600, Jens Axboe wrote: > On 05/02/2017 09:16 AM, Christoph Hellwig wrote: > > Any reason for the move from ->end_io_data to ->special? I thought > > that ->special was something we'd get rid of sooner or later now > > that we can have additional per-cmd data even for !mq. >=20 > With the switch to blk_execute_rq(), we can't be using end_io_data > and end_io, as we use that internally for the wakeup. So I have to > stuff it somewhere. >=20 > The obvious option would be to move it to mtip_cmd, but we can't > safely access that prior to having a driver tag assigned, which doesn't > happen until we end up in our ->queue_rq(). So we need to stuff it > somewhere. Hello Jens, Do you think it would be a good idea to allow blk_get_request() callers to specify that a driver tag has to be allocated even if a scheduler has been configured? That would make it possible to store completion data in mtip_cmd for the mtip driver. Thanks, Bart.= ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 4/6] mtip32xx: convert internal command issue to block IO path 2017-05-02 15:42 ` Bart Van Assche @ 2017-05-02 16:00 ` Jens Axboe 0 siblings, 0 replies; 23+ messages in thread From: Jens Axboe @ 2017-05-02 16:00 UTC (permalink / raw) To: Bart Van Assche, hch@lst.de Cc: linux-block@vger.kernel.org, ming.lei@redhat.com On 05/02/2017 09:42 AM, Bart Van Assche wrote: > On Tue, 2017-05-02 at 09:25 -0600, Jens Axboe wrote: >> On 05/02/2017 09:16 AM, Christoph Hellwig wrote: >>> Any reason for the move from ->end_io_data to ->special? I thought >>> that ->special was something we'd get rid of sooner or later now >>> that we can have additional per-cmd data even for !mq. >> >> With the switch to blk_execute_rq(), we can't be using end_io_data >> and end_io, as we use that internally for the wakeup. So I have to >> stuff it somewhere. >> >> The obvious option would be to move it to mtip_cmd, but we can't >> safely access that prior to having a driver tag assigned, which doesn't >> happen until we end up in our ->queue_rq(). So we need to stuff it >> somewhere. > > Hello Jens, > > Do you think it would be a good idea to allow blk_get_request() callers > to specify that a driver tag has to be allocated even if a scheduler has > been configured? That would make it possible to store completion data in > mtip_cmd for the mtip driver. Honestly, I think it's fine that we can stuff it _somewhere_ in the request. I'd rather not expose the driver vs internal tag anymore than we absolutely have, it's just prone to work on one configuration and then break if someone turns scheduling on or off. The real fix here, to avoid using ->special, would be to map the request before insertion. Then we don't have to pass any info at all. But that will require touching the callers of the internal command path for mtip32xx. Left as an exercise to the reader... -- Jens Axboe ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 5/6] blk-mq-sched: remove hack that bypasses scheduler for reserved requests 2017-04-28 16:54 [PATCH v4 0/6] Fixup mtip32xx for scheduling Jens Axboe ` (3 preceding siblings ...) 2017-04-28 16:54 ` [PATCH 4/6] mtip32xx: convert internal command issue to block IO path Jens Axboe @ 2017-04-28 16:54 ` Jens Axboe 2017-05-02 7:28 ` Christoph Hellwig 2017-04-28 16:54 ` [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" Jens Axboe 2017-05-02 12:27 ` [PATCH v4 0/6] Fixup mtip32xx for scheduling Ming Lei 6 siblings, 1 reply; 23+ messages in thread From: Jens Axboe @ 2017-04-28 16:54 UTC (permalink / raw) To: linux-block; +Cc: ming.lei, hch, Jens Axboe We have update the troublesome driver (mtip32xx) to deal with this appropriately. So kill the hack that bypassed scheduler allocation and insertion for reserved requests. Reviewed-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@fb.com> --- block/blk-mq-sched.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c index 8b361e192e8a..e79e9f18d7c2 100644 --- a/block/blk-mq-sched.c +++ b/block/blk-mq-sched.c @@ -82,11 +82,7 @@ struct request *blk_mq_sched_get_request(struct request_queue *q, if (likely(!data->hctx)) data->hctx = blk_mq_map_queue(q, data->ctx->cpu); - /* - * For a reserved tag, allocate a normal request since we might - * have driver dependencies on the value of the internal tag. - */ - if (e && !(data->flags & BLK_MQ_REQ_RESERVED)) { + if (e) { data->flags |= BLK_MQ_REQ_INTERNAL; /* -- 2.7.4 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH 5/6] blk-mq-sched: remove hack that bypasses scheduler for reserved requests 2017-04-28 16:54 ` [PATCH 5/6] blk-mq-sched: remove hack that bypasses scheduler for reserved requests Jens Axboe @ 2017-05-02 7:28 ` Christoph Hellwig 0 siblings, 0 replies; 23+ messages in thread From: Christoph Hellwig @ 2017-05-02 7:28 UTC (permalink / raw) To: Jens Axboe; +Cc: linux-block, ming.lei, hch Looks good, Reviewed-by: Christoph Hellwig <hch@lst.de> ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" 2017-04-28 16:54 [PATCH v4 0/6] Fixup mtip32xx for scheduling Jens Axboe ` (4 preceding siblings ...) 2017-04-28 16:54 ` [PATCH 5/6] blk-mq-sched: remove hack that bypasses scheduler for reserved requests Jens Axboe @ 2017-04-28 16:54 ` Jens Axboe 2017-05-02 7:28 ` Christoph Hellwig 2017-05-02 12:27 ` [PATCH v4 0/6] Fixup mtip32xx for scheduling Ming Lei 6 siblings, 1 reply; 23+ messages in thread From: Jens Axboe @ 2017-04-28 16:54 UTC (permalink / raw) To: linux-block; +Cc: ming.lei, hch, Jens Axboe This reverts commit 4981d04dd8f1ab19e2cce008da556d7f099b6e68. The driver has been converted to using the proper infrastructure for issuing internal commands. This means it's now safe to use with the scheduling infrastruture, so we can now revert the change that turned off scheduling for mtip32xx. Reviewed-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@fb.com> --- drivers/block/mtip32xx/mtip32xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 9749b099a914..9108be601a64 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -3961,7 +3961,7 @@ static int mtip_block_initialize(struct driver_data *dd) dd->tags.reserved_tags = 1; dd->tags.cmd_size = sizeof(struct mtip_cmd); dd->tags.numa_node = dd->numa_node; - dd->tags.flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_NO_SCHED; + dd->tags.flags = BLK_MQ_F_SHOULD_MERGE; dd->tags.driver_data = dd; dd->tags.timeout = MTIP_NCQ_CMD_TIMEOUT_MS; -- 2.7.4 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" 2017-04-28 16:54 ` [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" Jens Axboe @ 2017-05-02 7:28 ` Christoph Hellwig 0 siblings, 0 replies; 23+ messages in thread From: Christoph Hellwig @ 2017-05-02 7:28 UTC (permalink / raw) To: Jens Axboe; +Cc: linux-block, ming.lei, hch Looks good, Reviewed-by: Christoph Hellwig <hch@lst.de> ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 0/6] Fixup mtip32xx for scheduling 2017-04-28 16:54 [PATCH v4 0/6] Fixup mtip32xx for scheduling Jens Axboe ` (5 preceding siblings ...) 2017-04-28 16:54 ` [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" Jens Axboe @ 2017-05-02 12:27 ` Ming Lei 6 siblings, 0 replies; 23+ messages in thread From: Ming Lei @ 2017-05-02 12:27 UTC (permalink / raw) To: Jens Axboe; +Cc: linux-block, hch On Fri, Apr 28, 2017 at 10:54:27AM -0600, Jens Axboe wrote: > OK, I think we're getting there now. I dropped the RQF_RESERVED > and the tag helper, since mtip32xx can just call > blk_rq_is_passthrough() and know it's an internal request. > > We can do another cleanup series of mtip32xx making the > internal requests use the normal blk end_io infrastructure, > and use the provider helpers for mapping data. I think > that should be done separately as a cleanup, keeping this series > as a straight forward conversion. > > I've tested this on the following card: > > [ 56.394162] mtip32xx 0000:81:00.0: Model: P320h-MTFDGAR350SAH > > and it works fine for me. Tested this patchset against the latest linus tree, works fine on my system with mq-deadline scheduler enabled. Tested-by: Ming Lei <ming.lei@redhat.com> Thanks, Ming ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v2a 0/6]: Fixup mtip32xx for scheduling @ 2017-04-28 14:31 Jens Axboe 2017-04-28 14:31 ` [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" Jens Axboe 0 siblings, 1 reply; 23+ messages in thread From: Jens Axboe @ 2017-04-28 14:31 UTC (permalink / raw) To: linux-block; +Cc: ming.lei, hch Since I fat-fingered the previous posting of v2, here's a v2a that is what v2 should have been. No changes since v2, just for easier review. Sorry about that. To recap, changes since v1: - Mark internal commands as REQ_OP_DRV_IN. Doesn't really matter what the data direction is, the important bit is that we need to ensure the request is seen as a passthrough. - Remove redundant active = 1 setting in mtip_commands_active(). - Utilize blk-mq timeout infrastructure, to avoid racing with cleanup. -- Jens Axboe ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" 2017-04-28 14:31 [PATCH v2a 0/6]: " Jens Axboe @ 2017-04-28 14:31 ` Jens Axboe 2017-04-28 14:49 ` Christoph Hellwig 0 siblings, 1 reply; 23+ messages in thread From: Jens Axboe @ 2017-04-28 14:31 UTC (permalink / raw) To: linux-block; +Cc: ming.lei, hch, Jens Axboe This reverts commit 4981d04dd8f1ab19e2cce008da556d7f099b6e68. The driver has been converted to using the proper infrastructure for issuing internal commands. This means it's now safe to use with the scheduling infrastruture, so we can now revert the change that turned off scheduling for mtip32xx. Reviewed-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@fb.com> --- drivers/block/mtip32xx/mtip32xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 90f14f799527..15b9fcc2b89c 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -3961,7 +3961,7 @@ static int mtip_block_initialize(struct driver_data *dd) dd->tags.reserved_tags = 1; dd->tags.cmd_size = sizeof(struct mtip_cmd); dd->tags.numa_node = dd->numa_node; - dd->tags.flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_NO_SCHED; + dd->tags.flags = BLK_MQ_F_SHOULD_MERGE; dd->tags.driver_data = dd; dd->tags.timeout = MTIP_NCQ_CMD_TIMEOUT_MS; -- 2.7.4 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" 2017-04-28 14:31 ` [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" Jens Axboe @ 2017-04-28 14:49 ` Christoph Hellwig 0 siblings, 0 replies; 23+ messages in thread From: Christoph Hellwig @ 2017-04-28 14:49 UTC (permalink / raw) To: Jens Axboe; +Cc: linux-block, ming.lei, hch Looks fine, Reviewed-by: Christoph Hellwig <hch@lst.de> ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v2 0/6] Fixup mtip32xx for scheduling @ 2017-04-28 14:01 Jens Axboe 2017-04-28 14:01 ` [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" Jens Axboe 0 siblings, 1 reply; 23+ messages in thread From: Jens Axboe @ 2017-04-28 14:01 UTC (permalink / raw) To: linux-block; +Cc: ming.lei, hch Round two of this patchset to cleanup. Changes since the first posting: - Mark internal commands as REQ_OP_DRV_IN. Doesn't really matter what the data direction is, the important bit is that we need to ensure the request is seen as a passthrough. - Remove redundant active = 1 setting in mtip_commands_active(). - Utilize blk-mq timeout infrastructure, to avoid racing with cleanup. -- Jens Axboe ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" 2017-04-28 14:01 [PATCH v2 0/6] Fixup mtip32xx for scheduling Jens Axboe @ 2017-04-28 14:01 ` Jens Axboe 0 siblings, 0 replies; 23+ messages in thread From: Jens Axboe @ 2017-04-28 14:01 UTC (permalink / raw) To: linux-block; +Cc: ming.lei, hch, Jens Axboe This reverts commit 4981d04dd8f1ab19e2cce008da556d7f099b6e68. The driver has been converted to using the proper infrastructure for issuing internal commands. This means it's now safe to use with the scheduling infrastruture, so we can now revert the change that turned off scheduling for mtip32xx. Reviewed-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@fb.com> --- drivers/block/mtip32xx/mtip32xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 90f14f799527..15b9fcc2b89c 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -3961,7 +3961,7 @@ static int mtip_block_initialize(struct driver_data *dd) dd->tags.reserved_tags = 1; dd->tags.cmd_size = sizeof(struct mtip_cmd); dd->tags.numa_node = dd->numa_node; - dd->tags.flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_NO_SCHED; + dd->tags.flags = BLK_MQ_F_SHOULD_MERGE; dd->tags.driver_data = dd; dd->tags.timeout = MTIP_NCQ_CMD_TIMEOUT_MS; -- 2.7.4 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 0/6] Fixup mtip32xx for scheduling @ 2017-04-27 22:51 Jens Axboe 2017-04-27 22:51 ` [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" Jens Axboe 0 siblings, 1 reply; 23+ messages in thread From: Jens Axboe @ 2017-04-27 22:51 UTC (permalink / raw) To: linux-block; +Cc: ming.lei, hch This attempts a cleaner solution, where we simply mark a request as having come from the reserved pool. mtip32xx can then be converted to using that info, and moving it's internal command issue over to the regular block infrastructure. First three are prep/cleanup patches for mtip32xx, which an easier conversion of the driver. -- Jens Axboe ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" 2017-04-27 22:51 [PATCH 0/6] Fixup mtip32xx for scheduling Jens Axboe @ 2017-04-27 22:51 ` Jens Axboe 2017-04-28 4:06 ` Ming Lei 0 siblings, 1 reply; 23+ messages in thread From: Jens Axboe @ 2017-04-27 22:51 UTC (permalink / raw) To: linux-block; +Cc: ming.lei, hch, Jens Axboe This reverts commit 4981d04dd8f1ab19e2cce008da556d7f099b6e68. The driver has been converted to using the proper infrastructure for issuing internal commands. This means it's now safe to use with the scheduling infrastruture, so we can now revert the change that turned off scheduling for mtip32xx. Signed-off-by: Jens Axboe <axboe@fb.com> --- drivers/block/mtip32xx/mtip32xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index ba03a5b1f05a..cf11d364c848 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -3955,7 +3955,7 @@ static int mtip_block_initialize(struct driver_data *dd) dd->tags.reserved_tags = 1; dd->tags.cmd_size = sizeof(struct mtip_cmd); dd->tags.numa_node = dd->numa_node; - dd->tags.flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_NO_SCHED; + dd->tags.flags = BLK_MQ_F_SHOULD_MERGE; dd->tags.driver_data = dd; dd->tags.timeout = MTIP_NCQ_CMD_TIMEOUT_MS; -- 2.7.4 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" 2017-04-27 22:51 ` [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" Jens Axboe @ 2017-04-28 4:06 ` Ming Lei 0 siblings, 0 replies; 23+ messages in thread From: Ming Lei @ 2017-04-28 4:06 UTC (permalink / raw) To: Jens Axboe; +Cc: linux-block, hch On Thu, Apr 27, 2017 at 04:51:34PM -0600, Jens Axboe wrote: > This reverts commit 4981d04dd8f1ab19e2cce008da556d7f099b6e68. > > The driver has been converted to using the proper infrastructure > for issuing internal commands. This means it's now safe to use with > the scheduling infrastruture, so we can now revert the change > that turned off scheduling for mtip32xx. > > Signed-off-by: Jens Axboe <axboe@fb.com> > --- > drivers/block/mtip32xx/mtip32xx.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c > index ba03a5b1f05a..cf11d364c848 100644 > --- a/drivers/block/mtip32xx/mtip32xx.c > +++ b/drivers/block/mtip32xx/mtip32xx.c > @@ -3955,7 +3955,7 @@ static int mtip_block_initialize(struct driver_data *dd) > dd->tags.reserved_tags = 1; > dd->tags.cmd_size = sizeof(struct mtip_cmd); > dd->tags.numa_node = dd->numa_node; > - dd->tags.flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_NO_SCHED; > + dd->tags.flags = BLK_MQ_F_SHOULD_MERGE; > dd->tags.driver_data = dd; > dd->tags.timeout = MTIP_NCQ_CMD_TIMEOUT_MS; Reviewed-by: Ming Lei <ming.lei@redhat.com> Thanks, Ming ^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2017-05-02 16:00 UTC | newest] Thread overview: 23+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-04-28 16:54 [PATCH v4 0/6] Fixup mtip32xx for scheduling Jens Axboe 2017-04-28 16:54 ` [PATCH 1/6] mtip32xx: get rid of 'atomic' argument to mtip_exec_internal_command() Jens Axboe 2017-04-28 16:54 ` [PATCH 2/6] mtip32xx: kill atomic argument to mtip_quiesce_io() Jens Axboe 2017-04-28 16:54 ` [PATCH 3/6] mtip32xx: abstract out "are any commands active" helper Jens Axboe 2017-04-28 16:54 ` [PATCH 4/6] mtip32xx: convert internal command issue to block IO path Jens Axboe 2017-05-02 7:28 ` Christoph Hellwig 2017-05-02 13:53 ` Jens Axboe 2017-05-02 14:47 ` Jens Axboe 2017-05-02 15:09 ` Jens Axboe 2017-05-02 15:16 ` Christoph Hellwig 2017-05-02 15:25 ` Jens Axboe 2017-05-02 15:42 ` Bart Van Assche 2017-05-02 16:00 ` Jens Axboe 2017-04-28 16:54 ` [PATCH 5/6] blk-mq-sched: remove hack that bypasses scheduler for reserved requests Jens Axboe 2017-05-02 7:28 ` Christoph Hellwig 2017-04-28 16:54 ` [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" Jens Axboe 2017-05-02 7:28 ` Christoph Hellwig 2017-05-02 12:27 ` [PATCH v4 0/6] Fixup mtip32xx for scheduling Ming Lei -- strict thread matches above, loose matches on Subject: below -- 2017-04-28 14:31 [PATCH v2a 0/6]: " Jens Axboe 2017-04-28 14:31 ` [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" Jens Axboe 2017-04-28 14:49 ` Christoph Hellwig 2017-04-28 14:01 [PATCH v2 0/6] Fixup mtip32xx for scheduling Jens Axboe 2017-04-28 14:01 ` [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" Jens Axboe 2017-04-27 22:51 [PATCH 0/6] Fixup mtip32xx for scheduling Jens Axboe 2017-04-27 22:51 ` [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED" Jens Axboe 2017-04-28 4:06 ` Ming Lei
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).