tools include: Add __sum16 and __wsum definitions.
Subsystems (3)
PATCH 1/1 tools include: Add __sum16 and __wsum definitions.
This adds definitions available in the uapi version.
Explanation:
In the kernel include of types.h the uapi version is included. In tools the uapi/linux/types.h and linux/types.h are distinct. For BPF programs a definition of __wsum is needed by the generated bpf_helpers.h. The definition comes either from a generated vmlinux.h or from <linux/types.h> that may be transitively included from bpf.h. The perf build prefers linux/types.h over uapi/linux/types.h for <linux/types.h>*. To allow tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c to compile with the same include path used for perf then these definitions are necessary.
There is likely a wider conversation about exactly how types.h should be specified and the include order used by the perf build - it is somewhat confusing that tools/include/uapi/linux/bpf.h is using the non-uapi types.h.
*see tools/perf/Makefile.config:
...INC_FLAGS += -I$(srctree)/tools/include/INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi INC_FLAGS += -I$(srctree)/tools/include/uapi
...
The include directories are scanned from left-to-right:
https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html
As tools/include/linux/types.h appears before tools/include/uapi/linux/types.h then I say it is preferred.
--- tools/include/linux/types.h | 3 +++ 1 file changed, 3 insertions(+)
tools/include/linux/types.h +3 -0
@@ -61,6 +61,9 @@ typedef __u32 __bitwise __be32;typedef __u64 __bitwise __le64 ;typedef __u64 __bitwise __be64 ; +typedef __u16 __bitwise __sum16 ; +typedef __u32 __bitwise __wsum ; +typedef struct {int counter; }atomic_t ;
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
Daniel Borkmann
maintainerQuoted 29 lines · Ian Rogers
This adds definitions available in the uapi version.
Explanation:
In the kernel include oftypes.hthe uapi version is included. In tools theuapi/linux/types.handlinux/types.hare distinct. For BPF programs a definition of__wsumis needed by the generatedbpf_helpers.h. The definition comes either from a generatedvmlinux.hor from <linux/types.h> that may be transitively included frombpf.h. The perf build preferslinux/types.hoveruapi/linux/types.hfor <linux/types.h>*. To allowtools/perf/util/bpf_skel/bpf_prog_profiler.bpf.cto compile with the same include path used for perf then these definitions are necessary.There is likely a wider conversation about exactly how
types.hshould be specified and the include order used by the perf build - it is somewhat confusing thattools/include/uapi/linux/bpf.his using the non-uapitypes.h.*see
tools/perf/Makefile.config:
...INC_FLAGS+= -I$(srctree)/tools/include/INC_FLAGS+= -I$(srctree)/tools/arch/$(SRCARCH)/include/uapiINC_FLAGS+= -I$(srctree)/tools/include/uapi
...
The include directories are scanned from left-to-right:
https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html
Astools/include/linux/types.happears beforetools/include/uapi/linux/types.hthen I say it is preferred.
Quoted 1 line
Signed-off-by Ian Rogers <[email protected]>
Given more related to perf build infra, I presume Arnaldo would pick this one up?
Thanks,
Daniel
Em Mon, Mar 08, 2021 at 02:37:32PM +0100, Daniel Borkmann escreveu:
Quoted 30 lines · Ian Rogers
Quoted 29 lines
This adds definitions available in the uapi version.
Explanation:
In the kernel include oftypes.hthe uapi version is included. In tools theuapi/linux/types.handlinux/types.hare distinct. For BPF programs a definition of__wsumis needed by the generatedbpf_helpers.h. The definition comes either from a generatedvmlinux.hor from <linux/types.h> that may be transitively included frombpf.h. The perf build preferslinux/types.hoveruapi/linux/types.hfor <linux/types.h>*. To allowtools/perf/util/bpf_skel/bpf_prog_profiler.bpf.cto compile with the same include path used for perf then these definitions are necessary.There is likely a wider conversation about exactly how
types.hshould be specified and the include order used by the perf build - it is somewhat confusing thattools/include/uapi/linux/bpf.his using the non-uapitypes.h.*see
tools/perf/Makefile.config:
...INC_FLAGS+= -I$(srctree)/tools/include/INC_FLAGS+= -I$(srctree)/tools/arch/$(SRCARCH)/include/uapiINC_FLAGS+= -I$(srctree)/tools/include/uapi
...
The include directories are scanned from left-to-right:
https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html
Astools/include/linux/types.happears beforetools/include/uapi/linux/types.hthen I say it is preferred.
Quoted 4 lines
Quoted 1 line
Signed-off-by Ian Rogers <[email protected]>Given more related to perf build infra, I presume Arnaldo would pick this one up?
I'll process it.
- Arnaldo