* [PATCH v1 bpf-next] selftests/bpf : Clean up feature/ when make clean
@ 2019-06-10 16:57 Hechao Li
2019-06-10 18:05 ` Andrii Nakryiko
0 siblings, 1 reply; 5+ messages in thread
From: Hechao Li @ 2019-06-10 16:57 UTC (permalink / raw)
To: bpf; +Cc: netdev, daniel, ast, kernel-team, Hechao Li
I got an error when compiling selftests/bpf:
libbpf.c:411:10: error: implicit declaration of function 'reallocarray';
did you mean 'realloc'? [-Werror=implicit-function-declaration]
progs = reallocarray(progs, nr_progs + 1, sizeof(progs[0]));
It was caused by feature-reallocarray=1 in FEATURE-DUMP.libbpf and it
was fixed by manually removing feature/ folder. This diff adds feature/
to EXTRA_CLEAN to avoid this problem.
Signed-off-by: Hechao Li <hechaol@fb.com>
---
tools/testing/selftests/bpf/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 2b426ae1cdc9..44fb61f4d502 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -279,4 +279,5 @@ $(OUTPUT)/verifier/tests.h: $(VERIFIER_TESTS_DIR) $(VERIFIER_TEST_FILES)
) > $(VERIFIER_TESTS_H))
EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(ALU32_BUILD_DIR) \
- $(VERIFIER_TESTS_H) $(PROG_TESTS_H) $(MAP_TESTS_H)
+ $(VERIFIER_TESTS_H) $(PROG_TESTS_H) $(MAP_TESTS_H) \
+ feature
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1 bpf-next] selftests/bpf : Clean up feature/ when make clean
2019-06-10 16:57 [PATCH v1 bpf-next] selftests/bpf : Clean up feature/ when make clean Hechao Li
@ 2019-06-10 18:05 ` Andrii Nakryiko
2019-06-10 19:02 ` Hechao Li
0 siblings, 1 reply; 5+ messages in thread
From: Andrii Nakryiko @ 2019-06-10 18:05 UTC (permalink / raw)
To: Hechao Li
Cc: bpf, Networking, Daniel Borkmann, Alexei Starovoitov, Kernel Team
On Mon, Jun 10, 2019 at 9:57 AM Hechao Li <hechaol@fb.com> wrote:
>
> I got an error when compiling selftests/bpf:
>
> libbpf.c:411:10: error: implicit declaration of function 'reallocarray';
> did you mean 'realloc'? [-Werror=implicit-function-declaration]
> progs = reallocarray(progs, nr_progs + 1, sizeof(progs[0]));
>
> It was caused by feature-reallocarray=1 in FEATURE-DUMP.libbpf and it
> was fixed by manually removing feature/ folder. This diff adds feature/
> to EXTRA_CLEAN to avoid this problem.
>
> Signed-off-by: Hechao Li <hechaol@fb.com>
> ---
There is no need to include v1 into patch prefix for a first version
of a patch. Only v2 and further versions are added.
> tools/testing/selftests/bpf/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 2b426ae1cdc9..44fb61f4d502 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -279,4 +279,5 @@ $(OUTPUT)/verifier/tests.h: $(VERIFIER_TESTS_DIR) $(VERIFIER_TEST_FILES)
> ) > $(VERIFIER_TESTS_H))
>
> EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(ALU32_BUILD_DIR) \
> - $(VERIFIER_TESTS_H) $(PROG_TESTS_H) $(MAP_TESTS_H)
> + $(VERIFIER_TESTS_H) $(PROG_TESTS_H) $(MAP_TESTS_H) \
> + feature
It doesn't seem any of linux's Makefile do that. From brief reading of
build/Makefile.feature, it seems like it is supposed to handle
transparently the case where environment changes and thus a set of
supported features changes. I also verified that FEATURE-DUMP.libbpf
is re-generated every single time I run make in
tools/testing/selftests/bpf, even if nothing changed at all. So I
don't think this patch is necessary.
I'm not sure what was the cause of your original problem, though.
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 bpf-next] selftests/bpf : Clean up feature/ when make clean
2019-06-10 18:05 ` Andrii Nakryiko
@ 2019-06-10 19:02 ` Hechao Li
2019-06-10 23:37 ` Song Liu
2019-06-10 23:51 ` Andrii Nakryiko
0 siblings, 2 replies; 5+ messages in thread
From: Hechao Li @ 2019-06-10 19:02 UTC (permalink / raw)
To: Andrii Nakryiko
Cc: bpf, Networking, Daniel Borkmann, Alexei Starovoitov, Kernel Team
Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote on Mon [2019-Jun-10 11:05:28 -0700]:
> On Mon, Jun 10, 2019 at 9:57 AM Hechao Li <hechaol@fb.com> wrote:
> >
> > I got an error when compiling selftests/bpf:
> >
> > libbpf.c:411:10: error: implicit declaration of function 'reallocarray';
> > did you mean 'realloc'? [-Werror=implicit-function-declaration]
> > progs = reallocarray(progs, nr_progs + 1, sizeof(progs[0]));
> >
> > It was caused by feature-reallocarray=1 in FEATURE-DUMP.libbpf and it
> > was fixed by manually removing feature/ folder. This diff adds feature/
> > to EXTRA_CLEAN to avoid this problem.
> >
> > Signed-off-by: Hechao Li <hechaol@fb.com>
> > ---
>
> There is no need to include v1 into patch prefix for a first version
> of a patch. Only v2 and further versions are added.
>
>
> > tools/testing/selftests/bpf/Makefile | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> > index 2b426ae1cdc9..44fb61f4d502 100644
> > --- a/tools/testing/selftests/bpf/Makefile
> > +++ b/tools/testing/selftests/bpf/Makefile
> > @@ -279,4 +279,5 @@ $(OUTPUT)/verifier/tests.h: $(VERIFIER_TESTS_DIR) $(VERIFIER_TEST_FILES)
> > ) > $(VERIFIER_TESTS_H))
> >
> > EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(ALU32_BUILD_DIR) \
> > - $(VERIFIER_TESTS_H) $(PROG_TESTS_H) $(MAP_TESTS_H)
> > + $(VERIFIER_TESTS_H) $(PROG_TESTS_H) $(MAP_TESTS_H) \
> > + feature
>
> It doesn't seem any of linux's Makefile do that. From brief reading of
> build/Makefile.feature, it seems like it is supposed to handle
> transparently the case where environment changes and thus a set of
> supported features changes. I also verified that FEATURE-DUMP.libbpf
> is re-generated every single time I run make in
> tools/testing/selftests/bpf, even if nothing changed at all. So I
> don't think this patch is necessary.
>
> I'm not sure what was the cause of your original problem, though.
>
> > --
> > 2.17.1
> >
# Background:
My default GCC version is 4.8.5, which caused the following error when I
run make under selftests/bpf:
libbpf.c:39:10: fatal error: libelf.h: No such file or directory
To fix it, I have to run:
make CC=<Path to GCC 7.x>
The I got reallocarray not found error. By deleting feature/ folder
under selftests/bpf, it was fixed.
# Root Cause:
Now I found the root cause. When I run "make", which uses GCC 4.8.5, it
generates feature/test-reallocarray.d which indicates reallocarray is
enabled. However, when I switched to GCC 7.0, this file was not
re-generated and thus even FEATURE-DUMP.libbpf was re-generated,
feature-reallocarray is still 1 in it.
This can be reproduced by the following steps:
$ cd tools/testing/selftests/bpf
$ make clean && make CC=<Path to GCC 4.8.5>
(Fail due to libelf.h not found)
$ make clean && make CC=<Path to GCC 7.x>
(Should succeed but actually fail with reallocarray not defined)
If adding feature to EXTRA_CLEAN is not the way to go, do you have any
suggestion to fix such problem? I spent some time debugging this and I
hope to fix it so that other people with similar situation won't have to
waste time on this issue.
Thanks,
Hechao
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 bpf-next] selftests/bpf : Clean up feature/ when make clean
2019-06-10 19:02 ` Hechao Li
@ 2019-06-10 23:37 ` Song Liu
2019-06-10 23:51 ` Andrii Nakryiko
1 sibling, 0 replies; 5+ messages in thread
From: Song Liu @ 2019-06-10 23:37 UTC (permalink / raw)
To: Hechao Li
Cc: Andrii Nakryiko, bpf, Networking, Daniel Borkmann,
Alexei Starovoitov, Kernel Team
> On Jun 10, 2019, at 12:02 PM, Hechao Li <hechaol@fb.com> wrote:
>
> Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote on Mon [2019-Jun-10 11:05:28 -0700]:
>> On Mon, Jun 10, 2019 at 9:57 AM Hechao Li <hechaol@fb.com> wrote:
>>>
>>> I got an error when compiling selftests/bpf:
>>>
>>> libbpf.c:411:10: error: implicit declaration of function 'reallocarray';
>>> did you mean 'realloc'? [-Werror=implicit-function-declaration]
>>> progs = reallocarray(progs, nr_progs + 1, sizeof(progs[0]));
>>>
>>> It was caused by feature-reallocarray=1 in FEATURE-DUMP.libbpf and it
>>> was fixed by manually removing feature/ folder. This diff adds feature/
>>> to EXTRA_CLEAN to avoid this problem.
>>>
>>> Signed-off-by: Hechao Li <hechaol@fb.com>
>>> ---
>>
>> There is no need to include v1 into patch prefix for a first version
>> of a patch. Only v2 and further versions are added.
>>
>>
>>> tools/testing/selftests/bpf/Makefile | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
>>> index 2b426ae1cdc9..44fb61f4d502 100644
>>> --- a/tools/testing/selftests/bpf/Makefile
>>> +++ b/tools/testing/selftests/bpf/Makefile
>>> @@ -279,4 +279,5 @@ $(OUTPUT)/verifier/tests.h: $(VERIFIER_TESTS_DIR) $(VERIFIER_TEST_FILES)
>>> ) > $(VERIFIER_TESTS_H))
>>>
>>> EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(ALU32_BUILD_DIR) \
>>> - $(VERIFIER_TESTS_H) $(PROG_TESTS_H) $(MAP_TESTS_H)
>>> + $(VERIFIER_TESTS_H) $(PROG_TESTS_H) $(MAP_TESTS_H) \
>>> + feature
I think this makes sense (before we find a better solution). Folder
feature is already in .gitignore, we know it can be removed.
Thanks,
Song
>>
>> It doesn't seem any of linux's Makefile do that. From brief reading of
>> build/Makefile.feature, it seems like it is supposed to handle
>> transparently the case where environment changes and thus a set of
>> supported features changes. I also verified that FEATURE-DUMP.libbpf
>> is re-generated every single time I run make in
>> tools/testing/selftests/bpf, even if nothing changed at all. So I
>> don't think this patch is necessary.
>>
>> I'm not sure what was the cause of your original problem, though.
>>
>>> --
>>> 2.17.1
>>>
>
> # Background:
>
> My default GCC version is 4.8.5, which caused the following error when I
> run make under selftests/bpf:
> libbpf.c:39:10: fatal error: libelf.h: No such file or directory
>
> To fix it, I have to run:
>
> make CC=<Path to GCC 7.x>
>
> The I got reallocarray not found error. By deleting feature/ folder
> under selftests/bpf, it was fixed.
>
> # Root Cause:
>
> Now I found the root cause. When I run "make", which uses GCC 4.8.5, it
> generates feature/test-reallocarray.d which indicates reallocarray is
> enabled. However, when I switched to GCC 7.0, this file was not
> re-generated and thus even FEATURE-DUMP.libbpf was re-generated,
> feature-reallocarray is still 1 in it.
>
> This can be reproduced by the following steps:
> $ cd tools/testing/selftests/bpf
> $ make clean && make CC=<Path to GCC 4.8.5>
> (Fail due to libelf.h not found)
> $ make clean && make CC=<Path to GCC 7.x>
> (Should succeed but actually fail with reallocarray not defined)
>
> If adding feature to EXTRA_CLEAN is not the way to go, do you have any
> suggestion to fix such problem? I spent some time debugging this and I
> hope to fix it so that other people with similar situation won't have to
> waste time on this issue.
>
> Thanks,
> Hechao
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 bpf-next] selftests/bpf : Clean up feature/ when make clean
2019-06-10 19:02 ` Hechao Li
2019-06-10 23:37 ` Song Liu
@ 2019-06-10 23:51 ` Andrii Nakryiko
1 sibling, 0 replies; 5+ messages in thread
From: Andrii Nakryiko @ 2019-06-10 23:51 UTC (permalink / raw)
To: Hechao Li
Cc: bpf, Networking, Daniel Borkmann, Alexei Starovoitov, Kernel Team
On Mon, Jun 10, 2019 at 12:03 PM Hechao Li <hechaol@fb.com> wrote:
>
> Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote on Mon [2019-Jun-10 11:05:28 -0700]:
> > On Mon, Jun 10, 2019 at 9:57 AM Hechao Li <hechaol@fb.com> wrote:
> > >
> > > I got an error when compiling selftests/bpf:
> > >
> > > libbpf.c:411:10: error: implicit declaration of function 'reallocarray';
> > > did you mean 'realloc'? [-Werror=implicit-function-declaration]
> > > progs = reallocarray(progs, nr_progs + 1, sizeof(progs[0]));
> > >
> > > It was caused by feature-reallocarray=1 in FEATURE-DUMP.libbpf and it
> > > was fixed by manually removing feature/ folder. This diff adds feature/
> > > to EXTRA_CLEAN to avoid this problem.
> > >
> > > Signed-off-by: Hechao Li <hechaol@fb.com>
> > > ---
> >
> > There is no need to include v1 into patch prefix for a first version
> > of a patch. Only v2 and further versions are added.
> >
> >
> > > tools/testing/selftests/bpf/Makefile | 3 ++-
> > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> > > index 2b426ae1cdc9..44fb61f4d502 100644
> > > --- a/tools/testing/selftests/bpf/Makefile
> > > +++ b/tools/testing/selftests/bpf/Makefile
> > > @@ -279,4 +279,5 @@ $(OUTPUT)/verifier/tests.h: $(VERIFIER_TESTS_DIR) $(VERIFIER_TEST_FILES)
> > > ) > $(VERIFIER_TESTS_H))
> > >
> > > EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(ALU32_BUILD_DIR) \
> > > - $(VERIFIER_TESTS_H) $(PROG_TESTS_H) $(MAP_TESTS_H)
> > > + $(VERIFIER_TESTS_H) $(PROG_TESTS_H) $(MAP_TESTS_H) \
> > > + feature
> >
> > It doesn't seem any of linux's Makefile do that. From brief reading of
> > build/Makefile.feature, it seems like it is supposed to handle
> > transparently the case where environment changes and thus a set of
> > supported features changes. I also verified that FEATURE-DUMP.libbpf
> > is re-generated every single time I run make in
> > tools/testing/selftests/bpf, even if nothing changed at all. So I
> > don't think this patch is necessary.
> >
> > I'm not sure what was the cause of your original problem, though.
> >
> > > --
> > > 2.17.1
> > >
>
> # Background:
>
> My default GCC version is 4.8.5, which caused the following error when I
> run make under selftests/bpf:
> libbpf.c:39:10: fatal error: libelf.h: No such file or directory
>
> To fix it, I have to run:
>
> make CC=<Path to GCC 7.x>
>
> The I got reallocarray not found error. By deleting feature/ folder
> under selftests/bpf, it was fixed.
>
> # Root Cause:
>
> Now I found the root cause. When I run "make", which uses GCC 4.8.5, it
> generates feature/test-reallocarray.d which indicates reallocarray is
> enabled. However, when I switched to GCC 7.0, this file was not
> re-generated and thus even FEATURE-DUMP.libbpf was re-generated,
> feature-reallocarray is still 1 in it.
>
> This can be reproduced by the following steps:
> $ cd tools/testing/selftests/bpf
> $ make clean && make CC=<Path to GCC 4.8.5>
> (Fail due to libelf.h not found)
> $ make clean && make CC=<Path to GCC 7.x>
> (Should succeed but actually fail with reallocarray not defined)
>
> If adding feature to EXTRA_CLEAN is not the way to go, do you have any
> suggestion to fix such problem? I spent some time debugging this and I
> hope to fix it so that other people with similar situation won't have to
> waste time on this issue.
I think adding feature to EXTRA_CLEAN is just fine. I was hesitant
without understanding how this happened. Maybe condense this
explanation as part of commit message, I think it's useful, thanks for
explaining!
Acked-by: Andrii Nakryiko <andriin@fb.com>
>
> Thanks,
> Hechao
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-06-10 23:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-10 16:57 [PATCH v1 bpf-next] selftests/bpf : Clean up feature/ when make clean Hechao Li
2019-06-10 18:05 ` Andrii Nakryiko
2019-06-10 19:02 ` Hechao Li
2019-06-10 23:37 ` Song Liu
2019-06-10 23:51 ` 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).