bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* tools/bpf: Compilation issue on powerpc: unknown type name '__vector128'
@ 2020-10-23 23:06 Vitaly Chikunov
  2020-10-24  8:23 ` Dmitry V. Levin
  0 siblings, 1 reply; 5+ messages in thread
From: Vitaly Chikunov @ 2020-10-23 23:06 UTC (permalink / raw)
  To: bpf, Will Deacon, Alexei Starovoitov, Daniel Borkmann
  Cc: Dmitry V. Levin, Vitaly Chikunov

Hi,

Commit f143c11bb7b9 ("tools: bpf: Use local copy of headers including
uapi/linux/filter.h") introduces compilation issue on powerpc:
 
  builder@powerpc64le:~/linux$ make -C tools/bpf V=1
  make: Entering directory '/usr/src/linux/tools/bpf'
  gcc -Wall -O2 -D__EXPORTED_HEADERS__ -I/usr/src/linux/tools/include/uapi -I/usr/src/linux/tools/include -DDISASM_FOUR_ARGS_SIGNATURE -c -o bpf_dbg.o /usr/src/linux/tools/bpf/bpf_dbg.c
  In file included from /usr/include/asm/sigcontext.h:14,
		   from /usr/include/bits/sigcontext.h:30,
		   from /usr/include/signal.h:291,
		   from /usr/src/linux/tools/bpf/bpf_dbg.c:51:
  /usr/include/asm/elf.h:160:9: error: unknown type name '__vector128'
    160 | typedef __vector128 elf_vrreg_t;
	|         ^~~~~~~~~~~
  make: *** [Makefile:67: bpf_dbg.o] Error 1
  make: Leaving directory '/usr/src/linux/tools/bpf'



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

* Re: tools/bpf: Compilation issue on powerpc: unknown type name '__vector128'
  2020-10-23 23:06 tools/bpf: Compilation issue on powerpc: unknown type name '__vector128' Vitaly Chikunov
@ 2020-10-24  8:23 ` Dmitry V. Levin
  2020-10-24 20:30   ` Vitaly Chikunov
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry V. Levin @ 2020-10-24  8:23 UTC (permalink / raw)
  To: Vitaly Chikunov; +Cc: bpf, Will Deacon, Alexei Starovoitov, Daniel Borkmann

Hi,

On Sat, Oct 24, 2020 at 02:06:41AM +0300, Vitaly Chikunov wrote:
> Hi,
> 
> Commit f143c11bb7b9 ("tools: bpf: Use local copy of headers including
> uapi/linux/filter.h") introduces compilation issue on powerpc:
>  
>   builder@powerpc64le:~/linux$ make -C tools/bpf V=1
>   make: Entering directory '/usr/src/linux/tools/bpf'
>   gcc -Wall -O2 -D__EXPORTED_HEADERS__ -I/usr/src/linux/tools/include/uapi -I/usr/src/linux/tools/include -DDISASM_FOUR_ARGS_SIGNATURE -c -o bpf_dbg.o /usr/src/linux/tools/bpf/bpf_dbg.c
>   In file included from /usr/include/asm/sigcontext.h:14,
> 		   from /usr/include/bits/sigcontext.h:30,
> 		   from /usr/include/signal.h:291,
> 		   from /usr/src/linux/tools/bpf/bpf_dbg.c:51:
>   /usr/include/asm/elf.h:160:9: error: unknown type name '__vector128'
>     160 | typedef __vector128 elf_vrreg_t;
> 	|         ^~~~~~~~~~~
>   make: *** [Makefile:67: bpf_dbg.o] Error 1
>   make: Leaving directory '/usr/src/linux/tools/bpf'

__vector128 is defined in arch/powerpc/include/uapi/asm/types.h;
while include/uapi/linux/types.h does #include <asm/types.h>,
tools/include/uapi/linux/types.h doesn't, resulting to this
compilation error.


-- 
ldv

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

* Re: tools/bpf: Compilation issue on powerpc: unknown type name '__vector128'
  2020-10-24  8:23 ` Dmitry V. Levin
@ 2020-10-24 20:30   ` Vitaly Chikunov
  2020-10-26  4:45     ` Michael Ellerman
  0 siblings, 1 reply; 5+ messages in thread
From: Vitaly Chikunov @ 2020-10-24 20:30 UTC (permalink / raw)
  To: bpf, Will Deacon, Alexei Starovoitov, Daniel Borkmann, netdev,
	Michael Ellerman, Naveen N. Rao, Sandipan Das
  Cc: Dmitry V. Levin

Adding netdev and PowerPC maintainers JFYI.

On Sat, Oct 24, 2020 at 11:23:19AM +0300, Dmitry V. Levin wrote:
> Hi,
> 
> On Sat, Oct 24, 2020 at 02:06:41AM +0300, Vitaly Chikunov wrote:
> > Hi,
> > 
> > Commit f143c11bb7b9 ("tools: bpf: Use local copy of headers including
> > uapi/linux/filter.h") introduces compilation issue on powerpc:
> >  
> >   builder@powerpc64le:~/linux$ make -C tools/bpf V=1
> >   make: Entering directory '/usr/src/linux/tools/bpf'
> >   gcc -Wall -O2 -D__EXPORTED_HEADERS__ -I/usr/src/linux/tools/include/uapi -I/usr/src/linux/tools/include -DDISASM_FOUR_ARGS_SIGNATURE -c -o bpf_dbg.o /usr/src/linux/tools/bpf/bpf_dbg.c
> >   In file included from /usr/include/asm/sigcontext.h:14,
> > 		   from /usr/include/bits/sigcontext.h:30,
> > 		   from /usr/include/signal.h:291,
> > 		   from /usr/src/linux/tools/bpf/bpf_dbg.c:51:
> >   /usr/include/asm/elf.h:160:9: error: unknown type name '__vector128'
> >     160 | typedef __vector128 elf_vrreg_t;
> > 	|         ^~~~~~~~~~~
> >   make: *** [Makefile:67: bpf_dbg.o] Error 1
> >   make: Leaving directory '/usr/src/linux/tools/bpf'
> 
> __vector128 is defined in arch/powerpc/include/uapi/asm/types.h;
> while include/uapi/linux/types.h does #include <asm/types.h>,
> tools/include/uapi/linux/types.h doesn't, resulting to this
> compilation error.

This is too puzzling to fix portably.

Thanks,

> 
> 
> -- 
> ldv

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

* Re: tools/bpf: Compilation issue on powerpc: unknown type name '__vector128'
  2020-10-24 20:30   ` Vitaly Chikunov
@ 2020-10-26  4:45     ` Michael Ellerman
  2020-10-26  8:46       ` Will Deacon
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2020-10-26  4:45 UTC (permalink / raw)
  To: Vitaly Chikunov, bpf, Will Deacon, Alexei Starovoitov,
	Daniel Borkmann, netdev, Naveen N. Rao, Sandipan Das
  Cc: Dmitry V. Levin, Arnaldo Carvalho de Melo

Vitaly Chikunov <vt@altlinux.org> writes:
> Adding netdev and PowerPC maintainers JFYI.

Thanks.

> On Sat, Oct 24, 2020 at 11:23:19AM +0300, Dmitry V. Levin wrote:
>> Hi,
>> 
>> On Sat, Oct 24, 2020 at 02:06:41AM +0300, Vitaly Chikunov wrote:
>> > Hi,
>> > 
>> > Commit f143c11bb7b9 ("tools: bpf: Use local copy of headers including
>> > uapi/linux/filter.h") introduces compilation issue on powerpc:
>> >  
>> >   builder@powerpc64le:~/linux$ make -C tools/bpf V=1
>> >   make: Entering directory '/usr/src/linux/tools/bpf'
>> >   gcc -Wall -O2 -D__EXPORTED_HEADERS__ -I/usr/src/linux/tools/include/uapi -I/usr/src/linux/tools/include -DDISASM_FOUR_ARGS_SIGNATURE -c -o bpf_dbg.o /usr/src/linux/tools/bpf/bpf_dbg.c

Defining __EXPORTED_HEADERS__ is a hack to circumvent the checks in the
uapi headers.

So first comment is to stop doing that, although it doesn't actually fix
this issue.

>> >   In file included from /usr/include/asm/sigcontext.h:14,
>> > 		   from /usr/include/bits/sigcontext.h:30,
>> > 		   from /usr/include/signal.h:291,
>> > 		   from /usr/src/linux/tools/bpf/bpf_dbg.c:51:
>> >   /usr/include/asm/elf.h:160:9: error: unknown type name '__vector128'
>> >     160 | typedef __vector128 elf_vrreg_t;
>> > 	|         ^~~~~~~~~~~
>> >   make: *** [Makefile:67: bpf_dbg.o] Error 1
>> >   make: Leaving directory '/usr/src/linux/tools/bpf'
>> 
>> __vector128 is defined in arch/powerpc/include/uapi/asm/types.h;
>> while include/uapi/linux/types.h does #include <asm/types.h>,
>> tools/include/uapi/linux/types.h doesn't, resulting to this
>> compilation error.
>
> This is too puzzling to fix portably.

I don't really understand how this is expected to work.

We have tools/include/uapi/linux/types.h which is some sort of hand
hacked types.h, but doesn't match the real types.h from
include/uapi/linux.

In particular the tools/include types.h doesn't include asm/types.h,
which is why this breaks.

I can build bpf_dbg if I copy the properly exported header in:

  $ make INSTALL_HDR_PATH=$PWD/headers headers_install
  $ cp headers/include/linux/types.h tools/include/uapi/linux/
  $ make -C tools/bpf bpf_dbg
  make: Entering directory '/home/michael/linux/tools/bpf'
  
  Auto-detecting system features:
  ...                        libbfd: [ on  ]
  ...        disassembler-four-args: [ on  ]
  
    CC       bpf_dbg.o
    LINK     bpf_dbg
  make: Leaving directory '/home/michael/linux/tools/bpf


I'm not sure what the proper fix is.

Maybe sync the tools/include types.h with the real one?

Or TBH I would have thought the best option is to not have
tools/include/uapi at all, but instead just run headers_install before
building and use the properly exported headers.

cheers


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

* Re: tools/bpf: Compilation issue on powerpc: unknown type name '__vector128'
  2020-10-26  4:45     ` Michael Ellerman
@ 2020-10-26  8:46       ` Will Deacon
  0 siblings, 0 replies; 5+ messages in thread
From: Will Deacon @ 2020-10-26  8:46 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Vitaly Chikunov, bpf, Alexei Starovoitov, Daniel Borkmann,
	netdev, Naveen N. Rao, Sandipan Das, Dmitry V. Levin,
	Arnaldo Carvalho de Melo

On Mon, Oct 26, 2020 at 03:45:55PM +1100, Michael Ellerman wrote:
> Vitaly Chikunov <vt@altlinux.org> writes:
> > Adding netdev and PowerPC maintainers JFYI.
> 
> Thanks.
> 
> > On Sat, Oct 24, 2020 at 11:23:19AM +0300, Dmitry V. Levin wrote:
> >> Hi,
> >> 
> >> On Sat, Oct 24, 2020 at 02:06:41AM +0300, Vitaly Chikunov wrote:
> >> > Hi,
> >> > 
> >> > Commit f143c11bb7b9 ("tools: bpf: Use local copy of headers including
> >> > uapi/linux/filter.h") introduces compilation issue on powerpc:
> >> >  
> >> >   builder@powerpc64le:~/linux$ make -C tools/bpf V=1
> >> >   make: Entering directory '/usr/src/linux/tools/bpf'
> >> >   gcc -Wall -O2 -D__EXPORTED_HEADERS__ -I/usr/src/linux/tools/include/uapi -I/usr/src/linux/tools/include -DDISASM_FOUR_ARGS_SIGNATURE -c -o bpf_dbg.o /usr/src/linux/tools/bpf/bpf_dbg.c
> 
> Defining __EXPORTED_HEADERS__ is a hack to circumvent the checks in the
> uapi headers.
> 
> So first comment is to stop doing that, although it doesn't actually fix
> this issue.
> 
> >> >   In file included from /usr/include/asm/sigcontext.h:14,
> >> > 		   from /usr/include/bits/sigcontext.h:30,
> >> > 		   from /usr/include/signal.h:291,
> >> > 		   from /usr/src/linux/tools/bpf/bpf_dbg.c:51:
> >> >   /usr/include/asm/elf.h:160:9: error: unknown type name '__vector128'
> >> >     160 | typedef __vector128 elf_vrreg_t;
> >> > 	|         ^~~~~~~~~~~
> >> >   make: *** [Makefile:67: bpf_dbg.o] Error 1
> >> >   make: Leaving directory '/usr/src/linux/tools/bpf'
> >> 
> >> __vector128 is defined in arch/powerpc/include/uapi/asm/types.h;
> >> while include/uapi/linux/types.h does #include <asm/types.h>,
> >> tools/include/uapi/linux/types.h doesn't, resulting to this
> >> compilation error.
> >
> > This is too puzzling to fix portably.
> 
> I don't really understand how this is expected to work.
> 
> We have tools/include/uapi/linux/types.h which is some sort of hand
> hacked types.h, but doesn't match the real types.h from
> include/uapi/linux.
> 
> In particular the tools/include types.h doesn't include asm/types.h,
> which is why this breaks.
> 
> I can build bpf_dbg if I copy the properly exported header in:
> 
>   $ make INSTALL_HDR_PATH=$PWD/headers headers_install
>   $ cp headers/include/linux/types.h tools/include/uapi/linux/
>   $ make -C tools/bpf bpf_dbg
>   make: Entering directory '/home/michael/linux/tools/bpf'
>   
>   Auto-detecting system features:
>   ...                        libbfd: [ on  ]
>   ...        disassembler-four-args: [ on  ]
>   
>     CC       bpf_dbg.o
>     LINK     bpf_dbg
>   make: Leaving directory '/home/michael/linux/tools/bpf
> 
> 
> I'm not sure what the proper fix is.
> 
> Maybe sync the tools/include types.h with the real one?

Yeah, all f143c11bb7b9 did was sync the local copy with the result of
'headers_install', so if that's sufficient then I think that's the right
way to fix the immediate breakage.

> Or TBH I would have thought the best option is to not have
> tools/include/uapi at all, but instead just run headers_install before
> building and use the properly exported headers.

Agreed, although in some cases I suspect that kernel-internal parts are
being used.

Wiil

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

end of thread, other threads:[~2020-10-26  8:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-23 23:06 tools/bpf: Compilation issue on powerpc: unknown type name '__vector128' Vitaly Chikunov
2020-10-24  8:23 ` Dmitry V. Levin
2020-10-24 20:30   ` Vitaly Chikunov
2020-10-26  4:45     ` Michael Ellerman
2020-10-26  8:46       ` Will Deacon

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