From: Colin Ian King <colin.king(a)canonical.com>
The cpu-hotplug test assumes that we can offline the maximum CPU as
described by /sys/devices/system/cpu/offline. However, in the case
where the number of CPUs exceeds like kernel configuration then
the offline count can be greater than the present count and we end
up trying to test the offlining of a CPU that is not available to
offline. Fix this by testing the maximum present CPU instead.
Also, the test currently offlines the CPU and does not online it,
so fix this by onlining the CPU after the test.
Fixes: d89dffa976bc ("fault-injection: add selftests for cpu and memory hotplug")
Signed-off-by: Colin Ian King <colin.king(a)canonical.com>
---
V2: remove some debug and an empty line
---
.../selftests/cpu-hotplug/cpu-on-off-test.sh | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
index bab13dd025a6..0d26b5e3f966 100755
--- a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
+++ b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
@@ -37,6 +37,10 @@ prerequisite()
exit $ksft_skip
fi
+ present_cpus=`cat $SYSFS/devices/system/cpu/present`
+ present_max=${present_cpus##*-}
+ echo "present_cpus = $present_cpus present_max = $present_max"
+
echo -e "\t Cpus in online state: $online_cpus"
offline_cpus=`cat $SYSFS/devices/system/cpu/offline`
@@ -151,6 +155,8 @@ online_cpus=0
online_max=0
offline_cpus=0
offline_max=0
+present_cpus=0
+present_max=0
while getopts e:ahp: opt; do
case $opt in
@@ -190,9 +196,10 @@ if [ $allcpus -eq 0 ]; then
online_cpu_expect_success $online_max
if [[ $offline_cpus -gt 0 ]]; then
- echo -e "\t offline to online to offline: cpu $offline_max"
- online_cpu_expect_success $offline_max
- offline_cpu_expect_success $offline_max
+ echo -e "\t offline to online to offline: cpu $present_max"
+ online_cpu_expect_success $present_max
+ offline_cpu_expect_success $present_max
+ online_cpu $present_max
fi
exit 0
else
--
2.19.1
Le 27/09/2016 à 16:10, Rui Teng a écrit :
> From: Anton Blanchard <anton(a)au.ibm.com>
>
> Pull in a version of Anton's null_syscall benchmark:
> http://ozlabs.org/~anton/junkcode/null_syscall.c
> Into tools/testing/selftests/powerpc/benchmarks.
>
> Suggested-by: Michael Ellerman <mpe(a)ellerman.id.au>
> Signed-off-by: Anton Blanchard <anton(a)au.ibm.com>
> Signed-off-by: Rui Teng <rui.teng(a)linux.vnet.ibm.com>
> ---
> .../testing/selftests/powerpc/benchmarks/Makefile | 2 +-
> .../selftests/powerpc/benchmarks/null_syscall.c | 157 +++++++++++++++++++++
> 2 files changed, 158 insertions(+), 1 deletion(-)
> create mode 100644 tools/testing/selftests/powerpc/benchmarks/null_syscall.c
>
[...]
> +
> +static void do_null_syscall(unsigned long nr)
> +{
> + unsigned long i;
> +
> + for (i = 0; i < nr; i++)
> + getppid();
> +}
> +
Looks like getppid() performs a rcu_read_lock(). Is that what we want ?
Shouldn't we use getpid() instead for a lighter syscall ?
Christophe
The kmod.sh script breaks because an array is passed as input
instead of a single element input.This patch takes elements
one at a time and passed as input to the condition statement
which in turn fixes the error.There was an issue which had
the need for passing a single digit to the condition statement
which is fixed using regular expression.
Signed-off-by: Jeffrin Jose T <jeffrin(a)rajagiritech.edu.in>
---
tools/testing/selftests/kmod/kmod.sh | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/kmod/kmod.sh b/tools/testing/selftests/kmod/kmod.sh
index 0a76314b4414..49b273c3646e 100755
--- a/tools/testing/selftests/kmod/kmod.sh
+++ b/tools/testing/selftests/kmod/kmod.sh
@@ -526,9 +526,12 @@ function run_all_tests()
TEST_ID=${i%:*:*}
ENABLED=$(get_test_enabled $TEST_ID)
TEST_COUNT=$(get_test_count $TEST_ID)
- if [[ $ENABLED -eq "1" ]]; then
- test_case $TEST_ID $TEST_COUNT
- fi
+ for j in $ENABLED ; do
+ CHECK=${j#*:*:}
+ if [[ $CHECK -eq "1" ]]; then
+ test_case $TEST_ID $TEST_COUNT
+ fi
+ done
done
}
--
2.20.1
Hi Linus,
Please pull the following Kselftest update for Linux 5.0-rc4
This Kselftest update for Linux 5.0-rc4 consists of fixes to rtc,
seccomp and other tests.
diff is attached.
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit bfeffd155283772bbe78c6a05dec7c0128ee500c:
Linux 5.0-rc1 (2019-01-06 17:08:20 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
tags/linux-kselftest-5.0-rc4
for you to fetch changes up to 3d244c192afeee7dd4f5fb1b916ea4e47420d401:
selftests/seccomp: Abort without user notification support
(2019-01-17 11:00:23 -0700)
----------------------------------------------------------------
linux-kselftest-5.0-rc4
This Kselftest update for Linux 5.0-rc4 consists of fixes to rtc, seccomp
and other tests.
----------------------------------------------------------------
Alexandre Belloni (2):
selftests: rtc: rtctest: fix alarm tests
selftests: rtc: rtctest: add alarm test on minute boundary
Alison Schofield (1):
selftests/vm/gup_benchmark.c: match gup struct to kernel
Colin Ian King (1):
x86/mpx/selftests: fix spelling mistake "succeded" -> "succeeded"
Fathi Boudra (1):
selftests: seccomp: use LDLIBS instead of LDFLAGS
Geert Uytterhoeven (1):
selftests: gpio-mockup-chardev: Check asprintf() for error
Kees Cook (1):
selftests/seccomp: Abort without user notification support
Sabyasachi Gupta (1):
tools/testing/selftests/x86/unwind_vdso.c: Remove duplicate header
tools/testing/selftests/gpio/gpio-mockup-chardev.c | 9 +-
tools/testing/selftests/rtc/rtctest.c | 109
++++++++++++++++++++-
tools/testing/selftests/seccomp/Makefile | 2 +-
tools/testing/selftests/seccomp/seccomp_bpf.c | 10 +-
tools/testing/selftests/vm/gup_benchmark.c | 1 +
tools/testing/selftests/x86/mpx-mini-test.c | 2 +-
tools/testing/selftests/x86/unwind_vdso.c | 1 -
7 files changed, 118 insertions(+), 16 deletions(-)
----------------------------------------------------------------
From: Shuah Khan <shuah(a)kernel.org>
Upstream commit 211929fd3f7c ("selftests: Fix test errors related to
lib.mk khdr target")
This backport drops change to test that isn't in 4.19
- tools/testing/selftests/tc-testing/bpf/Makefile
The rest of the changes applied with minor changes to
- tools/testing/selftests/gpio/Makefile
- tools/testing/selftests/kvm/Makefile
Commit b2d35fa5fc80 ("selftests: add headers_install to lib.mk") added
khdr target to run headers_install target from the main Makefile. The
logic uses KSFT_KHDR_INSTALL and top_srcdir as controls to initialize
variables and include files to run headers_install from the top level
Makefile. There are a few problems with this logic.
1. Exposes top_srcdir to all tests
2. Common logic impacts all tests
3. Uses KSFT_KHDR_INSTALL, top_srcdir, and khdr in an adhoc way. Tests
add "khdr" dependency in their Makefiles to TEST_PROGS_EXTENDED in
some cases, and STATIC_LIBS in other cases. This makes this framework
confusing to use.
The common logic that runs for all tests even when KSFT_KHDR_INSTALL
isn't defined by the test. top_srcdir is initialized to a default value
when test doesn't initialize it. It works for all tests without a sub-dir
structure and tests with sub-dir structure fail to build.
e.g: make -C sparc64/drivers/ or make -C drivers/dma-buf
../../lib.mk:20: ../../../../scripts/subarch.include: No such file or directory
make: *** No rule to make target '../../../../scripts/subarch.include'. Stop.
There is no reason to require all tests to define top_srcdir and there is
no need to require tests to add khdr dependency using adhoc changes to
TEST_* and other variables.
Fix it with a consistent use of KSFT_KHDR_INSTALL and top_srcdir from tests
that have the dependency on headers_install.
Change common logic to include khdr target define and "all" target with
dependency on khdr when KSFT_KHDR_INSTALL is defined.
Only tests that have dependency on headers_install have to define just
the KSFT_KHDR_INSTALL, and top_srcdir variables and there is no need to
specify khdr dependency in the test Makefiles.
Fixes: b2d35fa5fc80 ("selftests: add headers_install to lib.mk")
Signed-off-by: Shuah Khan <shuah(a)kernel.org>
---
tools/testing/selftests/android/Makefile | 2 +-
tools/testing/selftests/futex/functional/Makefile | 1 +
tools/testing/selftests/gpio/Makefile | 1 +
tools/testing/selftests/kvm/Makefile | 2 +-
tools/testing/selftests/lib.mk | 8 ++++----
tools/testing/selftests/networking/timestamping/Makefile | 1 +
tools/testing/selftests/vm/Makefile | 1 +
7 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/android/Makefile b/tools/testing/selftests/android/Makefile
index d9a725478375..72c25a3cb658 100644
--- a/tools/testing/selftests/android/Makefile
+++ b/tools/testing/selftests/android/Makefile
@@ -6,7 +6,7 @@ TEST_PROGS := run.sh
include ../lib.mk
-all: khdr
+all:
@for DIR in $(SUBDIRS); do \
BUILD_TARGET=$(OUTPUT)/$$DIR; \
mkdir $$BUILD_TARGET -p; \
diff --git a/tools/testing/selftests/futex/functional/Makefile b/tools/testing/selftests/futex/functional/Makefile
index ad1eeb14fda7..30996306cabc 100644
--- a/tools/testing/selftests/futex/functional/Makefile
+++ b/tools/testing/selftests/futex/functional/Makefile
@@ -19,6 +19,7 @@ TEST_GEN_FILES := \
TEST_PROGS := run.sh
top_srcdir = ../../../../..
+KSFT_KHDR_INSTALL := 1
include ../../lib.mk
$(TEST_GEN_FILES): $(HEADERS)
diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile
index 4665cdbf1a8d..59ea4c461978 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -9,6 +9,7 @@ EXTRA_OBJS := ../gpiogpio-event-mon-in.o ../gpiogpio-event-mon.o
EXTRA_OBJS += ../gpiogpio-hammer-in.o ../gpiogpio-utils.o ../gpiolsgpio-in.o
EXTRA_OBJS += ../gpiolsgpio.o
+KSFT_KHDR_INSTALL := 1
include ../lib.mk
all: $(BINARIES)
diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
index ec32dad3c3f0..cc83e2fd3787 100644
--- a/tools/testing/selftests/kvm/Makefile
+++ b/tools/testing/selftests/kvm/Makefile
@@ -1,6 +1,7 @@
all:
top_srcdir = ../../../../
+KSFT_KHDR_INSTALL := 1
UNAME_M := $(shell uname -m)
LIBKVM = lib/assert.c lib/elf.c lib/io.c lib/kvm_util.c lib/sparsebit.c
@@ -40,4 +41,3 @@ $(OUTPUT)/libkvm.a: $(LIBKVM_OBJ)
all: $(STATIC_LIBS)
$(TEST_GEN_PROGS): $(STATIC_LIBS)
-$(STATIC_LIBS):| khdr
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 0a8e75886224..8b0f16409ed7 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -16,18 +16,18 @@ TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS))
TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED))
TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES))
+ifdef KSFT_KHDR_INSTALL
top_srcdir ?= ../../../..
include $(top_srcdir)/scripts/subarch.include
ARCH ?= $(SUBARCH)
-all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
-
.PHONY: khdr
khdr:
make ARCH=$(ARCH) -C $(top_srcdir) headers_install
-ifdef KSFT_KHDR_INSTALL
-$(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES):| khdr
+all: khdr $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
+else
+all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
endif
.ONESHELL:
diff --git a/tools/testing/selftests/networking/timestamping/Makefile b/tools/testing/selftests/networking/timestamping/Makefile
index 14cfcf006936..c46c0eefab9e 100644
--- a/tools/testing/selftests/networking/timestamping/Makefile
+++ b/tools/testing/selftests/networking/timestamping/Makefile
@@ -6,6 +6,7 @@ TEST_PROGS := hwtstamp_config rxtimestamp timestamping txtimestamp
all: $(TEST_PROGS)
top_srcdir = ../../../../..
+KSFT_KHDR_INSTALL := 1
include ../../lib.mk
clean:
diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
index e94b7b14bcb2..dc68340a6a96 100644
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -24,6 +24,7 @@ TEST_GEN_FILES += virtual_address_range
TEST_PROGS := run_vmtests
+KSFT_KHDR_INSTALL := 1
include ../lib.mk
$(OUTPUT)/userfaultfd: LDLIBS += -lpthread
--
2.17.1
Hi all,
Here are the fixes I previously mentioned I would send. I previously
assumed that the tests were mostly run as root, but it turns out
everything else besides the stuff I wrote in the seccomp tests either
sets NNP and doesn't require real root, so it all actually works. This
set of fixes should make most of the other tests work unprivileged,
while XFAIL-ing the one that requires real root.
Cheers,
Tycho
Tycho Andersen (6):
selftests: don't kill child immediately in get_metadata() test
selftests: fix typo in seccomp_bpf.c
selftest: include stdio.h in kselftest.h
selftests: skip seccomp get_metadata test if not real root
selftests: set NO_NEW_PRIVS bit in seccomp user tests
selftests: unshare userns in seccomp pidns testcases
tools/testing/selftests/kselftest.h | 1 +
tools/testing/selftests/seccomp/seccomp_bpf.c | 42 ++++++++++++++++---
2 files changed, 38 insertions(+), 5 deletions(-)
--
2.19.1
Newly added test case bpf test_netcnt failed on i386 and qemu_i386 on
mainline and -next kernel.
Here we are running i386 kernel on x86_64 device.
Pass on x86_64, arm64 and arm.
Am i missing any pre required Kconfigs ?
Test output log,
selftests: bpf: test_netcnt
libbpf: failed to create map (name: 'percpu_netcnt'): Invalid argument
libbpf: failed to load object './netcnt_prog.o'
Failed to load bpf program
not ok 1.. selftests: bpf: test_netcnt [FAIL]
selftests: bpf_test_netcnt [FAIL]
Full test log,
https://lkft.validation.linaro.org/scheduler/job/574652#L2903
Kernel Config,
http://snapshots.linaro.org/openembedded/lkft/rocko/intel-core2-32/lkft/lin…
Test results comparison of arm64, arm, x86_64 and i386 (kernel running
on x86_64 machine).
https://qa-reports.linaro.org/_/comparetest/?project=22&project=6&suite=kse…
Best regards
Naresh Kamboju
With more and more resctrl features are being added by Intel, AMD
and ARM, a test tool is becoming more and more useful to validate
that both hardware and software functionalities work as expected.
We introduce resctrl selftest to cover resctrl features on both
X86 and ARM architectures. It first implements MBM (Memory Bandwidth
Monitoring) and MBA (Memory Bandwidth Allocation) tests. We can enhance
the selftest tool to include more functionality tests in future.
There is an existing resctrl test suite 'intel_cmt_cat'. But the major
purpose of the tool is to test Intel(R) RDT hardware via writing and
reading MSR registers. It does access resctrl file system; but the
functionalities are very limited. And it doesn't support automatic test
and a lot of manual verifications are involved.
So the selftest tool we are introducing here provides a convenient
tool which does automatic resctrl testing, is easily available in kernel
tree, and will be extended to AMD QoS and ARM MPAM.
The selftest tool is in tools/testing/selftests/resctrl in order to have
generic test code for all architectures.
Changelog:
v5:
- Based the v4 patches submitted by Fenghua Yu and added changes to support
AMD.
- Changed the function name get_sock_num to get_resource_id. Intel uses
socket number for schemata and AMD uses l3 index id. To generalize changed
the function name to get_resource_id.
- Added the code to detect vendor.
- Disabled the few tests for AMD where the test results are not clear.
Also AMD does not have IMC.
- Fixed few compile issues.
- Some cleanup to make each patch independent.
- Tested the patches on AMD system. Fenghua, Need your help to test on
Intel box. Please feel free to change and resubmit if something
broken.
- Here is the link for previous version.
https://lore.kernel.org/lkml/1545438038-75107-1-git-send-email-fenghua.yu@i…
v4:
- address comments from Balu and Randy
- Add CAT and CQM tests
v3:
- Change code based on comments from Babu Moger
- Remove some unnessary code and use pipe to communicate b/w processes
v2:
- Change code based on comments from Babu Moger
- Clean up other places.
Arshiya Hayatkhan Pathan (4):
selftests/resctrl: Add MBM test
selftests/resctrl: Add MBA test
selftests/resctrl Add Cache QoS Monitoring (CQM) selftest
selftests/resctrl: Add Cache Allocation Technology (CAT) selftest
Babu Moger (3):
selftests/resctrl: Add vendor detection mechanism
selftests/resctrl: Use cache index3 id for AMD schemata masks
selftests/resctrl: Disable MBA and MBM tests for AMD
Fenghua Yu (2):
selftests/resctrl: Add README for resctrl tests
selftests/resctrl: Add the test in MAINTAINERS
Sai Praneeth Prakhya (4):
selftests/resctrl: Add basic resctrl file system operations and data
selftests/resctrl: Read memory bandwidth from perf IMC counter and
from resctrl file system
selftests/resctrl: Add callback to start a benchmark
selftests/resctrl: Add built in benchmark
MAINTAINERS | 1 +
tools/testing/selftests/resctrl/Makefile | 16 +
tools/testing/selftests/resctrl/README | 53 ++
tools/testing/selftests/resctrl/cache.c | 275 +++++++++
tools/testing/selftests/resctrl/cat_test.c | 243 ++++++++
tools/testing/selftests/resctrl/cqm_test.c | 169 ++++++
tools/testing/selftests/resctrl/fill_buf.c | 198 +++++++
tools/testing/selftests/resctrl/mba_test.c | 174 ++++++
tools/testing/selftests/resctrl/mbm_test.c | 146 +++++
tools/testing/selftests/resctrl/resctrl.h | 117 ++++
tools/testing/selftests/resctrl/resctrl_tests.c | 243 ++++++++
tools/testing/selftests/resctrl/resctrl_val.c | 727 ++++++++++++++++++++++++
tools/testing/selftests/resctrl/resctrlfs.c | 649 +++++++++++++++++++++
13 files changed, 3011 insertions(+)
create mode 100644 tools/testing/selftests/resctrl/Makefile
create mode 100644 tools/testing/selftests/resctrl/README
create mode 100644 tools/testing/selftests/resctrl/cache.c
create mode 100644 tools/testing/selftests/resctrl/cat_test.c
create mode 100644 tools/testing/selftests/resctrl/cqm_test.c
create mode 100644 tools/testing/selftests/resctrl/fill_buf.c
create mode 100644 tools/testing/selftests/resctrl/mba_test.c
create mode 100644 tools/testing/selftests/resctrl/mbm_test.c
create mode 100644 tools/testing/selftests/resctrl/resctrl.h
create mode 100644 tools/testing/selftests/resctrl/resctrl_tests.c
create mode 100644 tools/testing/selftests/resctrl/resctrl_val.c
create mode 100644 tools/testing/selftests/resctrl/resctrlfs.c
--
1.8.3.1