Re: [PATCH] libbpf: fix BPF_MAP_TYPE_PERF_EVENT_ARRAY auto-pinning

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

 



On 24/02/2022 01:15, Andrii Nakryiko wrote:
> On Tue, Feb 22, 2022 at 6:37 PM Song Liu <song@xxxxxxxxxx> wrote:
>> On Tue, Feb 22, 2022 at 12:51 PM Stijn Tintel <stijn@xxxxxxxxxxxxx> wrote:
>>> When a BPF map of type BPF_MAP_TYPE_PERF_EVENT_ARRAY doesn't have the
>>> max_entries parameter set, this parameter will be set to the number of
>>> possible CPUs. Due to this, the map_is_reuse_compat function will return
>>> false, causing the following error when trying to reuse the map:
>>>
>>> libbpf: couldn't reuse pinned map at '/sys/fs/bpf/m_logging': parameter mismatch
>>>
>>> Fix this by checking against the number of possible CPUs if the
>>> max_entries parameter is not set in the map definition.
>>>
>>> Fixes: 57a00f41644f ("libbpf: Add auto-pinning of maps when loading BPF objects")
>>> Signed-off-by: Stijn Tintel <stijn@xxxxxxxxxxxxx>
>> Acked-by: Song Liu <songliubraving@xxxxxx>
>>
>> I think the following fix would be more future proof, but the patch
>> as-is is better for
>> stable backport? How about we add a follow up patch on top of current
>> patch to fix
>> def->max_entries once for all?
> Keeping special logic for PERF_EVENT_ARRAY in one place is
> preferrable. With this, the changes in map_is_reuse_compat() shouldn't
> be necessary at all. Stijn, can you please send v2 with Song's
> proposed changes?
>
Will do!

Thanks,
Stijn




[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