Re: [PATCH 1/2] tools/dma: move dma_map_benchmark from selftests to tools/dma

From: Qinxin Xia
Date: Wed Aug 27 2025 - 08:07:59 EST




On 2025/8/22 09:12:07, Barry Song <21cnbao@xxxxxxxxx> wrote:

Does usr/include have header files? Did you run make headers_install
before make?
[xiaqinxin@localhost linux]$ make headers_install
HOSTCC scripts/basic/fixdep
HOSTCC scripts/unifdef
WRAP arch/arm64/include/generated/uapi/asm/socket.h
SYSHDR arch/arm64/include/generated/uapi/asm/unistd_64.h
HDRINST usr/include/asm-generic/mman.h
HDRINST usr/include/asm-generic/stat.h
HDRINST usr/include/asm-generic/ucontext.h
HDRINST usr/include/asm-generic/int-ll64.h
HDRINST usr/include/asm-generic/unistd.h
HDRINST usr/include/asm-generic/kvm_para.h
HDRINST usr/include/asm-generic/types.h
HDRINST usr/include/asm-generic/ipcbuf.h
HDRINST usr/include/asm-generic/termbits-common.h
...
[xiaqinxin@localhost linux]$ cd tools/dma/
[xiaqinxin@localhost dma]$ make
cc -I../../usr/include -I../../include dma_map_benchmark.c -o
dma_map_benchmark

This is really frustrating. Why do other parts not need this, but
dma_map_benchmark does? It is also not acceptable to hardcode the
path to usr/include.

It is also not good practice to access a kernel header directly from a
userspace tool - such as -I../../include.

Shouldn't map_benchmark.h be a proper UAPI header that gets installed
into the toolchain like the others?

Hello Barry :

This include file is inherited from the original version, and there are similar

method in other parts :

pcmcia/Makefile:CFLAGS := -I../../usr/include
laptop/dslm/Makefile:CFLAGS := -I../../usr/include
accounting/Makefile:CFLAGS := -I../../usr/include

During compilation, the system searches for header files from ../../usr/include first.

If no header file is found in ../../usr/include, the system attempts to get header files

from the system directory of the compilation environment. So maybe in some compilation

environments, compiling these modules might have the same problem...

'struct map_benchmark' is defined in map_benchmark.h which is used by map_benchmark.c

Do we need to define them separately in the kernel and uapi header files?>>
My test is ok.


Thanks
Barry