[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] tools/test/nvdimm: Fix out of tree build
by Santosh Sivaraj
Out of tree build using
make M=tools/test/nvdimm O=/tmp/build -C /tmp/build
fails with the following error
make: Entering directory '/tmp/build'
CC [M] tools/testing/nvdimm/test/nfit.o
linux/tools/testing/nvdimm/test/nfit.c:19:10: fatal error: nd-core.h: No such file or directory
19 | #include <nd-core.h>
| ^~~~~~~~~~~
compilation terminated.
That is because the kbuild file uses $(src) which points to
tools/testing/nvdimm, $(srctree) correctly points to root of the linux
source tree.
Reported-by: Aneesh Kumar K.V <aneesh.kumar(a)linux.ibm.com>
Signed-off-by: Santosh Sivaraj <santosh(a)fossix.org>
---
tools/testing/nvdimm/Kbuild | 4 ++--
tools/testing/nvdimm/test/Kbuild | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/testing/nvdimm/Kbuild b/tools/testing/nvdimm/Kbuild
index 6aca8d5be159..0615fa3d9f7e 100644
--- a/tools/testing/nvdimm/Kbuild
+++ b/tools/testing/nvdimm/Kbuild
@@ -22,8 +22,8 @@ DRIVERS := ../../../drivers
NVDIMM_SRC := $(DRIVERS)/nvdimm
ACPI_SRC := $(DRIVERS)/acpi/nfit
DAX_SRC := $(DRIVERS)/dax
-ccflags-y := -I$(src)/$(NVDIMM_SRC)/
-ccflags-y += -I$(src)/$(ACPI_SRC)/
+ccflags-y := -I$(srctree)/drivers/nvdimm/
+ccflags-y += -I$(srctree)/drivers/acpi/nfit/
obj-$(CONFIG_LIBNVDIMM) += libnvdimm.o
obj-$(CONFIG_BLK_DEV_PMEM) += nd_pmem.o
diff --git a/tools/testing/nvdimm/test/Kbuild b/tools/testing/nvdimm/test/Kbuild
index fb3c3d7cdb9b..75baebf8f4ba 100644
--- a/tools/testing/nvdimm/test/Kbuild
+++ b/tools/testing/nvdimm/test/Kbuild
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
-ccflags-y := -I$(src)/../../../../drivers/nvdimm/
-ccflags-y += -I$(src)/../../../../drivers/acpi/nfit/
+ccflags-y := -I$(srctree)/drivers/nvdimm/
+ccflags-y += -I$(srctree)/drivers/acpi/nfit/
obj-m += nfit_test.o
obj-m += nfit_test_iomap.o
--
2.24.1
2 years, 3 months
[PATCH] libnvdimm/bus: return the outvar 'cmd_rc' error code in __nd_ioctl()
by Vaibhav Jain
Presently the error code returned via out variable 'cmd_rc' from the
nvdimm-bus controller function is ignored when called from
__nd_ioctl() and never communicated back to user-space code that called
an ioctl on dimm/bus.
This minor patch updates __nd_ioctl() to propagate the value of out
variable 'cmd_rc' back to user-space in case it reports an error.
Signed-off-by: Vaibhav Jain <vaibhav(a)linux.ibm.com>
---
drivers/nvdimm/bus.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index a8b515968569..5b687a27fdf2 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -1153,6 +1153,11 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
if (rc < 0)
goto out_unlock;
+ if (cmd_rc < 0) {
+ rc = cmd_rc;
+ goto out_unlock;
+ }
+
if (!nvdimm && cmd == ND_CMD_CLEAR_ERROR && cmd_rc >= 0) {
struct nd_cmd_clear_error *clear_err = buf;
--
2.24.1
2 years, 4 months
[ndctl PATCH] ndctl/list: Drop named list objects from verbose
listing
by Dan Williams
The only expected difference between "ndctl list -R" and "ndctl list
-Rv" is some additional output fields. Instead it currently results in
the region array being contained in a named "regions" list object.
# ndctl list -R -r 0
[
{
"dev":"region0",
"size":4294967296,
"available_size":0,
"max_available_extent":0,
"type":"pmem",
"persistence_domain":"unknown"
}
]
# ndctl list -Rv -r 0
{
"regions":[
{
"dev":"region0",
"size":4294967296,
"available_size":0,
"max_available_extent":0,
"type":"pmem",
"numa_node":0,
"target_node":2,
"persistence_domain":"unknown",
"namespaces":[
{
"dev":"namespace0.0",
"mode":"fsdax",
"map":"mem",
"size":4294967296,
"sector_size":512,
"blockdev":"pmem0",
"numa_node":0,
"target_node":2
}
]
}
]
}
Drop the named list, by not including namespaces in the listing. Extra
objects only appear at the -vv level. "ndctl list -v" and "ndctl list
-Nv" are synonyms and behave as expected.
# ndctl list -Rv -r 0
[
{
"dev":"region0",
"size":4294967296,
"available_size":0,
"max_available_extent":0,
"type":"pmem",
"numa_node":0,
"target_node":2,
"persistence_domain":"unknown"
}
]
Another side effect of this change is that it allows for:
ndctl list -Rvvv
...to only show the verbose region details vs assuming that namespaces
and dimms etc also need to be added.
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
Documentation/ndctl/ndctl-list.txt | 46 ++++++++++++++++++++++++++++++++++++
ndctl/list.c | 10 +++++---
2 files changed, 52 insertions(+), 4 deletions(-)
diff --git a/Documentation/ndctl/ndctl-list.txt b/Documentation/ndctl/ndctl-list.txt
index f9c7434d3b0b..75fd11876395 100644
--- a/Documentation/ndctl/ndctl-list.txt
+++ b/Documentation/ndctl/ndctl-list.txt
@@ -234,6 +234,52 @@ include::xable-bus-options.txt[]
- *-vvv*
Everything '-vv' provides, plus --health, --capabilities,
--idle, and --firmware.
+::
+ The verbosity can also be scoped by the object type. For example
+ to just list regions with capabilities and media error info.
+----
+# ndctl list -Ru -vvv -r 0
+{
+ "dev":"region0",
+ "size":"4.00 GiB (4.29 GB)",
+ "available_size":0,
+ "max_available_extent":0,
+ "type":"pmem",
+ "numa_node":0,
+ "target_node":2,
+ "capabilities":[
+ {
+ "mode":"sector",
+ "sector_sizes":[
+ 512,
+ 520,
+ 528,
+ 4096,
+ 4104,
+ 4160,
+ 4224
+ ]
+ },
+ {
+ "mode":"fsdax",
+ "alignments":[
+ 4096,
+ 2097152,
+ 1073741824
+ ]
+ },
+ {
+ "mode":"devdax",
+ "alignments":[
+ 4096,
+ 2097152,
+ 1073741824
+ ]
+ }
+ ],
+ "persistence_domain":"unknown"
+}
+----
include::human-option.txt[]
diff --git a/ndctl/list.c b/ndctl/list.c
index 607996a85784..125a9fe34cb8 100644
--- a/ndctl/list.c
+++ b/ndctl/list.c
@@ -507,12 +507,14 @@ int cmd_list(int argc, const char **argv, struct ndctl_ctx *ctx)
list.health = true;
list.capabilities = true;
case 2:
- list.dimms = true;
- list.buses = true;
- list.regions = true;
+ if (num_list_flags() == 0) {
+ list.dimms = true;
+ list.buses = true;
+ list.regions = true;
+ list.namespaces = true;
+ }
case 1:
list.media_errors = true;
- list.namespaces = true;
list.dax = true;
case 0:
break;
2 years, 4 months
[ndctl PATCH 0/2] ndctl: Cross-arch compatible namespace alignment
by Dan Williams
A follow-up to the region-align kernel enabling, [1], update ndctl to
enumerate region alignment, and update the unit tests to account for the
kernel's default compatible alignment.
Given that changing the default is a surefire way to create incompatible
namespaces I do not think it makes sense to plumb region alignment
through the create-namespace interface. Only expert users would be
expected to trawl through sysfs and set a non-default alignment. I.e.
the lack of documentation and enabling for setting this value in the
ndctl man pages is deliberate.
---
Dan Williams (2):
ndctl/region: Support ndctl_region_{get,set}_align()
ndctl/namespace: Improve namespace action failure messages
ndctl/lib/libndctl.c | 35 ++++++++++++++++++++
ndctl/lib/libndctl.sym | 2 +
ndctl/libndctl.h | 2 +
ndctl/list.c | 5 +++
ndctl/namespace.c | 82 ++++++++++++++++++++++++++++++++----------------
test/blk_namespaces.c | 1 +
test/dpa-alloc.c | 10 +++++-
test/dsm-fail.c | 5 ++-
test/libndctl.c | 10 +++++-
test/parent-uuid.c | 1 +
10 files changed, 121 insertions(+), 32 deletions(-)
2 years, 4 months
[PATCH v2 ndctl] ndctl/namespace: Fix enable-namespace error for seed namespaces
by Santosh Sivaraj
'ndctl enable-namespace all' tries to enable seed namespaces too, which results
in a error like
libndctl: ndctl_namespace_enable: namespace1.0: failed to enable
Signed-off-by: Santosh Sivaraj <santosh(a)fossix.org>
---
ndctl/lib/libndctl.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index 6596f94..9c6ccb8 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -4010,11 +4010,16 @@ NDCTL_EXPORT int ndctl_namespace_enable(struct ndctl_namespace *ndns)
const char *devname = ndctl_namespace_get_devname(ndns);
struct ndctl_ctx *ctx = ndctl_namespace_get_ctx(ndns);
struct ndctl_region *region = ndns->region;
+ unsigned long long size = ndctl_namespace_get_size(ndns);
int rc;
if (ndctl_namespace_is_enabled(ndns))
return 0;
+ /* Don't try to enable idle namespace (no capacity allocated) */
+ if (size == 0)
+ return -ENXIO;
+
rc = ndctl_bind(ctx, ndns->module, devname);
/*
--
2.24.1
2 years, 4 months
[PATCH v2 00/27] 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.
V2:
- "powerpc: Map & release OpenCAPI LPC memory"
- Fix #if -> #ifdef
- use pci_dev_id to get the bdfn
- use __be64 to hold be data
- indent check_hotplug_memory_addressable correctly
- Remove export of check_hotplug_memory_addressable
- "ocxl: Conditionally bind SCM devices to the generic OCXL driver"
- Improve patch description and remove redundant default
- "nvdimm: Add driver for OpenCAPI Storage Class Memory"
- Mark a few funcs as static as identified by the 0day bot
- Add OCXL dependancies to OCXL_SCM
- Use memcpy_mcsafe in scm_ndctl_config_read
- Rename scm_foo_offset_0x00 to scm_foo_header_parse & add docs
- Name DIMM attribs "ocxl" rather than "scm"
- Split out into base + many feature patches
- "powerpc: Enable OpenCAPI Storage Class Memory driver on bare metal"
- Build DEV_DAX & friends as modules
- "ocxl: Conditionally bind SCM devices to the generic OCXL driver"
- Patch dropped (easy enough to maintain this out of tree for development)
- "ocxl: Tally up the LPC memory on a link & allow it to be mapped"
- Add a warning if an unmatched lpc_release is called
- "ocxl: Add functions to map/unmap LPC memory"
- Use EXPORT_SYMBOL_GPL
Alastair D'Silva (27):
memory_hotplug: Add a bounds check to __add_pages
nvdimm: remove prototypes for nonexistent functions
powerpc: Add OPAL calls for LPC memory alloc/release
mm/memory_hotplug: Allow check_hotplug_memory_addressable to be called
from drivers
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
ocxl: Free detached contexts in ocxl_context_detach_all()
nvdimm: Add driver for OpenCAPI Storage Class Memory
nvdimm/ocxl: Add register addresses & status values to header
nvdimm/ocxl: Read the capability registers & wait for device ready
nvdimm/ocxl: Add support for Admin commands
nvdimm/ocxl: Add support for near storage commands
nvdimm/ocxl: Register a character device for userspace to interact
with
nvdimm/ocxl: Implement the Read Error Log command
nvdimm/ocxl: Add controller dump IOCTLs
nvdimm/ocxl: Add an IOCTL to report controller statistics
nvdimm/ocxl: Forward events to userspace
nvdimm/ocxl: Add an IOCTL to request controller health & perf data
nvdimm/ocxl: Support firmware update via sysfs
nvdimm/ocxl: Implement the heartbeat command
nvdimm/ocxl: Add debug IOCTLs
nvdimm/ocxl: Implement Overwrite
nvdimm/ocxl: Expose SMART data via ndctl
powerpc: Enable OpenCAPI Storage Class Memory driver on bare metal
MAINTAINERS: Add myself & nvdimm/ocxl to ocxl
MAINTAINERS | 3 +
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 | 42 +
arch/powerpc/platforms/powernv/opal-call.c | 2 +
drivers/misc/ocxl/config.c | 50 +
drivers/misc/ocxl/context.c | 6 +-
drivers/misc/ocxl/core.c | 60 +
drivers/misc/ocxl/link.c | 60 +
drivers/misc/ocxl/ocxl_internal.h | 36 +
drivers/nvdimm/Kconfig | 2 +
drivers/nvdimm/Makefile | 2 +-
drivers/nvdimm/nd-core.h | 4 -
drivers/nvdimm/ocxl/Kconfig | 21 +
drivers/nvdimm/ocxl/Makefile | 7 +
drivers/nvdimm/ocxl/scm.c | 2220 ++++++++++++++++++++
drivers/nvdimm/ocxl/scm_internal.c | 238 +++
drivers/nvdimm/ocxl/scm_internal.h | 284 +++
drivers/nvdimm/ocxl/scm_sysfs.c | 163 ++
include/linux/memory_hotplug.h | 5 +
include/misc/ocxl.h | 19 +
include/uapi/nvdimm/ocxl-scm.h | 127 ++
mm/memory_hotplug.c | 21 +
25 files changed, 3377 insertions(+), 6 deletions(-)
create mode 100644 drivers/nvdimm/ocxl/Kconfig
create mode 100644 drivers/nvdimm/ocxl/Makefile
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/nvdimm/ocxl-scm.h
--
2.23.0
2 years, 4 months
[PATCH] mm: get rid of WARN if failed to cow user pages
by Murphy Zhou
By running xfstests with fsdax enabled, generic/437 always hits this
warning[1] since this commit:
commit 83d116c53058d505ddef051e90ab27f57015b025
Author: Jia He <justin.he(a)arm.com>
Date: Fri Oct 11 22:09:39 2019 +0800
mm: fix double page fault on arm64 if PTE_AF is cleared
Looking at the test program[2] generic/437 uses, it's pretty easy
to hit this warning. Remove this WARN as it seems not necessary.
[2] https://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git/tree/src/t_mmap_co...
[1] warning message:
-----------------------------------------------------------------------
[ 97.344077] WARNING: CPU: 0 PID: 2486 at mm/memory.c:2281 wp_page_copy+0x687/0x6e0
[ 97.348354] Modules linked in: nf_tables nfnetlink rfkill sunrpc snd_hda_codec_generic ledtrig_audio qxl snd_hda_intel snd_intel_dspcfg drm_ttm_helper snd_hda_codec ttm snd_hda_core drm_kms_helper snd_hwdep snd_seq syscopyarea sysfillrect sysimgblt snd_seq_device fb_sys_fops snd_pcm drm snd_timer crc32_pclmul snd soundcore dax_pmem_compat i2c_piix4 device_dax virtio_balloon pcspkr joydev dax_pmem_core ip_tables xfs libcrc32c crct10dif_pclmul crc32c_intel sd_mod sg ata_generic 8139too ata_piix libata ghash_clmulni_intel 8139cp virtio_console serio_raw nd_pmem mii dm_mirror dm_region_hash dm_log dm_mod
[ 97.382176] CPU: 0 PID: 2486 Comm: t_mmap_cow_race Tainted: G W 5.5.0-rc3-v5.5-rc3 #1
[ 97.387804] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011
[ 97.392228] RIP: 0010:wp_page_copy+0x687/0x6e0
[ 97.396572] Code: 95 f5 00 48 81 e6 00 f0 ff ff ba 00 10 00 00 49 c1 ff 06 49 c1 e7 0c 4c 03 3d 35 95 f5 00 4c 89 ff e8 8d 85 6a 00 85 c0 74 0a <0f> 0b 4c 89 ff e8 8f 80 6a 00 65 48 8b 04 25 40 7f 01 00 83 a8 d8
[ 97.413487] RSP: 0000:ffffb882493afd28 EFLAGS: 00010206
[ 97.417520] RAX: 0000000000001000 RBX: ffffb882493afdf8 RCX: 0000000000001000
[ 97.422295] RDX: 0000000000001000 RSI: 00007f1d20c00000 RDI: ffff976384d1f000
[ 97.426914] RBP: 0000000000000000 R08: 0000000000000000 R09: 00000000000ca308
[ 97.431746] R10: 0000000000000000 R11: ffffe0cd4c1347c0 R12: ffffe0cd4c1347c0
[ 97.436371] R13: ffff9763b46ba190 R14: ffff9763a963d0c0 R15: ffff976384d1f000
[ 97.441085] FS: 00007f1d203fe700(0000) GS:ffff9763b8a00000(0000) knlGS:0000000000000000
[ 97.445500] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 97.448393] CR2: 00007f1d20c00000 CR3: 0000000333dfc000 CR4: 00000000000006f0
[ 97.452346] Call Trace:
[ 97.453681] ? __switch_to_asm+0x34/0x70
[ 97.455566] ? __switch_to_asm+0x40/0x70
[ 97.457418] ? __switch_to_asm+0x34/0x70
[ 97.459197] ? __switch_to_asm+0x40/0x70
[ 97.460971] ? __switch_to_asm+0x34/0x70
[ 97.462746] ? __switch_to_asm+0x40/0x70
[ 97.464561] ? __switch_to_asm+0x34/0x70
[ 97.466342] ? __switch_to_asm+0x40/0x70
[ 97.468141] do_wp_page+0x8c/0x640
[ 97.469818] ? finish_task_switch+0x77/0x2a0
[ 97.471631] __handle_mm_fault+0xa06/0x1420
[ 97.473517] handle_mm_fault+0xae/0x1d0
[ 97.475168] __do_page_fault+0x27f/0x4e0
[ 97.476947] do_page_fault+0x30/0x110
[ 97.478490] async_page_fault+0x39/0x40
[ 97.480275] RIP: 0033:0x400d68
[ 97.481587] Code: 53 48 89 fb 48 83 ec 10 66 2e 0f 1f 84 00 00 00 00 00 0f b6 03 ba 04 00 00 00 be 00 00 20 00 48 89 df 89 44 24 0c 8b 44 24 0c <88> 03 e8 71 fc ff ff 85 c0 78 30 e8 b8 fc ff ff 89 c7 41 f7 ec 89
[ 97.489326] RSP: 002b:00007f1d203fded0 EFLAGS: 00010202
[ 97.491336] RAX: 0000000000000001 RBX: 00007f1d20c00000 RCX: 0000000000000000
[ 97.494080] RDX: 0000000000000004 RSI: 0000000000200000 RDI: 00007f1d20c00000
[ 97.497244] RBP: 0000000000000002 R08: 00007f1d2138d230 R09: 00007f1d2138d260
[ 97.500028] R10: 00007f1d203fe9d0 R11: 0000000000000000 R12: 0000000051eb851f
[ 97.502785] R13: 00007fff01d5607f R14: 0000000000000000 R15: 00007f1d203fdfc0
[ 97.505546] ---[ end trace 18f1c94bd7c3d1e1 ]---
Signed-off-by: Murphy Zhou <jencce.kernel(a)gmail.com>
---
mm/memory.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/mm/memory.c b/mm/memory.c
index 45442d9..e3a1dce 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2269,18 +2269,12 @@ static inline bool cow_user_page(struct page *dst, struct page *src,
/*
* This really shouldn't fail, because the page is there
- * in the page tables. But it might just be unreadable,
- * in which case we just give up and fill the result with
- * zeroes.
+ * in the page tables. But it could happen during races,
+ * or it might just be unreadable, in which cases we
+ * just give up and fill the result with zeroes.
*/
- if (__copy_from_user_inatomic(kaddr, uaddr, PAGE_SIZE)) {
- /*
- * Give a warn in case there can be some obscure
- * use-case
- */
- WARN_ON_ONCE(1);
+ if (__copy_from_user_inatomic(kaddr, uaddr, PAGE_SIZE))
clear_page(kaddr);
- }
ret = true;
--
1.8.3.1
2 years, 4 months
[RFC][PATCH] dax: Do not try to clear poison for partial pages
by Vivek Goyal
I am looking into getting rid of dependency on block device in dax
path. One such place is __dax_zero_page_range() which checks if
range being zeroed is aligned to block device logical size, then
it calls bdev_issue_zeroout() instead of doing memset(). Calling
blkdev_issue_zeroout() also clears bad blocks and poison if any
in that range.
This path is used by iomap_zero_range() which in-turn is being
used by filesystems to zero partial filesystem system blocks.
For zeroing full filesystem blocks we seem to be calling
blkdev_issue_zeroout() which clears bad blocks and poison in that
range.
So this code currently only seems to help with partial filesystem
block zeroing. That too only if truncation/hole_punch happens on
device logical block size boundary.
To avoid using blkdev_issue_zeroout() in this path, I proposed another
patch here which adds another dax operation to zero out a rangex and
clear poison.
https://lore.kernel.org/linux-fsdevel/20200123165249.GA7664@redhat.com/
Thinking more about it, it might be an overkill to solve this problem.
How about if we just not clear poison/bad blocks when a partial page
is being zeroed. IOW, users will need to hole_punch whole filesystem
block worth of data which will free that block and it will be zeroed
some other time and clear poison in the process. For partial fs block
truncation/punch_hole, we don't clear poison.
If above interface is acceptable, then we can get rid of code which
tries to call blkdev_issue_zeroout() in iomap_zero_range() path and
we don't have to implement another dax operation.
Looking for some feedback on this.
Vivek
Signed-off-by: Vivek Goyal <vgoyal(a)redhat.com>
---
fs/dax.c | 50 +++++++++++++++-----------------------------------
1 file changed, 15 insertions(+), 35 deletions(-)
Index: redhat-linux/fs/dax.c
===================================================================
--- redhat-linux.orig/fs/dax.c 2020-01-29 15:19:18.551902448 -0500
+++ redhat-linux/fs/dax.c 2020-01-29 15:40:56.584824549 -0500
@@ -1044,47 +1044,27 @@ static vm_fault_t dax_load_hole(struct x
return ret;
}
-static bool dax_range_is_aligned(struct block_device *bdev,
- unsigned int offset, unsigned int length)
-{
- unsigned short sector_size = bdev_logical_block_size(bdev);
-
- if (!IS_ALIGNED(offset, sector_size))
- return false;
- if (!IS_ALIGNED(length, sector_size))
- return false;
-
- return true;
-}
-
int __dax_zero_page_range(struct block_device *bdev,
struct dax_device *dax_dev, sector_t sector,
unsigned int offset, unsigned int size)
{
- if (dax_range_is_aligned(bdev, offset, size)) {
- sector_t start_sector = sector + (offset >> 9);
-
- return blkdev_issue_zeroout(bdev, start_sector,
- size >> 9, GFP_NOFS, 0);
- } else {
- pgoff_t pgoff;
- long rc, id;
- void *kaddr;
-
- rc = bdev_dax_pgoff(bdev, sector, PAGE_SIZE, &pgoff);
- if (rc)
- return rc;
-
- id = dax_read_lock();
- rc = dax_direct_access(dax_dev, pgoff, 1, &kaddr, NULL);
- if (rc < 0) {
- dax_read_unlock(id);
- return rc;
- }
- memset(kaddr + offset, 0, size);
- dax_flush(dax_dev, kaddr + offset, size);
+ pgoff_t pgoff;
+ long rc, id;
+ void *kaddr;
+
+ rc = bdev_dax_pgoff(bdev, sector, PAGE_SIZE, &pgoff);
+ if (rc)
+ return rc;
+
+ id = dax_read_lock();
+ rc = dax_direct_access(dax_dev, pgoff, 1, &kaddr, NULL);
+ if (rc < 0) {
dax_read_unlock(id);
+ return rc;
}
+ memset(kaddr + offset, 0, size);
+ dax_flush(dax_dev, kaddr + offset, size);
+ dax_read_unlock(id);
return 0;
}
EXPORT_SYMBOL_GPL(__dax_zero_page_range);
2 years, 4 months
[ndctl V2] namespace/create: Don't create multiple namespaces unless greedy
by Santosh Sivaraj
From: Vaibhav Jain <vaibhav(a)linux.ibm.com>
Currently create-namespace creates two namespaces with the '-f' option
even without the greedy flag. This behavior got introduced by
c75f7236d. The earlier behaviour was to create one namespace even with
the '-f' flag. The earlier behavior:
$ sudo ./ndctl/ndctl create-namespace -s 16M -f
[sudo] password for santosh:
{
"dev":"namespace1.14",
"mode":"fsdax",
"map":"dev",
"size":"14.00 MiB (14.68 MB)",
"uuid":"03f6b921-7684-4736-b2be-87f021996e52",
"sector_size":512,
"align":65536,
"blockdev":"pmem1.14"
}
After greedy option was introduced:
$ sudo ./ndctl/ndctl create-namespace -s 16M -f
{
"dev":"namespace1.8",
"mode":"fsdax",
"map":"dev",
"size":"14.00 MiB (14.68 MB)",
"uuid":"1a9d6610-558b-454e-8b95-76c6201798cb",
"sector_size":512,
"align":65536,
"blockdev":"pmem1.8"
}
{
"dev":"namespace0.3",
"mode":"fsdax",
"map":"dev",
"size":"14.00 MiB (14.68 MB)",
"uuid":"eed9d28b-69a2-4c7c-9503-24e8aee87b1e",
"sector_size":512,
"align":65536,
"blockdev":"pmem0.3"
}
The force flag makes sense only in the case of a reconfiguration or
greedy namespace creation.
Fixes: c75f7236d (ndctl/namespace: add a --continue option to create namespaces greedily)
Signed-off-by: Santosh Sivaraj <santosh(a)fossix.org>
Signed-off-by: Vaibhav Jain <vaibhav(a)linux.ibm.com>
---
ndctl/namespace.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 7fb0007..b1f2158 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -1388,11 +1388,9 @@ static int do_xaction_namespace(const char *namespace,
(*processed)++;
if (param.greedy)
continue;
- }
- if (force) {
- if (rc)
+ } else if (param.greedy && force) {
saved_rc = rc;
- continue;
+ continue;
}
return rc;
}
--
2.23.0
2 years, 4 months