[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
2 years, 2 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
2 years, 4 months
[PATCH 00/10] Add support for OpenCAPI SCM devices
by Alastair D'Silva
From: Alastair D'Silva <alastair(a)d-silva.org>
This series adds support for OpenCAPI SCM devices, exposing
them as nvdimms so that we can make use of the existing
infrastructure.
The first patch (in memory_hotplug) has reviews/acks, but has
not yet made it upstream.
Alastair D'Silva (10):
memory_hotplug: Add a bounds check to __add_pages
nvdimm: remove prototypes for nonexistent functions
powerpc: Add OPAL calls for LPC memory alloc/release
powerpc: Map & release OpenCAPI LPC memory
ocxl: Tally up the LPC memory on a link & allow it to be mapped
ocxl: Add functions to map/unmap LPC memory
ocxl: Save the device serial number in ocxl_fn
nvdimm: Add driver for OpenCAPI Storage Class Memory
powerpc: Enable OpenCAPI Storage Class Memory driver on bare metal
ocxl: Conditionally bind SCM devices to the generic OCXL driver
arch/powerpc/configs/powernv_defconfig | 4 +
arch/powerpc/include/asm/opal-api.h | 2 +
arch/powerpc/include/asm/opal.h | 3 +
arch/powerpc/include/asm/pnv-ocxl.h | 2 +
arch/powerpc/platforms/powernv/ocxl.c | 41 +
arch/powerpc/platforms/powernv/opal-call.c | 2 +
drivers/misc/ocxl/Kconfig | 7 +
drivers/misc/ocxl/config.c | 50 +
drivers/misc/ocxl/core.c | 60 +
drivers/misc/ocxl/link.c | 60 +
drivers/misc/ocxl/ocxl_internal.h | 36 +
drivers/misc/ocxl/pci.c | 3 +
drivers/nvdimm/Kconfig | 17 +
drivers/nvdimm/Makefile | 3 +
drivers/nvdimm/nd-core.h | 4 -
drivers/nvdimm/ocxl-scm.c | 2210 ++++++++++++++++++++
drivers/nvdimm/ocxl-scm_internal.c | 232 ++
drivers/nvdimm/ocxl-scm_internal.h | 331 +++
drivers/nvdimm/ocxl-scm_sysfs.c | 219 ++
include/linux/memory_hotplug.h | 5 +
include/misc/ocxl.h | 19 +
include/uapi/linux/ocxl-scm.h | 128 ++
mm/memory_hotplug.c | 22 +
23 files changed, 3456 insertions(+), 4 deletions(-)
create mode 100644 drivers/nvdimm/ocxl-scm.c
create mode 100644 drivers/nvdimm/ocxl-scm_internal.c
create mode 100644 drivers/nvdimm/ocxl-scm_internal.h
create mode 100644 drivers/nvdimm/ocxl-scm_sysfs.c
create mode 100644 include/uapi/linux/ocxl-scm.h
--
2.21.0
2 years, 4 months
[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
2 years, 4 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>
2 years, 5 months
[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
2 years, 6 months
[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
2 years, 7 months
[RFC PATCH 1/4] libnvdimm/namespace: Make namespace size validation arch dependent
by Aneesh Kumar K.V
The page size used to map the namespace is arch dependent. For example
architectures like ppc64 use 16MB page size for direct-mapping. If the namespace
size is not aligned to the mapping page size, we can observe kernel crash
during namespace init and destroy.
This is due to kernel doing partial map/unmap of the resource range
BUG: Unable to handle kernel data access at 0xc001000406000000
Faulting instruction address: 0xc000000000090790
NIP [c000000000090790] arch_add_memory+0xc0/0x130
LR [c000000000090744] arch_add_memory+0x74/0x130
Call Trace:
arch_add_memory+0x74/0x130 (unreliable)
memremap_pages+0x74c/0xa30
devm_memremap_pages+0x3c/0xa0
pmem_attach_disk+0x188/0x770
nvdimm_bus_probe+0xd8/0x470
really_probe+0x148/0x570
driver_probe_device+0x19c/0x1d0
device_driver_attach+0xcc/0x100
bind_store+0x134/0x1c0
drv_attr_store+0x44/0x60
sysfs_kf_write+0x74/0xc0
kernfs_fop_write+0x1b4/0x290
__vfs_write+0x3c/0x70
vfs_write+0xd0/0x260
ksys_write+0xdc/0x130
system_call+0x5c/0x68
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar(a)linux.ibm.com>
---
arch/arm64/mm/flush.c | 11 +++++++++++
arch/powerpc/lib/pmem.c | 21 +++++++++++++++++++--
arch/x86/mm/pageattr.c | 12 ++++++++++++
include/linux/libnvdimm.h | 1 +
4 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c
index ac485163a4a7..90c54c600023 100644
--- a/arch/arm64/mm/flush.c
+++ b/arch/arm64/mm/flush.c
@@ -91,4 +91,15 @@ void arch_invalidate_pmem(void *addr, size_t size)
__inval_dcache_area(addr, size);
}
EXPORT_SYMBOL_GPL(arch_invalidate_pmem);
+
+unsigned long arch_validate_namespace_size(unsigned int ndr_mappings, unsigned long size)
+{
+ u32 remainder;
+
+ div_u64_rem(size, PAGE_SIZE * ndr_mappings, &remainder);
+ if (remainder)
+ return PAGE_SIZE * ndr_mappings;
+ return 0;
+}
+EXPORT_SYMBOL_GPL(arch_validate_namespace_size);
#endif
diff --git a/arch/powerpc/lib/pmem.c b/arch/powerpc/lib/pmem.c
index 377712e85605..2e661a08dae5 100644
--- a/arch/powerpc/lib/pmem.c
+++ b/arch/powerpc/lib/pmem.c
@@ -17,14 +17,31 @@ void arch_wb_cache_pmem(void *addr, size_t size)
unsigned long start = (unsigned long) addr;
flush_dcache_range(start, start + size);
}
-EXPORT_SYMBOL(arch_wb_cache_pmem);
+EXPORT_SYMBOL_GPL(arch_wb_cache_pmem);
void arch_invalidate_pmem(void *addr, size_t size)
{
unsigned long start = (unsigned long) addr;
flush_dcache_range(start, start + size);
}
-EXPORT_SYMBOL(arch_invalidate_pmem);
+EXPORT_SYMBOL_GPL(arch_invalidate_pmem);
+
+unsigned long arch_validate_namespace_size(unsigned int ndr_mappings, unsigned long size)
+{
+ u32 remainder;
+ unsigned long linear_map_size;
+
+ if (radix_enabled())
+ linear_map_size = PAGE_SIZE;
+ else
+ linear_map_size = (1UL << mmu_psize_defs[mmu_linear_psize].shift);
+
+ div_u64_rem(size, linear_map_size * ndr_mappings, &remainder);
+ if (remainder)
+ return linear_map_size * ndr_mappings;
+ return 0;
+}
+EXPORT_SYMBOL_GPL(arch_validate_namespace_size);
/*
* CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE symbols
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 0d09cc5aad61..023329d7dfac 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -310,6 +310,18 @@ void arch_invalidate_pmem(void *addr, size_t size)
}
EXPORT_SYMBOL_GPL(arch_invalidate_pmem);
+unsigned long arch_validate_namespace_size(unsigned int ndr_mappings, unsigned long size)
+{
+ u32 remainder;
+
+ div_u64_rem(size, PAGE_SIZE * ndr_mappings, &remainder);
+ if (remainder)
+ return PAGE_SIZE * ndr_mappings;
+ return 0;
+}
+EXPORT_SYMBOL_GPL(arch_validate_namespace_size);
+
+
static void __cpa_flush_all(void *arg)
{
unsigned long cache = (unsigned long)arg;
diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
index b6eddf912568..e2f8387d9ef4 100644
--- a/include/linux/libnvdimm.h
+++ b/include/linux/libnvdimm.h
@@ -291,4 +291,5 @@ static inline void arch_invalidate_pmem(void *addr, size_t size)
}
#endif
+unsigned long arch_validate_namespace_size(unsigned int ndr_mappings, unsigned long size);
#endif /* __LIBNVDIMM_H__ */
--
2.21.0
2 years, 7 months
[RFC PATCH v2 0/7] xfs: reflink & dedupe for fsdax (read/write path).
by Shiyang Ruan
This patchset aims to take care of this issue to make reflink and dedupe
work correctly (actually in read/write path, there still has some problems,
such as the page->mapping and page->index issue, in mmap path) in XFS under
fsdax mode.
It is based on Goldwyn's patchsets: "v4 Btrfs dax support" and the latest
iomap. I borrowed 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 (two iomaps).
For XFS:
1. distinguish dax write/zero from normal write/zero.
2. remap extents after COW.
3. add file contents comparison function based on dax framework.
4. use xfs_break_layouts() instead of break_layout 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: handle copy-on-write in fsdax write() path.
xfs: support dedupe for fsdax.
fs/btrfs/ioctl.c | 3 +-
fs/dax.c | 211 +++++++++++++++++++++++++++++++++++++----
fs/iomap/buffered-io.c | 8 +-
fs/ocfs2/file.c | 2 +-
fs/read_write.c | 11 ++-
fs/xfs/xfs_bmap_util.c | 6 +-
fs/xfs/xfs_file.c | 10 +-
fs/xfs/xfs_iomap.c | 3 +-
fs/xfs/xfs_iops.c | 11 ++-
fs/xfs/xfs_reflink.c | 79 ++++++++-------
include/linux/dax.h | 16 ++--
include/linux/fs.h | 9 +-
12 files changed, 291 insertions(+), 78 deletions(-)
--
2.23.0
2 years, 7 months
Re: [PATCH 4/4] modpost: do not set ->preloaded for symbols from Module.symvers
by Jeff Moyer
Masahiro Yamada <yamada.masahiro(a)socionext.com> writes:
> Now that there is no overwrap between symbols from ELF files and
> ones from Module.symvers.
>
> So, the 'exported twice' warning should be reported irrespective
> of where the symbol in question came from. Only the exceptional case
> is when __crc_<sym> symbol appears before __ksymtab_<sym>. This
> typically occurs for EXPORT_SYMBOL in .S files.
Hi, Masahiro,
After apply this patch, I get the following modpost warnings when doing:
$ make M=tools/tesing/nvdimm
...
Building modules, stage 2.
MODPOST 12 modules
WARNING: tools/testing/nvdimm/libnvdimm: 'nvdimm_bus_lock' exported twice. Previous export was in drivers/nvdimm/libnvdimm.ko
WARNING: tools/testing/nvdimm/libnvdimm: 'nvdimm_bus_unlock' exported twice. Previous export was in drivers/nvdimm/libnvdimm.ko
WARNING: tools/testing/nvdimm/libnvdimm: 'is_nvdimm_bus_locked' exported twice. Previous export was in drivers/nvdimm/libnvdimm.ko
WARNING: tools/testing/nvdimm/libnvdimm: 'devm_nvdimm_memremap' exported twice. Previous export was in drivers/nvdimm/libnvdimm.ko
WARNING: tools/testing/nvdimm/libnvdimm: 'nd_fletcher64' exported twice. Previous export was in drivers/nvdimm/libnvdimm.ko
WARNING: tools/testing/nvdimm/libnvdimm: 'to_nd_desc' exported twice. Previous export was in drivers/nvdimm/libnvdimm.ko
WARNING: tools/testing/nvdimm/libnvdimm: 'to_nvdimm_bus_dev' exported twice. Previous export was in drivers/nvdimm/libnvdimm.ko
...
There are a lot of these warnings. :) If I revert this patch, no
complaints.
Cheers,
Jeff
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro(a)socionext.com>
> ---
>
> scripts/mod/modpost.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index 5234555cf550..6ca38d10efc5 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -2457,7 +2457,6 @@ static void read_dump(const char *fname, unsigned int kernel)
> s = sym_add_exported(symname, namespace, mod,
> export_no(export));
> s->kernel = kernel;
> - s->preloaded = 1;
> s->is_static = 0;
> sym_update_crc(symname, mod, crc, export_no(export));
> }
2 years, 7 months