4.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <john.stultz(a)linaro.org>
[ Upstream commit 1416270f4a1ae83ea84156ceba19a66a8f88be1f ]
In the past we've warned when ADJ_OFFSET was in progress, usually
caused by ntpd or some other time adjusting daemon running in non
steady sate, which can cause the skew calculations to be
incorrect.
Thus, this patch checks to see if the clock was being adjusted
when we fail so that we don't cause false negatives.
Cc: Thomas Gleixner <tglx(a)linutronix.de>
Cc: Ingo Molnar <mingo(a)kernel.org>
Cc: Miroslav Lichvar <mlichvar(a)redhat.com>
Cc: Richard Cochran <richardcochran(a)gmail.com>
Cc: Prarit Bhargava <prarit(a)redhat.com>
Cc: Stephen Boyd <sboyd(a)kernel.org>
Cc: Shuah Khan <shuah(a)kernel.org>
Cc: linux-kselftest(a)vger.kernel.org
Suggested-by: Miroslav Lichvar <mlichvar(a)redhat.com>
Signed-off-by: John Stultz <john.stultz(a)linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
v2: Widened the checks to look for other clock adjustments that
could happen, as suggested by Miroslav
v3: Fixed up commit message
Signed-off-by: Sasha Levin <alexander.levin(a)microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
tools/testing/selftests/timers/raw_skew.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/tools/testing/selftests/timers/raw_skew.c
+++ b/tools/testing/selftests/timers/raw_skew.c
@@ -134,6 +134,11 @@ int main(int argv, char **argc)
printf(" %lld.%i(act)", ppm/1000, abs((int)(ppm%1000)));
if (llabs(eppm - ppm) > 1000) {
+ if (tx1.offset || tx2.offset ||
+ tx1.freq != tx2.freq || tx1.tick != tx2.tick) {
+ printf(" [SKIP]\n");
+ return ksft_exit_skip("The clock was adjusted externally. Shutdown NTPd or other time sync daemons\n");
+ }
printf(" [FAILED]\n");
return ksft_exit_fail();
}
4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <john.stultz(a)linaro.org>
[ Upstream commit 1416270f4a1ae83ea84156ceba19a66a8f88be1f ]
In the past we've warned when ADJ_OFFSET was in progress, usually
caused by ntpd or some other time adjusting daemon running in non
steady sate, which can cause the skew calculations to be
incorrect.
Thus, this patch checks to see if the clock was being adjusted
when we fail so that we don't cause false negatives.
Cc: Thomas Gleixner <tglx(a)linutronix.de>
Cc: Ingo Molnar <mingo(a)kernel.org>
Cc: Miroslav Lichvar <mlichvar(a)redhat.com>
Cc: Richard Cochran <richardcochran(a)gmail.com>
Cc: Prarit Bhargava <prarit(a)redhat.com>
Cc: Stephen Boyd <sboyd(a)kernel.org>
Cc: Shuah Khan <shuah(a)kernel.org>
Cc: linux-kselftest(a)vger.kernel.org
Suggested-by: Miroslav Lichvar <mlichvar(a)redhat.com>
Signed-off-by: John Stultz <john.stultz(a)linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
v2: Widened the checks to look for other clock adjustments that
could happen, as suggested by Miroslav
v3: Fixed up commit message
Signed-off-by: Sasha Levin <alexander.levin(a)microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
tools/testing/selftests/timers/raw_skew.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/tools/testing/selftests/timers/raw_skew.c
+++ b/tools/testing/selftests/timers/raw_skew.c
@@ -134,6 +134,11 @@ int main(int argv, char **argc)
printf(" %lld.%i(act)", ppm/1000, abs((int)(ppm%1000)));
if (llabs(eppm - ppm) > 1000) {
+ if (tx1.offset || tx2.offset ||
+ tx1.freq != tx2.freq || tx1.tick != tx2.tick) {
+ printf(" [SKIP]\n");
+ return ksft_exit_skip("The clock was adjusted externally. Shutdown NTPd or other time sync daemons\n");
+ }
printf(" [FAILED]\n");
return ksft_exit_fail();
}
4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <john.stultz(a)linaro.org>
[ Upstream commit 1416270f4a1ae83ea84156ceba19a66a8f88be1f ]
In the past we've warned when ADJ_OFFSET was in progress, usually
caused by ntpd or some other time adjusting daemon running in non
steady sate, which can cause the skew calculations to be
incorrect.
Thus, this patch checks to see if the clock was being adjusted
when we fail so that we don't cause false negatives.
Cc: Thomas Gleixner <tglx(a)linutronix.de>
Cc: Ingo Molnar <mingo(a)kernel.org>
Cc: Miroslav Lichvar <mlichvar(a)redhat.com>
Cc: Richard Cochran <richardcochran(a)gmail.com>
Cc: Prarit Bhargava <prarit(a)redhat.com>
Cc: Stephen Boyd <sboyd(a)kernel.org>
Cc: Shuah Khan <shuah(a)kernel.org>
Cc: linux-kselftest(a)vger.kernel.org
Suggested-by: Miroslav Lichvar <mlichvar(a)redhat.com>
Signed-off-by: John Stultz <john.stultz(a)linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
v2: Widened the checks to look for other clock adjustments that
could happen, as suggested by Miroslav
v3: Fixed up commit message
Signed-off-by: Sasha Levin <alexander.levin(a)microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
tools/testing/selftests/timers/raw_skew.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/tools/testing/selftests/timers/raw_skew.c
+++ b/tools/testing/selftests/timers/raw_skew.c
@@ -146,6 +146,11 @@ int main(int argv, char **argc)
printf(" %lld.%i(act)", ppm/1000, abs((int)(ppm%1000)));
if (llabs(eppm - ppm) > 1000) {
+ if (tx1.offset || tx2.offset ||
+ tx1.freq != tx2.freq || tx1.tick != tx2.tick) {
+ printf(" [SKIP]\n");
+ return ksft_exit_skip("The clock was adjusted externally. Shutdown NTPd or other time sync daemons\n");
+ }
printf(" [FAILED]\n");
return ksft_exit_fail();
}
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <john.stultz(a)linaro.org>
[ Upstream commit 1416270f4a1ae83ea84156ceba19a66a8f88be1f ]
In the past we've warned when ADJ_OFFSET was in progress, usually
caused by ntpd or some other time adjusting daemon running in non
steady sate, which can cause the skew calculations to be
incorrect.
Thus, this patch checks to see if the clock was being adjusted
when we fail so that we don't cause false negatives.
Cc: Thomas Gleixner <tglx(a)linutronix.de>
Cc: Ingo Molnar <mingo(a)kernel.org>
Cc: Miroslav Lichvar <mlichvar(a)redhat.com>
Cc: Richard Cochran <richardcochran(a)gmail.com>
Cc: Prarit Bhargava <prarit(a)redhat.com>
Cc: Stephen Boyd <sboyd(a)kernel.org>
Cc: Shuah Khan <shuah(a)kernel.org>
Cc: linux-kselftest(a)vger.kernel.org
Suggested-by: Miroslav Lichvar <mlichvar(a)redhat.com>
Signed-off-by: John Stultz <john.stultz(a)linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
v2: Widened the checks to look for other clock adjustments that
could happen, as suggested by Miroslav
v3: Fixed up commit message
Signed-off-by: Sasha Levin <alexander.levin(a)microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
tools/testing/selftests/timers/raw_skew.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/tools/testing/selftests/timers/raw_skew.c
+++ b/tools/testing/selftests/timers/raw_skew.c
@@ -146,6 +146,11 @@ int main(int argv, char **argc)
printf(" %lld.%i(act)", ppm/1000, abs((int)(ppm%1000)));
if (llabs(eppm - ppm) > 1000) {
+ if (tx1.offset || tx2.offset ||
+ tx1.freq != tx2.freq || tx1.tick != tx2.tick) {
+ printf(" [SKIP]\n");
+ return ksft_exit_skip("The clock was adjusted externally. Shutdown NTPd or other time sync daemons\n");
+ }
printf(" [FAILED]\n");
return ksft_exit_fail();
}
Hi Rafael,
Thanks for the patch. Comments below.
On 09/02/2018 08:12 PM, Rafael David Tinoco wrote:
> Shuah,
>
> This is a draft only. I will remove summary from the top, run checkers,
> etc. Im thinking in replacing membarrier_test entirely with this code
> (compatible to existing one). Right now, this code:
>
> - allows each test to succeed, fail or be skipped independently
> - allows each test to be tested even when not supported (force option)
> - considers false negatives and false positives on every case
> - can be extended easily
>
> Right now, just to show as an example, it gives us:
>
> TAP version 13
> ok 1 sys_membarrier(): cmd_query succeeded.
> ok 2 sys_membarrier(): bad_cmd failed as expected.
> ok 3 sys_membarrier(): cmd_with_flags_set failed as expected.
> ok 4 sys_membarrier(): cmd_global succeeded.
> Pass 4 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0
> 1..4
>
> Are you okay with such move ? Only big TODO here is adding all covered
> tests in the test array (easy move), testing all combinations with all
> supported kernel versions (lab already ready) and suggesting it to you,
> replacing membarrier_test.c.
>
> PS: This is pretty close to how a LTP test would be, using their new
> API, but, since it addresses your concerns and seems like a
> simple/clean, code, I decided to suggest it as a replacement here (and
> it also fixes the issue with this test and LTS kernels).
> ---
> tools/testing/selftests/membarrier/Makefile | 2 +-
> .../selftests/membarrier/membarrier_test2.c | 180 ++++++++++++++++++
> 2 files changed, 181 insertions(+), 1 deletion(-)
> create mode 100644 tools/testing/selftests/membarrier/membarrier_test2.c
>
> diff --git a/tools/testing/selftests/membarrier/Makefile b/tools/testing/selftests/membarrier/Makefile
> index 02845532b059..3d44d4cd3a9d 100644
> --- a/tools/testing/selftests/membarrier/Makefile
> +++ b/tools/testing/selftests/membarrier/Makefile
> @@ -1,6 +1,6 @@
> CFLAGS += -g -I../../../../usr/include/
>
> -TEST_GEN_PROGS := membarrier_test
> +TEST_GEN_PROGS := membarrier_test membarrier_test2
>
> include ../lib.mk
>
> diff --git a/tools/testing/selftests/membarrier/membarrier_test2.c b/tools/testing/selftests/membarrier/membarrier_test2.c
> new file mode 100644
> index 000000000000..8fa1be6156fb
> --- /dev/null
> +++ b/tools/testing/selftests/membarrier/membarrier_test2.c
> @@ -0,0 +1,180 @@
> +// SPDX-License-Identifier: GPL-2.0
> +#define _GNU_SOURCE
> +#include <linux/membarrier.h>
> +#include <syscall.h>
> +#include <stdio.h>
> +#include <errno.h>
> +#include <string.h>
> +
> +#include "../kselftest.h"
> +/*
> + MEMBARRIER_CMD_QUERY
> + returns membarrier_cmd with supported features
> + MEMBARRIER_CMD_GLOBAL
> + returns 0
> + EINVAL = if nohz_full is enabled
> + MEMBARRIER_CMD_GLOBAL_EXPEDITED
> + returns 0
> + MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED
> + returns 0
> + MEMBARRIER_CMD_PRIVATE_EXPEDITED
> + returns 0
> + EINVAL = if CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE is not enabled
> + EPERM = if process did not register for PRIVATE_EXPEDITED
> + MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED
> + returns 0
> + EINVAL = if CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE is not enabled
> + MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE
> + returns 0
> + EINVAL = if CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE is not enabled
> + EPERM = if process did not register for PRIVATE_EXPEDITED
> + MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE
> + returns 0
> + EINVAL = if CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE is not enabled
> +*/
> +
> +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
> +
> +struct memb_tests {
> + char testname[80];
> + int command;
> + int flags;
> + int exp_ret;
> + int exp_errno;
> + int supported;
> + int force;
> +};
> +
> +struct memb_tests mbt[] = {
> + {
> + .testname = "bad_cmd\0",
> + .command = -1,
> + .exp_ret = -1,
> + .exp_errno = EINVAL,
> + .supported = 1,
> + },
> + {
> + .testname = "cmd_with_flags_set\0",
> + .command = MEMBARRIER_CMD_QUERY,
> + .flags = 1,
> + .exp_ret = -1,
> + .exp_errno = EINVAL,
> + .supported = 1,
> + },
> + {
> + .testname = "cmd_global\0",
> + .command = MEMBARRIER_CMD_GLOBAL,
> + .flags = 0,
> + .exp_ret = 0,
> + },
> +};
> +
> +static void info_passed_ok(struct memb_tests test)
> +{
> + ksft_test_result_pass("sys_membarrier(): %s succeeded.\n",
> + test.testname);
> +}
> +
Why do we need to add new routines for these conditions. Why can't handle
these strings in array. For example you can define an array of strings for
passed unexpectedly etc. and the pass the string to appropriate ksft_* interface
instead of adding of these routines. Also it is hard to review the code this way.
I would like to see the changes made to membarrier_test.c instead of adding a new
file.
I do like the direction though.
thanks,
-- Shuah
Hi Linus,
Please pull the following Kselftest update for Linux 4.19-rc5
linux-kselftest-4.19-rc5
This Kselftest fixes update for 4.19-rc5 consists of:
-- fixes to build failures
-- fixes to add missing config files to increase test coverage
-- fixes to cgroup test and a new cgroup test for memory.oom.group
Please note that the selftests: add headers_install to lib.mk patch changes
the main Makefile. Some tests can't build without headers installed. This
fixes such test build failures.
diff is attached.
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit 5b394b2ddf0347bef56e50c69a58773c94343ff3:
Linux 4.19-rc1 (2018-08-26 14:11:59 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux-kselftest-4.19-rc5
for you to fetch changes up to a987785dcd6c8ae2915460582aebd6481c81eb67:
Add tests for memory.oom.group (2018-09-07 16:36:01 -0600)
----------------------------------------------------------------
linux-kselftest-4.19-rc5
This Kselftest fixes update for 4.19-rc5 consists of:
-- fixes to build failures
-- fixes to add missing config files to increase test coverage
-- fixes to cgroup test and a new cgroup test for memory.oom.group
----------------------------------------------------------------
Anders Roxell (2):
selftests: android: move config up a level
selftests: add headers_install to lib.mk
Jay Kamat (2):
Fix cg_read_strcmp()
Add tests for memory.oom.group
Lei Yang (3):
selftests/efivarfs: add required kernel configs
selftests: memory-hotplug: add required configs
cgroup: kselftests: add test_core to .gitignore
Thiago Jung Bauermann (1):
selftests: kselftest: Remove outdated comment
Makefile | 14 +-
scripts/subarch.include | 13 ++
tools/testing/selftests/android/Makefile | 2 +-
tools/testing/selftests/android/{ion => }/config | 0
tools/testing/selftests/android/ion/Makefile | 2 +
tools/testing/selftests/cgroup/.gitignore | 1 +
tools/testing/selftests/cgroup/cgroup_util.c | 38 +++-
tools/testing/selftests/cgroup/cgroup_util.h | 1 +
tools/testing/selftests/cgroup/test_memcontrol.c | 205 +++++++++++++++++++++
tools/testing/selftests/efivarfs/config | 1 +
tools/testing/selftests/futex/functional/Makefile | 1 +
tools/testing/selftests/gpio/Makefile | 7 +-
tools/testing/selftests/kselftest.h | 1 -
tools/testing/selftests/kvm/Makefile | 7 +-
tools/testing/selftests/lib.mk | 12 ++
----------------------------------------------------------------
From: John Stultz <john.stultz(a)linaro.org>
[ Upstream commit 1416270f4a1ae83ea84156ceba19a66a8f88be1f ]
In the past we've warned when ADJ_OFFSET was in progress, usually
caused by ntpd or some other time adjusting daemon running in non
steady sate, which can cause the skew calculations to be
incorrect.
Thus, this patch checks to see if the clock was being adjusted
when we fail so that we don't cause false negatives.
Cc: Thomas Gleixner <tglx(a)linutronix.de>
Cc: Ingo Molnar <mingo(a)kernel.org>
Cc: Miroslav Lichvar <mlichvar(a)redhat.com>
Cc: Richard Cochran <richardcochran(a)gmail.com>
Cc: Prarit Bhargava <prarit(a)redhat.com>
Cc: Stephen Boyd <sboyd(a)kernel.org>
Cc: Shuah Khan <shuah(a)kernel.org>
Cc: linux-kselftest(a)vger.kernel.org
Suggested-by: Miroslav Lichvar <mlichvar(a)redhat.com>
Signed-off-by: John Stultz <john.stultz(a)linaro.org>
---
v2: Widened the checks to look for other clock adjustments that
could happen, as suggested by Miroslav
v3: Fixed up commit message
Signed-off-by: Sasha Levin <alexander.levin(a)microsoft.com>
---
tools/testing/selftests/timers/raw_skew.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/selftests/timers/raw_skew.c
index 30906bfd9c1b..0ab937a17ebb 100644
--- a/tools/testing/selftests/timers/raw_skew.c
+++ b/tools/testing/selftests/timers/raw_skew.c
@@ -146,6 +146,11 @@ int main(int argv, char **argc)
printf(" %lld.%i(act)", ppm/1000, abs((int)(ppm%1000)));
if (llabs(eppm - ppm) > 1000) {
+ if (tx1.offset || tx2.offset ||
+ tx1.freq != tx2.freq || tx1.tick != tx2.tick) {
+ printf(" [SKIP]\n");
+ return ksft_exit_skip("The clock was adjusted externally. Shutdown NTPd or other time sync daemons\n");
+ }
printf(" [FAILED]\n");
return ksft_exit_fail();
}
--
2.17.1
From: John Stultz <john.stultz(a)linaro.org>
[ Upstream commit 1416270f4a1ae83ea84156ceba19a66a8f88be1f ]
In the past we've warned when ADJ_OFFSET was in progress, usually
caused by ntpd or some other time adjusting daemon running in non
steady sate, which can cause the skew calculations to be
incorrect.
Thus, this patch checks to see if the clock was being adjusted
when we fail so that we don't cause false negatives.
Cc: Thomas Gleixner <tglx(a)linutronix.de>
Cc: Ingo Molnar <mingo(a)kernel.org>
Cc: Miroslav Lichvar <mlichvar(a)redhat.com>
Cc: Richard Cochran <richardcochran(a)gmail.com>
Cc: Prarit Bhargava <prarit(a)redhat.com>
Cc: Stephen Boyd <sboyd(a)kernel.org>
Cc: Shuah Khan <shuah(a)kernel.org>
Cc: linux-kselftest(a)vger.kernel.org
Suggested-by: Miroslav Lichvar <mlichvar(a)redhat.com>
Signed-off-by: John Stultz <john.stultz(a)linaro.org>
---
v2: Widened the checks to look for other clock adjustments that
could happen, as suggested by Miroslav
v3: Fixed up commit message
Signed-off-by: Sasha Levin <alexander.levin(a)microsoft.com>
---
tools/testing/selftests/timers/raw_skew.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/selftests/timers/raw_skew.c
index 30906bfd9c1b..0ab937a17ebb 100644
--- a/tools/testing/selftests/timers/raw_skew.c
+++ b/tools/testing/selftests/timers/raw_skew.c
@@ -146,6 +146,11 @@ int main(int argv, char **argc)
printf(" %lld.%i(act)", ppm/1000, abs((int)(ppm%1000)));
if (llabs(eppm - ppm) > 1000) {
+ if (tx1.offset || tx2.offset ||
+ tx1.freq != tx2.freq || tx1.tick != tx2.tick) {
+ printf(" [SKIP]\n");
+ return ksft_exit_skip("The clock was adjusted externally. Shutdown NTPd or other time sync daemons\n");
+ }
printf(" [FAILED]\n");
return ksft_exit_fail();
}
--
2.17.1