From: Tiezhu Yang <yangtiezhu@loongson.cn> Date: 2021-01-13 10:58:35
There exists many build errors and warnings when make M=samples/bpf,
this patch series fix some of them, I will submit some other patches
related with MIPS later.
Tiezhu Yang (2):
samples/bpf: Set flag __SANE_USERSPACE_TYPES__ for MIPS to fix build
warnings
compiler.h: Include asm/rwonce.h under ARM64 and ALPHA to fix build
errors
include/linux/compiler.h | 6 ++++++
samples/bpf/Makefile | 4 ++++
tools/include/linux/types.h | 3 +++
3 files changed, 13 insertions(+)
--
2.1.0
From: Tiezhu Yang <yangtiezhu@loongson.cn> Date: 2021-01-13 10:58:58
When make M=samples/bpf on the Loongson 3A3000 platform which
belongs to MIPS arch, there exists many similar build errors
about 'asm/rwonce.h' file not found, so include it only under
CONFIG_ARM64 and CONFIG_ALPHA due to it exists only in arm64
and alpha arch.
CLANG-bpf samples/bpf/xdpsock_kern.o
In file included from samples/bpf/xdpsock_kern.c:2:
In file included from ./include/linux/bpf.h:9:
In file included from ./include/linux/workqueue.h:9:
In file included from ./include/linux/timer.h:5:
In file included from ./include/linux/list.h:9:
In file included from ./include/linux/kernel.h:10:
./include/linux/compiler.h:246:10: fatal error: 'asm/rwonce.h' file not found
^~~~~~~~~~~~~~
1 error generated.
$ find . -name rwonce.h
./include/asm-generic/rwonce.h
./arch/arm64/include/asm/rwonce.h
./arch/alpha/include/asm/rwonce.h
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
include/linux/compiler.h | 6 ++++++
1 file changed, 6 insertions(+)
@@ -6,7 +6,10 @@#include<stddef.h>#include<stdint.h>+#ifndef __SANE_USERSPACE_TYPES__#define __SANE_USERSPACE_TYPES__ /* For PPC64, to get LL64 types */+#endif+#include<asm/types.h>#include<asm/posix_types.h>
From: Yonghong Song <hidden> Date: 2021-01-13 17:13:40
On 1/13/21 2:57 AM, Tiezhu Yang wrote:
MIPS needs __SANE_USERSPACE_TYPES__ before <linux/types.h> to select
'int-ll64.h' in arch/mips/include/uapi/asm/types.h and avoid compile
warnings when printing __u64 with %llu, %llx or %lld.
could you mention which command produces the following warning?
This change looks okay based on description in
arch/mips/include/uapi/asm/types.h
'''
/*
* We don't use int-l64.h for the kernel anymore but still use it for
* userspace to avoid code changes.
*
* However, some user programs (e.g. perf) may not want this. They can
* flag __SANE_USERSPACE_TYPES__ to get int-ll64.h here.
*/
'''
@@ -6,7 +6,10 @@#include<stddef.h>#include<stdint.h>+#ifndef __SANE_USERSPACE_TYPES__#define __SANE_USERSPACE_TYPES__ /* For PPC64, to get LL64 types */+#endif
What problem this patch fixed? If this header is used, you can just
change comment from "PPC64" to "PPC64/MIPS", right?
From: Yonghong Song <hidden> Date: 2021-01-13 17:16:21
On 1/13/21 2:57 AM, Tiezhu Yang wrote:
quoted hunk
When make M=samples/bpf on the Loongson 3A3000 platform which
belongs to MIPS arch, there exists many similar build errors
about 'asm/rwonce.h' file not found, so include it only under
CONFIG_ARM64 and CONFIG_ALPHA due to it exists only in arm64
and alpha arch.
CLANG-bpf samples/bpf/xdpsock_kern.o
In file included from samples/bpf/xdpsock_kern.c:2:
In file included from ./include/linux/bpf.h:9:
In file included from ./include/linux/workqueue.h:9:
In file included from ./include/linux/timer.h:5:
In file included from ./include/linux/list.h:9:
In file included from ./include/linux/kernel.h:10:
./include/linux/compiler.h:246:10: fatal error: 'asm/rwonce.h' file not found
^~~~~~~~~~~~~~
1 error generated.
$ find . -name rwonce.h
./include/asm-generic/rwonce.h
./arch/arm64/include/asm/rwonce.h
./arch/alpha/include/asm/rwonce.h
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
include/linux/compiler.h | 6 ++++++
1 file changed, 6 insertions(+)
I do not think this fix is correct. x86 does not define its own
rwonce.h and still compiles fine.
As noted in the above, we have include/asm-generic/rwonce.h.
Once you do a proper build, you will have rwonce.h in arch
generated directory like
-bash-4.4$ find . -name rwonce.h
./include/asm-generic/rwonce.h
./arch/alpha/include/asm/rwonce.h
./arch/arm64/include/asm/rwonce.h
./arch/x86/include/generated/asm/rwonce.h
for mips, it should generated in
arch/mips/include/generated/asm/rwonce.h. Please double check why this
does not happen.
From: Yonghong Song <hidden> Date: 2021-01-13 17:17:45
On 1/13/21 2:57 AM, Tiezhu Yang wrote:
There exists many build errors and warnings when make M=samples/bpf,
both fixes in this patch related to mips, please do mention in the
commit message that this is
mips related. x86 (and arm64 I assume) compiles just fine.
this patch series fix some of them, I will submit some other patches
related with MIPS later.
Tiezhu Yang (2):
samples/bpf: Set flag __SANE_USERSPACE_TYPES__ for MIPS to fix build
warnings
compiler.h: Include asm/rwonce.h under ARM64 and ALPHA to fix build
errors
include/linux/compiler.h | 6 ++++++
samples/bpf/Makefile | 4 ++++
tools/include/linux/types.h | 3 +++
3 files changed, 13 insertions(+)
From: Sergei Shtylyov <hidden> Date: 2021-01-14 08:42:08
Hello!
On 13.01.2021 13:57, Tiezhu Yang wrote:
quoted hunk
When make M=samples/bpf on the Loongson 3A3000 platform which
belongs to MIPS arch, there exists many similar build errors
about 'asm/rwonce.h' file not found, so include it only under
CONFIG_ARM64 and CONFIG_ALPHA due to it exists only in arm64
and alpha arch.
CLANG-bpf samples/bpf/xdpsock_kern.o
In file included from samples/bpf/xdpsock_kern.c:2:
In file included from ./include/linux/bpf.h:9:
In file included from ./include/linux/workqueue.h:9:
In file included from ./include/linux/timer.h:5:
In file included from ./include/linux/list.h:9:
In file included from ./include/linux/kernel.h:10:
./include/linux/compiler.h:246:10: fatal error: 'asm/rwonce.h' file not found
^~~~~~~~~~~~~~
1 error generated.
$ find . -name rwonce.h
./include/asm-generic/rwonce.h
./arch/arm64/include/asm/rwonce.h
./arch/alpha/include/asm/rwonce.h
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
include/linux/compiler.h | 6 ++++++
1 file changed, 6 insertions(+)
From: Tiezhu Yang <yangtiezhu@loongson.cn> Date: 2021-01-18 03:23:37
On 01/14/2021 01:12 AM, Yonghong Song wrote:
On 1/13/21 2:57 AM, Tiezhu Yang wrote:
quoted
MIPS needs __SANE_USERSPACE_TYPES__ before <linux/types.h> to select
'int-ll64.h' in arch/mips/include/uapi/asm/types.h and avoid compile
warnings when printing __u64 with %llu, %llx or %lld.
could you mention which command produces the following warning?
This change looks okay based on description in
arch/mips/include/uapi/asm/types.h
'''
/*
* We don't use int-l64.h for the kernel anymore but still use it for
* userspace to avoid code changes.
*
* However, some user programs (e.g. perf) may not want this. They can
* flag __SANE_USERSPACE_TYPES__ to get int-ll64.h here.
*/
'''
@@ -6,7 +6,10 @@#include<stddef.h>#include<stdint.h>+#ifndef__SANE_USERSPACE_TYPES__#define __SANE_USERSPACE_TYPES__ /* For PPC64, to get LL64 types */+#endif
What problem this patch fixed?
If add "TPROGS_CFLAGS += -D__SANE_USERSPACE_TYPES__" in
samples/bpf/Makefile, it appears the following error:
Auto-detecting system features:
... libelf: [ on ]
... zlib: [ on ]
... bpf: [ OFF ]
BPF API too old
make[3]: *** [Makefile:293: bpfdep] Error 1
make[2]: *** [Makefile:156: all] Error 2
With #ifndef __SANE_USERSPACE_TYPES__ in tools/include/linux/types.h,
the above error has gone.
If this header is used, you can just
change comment from "PPC64" to "PPC64/MIPS", right?
If include <linux/types.h> in the source files which have compile warnings
when printing __u64 with %llu, %llx or %lld, it has no effect due to
actually
it includes usr/include/linux/types.h instead of
tools/include/linux/types.h,
this is because the include-directories in samples/bpf/Makefile are searched
in the order, -I./usr/include is in the front of -I./tools/include.
So I think define __SANE_USERSPACE_TYPES__ for MIPS in samples/bpf/Makefile
is proper, at the same time, add #ifndef __SANE_USERSPACE_TYPES__ in
tools/include/linux/types.h can avoid build error and have no side effect.
I will send v2 later with mention in the commit message that this is
mips related.
Thanks,
Tiezhu
From: Tiezhu Yang <yangtiezhu@loongson.cn> Date: 2021-01-18 09:57:49
On 01/14/2021 01:14 AM, Yonghong Song wrote:
I do not think this fix is correct. x86 does not define its own
rwonce.h and still compiles fine.
As noted in the above, we have include/asm-generic/rwonce.h.
Once you do a proper build, you will have rwonce.h in arch
generated directory like
-bash-4.4$ find . -name rwonce.h
./include/asm-generic/rwonce.h
./arch/alpha/include/asm/rwonce.h
./arch/arm64/include/asm/rwonce.h
./arch/x86/include/generated/asm/rwonce.h
for mips, it should generated in
arch/mips/include/generated/asm/rwonce.h. Please double check why this
does not happen.
Hi Yonghong,
Thank you very much for your reply.
You are right, this patch is meaningless.
I find this build error when make M=samples/bpf after make clean,
so the ./arch/mips/include/generated/asm/rwonce.h is not exist.
After rebuild the kernel, this header file can be found when make
M=samples/bpf due to samples/bpf/Makefile contains $LINUXINCLUDE.
$ find . -name rwonce.h
./include/asm-generic/rwonce.h
./arch/arm64/include/asm/rwonce.h
./arch/mips/include/generated/asm/rwonce.h
./arch/alpha/include/asm/rwonce.h
$ cat ./arch/mips/include/generated/asm/rwonce.h
#include <asm-generic/rwonce.h>
Hi Sergei and kernel test robot,
Thank you for your suggestion and report,
please ignore this patch, sorry for the noise.
Thanks,
Tiezhu
From: Yonghong Song <hidden> Date: 2021-01-18 18:51:40
On 1/17/21 7:22 PM, Tiezhu Yang wrote:
On 01/14/2021 01:12 AM, Yonghong Song wrote:
quoted
On 1/13/21 2:57 AM, Tiezhu Yang wrote:
quoted
MIPS needs __SANE_USERSPACE_TYPES__ before <linux/types.h> to select
'int-ll64.h' in arch/mips/include/uapi/asm/types.h and avoid compile
warnings when printing __u64 with %llu, %llx or %lld.
could you mention which command produces the following warning?
This change looks okay based on description in
arch/mips/include/uapi/asm/types.h
'''
/*
* We don't use int-l64.h for the kernel anymore but still use it for
* userspace to avoid code changes.
*
* However, some user programs (e.g. perf) may not want this. They can
* flag __SANE_USERSPACE_TYPES__ to get int-ll64.h here.
*/
'''
#include <stddef.h>
#include <stdint.h>
+#ifndef __SANE_USERSPACE_TYPES__
#define __SANE_USERSPACE_TYPES__ /* For PPC64, to get LL64 types */
+#endif
What problem this patch fixed?
If add "TPROGS_CFLAGS += -D__SANE_USERSPACE_TYPES__" in
samples/bpf/Makefile, it appears the following error:
Auto-detecting system features:
... libelf: [ on ]
... zlib: [ on ]
... bpf: [ OFF ]
BPF API too old
make[3]: *** [Makefile:293: bpfdep] Error 1
make[2]: *** [Makefile:156: all] Error 2
With #ifndef __SANE_USERSPACE_TYPES__ in tools/include/linux/types.h,
the above error has gone.
quoted
If this header is used, you can just
change comment from "PPC64" to "PPC64/MIPS", right?
If include <linux/types.h> in the source files which have compile warnings
when printing __u64 with %llu, %llx or %lld, it has no effect due to
actually
it includes usr/include/linux/types.h instead of
tools/include/linux/types.h,
this is because the include-directories in samples/bpf/Makefile are
searched
in the order, -I./usr/include is in the front of -I./tools/include.
So I think define __SANE_USERSPACE_TYPES__ for MIPS in samples/bpf/Makefile
is proper, at the same time, add #ifndef __SANE_USERSPACE_TYPES__ in
tools/include/linux/types.h can avoid build error and have no side effect.
I will send v2 later with mention in the commit message that this is
mips related.
It would be good if you can add the above information to the commit
message so people will know what the root cause of the issue.
If I understand correctly, if we could have include path
"tools/include" earlier than "usr/include", we might not have this
issue. The problem is that "usr/include" is preferred first (uapi)
than "tools/include" (including kernel dev headers).
I am wondering whether we could avoid changes in
tools/include/linux/types.h, e.g., by undef __SANE_USER_SPACE_TYPES
right before include
path tools/include. But that sounds like a ugly hack and actually
the change in tools/include/linux/types.h does not hurt other
compilations.
So your current change looks good to me, but please have better
explanation of the problem and why for each change in the commit
message.