On Tue, 2024-07-09 at 18:18 -0700, Alexei Starovoitov wrote: > On Thu, Jul 4, 2024 at 3:24 AM Eduard Zingerman <eddyz87@xxxxxxxxx> wrote: > > > > - stack offsets used for spills/fills are allocated as minimal > > stack offsets in whole function and are not used for any other > > purposes; > > "minimal stack offset" reads odd to me. > I noticed the same naming convention is used in llvm diff. > imo it's odd there as well. > Maybe say: > llvm grows the stack that in bpf architecture always grows down and > picks the lowest stack offset not used by local variables > and spill/fill. Will replace "minimal" with lowest here and in LLVM diff. > > Here is how the program looks after verifier processing: > > > > # bpftool prog load ./nocsr.bpf.o /sys/fs/bpf/nocsr-test > > # bpftool prog dump xlated pinned /sys/fs/bpf/nocsr-test > > int test(void * ctx): > > ; int test(void *ctx) > > 0: (bf) r3 = r1 <--------- 3rd printk parameter > > ; __u32 task = bpf_get_smp_processor_id(); > > 1: (b4) w0 = 197132 <--------- inlined helper call, > > 2: (bf) r0 = r0 <--------- spill/fill pair removed > > Are you using old bpftool or something? > That should have been: > r0 = &(void __percpu *)(r0) > ? Yes, I was using distro-provided bpftool. Re-running with kernel version of the tool shows the __percpu thing. > > > 3: (61) r0 = *(u32 *)(r0 +0) <--------- [...]