lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b923af39-8a33-4c2e-38ee-3ef53ced08e1@acm.org>
Date:   Tue, 13 Apr 2021 09:14:01 -0700
From:   Bart Van Assche <bvanassche@....org>
To:     Changheun Lee <nanich.lee@...sung.com>, damien.lemoal@....com,
        Johannes.Thumshirn@....com, asml.silence@...il.com,
        axboe@...nel.dk, gregkh@...uxfoundation.org, hch@...radead.org,
        linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
        ming.lei@...hat.com, osandov@...com, patchwork-bot@...nel.org,
        tj@...nel.org, tom.leiming@...il.com
Cc:     jisoo2146.oh@...sung.com, junho89.kim@...sung.com,
        mj0123.lee@...sung.com, seunghwan.hyun@...sung.com,
        sookwan7.kim@...sung.com, woosung2.lee@...sung.com,
        yt0928.kim@...sung.com
Subject: Re: [PATCH v7 2/3] ufs: set QUEUE_FLAG_LIMIT_BIO_SIZE

On 4/12/21 7:55 PM, Changheun Lee wrote:
> Set QUEUE_FLAG_LIMIT_BIO_SIZE queue flag to limit bio max size to
> queue max sectors size for UFS device.
> 
> Signed-off-by: Changheun Lee <nanich.lee@...sung.com>
> ---
>  drivers/scsi/scsi_lib.c   | 2 ++
>  drivers/scsi/ufs/ufshcd.c | 1 +
>  include/scsi/scsi_host.h  | 2 ++
>  3 files changed, 5 insertions(+)
> 
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 7d52a11e1b61..73ce6ba7903a 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1838,6 +1838,8 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q)
>  	 * Devices that require a bigger alignment can increase it later.
>  	 */
>  	blk_queue_dma_alignment(q, max(4, dma_get_cache_alignment()) - 1);
> +
> +	blk_queue_set_limit_bio_size(q, shost->limit_bio_size);
>  }
>  EXPORT_SYMBOL_GPL(__scsi_init_queue);
>  
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index d3d05e997c13..000eb5ab022e 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -9313,6 +9313,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
>  	host->max_channel = UFSHCD_MAX_CHANNEL;
>  	host->unique_id = host->host_no;
>  	host->max_cmd_len = UFS_CDB_SIZE;
> +	host->limit_bio_size = true;
>  
>  	hba->max_pwr_info.is_valid = false;
>  
> diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
> index e30fd963b97d..486f61588717 100644
> --- a/include/scsi/scsi_host.h
> +++ b/include/scsi/scsi_host.h
> @@ -607,6 +607,8 @@ struct Scsi_Host {
>  	unsigned int max_segment_size;
>  	unsigned long dma_boundary;
>  	unsigned long virt_boundary_mask;
> +	unsigned int limit_bio_size;
> +
>  	/*
>  	 * In scsi-mq mode, the number of hardware queues supported by the LLD.
>  	 *

This patch should have been split into one patch for the SCSI core and
another patch for the UFS driver.

I see an issue with this patch: a new attribute has been introduced in
struct Scsi_Host but it is not used by the SCSI core. That seems weird
to me.

Another comment I have about this patch is why to restrict the BIO size
(blk_queue_set_limit_bio_size(q, shost->limit_bio_size)) only for UFS
devices? Aren't all block devices, including NVMe devices, expected to
benefit from limiting the BIO size if no stacking is involved? How about
the following approach?
* In blk_queue_max_hw_sectors(), set the maximum BIO size to
  max_hw_sectors. As you may know blk_queue_max_hw_sectors() may be
  called by any block driver (stacking and non-stacking).
* In blk_stack_limits(), set the maximum BIO size to UINT_MAX. Stacking
  block drivers must call blk_stack_limits().

Thanks,

Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