bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 1/2] bpf: Use --no-fail option if CONFIG_BPF is not enabled
@ 2020-09-18 12:26 Jiri Olsa
  2020-09-18 12:26 ` [PATCH bpf-next 2/2] tools resolve_btfids: Always force HOSTARCH Jiri Olsa
  2020-09-21 21:55 ` [PATCH bpf-next 1/2] bpf: Use --no-fail option if CONFIG_BPF is not enabled Andrii Nakryiko
  0 siblings, 2 replies; 5+ messages in thread
From: Jiri Olsa @ 2020-09-18 12:26 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: netdev, bpf, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Seth Forshee

Currently all the resolve_btfids 'users' are under CONFIG_BPF
code, so if we have CONFIG_BPF disabled, resolve_btfids will
fail, because there's no data to resolve.

In case CONFIG_BPF is disabled, using resolve_btfids --no-fail
option, that makes resolve_btfids leave quietly if there's no
data to resolve.

Fixes: c9a0f3b85e09 ("bpf: Resolve BTF IDs in vmlinux image")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 scripts/link-vmlinux.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index e6e2d9e5ff48..3173b8cf08cb 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -342,8 +342,13 @@ vmlinux_link vmlinux "${kallsymso}" ${btf_vmlinux_bin_o}
 
 # fill in BTF IDs
 if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then
-info BTFIDS vmlinux
-${RESOLVE_BTFIDS} vmlinux
+	info BTFIDS vmlinux
+	# Let's be more permissive if CONFIG_BPF is disabled
+	# and do not fail if there's no data to resolve.
+	if [ -z "${CONFIG_BPF}" ]; then
+	  no_fail=--no-fail
+	fi
+	${RESOLVE_BTFIDS} $no_fail vmlinux
 fi
 
 if [ -n "${CONFIG_BUILDTIME_TABLE_SORT}" ]; then
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH bpf-next 2/2] tools resolve_btfids: Always force HOSTARCH
  2020-09-18 12:26 [PATCH bpf-next 1/2] bpf: Use --no-fail option if CONFIG_BPF is not enabled Jiri Olsa
@ 2020-09-18 12:26 ` Jiri Olsa
  2020-09-21 21:55 ` [PATCH bpf-next 1/2] bpf: Use --no-fail option if CONFIG_BPF is not enabled Andrii Nakryiko
  1 sibling, 0 replies; 5+ messages in thread
From: Jiri Olsa @ 2020-09-18 12:26 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: Seth Forshee, netdev, bpf, Martin KaFai Lau, Song Liu,
	Yonghong Song, John Fastabend, KP Singh

Seth reported problem with cross builds, that fail
on resolve_btfids build, because we are trying to
build it on cross build arch.

Fixing this by always forcing the host arch.

Fixes: fbbb68de80a4 ("bpf: Add resolve_btfids tool to resolve BTF IDs in ELF object")
Reported-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/bpf/resolve_btfids/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile
index a88cd4426398..d3c818b8d8d3 100644
--- a/tools/bpf/resolve_btfids/Makefile
+++ b/tools/bpf/resolve_btfids/Makefile
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 include ../../scripts/Makefile.include
+include ../../scripts/Makefile.arch
 
 ifeq ($(srctree),)
 srctree := $(patsubst %/,%,$(dir $(CURDIR)))
@@ -29,6 +30,7 @@ endif
 AR       = $(HOSTAR)
 CC       = $(HOSTCC)
 LD       = $(HOSTLD)
