Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Avi Weiss <thnkslprpt@gmail.com>
To: bpf@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	eddyz87@gmail.com, memxor@gmail.com, shuah@kernel.org,
	emil@etsalapatis.com, houtao1@huawei.com,
	linux-kselftest@vger.kernel.org, Avi Weiss <thnkslprpt@gmail.com>
Subject: [PATCH bpf 0/2] bpf: Clear invalid cpumask bits after population
Date: Sun, 15 Nov 2026 08:45:10 +0200	[thread overview]
Message-ID: <cover.1794724099.git.thnkslprpt@gmail.com> (raw)

bpf_cpumask_populate() copies the final bitmap word without clearing
bits beyond nr_cpu_ids. On configurations where cpumask operations
scan a whole word, those bits can inflate the reported mask weight.

Patch 1 clears the unused tail bits. Patch 2 checks the resulting
weight in the existing populate selftest.

Tested on 97d73c825122 (x86_64, CONFIG_NR_CPUS=64, 4 possible CPUs):
- Unpatched: cpumask/test_populate FAIL (err=5).
- Patched: cpumask/test_populate PASS.
- Patched: cpumask selftests 36/36 subtests PASS.

Not run: allmodconfig, allyesconfig, the full BPF selftest suite,
cross-architecture builds or a dedicated performance benchmark.
The changes have not been rebuilt on top of the target BPF fixes tip.

Avi Weiss (2):
  bpf: Clear invalid tail bits when populating a cpumask
  selftests/bpf: Check cpumask weight after population

 kernel/bpf/cpumask.c                                | 2 +-
 tools/testing/selftests/bpf/progs/cpumask_success.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)


base-commit: 4b4eb7f44ee05754339d07e9df649809f45d14c5
-- 
2.43.0


             reply	other threads:[~2026-11-15  6:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-15  6:45 Avi Weiss [this message]
2026-11-15  6:45 ` [PATCH bpf 1/2] bpf: Clear invalid tail bits when populating a cpumask Avi Weiss
2026-11-15  6:45 ` [PATCH bpf 2/2] selftests/bpf: Check cpumask weight after population Avi Weiss

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=cover.1794724099.git.thnkslprpt@gmail.com \
    --to=thnkslprpt@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=houtao1@huawei.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=memxor@gmail.com \
    --cc=shuah@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