From: Damien Le Moal <dlemoal@kernel.org>
To: Christoph Hellwig <hch@infradead.org>,
Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: linux-nvme@lists.infradead.org, Keith Busch <kbusch@kernel.org>,
Johannes Thumshirn <johannes.thumshirn@wdc.com>
Subject: Re: [PATCH] nvme: zns: limit max_zone_append by max_segments
Date: Mon, 31 Jul 2023 23:02:35 +0900 [thread overview]
Message-ID: <2dea2a1c-b127-4661-c232-4dcf0b249878@kernel.org> (raw)
In-Reply-To: <ZMe7Gck9MSo8Fn+a@infradead.org>
On 7/31/23 22:46, Christoph Hellwig wrote:
> On Mon, Jul 31, 2023 at 08:46:32PM +0900, Shin'ichiro Kawasaki wrote:
>> To avoid the unexpected BIO split, reflect the max_segments limit to the
>> max_zone_append limit. In the worst case, the safe max_zone_append size
>> is max_segments multiplied by PAGE_SIZE. Compare it with the
>> max_zone_append size obtained from ZNS devices, and set the smaller
>> value as the max_zone_append limit.
>
> This is true only for NVMe and a hand full of drivers that
> set the virt_boundary. For others the maximum size is completely
> unrelated to the maximum number of segments.
>
> Can you reword the commit log a bit to make that more clear?
>
>> diff --git a/drivers/nvme/host/zns.c b/drivers/nvme/host/zns.c
>> index ec8557810c21..9ee77626c235 100644
>> --- a/drivers/nvme/host/zns.c
>> +++ b/drivers/nvme/host/zns.c
>> @@ -10,9 +10,11 @@
>> int nvme_revalidate_zones(struct nvme_ns *ns)
>> {
>> struct request_queue *q = ns->queue;
>> + unsigned int max_sectors = queue_max_segments(q) << PAGE_SECTORS_SHIFT;
>>
>> blk_queue_chunk_sectors(q, ns->zsze);
>> - blk_queue_max_zone_append_sectors(q, ns->ctrl->max_zone_append);
>> + max_sectors = min(max_sectors, ns->ctrl->max_zone_append);
>> + blk_queue_max_zone_append_sectors(q, max_sectors);
>
> And while this looks correct, it also feels pretty ugly. Shouldn't a
>
> blk_queue_max_zone_append_sectors(q,
> queue_max_sectors(q), ns->ctrl->max_zone_append);
blk_queue_max_zone_append_sectors() already does cap max zone append to
max_hw_sectors. We could also add the cap to queue_max_segments(q) <<
PAGE_SECTORS_SHIFT in that function as well given that all zoned devices should
have that anyway...
>
> do the same thing in a somewhat more obvious way given that max_segments
> is already taken into account for the queue_max_sectors calculation?
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2023-07-31 14:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-31 11:46 [PATCH] nvme: zns: limit max_zone_append by max_segments Shin'ichiro Kawasaki
2023-07-31 12:03 ` Damien Le Moal
2023-07-31 13:51 ` Christoph Hellwig
2023-07-31 14:01 ` Damien Le Moal
2023-07-31 14:06 ` Christoph Hellwig
2023-07-31 14:12 ` Damien Le Moal
2023-07-31 14:26 ` Christoph Hellwig
2023-07-31 14:33 ` Damien Le Moal
2023-07-31 13:46 ` Christoph Hellwig
2023-07-31 14:02 ` Damien Le Moal [this message]
2023-07-31 14:05 ` Christoph Hellwig
2023-07-31 14:07 ` Damien Le Moal
2023-07-31 14:08 ` Christoph Hellwig
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=2dea2a1c-b127-4661-c232-4dcf0b249878@kernel.org \
--to=dlemoal@kernel.org \
--cc=hch@infradead.org \
--cc=johannes.thumshirn@wdc.com \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=shinichiro.kawasaki@wdc.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