Hi Linus,
Please pull the following kselftest fixes update for Linux 6.13-rc1.
kselftest update for Linux 6.13-rc1
-- timers test - removes duplicates defines
-- timers test - fixes to improve error reporting
-- rtc test - adds check rtc alarm status to alarm test
-- resctrl test - adds array overrun checks during iMC config parsing code
-- resctrl test - adds array overflow checks when reading strings
-- resctrl test - fixes and reorganizing code
Looks like I forgot to mention signal test changes in my tag
message. :(
diff is attached.
Tests passed on my kselftest next branch:
- Individual test runs of signal, timers, rtc, and resctrl
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit 8e929cb546ee42c9a61d24fae60605e9e3192354:
Linux 6.12-rc3 (2024-10-13 14:33:32 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux_kselftest-next-6.13-rc1
for you to fetch changes up to a44c26d7fa74a5f4d2795a5c55a2d6ec1ebf1e38:
selftests/resctrl: Replace magic constants used as array size (2024-11-04 17:02:03 -0700)
----------------------------------------------------------------
linux_kselftest-next-6.13-rc1
kselftest update for Linux 6.13-rc1
-- timers test - removes duplicates defines
-- timers test - fixes to improve error reporting
-- rtc test - adds check rtc alarm status to alarm test
-- resctrl test - adds array overrun checks during iMC config parsing code
-- resctrl test - adds array overflow checks when reading strings
-- resctrl test - fixes and reorganizing code
----------------------------------------------------------------
Chen Ni (1):
selftests: timers: Remove unneeded semicolon
Dev Jain (2):
selftests: Rename sigaltstack to generic signal
selftests: Add a test mangling with uc_sigmask
Gianfranco Trad (1):
selftests: timers: improve timer_create failure message
Joseph Jang (1):
selftest: rtc: Add to check rtc alarm status for alarm related test
Nícolas F. R. A. Prado (1):
docs: dev-tools: Add documentation for the device focused kselftests
Reinette Chatre (15):
selftests/resctrl: Make functions only used in same file static
selftests/resctrl: Print accurate buffer size as part of MBM results
selftests/resctrl: Fix memory overflow due to unhandled wraparound
selftests/resctrl: Protect against array overrun during iMC config parsing
selftests/resctrl: Protect against array overflow when reading strings
selftests/resctrl: Make wraparound handling obvious
selftests/resctrl: Remove "once" parameter required to be false
selftests/resctrl: Only support measured read operation
selftests/resctrl: Remove unused measurement code
selftests/resctrl: Make benchmark parameter passing robust
selftests/resctrl: Ensure measurements skip initialization of default benchmark
selftests/resctrl: Use cache size to determine "fill_buf" buffer size
selftests/resctrl: Do not compare performance counters and resctrl at low bandwidth
selftests/resctrl: Keep results from first test run
selftests/resctrl: Replace magic constants used as array size
Shuah Khan (2):
selftests: timers: Remove local NSEC_PER_SEC and USEC_PER_SEC defines
selftests:timers: remove local CLOCKID defines
Documentation/dev-tools/kselftest.rst | 9 +
Documentation/dev-tools/testing-devices.rst | 47 +++
tools/testing/selftests/Makefile | 2 +-
tools/testing/selftests/resctrl/cmt_test.c | 37 +-
tools/testing/selftests/resctrl/fill_buf.c | 45 +--
tools/testing/selftests/resctrl/mba_test.c | 54 ++-
tools/testing/selftests/resctrl/mbm_test.c | 37 +-
tools/testing/selftests/resctrl/resctrl.h | 79 +++-
tools/testing/selftests/resctrl/resctrl_tests.c | 95 ++++-
tools/testing/selftests/resctrl/resctrl_val.c | 447 ++++++---------------
tools/testing/selftests/resctrl/resctrlfs.c | 19 +-
tools/testing/selftests/rtc/Makefile | 2 +-
tools/testing/selftests/rtc/rtctest.c | 64 +++
.../selftests/{sigaltstack => signal}/.gitignore | 1 +
.../selftests/{sigaltstack => signal}/Makefile | 3 +-
.../current_stack_pointer.h | 0
tools/testing/selftests/signal/mangle_uc_sigmask.c | 184 +++++++++
.../selftests/{sigaltstack => signal}/sas.c | 0
tools/testing/selftests/timers/Makefile | 2 +-
tools/testing/selftests/timers/adjtick.c | 6 +-
.../testing/selftests/timers/alarmtimer-suspend.c | 22 +-
.../testing/selftests/timers/inconsistency-check.c | 21 +-
tools/testing/selftests/timers/leap-a-day.c | 2 +-
tools/testing/selftests/timers/mqueue-lat.c | 2 +-
tools/testing/selftests/timers/nanosleep.c | 21 +-
tools/testing/selftests/timers/nsleep-lat.c | 22 +-
tools/testing/selftests/timers/posix_timers.c | 15 +-
tools/testing/selftests/timers/raw_skew.c | 4 +-
tools/testing/selftests/timers/set-2038.c | 3 +-
tools/testing/selftests/timers/set-timer-lat.c | 21 +-
tools/testing/selftests/timers/valid-adjtimex.c | 4 +-
31 files changed, 701 insertions(+), 569 deletions(-)
create mode 100644 Documentation/dev-tools/testing-devices.rst
rename tools/testing/selftests/{sigaltstack => signal}/.gitignore (70%)
rename tools/testing/selftests/{sigaltstack => signal}/Makefile (56%)
rename tools/testing/selftests/{sigaltstack => signal}/current_stack_pointer.h (100%)
create mode 100644 tools/testing/selftests/signal/mangle_uc_sigmask.c
rename tools/testing/selftests/{sigaltstack => signal}/sas.c (100%)
----------------------------------------------------------------
Page Detective is a new kernel debugging tool that provides detailed
information about the usage and mapping of physical memory pages.
It is often known that a particular page is corrupted, but it is hard to
extract more information about such a page from live system. Examples
are:
- Checksum failure during live migration
- Filesystem journal failure
- dump_page warnings on the console log
- Unexcpected segfaults
Page Detective helps to extract more information from the kernel, so it
can be used by developers to root cause the associated problem.
It operates through the Linux debugfs interface, with two files: "virt"
and "phys".
The "virt" file takes a virtual address and PID and outputs information
about the corresponding page.
The "phys" file takes a physical address and outputs information about
that page.
The output is presented via kernel log messages (can be accessed with
dmesg), and includes information such as the page's reference count,
mapping, flags, and memory cgroup. It also shows whether the page is
mapped in the kernel page table, and if so, how many times.
Pasha Tatashin (6):
mm: Make get_vma_name() function public
pagewalk: Add a page table walker for init_mm page table
mm: Add a dump_page variant that accept log level argument
misc/page_detective: Introduce Page Detective
misc/page_detective: enable loadable module
selftests/page_detective: Introduce self tests for Page Detective
Documentation/misc-devices/index.rst | 1 +
Documentation/misc-devices/page_detective.rst | 78 ++
MAINTAINERS | 8 +
drivers/misc/Kconfig | 11 +
drivers/misc/Makefile | 1 +
drivers/misc/page_detective.c | 808 ++++++++++++++++++
fs/inode.c | 18 +-
fs/kernfs/dir.c | 1 +
fs/proc/task_mmu.c | 61 --
include/linux/fs.h | 5 +-
include/linux/mmdebug.h | 1 +
include/linux/pagewalk.h | 2 +
kernel/pid.c | 1 +
mm/debug.c | 53 +-
mm/memcontrol.c | 1 +
mm/oom_kill.c | 1 +
mm/pagewalk.c | 32 +
mm/vma.c | 60 ++
tools/testing/selftests/Makefile | 1 +
.../selftests/page_detective/.gitignore | 1 +
.../testing/selftests/page_detective/Makefile | 7 +
tools/testing/selftests/page_detective/config | 4 +
.../page_detective/page_detective_test.c | 727 ++++++++++++++++
23 files changed, 1787 insertions(+), 96 deletions(-)
create mode 100644 Documentation/misc-devices/page_detective.rst
create mode 100644 drivers/misc/page_detective.c
create mode 100644 tools/testing/selftests/page_detective/.gitignore
create mode 100644 tools/testing/selftests/page_detective/Makefile
create mode 100644 tools/testing/selftests/page_detective/config
create mode 100644 tools/testing/selftests/page_detective/page_detective_test.c
--
2.47.0.338.g60cca15819-goog
Hi all,
Another rather vague question from me - does anyone know any reasons
why we couldn't support KUNIT_EXPECT in atomic contexts?
For Address Space Isolation we have some tests that want to disable
preemption. I guess this is not a totally insane thing to want to do -
am I missing anything there?
You can see some examples here:
https://github.com/googleprodkernel/linux-kvm/blob/asi-lpc-24/arch/x86/mm/a…
(Actually, looks like in that code we just started doing KUNIT_EXPECT
in preempt-disabled regions anyway, and I never suffered any
consequences until recently. Probably we just never had those
assertions fail under DEBUG_ATOMIC_SLEEP).
From a very quick look, it seems like the only reason you can't
KUNIT_EXPECT from atomic right now is the GFP_KERNEL allocations.
So... what if we just made them GFP_ATOMIC? In general I think that's
a pretty ropey approach, but maybe fine in the context of unit tests?
Or, we could have variants of the assertions, or a test attribute, to
just use GFP_ATOMIC in the cases where it's needed.
Is there anything else missing that would need to be done?
Alternatively, we could expose the whole context concern to the user
in such a way that KUNIT_ASSERT can be used too, something like:
struct kunit_defer defer = KUNIT_INIT_DEFER(test);
preempt_disable();
KUNIT_EXPECT_DEFERRED_TRUE(&defer, ...);
KUNIT_ASSERT_DEFERRED_EQ(&defer, ...);
preempt_enable();
// Prints failures from above, aborts if the ASSERT failed:
kunit_defer_finish(&defer);
I hope that wouldn't be necessary though, it seems like a lot of API surface.
Currently the mount_setattr_test fails on machines with a 64K PAGE_SIZE,
with errors such as:
# RUN mount_setattr_idmapped.invalid_fd_negative ...
mkfs.ext4: No space left on device while writing out and closing file system
# mount_setattr_test.c:1055:invalid_fd_negative:Expected system("mkfs.ext4 -q /mnt/C/ext4.img") (256) == 0 (0)
# invalid_fd_negative: Test terminated by assertion
# FAIL mount_setattr_idmapped.invalid_fd_negative
not ok 12 mount_setattr_idmapped.invalid_fd_negative
The code creates a 100,000 byte tmpfs:
ASSERT_EQ(mount("testing", "/mnt", "tmpfs", MS_NOATIME | MS_NODEV,
"size=100000,mode=700"), 0);
And then a little later creates a 2MB ext4 filesystem in that tmpfs:
ASSERT_EQ(ftruncate(img_fd, 1024 * 2048), 0);
ASSERT_EQ(system("mkfs.ext4 -q /mnt/C/ext4.img"), 0);
At first glance it seems like that should never work, after all 2MB is
larger than 100,000 bytes. However the filesystem image doesn't actually
occupy 2MB on "disk" (actually RAM, due to tmpfs). On 4K kernels the
ext4.img uses ~84KB of actual space (according to du), which just fits.
However on 64K PAGE_SIZE kernels the ext4.img takes at least 256KB,
which is too large to fit in the tmpfs, hence the errors.
It seems fraught to rely on the ext4.img taking less space on disk than
the allocated size, so instead create the tmpfs with a size of 2MB. With
that all 21 tests pass on 64K PAGE_SIZE kernels.
Fixes: 01eadc8dd96d ("tests: add mount_setattr() selftests")
Signed-off-by: Michael Ellerman <mpe(a)ellerman.id.au>
---
tools/testing/selftests/mount_setattr/mount_setattr_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/mount_setattr/mount_setattr_test.c b/tools/testing/selftests/mount_setattr/mount_setattr_test.c
index 68801e1a9ec2..70f65eb320a7 100644
--- a/tools/testing/selftests/mount_setattr/mount_setattr_test.c
+++ b/tools/testing/selftests/mount_setattr/mount_setattr_test.c
@@ -1026,7 +1026,7 @@ FIXTURE_SETUP(mount_setattr_idmapped)
"size=100000,mode=700"), 0);
ASSERT_EQ(mount("testing", "/mnt", "tmpfs", MS_NOATIME | MS_NODEV,
- "size=100000,mode=700"), 0);
+ "size=2m,mode=700"), 0);
ASSERT_EQ(mkdir("/mnt/A", 0777), 0);
--
2.47.0
Hi Linus,
Please pull the following kunit update for Linux 6.13-rc1.
kunit update for Linux 6.13-rc1
-- fixes user-after-free (UAF) bug in kunit_init_suite()
-- adds option to kunit tool to print just the summary of test results
-- adds option to kunit tool to print just the failed test results
-- fixes kunit_zalloc_skb() to use user passed in gfp value instead of
hardcoding GFP_KERNEL
-- fixes kunit_zalloc_skb() kernel doc to include allocation flags variable
diff is attached.
Tests passed on my kunit repo:
- Build make allmodconfig
./tools/testing/kunit/kunit.py run
./tools/testing/kunit/kunit.py run --alltests
./tools/testing/kunit/kunit.py run --arch x86_64
./tools/testing/kunit/kunit.py run --alltests --arch x86_64
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit 2d5404caa8c7bb5c4e0435f94b28834ae5456623:
Linux 6.12-rc7 (2024-11-10 14:19:35 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux_kselftest-kunit-6.13-rc1
for you to fetch changes up to 67b6d342fb6d5abfbeb71e0f23141b9b96cf7bb1:
kunit: tool: print failed tests only (2024-11-14 09:38:19 -0700)
----------------------------------------------------------------
linux_kselftest-kunit-6.13-rc1
kunit update for Linux 6.13-rc1
-- fixes user-after-free (UAF) bug in kunit_init_suite()
-- adds option to kunit tool to print just the summary of test results
-- adds option to kunit tool to print just the failed test results
-- fixes kunit_zalloc_skb() to use user passed in gfp value instead of
hardcoding GFP_KERNEL
-- fixes kunit_zalloc_skb() kernel doc to include allocation flags variable
----------------------------------------------------------------
Dan Carpenter (2):
kunit: skb: use "gfp" variable instead of hardcoding GFP_KERNEL
kunit: skb: add gfp to kernel doc for kunit_zalloc_skb()
David Gow (1):
kunit: tool: Only print the summary
Jinjie Ruan (1):
kunit: string-stream: Fix a UAF bug in kunit_init_suite()
Rae Moar (1):
kunit: tool: print failed tests only
include/kunit/skbuff.h | 5 +-
lib/kunit/string-stream.c | 1 +
tools/testing/kunit/kunit.py | 28 ++++++-
tools/testing/kunit/kunit_parser.py | 134 +++++++++++++++++++++------------
tools/testing/kunit/kunit_printer.py | 14 +++-
tools/testing/kunit/kunit_tool_test.py | 55 +++++++-------
6 files changed, 151 insertions(+), 86 deletions(-)
----------------------------------------------------------------
page_frag test module is an out of tree module, but built
using KDIR as the main kernel tree, the mm test suite is
just getting skipped if newly added page_frag test module
fails to compile due to kernel not yet compiled.
Fix the above problem by ensuring both kernel is built first
and a newer kernel which has page_frag_cache.h is used.
CC: Andrew Morton <akpm(a)linux-foundation.org>
CC: Alexander Duyck <alexanderduyck(a)fb.com>
CC: Linux-MM <linux-mm(a)kvack.org>
Fixes: 7fef0dec415c ("mm: page_frag: add a test module for page_frag")
Fixes: 65941f10caf2 ("mm: move the page fragment allocator from page_alloc into its own file")
Reported-by: Mark Brown <broonie(a)kernel.org>
Signed-off-by: Yunsheng Lin <linyunsheng(a)huawei.com>
Tested-by: Mark Brown <broonie(a)kernel.org>
---
V2: Repost by adding net-next ML.
Note, page_frag test module is only in the net-next tree for now,
so target the net-next tree.
---
tools/testing/selftests/mm/Makefile | 18 ++++++++++++++++++
tools/testing/selftests/mm/page_frag/Makefile | 2 +-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile
index acec529baaca..04e04733fc8a 100644
--- a/tools/testing/selftests/mm/Makefile
+++ b/tools/testing/selftests/mm/Makefile
@@ -36,7 +36,16 @@ MAKEFLAGS += --no-builtin-rules
CFLAGS = -Wall -I $(top_srcdir) $(EXTRA_CFLAGS) $(KHDR_INCLUDES) $(TOOLS_INCLUDES)
LDLIBS = -lrt -lpthread -lm
+KDIR ?= /lib/modules/$(shell uname -r)/build
+ifneq (,$(wildcard $(KDIR)/Module.symvers))
+ifneq (,$(wildcard $(KDIR)/include/linux/page_frag_cache.h))
TEST_GEN_MODS_DIR := page_frag
+else
+PAGE_FRAG_WARNING = "missing page_frag_cache.h, please use a newer kernel"
+endif
+else
+PAGE_FRAG_WARNING = "missing Module.symvers, please have the kernel built first"
+endif
TEST_GEN_FILES = cow
TEST_GEN_FILES += compaction_test
@@ -214,3 +223,12 @@ warn_missing_liburing:
echo "Warning: missing liburing support. Some tests will be skipped." ; \
echo
endif
+
+ifneq ($(PAGE_FRAG_WARNING),)
+all: warn_missing_page_frag
+
+warn_missing_page_frag:
+ @echo ; \
+ echo "Warning: $(PAGE_FRAG_WARNING). page_frag test will be skipped." ; \
+ echo
+endif
diff --git a/tools/testing/selftests/mm/page_frag/Makefile b/tools/testing/selftests/mm/page_frag/Makefile
index 58dda74d50a3..8c8bb39ffa28 100644
--- a/tools/testing/selftests/mm/page_frag/Makefile
+++ b/tools/testing/selftests/mm/page_frag/Makefile
@@ -1,5 +1,5 @@
PAGE_FRAG_TEST_DIR := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
-KDIR ?= $(abspath $(PAGE_FRAG_TEST_DIR)/../../../../..)
+KDIR ?= /lib/modules/$(shell uname -r)/build
ifeq ($(V),1)
Q =
--
2.33.0
The series of patches are for doing basic tests
of NIC driver. Test comprises checks for auto-negotiation,
speed, duplex state and throughput between local NIC and
partner. Tools such as ethtool, iperf3 are used.
Signed-off-by: Mohan Prasad J <mohan.prasad(a)microchip.com>
---
Changes in v4:
- Type hints are added for arguments and return types.
- Test values can be modified through command line.
- Minor code improvements.
- GenerateTraffic class extended for throughput test.
- Protocol testcases separated.
Changes in v3:
Link to v3: https://patchwork.kernel.org/project/netdevbpf/cover/20241016215014.401476-…
- LinkConfig class is included in the hw library. This contains
generic APIs for doing link layer operations.
- Auto-negotiation checks involve changing the auto-neg state
both in local and partner NIC.
- Link layer test and performance test are separated to
different selftest files.
- Resetting of NIC driver done after test completion.
Changes in v2:
Link to v2: https://patchwork.kernel.org/project/netdevbpf/cover/20240917023525.2571082…
- Changed the hardcoded implementation of speed, duplex states,
throughput to generic values, in order to support all type
of NIC drivers.
- Test executes based on the supported link modes between local
NIC driver and partner.
- Instead of lan743x directory, selftest file is now relocated
to /selftests/drivers/net/hw.
Link to v1: https://patchwork.kernel.org/project/netdevbpf/cover/20240903221549.1215842…
---
Mohan Prasad J (3):
selftests: nic_link_layer: Add link layer selftest for NIC driver
selftests: nic_link_layer: Add selftest case for speed and duplex
states
selftests: nic_performance: Add selftest for performance of NIC driver
.../testing/selftests/drivers/net/hw/Makefile | 6 +-
.../drivers/net/hw/lib/py/__init__.py | 1 +
.../drivers/net/hw/lib/py/linkconfig.py | 222 ++++++++++++++++++
.../drivers/net/hw/nic_link_layer.py | 113 +++++++++
.../drivers/net/hw/nic_performance.py | 137 +++++++++++
.../selftests/drivers/net/lib/py/load.py | 20 +-
6 files changed, 496 insertions(+), 3 deletions(-)
create mode 100644 tools/testing/selftests/drivers/net/hw/lib/py/linkconfig.py
create mode 100644 tools/testing/selftests/drivers/net/hw/nic_link_layer.py
create mode 100644 tools/testing/selftests/drivers/net/hw/nic_performance.py
--
2.43.0
Hello,
this new series aims to migrate test_flow_dissector.sh into test_progs.
There are 2 "main" parts in test_flow_dissector.sh:
- a set of tests checking flow_dissector programs attachment to either
root namespace or non-root namespace
- dissection test
The first set is integrated in flow_dissector.c, which already contains
some existing tests for flow_dissector programs. This series uses the
opportunity to update a bit this file (use new assert, re-split tests,
etc)
The second part is migrated into a new file under test_progs,
flow_dissector_classification.c. It uses the same eBPF programs as
flow_dissector.c, but the difference is rather about how those program
are executed:
- flow_dissector.c manually runs programs with BPF_PROG_RUN
- flow_dissector_classification.c sends real packets to be dissected, and
so it also executes kernel code related to eBPF flow dissector (eg:
__skb_flow_bpf_to_target)
---
Changes in v2:
- allow tests to run in parallel
- move some generic helpers to network_helpers.h
- define proper function for ASSERT_MEMEQ
- fetch acked-by tags
- Link to v1: https://lore.kernel.org/r/20241113-flow_dissector-v1-0-27c4df0592dc@bootlin…
---
Alexis Lothoré (eBPF Foundation) (13):
selftests/bpf: add a macro to compare raw memory
selftests/bpf: use ASSERT_MEMEQ to compare bpf flow keys
selftests/bpf: replace CHECK calls with ASSERT macros in flow_dissector test
selftests/bpf: re-split main function into dedicated tests
selftests/bpf: expose all subtests from flow_dissector
selftests/bpf: add gre packets testing to flow_dissector
selftests/bpf: migrate flow_dissector namespace exclusivity test
selftests/bpf: Enable generic tc actions in selftests config
selftests/bpf: move ip checksum helper to network helpers
selftests/bpf: rename pseudo headers checksum computation
selftests/bpf: add network helpers to generate udp checksums
selftests/bpf: migrate bpf flow dissectors tests to test_progs
selftests/bpf: remove test_flow_dissector.sh
tools/testing/selftests/bpf/.gitignore | 1 -
tools/testing/selftests/bpf/Makefile | 3 +-
tools/testing/selftests/bpf/config | 1 +
tools/testing/selftests/bpf/network_helpers.h | 64 +-
.../selftests/bpf/prog_tests/flow_dissector.c | 323 +++++++--
.../bpf/prog_tests/flow_dissector_classification.c | 807 +++++++++++++++++++++
.../selftests/bpf/prog_tests/xdp_metadata.c | 24 +-
tools/testing/selftests/bpf/test_flow_dissector.c | 780 --------------------
tools/testing/selftests/bpf/test_flow_dissector.sh | 178 -----
tools/testing/selftests/bpf/test_progs.c | 15 +
tools/testing/selftests/bpf/test_progs.h | 15 +
tools/testing/selftests/bpf/xdp_hw_metadata.c | 12 +-
12 files changed, 1153 insertions(+), 1070 deletions(-)
---
base-commit: 9e71d50d3befb93a6394b0979f8ebd0dc9bd8d0f
change-id: 20241019-flow_dissector-3eb0c07fc163
Best regards,
--
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com