2024-05-21 17:08:07

by Namhyung Kim

[permalink] [raw]
Subject: Re: Makefile.perf:1149: *** Missing bpftool input for generating vmlinux.h. Stop.

Hi Ian and Ingo,

The failure happens when you don't have vmlinux.h or vmlinux with BTF.

ifeq ($(VMLINUX_H),)
ifeq ($(VMLINUX_BTF),)
$(error Missing bpftool input for generating vmlinux.h)
endif
endif

VMLINUX_BTF can be empty if you didn't build a kernel or
it doesn't have a BTF section and the current kernel also
has no BTF. This is totally ok.

But VMLINUX_H should be set to the minimal version in
the source tree (unless you overwrite it manually) when you
don't pass GEN_VMLINUX_H=1 (which requires VMLINUX_BTF
should not be empty). The problem is that it's defined in
Makefile.config which is not included for `make clean`.

Can you please verify if the below patch fixes it?

Thanks,
Namhyung

---8<---

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 5c35c0d89306..e6d56b555369 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -214,6 +214,7 @@ NON_CONFIG_TARGETS := clean python-clean TAGS tags
cscope help

ifdef MAKECMDGOALS
ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
+ VMLINUX_H=$(src-perf)/util/bpf_skel/vmlinux/vmlinux.h
config := 0
endif
endif


2024-06-05 07:15:32

by Ingo Molnar

[permalink] [raw]
Subject: Re: Makefile.perf:1149: *** Missing bpftool input for generating vmlinux.h. Stop.


* Namhyung Kim <[email protected]> wrote:

> Hi Ian and Ingo,
>
> The failure happens when you don't have vmlinux.h or vmlinux with BTF.
>
> ifeq ($(VMLINUX_H),)
> ifeq ($(VMLINUX_BTF),)
> $(error Missing bpftool input for generating vmlinux.h)
> endif
> endif
>
> VMLINUX_BTF can be empty if you didn't build a kernel or
> it doesn't have a BTF section and the current kernel also
> has no BTF. This is totally ok.
>
> But VMLINUX_H should be set to the minimal version in
> the source tree (unless you overwrite it manually) when you
> don't pass GEN_VMLINUX_H=1 (which requires VMLINUX_BTF
> should not be empty). The problem is that it's defined in
> Makefile.config which is not included for `make clean`.
>
> Can you please verify if the below patch fixes it?
>
> Thanks,
> Namhyung
>
> ---8<---
>
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 5c35c0d89306..e6d56b555369 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -214,6 +214,7 @@ NON_CONFIG_TARGETS := clean python-clean TAGS tags
> cscope help
>
> ifdef MAKECMDGOALS
> ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
> + VMLINUX_H=$(src-perf)/util/bpf_skel/vmlinux/vmlinux.h
> config := 0
> endif
> endif

Yeah, this appears to be doing the trick here - judging by a couple of
tries of interrupted builds:

Tested-by: Ingo Molnar <[email protected]>

There's a new issue btw: see the 'invalid escape sequence' warnings below.
This is on a pretty stock Unbuntu 24.04 desktop.

Thanks,

Ingo

<unknown>:1: SyntaxWarning: invalid escape sequence '\S'
ASCIIDOC perf-config.xml
<unknown>:1: SyntaxWarning: invalid escape sequence '\S'
<unknown>:1: SyntaxWarning: invalid escape sequence '\S'
<unknown>:1: SyntaxWarning: invalid escape sequence '\S'
<unknown>:1: SyntaxWarning: invalid escape sequence '\S'
ASCIIDOC perf-daemon.xml
<unknown>:1: SyntaxWarning: invalid escape sequence '\S'
<unknown>:1: SyntaxWarning: invalid escape sequence '\S'
ASCIIDOC perf-data.xml
ASCIIDOC perf-diff.xml


2024-06-05 07:19:58

by Ingo Molnar

[permalink] [raw]
Subject: Re: Makefile.perf:1149: *** Missing bpftool input for generating vmlinux.h. Stop.


* Ingo Molnar <[email protected]> wrote:

