From: Damien Le Moal <dlemoal@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, dm-devel@lists.linux.dev,
Mike Snitzer <snitzer@kernel.org>,
Mikulas Patocka <mpatocka@redhat.com>,
Benjamin Marzinski <bmarzins@redhat.com>
Subject: Re: [PATCH v2 1/2] block: Imporve checks on zone resource limits
Date: Wed, 5 Jun 2024 13:52:01 +0900 [thread overview]
Message-ID: <71118710-51fd-491a-8dd6-5b43b61e297a@kernel.org> (raw)
In-Reply-To: <20240605041754.GA12183@lst.de>
On 6/5/24 13:17, Christoph Hellwig wrote:
> improve is misspelled in the subject.
>
>> @@ -80,6 +80,10 @@ static int blk_validate_zoned_limits(struct queue_limits *lim)
>> if (WARN_ON_ONCE(!IS_ENABLED(CONFIG_BLK_DEV_ZONED)))
>> return -EINVAL;
>>
>> + if (lim->max_active_zones &&
>> + WARN_ON_ONCE(lim->max_open_zones > lim->max_active_zones))
>> + lim->max_open_zones = lim->max_active_zones;
>
> Given how active zones are defined this is an error condition, and
> should return -EINVAL.
>
>> diff --git a/block/blk-zoned.c b/block/blk-zoned.c
>> index 52abebf56027..2af4d5ca81d2 100644
>> --- a/block/blk-zoned.c
>> +++ b/block/blk-zoned.c
>> @@ -1660,6 +1660,11 @@ static int disk_update_zone_resources(struct gendisk *disk,
>> lim = queue_limits_start_update(q);
>>
>> nr_seq_zones = disk->nr_zones - nr_conv_zones;
>> + if (WARN_ON_ONCE(lim.max_active_zones > nr_seq_zones))
>> + lim.max_active_zones = 0;
>> + if (WARN_ON_ONCE(lim.max_open_zones > nr_seq_zones))
>> + lim.max_open_zones = 0;
>
> Why would you warn about this? Offering an open/active limit larger
> than the number of sequential zones is a pretty natural condition
> for certain corner cases (e.g. create only a tiny namespace on a ZNS
> SSD). This could also use a code comment explaining why the limit
> is adjusted.
Right. I actually did not consider that case, which is indeed valid given that
for nvme, the limits are per controller, not namespace (which is a very
unfortunate design flaw...).
I will remove the warn and add a comment.
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2024-06-05 4:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-05 2:24 [PATCH v2 0/2] Fix DM zone resource limits stacking Damien Le Moal
2024-06-05 2:24 ` [PATCH v2 1/2] block: Imporve checks on zone resource limits Damien Le Moal
2024-06-05 4:17 ` Christoph Hellwig
2024-06-05 4:52 ` Damien Le Moal [this message]
2024-06-05 2:24 ` [PATCH v2 2/2] dm: Improve zone resource limits handling Damien Le Moal
2024-06-05 4:23 ` Christoph Hellwig
2024-06-05 4:55 ` Damien Le Moal
2024-06-05 2:26 ` [PATCH v2 0/2] Fix DM zone resource limits stacking Damien Le Moal
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=71118710-51fd-491a-8dd6-5b43b61e297a@kernel.org \
--to=dlemoal@kernel.org \
--cc=axboe@kernel.dk \
--cc=bmarzins@redhat.com \
--cc=dm-devel@lists.linux.dev \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=snitzer@kernel.org \
/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