From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: "Björn Töpel" <bjorn.topel@gmail.com>
Cc: netdev@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
"Björn Töpel" <bjorn.topel@intel.com>,
bpf@vger.kernel.org, magnus.karlsson@gmail.com,
magnus.karlsson@intel.com, jonathan.lemon@gmail.com,
ecree@solarflare.com, thoiland@redhat.com, brouer@redhat.com,
andrii.nakryiko@gmail.com
Subject: Re: [PATCH bpf-next v4 2/6] bpf: introduce BPF dispatcher
Date: Thu, 12 Dec 2019 21:30:55 -0800 [thread overview]
Message-ID: <20191213053054.l3o6xlziqzwqxq22@ast-mbp> (raw)
In-Reply-To: <20191211123017.13212-3-bjorn.topel@gmail.com>
On Wed, Dec 11, 2019 at 01:30:13PM +0100, Björn Töpel wrote:
> +
> +#define DEFINE_BPF_DISPATCHER(name) \
> + unsigned int name##func( \
> + const void *xdp_ctx, \
> + const struct bpf_insn *insnsi, \
> + unsigned int (*bpf_func)(const void *, \
> + const struct bpf_insn *)) \
> + { \
> + return bpf_func(xdp_ctx, insnsi); \
> + } \
> + EXPORT_SYMBOL(name##func); \
> + struct bpf_dispatcher name = BPF_DISPATCHER_INIT(name);
The dispatcher function is a normal function. EXPORT_SYMBOL doesn't make it
'noinline'. struct bpf_dispatcher takes a pointer to it and that address is
used for text_poke.
In patch 3 __BPF_PROG_RUN calls dfunc() from two places.
What stops compiler from inlining it? Or partially inlining it in one
or the other place?
I guess it works, because your compiler didn't inline it?
Could you share how asm looks for bpf_prog_run_xdp()
(where __BPF_PROG_RUN is called) and asm for name##func() ?
I hope my guess that compiler didn't inline it is correct. Then extra noinline
will not hurt and that's the only thing needed to avoid the issue.
next prev parent reply other threads:[~2019-12-13 5:31 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-11 12:30 [PATCH bpf-next v4 0/6] Introduce the BPF dispatcher Björn Töpel
2019-12-11 12:30 ` [PATCH bpf-next v4 1/6] bpf: move trampoline JIT image allocation to a function Björn Töpel
2019-12-11 12:30 ` [PATCH bpf-next v4 2/6] bpf: introduce BPF dispatcher Björn Töpel
2019-12-11 13:26 ` Toke Høiland-Jørgensen
2019-12-13 8:23 ` Björn Töpel
2019-12-13 5:30 ` Alexei Starovoitov [this message]
2019-12-13 7:51 ` Björn Töpel
2019-12-13 15:04 ` Alexei Starovoitov
2019-12-13 15:49 ` Björn Töpel
2019-12-13 15:51 ` Alexei Starovoitov
2019-12-13 15:59 ` Björn Töpel
2019-12-13 16:03 ` Alexei Starovoitov
2019-12-13 16:09 ` Björn Töpel
2019-12-13 17:18 ` Alexei Starovoitov
2022-08-15 14:13 ` Steven Rostedt
2022-08-15 14:31 ` Alexei Starovoitov
2022-08-15 14:56 ` Peter Zijlstra
2022-08-15 15:16 ` Steven Rostedt
2022-08-15 15:19 ` Alexei Starovoitov
2022-08-15 15:21 ` Steven Rostedt
2022-08-15 15:39 ` Steven Rostedt
2019-12-11 12:30 ` [PATCH bpf-next v4 3/6] bpf, xdp: start using the BPF dispatcher for XDP Björn Töpel
2019-12-11 12:30 ` [PATCH bpf-next v4 4/6] bpf: start using the BPF dispatcher in BPF_TEST_RUN Björn Töpel
2019-12-11 12:30 ` [PATCH bpf-next v4 5/6] selftests: bpf: add xdp_perf test Björn Töpel
2019-12-11 12:30 ` [PATCH bpf-next v4 6/6] bpf, x86: align dispatcher branch targets to 16B Björn Töpel
2019-12-11 12:33 ` [PATCH bpf-next v4 0/6] Introduce the BPF dispatcher Björn Töpel
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=20191213053054.l3o6xlziqzwqxq22@ast-mbp \
--to=alexei.starovoitov@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=ast@kernel.org \
--cc=bjorn.topel@gmail.com \
--cc=bjorn.topel@intel.com \
--cc=bpf@vger.kernel.org \
--cc=brouer@redhat.com \
--cc=daniel@iogearbox.net \
--cc=ecree@solarflare.com \
--cc=jonathan.lemon@gmail.com \
--cc=magnus.karlsson@gmail.com \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
--cc=thoiland@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).