Re: [PATCH bpf] cpumap: Avoid warning when CONFIG_DEBUG_PER_CPU_MAPS is enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jesper Dangaard Brouer <brouer@xxxxxxxxxx> writes:

> On Wed, 15 Apr 2020 16:01:51 +0200
> Toke Høiland-Jørgensen <toke@xxxxxxxxxx> wrote:
>
>> When the kernel is built with CONFIG_DEBUG_PER_CPU_MAPS, the cpumap code
>> can trigger a spurious warning if CONFIG_CPUMASK_OFFSTACK is also set. This
>> happens because in this configuration, NR_CPUS can be larger than
>> nr_cpumask_bits, so the initial check in cpu_map_alloc() is not sufficient
>> to guard against hitting the warning in cpumask_check().
>> 
>> Fix this by using the nr_cpumask_bits variable in the map creation code
>> instead of the NR_CPUS constant.
>
> Shouldn't you use 'nr_cpu_ids' instead of 'nr_cpumask_bits' ?
>
> Else this will still fail on systems with CONFIG_CPUMASK_OFFSTACK=n.

Jesper and I had an offlist discussion about this, and decided that it's
actually better to keep the check in cpu_map_alloc as-is, and instead
just check against nr_cpumask_bits in cpu_map_update_elem(). Otherwise,
the max-size of the map can vary between machines which can affect BPF
program portability.

I'll send a v2.

-Toke





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux