netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next] samples/bpf: Add include dir for MIPS Loongson64 to fix build errors
@ 2021-01-26 14:05 Tiezhu Yang
  2021-01-26 16:01 ` Daniel Borkmann
  2021-02-02 22:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Tiezhu Yang @ 2021-01-26 14:05 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Nathan Chancellor, Nick Desaulniers
  Cc: netdev, bpf, clang-built-linux, linux-mips, linux-kernel, Xuefeng Li

There exists many build errors when make M=samples/bpf on the Loongson
platform, this issue is MIPS related, x86 compiles just fine.

Here are some errors:

  CLANG-bpf  samples/bpf/sockex2_kern.o
In file included from samples/bpf/sockex2_kern.c:2:
In file included from ./include/uapi/linux/in.h:24:
In file included from ./include/linux/socket.h:8:
In file included from ./include/linux/uio.h:8:
In file included from ./include/linux/kernel.h:11:
In file included from ./include/linux/bitops.h:32:
In file included from ./arch/mips/include/asm/bitops.h:19:
In file included from ./arch/mips/include/asm/barrier.h:11:
./arch/mips/include/asm/addrspace.h:13:10: fatal error: 'spaces.h' file not found
         ^~~~~~~~~~
1 error generated.

  CLANG-bpf  samples/bpf/sockex2_kern.o
In file included from samples/bpf/sockex2_kern.c:2:
In file included from ./include/uapi/linux/in.h:24:
In file included from ./include/linux/socket.h:8:
In file included from ./include/linux/uio.h:8:
In file included from ./include/linux/kernel.h:11:
In file included from ./include/linux/bitops.h:32:
In file included from ./arch/mips/include/asm/bitops.h:22:
In file included from ./arch/mips/include/asm/cpu-features.h:13:
In file included from ./arch/mips/include/asm/cpu-info.h:15:
In file included from ./include/linux/cache.h:6:
./arch/mips/include/asm/cache.h:12:10: fatal error: 'kmalloc.h' file not found
         ^~~~~~~~~~~
1 error generated.

  CLANG-bpf  samples/bpf/sockex2_kern.o
In file included from samples/bpf/sockex2_kern.c:2:
In file included from ./include/uapi/linux/in.h:24:
In file included from ./include/linux/socket.h:8:
In file included from ./include/linux/uio.h:8:
In file included from ./include/linux/kernel.h:11:
In file included from ./include/linux/bitops.h:32:
In file included from ./arch/mips/include/asm/bitops.h:22:
./arch/mips/include/asm/cpu-features.h:15:10: fatal error: 'cpu-feature-overrides.h' file not found
         ^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

$ find arch/mips/include/asm -name spaces.h | sort
arch/mips/include/asm/mach-ar7/spaces.h
...
arch/mips/include/asm/mach-generic/spaces.h
...
arch/mips/include/asm/mach-loongson64/spaces.h
...
arch/mips/include/asm/mach-tx49xx/spaces.h

$ find arch/mips/include/asm -name kmalloc.h | sort
arch/mips/include/asm/mach-generic/kmalloc.h
arch/mips/include/asm/mach-ip32/kmalloc.h
arch/mips/include/asm/mach-tx49xx/kmalloc.h

$ find arch/mips/include/asm -name cpu-feature-overrides.h | sort
arch/mips/include/asm/mach-ath25/cpu-feature-overrides.h
...
arch/mips/include/asm/mach-generic/cpu-feature-overrides.h
...
arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h
...
arch/mips/include/asm/mach-tx49xx/cpu-feature-overrides.h

In the arch/mips/Makefile, there exists the following board-dependent
options:

include arch/mips/Kbuild.platforms
cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic

So we can do the similar things in samples/bpf/Makefile, just add
platform specific and generic include dir for MIPS Loongson64 to
fix the build errors.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 samples/bpf/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 362f314..45ceca4 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -185,6 +185,10 @@ endif
 
 ifeq ($(ARCH), mips)
 TPROGS_CFLAGS += -D__SANE_USERSPACE_TYPES__
+ifdef CONFIG_MACH_LOONGSON64
+BPF_EXTRA_CFLAGS += -I$(srctree)/arch/mips/include/asm/mach-loongson64
+BPF_EXTRA_CFLAGS += -I$(srctree)/arch/mips/include/asm/mach-generic
+endif
 endif
 
 TPROGS_CFLAGS += -Wall -O2
-- 
2.1.0


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

* Re: [PATCH bpf-next] samples/bpf: Add include dir for MIPS Loongson64 to fix build errors
  2021-01-26 14:05 [PATCH bpf-next] samples/bpf: Add include dir for MIPS Loongson64 to fix build errors Tiezhu Yang
@ 2021-01-26 16:01 ` Daniel Borkmann
  2021-01-27  1:40   ` Tiezhu Yang
  2021-02-02 22:40 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel Borkmann @ 2021-01-26 16:01 UTC (permalink / raw)
  To: Tiezhu Yang, Alexei Starovoitov, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Nathan Chancellor, Nick Desaulniers
  Cc: netdev, bpf, clang-built-linux, linux-mips, linux-kernel, Xuefeng Li

On 1/26/21 3:05 PM, Tiezhu Yang wrote:
> There exists many build errors when make M=samples/bpf on the Loongson
> platform, this issue is MIPS related, x86 compiles just fine.
> 
> Here are some errors:
[...]
> 
> So we can do the similar things in samples/bpf/Makefile, just add
> platform specific and generic include dir for MIPS Loongson64 to
> fix the build errors.

Your patch from [0] said ...

   There exists many build warnings when make M=samples/bpf on the Loongson
   platform, this issue is MIPS related, x86 compiles just fine.

   Here are some warnings:
   [...]

   With #ifndef __SANE_USERSPACE_TYPES__  in tools/include/linux/types.h,
   the above error has gone and this ifndef change does not hurt other
   compilations.

... which ave the impression that all the issues were fixed. What else
is needed aside from this patch here? More samples/bpf fixes coming? If
yes, please all submit them as a series instead of individual ones.

  [0] https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=190d1c921ad0862da14807e1670f54020f48e889

> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>   samples/bpf/Makefile | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
> index 362f314..45ceca4 100644
> --- a/samples/bpf/Makefile
> +++ b/samples/bpf/Makefile
> @@ -185,6 +185,10 @@ endif
>   
>   ifeq ($(ARCH), mips)
>   TPROGS_CFLAGS += -D__SANE_USERSPACE_TYPES__
> +ifdef CONFIG_MACH_LOONGSON64
> +BPF_EXTRA_CFLAGS += -I$(srctree)/arch/mips/include/asm/mach-loongson64
> +BPF_EXTRA_CFLAGS += -I$(srctree)/arch/mips/include/asm/mach-generic
> +endif
>   endif
>   
>   TPROGS_CFLAGS += -Wall -O2
> 


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

* Re: [PATCH bpf-next] samples/bpf: Add include dir for MIPS Loongson64 to fix build errors
  2021-01-26 16:01 ` Daniel Borkmann
@ 2021-01-27  1:40   ` Tiezhu Yang
  0 siblings, 0 replies; 4+ messages in thread
From: Tiezhu Yang @ 2021-01-27  1:40 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Nathan Chancellor, Nick Desaulniers
  Cc: netdev, bpf, clang-built-linux, linux-mips, linux-kernel, Xuefeng Li

On 01/27/2021 12:01 AM, Daniel Borkmann wrote:
> On 1/26/21 3:05 PM, Tiezhu Yang wrote:
>> There exists many build errors when make M=samples/bpf on the Loongson
>> platform, this issue is MIPS related, x86 compiles just fine.
>>
>> Here are some errors:
> [...]
>>
>> So we can do the similar things in samples/bpf/Makefile, just add
>> platform specific and generic include dir for MIPS Loongson64 to
>> fix the build errors.
>
> Your patch from [0] said ...
>
>   There exists many build warnings when make M=samples/bpf on the 
> Loongson
>   platform, this issue is MIPS related, x86 compiles just fine.
>
>   Here are some warnings:
>   [...]
>
>   With #ifndef __SANE_USERSPACE_TYPES__  in tools/include/linux/types.h,
>   the above error has gone and this ifndef change does not hurt other
>   compilations.
>
> ... which ave the impression that all the issues were fixed. What else
> is needed aside from this patch here? More samples/bpf fixes coming? If
> yes, please all submit them as a series instead of individual ones.

Hi Daniel,

Thanks for your reply.

This is the last samples/bpf patch to fix the obvious build issues when
make M=samples/bpf on the MIPS Loongson64 platform.

There is another MIPS patch to fix the following build error when make
M=samples/bpf, but it seems a common and known issue when build MIPS
kernel used with clang [1]:

./arch/mips/include/asm/checksum.h:161:9: error: unsupported inline asm: 
input with type 'unsigned long' matching output with type '__wsum' (aka 
'unsigned int')
         : "0" ((__force unsigned long)daddr),
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Because these two patches are independent, this one is bpf-next related,
the other one is mips-next related, so I submit them sepearately.

[1] 
https://lore.kernel.org/linux-mips/CAG_fn=W0JHf8QyUX==+rQMp8PoULHrsQCa9Htffws31ga8k-iw@mail.gmail.com/

Thanks,
Tiezhu

>
>  [0] 
> https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=190d1c921ad0862da14807e1670f54020f48e889
>
>> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
>> ---
>>   samples/bpf/Makefile | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
>> index 362f314..45ceca4 100644
>> --- a/samples/bpf/Makefile
>> +++ b/samples/bpf/Makefile
>> @@ -185,6 +185,10 @@ endif
>>     ifeq ($(ARCH), mips)
>>   TPROGS_CFLAGS += -D__SANE_USERSPACE_TYPES__
>> +ifdef CONFIG_MACH_LOONGSON64
>> +BPF_EXTRA_CFLAGS += -I$(srctree)/arch/mips/include/asm/mach-loongson64
>> +BPF_EXTRA_CFLAGS += -I$(srctree)/arch/mips/include/asm/mach-generic
>> +endif
>>   endif
>>     TPROGS_CFLAGS += -Wall -O2
>>


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

* Re: [PATCH bpf-next] samples/bpf: Add include dir for MIPS Loongson64 to fix build errors
  2021-01-26 14:05 [PATCH bpf-next] samples/bpf: Add include dir for MIPS Loongson64 to fix build errors Tiezhu Yang
  2021-01-26 16:01 ` Daniel Borkmann
@ 2021-02-02 22:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-02-02 22:40 UTC (permalink / raw)
  To: Tiezhu Yang
  Cc: ast, daniel, andrii, kafai, songliubraving, yhs, john.fastabend,
	kpsingh, natechancellor, ndesaulniers, netdev, bpf,
	clang-built-linux, linux-mips, linux-kernel, lixuefeng

Hello:

This patch was applied to bpf/bpf-next.git (refs/heads/master):

On Tue, 26 Jan 2021 22:05:25 +0800 you wrote:
> There exists many build errors when make M=samples/bpf on the Loongson
> platform, this issue is MIPS related, x86 compiles just fine.
> 
> Here are some errors:
> 
>   CLANG-bpf  samples/bpf/sockex2_kern.o
> In file included from samples/bpf/sockex2_kern.c:2:
> In file included from ./include/uapi/linux/in.h:24:
> In file included from ./include/linux/socket.h:8:
> In file included from ./include/linux/uio.h:8:
> In file included from ./include/linux/kernel.h:11:
> In file included from ./include/linux/bitops.h:32:
> In file included from ./arch/mips/include/asm/bitops.h:19:
> In file included from ./arch/mips/include/asm/barrier.h:11:
> ./arch/mips/include/asm/addrspace.h:13:10: fatal error: 'spaces.h' file not found
>          ^~~~~~~~~~
> 1 error generated.
> 
> [...]

Here is the summary with links:
  - [bpf-next] samples/bpf: Add include dir for MIPS Loongson64 to fix build errors
    https://git.kernel.org/bpf/bpf-next/c/058107abafc7

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-02-02 22:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-26 14:05 [PATCH bpf-next] samples/bpf: Add include dir for MIPS Loongson64 to fix build errors Tiezhu Yang
2021-01-26 16:01 ` Daniel Borkmann
2021-01-27  1:40   ` Tiezhu Yang
2021-02-02 22:40 ` patchwork-bot+netdevbpf

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