Skip to contentSkip to conversation

dma-mapping: benchmark: Fix compile error in user-space tool

PATCH In review Gerd Bayer 4 participants 8 messages Dec 5, 2022 – Jan 9, 2023 Kselftest

lore
Share & tools
lore

Gerd Bayer

author
#0 lore raw

PATCH 1/1 dma-mapping: benchmark: Fix compile error in user-space tool

Since [1] the user-space program dma_map_benchmark shares the header file linux/map_benchmark.h with the kernel driver in kernel/dma/map_benchmark.c. With latest kernel version this does not compile any more.

While https://kernelnewbies.org/KernelHeaders suggests otherwise, allow it to use of kernel headers through the uapi/ include direcotry. I assume we can do so safely, since the controlling user-space program is distributed with the kernel.

With this change dma_map_benchmark compiles with just the obvious warning about uapi usage on ARCH=x86 and s390 and runs on ARCH=s390.

[1] commit 8ddde07a3d28 ("dma-mapping: benchmark: extract a common header file for map_benchmark definition")

---
 tools/testing/selftests/dma/dma_map_benchmark.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/dma/dma_map_benchmark.c +1 -1
index 5c997f17fcbd..d49d7ea6a63e 100644
@@ -10,7 +10,7 @@
 #include <unistd.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
-#include <linux/types.h>
+#include <uapi/linux/types.h>
 #include <linux/map_benchmark.h>
 
 #define NSEC_PER_MSEC	1000000L

base-commit: 8abacb3356e68261ccd3a2ad74ed6042363e5d0f

Signature · 1 line
2.38.1
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Gerd Bayer

Since [1] the user-space program dma_map_benchmark shares the header file linux/map_benchmark.h with the kernel driver in kernel/dma/map_benchmark.c. With latest kernel version this does not compile any more.

While https://kernelnewbies.org/KernelHeaders suggests otherwise, allow it to use of kernel headers through the uapi/ include direcotry. I assume we can do so safely, since the controlling user-space program is distributed with the kernel.

Quoted 6 lines

With this change dma_map_benchmark compiles with just the obvious warning about uapi usage on ARCH=x86 and s390 and runs on ARCH=s390.

[1] commit 8ddde07a3d28 ("dma-mapping: benchmark: extract a common header file for map_benchmark definition")

It also solves the compile error on arm64 platform.

Quoted 19 lines
---
  tools/testing/selftests/dma/dma_map_benchmark.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/dma/dma_map_benchmark.c +1 -1
index 5c997f17fcbd..d49d7ea6a63e 100644
@@ -10,7 +10,7 @@
  #include <unistd.h>
  #include <sys/ioctl.h>
  #include <sys/mman.h>
-#include <linux/types.h>
+#include <uapi/linux/types.h>
  #include <linux/map_benchmark.h>
 
  #define NSEC_PER_MSEC	1000000L

base-commit: 8abacb3356e68261ccd3a2ad74ed6042363e5d0f

author
#2 lore raw
Quoted 20 lines · chenxiang (M)
Quoted 18 lines · Gerd Bayer

Since [1] the user-space program dma_map_benchmark shares the header file
linux/map_benchmark.h with the kernel driver in kernel/dma/map_benchmark.c.
With latest kernel version this does not compile any more.

While https://kernelnewbies.org/KernelHeaders suggests otherwise, allow it
to use of kernel headers through the uapi/ include direcotry. I assume we can
do so safely, since the controlling user-space program is distributed with
the kernel.

With this change dma_map_benchmark compiles with just the obvious warning
about uapi usage on ARCH=x86 and s390 and runs on ARCH=s390.

Quoted 7 lines
Quoted 4 lines

[1] commit 8ddde07a3d28 ("dma-mapping: benchmark: extract a common header file for map_benchmark definition")

It also solves the compile error on arm64 platform.

Hi Xiang Chen, hi Shuah,

so is there any chance to have this compile fix integrated into linux- next still, or is this too late now?

Thanks,
Gerd

Quoted 22 lines
Quoted 21 lines

---
  tools/testing/selftests/dma/dma_map_benchmark.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/dma/dma_map_benchmark.c +1 -1
index 5c997f17fcbd..d49d7ea6a63e 100644
@@ -10,7 +10,7 @@
   #include <unistd.h>
   #include <sys/ioctl.h>
   #include <sys/mman.h>
-#include <linux/types.h>
+#include <uapi/linux/types.h>
   #include <linux/map_benchmark.h>


  #define NSEC_PER_MSEC 1000000L

base-commit: 8abacb3356e68261ccd3a2ad74ed6042363e5d0f

#3 lore raw

+cc Christoph Hellwig

Quoted 56 lines · Gerd Bayer
Quoted 19 lines · chenxiang (M)
Quoted 18 lines · Gerd Bayer

Since [1] the user-space program dma_map_benchmark shares the header file
linux/map_benchmark.h with the kernel driver in kernel/dma/map_benchmark.c.
With latest kernel version this does not compile any more.

While https://kernelnewbies.org/KernelHeaders suggests otherwise, allow it
to use of kernel headers through the uapi/ include direcotry. I assume we can
do so safely, since the controlling user-space program is distributed with
the kernel.

