2022-04-22 21:11:16

by Yuanchu Xie

[permalink] [raw]
Subject: [PATCH RESEND] 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.

Fixes: b348eb7abd09 ("mm/damon: add user space selftests")
Reviewed-by: SeongJae Park <[email protected]>
Signed-off-by: Yuanchu Xie <[email protected]>
---
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
--
2.35.1.265.g69c8d7142f-goog


2022-04-25 06:50:45

by David Rientjes

[permalink] [raw]
Subject: Re: [PATCH RESEND] selftests/damon: add damon to selftests root Makefile

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 <[email protected]>
> Signed-off-by: Yuanchu Xie <[email protected]>

Acked-by: David Rientjes <[email protected]>

2022-04-26 07:08:14

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH RESEND] selftests/damon: add damon to selftests root Makefile

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 <[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

2022-04-26 08:19:39

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH RESEND] selftests/damon: add damon to selftests root Makefile

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 <[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_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

2022-05-05 11:33:03

by Yuanchu Xie

[permalink] [raw]
Subject: [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.

Signed-off-by: Yuanchu Xie <[email protected]>
---
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