All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: Bart Van Assche <bvanassche@acm.org>
Cc: Pankaj Raghav <p.raghav@samsung.com>,
	Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-scsi@vger.kernel.org,
	Jaegeuk Kim <jaegeuk@kernel.org>,
	Avri Altman <avri.altman@wdc.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Christoph Hellwig <hch@lst.de>, Ming Lei <ming.lei@redhat.com>,
	Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCH v4 2/7] block: Support configuring limits below the page size
Date: Mon, 6 Feb 2023 16:19:34 -0800	[thread overview]
Message-ID: <Y+GZFoHiUOQeq25d@bombadil.infradead.org> (raw)
In-Reply-To: <24b34999-8f7c-7821-0b15-fdfc3f508b13@acm.org>

On Mon, Feb 06, 2023 at 04:02:46PM -0800, Bart Van Assche wrote:
> On 2/1/23 15:50, Luis Chamberlain wrote:
> > On Mon, Jan 30, 2023 at 01:26:51PM -0800, Bart Van Assche wrote:
> > > @@ -122,12 +177,17 @@ EXPORT_SYMBOL(blk_queue_bounce_limit);
> > >   void blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_hw_sectors)
> > >   {
> > >   	struct queue_limits *limits = &q->limits;
> > > +	unsigned int min_max_hw_sectors = PAGE_SIZE >> SECTOR_SHIFT;
> > >   	unsigned int max_sectors;
> > > -	if ((max_hw_sectors << 9) < PAGE_SIZE) {
> > > -		max_hw_sectors = 1 << (PAGE_SHIFT - 9);
> > > -		printk(KERN_INFO "%s: set to minimum %d\n",
> > > -		       __func__, max_hw_sectors);
> > > +	if (max_hw_sectors < min_max_hw_sectors) {
> > > +		blk_enable_sub_page_limits(limits);
> > > +		min_max_hw_sectors = 1;
> > > +	}
> > 
> > Up to this part this a non-functional update, and so why not a
> > separate patch to clarify that.
> 
> Will do.
> 
> > > +
> > > +	if (max_hw_sectors < min_max_hw_sectors) {
> > > +		max_hw_sectors = min_max_hw_sectors;
> > > +		pr_info("%s: set to minimum %u\n", __func__, max_hw_sectors);
> > 
> > But if I understand correctly here we're now changing
> > max_hw_sectors from 1 to whatever the driver set on
> > blk_queue_max_hw_sectors() if its smaller than PAGE_SIZE.
> > 
> > To determine if this is a functional change it begs the
> > question as to how many block drivers have a max hw sector
> > smaller than the equivalent PAGE_SIZE and wonder if that
> > could regress.
> 
> If a block driver passes an argument to blk_queue_max_hw_sectors() or
> blk_queue_max_segment_size() that is smaller than what is supported by the
> block layer, data corruption will be triggered if the block driver or the
> hardware supported by the block driver does not support the larger values
> chosen by the block layer. Changing limits that will trigger data corruption
> into limits that may work seems like an improvement to me?

Wow, clearly! Without a doubt!

But I'm trying to do a careful review here.

The commit log did not describe what *does* happen in these situations today,
and you seem to now be suggesting in the worst case corruption can happen.
That changes the patch context quite a bit!

My question above still stands though, how many block drivers have a max
hw sector smaller than the equivalent PAGE_SIZE. If you make your
change, even if it fixes some new use case where corruption is seen, can
it regress some old use cases for some old controllers?

  Luis

  reply	other threads:[~2023-02-07  0:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30 21:26 [PATCH v4 0/7] Add support for limits below the page size Bart Van Assche
2023-01-30 21:26 ` [PATCH v4 1/7] block: Introduce blk_mq_debugfs_init() Bart Van Assche
2023-02-01 20:58   ` Luis Chamberlain
2023-02-01 21:23     ` Luis Chamberlain
2023-02-01 22:01       ` Bart Van Assche
2023-02-01 23:59         ` Luis Chamberlain
2023-02-02  1:06           ` Bart Van Assche
2023-02-06 16:03             ` Luis Chamberlain
2023-02-06 21:11               ` Bart Van Assche
2023-01-30 21:26 ` [PATCH v4 2/7] block: Support configuring limits below the page size Bart Van Assche
2023-02-01 23:50   ` Luis Chamberlain
2023-02-07  0:02     ` Bart Van Assche
2023-02-07  0:19       ` Luis Chamberlain [this message]
2023-02-07  0:31         ` Bart Van Assche
2023-02-07  2:08           ` Luis Chamberlain
2023-02-07 18:26             ` Bart Van Assche
2023-01-30 21:26 ` [PATCH v4 3/7] block: Support submitting passthrough requests with small segments Bart Van Assche
2023-01-30 21:26 ` [PATCH v4 4/7] block: Add support for filesystem requests and " Bart Van Assche
2023-01-30 21:26 ` [PATCH v4 5/7] block: Add support for small segments in blk_rq_map_user_iov() Bart Van Assche
2023-01-30 21:26 ` [PATCH v4 6/7] scsi_debug: Support configuring the maximum segment size Bart Van Assche
2023-01-30 21:26 ` [PATCH v4 7/7] null_blk: " Bart Van Assche

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=Y+GZFoHiUOQeq25d@bombadil.infradead.org \
    --to=mcgrof@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=avri.altman@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=hch@lst.de \
    --cc=jaegeuk@kernel.org \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=p.raghav@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.