From: "Christoph Böhmwalder" <christoph.boehmwalder@linbit.com>
To: Ionut Nechita <ionut.nechita@windriver.com>,
Jens Axboe <axboe@kernel.dk>
Cc: Philipp Reisner <philipp.reisner@linbit.com>,
Lars Ellenberg <lars.ellenberg@linbit.com>,
Joel Colledge <joel.colledge@linbit.com>,
drbd-dev@lists.linux.dev, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] drbd: increase maximum CPU mask size
Date: Mon, 10 Aug 2026 16:52:39 +0200 [thread overview]
Message-ID: <bcca87bc-ec44-4d6b-bcbf-93343e582123@linbit.com> (raw)
In-Reply-To: <20260802110552.50757-3-ionut.nechita@windriver.com>
Am 02.08.26 um 13:05 schrieb Ionut Nechita:
> The cpu-mask resource option is limited to DRBD_CPU_MASK_SIZE - 1, i.e.
> 31 characters. bitmap_parse() reads the string as comma separated chunks
> of up to eight hex digits, each describing 32 bits, so 31 characters
> describe at most 112 CPUs. A full mask cannot be expressed on anything
> larger, which by now includes most two-socket machines.
>
> Sparse masks can still reach higher CPU numbers by padding with zero
> chunks - "8,0,0,0" selects CPU 99 - but that only helps when few bits
> are set.
>
> Userspace has already moved on. drbd-utils carries its own copy of these
> headers, where DRBD_CPU_MASK_SIZE has been 256 since 2023 ("drbd:
> increase maximum CPU mask size" by Joel Colledge, in LINBIT's
> drbd-headers repository). A drbdsetup built against those headers is
> rejected with -ERANGE by validate_nla() as soon as the mask does not fit
> in the 31 characters this driver accepts.
>
> Raise the limit to match userspace. 255 characters allow a full mask for
> 908 CPUs: a leading chunk of three hex digits followed by 28 chunks of
> eight.
>
> The cpu_mask member of struct res_opts grows accordingly. Two instances
> live on the stack, in drbd_adm_resource_opts() and in
> drbd_adm_new_resource(), which is uncritical at this size.
>
> This only relaxes an upper bound, so an old drbdsetup keeps working
> against a kernel with this change, and a new drbdsetup keeps working
> against a kernel without it as long as the mask string still fits in the
> old limit.
>
> The new size will likely be too small again eventually. Describing the
> mask with bitmap_parselist() would avoid that, but the list and hex
> formats are ambiguous for the same input - "8" means CPU 3 in one and
> CPU 8 in the other - so it would have to be a separate attribute rather
> than a reinterpretation of this one.
>
> Signed-off-by: Ionut Nechita <ionut.nechita@windriver.com>
Thanks, this also looks correct.
Just one nit: in the commit message, you reference
drbd_adm_resource_opts and drbd_adm_new_resource; these have been
renamed to drbd_nl_resource_opts_doit and drbd_nl_new_resource_doit,
respectively, in the recent netlink refactoring commit.
But for the code itself:
Reviewed-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
--
Christoph Böhmwalder
LINBIT | Keeping the Digital World Running
DRBD HA — Disaster Recovery — Software defined Storage
prev parent reply other threads:[~2026-08-10 14:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-02 11:05 [PATCH 0/2] drbd: fix netlink string policy lengths, raise cpu-mask limit Ionut Nechita
2026-08-02 11:05 ` [PATCH 1/2] drbd: fix off-by-one in netlink NUL-string policy lengths Ionut Nechita
2026-08-10 14:46 ` Christoph Böhmwalder
2026-08-02 11:05 ` [PATCH 2/2] drbd: increase maximum CPU mask size Ionut Nechita
2026-08-10 14:52 ` Christoph Böhmwalder [this message]
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=bcca87bc-ec44-4d6b-bcbf-93343e582123@linbit.com \
--to=christoph.boehmwalder@linbit.com \
--cc=axboe@kernel.dk \
--cc=drbd-dev@lists.linux.dev \
--cc=ionut.nechita@windriver.com \
--cc=joel.colledge@linbit.com \
--cc=lars.ellenberg@linbit.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=philipp.reisner@linbit.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