selftests/damon: add damon to selftests root Makefile
Subsystems (3)
PATCH RESEND 1/1 selftests/damon: add damon to selftests root Makefile
Currently the damon selftests are not built with the rest of the selftests. We add damon to the list of targets.
--- tools/testing/selftests/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/Makefile +1 -0
@@ -9,6 +9,7 @@ TARGETS += clone3 TARGETS += core TARGETS += cpufreq TARGETS += cpu-hotplug +TARGETS += damon TARGETS += drivers/dma-buf TARGETS += efivarfs TARGETS += exec
Signature · 1 line
2.35.1.265.g69c8d7142f-goog
Quoted 6 lines · Yuanchu Xie
Currently the damon selftests are not built with the rest of the selftests. We add damon to the list of targets.
Fixes b348eb7abd09 ("mm/damon: add user space selftests")Reviewed-by SeongJae Park <[email protected]>Signed-off-by Yuanchu Xie <[email protected]>
Shuah Khan
maintainerQuoted 11 lines · David Rientjes
Quoted 6 lines · Yuanchu Xie
Currently the damon selftests are not built with the rest of the selftests. We add damon to the list of targets.
Fixes b348eb7abd09 ("mm/damon: add user space selftests")Reviewed-by SeongJae Park <[email protected]>Signed-off-by Yuanchu Xie <[email protected]>Acked-by David Rientjes <[email protected]>
Thank you. Applied to linux-kselftest next for 5.19-rc1.
thanks,
-- Shuah
Shuah Khan
maintainerQuoted 6 lines · Shuah Khan
Quoted 5 lines · David Rientjes
Quoted 3 lines · Yuanchu Xie
Currently the damon selftests are not built with the rest of the selftests. We add damon to the list of targets.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Fixes b348eb7abd09 ("mm/damon: add user space selftests")Reviewed-by SeongJae Park <[email protected]>Signed-off-by Yuanchu Xie <[email protected]>Acked-by David Rientjes <[email protected]>Thank you. Applied to linux-kselftest next for 5.19-rc1.
The test builds with warnings. Would you like to fix these as well?
make
gcc huge_count_read_write.c -o linux_5.18/tools/testing/selftests/damon/huge_count_read_writehuge_count_read_write.c: In function ‘write_read_with_huge_count’:
huge_count_read_write.c:23:9: warning: ‘write’ reading 4294967295 bytes from a region of size 1 [-Wstringop-overread]
23 | write(filedesc, "", 0xfffffffful);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from huge_count_read_write.c:8:
/usr/include/unistd.h:378:16: note: in a call to function ‘write’ declared with attribute ‘access (read_only, 2, 3)’
378 | extern ssize_t write (int __fd, const void *__buf, size_t __n) __wur
| ^~~~~
huge_count_read_write.c:25:15: warning: ‘read’ writing 4294967295 bytes into a region of size 25 overflows the destination [-Wstringop-overflow=]
25 | ret = read(filedesc, buf, 0xfffffffful);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~huge_count_read_write.c:14:14: note: destination object ‘buf’ of size 25
14 | char buf[25];
| ^~~
In file included from huge_count_read_write.c:8:/usr/include/unistd.h:371:16: note: in a call to function ‘read’ declared with attribute ‘access (write_only, 2, 3)’
371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
| ^~~~
thanks,
-- Shuah
PATCH v2 1/2 selftests/damon: suppress compiler warnings for huge_count_read_write
The test case added in commit db7a347b26fe ("mm/damon/dbgfs:
use '__GFP_NOWARN' for user-specified size buffer allocation") intentionally writes and reads with a large count to cause allocation failure and check for kernel warnings. We suppress the compiler warnings for these calls as they work as intended.
--- tools/testing/selftests/damon/Makefile | 3 +++ 1 file changed, 3 insertions(+)
tools/testing/selftests/damon/Makefile +3 -0
@@ -1,6 +1,9 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for damon selftests +CFLAGS += -Wno-stringop-overread +CFLAGS += -Wno-stringop-overflow + TEST_GEN_FILES += huge_count_read_write TEST_FILES = _chk_dependency.sh _debugfs_common.sh
Signature · 1 line
2.36.0.464.gb9c8b46e94-goog
PATCH v2 2/2 selftests/damon: add damon to selftests root Makefile
Currently the damon selftests are not built with the rest of the selftests. We add damon to the list of targets.
--- tools/testing/selftests/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/Makefile +1 -0
@@ -9,6 +9,7 @@ TARGETS += clone3 TARGETS += core TARGETS += cpufreq TARGETS += cpu-hotplug +TARGETS += damon TARGETS += drivers/dma-buf TARGETS += efivarfs TARGETS += exec
Signature · 1 line
2.36.0.464.gb9c8b46e94-goog
Quoted 5 lines · On Wed, 4 May 2022 00:03:58 +0000 Yuanchu Xie <[email protected]> wrote:
Currently the damon selftests are not built with the rest of the selftests. We add damon to the list of targets.
Fixes b348eb7abd09 ("mm/damon: add user space selftests")Signed-off-by Yuanchu Xie <[email protected]>
Thanks,
SJ
Quoted 18 lines
--- tools/testing/selftests/Makefile | 1 + 1 file changed, 1 insertion(+)tools/testing/selftests/Makefile +1
-0@@ -9,6 +9,7 @@ TARGETS += clone3 TARGETS += core TARGETS += cpufreq TARGETS += cpu-hotplug +TARGETS += damon TARGETS += drivers/dma-buf TARGETS += efivarfs TARGETS += execSignature · 1 line
2.36.0.464.gb9c8b46e94-goog
Quoted 5 lines · Yuanchu Xie
Currently the damon selftests are not built with the rest of the selftests. We add damon to the list of targets.
Fixes b348eb7abd09 ("mm/damon: add user space selftests")Signed-off-by Yuanchu Xie <[email protected]>
Re: [PATCH v2 1/2] selftests/damon: suppress compiler warnings for huge_count_read_write
In reply to Yuanchu XieHi Yuanchu, thank you for this patch!
Quoted 7 lines · On Wed, 4 May 2022 00:03:57 +0000 Yuanchu Xie <[email protected]> wrote:
The test case added in commit
db7a347b26fe("mm/damon/dbgfs:
use '__GFP_NOWARN' for user-specified size buffer allocation") intentionally writes and reads with a large count to cause allocation failure and check for kernel warnings. We suppress the compiler warnings for these calls as they work as intended.Signed-off-by Yuanchu Xie <[email protected]>
Thanks,
SJ
[...]
Quoted 21 lines
--- tools/testing/selftests/damon/Makefile | 3 +++ 1 file changed, 3 insertions(+)tools/testing/selftests/damon/Makefile +3
-0@@ -1,6 +1,9 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for damon selftests +CFLAGS += -Wno-stringop-overread +CFLAGS += -Wno-stringop-overflow + TEST_GEN_FILES += huge_count_read_write TEST_FILES = _chk_dependency.sh _debugfs_common.shSignature · 1 line
2.36.0.464.gb9c8b46e94-goog
PATCH v3 1/1 selftests/damon: suppress compiler warnings for huge_count_read_write
The test case added in commit db7a347b26fe ("mm/damon/dbgfs:
use '__GFP_NOWARN' for user-specified size buffer allocation") intentionally writes and reads with a large count to cause allocation failure and check for kernel warnings. We suppress the compiler warnings for these calls as they work as intended.
--- tools/testing/selftests/damon/huge_count_read_write.c | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/damon/huge_count_read_write.c +2 -0
@@ -2,6 +2,8 @@/* * Author: SeongJae Park <[email protected]> */ +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#pragma GCC diagnostic ignored "-Wstringop-overread"#include <fcntl.h> #include <stdlib.h>
Signature · 1 line
2.36.0.464.gb9c8b46e94-goog
Re: [PATCH v3] selftests/damon: suppress compiler warnings for huge_count_read_write
Hi SeongJae,
Instead of adding the exception to the Makefile, these two pragmas can be added to the offending c file instead. Although it is fairly minor and either one works but I think this is cleaner.
Thanks,
Yuanchu
SeongJae Park
maintainerRe: [PATCH v3] selftests/damon: suppress compiler warnings for huge_count_read_write
In reply to Yuanchu XieHi Yuanchu,
Quoted 8 lines · On Wed, 4 May 2022 18:29:08 +0000 Yuanchu Xie <[email protected]> wrote:
The test case added in commit
db7a347b26fe("mm/damon/dbgfs:
use '__GFP_NOWARN' for user-specified size buffer allocation") intentionally writes and reads with a large count to cause allocation failure and check for kernel warnings. We suppress the compiler warnings for these calls as they work as intended.Signed-off-by Yuanchu Xie <[email protected]>---
It would be a good practice to mention the changes from the previous version of this patch here[1].
[1] https://docs.kernel.org/process/submitting-patches.html#the-canonical-patch-format
tools/testing/selftests/damon/huge_count_read_write.c line 6
Quoted 13 lines
tools/testing/selftests/damon/huge_count_read_write.c | 2 ++ 1 file changed, 2 insertions(+)tools/testing/selftests/damon/huge_count_read_write.c +2
-0@@ -2,6 +2,8 @@/* * Author: SeongJae Park <[email protected]> */ +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#pragma GCC diagnostic ignored "-Wstringop-overread"
I agree that this must be the cleaner way than v2. But, I get below warning after applying this:
$ sudo make -C tools/testing/selftests/damon run_tests
make: Entering directory '/home/sjpark/linux/tools/testing/selftests/damon'
gcc huge_count_read_write.c -o /home/sjpark/linux/tools/testing/selftests/damon/huge_count_read_write
huge_count_read_write.c:6:32: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas]
6 | #pragma GCC diagnostic ignored "-Wstringop-overread"
| ^~~~~~~~~~~~~~~~~~~~~My gcc version is:
$ gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0Thanks,
SJ
Quoted 6 lines
tools/testing/selftests/damon/huge_count_read_write.c +0
-0#include <fcntl.h> #include <stdlib.h> Signature · 1 line
2.36.0.464.gb9c8b46e94-goog
Re: [PATCH v3] selftests/damon: suppress compiler warnings for huge_count_read_write
Hi SeongJae,
Quoted 11 lines · SeongJae Park
Hi Yuanchu,
Quoted 6 lines · On Wed, 4 May 2022 18:29:08 +0000 Yuanchu Xie <[email protected]> wrote:
The test case added in commit
db7a347b26fe("mm/damon/dbgfs:
use '__GFP_NOWARN' for user-specified size buffer allocation") intentionally writes and reads with a large count to cause allocation failure and check for kernel warnings. We suppress the compiler warnings for these calls as they work as intended.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Yuanchu Xie <[email protected]>---
It would be a good practice to mention the changes from the previous version of this patch here[1].
[1] https://docs.kernel.org/process/submitting-patches.html#the-canonical-patch-format
Thank you, I missed this when trying to figure out how to add additional comments for a revision.
Quoted 24 lines
tools/testing/selftests/damon/huge_count_read_write.c line 6
Quoted 13 lines
tools/testing/selftests/damon/huge_count_read_write.c | 2 ++ 1 file changed, 2 insertions(+)tools/testing/selftests/damon/huge_count_read_write.c +2
-0@@ -2,6 +2,8 @@/* * Author: SeongJae Park <[email protected]> */ +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#pragma GCC diagnostic ignored "-Wstringop-overread"I agree that this must be the cleaner way than v2. But, I get below warning after applying this:
$ sudo make -C tools/testing/selftests/damon run_tests make: Entering directory '/home/sjpark/linux/tools/testing/selftests/damon' gcc huge_count_read_write.c -o /home/sjpark/linux/tools/testing/selftests/damon/huge_count_read_write huge_count_read_write.c:6:32: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas] 6 | #pragma GCC diagnostic ignored "-Wstringop-overread" | ^~~~~~~~~~~~~~~~~~~~~
Quoted 4 lines
My gcc version is:
$ gcc --version gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
I see, I'm running
$ gcc --version
gcc (Debian 11.2.0-16+build1) 11.2.0I believe this is a new warning for gcc-11 [1], and somewhat unfortunate that it results in a warning for gcc-9.4. I'm not sure what the preference is here.
[1] https://gcc.gnu.org/onlinedocs/gcc-10.3.0/gcc/Warning-Options.html
Thanks,
Yuanchu
Re: [PATCH v3] selftests/damon: suppress compiler warnings for huge_count_read_write
SeongJae,
Do you have a preference on how this should be handled?
Thanks,
Yuanchu
Quoted 66 lines · Yuanchu Xie
Hi SeongJae,
Quoted 11 lines · SeongJae Park
Hi Yuanchu,
Quoted 6 lines · On Wed, 4 May 2022 18:29:08 +0000 Yuanchu Xie <[email protected]> wrote:
The test case added in commit
db7a347b26fe("mm/damon/dbgfs:
use '__GFP_NOWARN' for user-specified size buffer allocation") intentionally writes and reads with a large count to cause allocation failure and check for kernel warnings. We suppress the compiler warnings for these calls as they work as intended.Quoted 8 lines
Quoted 2 lines
Signed-off-by Yuanchu Xie <[email protected]>---
It would be a good practice to mention the changes from the previous version of this patch here[1].
[1] https://docs.kernel.org/process/submitting-patches.html#the-canonical-patch-format
Thank you, I missed this when trying to figure out how to add additional comments for a revision.
Quoted 24 lines
tools/testing/selftests/damon/huge_count_read_write.c line 6
Quoted 13 lines
tools/testing/selftests/damon/huge_count_read_write.c | 2 ++ 1 file changed, 2 insertions(+)tools/testing/selftests/damon/huge_count_read_write.c +2
-0@@ -2,6 +2,8 @@/* * Author: SeongJae Park <[email protected]> */ +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#pragma GCC diagnostic ignored "-Wstringop-overread"I agree that this must be the cleaner way than v2. But, I get below warning after applying this:
$ sudo make -C tools/testing/selftests/damon run_tests make: Entering directory '/home/sjpark/linux/tools/testing/selftests/damon' gcc huge_count_read_write.c -o /home/sjpark/linux/tools/testing/selftests/damon/huge_count_read_write huge_count_read_write.c:6:32: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas] 6 | #pragma GCC diagnostic ignored "-Wstringop-overread" | ^~~~~~~~~~~~~~~~~~~~~Quoted 4 lines
My gcc version is:
$ gcc --version gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0I see, I'm running
$ gcc --version gcc (Debian 11.2.0-16+build1) 11.2.0I believe this is a new warning for gcc-11 [1], and somewhat unfortunate that it results in a warning for gcc-9.4. I'm not sure what the preference is here.
[1] https://gcc.gnu.org/onlinedocs/gcc-10.3.0/gcc/Warning-Options.htmlThanks,
Yuanchu
SeongJae Park
maintainerRe: [PATCH v3] selftests/damon: suppress compiler warnings for huge_count_read_write
Hi Yuanchu,
Quoted 3 lines · On Mon, 16 May 2022 21:07:25 -0400 Yuanchu Xie <[email protected]> wrote:
SeongJae,
Do you have a preference on how this should be handled?
Sorry for late response. I was thinking you were asking Shuah's opinion. I have no strong opinion but the approach you made in v2 looks slightly better for me.
Thanks,
SJ
Quoted 72 lines
Thanks,
YuanchuQuoted 66 lines · Yuanchu Xie
Hi SeongJae,
Quoted 11 lines · SeongJae Park
Hi Yuanchu,
Quoted 6 lines · On Wed, 4 May 2022 18:29:08 +0000 Yuanchu Xie <[email protected]> wrote:
The test case added in commit
db7a347b26fe("mm/damon/dbgfs:
use '__GFP_NOWARN' for user-specified size buffer allocation") intentionally writes and reads with a large count to cause allocation failure and check for kernel warnings. We suppress the compiler warnings for these calls as they work as intended.Quoted 8 lines
Quoted 2 lines
Signed-off-by Yuanchu Xie <[email protected]>---
It would be a good practice to mention the changes from the previous version of this patch here[1].
[1] https://docs.kernel.org/process/submitting-patches.html#the-canonical-patch-format
Thank you, I missed this when trying to figure out how to add additional comments for a revision.
Quoted 24 lines
tools/testing/selftests/damon/huge_count_read_write.c line 6
Quoted 13 lines
tools/testing/selftests/damon/huge_count_read_write.c | 2 ++ 1 file changed, 2 insertions(+)tools/testing/selftests/damon/huge_count_read_write.c +2
-0@@ -2,6 +2,8 @@/* * Author: SeongJae Park <[email protected]> */ +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#pragma GCC diagnostic ignored "-Wstringop-overread"I agree that this must be the cleaner way than v2. But, I get below warning after applying this:
$ sudo make -C tools/testing/selftests/damon run_tests make: Entering directory '/home/sjpark/linux/tools/testing/selftests/damon' gcc huge_count_read_write.c -o /home/sjpark/linux/tools/testing/selftests/damon/huge_count_read_write huge_count_read_write.c:6:32: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas] 6 | #pragma GCC diagnostic ignored "-Wstringop-overread" | ^~~~~~~~~~~~~~~~~~~~~Quoted 4 lines
My gcc version is:
$ gcc --version gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0I see, I'm running
$ gcc --version gcc (Debian 11.2.0-16+build1) 11.2.0I believe this is a new warning for gcc-11 [1], and somewhat unfortunate that it results in a warning for gcc-9.4. I'm not sure what the preference is here.
[1] https://gcc.gnu.org/onlinedocs/gcc-10.3.0/gcc/Warning-Options.htmlThanks,
Yuanchu
Re: [PATCH v3] selftests/damon: suppress compiler warnings for huge_count_read_write
In reply to SeongJae ParkHi Shuah,
Quoted 43 lines · SeongJae Park
Hi Yuanchu,
Quoted 8 lines · On Wed, 4 May 2022 18:29:08 +0000 Yuanchu Xie <[email protected]> wrote:
The test case added in commit
db7a347b26fe("mm/damon/dbgfs:
use '__GFP_NOWARN' for user-specified size buffer allocation") intentionally writes and reads with a large count to cause allocation failure and check for kernel warnings. We suppress the compiler warnings for these calls as they work as intended.Signed-off-by Yuanchu Xie <[email protected]>---
It would be a good practice to mention the changes from the previous version of this patch here[1].
[1] https://docs.kernel.org/process/submitting-patches.html#the-canonical-patch-format
tools/testing/selftests/damon/huge_count_read_write.c line 6
Quoted 13 lines
tools/testing/selftests/damon/huge_count_read_write.c | 2 ++ 1 file changed, 2 insertions(+)tools/testing/selftests/damon/huge_count_read_write.c +2
-0@@ -2,6 +2,8 @@/* * Author: SeongJae Park <[email protected]> */ +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#pragma GCC diagnostic ignored "-Wstringop-overread"I agree that this must be the cleaner way than v2. But, I get below warning after applying this:
$ sudo make -C tools/testing/selftests/damon run_tests make: Entering directory '/home/sjpark/linux/tools/testing/selftests/damon' gcc huge_count_read_write.c -o /home/sjpark/linux/tools/testing/selftests/damon/huge_count_read_write huge_count_read_write.c:6:32: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas] 6 | #pragma GCC diagnostic ignored "-Wstringop-overread" | ^~~~~~~~~~~~~~~~~~~~~
Quoted 4 lines
My gcc version is:
$ gcc --version gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
$ gcc --version
gcc (Debian 11.2.0-16+build1) 11.2.0I believe this is a new warning for gcc-11 [1], and somewhat unfortunate that it results in a warning for gcc-9.4. So a patch that would resolve the test warnings for gcc 11 would introduce a new warning for gcc 9, and vice versa. What's the preferred solution here?
[1] https://gcc.gnu.org/onlinedocs/gcc-10.3.0/gcc/Warning-Options.html
Thanks,
Yuanchu