[PATCH 0/7] dax: unified host inode for device-dax mappings
by Dan Williams
There are two scenarios where we need mappings of a /dev/dax device to
share a single host inode, invalidating mappings at device shutdown, and
coordinating resize of an actively mapped device. This series addresses
the unmap-on-shutdown case and includes reworks, like the cdev api
conversion, to prepare for a dynamic resize / allocation capability.
Recall that device-DAX, introduced in v4.7 [1], is a mechanism to
provide deterministic mapping behavior for performance- /
feature-differentiated memory ranges.
[1]: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?i...
---
Dan Williams (7):
dax: cleanup needlessly global symbol warnings
dax: reorder dax_fops function definitions
dax: rename fops from dax_dev_ to dax_
dax: embed a struct device in dax_dev
dax: convert to the cdev api
dax: define a unified inode/address_space for device-dax mappings
dax: unmap/truncate on device shutdown
drivers/dax/Kconfig | 5
drivers/dax/dax.c | 555 ++++++++++++++++++++++++++------------------
drivers/dax/pmem.c | 2
fs/char_dev.c | 1
include/uapi/linux/magic.h | 1
5 files changed, 337 insertions(+), 227 deletions(-)
4 years, 5 months
[PATCH v2 0/3] 'slot' can be NULL in radix_tree_next_slot()
by Ross Zwisler
This adds comments above radix_tree_next_slot() documenting the combination
of factors that prevent us from dereferencing a NULL 'slot' pointer. It
also adds a radix tree unit test so that we can easily catch any unhandled
NULL pointer issues with radix_tree_next_slot().
Changes from V1:
- Instead of adding an explicit check for 'slot' being NULL at the
beginning of radix_tree_next_slot(), document what factors are keeping
us safe instead. (Konstantin)
Ross Zwisler (3):
radix-tree: 'slot' can be NULL in radix_tree_next_slot()
radix-tree tests: add iteration test
radix-tree tests: properly initialize mutex
include/linux/radix-tree.h | 8 ++
tools/testing/radix-tree/Makefile | 3 +-
tools/testing/radix-tree/iteration_check.c | 180 +++++++++++++++++++++++++++++
tools/testing/radix-tree/main.c | 1 +
tools/testing/radix-tree/regression1.c | 2 +-
tools/testing/radix-tree/test.h | 1 +
6 files changed, 193 insertions(+), 2 deletions(-)
create mode 100644 tools/testing/radix-tree/iteration_check.c
--
2.9.0
4 years, 5 months
[GIT PULL] libnvdimm fixes for 4.8-rc2
by Williams, Dan J
Hi Linus, please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm libnvdimm-fixes
...to receive:
- Fix for the nd_blk (NVDIMM Block Window Aperture) driver. A spec
clarification requires the driver to mask off reserved bits in status
register. This is tagged for -stable back to the v4.2 kernel.
- Fix for a kernel crash in the nvdimm unit tests when module loading
is interrupted with SIGTERM. Tagged for -stable since validation
efforts external to Intel use the unit tests for qualifying backports.
- Add a new 'size' sysfs attribute for the BTT (NVDIMM Block
Translation Table) driver to make it symmetric with the other namespace
personality drivers (PFN and DAX) that provide a size attribute for
indicating how much namespace capacity is lost to metadata.
The BTT change arrived at the start of the merge window and has
appeared in a -next release. It can technically wait for 4.9, but it
is small, fixes asymmetry in the libnvdimm-sysfs interface, and
something I would have squeezed into the v4.8 pull request had it
arrived a few days earlier.
---
The following changes since commit 29b4817d4018df78086157ea3a55c1d9424a7cfc:
Linux 4.8-rc1 (2016-08-07 18:18:00 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm libnvdimm-fixes
for you to fetch changes up to d8d378fa1a0c98ecb50ca52c9bf3bc14e25aa2d2:
tools/testing/nvdimm: fix SIGTERM vs hotplug crash (2016-08-10 15:59:09 -0700)
----------------------------------------------------------------
Dan Williams (1):
tools/testing/nvdimm: fix SIGTERM vs hotplug crash
Ross Zwisler (1):
libnvdimm, nd_blk: mask off reserved status bits
Vishal Verma (1):
nvdimm, btt: add a size attribute for BTTs
drivers/acpi/nfit/core.c | 3 ++-
drivers/nvdimm/btt.c | 1 +
drivers/nvdimm/btt_devs.c | 20 ++++++++++++++++++++
drivers/nvdimm/nd.h | 1 +
tools/testing/nvdimm/test/nfit.c | 2 ++
5 files changed, 26 insertions(+), 1 deletion(-)
commit 68202c9f0ad6e16ee806fbadbc5838d55fe5aa5c
Author: Ross Zwisler <ross.zwisler(a)linux.intel.com>
Date: Fri Jul 29 14:59:12 2016 -0600
libnvdimm, nd_blk: mask off reserved status bits
The "NVDIMM Block Window Driver Writer's Guide":
http://pmem.io/documents/NVDIMM_DriverWritersGuide-July-2016.pdf
...defines the layout of the block window status register. For the July
2016 version of the spec linked to above, this happens in Figure 4 on
page 26.
The only bits defined in this spec are bits 31, 5, 4, 2, 1 and 0. The
rest of the bits in the status register are reserved, and there is a
warning following the diagram that says:
Note: The driver cannot assume the value of the RESERVED bits in the
status register are zero. These reserved bits need to be masked off, and
the driver must avoid checking the state of those bits.
This change ensures that for hardware implementations that set these
reserved bits in the status register, the driver won't incorrectly fail the
block I/Os.
Cc: <stable(a)vger.kernel.org> #v4.2+
Reviewed-by: Lee, Chun-Yi <jlee(a)suse.com>
Signed-off-by: Ross Zwisler <ross.zwisler(a)linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
commit abe8b4e3cef88b8202641d63f5ad58141b970b0f
Author: Vishal Verma <vishal.l.verma(a)intel.com>
Date: Wed Jul 27 16:38:59 2016 -0600
nvdimm, btt: add a size attribute for BTTs
To be consistent with other namespaces, expose a 'size' attribute for
BTT devices also.
Cc: Dan Williams <dan.j.williams(a)intel.com>
Reported-by: Linda Knippers <linda.knippers(a)hpe.com>
Signed-off-by: Vishal Verma <vishal.l.verma(a)intel.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
commit d8d378fa1a0c98ecb50ca52c9bf3bc14e25aa2d2
Author: Dan Williams <dan.j.williams(a)intel.com>
Date: Wed Aug 10 15:59:09 2016 -0700
tools/testing/nvdimm: fix SIGTERM vs hotplug crash
The unit tests crash when hotplug races the previous probe. This race
requires that the loading of the nfit_test module be terminated with
SIGTERM, and the module to be unloaded while the ars scan is still
running.
In contrast to the normal nfit driver, the unit test calls
acpi_nfit_init() twice to simulate hotplug, whereas the nominal case
goes through the acpi_nfit_notify() event handler. The
acpi_nfit_notify() path is careful to flush the previous region
registration before servicing the hotplug event. The unit test was
missing this guarantee.
BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<ffffffff810cdce7>] pwq_activate_delayed_work+0x47/0x170
[..]
Call Trace:
[<ffffffff810ce186>] pwq_dec_nr_in_flight+0x66/0xa0
[<ffffffff810ce490>] process_one_work+0x2d0/0x680
[<ffffffff810ce331>] ? process_one_work+0x171/0x680
[<ffffffff810ce88e>] worker_thread+0x4e/0x480
[<ffffffff810ce840>] ? process_one_work+0x680/0x680
[<ffffffff810ce840>] ? process_one_work+0x680/0x680
[<ffffffff810d5343>] kthread+0xf3/0x110
[<ffffffff8199846f>] ret_from_fork+0x1f/0x40
[<ffffffff810d5250>] ? kthread_create_on_node+0x230/0x230
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
4 years, 5 months
上海东方网点双峰店有限公司
by gvoc
xv1toqb0ijtuzknv4cidqpfxl8rmsbhpq7
什么是企业资产前面的"1"
2016/8/12
21:25:51
4 years, 5 months
[ndctl PATCH] ndctl: update to latest ndctl.h
by Dan Williams
SMART Health and Threshold payload updates.
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
ndctl/ndctl.h | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/ndctl/ndctl.h b/ndctl/ndctl.h
index 7c19e9764da0..3b1d703e4af1 100644
--- a/ndctl/ndctl.h
+++ b/ndctl/ndctl.h
@@ -21,14 +21,16 @@ struct nd_cmd_smart {
} __attribute__((packed));
#define ND_SMART_HEALTH_VALID (1 << 0)
-#define ND_SMART_TEMP_VALID (1 << 1)
-#define ND_SMART_SPARES_VALID (1 << 2)
-#define ND_SMART_ALARM_VALID (1 << 3)
-#define ND_SMART_USED_VALID (1 << 4)
-#define ND_SMART_SHUTDOWN_VALID (1 << 5)
-#define ND_SMART_VENDOR_VALID (1 << 6)
-#define ND_SMART_TEMP_TRIP (1 << 0)
-#define ND_SMART_SPARE_TRIP (1 << 1)
+#define ND_SMART_SPARES_VALID (1 << 1)
+#define ND_SMART_USED_VALID (1 << 2)
+#define ND_SMART_TEMP_VALID (1 << 3)
+#define ND_SMART_CTEMP_VALID (1 << 4)
+#define ND_SMART_ALARM_VALID (1 << 9)
+#define ND_SMART_SHUTDOWN_VALID (1 << 10)
+#define ND_SMART_VENDOR_VALID (1 << 11)
+#define ND_SMART_SPARE_TRIP (1 << 0)
+#define ND_SMART_TEMP_TRIP (1 << 1)
+#define ND_SMART_CTEMP_TRIP (1 << 2)
#define ND_SMART_NON_CRITICAL_HEALTH (1 << 0)
#define ND_SMART_CRITICAL_HEALTH (1 << 1)
#define ND_SMART_FATAL_HEALTH (1 << 2)
@@ -37,14 +39,15 @@ struct nd_smart_payload {
__u32 flags;
__u8 reserved0[4];
__u8 health;
- __u16 temperature;
__u8 spares;
- __u8 alarm_flags;
__u8 life_used;
+ __u8 alarm_flags;
+ __u16 temperature;
+ __u16 ctrl_temperature;
+ __u8 reserved1[15];
__u8 shutdown_state;
- __u8 reserved1;
__u32 vendor_size;
- __u8 vendor_data[108];
+ __u8 vendor_data[92];
} __attribute__((packed));
struct nd_cmd_smart_threshold {
@@ -53,7 +56,8 @@ struct nd_cmd_smart_threshold {
} __attribute__((packed));
struct nd_smart_threshold_payload {
- __u16 alarm_control;
+ __u8 alarm_control;
+ __u8 reserved0;
__u16 temperature;
__u8 spares;
__u8 reserved[3];
@@ -298,6 +302,7 @@ struct nd_cmd_pkg {
#define NVDIMM_FAMILY_INTEL 0
#define NVDIMM_FAMILY_HPE1 1
#define NVDIMM_FAMILY_HPE2 2
+#define NVDIMM_FAMILY_MSFT 3
#define ND_IOCTL_CALL _IOWR(ND_IOCTL, ND_CMD_CALL,\
struct nd_cmd_pkg)
4 years, 5 months
[PATCH] libnvdimm: fix SMART Health DSM payload definition
by Dan Williams
"NVDIMM DSM Interface Example" v1.2 made an incompatible change to the
layout of function1 "SMART and Health Info". While the kernel does not
directly consume this payload, it does define it in ndctl.h that
userpace utilities consume.
Reported-by: Brian Boylston <brian.boylston(a)hpe.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
Note, there's no urgency to get this into the kernel since the only
consumer of it is userspace [1], and it can update in advance of this
patch being merged upstream in v4.9.
[1]: github.com/pmem/ndctl
include/uapi/linux/ndctl.h | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h
index ba5a8c79652a..ede5c6a62164 100644
--- a/include/uapi/linux/ndctl.h
+++ b/include/uapi/linux/ndctl.h
@@ -21,14 +21,16 @@ struct nd_cmd_smart {
} __packed;
#define ND_SMART_HEALTH_VALID (1 << 0)
-#define ND_SMART_TEMP_VALID (1 << 1)
-#define ND_SMART_SPARES_VALID (1 << 2)
-#define ND_SMART_ALARM_VALID (1 << 3)
-#define ND_SMART_USED_VALID (1 << 4)
-#define ND_SMART_SHUTDOWN_VALID (1 << 5)
-#define ND_SMART_VENDOR_VALID (1 << 6)
-#define ND_SMART_TEMP_TRIP (1 << 0)
-#define ND_SMART_SPARE_TRIP (1 << 1)
+#define ND_SMART_SPARES_VALID (1 << 1)
+#define ND_SMART_USED_VALID (1 << 2)
+#define ND_SMART_TEMP_VALID (1 << 3)
+#define ND_SMART_CTEMP_VALID (1 << 4)
+#define ND_SMART_ALARM_VALID (1 << 9)
+#define ND_SMART_SHUTDOWN_VALID (1 << 10)
+#define ND_SMART_VENDOR_VALID (1 << 11)
+#define ND_SMART_SPARE_TRIP (1 << 0)
+#define ND_SMART_TEMP_TRIP (1 << 1)
+#define ND_SMART_CTEMP_TRIP (1 << 2)
#define ND_SMART_NON_CRITICAL_HEALTH (1 << 0)
#define ND_SMART_CRITICAL_HEALTH (1 << 1)
#define ND_SMART_FATAL_HEALTH (1 << 2)
@@ -37,14 +39,15 @@ struct nd_smart_payload {
__u32 flags;
__u8 reserved0[4];
__u8 health;
- __u16 temperature;
__u8 spares;
- __u8 alarm_flags;
__u8 life_used;
+ __u8 alarm_flags;
+ __u16 temperature;
+ __u16 ctrl_temperature;
+ __u8 reserved1[15];
__u8 shutdown_state;
- __u8 reserved1;
__u32 vendor_size;
- __u8 vendor_data[108];
+ __u8 vendor_data[92];
} __packed;
struct nd_cmd_smart_threshold {
@@ -53,7 +56,8 @@ struct nd_cmd_smart_threshold {
} __packed;
struct nd_smart_threshold_payload {
- __u16 alarm_control;
+ __u8 alarm_control;
+ __u8 reserved0;
__u16 temperature;
__u8 spares;
__u8 reserved[3];
4 years, 5 months
OA邮箱升级
by admin
尊敬的领导以及同事:
由于部分离职员工离职办邮箱未上缴,导致资料泄露OA邮统的安全运营!
现请在员工配合邮箱备案登记,逾时未备案的邮箱将删除处理。
点 击 备 案 截止日期:2016年8月16日
4 years, 5 months
[4.6 stable PATCH 0/2] libnvdimm: fix initialization vs autodetect
by Dan Williams
Commit 1ee6667cd8d1 "libnvdimm, pfn, dax: fix initialization vs
autodetect for mode + alignment" originally tagged for -stable does not
apply cleanly to 4.6. This backport pulls in commit 45a0dac04511
"libnvdimm, dax: record the specified alignment of a dax-device
instance" as a pre-requisite.
The result has been verfied to pass the ndctl unit tests.
---
Dan Williams (2):
libnvdimm, dax: record the specified alignment of a dax-device instance
libnvdimm, pfn, dax: fix initialization vs autodetect for mode + alignment
drivers/nvdimm/pfn.h | 4 +++
drivers/nvdimm/pfn_devs.c | 53 +++++++++++++++++++++++++++++++++++++--------
drivers/nvdimm/pmem.c | 4 ++-
3 files changed, 49 insertions(+), 12 deletions(-)
4 years, 5 months
[PATCH] fs/char_dev: fix cdev_put() vs f_op->release() use-after-free
by Dan Williams
drivers/dax/dax.c implements a character device that supports mmap().
While trying to convert it to use the cdev api a unit test started
failing. The test effectively does the following to test that the driver
revokes active mappings when the device is unregistered:
fd = open("/dev/dax0.0", ...);
mmap(..., fd, ...);
<twiddle sysfs to trigger device_unregister()>;
exit();
...results in this crash:
dax dax0.0: dax_dev_vm_close
dax dax0.0: dax_dev_release: ffff880338afd298
dax_dev_free: ffff880338afd298
general protection fault: 0000 [#1] SMP
[..]
Call Trace:
[<ffffffff8128e2c0>] cdev_put+0x20/0x30
[<ffffffff8128b4db>] __fput+0x1ab/0x1f0
[<ffffffff8128b55e>] ____fput+0xe/0x10
[<ffffffff810d371e>] task_work_run+0x7e/0xa0
[<ffffffff810b41b2>] do_exit+0x302/0xc10
Where dax_dev_release() is the f_op->release() method, and is
implemented to simply drop the final references on our driver objects:
struct dax_dev *dax_dev = filp->private_data;
struct device *dev = dax_dev->dev;
dev_dbg(dax_dev->dev, "%s\n", __func__);
put_device(dev);
dax_dev_put(dax_dev);
The dax_dev object embeds a 'struct cdev' which means f_op->release()
may free cdev, so __fput() needs to drop the cdev reference before
calling f_op->release().
Cc: Al Viro <viro(a)zeniv.linux.org.uk>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
fs/file_table.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/file_table.c b/fs/file_table.c
index ad17e05ebf95..8856b8008248 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -204,13 +204,13 @@ static void __fput(struct file *file)
file->f_op->fasync(-1, file, 0);
}
ima_file_free(file);
- if (file->f_op->release)
- file->f_op->release(inode, file);
- security_file_free(file);
if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL &&
!(file->f_mode & FMODE_PATH))) {
cdev_put(inode->i_cdev);
}
+ if (file->f_op->release)
+ file->f_op->release(inode, file);
+ security_file_free(file);
fops_put(file->f_op);
put_pid(file->f_owner.pid);
if ((file->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ)
4 years, 5 months