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 sj@kernel.org Signed-off-by: Yuanchu Xie yuanchu@google.com --- tools/testing/selftests/Makefile | 1 + 1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index d08fe4cfe811..ffe453760a12 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -9,6 +9,7 @@ TARGETS += clone3 TARGETS += core TARGETS += cpufreq TARGETS += cpu-hotplug +TARGETS += damon TARGETS += drivers/dma-buf TARGETS += efivarfs TARGETS += exec
On Mon, 18 Apr 2022, Yuanchu Xie 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") Reviewed-by: SeongJae Park sj@kernel.org Signed-off-by: Yuanchu Xie yuanchu@google.com
Acked-by: David Rientjes rientjes@google.com
On 4/24/22 1:35 PM, David Rientjes wrote:
On Mon, 18 Apr 2022, Yuanchu Xie 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") Reviewed-by: SeongJae Park sj@kernel.org Signed-off-by: Yuanchu Xie yuanchu@google.com
Acked-by: David Rientjes rientjes@google.com
Thank you. Applied to linux-kselftest next for 5.19-rc1.
thanks, -- Shuah
On 4/25/22 1:37 PM, Shuah Khan wrote:
On 4/24/22 1:35 PM, David Rientjes wrote:
On Mon, 18 Apr 2022, Yuanchu Xie 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") Reviewed-by: SeongJae Park sj@kernel.org Signed-off-by: Yuanchu Xie yuanchu@google.com
Acked-by: David Rientjes rientjes@google.com
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_write huge_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
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 yuanchu@google.com --- tools/testing/selftests/damon/Makefile | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/tools/testing/selftests/damon/Makefile b/tools/testing/selftests/damon/Makefile index 0470c5f3e690..a300b4c5b373 100644 --- a/tools/testing/selftests/damon/Makefile +++ b/tools/testing/selftests/damon/Makefile @@ -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
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 yuanchu@google.com --- tools/testing/selftests/Makefile | 1 + 1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index 2319ec87f53d..bd2ac8b3bf1f 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -9,6 +9,7 @@ TARGETS += clone3 TARGETS += core TARGETS += cpufreq TARGETS += cpu-hotplug +TARGETS += damon TARGETS += drivers/dma-buf TARGETS += efivarfs TARGETS += exec
On Wed, 4 May 2022 00:03:58 +0000 Yuanchu Xie yuanchu@google.com 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 yuanchu@google.com
Reviewed-by: SeongJae Park sj@kernel.org
Thanks, SJ
tools/testing/selftests/Makefile | 1 + 1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index 2319ec87f53d..bd2ac8b3bf1f 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -9,6 +9,7 @@ TARGETS += clone3 TARGETS += core TARGETS += cpufreq TARGETS += cpu-hotplug +TARGETS += damon TARGETS += drivers/dma-buf TARGETS += efivarfs TARGETS += exec -- 2.36.0.464.gb9c8b46e94-goog
On Wed, 4 May 2022, Yuanchu Xie 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 yuanchu@google.com
Acked-by: David Rientjes rientjes@google.com
Hi Yuanchu, thank you for this patch!
On Wed, 4 May 2022 00:03:57 +0000 Yuanchu Xie yuanchu@google.com 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 yuanchu@google.com
Reviewed-by: SeongJae Park sj@kernel.org
Thanks, SJ
[...]
tools/testing/selftests/damon/Makefile | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/tools/testing/selftests/damon/Makefile b/tools/testing/selftests/damon/Makefile index 0470c5f3e690..a300b4c5b373 100644 --- a/tools/testing/selftests/damon/Makefile +++ b/tools/testing/selftests/damon/Makefile @@ -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 -- 2.36.0.464.gb9c8b46e94-goog
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 yuanchu@google.com --- tools/testing/selftests/damon/huge_count_read_write.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/damon/huge_count_read_write.c b/tools/testing/selftests/damon/huge_count_read_write.c index ad7a6b4cf338..91bd80c75cd9 100644 --- a/tools/testing/selftests/damon/huge_count_read_write.c +++ b/tools/testing/selftests/damon/huge_count_read_write.c @@ -2,6 +2,8 @@ /* * Author: SeongJae Park sj@kernel.org */ +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#pragma GCC diagnostic ignored "-Wstringop-overread"
#include <fcntl.h> #include <stdlib.h>
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
Hi Yuanchu,
On Wed, 4 May 2022 18:29:08 +0000 Yuanchu Xie yuanchu@google.com 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 yuanchu@google.com
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-...
tools/testing/selftests/damon/huge_count_read_write.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/damon/huge_count_read_write.c b/tools/testing/selftests/damon/huge_count_read_write.c index ad7a6b4cf338..91bd80c75cd9 100644 --- a/tools/testing/selftests/damon/huge_count_read_write.c +++ b/tools/testing/selftests/damon/huge_count_read_write.c @@ -2,6 +2,8 @@ /*
- Author: SeongJae Park sj@kernel.org
*/ +#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.0
Thanks, SJ
#include <fcntl.h>
#include <stdlib.h>
2.36.0.464.gb9c8b46e94-goog
Hi SeongJae,
On Wed, May 4, 2022 at 11:45 AM SeongJae Park sj@kernel.org wrote:
Hi Yuanchu,
On Wed, 4 May 2022 18:29:08 +0000 Yuanchu Xie yuanchu@google.com 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 yuanchu@google.com
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-...
Thank you, I missed this when trying to figure out how to add additional comments for a revision.
tools/testing/selftests/damon/huge_count_read_write.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/damon/huge_count_read_write.c b/tools/testing/selftests/damon/huge_count_read_write.c index ad7a6b4cf338..91bd80c75cd9 100644 --- a/tools/testing/selftests/damon/huge_count_read_write.c +++ b/tools/testing/selftests/damon/huge_count_read_write.c @@ -2,6 +2,8 @@ /*
- Author: SeongJae Park sj@kernel.org
*/ +#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.0
I see, I'm running
$ gcc --version gcc (Debian 11.2.0-16+build1) 11.2.0
I 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
SeongJae,
Do you have a preference on how this should be handled?
Thanks, Yuanchu
On Wed, May 4, 2022 at 6:12 PM Yuanchu Xie yuanchu@google.com wrote:
Hi SeongJae,
On Wed, May 4, 2022 at 11:45 AM SeongJae Park sj@kernel.org wrote:
Hi Yuanchu,
On Wed, 4 May 2022 18:29:08 +0000 Yuanchu Xie yuanchu@google.com 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 yuanchu@google.com
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-...
Thank you, I missed this when trying to figure out how to add additional comments for a revision.
tools/testing/selftests/damon/huge_count_read_write.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/damon/huge_count_read_write.c b/tools/testing/selftests/damon/huge_count_read_write.c index ad7a6b4cf338..91bd80c75cd9 100644 --- a/tools/testing/selftests/damon/huge_count_read_write.c +++ b/tools/testing/selftests/damon/huge_count_read_write.c @@ -2,6 +2,8 @@ /*
- Author: SeongJae Park sj@kernel.org
*/ +#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.0
I see, I'm running
$ gcc --version gcc (Debian 11.2.0-16+build1) 11.2.0
I 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
Hi Yuanchu,
On Mon, 16 May 2022 21:07:25 -0400 Yuanchu Xie yuanchu@google.com 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
Thanks, Yuanchu
On Wed, May 4, 2022 at 6:12 PM Yuanchu Xie yuanchu@google.com wrote:
Hi SeongJae,
On Wed, May 4, 2022 at 11:45 AM SeongJae Park sj@kernel.org wrote:
Hi Yuanchu,
On Wed, 4 May 2022 18:29:08 +0000 Yuanchu Xie yuanchu@google.com 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 yuanchu@google.com
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-...
Thank you, I missed this when trying to figure out how to add additional comments for a revision.
tools/testing/selftests/damon/huge_count_read_write.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/damon/huge_count_read_write.c b/tools/testing/selftests/damon/huge_count_read_write.c index ad7a6b4cf338..91bd80c75cd9 100644 --- a/tools/testing/selftests/damon/huge_count_read_write.c +++ b/tools/testing/selftests/damon/huge_count_read_write.c @@ -2,6 +2,8 @@ /*
- Author: SeongJae Park sj@kernel.org
*/ +#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.0
I see, I'm running
$ gcc --version gcc (Debian 11.2.0-16+build1) 11.2.0
I 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
Hi Shuah,
On Wed, May 4, 2022 at 11:45 AM SeongJae Park sj@kernel.org wrote:
Hi Yuanchu,
On Wed, 4 May 2022 18:29:08 +0000 Yuanchu Xie yuanchu@google.com 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 yuanchu@google.com
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-...
tools/testing/selftests/damon/huge_count_read_write.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/damon/huge_count_read_write.c b/tools/testing/selftests/damon/huge_count_read_write.c index ad7a6b4cf338..91bd80c75cd9 100644 --- a/tools/testing/selftests/damon/huge_count_read_write.c +++ b/tools/testing/selftests/damon/huge_count_read_write.c @@ -2,6 +2,8 @@ /*
- Author: SeongJae Park sj@kernel.org
*/ +#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.0
$ gcc --version gcc (Debian 11.2.0-16+build1) 11.2.0
I 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
linux-kselftest-mirror@lists.linaro.org