On Wed, Nov 22, 2023 at 10:40 AM Martin KaFai Lau <martin.lau@xxxxxxxxx> wrote: > > On 11/22/23 10:05 AM, Stanislav Fomichev wrote: > >>>> Commit ef01f4e25c17 ("bpf: restore the ebpf program ID for BPF_AUDIT_UNLOAD > >>>> and PERF_BPF_EVENT_PROG_UNLOAD") stopped removing program's id from > >>>> idr when the offloaded/bound netdev goes away. I was supposed to > >>>> take a look and check in [0], but apparently I did not. > >>>> > >>>> The purpose of idr removal is to avoid BPF_PROG_GET_NEXT_ID returning > >>>> stale ids for the programs that have a dead netdev. This functionality > >>> > >>> What may be wrong if BPF_PROG_GET_NEXT_ID returns the id? > >>> e.g. If the prog is pinned somewhere, it may be useful to know a prog is still loaded in the system. > > > > bpftool is a bit spooked by those prog ids currently: calling GET_INFO_BY_ID > > on those programs returns ENODEV. So we can keep those ids around, but > > need some tweaks on the bpftool in this case. LMK if any of you prefer > > this option. > > I think it is in general useful to improve 'bpftool prog show' to keep going for > the next prog id if possible. May be print an error message after the prog id > and then keep going for the next prog id? Replied with a v2 where I mark those progs as 'orphaned'!