Message ID | e1e827ba633f780b00d070e087204d5c@mail.gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, 2017-01-30 at 19:22 +0530, Kashyap Desai wrote: > - if (atomic_inc_return(&instance->fw_outstanding) > > - instance->host->can_queue) { > - atomic_dec(&instance->fw_outstanding); > - return SCSI_MLQUEUE_HOST_BUSY; > - } > + if (atomic_inc_return(&instance->fw_outstanding) > safe_can_queue) { > + is_nonrot = blk_queue_nonrot(scmd->device->request_queue); > + /* For rotational device wait for sometime to get fusion command > from pool. > + * This is just to reduce proactive re-queue at mid layer which is > not > + * sending sorted IO in SCSI.MQ mode. > + */ > + if (!is_nonrot) > + udelay(100); > + } The SCSI core does not allow to sleep inside the queuecommand() callback function. Bart.-- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 01/30/2017 09:30 AM, Bart Van Assche wrote: > On Mon, 2017-01-30 at 19:22 +0530, Kashyap Desai wrote: >> - if (atomic_inc_return(&instance->fw_outstanding) > >> - instance->host->can_queue) { >> - atomic_dec(&instance->fw_outstanding); >> - return SCSI_MLQUEUE_HOST_BUSY; >> - } >> + if (atomic_inc_return(&instance->fw_outstanding) > safe_can_queue) { >> + is_nonrot = blk_queue_nonrot(scmd->device->request_queue); >> + /* For rotational device wait for sometime to get fusion command >> from pool. >> + * This is just to reduce proactive re-queue at mid layer which is >> not >> + * sending sorted IO in SCSI.MQ mode. >> + */ >> + if (!is_nonrot) >> + udelay(100); >> + } > > The SCSI core does not allow to sleep inside the queuecommand() callback > function. udelay() is a busy loop, so it's not sleeping. That said, it's obviously NOT a great idea. We want to fix the reordering due to requeues, not introduce random busy delays to work around it.
> -----Original Message----- > From: Jens Axboe [mailto:axboe@kernel.dk] > Sent: Monday, January 30, 2017 10:03 PM > To: Bart Van Assche; osandov@osandov.com; kashyap.desai@broadcom.com > Cc: linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org; > hch@infradead.org; linux-block@vger.kernel.org; paolo.valente@linaro.org > Subject: Re: Device or HBA level QD throttling creates randomness in > sequetial workload > > On 01/30/2017 09:30 AM, Bart Van Assche wrote: > > On Mon, 2017-01-30 at 19:22 +0530, Kashyap Desai wrote: > >> - if (atomic_inc_return(&instance->fw_outstanding) > > >> - instance->host->can_queue) { > >> - atomic_dec(&instance->fw_outstanding); > >> - return SCSI_MLQUEUE_HOST_BUSY; > >> - } > >> + if (atomic_inc_return(&instance->fw_outstanding) > safe_can_queue) { > >> + is_nonrot = blk_queue_nonrot(scmd->device->request_queue); > >> + /* For rotational device wait for sometime to get fusion > >> + command > >> from pool. > >> + * This is just to reduce proactive re-queue at mid layer > >> + which is > >> not > >> + * sending sorted IO in SCSI.MQ mode. > >> + */ > >> + if (!is_nonrot) > >> + udelay(100); > >> + } > > > > The SCSI core does not allow to sleep inside the queuecommand() > > callback function. > > udelay() is a busy loop, so it's not sleeping. That said, it's obviously NOT a > great idea. We want to fix the reordering due to requeues, not introduce > random busy delays to work around it. Thanks for feedback. I do realize that udelay() is going to be very odd in queue_command call back. I will keep this note. Preferred solution is blk mq scheduler patches. > > -- > Jens Axboe -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 01/30/2017 11:28 AM, Kashyap Desai wrote: >> -----Original Message----- >> From: Jens Axboe [mailto:axboe@kernel.dk] >> Sent: Monday, January 30, 2017 10:03 PM >> To: Bart Van Assche; osandov@osandov.com; kashyap.desai@broadcom.com >> Cc: linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org; >> hch@infradead.org; linux-block@vger.kernel.org; paolo.valente@linaro.org >> Subject: Re: Device or HBA level QD throttling creates randomness in >> sequetial workload >> >> On 01/30/2017 09:30 AM, Bart Van Assche wrote: >>> On Mon, 2017-01-30 at 19:22 +0530, Kashyap Desai wrote: >>>> - if (atomic_inc_return(&instance->fw_outstanding) > >>>> - instance->host->can_queue) { >>>> - atomic_dec(&instance->fw_outstanding); >>>> - return SCSI_MLQUEUE_HOST_BUSY; >>>> - } >>>> + if (atomic_inc_return(&instance->fw_outstanding) > > safe_can_queue) { >>>> + is_nonrot = blk_queue_nonrot(scmd->device->request_queue); >>>> + /* For rotational device wait for sometime to get fusion >>>> + command >>>> from pool. >>>> + * This is just to reduce proactive re-queue at mid layer >>>> + which is >>>> not >>>> + * sending sorted IO in SCSI.MQ mode. >>>> + */ >>>> + if (!is_nonrot) >>>> + udelay(100); >>>> + } >>> >>> The SCSI core does not allow to sleep inside the queuecommand() >>> callback function. >> >> udelay() is a busy loop, so it's not sleeping. That said, it's obviously > NOT a >> great idea. We want to fix the reordering due to requeues, not introduce >> random busy delays to work around it. > > Thanks for feedback. I do realize that udelay() is going to be very odd > in queue_command call back. I will keep this note. Preferred solution is > blk mq scheduler patches. It's coming in 4.11, so you don't have to wait long.
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 9a9c84f..a683eb0 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -54,6 +54,7 @@ #include <scsi/scsi_host.h> #include <scsi/scsi_dbg.h> #include <linux/dmi.h> +#include <linux/cpumask.h> #include "megaraid_sas_fusion.h" #include "megaraid_sas.h" @@ -2572,7 +2573,15 @@ void megasas_prepare_secondRaid1_IO(struct megasas_instance *instance, struct megasas_cmd_fusion *cmd, *r1_cmd = NULL; union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc; u32 index; - struct fusion_context *fusion; + bool is_nonrot; + u32 safe_can_queue; + u32 num_cpus; + struct fusion_context *fusion; + + fusion = instance->ctrl_context; + + num_cpus = num_online_cpus(); + safe_can_queue = instance->cur_can_queue - num_cpus; fusion = instance->ctrl_context;