Re: [PATCH 3/4] scsi: sd: register request queue after sd_revalidate_disk is done

Hannes Reinecke
2019-11-20T09:59:11Z

On 11/18/19 11:31 AM, Ming Lei wrote:
> Prepare for improving SSD performance in the following patch, which
> needs to read queue flag of QUEUE_FLAG_NONROT in IO path. So we have
> to freeze queue before changing this flag in sd_revalidate_disk().
>
> However, queue freezing becomes quite slow after the queue is registered
> because RCU period is involved.
>
> So delay registering queue after sd_revalidate_disk() is done for
> avoiding slow queue freezing which will be added to sd_revalidate_disk()
> in the following patch.
>
> Cc: Sathya Prakash <sathya.prakash@broadcom.com>
> Cc: Chaitra P B <chaitra.basappa@broadcom.com>
> Cc: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
> Cc: Kashyap Desai <kashyap.desai@broadcom.com>
> Cc: Sumit Saxena <sumit.saxena@broadcom.com>
> Cc: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
> Cc: Ewan D. Milne <emilne@redhat.com>
> Cc: Christoph Hellwig <hch@lst.de>,
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: Bart Van Assche <bart.vanassche@wdc.com>
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> ---
> drivers/scsi/sd.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 03163ac5fe95..0744c34468e1 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -3368,12 +3368,14 @@ static int sd_probe(struct device *dev)
> }
>
> blk_pm_runtime_init(sdp->request_queue, dev);
> - device_add_disk(dev, gd, NULL);
> + device_add_disk_no_queue_reg(dev, gd);
> if (sdkp->capacity)
> sd_dif_config_host(sdkp);
>
> sd_revalidate_disk(gd);
>
> + blk_register_queue(gd);
> +
> if (sdkp->security) {
> sdkp->opal_dev = init_opal_dev(sdp, &sd_sec_submit);
> if (sdkp->opal_dev)
>
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@suse.de +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 247165 (AG München), GF: Felix Imendörffer