BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Kernel Team <kernel-team@fb.com>,
	Yonghong Song <yonghong.song@linux.dev>,
	Puranjay Mohan <puranjay@kernel.org>,
	"Jose E. Marchesi" <jose.marchesi@oracle.com>
Subject: Re: [RFC bpf-next v2 0/9] no_caller_saved_registers attribute for helper calls
Date: Tue, 09 Jul 2024 20:35:12 -0700	[thread overview]
Message-ID: <c9639d8de4c000cf4d685416d81da81a653fcfb4.camel@gmail.com> (raw)
In-Reply-To: <CAADnVQLBd9V3NxxbEJM_RyZHm-jcwqqUkc1n-1Djry5RqF5eEQ@mail.gmail.com>

On Tue, 2024-07-09 at 18:18 -0700, Alexei Starovoitov wrote:
> On Thu, Jul 4, 2024 at 3:24 AM Eduard Zingerman <eddyz87@gmail.com> 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)  <---------

[...]


      reply	other threads:[~2024-07-10  3:35 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-04 10:23 [RFC bpf-next v2 0/9] no_caller_saved_registers attribute for helper calls Eduard Zingerman
2024-07-04 10:23 ` [RFC bpf-next v2 1/9] bpf: add a get_helper_proto() utility function Eduard Zingerman
2024-07-09 23:42   ` Andrii Nakryiko
2024-07-10  0:26     ` Eduard Zingerman
2024-07-04 10:23 ` [RFC bpf-next v2 2/9] bpf: no_caller_saved_registers attribute for helper calls Eduard Zingerman
2024-07-09 23:42   ` Andrii Nakryiko
2024-07-10  3:00     ` Eduard Zingerman
2024-07-10  6:01       ` Andrii Nakryiko
2024-07-10  7:57         ` Eduard Zingerman
2024-07-10 15:36           ` Andrii Nakryiko
2024-07-10 16:15             ` Eduard Zingerman
2024-07-10 17:50               ` Andrii Nakryiko
2024-07-10 18:40                 ` Eduard Zingerman
2024-07-10 18:49                   ` Andrii Nakryiko
2024-07-10 19:03                     ` Eduard Zingerman
2024-07-10 19:16                       ` Andrii Nakryiko
2024-07-10 19:07                   ` Alexei Starovoitov
2024-07-10 19:17                     ` Andrii Nakryiko
2024-07-10 19:01             ` Alexei Starovoitov
2024-07-10  9:46     ` Eduard Zingerman
2024-07-10 15:23       ` Andrii Nakryiko
2024-07-10  1:09   ` Alexei Starovoitov
2024-07-10  3:06     ` Eduard Zingerman
2024-07-04 10:23 ` [RFC bpf-next v2 3/9] bpf, x86, riscv, arm: no_caller_saved_registers for bpf_get_smp_processor_id() Eduard Zingerman
2024-07-04 10:23 ` [RFC bpf-next v2 4/9] selftests/bpf: extract utility function for BPF disassembly Eduard Zingerman
2024-07-09 23:46   ` Andrii Nakryiko
2024-07-04 10:23 ` [RFC bpf-next v2 5/9] selftests/bpf: no need to track next_match_pos in struct test_loader Eduard Zingerman
2024-07-04 10:23 ` [RFC bpf-next v2 6/9] selftests/bpf: extract test_loader->expect_msgs as a data structure Eduard Zingerman
2024-07-04 10:23 ` [RFC bpf-next v2 7/9] selftests/bpf: allow checking xlated programs in verifier_* tests Eduard Zingerman
2024-07-04 10:24 ` [RFC bpf-next v2 8/9] selftests/bpf: __arch_* macro to limit test cases to specific archs Eduard Zingerman
2024-07-09 23:50   ` Andrii Nakryiko
2024-07-04 10:24 ` [RFC bpf-next v2 9/9] selftests/bpf: test no_caller_saved_registers spill/fill removal Eduard Zingerman
2024-07-08 11:44 ` [RFC bpf-next v2 0/9] no_caller_saved_registers attribute for helper calls Puranjay Mohan
2024-07-08 17:29   ` Eduard Zingerman
2024-07-10  1:18 ` Alexei Starovoitov
2024-07-10  3:35   ` Eduard Zingerman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c9639d8de4c000cf4d685416d81da81a653fcfb4.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jose.marchesi@oracle.com \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@linux.dev \
    --cc=puranjay@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox