Open-CAS / standalone-linux-io-tracer

Standalone Linux IO Tracer (iotrace) is a tool for block device and filesystem I/O tracing
BSD 3-Clause "New" or "Revised" License
58 stars 22 forks source link

ubuntu 20.04 compile incomplete definition of type 'struct folio' #282

Closed boycechen closed 6 months ago

boycechen commented 1 year ago

@mariuszbarczak @robertbaldyga @micrakow @mmkayPL ### I build the source code on ubuntu 20.04 with kernel 5.15.0-60-generic, but it fails with error in 98% progress as follows:

[ 98%] [clang] Building BPF object: iotrace In file included from /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.c:12:

/root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:191:37: error: incomplete definition of type 'struct folio' struct address_space *mapping = BPF_CORE_READ(folio, mapping); ^~~~~~~~~ /usr/include/bpf/bpf_core_read.h:403:2: note: expanded from macro 'BPF_CORE_READ' _type((src), a, ##__VA_ARGS) __r; \ ^~~~~~~~ /usr/include/bpf/bpf_core_read.h:274:29: note: expanded from macro '___type'

define type(...) typeof(arrow(__VA_ARGS__))

                        ^~~~~~~~~~~~~~~~~~~~~

/usr/include/bpf/bpf_core_read.h:272:23: note: expanded from macro '___arrow'

define arrow(...) apply(arrow, narg(VA_ARGS))(VA_ARGS)

                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) /usr/include/bpf/bpf_core_read.h:223:25: note: expanded from macro '___concat'

define ___concat(a, b) a ## b

                    ^
:64:1: note: expanded from here ___arrow2 ^ /usr/include/bpf/bpf_core_read.h:263:26: note: expanded from macro '___arrow2' #define ___arrow2(a, b) a->b ~^ /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:185:31: note: forward declaration of 'struct folio' static __always_inline struct folio *page_folio(struct page *page) { ^ /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:191:37: **error: incomplete definition of type 'struct folio'** struct address_space *mapping = BPF_CORE_READ(folio, mapping); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:404:2: note: expanded from macro 'BPF_CORE_READ' BPF_CORE_READ_INTO(&__r, (src), a, ##__VA_ARGS__); \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:311:2: note: expanded from macro 'BPF_CORE_READ_INTO' ___core_read(bpf_core_read, bpf_core_read, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:302:2: note: expanded from macro '___core_read' ___apply(___core_read, ___empty(__VA_ARGS__))(fn, fn_ptr, dst, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) /usr/include/bpf/bpf_core_read.h:296:2: note: expanded from macro '___core_read0' ___read(fn, dst, ___type(src), src, a); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:277:59: note: expanded from macro '___read' read_fn((void *)(dst), sizeof(*(dst)), &((src_type)(src))->accessor) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:206:79: note: expanded from macro 'bpf_core_read' bpf_probe_read_kernel(dst, sz, (const void *)__builtin_preserve_access_index(src)) ^~~ /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:185:31: note: forward declaration of 'struct folio' static __always_inline struct folio *page_folio(struct page *page) { ^ /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:191:27: **error: initializing 'struct address_space *' with an expression of incompatible type 'void'** struct address_space *mapping = BPF_CORE_READ(folio, mapping); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:201:48: **error: use of undeclared identifier 'PG_readahead'** return BPF_CORE_READ(page, flags) & (1UL < PG_readahead); ^ /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:231:20: **error: incomplete definition of type 'struct folio'** return NULL != BPF_CORE_READ(folio, mapping); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:403:2: note: expanded from macro 'BPF_CORE_READ' ___type((src), a, ##__VA_ARGS__) __r; \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:274:29: note: expanded from macro '___type' #define ___type(...) typeof(___arrow(__VA_ARGS__)) ^~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:272:23: note: expanded from macro '___arrow' #define ___arrow(...) ___apply(___arrow, ___narg(__VA_ARGS__))(__VA_ARGS__) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) /usr/include/bpf/bpf_core_read.h:223:25: note: expanded from macro '___concat' #define ___concat(a, b) a ## b ^ :79:1: note: expanded from here ___arrow2 ^ /usr/include/bpf/bpf_core_read.h:263:26: note: expanded from macro '___arrow2' #define ___arrow2(a, b) a->b ~^ /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:185:31: note: forward declaration of 'struct folio' static __always_inline struct folio *page_folio(struct page *page) { ^ /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:231:20: **error: incomplete definition of type 'struct folio'** return NULL != BPF_CORE_READ(folio, mapping); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:404:2: note: expanded from macro 'BPF_CORE_READ' BPF_CORE_READ_INTO(&__r, (src), a, ##__VA_ARGS__); \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:311:2: note: expanded from macro 'BPF_CORE_READ_INTO' ___core_read(bpf_core_read, bpf_core_read, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:302:2: note: expanded from macro '___core_read' ___apply(___core_read, ___empty(__VA_ARGS__))(fn, fn_ptr, dst, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) /usr/include/bpf/bpf_core_read.h:296:2: note: expanded from macro '___core_read0' ___read(fn, dst, ___type(src), src, a); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:277:59: note: expanded from macro '___read' read_fn((void *)(dst), sizeof(*(dst)), &((src_type)(src))->accessor) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ /usr/include/bpf/bpf_core_read.h:206:79: note: expanded from macro 'bpf_core_read' bpf_probe_read_kernel(dst, sz, (const void *)__builtin_preserve_access_index(src)) ^~~ /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:185:31: note: forward declaration of 'struct folio' static __always_inline struct folio *page_folio(struct page *page) { ^ /root/standalone-linux-io-tracer/source/iotrace/iotrace.bpf.defs.h:231:17: **error: invalid operands to binary expression ('void *'** and 'void') return NULL != BPF_CORE_READ(folio, mapping); ~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7 errors generated. make[3]: *** [source/iotrace/CMakeFiles/iotrace.dir/build.make:74: source/iotrace/iotrace.bpf.o] Error 1 make[3]: Leaving directory '/root/standalone-linux-io-tracer/build/release' make[2]: *** [CMakeFiles/Makefile2:2528: source/iotrace/CMakeFiles/iotrace.dir/all] Error 2 make[2]: Leaving directory '/root/standalone-linux-io-tracer/build/release' make[1]: *** [Makefile:152: all] Error 2 make[1]: Leaving directory '/root/standalone-linux-io-tracer/build/release' make: *** [Makefile:40: all] Error 2 How do I to fix the compile issue ?
zwbrealm commented 11 months ago

I have this probolem,too

mariuszbarczak commented 11 months ago

Hi Guys, the main branch is dedicated to work with newer kernels and eBPF. Could you try this branch: master-kernel (https://github.com/Open-CAS/standalone-linux-io-tracer/tree/master-kernel). It sill uses kernel module to collect fetch io traces.

mariuszbarczak commented 7 months ago

@zwbrealm The fix is coming. You can check if this solve your problem,

mariuszbarczak commented 6 months ago

Fix integrated to the main