On Wed, Sep 22, 2021 at 05:33:26AM IST, Andrii Nakryiko wrote: > > [...] > > Hmm, good idea, I'd just need to fill in the BTF id dynamically at runtime, > > but that should be possible. > > > > Though we still need to craft distinct calls (I am trying to test the limit > > where insn->off is different for each case). Since we try to reuse index in both > > gen_loader and libbpf, just generating same call 256 times would not be enough. > > You just need to generate one instruction with offset = 257 to test > this. And separately one call with fd_array that has module BTF fd at > fd_array[256] (to check that 256 is ok). Or am I missing something? > That won't be enough, if I just pass insn->imm = id, insn->off = 257, it becomes first descriptor in kfunc_tab and kfunc_btf_tab. The total limit is 256, and they are kept in sorted order by based on id and off for the first, off for the second. So 256 different offs are needed (imm may be same actually), so that both fill up. -- Kartikeya