With this change dma_map_benchmark compiles with just the obvious warning
about uapi usage on ARCH=x86 and s390 and runs on ARCH=s390.

Quoted 6 lines
Quoted 4 lines

[1] commit 8ddde07a3d28 ("dma-mapping: benchmark: extract a common header file for map_benchmark definition")

It also solves the compile error on arm64 platform.

Hi Xiang Chen, hi Shuah,

so is there any chance to have this compile fix integrated into linux- next still, or is this too late now?

Thanks,
Gerd

Quoted 17 lines
Quoted 17 lines
---
   tools/testing/selftests/dma/dma_map_benchmark.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/dma/dma_map_benchmark.c +1 -1
index 5c997f17fcbd..d49d7ea6a63e 100644
@@ -10,7 +10,7 @@
   #include <unistd.h>
   #include <sys/ioctl.h>
   #include <sys/mman.h>
-#include <linux/types.h>
+#include <uapi/linux/types.h>
   #include <linux/map_benchmark.h>
 
Quoted 3 lines
Quoted 3 lines
tools/testing/selftests/dma/dma_map_benchmark.c +0 -0
   #define NSEC_PER_MSEC 1000000L

base-commit: 8abacb3356e68261ccd3a2ad74ed6042363e5d0f

.

#4 lore raw

Can you explain what the problem is? I just say a maze of quotes and top posting replies.

maintainer
#5 lore raw
In reply to Gerd Bayer
Quoted 26 lines · Gerd Bayer
Quoted 25 lines · chenxiang (M)
Quoted 22 lines · Gerd Bayer

Since [1] the user-space program dma_map_benchmark shares the header file
linux/map_benchmark.h with the kernel driver in kernel/dma/map_benchmark.c.
With latest kernel version this does not compile any more.

While https://kernelnewbies.org/KernelHeaders suggests otherwise, allow it
to use of kernel headers through the uapi/ include direcotry. I assume we can
do so safely, since the controlling user-space program is distributed with
the kernel.

With this change dma_map_benchmark compiles with just the obvious warning
about uapi usage on ARCH=x86 and s390 and runs on ARCH=s390.

[1] commit 8ddde07a3d28 ("dma-mapping: benchmark: extract a common header file for map_benchmark definition")

Quoted 7 lines
Quoted 2 lines

It also solves the compile error on arm64 platform.

Hi Xiang Chen, hi Shuah,

so is there any chance to have this compile fix integrated into linux- next still, or is this too late now?

Plan to apply this after the merge window closes

thanks,
-- Shuah

maintainer
#6 lore raw
Quoted 27 lines · Shuah Khan
Quoted 26 lines · Gerd Bayer
Quoted 25 lines · chenxiang (M)
Quoted 22 lines · Gerd Bayer

Since [1] the user-space program dma_map_benchmark shares the header file
linux/map_benchmark.h with the kernel driver in kernel/dma/map_benchmark.c.
With latest kernel version this does not compile any more.

While https://kernelnewbies.org/KernelHeaders suggests otherwise, allow it
to use of kernel headers through the uapi/ include direcotry. I assume we can
do so safely, since the controlling user-space program is distributed with
the kernel.

With this change dma_map_benchmark compiles with just the obvious warning
about uapi usage on ARCH=x86 and s390 and runs on ARCH=s390.

[1] commit 8ddde07a3d28 ("dma-mapping: benchmark: extract a common header file for map_benchmark definition")

Quoted 9 lines
Quoted 7 lines
Quoted 2 lines

It also solves the compile error on arm64 platform.

Hi Xiang Chen, hi Shuah,

so is there any chance to have this compile fix integrated into linux- next still, or is this too late now?

Plan to apply this after the merge window closes

The reason for the delay is this patch doesn't have the right commit header. This should have been "selftests:dma -----"

It makes it easier for maintainers to parse and pay attention to the patches if they indicate the area they fall under. Something to keep in mind for your future patches.

Please resend the patch with the Acks you received and a correct commit header.

thanks,
-- Shuah

author
#7 lore raw
Quoted 10 lines · Shuah Khan
Quoted 9 lines · Shuah Khan
Quoted 8 lines · Gerd Bayer
Quoted 7 lines · chenxiang (M)
Quoted 5 lines · Gerd Bayer

Since [1] the user-space program dma_map_benchmark shares the header file
linux/map_benchmark.h with the kernel driver in kernel/dma/map_benchmark.c.
With latest kernel version this does not compile any more.

[...]

Quoted 19 lines
Quoted 11 lines
Quoted 9 lines
Quoted 3 lines

It also solves the compile error on arm64 platform.

Hi Xiang Chen, hi Shuah,

so is there any chance to have this compile fix integrated into linux-
next still, or is this too late now?

Plan to apply this after the merge window closes

The reason for the delay is this patch doesn't have the right commit header. This should have been "selftests:dma -----"

It makes it easier for maintainers to parse and pay attention to the patches if they indicate the area they fall under. Something to keep in mind for your future patches.

Quoted 5 lines

Please resend the patch with the Acks you received and a correct commit header.

thanks,
-- Shuah

Shuah,

thank you for your explanation. I'm working on resending the patch.

Thanks,
Gerd