Message ID | 94134844a6f4be2e0da2c518cb0e2e9ebb1d71b0.1621424513.git.asml.silence@gmail.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | BPF |
Headers | show |
Series | io_uring BPF requests | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
On Wed, May 19, 2021 at 7:14 AM Pavel Begunkov <asml.silence@gmail.com> wrote: > > Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> > --- > tools/lib/bpf/libbpf.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > index 4181d178ee7b..de5d1508f58e 100644 > --- a/tools/lib/bpf/libbpf.c > +++ b/tools/lib/bpf/libbpf.c > @@ -13,6 +13,10 @@ > #ifndef _GNU_SOURCE > #define _GNU_SOURCE > #endif > + > +/* hack, use local headers instead of system-wide */ > +#include "../../../include/uapi/linux/bpf.h" > + libbpf is already using the latest UAPI headers, so you don't need this hack. You just haven't synced include/uapi/linux/bpf.h into tools/include/uapi/linux/bpf.h > #include <stdlib.h> > #include <stdio.h> > #include <stdarg.h> > @@ -8630,6 +8634,9 @@ static const struct bpf_sec_def section_defs[] = { > BPF_PROG_SEC("struct_ops", BPF_PROG_TYPE_STRUCT_OPS), > BPF_EAPROG_SEC("sk_lookup/", BPF_PROG_TYPE_SK_LOOKUP, > BPF_SK_LOOKUP), > + SEC_DEF("iouring/", IOURING), > + SEC_DEF("iouring.s/", IOURING, > + .is_sleepable = true), > }; > > #undef BPF_PROG_SEC_IMPL > -- > 2.31.1 >
On 5/19/21 6:38 PM, Andrii Nakryiko wrote: > On Wed, May 19, 2021 at 7:14 AM Pavel Begunkov <asml.silence@gmail.com> wrote: >> >> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> >> --- >> tools/lib/bpf/libbpf.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c >> index 4181d178ee7b..de5d1508f58e 100644 >> --- a/tools/lib/bpf/libbpf.c >> +++ b/tools/lib/bpf/libbpf.c >> @@ -13,6 +13,10 @@ >> #ifndef _GNU_SOURCE >> #define _GNU_SOURCE >> #endif >> + >> +/* hack, use local headers instead of system-wide */ >> +#include "../../../include/uapi/linux/bpf.h" >> + > > libbpf is already using the latest UAPI headers, so you don't need > this hack. You just haven't synced include/uapi/linux/bpf.h into > tools/include/uapi/linux/bpf.h It's more convenient to keep it local to me while RFC, surely will drop it later. btw, I had a problem with find_sec_def() successfully matching "iouring.s" string with "iouring", because section_defs[i].len doesn't include final \0 and so does a sort of prefix comparison. That's why "iouring/". Can we fix it? Are compatibility concerns? > >> #include <stdlib.h> >> #include <stdio.h> >> #include <stdarg.h> >> @@ -8630,6 +8634,9 @@ static const struct bpf_sec_def section_defs[] = { >> BPF_PROG_SEC("struct_ops", BPF_PROG_TYPE_STRUCT_OPS), >> BPF_EAPROG_SEC("sk_lookup/", BPF_PROG_TYPE_SK_LOOKUP, >> BPF_SK_LOOKUP), >> + SEC_DEF("iouring/", IOURING), >> + SEC_DEF("iouring.s/", IOURING, >> + .is_sleepable = true), >> }; >> >> #undef BPF_PROG_SEC_IMPL >> -- >> 2.31.1 >>
On Thu, May 20, 2021 at 2:58 AM Pavel Begunkov <asml.silence@gmail.com> wrote: > > On 5/19/21 6:38 PM, Andrii Nakryiko wrote: > > On Wed, May 19, 2021 at 7:14 AM Pavel Begunkov <asml.silence@gmail.com> wrote: > >> > >> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> > >> --- > >> tools/lib/bpf/libbpf.c | 7 +++++++ > >> 1 file changed, 7 insertions(+) > >> > >> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > >> index 4181d178ee7b..de5d1508f58e 100644 > >> --- a/tools/lib/bpf/libbpf.c > >> +++ b/tools/lib/bpf/libbpf.c > >> @@ -13,6 +13,10 @@ > >> #ifndef _GNU_SOURCE > >> #define _GNU_SOURCE > >> #endif > >> + > >> +/* hack, use local headers instead of system-wide */ > >> +#include "../../../include/uapi/linux/bpf.h" > >> + > > > > libbpf is already using the latest UAPI headers, so you don't need > > this hack. You just haven't synced include/uapi/linux/bpf.h into > > tools/include/uapi/linux/bpf.h > > It's more convenient to keep it local to me while RFC, surely will > drop it later. > > btw, I had a problem with find_sec_def() successfully matching > "iouring.s" string with "iouring", because section_defs[i].len > doesn't include final \0 and so does a sort of prefix comparison. > That's why "iouring/". Can we fix it? Are compatibility concerns? If you put "iouring.s" before "iouring" it will be matched first, libbpf matches them in order, so more specific prefix should go first. It is currently always treated as a prefix, not exact match, unfortunately. I have a work planned to revamp this logic quite a bit for libbpf 1.0, so this should be improved as part of that work. > > > > >> #include <stdlib.h> > >> #include <stdio.h> > >> #include <stdarg.h> > >> @@ -8630,6 +8634,9 @@ static const struct bpf_sec_def section_defs[] = { > >> BPF_PROG_SEC("struct_ops", BPF_PROG_TYPE_STRUCT_OPS), > >> BPF_EAPROG_SEC("sk_lookup/", BPF_PROG_TYPE_SK_LOOKUP, > >> BPF_SK_LOOKUP), > >> + SEC_DEF("iouring/", IOURING), > >> + SEC_DEF("iouring.s/", IOURING, > >> + .is_sleepable = true), > >> }; > >> > >> #undef BPF_PROG_SEC_IMPL > >> -- > >> 2.31.1 > >> > > -- > Pavel Begunkov
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 4181d178ee7b..de5d1508f58e 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -13,6 +13,10 @@ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif + +/* hack, use local headers instead of system-wide */ +#include "../../../include/uapi/linux/bpf.h" + #include <stdlib.h> #include <stdio.h> #include <stdarg.h> @@ -8630,6 +8634,9 @@ static const struct bpf_sec_def section_defs[] = { BPF_PROG_SEC("struct_ops", BPF_PROG_TYPE_STRUCT_OPS), BPF_EAPROG_SEC("sk_lookup/", BPF_PROG_TYPE_SK_LOOKUP, BPF_SK_LOOKUP), + SEC_DEF("iouring/", IOURING), + SEC_DEF("iouring.s/", IOURING, + .is_sleepable = true), }; #undef BPF_PROG_SEC_IMPL
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> --- tools/lib/bpf/libbpf.c | 7 +++++++ 1 file changed, 7 insertions(+)