+ARCH     = $(HOSTARCH)
 
 OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf-next 1/2] bpf: Use --no-fail option if CONFIG_BPF is not enabled
  2020-09-18 12:26 [PATCH bpf-next 1/2] bpf: Use --no-fail option if CONFIG_BPF is not enabled Jiri Olsa
  2020-09-18 12:26 ` [PATCH bpf-next 2/2] tools resolve_btfids: Always force HOSTARCH Jiri Olsa
@ 2020-09-21 21:55 ` Andrii Nakryiko
  2020-09-22 18:47   ` Jiri Olsa
  1 sibling, 1 reply; 5+ messages in thread
From: Andrii Nakryiko @ 2020-09-21 21:55 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Networking,
	bpf, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Seth Forshee

On Fri, Sep 18, 2020 at 5:30 AM Jiri Olsa <jolsa@kernel.org> wrote:
>
> Currently all the resolve_btfids 'users' are under CONFIG_BPF
> code, so if we have CONFIG_BPF disabled, resolve_btfids will
> fail, because there's no data to resolve.
>
> In case CONFIG_BPF is disabled, using resolve_btfids --no-fail
> option, that makes resolve_btfids leave quietly if there's no
> data to resolve.
>
> Fixes: c9a0f3b85e09 ("bpf: Resolve BTF IDs in vmlinux image")
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---

If no CONFIG_BTF is specified, there is no need to even run
resolve_btfids. So why not do just that -- run resolve_btfids only
if both CONFIG_BPF and CONFIG_DEBUG_INFO_BTF are specified?


>  scripts/link-vmlinux.sh | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index e6e2d9e5ff48..3173b8cf08cb 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -342,8 +342,13 @@ vmlinux_link vmlinux "${kallsymso}" ${btf_vmlinux_bin_o}
>
>  # fill in BTF IDs
>  if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then
> -info BTFIDS vmlinux
> -${RESOLVE_BTFIDS} vmlinux
> +       info BTFIDS vmlinux
> +       # Let's be more permissive if CONFIG_BPF is disabled
> +       # and do not fail if there's no data to resolve.
> +       if [ -z "${CONFIG_BPF}" ]; then
> +         no_fail=--no-fail
> +       fi
> +       ${RESOLVE_BTFIDS} $no_fail vmlinux
>  fi
>
>  if [ -n "${CONFIG_BUILDTIME_TABLE_SORT}" ]; then
> --
> 2.26.2
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf-next 1/2] bpf: Use --no-fail option if CONFIG_BPF is not enabled
  2020-09-21 21:55 ` [PATCH bpf-next 1/2] bpf: Use --no-fail option if CONFIG_BPF is not enabled Andrii Nakryiko
@ 2020-09-22 18:47   ` Jiri Olsa
  2020-09-22 20:27     ` Andrii Nakryiko
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Olsa @ 2020-09-22 18:47 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: Jiri Olsa, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Networking, bpf, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Seth Forshee

On Mon, Sep 21, 2020 at 02:55:27PM -0700, Andrii Nakryiko wrote:
> On Fri, Sep 18, 2020 at 5:30 AM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > Currently all the resolve_btfids 'users' are under CONFIG_BPF
> > code, so if we have CONFIG_BPF disabled, resolve_btfids will
> > fail, because there's no data to resolve.
> >
> > In case CONFIG_BPF is disabled, using resolve_btfids --no-fail
> > option, that makes resolve_btfids leave quietly if there's no
> > data to resolve.
> >
> > Fixes: c9a0f3b85e09 ("bpf: Resolve BTF IDs in vmlinux image")
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> 
> If no CONFIG_BTF is specified, there is no need to even run
> resolve_btfids. So why not do just that -- run resolve_btfids only
> if both CONFIG_BPF and CONFIG_DEBUG_INFO_BTF are specified?

we can have CONFIG_DEBUG_INFO_BTF without CONFIG_BPF being enabled,
so we could in theory have in future some BTF ID user outside bpf code,
but I guess we can enable that, when it actually happens

jirka

