From: Eduard Zingerman <eddyz87@gmail.com>
To: Song Liu <song@kernel.org>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Kernel Team <kernel-team@fb.com>,
joannelkoong@gmail.com
Subject: Re: [PATCH bpf-next v4 3/5] bpf: Inline calls to bpf_loop when callback is known
Date: Sat, 11 Jun 2022 02:21:02 +0300 [thread overview]
Message-ID: <c083c5cb2bc42eb455484cfd9ea803bd6a5e9d77.camel@gmail.com> (raw)
In-Reply-To: <CAPhsuW4MMAFEOWn0ehvOZtt3h0w_Z6HaD0UJ2PH47PLHcExKwQ@mail.gmail.com>
> On Fri, 2022-06-10 at 16:01 -0700, Song Liu wrote:
>
> In this case, we need to initialize fit_for_inline to true, no?
You are right...
My Last try is below, if you don't like it I'll proceed with your
version. I just really don't like the "not-cannot" part in the
expression "!inline_state->cannot_inline" :)
static void update_loop_inline_state(struct bpf_verifier_env *env, u32 subprogno)
{
struct bpf_loop_inline_state *state = &cur_aux(env)->loop_inline_state;
struct bpf_reg_state *regs = cur_regs(env);
struct bpf_reg_state *flags_reg = ®s[BPF_REG_4];
int flags_is_zero =
register_is_const(flags_reg) && flags_reg->var_off.value == 0;
if (!state->initialized) {
state->initialized = 1;
state->fit_for_inline = flags_is_zero;
state->callback_subprogno = subprogno;
return;
}
if (!state->fit_for_inline)
return;
state->fit_for_inline =
flags_is_zero &&
state->callback_subprogno == subprogno;
}
static int optimize_bpf_loop(struct bpf_verifier_env *env)
{
// ...
if (is_bpf_loop_call(insn) && inline_state->fit_for_inline) { ... }
// ...
}
Thanks,
Eduard
next prev parent reply other threads:[~2022-06-10 23:21 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-08 19:26 [PATCH bpf-next v4 0/5] bpf_loop inlining Eduard Zingerman
2022-06-08 19:26 ` [PATCH bpf-next v4 1/5] selftests/bpf: specify expected instructions in test_verifier tests Eduard Zingerman
2022-06-10 17:56 ` Song Liu
2022-06-08 19:26 ` [PATCH bpf-next v4 2/5] selftests/bpf: allow BTF specs and func infos " Eduard Zingerman
2022-06-10 18:09 ` Song Liu
2022-06-10 19:16 ` Eduard Zingerman
2022-06-10 20:56 ` Song Liu
2022-06-08 19:26 ` [PATCH bpf-next v4 3/5] bpf: Inline calls to bpf_loop when callback is known Eduard Zingerman
2022-06-09 14:56 ` kernel test robot
2022-06-10 20:54 ` Song Liu
2022-06-10 21:54 ` Eduard Zingerman
2022-06-10 22:40 ` Song Liu
2022-06-10 22:49 ` Eduard Zingerman
2022-06-10 23:01 ` Song Liu
2022-06-10 23:21 ` Eduard Zingerman [this message]
2022-06-11 1:46 ` Song Liu
2022-06-08 19:26 ` [PATCH bpf-next v4 4/5] selftests/bpf: BPF test_verifier selftests for bpf_loop inlining Eduard Zingerman
2022-06-10 18:14 ` Song Liu
2022-06-10 19:20 ` Eduard Zingerman
2022-06-10 20:57 ` Song Liu
2022-06-08 19:26 ` [PATCH bpf-next v4 5/5] selftests/bpf: BPF test_prog " Eduard Zingerman
2022-06-10 18:15 ` Song Liu
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=c083c5cb2bc42eb455484cfd9ea803bd6a5e9d77.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=joannelkoong@gmail.com \
--cc=kernel-team@fb.com \
--cc=song@kernel.org \
/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