From: Changheun Lee <nanich.lee@samsung.com>
To: bvanassche@acm.org
Cc: Johannes.Thumshirn@wdc.com, alex_y_xu@yahoo.ca,
alim.akhtar@samsung.com, asml.silence@gmail.com,
avri.altman@wdc.com, axboe@kernel.dk, bgoncalv@redhat.com,
cang@codeaurora.org, damien.lemoal@wdc.com,
gregkh@linuxfoundation.org, hch@infradead.org,
jaegeuk@kernel.org, jejb@linux.ibm.com, jisoo2146.oh@samsung.com,
junho89.kim@samsung.com, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
martin.petersen@oracle.com, ming.lei@redhat.com,
mj0123.lee@samsung.com, nanich.lee@samsung.com, osandov@fb.com,
patchwork-bot@kernel.org, seunghwan.hyun@samsung.com,
sookwan7.kim@samsung.com, tj@kernel.org, tom.leiming@gmail.com,
woosung2.lee@samsung.com, yi.zhang@redhat.com,
yt0928.kim@samsung.com
Subject: Re: [PATCH v12 3/3] ufs: set max_bio_bytes with queue max sectors
Date: Mon, 7 Jun 2021 18:21:56 +0900 [thread overview]
Message-ID: <20210607092156.16774-1-nanich.lee@samsung.com> (raw)
In-Reply-To: <004bef40-1667-3b60-adaf-bea2b15f2514@acm.org>
> On 6/3/21 10:03 PM, Changheun Lee wrote:
> > Set max_bio_bytes same with queue max sectors. It will lead to fast bio
> > submit when bio size is over than queue max sectors. And it might be helpful
> > to align submit bio size in some case.
> >
> > Signed-off-by: Changheun Lee <nanich.lee@samsung.com>
> > ---
> > drivers/scsi/ufs/ufshcd.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> > index 3eb54937f1d8..37365a726517 100644
> > --- a/drivers/scsi/ufs/ufshcd.c
> > +++ b/drivers/scsi/ufs/ufshcd.c
> > @@ -4858,6 +4858,7 @@ static int ufshcd_slave_configure(struct scsi_device *sdev)
> > {
> > struct ufs_hba *hba = shost_priv(sdev->host);
> > struct request_queue *q = sdev->request_queue;
> > + unsigned int max_bio_bytes;
> >
> > blk_queue_update_dma_pad(q, PRDT_DATA_BYTE_COUNT_PAD - 1);
> > if (hba->quirks & UFSHCD_QUIRK_ALIGN_SG_WITH_PAGE_SIZE)
> > @@ -4868,6 +4869,10 @@ static int ufshcd_slave_configure(struct scsi_device *sdev)
> >
> > ufshcd_crypto_setup_rq_keyslot_manager(hba, q);
> >
> > + if (!check_shl_overflow(queue_max_sectors(q),
> > + SECTOR_SHIFT, &max_bio_bytes))
> > + blk_queue_max_bio_bytes(q, max_bio_bytes);
> > +
> > return 0;
> > }
>
> Just like previous versions of this patch series, this approach will
> trigger data corruption if dm-crypt is stacked on top of the UFS driver
> since ufs_max_sectors << SECTOR_SHIFT = 1024 * 512 is less than the size
> of the dm-crypt buffer (BIO_MAX_VECS << PAGE_SHIFT = 256 * 4096).
max_bio_bytes can't be smaller than "BIO_MAX_VECS * PAGE_SIZE". Large value
will be selected between input parameter and "BIO_MAX_VECS * PAGE_SIZE" in
blk_queue_max_bio_bytes(). I think bio max size should be larger than
"BIO_MAX_VECS * PAGE_SIZE" for kernel stability.
void blk_queue_max_bio_bytes(struct request_queue *q, unsigned int bytes)
{
struct queue_limits *limits = &q->limits;
unsigned int max_bio_bytes = round_up(bytes, PAGE_SIZE);
limits->max_bio_bytes = max_t(unsigned int, max_bio_bytes,
BIO_MAX_VECS * PAGE_SIZE);
}
EXPORT_SYMBOL(blk_queue_max_bio_bytes);
>
> I am not recommending to increase max_sectors for the UFS driver. We
> need a solution that is independent of the dm-crypt internals.
>
> Bart.
No need to increase max_sectors in driver to set max_bio_bytes. There are
no dependency with dm-crypt I think.
Thank you,
Changheun Lee
next prev parent reply other threads:[~2021-06-07 9:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20210604052157epcas1p2e5eebb52d08b06174696290e11fdd5a4@epcas1p2.samsung.com>
2021-06-04 5:03 ` [PATCH v12 0/3] bio: control bio max size Changheun Lee
[not found] ` <CGME20210604052159epcas1p4370bee98aad882ab335dda1565db94fb@epcas1p4.samsung.com>
2021-06-04 5:03 ` [PATCH v12 1/3] " Changheun Lee
2021-06-04 7:24 ` Damien Le Moal
[not found] ` <CGME20210604075331epcas1p13bb57f9ddfc7b112dec1ba8cf40fdc74@epcas1p1.samsung.com>
2021-06-04 7:34 ` Changheun Lee
2021-06-04 8:01 ` Damien Le Moal
[not found] ` <CGME20210604094209epcas1p26368dd18011bb2761529432cf2656a9f@epcas1p2.samsung.com>
2021-06-04 9:23 ` Changheun Lee
2021-06-04 14:52 ` Bart Van Assche
2021-06-07 6:35 ` Christoph Hellwig
2021-06-07 16:46 ` Bart Van Assche
2021-06-08 5:22 ` Christoph Hellwig
2021-06-07 6:32 ` Christoph Hellwig
[not found] ` <CGME20210607110122epcas1p4557bcbc7abac791f2557cc0d317214fd@epcas1p4.samsung.com>
2021-06-07 10:42 ` Changheun Lee
[not found] ` <CGME20210604052200epcas1p10754a3187476a0fcbfcc89c103a6d436@epcas1p1.samsung.com>
2021-06-04 5:03 ` [PATCH v12 2/3] blk-sysfs: add max_bio_bytes Changheun Lee
[not found] ` <CGME20210604052201epcas1p41a27660b20d70b7fc4295c8f131d33ce@epcas1p4.samsung.com>
2021-06-04 5:03 ` [PATCH v12 3/3] ufs: set max_bio_bytes with queue max sectors Changheun Lee
2021-06-04 16:11 ` Bart Van Assche
[not found] ` <CGME20210607094031epcas1p1f4a9ee01eaa4652ba0e8eb6a4964c952@epcas1p1.samsung.com>
2021-06-07 9:21 ` Changheun Lee [this message]
2021-06-04 6:41 ` [PATCH v12 0/3] bio: control bio max size Can Guo
2021-06-04 16:13 ` Bart Van Assche
[not found] ` <CGME20210607101609epcas1p392324f6d215e329d632a615c4b1adf4c@epcas1p3.samsung.com>
2021-06-07 9:57 ` Changheun Lee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210607092156.16774-1-nanich.lee@samsung.com \
--to=nanich.lee@samsung.com \
--cc=Johannes.Thumshirn@wdc.com \
--cc=alex_y_xu@yahoo.ca \
--cc=alim.akhtar@samsung.com \
--cc=asml.silence@gmail.com \
--cc=avri.altman@wdc.com \
--cc=axboe@kernel.dk \
--cc=bgoncalv@redhat.com \
--cc=bvanassche@acm.org \
--cc=cang@codeaurora.org \
--cc=damien.lemoal@wdc.com \
--cc=gregkh@linuxfoundation.org \
--cc=hch@infradead.org \
--cc=jaegeuk@kernel.org \
--cc=jejb@linux.ibm.com \
--cc=jisoo2146.oh@samsung.com \
--cc=junho89.kim@samsung.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=ming.lei@redhat.com \
--cc=mj0123.lee@samsung.com \
--cc=osandov@fb.com \
--cc=patchwork-bot@kernel.org \
--cc=seunghwan.hyun@samsung.com \
--cc=sookwan7.kim@samsung.com \
--cc=tj@kernel.org \
--cc=tom.leiming@gmail.com \
--cc=woosung2.lee@samsung.com \
--cc=yi.zhang@redhat.com \
--cc=yt0928.kim@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®