> 
> 
> >  scripts/link-vmlinux.sh | 9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> > index e6e2d9e5ff48..3173b8cf08cb 100755
> > --- a/scripts/link-vmlinux.sh
> > +++ b/scripts/link-vmlinux.sh
> > @@ -342,8 +342,13 @@ vmlinux_link vmlinux "${kallsymso}" ${btf_vmlinux_bin_o}
> >
> >  # fill in BTF IDs
> >  if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then
> > -info BTFIDS vmlinux
> > -${RESOLVE_BTFIDS} vmlinux
> > +       info BTFIDS vmlinux
> > +       # Let's be more permissive if CONFIG_BPF is disabled
> > +       # and do not fail if there's no data to resolve.
> > +       if [ -z "${CONFIG_BPF}" ]; then
> > +         no_fail=--no-fail
> > +       fi
> > +       ${RESOLVE_BTFIDS} $no_fail vmlinux
> >  fi
> >
> >  if [ -n "${CONFIG_BUILDTIME_TABLE_SORT}" ]; then
> > --
> > 2.26.2
> >
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf-next 1/2] bpf: Use --no-fail option if CONFIG_BPF is not enabled
  2020-09-22 18:47   ` Jiri Olsa
@ 2020-09-22 20:27     ` Andrii Nakryiko
  0 siblings, 0 replies; 5+ messages in thread
From: Andrii Nakryiko @ 2020-09-22 20:27 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Jiri Olsa, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Networking, bpf, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Seth Forshee

On Tue, Sep 22, 2020 at 11:48 AM Jiri Olsa <jolsa@redhat.com> wrote:
>
> On Mon, Sep 21, 2020 at 02:55:27PM -0700, Andrii Nakryiko wrote:
> > On Fri, Sep 18, 2020 at 5:30 AM Jiri Olsa <jolsa@kernel.org> wrote:
> > >
> > > Currently all the resolve_btfids 'users' are under CONFIG_BPF
> > > code, so if we have CONFIG_BPF disabled, resolve_btfids will
> > > fail, because there's no data to resolve.
> > >
> > > In case CONFIG_BPF is disabled, using resolve_btfids --no-fail
> > > option, that makes resolve_btfids leave quietly if there's no
> > > data to resolve.
> > >
> > > Fixes: c9a0f3b85e09 ("bpf: Resolve BTF IDs in vmlinux image")
> > > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > > ---
> >
> > If no CONFIG_BTF is specified, there is no need to even run
> > resolve_btfids. So why not do just that -- run resolve_btfids only
> > if both CONFIG_BPF and CONFIG_DEBUG_INFO_BTF are specified?
>
> we can have CONFIG_DEBUG_INFO_BTF without CONFIG_BPF being enabled,
> so we could in theory have in future some BTF ID user outside bpf code,
> but I guess we can enable that, when it actually happens
>

Right. Let's cross that bridge when we get there.

> jirka
>
> >
> >
> > >  scripts/link-vmlinux.sh | 9 +++++++--
> > >  1 file changed, 7 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> > > index e6e2d9e5ff48..3173b8cf08cb 100755
> > > --- a/scripts/link-vmlinux.sh
> > > +++ b/scripts/link-vmlinux.sh
> > > @@ -342,8 +342,13 @@ vmlinux_link vmlinux "${kallsymso}" ${btf_vmlinux_bin_o}
> > >
> > >  # fill in BTF IDs
> > >  if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then
> > > -info BTFIDS vmlinux
> > > -${RESOLVE_BTFIDS} vmlinux
> > > +       info BTFIDS vmlinux
> > > +       # Let's be more permissive if CONFIG_BPF is disabled
> > > +       # and do not fail if there's no data to resolve.
> > > +       if [ -z "${CONFIG_BPF}" ]; then
> > > +         no_fail=--no-fail
> > > +       fi
> > > +       ${RESOLVE_BTFIDS} $no_fail vmlinux
> > >  fi
> > >
> > >  if [ -n "${CONFIG_BUILDTIME_TABLE_SORT}" ]; then
> > > --
> > > 2.26.2
> > >
> >
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-09-22 20:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18 12:26 [PATCH bpf-next 1/2] bpf: Use --no-fail option if CONFIG_BPF is not enabled Jiri Olsa
2020-09-18 12:26 ` [PATCH bpf-next 2/2] tools resolve_btfids: Always force HOSTARCH Jiri Olsa
2020-09-21 21:55 ` [PATCH bpf-next 1/2] bpf: Use --no-fail option if CONFIG_BPF is not enabled Andrii Nakryiko
2020-09-22 18:47   ` Jiri Olsa
2020-09-22 20:27     ` Andrii Nakryiko

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).