Message ID | 20250305211235.368399-1-emil@etsalapatis.com (mailing list archive) |
---|---|
Headers | show |
Series | bpf: introduce helper for populating bpf_cpumask | expand |
Hello: This series was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <ast@kernel.org>: On Wed, 5 Mar 2025 16:12:32 -0500 you wrote: > Some BPF programs like scx schedulers have their own internal CPU mask types, > mask types, which they must transform into struct bpf_cpumask instances > before passing them to scheduling-related kfuncs. There is currently no > way to efficiently populate the bitfield of a bpf_cpumask from BPF memory, > and programs must use multiple bpf_cpumask_[set, clear] calls to do so. > Introduce a kfunc helper to populate the bitfield of a bpf_cpumask from valid > BPF memory with a single call. > > [...] Here is the summary with links: - [v4,1/3] bpf: add kfunc for populating cpumask bits https://git.kernel.org/bpf/bpf-next/c/a6db20f88a63 - [v4,2/3] selftests: bpf: add bpf_cpumask_fill selftests https://git.kernel.org/bpf/bpf-next/c/66be130f8bf9 - [v4,3/3] bpf: fix missing kdoc string fields in cpumask.c https://git.kernel.org/bpf/bpf-next/c/f3839e9749b1 You are awesome, thank you!
Some BPF programs like scx schedulers have their own internal CPU mask types, mask types, which they must transform into struct bpf_cpumask instances before passing them to scheduling-related kfuncs. There is currently no way to efficiently populate the bitfield of a bpf_cpumask from BPF memory, and programs must use multiple bpf_cpumask_[set, clear] calls to do so. Introduce a kfunc helper to populate the bitfield of a bpf_cpumask from valid BPF memory with a single call. Changelog : ----------- v3->v4 v3: https://lore.kernel.org/bpf/20250305161327.203396-1-emil@etsalapatis.com/ * Removed new tests from tools/selftests/bpf/prog_tests/cpumask.c because they were being run twice. Addressed feedback by Alexei Starovoitov: * Added missing return value in function kdoc * Added an additional patch fixing some missing kdoc fields in kernel/bpf/cpumask.c Addressed feedback by Tejun Heo: * Renamed the kfunc to bpf_cpumask_populate to avoid confusion w/ bitmap_fill() v2->v3 v2: https://lore.kernel.org/bpf/20250305021020.1004858-1-emil@etsalapatis.com/ Addressed feedback by Alexei Starovoitov: * Added back patch descriptions dropped from v1->v2 * Elide the alignment check for archs with efficient unaligned accesses v1->v2 v1: https://lore.kernel.org/bpf/20250228003321.1409285-1-emil@etsalapatis.com/ Addressed feedback by Hou Tao: * Add check that the input buffer is aligned to sizeof(long) * Adjust input buffer size check to use bitmap_size() * Add selftest for checking the bit pattern of the bpf_cpumask * Moved all selftests into existing files Signed-off-by: Emil Tsalapatis (Meta) <emil@etsalapatis.com> Emil Tsalapatis (3): bpf: add kfunc for populating cpumask bits selftests: bpf: add bpf_cpumask_fill selftests bpf: fix missing kdoc string fields in cpumask.c kernel/bpf/cpumask.c | 53 ++++++++ .../selftests/bpf/progs/cpumask_failure.c | 38 ++++++ .../selftests/bpf/progs/cpumask_success.c | 114 ++++++++++++++++++ 3 files changed, 205 insertions(+)