* [PATCH] selftests:dma: Fix compile error in user-space tool
@ 2023-01-09 18:07 Gerd Bayer
2023-01-12 20:36 ` Shuah Khan
0 siblings, 1 reply; 4+ messages in thread
From: Gerd Bayer @ 2023-01-09 18:07 UTC (permalink / raw)
To: Xiang Chen, Shuah Khan
Cc: Joerg Roedel, iommu, linux-kselftest, Niklas Schnelle
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 anymore.
While https://kernelnewbies.org/KernelHeaders suggests otherwise, allow it
to use kernel headers through the uapi/ include directory. 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, arm64, and s390 and runs on ARCH=s390.
[1] commit 8ddde07a3d28 ("dma-mapping: benchmark: extract a common header
file for map_benchmark definition")
Signed-off-by: Gerd Bayer <gbayer@linux.ibm.com>
Acked-by: Xiang Chen <chenxiang66@hisilicon.com>
---
tools/testing/selftests/dma/dma_map_benchmark.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/dma/dma_map_benchmark.c b/tools/testing/selftests/dma/dma_map_benchmark.c
index 5c997f17fcbd..d49d7ea6a63e 100644
--- a/tools/testing/selftests/dma/dma_map_benchmark.c
+++ b/tools/testing/selftests/dma/dma_map_benchmark.c
@@ -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: 1fe4fd6f5cad346e598593af36caeadc4f5d4fa9
--
2.39.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests:dma: Fix compile error in user-space tool
2023-01-09 18:07 [PATCH] selftests:dma: Fix compile error in user-space tool Gerd Bayer
@ 2023-01-12 20:36 ` Shuah Khan
2023-01-13 16:52 ` Gerd Bayer
0 siblings, 1 reply; 4+ messages in thread
From: Shuah Khan @ 2023-01-12 20:36 UTC (permalink / raw)
To: Gerd Bayer, Xiang Chen, Shuah Khan
Cc: Joerg Roedel, iommu, linux-kselftest, Niklas Schnelle, Shuah Khan
On 1/9/23 11:07, Gerd Bayer wrote:
> 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 anymore.
>
> While https://kernelnewbies.org/KernelHeaders suggests otherwise, allow it
> to use kernel headers through the uapi/ include directory. 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, arm64, and s390 and runs on ARCH=s390.
>
> [1] commit 8ddde07a3d28 ("dma-mapping: benchmark: extract a common header
> file for map_benchmark definition")
>
> Signed-off-by: Gerd Bayer <gbayer@linux.ibm.com>
> Acked-by: Xiang Chen <chenxiang66@hisilicon.com>
> ---
> tools/testing/selftests/dma/dma_map_benchmark.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/dma/dma_map_benchmark.c b/tools/testing/selftests/dma/dma_map_benchmark.c
> index 5c997f17fcbd..d49d7ea6a63e 100644
> --- a/tools/testing/selftests/dma/dma_map_benchmark.c
> +++ b/tools/testing/selftests/dma/dma_map_benchmark.c
> @@ -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: 1fe4fd6f5cad346e598593af36caeadc4f5d4fa9
On Linux 6.2-rc3, dma_map_benchmark compiles just fine. You do
have to do "make headers_install" first as kselftest depends
on headers being installed in the repo.
Please let me know if you are seeing compile problems even after
installing headers.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests:dma: Fix compile error in user-space tool
2023-01-12 20:36 ` Shuah Khan
@ 2023-01-13 16:52 ` Gerd Bayer
2023-01-13 18:15 ` Shuah Khan
0 siblings, 1 reply; 4+ messages in thread
From: Gerd Bayer @ 2023-01-13 16:52 UTC (permalink / raw)
To: Shuah Khan, Xiang Chen, Shuah Khan
Cc: Joerg Roedel, iommu, linux-kselftest, Niklas Schnelle
On Thu, 2023-01-12 at 13:36 -0700, Shuah Khan wrote:
> On 1/9/23 11:07, Gerd Bayer wrote:
> > With this change dma_map_benchmark compiles with just the obvious
> > warning
> > about uapi usage on ARCH=x86, arm64, and s390 and runs on
> > ARCH=s390.
>
> On Linux 6.2-rc3, dma_map_benchmark compiles just fine. You do
> have to do "make headers_install" first as kselftest depends
> on headers being installed in the repo.
>
> Please let me know if you are seeing compile problems even after
> installing headers.
>
> thanks,
> -- Shuah
Hi Shuah,
thank you for this clarification. Once I run "make headers_install"
before attempting to build the dma_benchmark_test executable with
make -C tools/testing/selftests/ TARGETS="dma"
everything works out nicely - even w/o my patch.
I have to apologize for creating this fuzz. I was not aware that one of
the dependencies for "make kselftest" was "make headers_install", since
I was going straight for the interactive "dma_benchmark_test" control
tool of the test that is implemented in kernel/dma/benchmark_test.c.
I didn't intend to run the full "make kselftest" suite, primarily since
I have distinct test and build systems - most often building cross-
arch, even.
So please, disregard the PATCH.
Thank you,
Gerd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests:dma: Fix compile error in user-space tool
2023-01-13 16:52 ` Gerd Bayer
@ 2023-01-13 18:15 ` Shuah Khan
0 siblings, 0 replies; 4+ messages in thread
From: Shuah Khan @ 2023-01-13 18:15 UTC (permalink / raw)
To: Gerd Bayer, Xiang Chen, Shuah Khan
Cc: Joerg Roedel, iommu, linux-kselftest, Niklas Schnelle, Shuah Khan
On 1/13/23 09:52, Gerd Bayer wrote:
> On Thu, 2023-01-12 at 13:36 -0700, Shuah Khan wrote:
>> On 1/9/23 11:07, Gerd Bayer wrote:
>>> With this change dma_map_benchmark compiles with just the obvious
>>> warning
>>> about uapi usage on ARCH=x86, arm64, and s390 and runs on
>>> ARCH=s390.
>>
>> On Linux 6.2-rc3, dma_map_benchmark compiles just fine. You do
>> have to do "make headers_install" first as kselftest depends
>> on headers being installed in the repo.
>>
>> Please let me know if you are seeing compile problems even after
>> installing headers.
>>
>> thanks,
>> -- Shuah
>
> Hi Shuah,
>
> thank you for this clarification. Once I run "make headers_install"
> before attempting to build the dma_benchmark_test executable with
> make -C tools/testing/selftests/ TARGETS="dma"
> everything works out nicely - even w/o my patch.
>
> I have to apologize for creating this fuzz. I was not aware that one of
> the dependencies for "make kselftest" was "make headers_install", since
> I was going straight for the interactive "dma_benchmark_test" control
> tool of the test that is implemented in kernel/dma/benchmark_test.c.
> I didn't intend to run the full "make kselftest" suite, primarily since
> I have distinct test and build systems - most often building cross-
> arch, even.
>
No worries. The reason for this dependency is to ensure kselftest can
test the kernel properly. Tests for new or enhanced kernel features
depend on mew headers. headers_install has been dependency for kselftest
from the beginning and some individual tests depend on it.
The main Makefile (make kselftest) enforces the dependency and installs
headers first. You can use the following commands to compile/run dma test.
This will install the headers and then compile/run dma test.
make kselftest-all TARGETS=dma (compile)
make kselftest TARGETS=dma (compile and run)
> So please, disregard the PATCH.
Done.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-01-13 18:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-09 18:07 [PATCH] selftests:dma: Fix compile error in user-space tool Gerd Bayer
2023-01-12 20:36 ` Shuah Khan
2023-01-13 16:52 ` Gerd Bayer
2023-01-13 18:15 ` Shuah Khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox