* + mm-damon-add-user-space-selftests.patch added to -mm tree
@ 2021-08-06 0:42 akpm
2021-08-10 11:20 ` [PATCH] selftests/damon/debugfs_attrs: Add missing execute permission SeongJae Park
0 siblings, 1 reply; 4+ messages in thread
From: akpm @ 2021-08-06 0:42 UTC (permalink / raw)
To: mm-commits, vdavydov.dev, vbabka, sieberf, shuah, shakeelb,
rostedt, rientjes, riel, peterz, namhyung, mingo, minchan,
mheyne, mgorman, markubo, Jonathan.Cameron, joe, gthelen, greg,
foersleo, fan.du, elver, dwmw, david, corbet, brendanhiggins,
benh, amit, alexander.shishkin, sjpark
The patch titled
Subject: mm/damon: add user space selftests
has been added to the -mm tree. Its filename is
mm-damon-add-user-space-selftests.patch
This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/mm-damon-add-user-space-selftests.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/mm-damon-add-user-space-selftests.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: SeongJae Park <sjpark@amazon.de>
Subject: mm/damon: add user space selftests
This commit adds a simple user space tests for DAMON. The tests are using
kselftest framework.
Link: https://lkml.kernel.org/r/20210716081449.22187-13-sj38.park@gmail.com
Signed-off-by: SeongJae Park <sjpark@amazon.de>
Reviewed-by: Markus Boehme <markubo@amazon.de>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Amit Shah <amit@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Brendan Higgins <brendanhiggins@google.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: David Rientjes <rientjes@google.com>
Cc: David Woodhouse <dwmw@amazon.com>
Cc: Fan Du <fan.du@intel.com>
Cc: Fernand Sieber <sieberf@amazon.com>
Cc: Greg Kroah-Hartman <greg@kroah.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Joe Perches <joe@perches.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Leonard Foerster <foersleo@amazon.de>
Cc: Marco Elver <elver@google.com>
Cc: Maximilian Heyne <mheyne@amazon.de>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
tools/testing/selftests/damon/Makefile | 7 +
tools/testing/selftests/damon/_chk_dependency.sh | 28 ++++
tools/testing/selftests/damon/debugfs_attrs.sh | 75 +++++++++++++
3 files changed, 110 insertions(+)
--- /dev/null
+++ a/tools/testing/selftests/damon/_chk_dependency.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+# Kselftest framework requirement - SKIP code is 4.
+ksft_skip=4
+
+DBGFS=/sys/kernel/debug/damon
+
+if [ $EUID -ne 0 ];
+then
+ echo "Run as root"
+ exit $ksft_skip
+fi
+
+if [ ! -d "$DBGFS" ]
+then
+ echo "$DBGFS not found"
+ exit $ksft_skip
+fi
+
+for f in attrs target_ids monitor_on
+do
+ if [ ! -f "$DBGFS/$f" ]
+ then
+ echo "$f not found"
+ exit 1
+ fi
+done
--- /dev/null
+++ a/tools/testing/selftests/damon/debugfs_attrs.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+test_write_result() {
+ file=$1
+ content=$2
+ orig_content=$3
+ expect_reason=$4
+ expected=$5
+
+ echo "$content" > "$file"
+ if [ $? -ne "$expected" ]
+ then
+ echo "writing $content to $file doesn't return $expected"
+ echo "expected because: $expect_reason"
+ echo "$orig_content" > "$file"
+ exit 1
+ fi
+}
+
+test_write_succ() {
+ test_write_result "$1" "$2" "$3" "$4" 0
+}
+
+test_write_fail() {
+ test_write_result "$1" "$2" "$3" "$4" 1
+}
+
+test_content() {
+ file=$1
+ orig_content=$2
+ expected=$3
+ expect_reason=$4
+
+ content=$(cat "$file")
+ if [ "$content" != "$expected" ]
+ then
+ echo "reading $file expected $expected but $content"
+ echo "expected because: $expect_reason"
+ echo "$orig_content" > "$file"
+ exit 1
+ fi
+}
+
+source ./_chk_dependency.sh
+
+# Test attrs file
+# ===============
+
+file="$DBGFS/attrs"
+orig_content=$(cat "$file")
+
+test_write_succ "$file" "1 2 3 4 5" "$orig_content" "valid input"
+test_write_fail "$file" "1 2 3 4" "$orig_content" "no enough fields"
+test_write_fail "$file" "1 2 3 5 4" "$orig_content" \
+ "min_nr_regions > max_nr_regions"
+test_content "$file" "$orig_content" "1 2 3 4 5" "successfully written"
+echo "$orig_content" > "$file"
+
+# Test target_ids file
+# ====================
+
+file="$DBGFS/target_ids"
+orig_content=$(cat "$file")
+
+test_write_succ "$file" "1 2 3 4" "$orig_content" "valid input"
+test_write_succ "$file" "1 2 abc 4" "$orig_content" "still valid input"
+test_content "$file" "$orig_content" "1 2" "non-integer was there"
+test_write_succ "$file" "abc 2 3" "$orig_content" "the file allows wrong input"
+test_content "$file" "$orig_content" "" "wrong input written"
+test_write_succ "$file" "" "$orig_content" "empty input"
+test_content "$file" "$orig_content" "" "empty input written"
+echo "$orig_content" > "$file"
+
+echo "PASS"
--- /dev/null
+++ a/tools/testing/selftests/damon/Makefile
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
+# Makefile for damon selftests
+
+TEST_FILES = _chk_dependency.sh
+TEST_PROGS = debugfs_attrs.sh
+
+include ../lib.mk
_
Patches currently in -mm which might be from sjpark@amazon.de are
mm-introduce-data-access-monitor-damon.patch
mm-damon-core-implement-region-based-sampling.patch
mm-damon-adaptively-adjust-regions.patch
mm-idle_page_tracking-make-pg_idle-reusable.patch
mm-damon-implement-primitives-for-the-virtual-memory-address-spaces.patch
mm-damon-add-a-tracepoint.patch
mm-damon-implement-a-debugfs-based-user-space-interface.patch
mm-damon-dbgfs-export-kdamond-pid-to-the-user-space.patch
mm-damon-dbgfs-support-multiple-contexts.patch
documentation-add-documents-for-damon.patch
mm-damon-add-kunit-tests.patch
mm-damon-add-user-space-selftests.patch
maintainers-update-for-damon.patch
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] selftests/damon/debugfs_attrs: Add missing execute permission
2021-08-06 0:42 + mm-damon-add-user-space-selftests.patch added to -mm tree akpm
@ 2021-08-10 11:20 ` SeongJae Park
2021-08-10 11:27 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: SeongJae Park @ 2021-08-10 11:20 UTC (permalink / raw)
To: akpm
Cc: shuah, linux-mm, linux-kselftest, linux-kernel, mm-commits,
SeongJae Park
From: SeongJae Park <sjpark@amazon.de>
Commit 04edafbc0c07 ("mm/damon: add user space selftests") of
linux-mm[1] gives no execute permission to 'debugfs_attrs.sh' file.
This results in a DAMON selftest failure as below:
$ make -C tools/testing/selftests/damon run_tests
make: Entering directory '/home/sjpark/linux/tools/testing/selftests/damon'
TAP version 13
1..1
# selftests: damon: debugfs_attrs.sh
# Warning: file debugfs_attrs.sh is not executable, correct this.
not ok 1 selftests: damon: debugfs_attrs.sh
make: Leaving directory '/home/sjpark/linux/tools/testing/selftests/damon'
To solve the problem, this commit adds the execute permission for
'debugfs_attrs.sh' file.
[1] https://github.com/hnaz/linux-mm/commit/04edafbc0c07
Signed-off-by: SeongJae Park <sjpark@amazon.de>
---
tools/testing/selftests/damon/debugfs_attrs.sh | 0
1 file changed, 0 insertions(+), 0 deletions(-)
mode change 100644 => 100755 tools/testing/selftests/damon/debugfs_attrs.sh
diff --git a/tools/testing/selftests/damon/debugfs_attrs.sh b/tools/testing/selftests/damon/debugfs_attrs.sh
old mode 100644
new mode 100755
--
2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/damon/debugfs_attrs: Add missing execute permission
2021-08-10 11:20 ` [PATCH] selftests/damon/debugfs_attrs: Add missing execute permission SeongJae Park
@ 2021-08-10 11:27 ` Greg KH
2021-08-10 14:08 ` SeongJae Park
0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2021-08-10 11:27 UTC (permalink / raw)
To: SeongJae Park
Cc: akpm, shuah, linux-mm, linux-kselftest, linux-kernel, mm-commits,
SeongJae Park
On Tue, Aug 10, 2021 at 11:20:50AM +0000, SeongJae Park wrote:
> From: SeongJae Park <sjpark@amazon.de>
>
> Commit 04edafbc0c07 ("mm/damon: add user space selftests") of
> linux-mm[1] gives no execute permission to 'debugfs_attrs.sh' file.
> This results in a DAMON selftest failure as below:
>
> $ make -C tools/testing/selftests/damon run_tests
> make: Entering directory '/home/sjpark/linux/tools/testing/selftests/damon'
> TAP version 13
> 1..1
> # selftests: damon: debugfs_attrs.sh
> # Warning: file debugfs_attrs.sh is not executable, correct this.
> not ok 1 selftests: damon: debugfs_attrs.sh
> make: Leaving directory '/home/sjpark/linux/tools/testing/selftests/damon'
>
> To solve the problem, this commit adds the execute permission for
> 'debugfs_attrs.sh' file.
>
> [1] https://github.com/hnaz/linux-mm/commit/04edafbc0c07
>
> Signed-off-by: SeongJae Park <sjpark@amazon.de>
> ---
> tools/testing/selftests/damon/debugfs_attrs.sh | 0
> 1 file changed, 0 insertions(+), 0 deletions(-)
> mode change 100644 => 100755 tools/testing/selftests/damon/debugfs_attrs.sh
>
> diff --git a/tools/testing/selftests/damon/debugfs_attrs.sh b/tools/testing/selftests/damon/debugfs_attrs.sh
> old mode 100644
> new mode 100755
> --
> 2.17.1
>
Why not fix the tools to execute the file properly as changing the mode
of a file does not work well with all tools that we use (i.e. patch
files.)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/damon/debugfs_attrs: Add missing execute permission
2021-08-10 11:27 ` Greg KH
@ 2021-08-10 14:08 ` SeongJae Park
0 siblings, 0 replies; 4+ messages in thread
From: SeongJae Park @ 2021-08-10 14:08 UTC (permalink / raw)
To: Greg KH
Cc: SeongJae Park, akpm, shuah, linux-mm, linux-kselftest,
linux-kernel, mm-commits, SeongJae Park
From: SeongJae Park <sjpark@amazon.de>
On Tue, 10 Aug 2021 13:27:44 +0200 Greg KH <gregkh@linuxfoundation.org> wrote:
> On Tue, Aug 10, 2021 at 11:20:50AM +0000, SeongJae Park wrote:
> > From: SeongJae Park <sjpark@amazon.de>
> >
> > Commit 04edafbc0c07 ("mm/damon: add user space selftests") of
> > linux-mm[1] gives no execute permission to 'debugfs_attrs.sh' file.
> > This results in a DAMON selftest failure as below:
> >
> > $ make -C tools/testing/selftests/damon run_tests
> > make: Entering directory '/home/sjpark/linux/tools/testing/selftests/damon'
> > TAP version 13
> > 1..1
> > # selftests: damon: debugfs_attrs.sh
> > # Warning: file debugfs_attrs.sh is not executable, correct this.
> > not ok 1 selftests: damon: debugfs_attrs.sh
> > make: Leaving directory '/home/sjpark/linux/tools/testing/selftests/damon'
> >
> > To solve the problem, this commit adds the execute permission for
> > 'debugfs_attrs.sh' file.
> >
> > [1] https://github.com/hnaz/linux-mm/commit/04edafbc0c07
> >
> > Signed-off-by: SeongJae Park <sjpark@amazon.de>
> > ---
> > tools/testing/selftests/damon/debugfs_attrs.sh | 0
> > 1 file changed, 0 insertions(+), 0 deletions(-)
> > mode change 100644 => 100755 tools/testing/selftests/damon/debugfs_attrs.sh
> >
> > diff --git a/tools/testing/selftests/damon/debugfs_attrs.sh b/tools/testing/selftests/damon/debugfs_attrs.sh
> > old mode 100644
> > new mode 100755
> > --
> > 2.17.1
> >
>
> Why not fix the tools to execute the file properly as changing the mode
> of a file does not work well with all tools that we use (i.e. patch
> files.)
Ok, It sounds make some sense. Hence, I posted this patch:
https://lore.kernel.org/linux-kselftest/20210810140459.23990-1-sj38.park@gmail.com/
Thanks,
SeongJae Park
[...]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-08-10 14:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06 0:42 + mm-damon-add-user-space-selftests.patch added to -mm tree akpm
2021-08-10 11:20 ` [PATCH] selftests/damon/debugfs_attrs: Add missing execute permission SeongJae Park
2021-08-10 11:27 ` Greg KH
2021-08-10 14:08 ` SeongJae Park
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.