>
> * Namhyung Kim <[email protected]> wrote:
>
> > Hi Ian and Ingo,
> >
> > The failure happens when you don't have vmlinux.h or vmlinux with BTF.
> >
> > ifeq ($(VMLINUX_H),)
> > ifeq ($(VMLINUX_BTF),)
> > $(error Missing bpftool input for generating vmlinux.h)
> > endif
> > endif
> >
> > VMLINUX_BTF can be empty if you didn't build a kernel or
> > it doesn't have a BTF section and the current kernel also
> > has no BTF. This is totally ok.
> >
> > But VMLINUX_H should be set to the minimal version in
> > the source tree (unless you overwrite it manually) when you
> > don't pass GEN_VMLINUX_H=1 (which requires VMLINUX_BTF
> > should not be empty). The problem is that it's defined in
> > Makefile.config which is not included for `make clean`.
> >
> > Can you please verify if the below patch fixes it?
> >
> > Thanks,
> > Namhyung
> >
> > ---8<---
> >
> > diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> > index 5c35c0d89306..e6d56b555369 100644
> > --- a/tools/perf/Makefile.perf
> > +++ b/tools/perf/Makefile.perf
> > @@ -214,6 +214,7 @@ NON_CONFIG_TARGETS := clean python-clean TAGS tags
> > cscope help
> >
> > ifdef MAKECMDGOALS
> > ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
> > + VMLINUX_H=$(src-perf)/util/bpf_skel/vmlinux/vmlinux.h
> > config := 0
> > endif
> > endif
>
> Yeah, this appears to be doing the trick here - judging by a couple of
> tries of interrupted builds:
>
> Tested-by: Ingo Molnar <[email protected]>

Specifically I also tested it on a failed tree, by merging in your fix the
build now progresses as expected. So this is fixed for good.

Thanks,

Ingo

2024-06-05 14:47:51

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: Makefile.perf:1149: *** Missing bpftool input for generating vmlinux.h. Stop.

On Wed, Jun 05, 2024 at 09:18:33AM +0200, Ingo Molnar wrote:
> > Yeah, this appears to be doing the trick here - judging by a couple of
> > tries of interrupted builds:
> >
> > Tested-by: Ingo Molnar <[email protected]>
>
> Specifically I also tested it on a failed tree, by merging in your fix the
> build now progresses as expected. So this is fixed for good.

Hi,

I put this together, can I keep it so that I have it in my next
perf-tools pull req for Linus for v6.10?

Cheers,

- Arnaldo

From ca9680821dfec73c9100860bda4fab1f1309722e Mon Sep 17 00:00:00 2001
From: Namhyung Kim <[email protected]>
Date: Tue, 21 May 2024 10:07:40 -0700
Subject: [PATCH 1/1] perf bpf: Fix handling of minimal vmlinux.h file when
interrupting the build

Ingo reported that he was seeing these when hitting Control+C during a
perf tools build:

Makefile.perf:1149: *** Missing bpftool input for generating vmlinux.h. Stop.

The failure happens when you don't have vmlinux.h or vmlinux with BTF.

ifeq ($(VMLINUX_H),)
ifeq ($(VMLINUX_BTF),)
$(error Missing bpftool input for generating vmlinux.h)
endif
endif

VMLINUX_BTF can be empty if you didn't build a kernel or it doesn't have
a BTF section and the current kernel also has no BTF. This is totally
ok.

But VMLINUX_H should be set to the minimal version in the source tree
(unless you overwrite it manually) when you don't pass GEN_VMLINUX_H=1
(which requires VMLINUX_BTF should not be empty). The problem is that
it's defined in Makefile.config which is not included for `make clean`.

Reported-by: Ingo Molnar <[email protected]>
Signed-off-by: Namhyung Kim <[email protected]>
Tested-by: Ingo Molnar <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Ian Rogers <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Kan Liang <[email protected]>
Link: http://lore.kernel.org/lkml/CAM9d7ch5HTr+k+_GpbMrX0HUo5BZ11byh1xq0Two7B7RQACuNw@mail.gmail.com
Link: http://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/Makefile.perf | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 5c35c0d89306964f..e6d56b555369581d 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -214,6 +214,7 @@ NON_CONFIG_TARGETS := clean python-clean TAGS tags cscope help

ifdef MAKECMDGOALS
ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
+ VMLINUX_H=$(src-perf)/util/bpf_skel/vmlinux/vmlinux.h
config := 0
endif
endif
--
2.45.1