[PATCH v2 0/3] Maintainer Entry Profiles
by Dan Williams
Changes since v1 [1]:
- Simplify the profile to a hopefully non-controversial set of
attributes that address the most common sources of contributor
confusion, or maintainer frustration.
- Rename "Subsystem Profile" to "Maintainer Entry Profile". Not every
entry in MAINTAINERS represents a full subsystem. There may be driver
local considerations to communicate to a submitter in addition to wider
subsystem guidelines.
- Delete the old P: tag in MAINTAINERS rather than convert to a new E:
tag (Joe Perches).
[1]: http://lore.kernel.org/r/154225759358.2499188.15268218778137905050.stgit@...
---
At last years Plumbers Conference I proposed the Maintainer Entry
Profile as a document that a maintainer can provide to set contributor
expectations and provide fodder for a discussion between maintainers
about the merits of different maintainer policies.
For those that did not attend, the goal of the Maintainer Entry Profile,
and the Maintainer Handbook more generally, is to provide a desk
reference for maintainers both new and experienced. The session
introduction was:
The first rule of kernel maintenance is that there are no hard and
fast rules. That state of affairs is both a blessing and a curse. It
has served the community well to be adaptable to the different
people and different problem spaces that inhabit the kernel
community. However, that variability also leads to inconsistent
experiences for contributors, little to no guidance for new
contributors, and unnecessary stress on current maintainers. There
are quite a few of people who have been around long enough to make
enough mistakes that they have gained some hard earned proficiency.
However if the kernel community expects to keep growing it needs to
be able both scale the maintainers it has and ramp new ones without
necessarily let them make a decades worth of mistakes to learn the
ropes.
To be clear, the proposed document does not impose or suggest new
rules. Instead it provides an outlet to document the unwritten rules
and policies in effect for each subsystem, and that each subsystem
might decide differently for whatever reason.
---
Dan Williams (3):
MAINTAINERS: Reclaim the P: tag for Maintainer Entry Profile
Maintainer Handbook: Maintainer Entry Profile
libnvdimm, MAINTAINERS: Maintainer Entry Profile
Documentation/maintainer/index.rst | 1
.../maintainer/maintainer-entry-profile.rst | 99 ++++++++++++++++++++
Documentation/nvdimm/maintainer-entry-profile.rst | 64 +++++++++++++
MAINTAINERS | 20 ++--
4 files changed, 175 insertions(+), 9 deletions(-)
create mode 100644 Documentation/maintainer/maintainer-entry-profile.rst
create mode 100644 Documentation/nvdimm/maintainer-entry-profile.rst
9 months
[PATCH v3 00/19][RFC] virtio-fs: Enable DAX support
by Vivek Goyal
Hi,
This patch series enables DAX support for virtio-fs filesystem. Patches
are based on 5.3-rc5 kernel and need first patch series posted for
virtio-fs support with subject "virtio-fs: shared file system for virtual
machines".
https://www.redhat.com/archives/virtio-fs/2019-August/msg00281.html
Enabling DAX seems to improve performance for most of the operations
in general a great deal. I have reported performance numbers in first patch
series so I am not repeating these here.
Any comments or feedback is welcome.
Thanks
Vivek
Sebastien Boeuf (3):
virtio: Add get_shm_region method
virtio: Implement get_shm_region for PCI transport
virtio: Implement get_shm_region for MMIO transport
Stefan Hajnoczi (4):
dax: remove block device dependencies
fuse, dax: add fuse_conn->dax_dev field
virtio_fs, dax: Set up virtio_fs dax_device
fuse, dax: add DAX mmap support
Vivek Goyal (12):
dax: Pass dax_dev to dax_writeback_mapping_range()
fuse: Keep a list of free dax memory ranges
fuse: implement FUSE_INIT map_alignment field
fuse: Introduce setupmapping/removemapping commands
fuse, dax: Implement dax read/write operations
fuse: Define dax address space operations
fuse, dax: Take ->i_mmap_sem lock during dax page fault
fuse: Maintain a list of busy elements
dax: Create a range version of dax_layout_busy_page()
fuse: Add logic to free up a memory range
fuse: Release file in process context
fuse: Take inode lock for dax inode truncation
drivers/dax/super.c | 3 +-
drivers/virtio/virtio_mmio.c | 32 +
drivers/virtio/virtio_pci_modern.c | 108 +++
fs/dax.c | 89 +-
fs/ext2/inode.c | 2 +-
fs/ext4/inode.c | 2 +-
fs/fuse/cuse.c | 3 +-
fs/fuse/dir.c | 2 +
fs/fuse/file.c | 1206 +++++++++++++++++++++++++++-
fs/fuse/fuse_i.h | 99 ++-
fs/fuse/inode.c | 138 +++-
fs/fuse/virtio_fs.c | 134 +++-
fs/xfs/xfs_aops.c | 2 +-
include/linux/dax.h | 12 +-
include/linux/virtio_config.h | 17 +
include/uapi/linux/fuse.h | 47 +-
include/uapi/linux/virtio_fs.h | 3 +
include/uapi/linux/virtio_mmio.h | 11 +
include/uapi/linux/virtio_pci.h | 11 +-
19 files changed, 1868 insertions(+), 53 deletions(-)
--
2.20.1
11 months, 2 weeks
[PATCH v6] mm/pgmap: Use correct alignment when looking at first pfn from a region
by Aneesh Kumar K.V
vmem_altmap_offset() adjust the section aligned base_pfn offset.
So we need to make sure we account for the same when computing base_pfn.
ie, for altmap_valid case, our pfn_first should be:
pfn_first = altmap->base_pfn + vmem_altmap_offset(altmap);
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar(a)linux.ibm.com>
---
* changes from v5
* update commit subject and use linux-mm for merge
mm/memremap.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/mm/memremap.c b/mm/memremap.c
index ed70c4e8e52a..233908d7df75 100644
--- a/mm/memremap.c
+++ b/mm/memremap.c
@@ -54,8 +54,16 @@ static void pgmap_array_delete(struct resource *res)
static unsigned long pfn_first(struct dev_pagemap *pgmap)
{
- return PHYS_PFN(pgmap->res.start) +
- vmem_altmap_offset(pgmap_altmap(pgmap));
+ const struct resource *res = &pgmap->res;
+ struct vmem_altmap *altmap = pgmap_altmap(pgmap);
+ unsigned long pfn;
+
+ if (altmap) {
+ pfn = altmap->base_pfn + vmem_altmap_offset(altmap);
+ } else
+ pfn = PHYS_PFN(res->start);
+
+ return pfn;
}
static unsigned long pfn_end(struct dev_pagemap *pgmap)
--
2.21.0
12 months
Lease semantic proposal
by Ira Weiny
Since the last RFC patch set[1] much of the discussion of supporting RDMA with
FS DAX has been around the semantics of the lease mechanism.[2] Within that
thread it was suggested I try and write some documentation and/or tests for the
new mechanism being proposed. I have created a foundation to test lease
functionality within xfstests.[3] This should be close to being accepted.
Before writing additional lease tests, or changing lots of kernel code, this
email presents documentation for the new proposed "layout lease" semantic.
At Linux Plumbers[4] just over a week ago, I presented the current state of the
patch set and the outstanding issues. Based on the discussion there, well as
follow up emails, I propose the following addition to the fcntl() man page.
Thank you,
Ira
[1] https://lkml.org/lkml/2019/8/9/1043
[2] https://lkml.org/lkml/2019/8/9/1062
[3] https://www.spinics.net/lists/fstests/msg12620.html
[4] https://linuxplumbersconf.org/event/4/contributions/368/
<fcntl man page addition>
Layout Leases
-------------
Layout (F_LAYOUT) leases are special leases which can be used to control and/or
be informed about the manipulation of the underlying layout of a file.
A layout is defined as the logical file block -> physical file block mapping
including the file size and sharing of physical blocks among files. Note that
the unwritten state of a block is not considered part of file layout.
**Read layout lease F_RDLCK | F_LAYOUT**
Read layout leases can be used to be informed of layout changes by the
system or other users. This lease is similar to the standard read (F_RDLCK)
lease in that any attempt to change the _layout_ of the file will be reported to
the process through the lease break process. But this lease is different
because the file can be opened for write and data can be read and/or written to
the file as long as the underlying layout of the file does not change.
Therefore, the lease is not broken if the file is simply open for write, but
_may_ be broken if an operation such as, truncate(), fallocate() or write()
results in changing the underlying layout.
**Write layout lease (F_WRLCK | F_LAYOUT)**
Write Layout leases can be used to break read layout leases to indicate that
the process intends to change the underlying layout lease of the file.
A process which has taken a write layout lease has exclusive ownership of the
file layout and can modify that layout as long as the lease is held.
Operations which change the layout are allowed by that process. But operations
from other file descriptors which attempt to change the layout will break the
lease through the standard lease break process. The F_LAYOUT flag is used to
indicate a difference between a regular F_WRLCK and F_WRLCK with F_LAYOUT. In
the F_LAYOUT case opens for write do not break the lease. But some operations,
if they change the underlying layout, may.
The distinction between read layout leases and write layout leases is that
write layout leases can change the layout without breaking the lease within the
owning process. This is useful to guarantee a layout prior to specifying the
unbreakable flag described below.
**Unbreakable Layout Leases (F_UNBREAK)**
In order to support pinning of file pages by direct user space users an
unbreakable flag (F_UNBREAK) can be used to modify the read and write layout
lease. When specified, F_UNBREAK indicates that any user attempting to break
the lease will fail with ETXTBUSY rather than follow the normal breaking
procedure.
Both read and write layout leases can have the unbreakable flag (F_UNBREAK)
specified. The difference between an unbreakable read layout lease and an
unbreakable write layout lease are that an unbreakable read layout lease is
_not_ exclusive. This means that once a layout is established on a file,
multiple unbreakable read layout leases can be taken by multiple processes and
used to pin the underlying pages of that file.
Care must therefore be taken to ensure that the layout of the file is as the
user wants prior to using the unbreakable read layout lease. A safe mechanism
to do this would be to take a write layout lease and use fallocate() to set the
layout of the file. The layout lease can then be "downgraded" to unbreakable
read layout as long as no other user broke the write layout lease.
</fcntl man page addition>
1 year
[LSF/MM TOPIC] The end of the DAX experiment
by Dan Williams
Before people get too excited this isn't a proposal to kill DAX. The
topic proposal is a discussion to resolve lingering open questions
that currently motivate ext4 and xfs to scream "EXPERIMENTAL" when the
current DAX facilities are enabled. The are 2 primary concerns to
resolve. Enumerate the remaining features/fixes, and identify a path
to implement it all without regressing any existing application use
cases.
An enumeration of remaining projects follows, please expand this list
if I missed something:
* "DAX" has no specific meaning by itself, users have 2 use cases for
"DAX" capabilities: userspace cache management via MAP_SYNC, and page
cache avoidance where the latter aspect of DAX has no current api to
discover / use it. The project is to supplement MAP_SYNC with a
MAP_DIRECT facility and MADV_SYNC / MADV_DIRECT to indicate the same
dynamically via madvise. Similar to O_DIRECT, MAP_DIRECT would be an
application hint to avoid / minimiize page cache usage, but no strict
guarantee like what MAP_SYNC provides.
* Resolve all "if (dax) goto fail;" patterns in the kernel. Outside of
longterm-GUP (a topic in its own right) the projects here are
XFS-reflink and XFS-realtime-device support. DAX+reflink effectively
requires a given physical page to be mapped into two different inodes
at different (page->index) offsets. The challenge is to support
DAX-reflink without violating any existing application visible
semantics, the operating assumption / strawman to debate is that
experimental status is not blanket permission to go change existing
semantics in backwards incompatible ways.
* Deprecate, but not remove, the DAX mount option. Too many flows
depend on the option so it will never go away, but the facility is too
coarse. Provide an option to enable MAP_SYNC and
more-likely-to-do-something-useful-MAP_DIRECT on a per-directory
basis. The current proposal is to allow this property to only be
toggled while the directory is empty to avoid the complications of
racing page invalidation with new DAX mappings.
Secondary projects, i.e. important but I would submit are not in the
critical path to removing the "experimental" designation:
* Filesystem-integrated badblock management. Hook up the media error
notifications from libnvdimm to the filesystem to allow for operations
like "list files with media errors" and "enumerate bad file offsets on
a granulatiy smaller than a page". Another consideration along these
lines is to integrate machine-check-handling and dynamic error
notification into a filesystem interface. I've heard complaints that
the sigaction() based mechanism to receive BUS_MCEERR_* information,
while sufficient for the "System RAM" use case, is not precise enough
for the "Persistent Memory / DAX" use case where errors are repairable
and sub-page error information is useful.
* Userfaultfd for file-backed mappings and DAX
Ideally all the usual DAX, persistent memory, and GUP suspects could
be in the room to discuss this:
* Jan Kara
* Dave Chinner
* Christoph Hellwig
* Jeff Moyer
* Johannes Thumshirn
* Matthew Wilcox
* John Hubbard
* Jérôme Glisse
* MM folks for the reflink vs 'struct page' vs Xarray considerations
1 year, 1 month
[PATCH 1/2] rename nfit_test_bus with a more generic name
by Santosh Sivaraj
This cleanup would avoid confusion when ndctl is used for testing
on non-nfit platforms.
Signed-off-by: Santosh Sivaraj <santosh(a)fossix.org>
---
test/blk-exhaust.sh | 14 +++++++-------
test/btt-check.sh | 8 ++++----
test/btt-errors.sh | 22 +++++++++++-----------
test/btt-pad-compat.sh | 12 ++++++------
test/clear.sh | 12 ++++++------
test/common | 10 +++++-----
test/create.sh | 10 +++++-----
test/daxdev-errors.sh | 14 +++++++-------
test/firmware-update.sh | 8 ++++----
test/inject-error.sh | 8 ++++----
test/inject-smart.sh | 2 +-
test/label-compat.sh | 10 +++++-----
test/max_available_extent_ns.sh | 8 ++++----
test/monitor.sh | 10 +++++-----
test/multi-dax.sh | 12 ++++++------
test/pfn-meta-errors.sh | 8 ++++----
test/pmem-errors.sh | 8 ++++----
test/rescan-partitions.sh | 8 ++++----
test/sector-mode.sh | 14 +++++++-------
test/security.sh | 14 +++++++-------
20 files changed, 106 insertions(+), 106 deletions(-)
diff --git a/test/blk-exhaust.sh b/test/blk-exhaust.sh
index 326ce73..067ed27 100755
--- a/test/blk-exhaust.sh
+++ b/test/blk-exhaust.sh
@@ -23,17 +23,17 @@ trap 'err $LINENO' ERR
# setup (reset nfit_test dimms)
modprobe nfit_test
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+$NDCTL disable-region -b $TEST_BUS0 all
+$NDCTL zero-labels -b $TEST_BUS0 all
+$NDCTL enable-region -b $TEST_BUS0 all
# if the kernel accounting is correct we should be able to create two
# pmem and two blk namespaces on nfit_test.0
rc=1
-$NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem
-$NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem
-$NDCTL create-namespace -b $NFIT_TEST_BUS0 -t blk -m raw
-$NDCTL create-namespace -b $NFIT_TEST_BUS0 -t blk -m raw
+$NDCTL create-namespace -b $TEST_BUS0 -t pmem
+$NDCTL create-namespace -b $TEST_BUS0 -t pmem
+$NDCTL create-namespace -b $TEST_BUS0 -t blk -m raw
+$NDCTL create-namespace -b $TEST_BUS0 -t blk -m raw
# clearnup and exit
_cleanup
diff --git a/test/btt-check.sh b/test/btt-check.sh
index ceabee5..c91a5ad 100755
--- a/test/btt-check.sh
+++ b/test/btt-check.sh
@@ -37,7 +37,7 @@ check_min_kver "4.14" || do_skip "may not support badblocks clearing on pmem via
create()
{
- json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m sector)
+ json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m sector)
rc=2
eval "$(echo "$json" | json2var)"
[ -n "$dev" ] || err "$LINENO"
@@ -50,9 +50,9 @@ create()
reset()
{
- $NDCTL disable-region -b $NFIT_TEST_BUS0 all
- $NDCTL zero-labels -b $NFIT_TEST_BUS0 all
- $NDCTL enable-region -b $NFIT_TEST_BUS0 all
+ $NDCTL disable-region -b $TEST_BUS0 all
+ $NDCTL zero-labels -b $TEST_BUS0 all
+ $NDCTL enable-region -b $TEST_BUS0 all
}
# re-enable the BTT namespace, and do IO to it in an attempt to
diff --git a/test/btt-errors.sh b/test/btt-errors.sh
index cb35865..65224b3 100755
--- a/test/btt-errors.sh
+++ b/test/btt-errors.sh
@@ -54,15 +54,15 @@ trap 'err $LINENO cleanup' ERR
# setup (reset nfit_test dimms)
modprobe nfit_test
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+$NDCTL disable-region -b $TEST_BUS0 all
+$NDCTL zero-labels -b $TEST_BUS0 all
+$NDCTL enable-region -b $TEST_BUS0 all
rc=1
# create a btt namespace and clear errors (if any)
dev="x"
-json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m sector)
+json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m sector)
eval "$(echo "$json" | json2var)"
[ $dev = "x" ] && echo "fail: $LINENO" && exit 1
@@ -135,11 +135,11 @@ dd if=$MNT/$FILE of=/dev/null iflag=direct bs=4096 count=1
# reset everything to get a clean log
if grep -q "$MNT" /proc/mounts; then umount $MNT; fi
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+$NDCTL disable-region -b $TEST_BUS0 all
+$NDCTL zero-labels -b $TEST_BUS0 all
+$NDCTL enable-region -b $TEST_BUS0 all
dev="x"
-json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m sector)
+json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m sector)
eval "$(echo "$json" | json2var)"
[ $dev = "x" ] && echo "fail: $LINENO" && exit 1
@@ -157,8 +157,8 @@ force_raw 0
dd if=/dev/$blockdev of=/dev/null iflag=direct bs=4096 count=1 && err $LINENO || true
# done, exit
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+$NDCTL disable-region -b $TEST_BUS0 all
+$NDCTL zero-labels -b $TEST_BUS0 all
+$NDCTL enable-region -b $TEST_BUS0 all
_cleanup
exit 0
diff --git a/test/btt-pad-compat.sh b/test/btt-pad-compat.sh
index 2c1f271..a5fc796 100755
--- a/test/btt-pad-compat.sh
+++ b/test/btt-pad-compat.sh
@@ -31,7 +31,7 @@ trap 'err $LINENO' ERR
create()
{
- json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m sector)
+ json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m sector)
rc=2
eval "$(echo "$json" | json2var)"
[ -n "$dev" ] || err "$LINENO"
@@ -47,9 +47,9 @@ create()
reset()
{
- $NDCTL disable-region -b $NFIT_TEST_BUS0 all
- $NDCTL zero-labels -b $NFIT_TEST_BUS0 all
- $NDCTL enable-region -b $NFIT_TEST_BUS0 all
+ $NDCTL disable-region -b $TEST_BUS0 all
+ $NDCTL zero-labels -b $TEST_BUS0 all
+ $NDCTL enable-region -b $TEST_BUS0 all
}
verify_idx()
@@ -120,7 +120,7 @@ create_oldfmt_ns()
# that supports a raw namespace with a 4K sector size, prior to
# v4.13 raw namespaces are limited to 512-byte sector size.
rc=77
- json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -s 64M -t pmem -m raw -l 4096 -u 00000000-0000-0000-0000-000000000000)
+ json=$($NDCTL create-namespace -b $TEST_BUS0 -s 64M -t pmem -m raw -l 4096 -u 00000000-0000-0000-0000-000000000000)
rc=2
eval "$(echo "$json" | json2var)"
[ -n "$dev" ] || err "$LINENO"
@@ -128,7 +128,7 @@ create_oldfmt_ns()
[ $size -gt 0 ] || err "$LINENO"
# reconfig it to sector mode
- json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -e $dev -m sector --force)
+ json=$($NDCTL create-namespace -b $TEST_BUS0 -e $dev -m sector --force)
eval "$(echo "$json" | json2var)"
[ -n "$dev" ] || err "$LINENO"
[ -n "$size" ] || err "$LINENO"
diff --git a/test/clear.sh b/test/clear.sh
index 17d5bed..f0b4a9b 100755
--- a/test/clear.sh
+++ b/test/clear.sh
@@ -23,15 +23,15 @@ trap 'err $LINENO' ERR
# setup (reset nfit_test dimms)
modprobe nfit_test
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+$NDCTL disable-region -b $TEST_BUS0 all
+$NDCTL zero-labels -b $TEST_BUS0 all
+$NDCTL enable-region -b $TEST_BUS0 all
rc=1
# create pmem
dev="x"
-json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m raw)
+json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m raw)
eval $(echo $json | json2var)
[ $dev = "x" ] && echo "fail: $LINENO" && exit 1
[ $mode != "raw" ] && echo "fail: $LINENO" && exit 1
@@ -73,8 +73,8 @@ fi
if check_min_kver "4.9"; then
# check for re-appearance of stale badblocks from poison_list
- $NDCTL disable-region -b $NFIT_TEST_BUS0 all
- $NDCTL enable-region -b $NFIT_TEST_BUS0 all
+ $NDCTL disable-region -b $TEST_BUS0 all
+ $NDCTL enable-region -b $TEST_BUS0 all
# since we have cleared the errors, a disable/reenable shouldn't bring them back
if read sector len < /sys/block/$blockdev/badblocks; then
diff --git a/test/common b/test/common
index 1814a0c..54085ae 100644
--- a/test/common
+++ b/test/common
@@ -27,10 +27,10 @@ else
fi
-# NFIT_TEST_BUS[01]
+# TEST_BUS[01]
#
-NFIT_TEST_BUS0="nfit_test.0"
-NFIT_TEST_BUS1="nfit_test.1"
+TEST_BUS0="nfit_test.0"
+TEST_BUS1="nfit_test.1"
ACPI_BUS="ACPI.NFIT"
E820_BUS="e820"
@@ -82,8 +82,8 @@ check_prereq()
#
_cleanup()
{
- $NDCTL disable-region -b $NFIT_TEST_BUS0 all
- $NDCTL disable-region -b $NFIT_TEST_BUS1 all
+ $NDCTL disable-region -b $TEST_BUS0 all
+ $NDCTL disable-region -b $TEST_BUS1 all
modprobe -r nfit_test
}
diff --git a/test/create.sh b/test/create.sh
index 8d78797..1398c79 100755
--- a/test/create.sh
+++ b/test/create.sh
@@ -24,15 +24,15 @@ trap 'err $LINENO' ERR
# setup (reset nfit_test dimms)
modprobe nfit_test
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+$NDCTL disable-region -b $TEST_BUS0 all
+$NDCTL zero-labels -b $TEST_BUS0 all
+$NDCTL enable-region -b $TEST_BUS0 all
rc=1
# create pmem
dev="x"
-json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m raw)
+json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m raw)
eval $(echo $json | json2var )
[ $dev = "x" ] && echo "fail: $LINENO" && exit 1
[ $mode != "raw" ] && echo "fail: $LINENO" && exit 1
@@ -53,7 +53,7 @@ $NDCTL destroy-namespace -f $dev
# create blk
dev="x"
-json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t blk -m raw -v)
+json=$($NDCTL create-namespace -b $TEST_BUS0 -t blk -m raw -v)
eval $(echo $json | json2var)
[ $dev = "x" ] && echo "fail: $LINENO" && exit 1
[ $mode != "raw" ] && echo "fail: $LINENO" && exit 1
diff --git a/test/daxdev-errors.sh b/test/daxdev-errors.sh
index c5adb72..c877874 100755
--- a/test/daxdev-errors.sh
+++ b/test/daxdev-errors.sh
@@ -23,16 +23,16 @@ trap 'err $LINENO' ERR
# setup (reset nfit_test dimms)
modprobe nfit_test
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+$NDCTL disable-region -b $TEST_BUS0 all
+$NDCTL zero-labels -b $TEST_BUS0 all
+$NDCTL enable-region -b $TEST_BUS0 all
rc=1
query=". | sort_by(.available_size) | reverse | .[0].dev"
-region=$($NDCTL list -b $NFIT_TEST_BUS0 -t pmem -Ri | jq -r "$query")
+region=$($NDCTL list -b $TEST_BUS0 -t pmem -Ri | jq -r "$query")
-json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a 4096)
+json=$($NDCTL create-namespace -b $TEST_BUS0 -r $region -t pmem -m devdax -a 4096)
chardev=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev")
#{
@@ -53,11 +53,11 @@ chardev=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[
# }
#}
-json1=$($NDCTL list -b $NFIT_TEST_BUS0 --mode=devdax --namespaces)
+json1=$($NDCTL list -b $TEST_BUS0 --mode=devdax --namespaces)
eval $(echo $json1 | json2var)
nsdev=$dev
-json1=$($NDCTL list -b $NFIT_TEST_BUS0)
+json1=$($NDCTL list -b $TEST_BUS0)
eval $(echo $json1 | json2var)
busdev=$dev
diff --git a/test/firmware-update.sh b/test/firmware-update.sh
index 7852e58..dbd5c7f 100755
--- a/test/firmware-update.sh
+++ b/test/firmware-update.sh
@@ -12,9 +12,9 @@ trap 'err $LINENO' ERR
reset()
{
- $NDCTL disable-region -b $NFIT_TEST_BUS0 all
- $NDCTL zero-labels -b $NFIT_TEST_BUS0 all
- $NDCTL enable-region -b $NFIT_TEST_BUS0 all
+ $NDCTL disable-region -b $TEST_BUS0 all
+ $NDCTL zero-labels -b $TEST_BUS0 all
+ $NDCTL enable-region -b $TEST_BUS0 all
if [ -f $image ]; then
rm -f $image
fi
@@ -22,7 +22,7 @@ reset()
detect()
{
- dev=$($NDCTL list -b $NFIT_TEST_BUS0 -D | jq .[0].dev | tr -d '"')
+ dev=$($NDCTL list -b $TEST_BUS0 -D | jq .[0].dev | tr -d '"')
[ -n "$dev" ] || err "$LINENO"
}
diff --git a/test/inject-error.sh b/test/inject-error.sh
index 49e68b3..3e33a1b 100755
--- a/test/inject-error.sh
+++ b/test/inject-error.sh
@@ -35,7 +35,7 @@ check_min_kver "4.15" || do_skip "kernel $KVER may not support error injection"
create()
{
- json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem --align=4k)
+ json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem --align=4k)
rc=2
eval "$(echo "$json" | json2var)"
[ -n "$dev" ] || err "$LINENO"
@@ -46,9 +46,9 @@ create()
reset()
{
- $NDCTL disable-region -b $NFIT_TEST_BUS0 all
- $NDCTL zero-labels -b $NFIT_TEST_BUS0 all
- $NDCTL enable-region -b $NFIT_TEST_BUS0 all
+ $NDCTL disable-region -b $TEST_BUS0 all
+ $NDCTL zero-labels -b $TEST_BUS0 all
+ $NDCTL enable-region -b $TEST_BUS0 all
}
check_status()
diff --git a/test/inject-smart.sh b/test/inject-smart.sh
index 18655ba..fa18a58 100755
--- a/test/inject-smart.sh
+++ b/test/inject-smart.sh
@@ -4,7 +4,7 @@
rc=77
. ./common
-bus="$NFIT_TEST_BUS0"
+bus="$TEST_BUS0"
inj_val="42"
trap 'err $LINENO' ERR
diff --git a/test/label-compat.sh b/test/label-compat.sh
index dc6226d..a31bf4a 100755
--- a/test/label-compat.sh
+++ b/test/label-compat.sh
@@ -23,12 +23,12 @@ trap 'err $LINENO' ERR
# setup (reset nfit_test dimms)
modprobe nfit_test
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
+$NDCTL disable-region -b $TEST_BUS0 all
+$NDCTL zero-labels -b $TEST_BUS0 all
-# grab the largest pmem region on -b $NFIT_TEST_BUS0
+# grab the largest pmem region on -b $TEST_BUS0
query=". | sort_by(.available_size) | reverse | .[0].dev"
-region=$($NDCTL list -b $NFIT_TEST_BUS0 -t pmem -Ri | jq -r "$query")
+region=$($NDCTL list -b $TEST_BUS0 -t pmem -Ri | jq -r "$query")
# we assume that $region is comprised of 4 dimms
query=". | .regions[0].mappings | sort_by(.dimm) | .[].dimm"
@@ -40,7 +40,7 @@ do
i=$((i+1))
done
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+$NDCTL enable-region -b $TEST_BUS0 all
len=$($NDCTL list -r $region -N | jq -r "length")
diff --git a/test/max_available_extent_ns.sh b/test/max_available_extent_ns.sh
index 1c7e7bf..5701195 100755
--- a/test/max_available_extent_ns.sh
+++ b/test/max_available_extent_ns.sh
@@ -13,14 +13,14 @@ check_min_kver "4.19" || do_skip "kernel $KVER may not support max_available_siz
init()
{
- $NDCTL disable-region -b $NFIT_TEST_BUS0 all
- $NDCTL zero-labels -b $NFIT_TEST_BUS0 all
- $NDCTL enable-region -b $NFIT_TEST_BUS0 all
+ $NDCTL disable-region -b $TEST_BUS0 all
+ $NDCTL zero-labels -b $TEST_BUS0 all
+ $NDCTL enable-region -b $TEST_BUS0 all
}
do_test()
{
- region=$($NDCTL list -b $NFIT_TEST_BUS0 -R -t pmem | jq -r 'sort_by(-.size) | .[].dev' | head -1)
+ region=$($NDCTL list -b $TEST_BUS0 -R -t pmem | jq -r 'sort_by(-.size) | .[].dev' | head -1)
available_sz=$($NDCTL list -r $region | jq -r .[].available_size)
size=$(( available_sz/4 ))
diff --git a/test/monitor.sh b/test/monitor.sh
index 29d4ea1..c9f7224 100755
--- a/test/monitor.sh
+++ b/test/monitor.sh
@@ -20,9 +20,9 @@ check_min_kver "4.15" || do_skip "kernel $KVER may not support monitor service"
init()
{
- $NDCTL disable-region -b $NFIT_TEST_BUS0 all
- $NDCTL zero-labels -b $NFIT_TEST_BUS0 all
- $NDCTL enable-region -b $NFIT_TEST_BUS0 all
+ $NDCTL disable-region -b $TEST_BUS0 all
+ $NDCTL zero-labels -b $TEST_BUS0 all
+ $NDCTL enable-region -b $TEST_BUS0 all
}
start_monitor()
@@ -36,10 +36,10 @@ start_monitor()
set_smart_supported_bus()
{
- smart_supported_bus=$NFIT_TEST_BUS0
+ smart_supported_bus=$TEST_BUS0
monitor_dimms=$(./list-smart-dimm -b $smart_supported_bus | jq -r .[0].dev)
if [ -z $monitor_dimms ]; then
- smart_supported_bus=$NFIT_TEST_BUS1
+ smart_supported_bus=$TEST_BUS1
fi
}
diff --git a/test/multi-dax.sh b/test/multi-dax.sh
index 0829bf2..1dca352 100755
--- a/test/multi-dax.sh
+++ b/test/multi-dax.sh
@@ -23,17 +23,17 @@ trap 'err $LINENO' ERR
# setup (reset nfit_test dimms)
modprobe nfit_test
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+$NDCTL disable-region -b $TEST_BUS0 all
+$NDCTL zero-labels -b $TEST_BUS0 all
+$NDCTL enable-region -b $TEST_BUS0 all
rc=1
query=". | sort_by(.available_size) | reverse | .[0].dev"
-region=$($NDCTL list -b $NFIT_TEST_BUS0 -t pmem -Ri | jq -r "$query")
+region=$($NDCTL list -b $TEST_BUS0 -t pmem -Ri | jq -r "$query")
-json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a 4096 -s 16M)
+json=$($NDCTL create-namespace -b $TEST_BUS0 -r $region -t pmem -m devdax -a 4096 -s 16M)
chardev1=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev")
-json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a 4096 -s 16M)
+json=$($NDCTL create-namespace -b $TEST_BUS0 -r $region -t pmem -m devdax -a 4096 -s 16M)
chardev2=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev")
_cleanup
diff --git a/test/pfn-meta-errors.sh b/test/pfn-meta-errors.sh
index 2b57f19..f930325 100755
--- a/test/pfn-meta-errors.sh
+++ b/test/pfn-meta-errors.sh
@@ -30,15 +30,15 @@ trap 'err $LINENO' ERR
# setup (reset nfit_test dimms)
modprobe nfit_test
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+$NDCTL disable-region -b $TEST_BUS0 all
+$NDCTL zero-labels -b $TEST_BUS0 all
+$NDCTL enable-region -b $TEST_BUS0 all
rc=1
# create a fsdax namespace and clear errors (if any)
dev="x"
-json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m fsdax)
+json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m fsdax)
eval "$(echo "$json" | json2var)"
[ $dev = "x" ] && echo "fail: $LINENO" && exit 1
diff --git a/test/pmem-errors.sh b/test/pmem-errors.sh
index 9553a3f..8ce57c8 100755
--- a/test/pmem-errors.sh
+++ b/test/pmem-errors.sh
@@ -28,15 +28,15 @@ trap 'err $LINENO cleanup' ERR
# setup (reset nfit_test dimms)
modprobe nfit_test
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+$NDCTL disable-region -b $TEST_BUS0 all
+$NDCTL zero-labels -b $TEST_BUS0 all
+$NDCTL enable-region -b $TEST_BUS0 all
rc=1
# create pmem
dev="x"
-json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m raw)
+json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m raw)
eval $(echo $json | json2var)
[ $dev = "x" ] && echo "fail: $LINENO" && false
[ $mode != "raw" ] && echo "fail: $LINENO" && false
diff --git a/test/rescan-partitions.sh b/test/rescan-partitions.sh
index 9c7b7a0..5e01665 100755
--- a/test/rescan-partitions.sh
+++ b/test/rescan-partitions.sh
@@ -27,9 +27,9 @@ check_prereq "blockdev"
reset()
{
- $NDCTL disable-region -b $NFIT_TEST_BUS0 all
- $NDCTL zero-labels -b $NFIT_TEST_BUS0 all
- $NDCTL enable-region -b $NFIT_TEST_BUS0 all
+ $NDCTL disable-region -b $TEST_BUS0 all
+ $NDCTL zero-labels -b $TEST_BUS0 all
+ $NDCTL enable-region -b $TEST_BUS0 all
}
test_mode()
@@ -37,7 +37,7 @@ test_mode()
local mode="$1"
# create namespace
- json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m "$mode")
+ json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m "$mode")
rc=2
eval "$(echo "$json" | json2var)"
[ -n "$dev" ] || err "$LINENO"
diff --git a/test/sector-mode.sh b/test/sector-mode.sh
index 4b964c5..7f60452 100755
--- a/test/sector-mode.sh
+++ b/test/sector-mode.sh
@@ -20,17 +20,17 @@ trap 'err $LINENO' ERR
# setup (reset nfit_test dimms)
modprobe nfit_test
-$NDCTL disable-region -b $NFIT_TEST_BUS0 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
-$NDCTL enable-region -b $NFIT_TEST_BUS0 all
+$NDCTL disable-region -b $TEST_BUS0 all
+$NDCTL zero-labels -b $TEST_BUS0 all
+$NDCTL enable-region -b $TEST_BUS0 all
-$NDCTL disable-region -b $NFIT_TEST_BUS1 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS1 all
-$NDCTL enable-region -b $NFIT_TEST_BUS1 all
+$NDCTL disable-region -b $TEST_BUS1 all
+$NDCTL zero-labels -b $TEST_BUS1 all
+$NDCTL enable-region -b $TEST_BUS1 all
rc=1
query=". | sort_by(.size) | reverse | .[0].dev"
-NAMESPACE=$($NDCTL list -b $NFIT_TEST_BUS1 -N | jq -r "$query")
+NAMESPACE=$($NDCTL list -b $TEST_BUS1 -N | jq -r "$query")
REGION=$($NDCTL list -R --namespace=$NAMESPACE | jq -r "(.[]) | .dev")
echo 0 > /sys/bus/nd/devices/$REGION/read_only
$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m sector -f -l 4K
diff --git a/test/security.sh b/test/security.sh
index c86d2c6..80d64df 100755
--- a/test/security.sh
+++ b/test/security.sh
@@ -17,14 +17,14 @@ trap 'err $LINENO' ERR
setup()
{
- $NDCTL disable-region -b "$NFIT_TEST_BUS0" all
+ $NDCTL disable-region -b "$TEST_BUS0" all
}
detect()
{
- dev="$($NDCTL list -b "$NFIT_TEST_BUS0" -D | jq -r .[0].dev)"
+ dev="$($NDCTL list -b "$TEST_BUS0" -D | jq -r .[0].dev)"
[ -n "$dev" ] || err "$LINENO"
- id="$($NDCTL list -b "$NFIT_TEST_BUS0" -D | jq -r .[0].id)"
+ id="$($NDCTL list -b "$TEST_BUS0" -D | jq -r .[0].id)"
[ -n "$id" ] || err "$LINENO"
}
@@ -83,9 +83,9 @@ lock_dimm()
# inline. Once a subsequent user arrives we can refactor this to a
# helper in test/common:
# get_test_dimm_path "nfit_test.0" "nmem3"
- handle="$($NDCTL list -b "$NFIT_TEST_BUS0" -d "$dev" -i | jq -r .[].dimms[0].handle)"
+ handle="$($NDCTL list -b "$TEST_BUS0" -d "$dev" -i | jq -r .[].dimms[0].handle)"
test_dimm_path=""
- for test_dimm in /sys/devices/platform/"$NFIT_TEST_BUS0"/nfit_test_dimm/test_dimm*; do
+ for test_dimm in /sys/devices/platform/"$TEST_BUS0"/nfit_test_dimm/test_dimm*; do
td_handle_file="$test_dimm/handle"
test -e "$td_handle_file" || continue
td_handle="$(cat "$td_handle_file")"
@@ -107,7 +107,7 @@ lock_dimm()
get_security_state()
{
- $NDCTL list -i -b "$NFIT_TEST_BUS0" -d "$dev" | jq -r .[].dimms[0].security
+ $NDCTL list -i -b "$TEST_BUS0" -d "$dev" | jq -r .[].dimms[0].security
}
setup_passphrase()
@@ -184,7 +184,7 @@ test_4_security_unlock()
echo "Incorrect security state: $sstate expected: unlocked"
err "$LINENO"
fi
- $NDCTL disable-region -b "$NFIT_TEST_BUS0" all
+ $NDCTL disable-region -b "$TEST_BUS0" all
remove_passphrase
}
--
2.21.0
1 year, 2 months
[PATCH] Consider namespace with size as active namespace
by Aneesh Kumar K.V
This enables us to mark a namespace as disabled due to pfn_sb
mismatch. We have pending kernel patches at that will mark the
namespace disabled when the PAGE_SIZE or struct page size didn't
match with the value stored in pfn_sb.
We need to make sure we don't use this disabled namespace as seed namespace
for new namespace creation.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar(a)linux.ibm.com>
---
ndctl/namespace.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 58a9e3c53474..1f212a2b3a9b 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -455,7 +455,8 @@ static int is_namespace_active(struct ndctl_namespace *ndns)
return ndns && (ndctl_namespace_is_enabled(ndns)
|| ndctl_namespace_get_pfn(ndns)
|| ndctl_namespace_get_dax(ndns)
- || ndctl_namespace_get_btt(ndns));
+ || ndctl_namespace_get_btt(ndns)
+ || ndctl_namespace_get_size(ndns));
}
/*
--
2.21.0
1 year, 2 months
[PATCH] ndctl: Use the same align value as original namespace on reconfigure
by Aneesh Kumar K.V
When using reconfigure command to add a `name` to the namespace we end
up updating the align attribute. Avoid this by using the value from
the original namespace. Do this only if we are keeping the namespace mode
same.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar(a)linux.ibm.com>
---
ndctl/namespace.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 1f212a2b3a9b..24e51bb35ae1 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -596,6 +596,22 @@ static int validate_namespace_options(struct ndctl_region *region,
return -ENXIO;
}
} else {
+
+ /*
+ * If we are tryint to reconfigure with the same namespace mode
+ * Use the align details from the origin namespace. Otherwise
+ * pick the align details from seed namespace
+ */
+ if (ndns && p->mode == ndctl_namespace_get_mode(ndns)) {
+ struct ndctl_pfn *ns_pfn = ndctl_namespace_get_pfn(ndns);
+ struct ndctl_dax *ns_dax = ndctl_namespace_get_dax(ndns);
+ if (ns_pfn)
+ p->align = ndctl_pfn_get_align(ns_pfn);
+ else if (ns_dax)
+ p->align = ndctl_dax_get_align(ns_dax);
+ else
+ p->align = sysconf(_SC_PAGE_SIZE);
+ } else
/*
* Use the seed namespace alignment as the default if we need
* one. If we don't then use PAGE_SIZE so the size_align
--
2.21.0
1 year, 3 months
[RFC PATCH 0/7] xfs: add reflink & dedupe support for fsdax.
by Shiyang Ruan
This patchset aims to take care of this issue to make reflink and dedupe
work correctly in XFS.
It is based on Goldwyn's patchsets: "v4 Btrfs dax support" and "Btrfs
iomap". I picked up some patches related and made a few fix to make it
basically works fine.
For dax framework:
1. adapt to the latest change in iomap.
For XFS:
1. report the source address and set IOMAP_COW type for those write
operations that need COW.
2. update extent list at the end.
3. add file contents comparison function based on dax framework.
4. use xfs_break_layouts() to support dax.
Goldwyn Rodrigues (3):
dax: replace mmap entry in case of CoW
fs: dedup file range to use a compare function
dax: memcpy before zeroing range
Shiyang Ruan (4):
dax: Introduce dax_copy_edges() for COW.
dax: copy data before write.
xfs: Add COW handle for fsdax.
xfs: Add dedupe support for fsdax.
fs/btrfs/ioctl.c | 11 ++-
fs/dax.c | 203 ++++++++++++++++++++++++++++++++++++++----
fs/iomap.c | 9 +-
fs/ocfs2/file.c | 2 +-
fs/read_write.c | 11 +--
fs/xfs/xfs_iomap.c | 42 +++++----
fs/xfs/xfs_reflink.c | 84 +++++++++--------
include/linux/dax.h | 15 ++--
include/linux/fs.h | 8 +-
include/linux/iomap.h | 6 ++
10 files changed, 294 insertions(+), 97 deletions(-)
--
2.17.0
1 year, 3 months
[PATCH v18 00/19] kunit: introduce KUnit, the Linux kernel unit testing framework
by Brendan Higgins
## TL;DR
This revision addresses comments from Linus[1] and Randy[2], by moving
top level `kunit/` directory to `lib/kunit/` and likewise moves top
level Kconfig entry under lib/Kconfig.debug, so the KUnit submenu now
shows up under the "Kernel Hacking" menu.
As a consequence of this, I rewrote patch 06/18 (kbuild: enable building
KUnit) - now 06/19 (lib: enable building KUnit in lib/), and now needs
to be re-acked/reviewed.
## Background
This patch set proposes KUnit, a lightweight unit testing and mocking
framework for the Linux kernel.
Unlike Autotest and kselftest, KUnit is a true unit testing framework;
it does not require installing the kernel on a test machine or in a VM
(however, KUnit still allows you to run tests on test machines or in VMs
if you want[3]) and does not require tests to be written in userspace
running on a host kernel. Additionally, KUnit is fast: From invocation
to completion KUnit can run several dozen tests in about a second.
Currently, the entire KUnit test suite for KUnit runs in under a second
from the initial invocation (build time excluded).
KUnit is heavily inspired by JUnit, Python's unittest.mock, and
Googletest/Googlemock for C++. KUnit provides facilities for defining
unit test cases, grouping related test cases into test suites, providing
common infrastructure for running tests, mocking, spying, and much more.
### What's so special about unit testing?
A unit test is supposed to test a single unit of code in isolation,
hence the name. There should be no dependencies outside the control of
the test; this means no external dependencies, which makes tests orders
of magnitudes faster. Likewise, since there are no external dependencies,
there are no hoops to jump through to run the tests. Additionally, this
makes unit tests deterministic: a failing unit test always indicates a
problem. Finally, because unit tests necessarily have finer granularity,
they are able to test all code paths easily solving the classic problem
of difficulty in exercising error handling code.
### Is KUnit trying to replace other testing frameworks for the kernel?
No. Most existing tests for the Linux kernel are end-to-end tests, which
have their place. A well tested system has lots of unit tests, a
reasonable number of integration tests, and some end-to-end tests. KUnit
is just trying to address the unit test space which is currently not
being addressed.
### More information on KUnit
There is a bunch of documentation near the end of this patch set that
describes how to use KUnit and best practices for writing unit tests.
For convenience I am hosting the compiled docs here[4].
Additionally for convenience, I have applied these patches to a
branch[5]. The repo may be cloned with:
git clone https://kunit.googlesource.com/linux
This patchset is on the kunit/initial/v5.3/v18 branch.
## History since v15
### v18
- Addrssed comments on 07/19 (kunit: test: add initial tests) from
Randy Dunlap by removing redundant dependencies from Kconfig entries.
### v17
- Addressed comments on 06/19 (lib: enable building KUnit in lib/) from
Stephen Boyd by moving KUnit submenu ahead of Runtime Testing
submenu.
### v16
- Addressed comments from Linus Torvalds by moving all kunit/ paths to
lib/kunit/.
- Addressed comments by Randy Dunlap by moving KUnit Kconfig under
lib/Kconfig.debug so the KUnit submenu shows up under the "Kernel
Hacking" menu.
[1] https://www.lkml.org/lkml/2019/9/20/696
[2] https://www.lkml.org/lkml/2019/9/20/738
[3] https://google.github.io/kunit-docs/third_party/kernel/docs/usage.html#ku...
[4] https://google.github.io/kunit-docs/third_party/kernel/docs/
[5] https://kunit.googlesource.com/linux/+/kunit/initial/v5.3/v18
---
Avinash Kondareddy (1):
kunit: test: add tests for KUnit managed resources
Brendan Higgins (16):
kunit: test: add KUnit test runner core
kunit: test: add test resource management API
kunit: test: add string_stream a std::stream like string builder
kunit: test: add assertion printing library
kunit: test: add the concept of expectations
lib: enable building KUnit in lib/
kunit: test: add initial tests
objtool: add kunit_try_catch_throw to the noreturn list
kunit: test: add support for test abort
kunit: test: add tests for kunit test abort
kunit: test: add the concept of assertions
kunit: defconfig: add defconfigs for building KUnit tests
Documentation: kunit: add documentation for KUnit
MAINTAINERS: add entry for KUnit the unit testing framework
MAINTAINERS: add proc sysctl KUnit test to PROC SYSCTL section
kunit: fix failure to build without printk
Felix Guo (1):
kunit: tool: add Python wrappers for running KUnit tests
Iurii Zaikin (1):
kernel/sysctl-test: Add null pointer test for sysctl.c:proc_dointvec()
Documentation/dev-tools/index.rst | 1 +
Documentation/dev-tools/kunit/api/index.rst | 16 +
Documentation/dev-tools/kunit/api/test.rst | 11 +
Documentation/dev-tools/kunit/faq.rst | 62 +
Documentation/dev-tools/kunit/index.rst | 79 +
Documentation/dev-tools/kunit/start.rst | 180 ++
Documentation/dev-tools/kunit/usage.rst | 576 +++++++
MAINTAINERS | 13 +
arch/um/configs/kunit_defconfig | 3 +
include/kunit/assert.h | 356 ++++
include/kunit/string-stream.h | 51 +
include/kunit/test.h | 1490 +++++++++++++++++
include/kunit/try-catch.h | 75 +
kernel/Makefile | 2 +
kernel/sysctl-test.c | 392 +++++
lib/Kconfig.debug | 13 +
lib/Makefile | 2 +
lib/kunit/Kconfig | 36 +
lib/kunit/Makefile | 9 +
lib/kunit/assert.c | 141 ++
lib/kunit/example-test.c | 88 +
lib/kunit/string-stream-test.c | 52 +
lib/kunit/string-stream.c | 217 +++
lib/kunit/test-test.c | 331 ++++
lib/kunit/test.c | 478 ++++++
lib/kunit/try-catch.c | 118 ++
tools/objtool/check.c | 1 +
tools/testing/kunit/.gitignore | 3 +
tools/testing/kunit/configs/all_tests.config | 3 +
tools/testing/kunit/kunit.py | 136 ++
tools/testing/kunit/kunit_config.py | 66 +
tools/testing/kunit/kunit_kernel.py | 149 ++
tools/testing/kunit/kunit_parser.py | 310 ++++
tools/testing/kunit/kunit_tool_test.py | 206 +++
.../test_is_test_passed-all_passed.log | 32 +
.../test_data/test_is_test_passed-crash.log | 69 +
.../test_data/test_is_test_passed-failure.log | 36 +
.../test_is_test_passed-no_tests_run.log | 75 +
.../test_output_isolated_correctly.log | 106 ++
.../test_data/test_read_from_file.kconfig | 17 +
40 files changed, 6001 insertions(+)
create mode 100644 Documentation/dev-tools/kunit/api/index.rst
create mode 100644 Documentation/dev-tools/kunit/api/test.rst
create mode 100644 Documentation/dev-tools/kunit/faq.rst
create mode 100644 Documentation/dev-tools/kunit/index.rst
create mode 100644 Documentation/dev-tools/kunit/start.rst
create mode 100644 Documentation/dev-tools/kunit/usage.rst
create mode 100644 arch/um/configs/kunit_defconfig
create mode 100644 include/kunit/assert.h
create mode 100644 include/kunit/string-stream.h
create mode 100644 include/kunit/test.h
create mode 100644 include/kunit/try-catch.h
create mode 100644 kernel/sysctl-test.c
create mode 100644 lib/kunit/Kconfig
create mode 100644 lib/kunit/Makefile
create mode 100644 lib/kunit/assert.c
create mode 100644 lib/kunit/example-test.c
create mode 100644 lib/kunit/string-stream-test.c
create mode 100644 lib/kunit/string-stream.c
create mode 100644 lib/kunit/test-test.c
create mode 100644 lib/kunit/test.c
create mode 100644 lib/kunit/try-catch.c
create mode 100644 tools/testing/kunit/.gitignore
create mode 100644 tools/testing/kunit/configs/all_tests.config
create mode 100755 tools/testing/kunit/kunit.py
create mode 100644 tools/testing/kunit/kunit_config.py
create mode 100644 tools/testing/kunit/kunit_kernel.py
create mode 100644 tools/testing/kunit/kunit_parser.py
create mode 100755 tools/testing/kunit/kunit_tool_test.py
create mode 100644 tools/testing/kunit/test_data/test_is_test_passed-all_passed.log
create mode 100644 tools/testing/kunit/test_data/test_is_test_passed-crash.log
create mode 100644 tools/testing/kunit/test_data/test_is_test_passed-failure.log
create mode 100644 tools/testing/kunit/test_data/test_is_test_passed-no_tests_run.log
create mode 100644 tools/testing/kunit/test_data/test_output_isolated_correctly.log
create mode 100644 tools/testing/kunit/test_data/test_read_from_file.kconfig
--
2.23.0.351.gc4317032e6-goog
1 year, 3 months