aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-17 12:51:57 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-17 12:51:57 -0500
commita3841f94c7ecb3ede0f888d3fcfe8fb6368ddd7a (patch)
tree6625eedf10d0672068ee218bb893a5a0e1803df2 /include
parentadeba81ac2a6451f44545874da3d181081f0ab04 (diff)
parent4247f24c23589bcc3bc3490515ef8c9497e9ae55 (diff)
Merge tag 'libnvdimm-for-4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm and dax updates from Dan Williams: "Save for a few late fixes, all of these commits have shipped in -next releases since before the merge window opened, and 0day has given a build success notification. The ext4 touches came from Jan, and the xfs touches have Darrick's reviewed-by. An xfstest for the MAP_SYNC feature has been through a few round of reviews and is on track to be merged. - Introduce MAP_SYNC and MAP_SHARED_VALIDATE, a mechanism to enable 'userspace flush' of persistent memory updates via filesystem-dax mappings. It arranges for any filesystem metadata updates that may be required to satisfy a write fault to also be flushed ("on disk") before the kernel returns to userspace from the fault handler. Effectively every write-fault that dirties metadata completes an fsync() before returning from the fault handler. The new MAP_SHARED_VALIDATE mapping type guarantees that the MAP_SYNC flag is validated as supported by the filesystem's ->mmap() file operation. - Add support for the standard ACPI 6.2 label access methods that replace the NVDIMM_FAMILY_INTEL (vendor specific) label methods. This enables interoperability with environments that only implement the standardized methods. - Add support for the ACPI 6.2 NVDIMM media error injection methods. - Add support for the NVDIMM_FAMILY_INTEL v1.6 DIMM commands for latch last shutdown status, firmware update, SMART error injection, and SMART alarm threshold control. - Cleanup physical address information disclosures to be root-only. - Fix revalidation of the DIMM "locked label area" status to support dynamic unlock of the label area. - Expand unit test infrastructure to mock the ACPI 6.2 Translate SPA (system-physical-address) command and error injection commands. Acknowledgements that came after the commits were pushed to -next: - 957ac8c421ad ("dax: fix PMD faults on zero-length files"): Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com> - a39e596baa07 ("xfs: support for synchronous DAX faults") and 7b565c9f965b ("xfs: Implement xfs_filemap_pfn_mkwrite() using __xfs_filemap_fault()") Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>" * tag 'libnvdimm-for-4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: (49 commits) acpi, nfit: add 'Enable Latch System Shutdown Status' command support dax: fix general protection fault in dax_alloc_inode dax: fix PMD faults on zero-length files dax: stop requiring a live device for dax_flush() brd: remove dax support dax: quiet bdev_dax_supported() fs, dax: unify IOMAP_F_DIRTY read vs write handling policy in the dax core tools/testing/nvdimm: unit test clear-error commands acpi, nfit: validate commands against the device type tools/testing/nvdimm: stricter bounds checking for error injection commands xfs: support for synchronous DAX faults xfs: Implement xfs_filemap_pfn_mkwrite() using __xfs_filemap_fault() ext4: Support for synchronous DAX faults ext4: Simplify error handling in ext4_dax_huge_fault() dax: Implement dax_finish_sync_fault() dax, iomap: Add support for synchronous faults mm: Define MAP_SYNC and VM_SYNC flags dax: Allow tuning whether dax_insert_mapping_entry() dirties entry dax: Allow dax_iomap_fault() to return pfn dax: Fix comment describing dax_iomap_fault() ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/dax.h4
-rw-r--r--include/linux/fs.h1
-rw-r--r--include/linux/iomap.h4
-rw-r--r--include/linux/jbd2.h1
-rw-r--r--include/linux/libnvdimm.h21
-rw-r--r--include/linux/mm.h9
-rw-r--r--include/linux/mman.h48
-rw-r--r--include/trace/events/fs_dax.h3
-rw-r--r--include/uapi/asm-generic/mman-common.h1
-rw-r--r--include/uapi/asm-generic/mman.h1
10 files changed, 83 insertions, 10 deletions
diff --git a/include/linux/dax.h b/include/linux/dax.h
index 895e16fcc62d..5258346c558c 100644
--- a/include/linux/dax.h
+++ b/include/linux/dax.h
@@ -96,7 +96,9 @@ bool dax_write_cache_enabled(struct dax_device *dax_dev);
96ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter, 96ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
97 const struct iomap_ops *ops); 97 const struct iomap_ops *ops);
98int dax_iomap_fault(struct vm_fault *vmf, enum page_entry_size pe_size, 98int dax_iomap_fault(struct vm_fault *vmf, enum page_entry_size pe_size,
99 const struct iomap_ops *ops); 99 pfn_t *pfnp, const struct iomap_ops *ops);
100int dax_finish_sync_fault(struct vm_fault *vmf, enum page_entry_size pe_size,
101 pfn_t pfn);
100int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index); 102int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index);
101int dax_invalidate_mapping_entry_sync(struct address_space *mapping, 103int dax_invalidate_mapping_entry_sync(struct address_space *mapping,
102 pgoff_t index); 104 pgoff_t index);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 269086440071..a2b5d64ea503 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1702,6 +1702,7 @@ struct file_operations {
1702 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 1702 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
1703 long (*compat_ioctl) (struct file *, unsigned int, unsigned long); 1703 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
1704 int (*mmap) (struct file *, struct vm_area_struct *); 1704 int (*mmap) (struct file *, struct vm_area_struct *);
1705 unsigned long mmap_supported_flags;
1705 int (*open) (struct inode *, struct file *); 1706 int (*open) (struct inode *, struct file *);
1706 int (*flush) (struct file *, fl_owner_t id); 1707 int (*flush) (struct file *, fl_owner_t id);
1707 int (*release) (struct inode *, struct file *); 1708 int (*release) (struct inode *, struct file *);
diff --git a/include/linux/iomap.h b/include/linux/iomap.h
index ca10767ab73d..19a07de28212 100644
--- a/include/linux/iomap.h
+++ b/include/linux/iomap.h
@@ -21,9 +21,13 @@ struct vm_fault;
21 21
22/* 22/*
23 * Flags for all iomap mappings: 23 * Flags for all iomap mappings:
24 *
25 * IOMAP_F_DIRTY indicates the inode has uncommitted metadata needed to access
26 * written data and requires fdatasync to commit them to persistent storage.
24 */ 27 */
25#define IOMAP_F_NEW 0x01 /* blocks have been newly allocated */ 28#define IOMAP_F_NEW 0x01 /* blocks have been newly allocated */
26#define IOMAP_F_BOUNDARY 0x02 /* mapping ends at metadata boundary */ 29#define IOMAP_F_BOUNDARY 0x02 /* mapping ends at metadata boundary */
30#define IOMAP_F_DIRTY 0x04 /* uncommitted metadata */
27 31
28/* 32/*
29 * Flags that only need to be reported for IOMAP_REPORT requests: 33 * Flags that only need to be reported for IOMAP_REPORT requests:
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 606b6bce3a5b..296d1e0ea87b 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1367,6 +1367,7 @@ int jbd2_log_start_commit(journal_t *journal, tid_t tid);
1367int __jbd2_log_start_commit(journal_t *journal, tid_t tid); 1367int __jbd2_log_start_commit(journal_t *journal, tid_t tid);
1368int jbd2_journal_start_commit(journal_t *journal, tid_t *tid); 1368int jbd2_journal_start_commit(journal_t *journal, tid_t *tid);
1369int jbd2_log_wait_commit(journal_t *journal, tid_t tid); 1369int jbd2_log_wait_commit(journal_t *journal, tid_t tid);
1370int jbd2_transaction_committed(journal_t *journal, tid_t tid);
1370int jbd2_complete_transaction(journal_t *journal, tid_t tid); 1371int jbd2_complete_transaction(journal_t *journal, tid_t tid);
1371int jbd2_log_do_checkpoint(journal_t *journal); 1372int jbd2_log_do_checkpoint(journal_t *journal);
1372int jbd2_trans_will_send_data_barrier(journal_t *journal, tid_t tid); 1373int jbd2_trans_will_send_data_barrier(journal_t *journal, tid_t tid);
diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
index 3eaad2fbf284..f8109ddb5ef1 100644
--- a/include/linux/libnvdimm.h
+++ b/include/linux/libnvdimm.h
@@ -18,6 +18,18 @@
18#include <linux/sizes.h> 18#include <linux/sizes.h>
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/uuid.h> 20#include <linux/uuid.h>
21#include <linux/spinlock.h>
22
23struct badrange_entry {
24 u64 start;
25 u64 length;
26 struct list_head list;
27};
28
29struct badrange {
30 struct list_head list;
31 spinlock_t lock;
32};
21 33
22enum { 34enum {
23 /* when a dimm supports both PMEM and BLK access a label is required */ 35 /* when a dimm supports both PMEM and BLK access a label is required */
@@ -129,9 +141,12 @@ static inline struct nd_blk_region_desc *to_blk_region_desc(
129 141
130} 142}
131 143
132int nvdimm_bus_add_poison(struct nvdimm_bus *nvdimm_bus, u64 addr, u64 length); 144void badrange_init(struct badrange *badrange);
133void nvdimm_forget_poison(struct nvdimm_bus *nvdimm_bus, 145int badrange_add(struct badrange *badrange, u64 addr, u64 length);
134 phys_addr_t start, unsigned int len); 146void badrange_forget(struct badrange *badrange, phys_addr_t start,
147 unsigned int len);
148int nvdimm_bus_add_badrange(struct nvdimm_bus *nvdimm_bus, u64 addr,
149 u64 length);
135struct nvdimm_bus *nvdimm_bus_register(struct device *parent, 150struct nvdimm_bus *nvdimm_bus_register(struct device *parent,
136 struct nvdimm_bus_descriptor *nfit_desc); 151 struct nvdimm_bus_descriptor *nfit_desc);
137void nvdimm_bus_unregister(struct nvdimm_bus *nvdimm_bus); 152void nvdimm_bus_unregister(struct nvdimm_bus *nvdimm_bus);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index c7b1d617dff6..ee073146aaa7 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -199,6 +199,7 @@ extern unsigned int kobjsize(const void *objp);
199#define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */ 199#define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */
200#define VM_NORESERVE 0x00200000 /* should the VM suppress accounting */ 200#define VM_NORESERVE 0x00200000 /* should the VM suppress accounting */
201#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ 201#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */
202#define VM_SYNC 0x00800000 /* Synchronous page faults */
202#define VM_ARCH_1 0x01000000 /* Architecture-specific flag */ 203#define VM_ARCH_1 0x01000000 /* Architecture-specific flag */
203#define VM_WIPEONFORK 0x02000000 /* Wipe VMA contents in child. */ 204#define VM_WIPEONFORK 0x02000000 /* Wipe VMA contents in child. */
204#define VM_DONTDUMP 0x04000000 /* Do not include in the core dump */ 205#define VM_DONTDUMP 0x04000000 /* Do not include in the core dump */
@@ -1191,8 +1192,9 @@ static inline void clear_page_pfmemalloc(struct page *page)
1191#define VM_FAULT_RETRY 0x0400 /* ->fault blocked, must retry */ 1192#define VM_FAULT_RETRY 0x0400 /* ->fault blocked, must retry */
1192#define VM_FAULT_FALLBACK 0x0800 /* huge page fault failed, fall back to small */ 1193#define VM_FAULT_FALLBACK 0x0800 /* huge page fault failed, fall back to small */
1193#define VM_FAULT_DONE_COW 0x1000 /* ->fault has fully handled COW */ 1194#define VM_FAULT_DONE_COW 0x1000 /* ->fault has fully handled COW */
1194 1195#define VM_FAULT_NEEDDSYNC 0x2000 /* ->fault did not modify page tables
1195#define VM_FAULT_HWPOISON_LARGE_MASK 0xf000 /* encodes hpage index for large hwpoison */ 1196 * and needs fsync() to complete (for
1197 * synchronous page faults in DAX) */
1196 1198
1197#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV | \ 1199#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV | \
1198 VM_FAULT_HWPOISON | VM_FAULT_HWPOISON_LARGE | \ 1200 VM_FAULT_HWPOISON | VM_FAULT_HWPOISON_LARGE | \
@@ -1210,7 +1212,8 @@ static inline void clear_page_pfmemalloc(struct page *page)
1210 { VM_FAULT_LOCKED, "LOCKED" }, \ 1212 { VM_FAULT_LOCKED, "LOCKED" }, \
1211 { VM_FAULT_RETRY, "RETRY" }, \ 1213 { VM_FAULT_RETRY, "RETRY" }, \
1212 { VM_FAULT_FALLBACK, "FALLBACK" }, \ 1214 { VM_FAULT_FALLBACK, "FALLBACK" }, \
1213 { VM_FAULT_DONE_COW, "DONE_COW" } 1215 { VM_FAULT_DONE_COW, "DONE_COW" }, \
1216 { VM_FAULT_NEEDDSYNC, "NEEDDSYNC" }
1214 1217
1215/* Encode hstate index for a hwpoisoned large page */ 1218/* Encode hstate index for a hwpoisoned large page */
1216#define VM_FAULT_SET_HINDEX(x) ((x) << 12) 1219#define VM_FAULT_SET_HINDEX(x) ((x) << 12)
diff --git a/include/linux/mman.h b/include/linux/mman.h
index 7c87b6652244..6a4d1caaff5c 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -8,6 +8,48 @@
8#include <linux/atomic.h> 8#include <linux/atomic.h>
9#include <uapi/linux/mman.h> 9#include <uapi/linux/mman.h>
10 10
11/*
12 * Arrange for legacy / undefined architecture specific flags to be
13 * ignored by mmap handling code.
14 */
15#ifndef MAP_32BIT
16#define MAP_32BIT 0
17#endif
18#ifndef MAP_HUGE_2MB
19#define MAP_HUGE_2MB 0
20#endif
21#ifndef MAP_HUGE_1GB
22#define MAP_HUGE_1GB 0
23#endif
24#ifndef MAP_UNINITIALIZED
25#define MAP_UNINITIALIZED 0
26#endif
27#ifndef MAP_SYNC
28#define MAP_SYNC 0
29#endif
30
31/*
32 * The historical set of flags that all mmap implementations implicitly
33 * support when a ->mmap_validate() op is not provided in file_operations.
34 */
35#define LEGACY_MAP_MASK (MAP_SHARED \
36 | MAP_PRIVATE \
37 | MAP_FIXED \
38 | MAP_ANONYMOUS \
39 | MAP_DENYWRITE \
40 | MAP_EXECUTABLE \
41 | MAP_UNINITIALIZED \
42 | MAP_GROWSDOWN \
43 | MAP_LOCKED \
44 | MAP_NORESERVE \
45 | MAP_POPULATE \
46 | MAP_NONBLOCK \
47 | MAP_STACK \
48 | MAP_HUGETLB \
49 | MAP_32BIT \
50 | MAP_HUGE_2MB \
51 | MAP_HUGE_1GB)
52
11extern int sysctl_overcommit_memory; 53extern int sysctl_overcommit_memory;
12extern int sysctl_overcommit_ratio; 54extern int sysctl_overcommit_ratio;
13extern unsigned long sysctl_overcommit_kbytes; 55extern unsigned long sysctl_overcommit_kbytes;
@@ -64,8 +106,9 @@ static inline bool arch_validate_prot(unsigned long prot)
64 * ("bit1" and "bit2" must be single bits) 106 * ("bit1" and "bit2" must be single bits)
65 */ 107 */
66#define _calc_vm_trans(x, bit1, bit2) \ 108#define _calc_vm_trans(x, bit1, bit2) \
109 ((!(bit1) || !(bit2)) ? 0 : \
67 ((bit1) <= (bit2) ? ((x) & (bit1)) * ((bit2) / (bit1)) \ 110 ((bit1) <= (bit2) ? ((x) & (bit1)) * ((bit2) / (bit1)) \
68 : ((x) & (bit1)) / ((bit1) / (bit2))) 111 : ((x) & (bit1)) / ((bit1) / (bit2))))
69 112
70/* 113/*
71 * Combine the mmap "prot" argument into "vm_flags" used internally. 114 * Combine the mmap "prot" argument into "vm_flags" used internally.
@@ -87,7 +130,8 @@ calc_vm_flag_bits(unsigned long flags)
87{ 130{
88 return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) | 131 return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) |
89 _calc_vm_trans(flags, MAP_DENYWRITE, VM_DENYWRITE ) | 132 _calc_vm_trans(flags, MAP_DENYWRITE, VM_DENYWRITE ) |
90 _calc_vm_trans(flags, MAP_LOCKED, VM_LOCKED ); 133 _calc_vm_trans(flags, MAP_LOCKED, VM_LOCKED ) |
134 _calc_vm_trans(flags, MAP_SYNC, VM_SYNC );
91} 135}
92 136
93unsigned long vm_commit_limit(void); 137unsigned long vm_commit_limit(void);
diff --git a/include/trace/events/fs_dax.h b/include/trace/events/fs_dax.h
index 8a8df5423dca..97b09fcf7e52 100644
--- a/include/trace/events/fs_dax.h
+++ b/include/trace/events/fs_dax.h
@@ -149,7 +149,6 @@ DEFINE_EVENT(dax_pmd_insert_mapping_class, name, \
149 TP_ARGS(inode, vmf, length, pfn, radix_entry)) 149 TP_ARGS(inode, vmf, length, pfn, radix_entry))
150 150
151DEFINE_PMD_INSERT_MAPPING_EVENT(dax_pmd_insert_mapping); 151DEFINE_PMD_INSERT_MAPPING_EVENT(dax_pmd_insert_mapping);
152DEFINE_PMD_INSERT_MAPPING_EVENT(dax_pmd_insert_mapping_fallback);
153 152
154DECLARE_EVENT_CLASS(dax_pte_fault_class, 153DECLARE_EVENT_CLASS(dax_pte_fault_class,
155 TP_PROTO(struct inode *inode, struct vm_fault *vmf, int result), 154 TP_PROTO(struct inode *inode, struct vm_fault *vmf, int result),
@@ -192,6 +191,8 @@ DEFINE_EVENT(dax_pte_fault_class, name, \
192DEFINE_PTE_FAULT_EVENT(dax_pte_fault); 191DEFINE_PTE_FAULT_EVENT(dax_pte_fault);
193DEFINE_PTE_FAULT_EVENT(dax_pte_fault_done); 192DEFINE_PTE_FAULT_EVENT(dax_pte_fault_done);
194DEFINE_PTE_FAULT_EVENT(dax_load_hole); 193DEFINE_PTE_FAULT_EVENT(dax_load_hole);
194DEFINE_PTE_FAULT_EVENT(dax_insert_pfn_mkwrite_no_entry);
195DEFINE_PTE_FAULT_EVENT(dax_insert_pfn_mkwrite);
195 196
196TRACE_EVENT(dax_insert_mapping, 197TRACE_EVENT(dax_insert_mapping,
197 TP_PROTO(struct inode *inode, struct vm_fault *vmf, void *radix_entry), 198 TP_PROTO(struct inode *inode, struct vm_fault *vmf, void *radix_entry),
diff --git a/include/uapi/asm-generic/mman-common.h b/include/uapi/asm-generic/mman-common.h
index 6d319c46fd90..f8b134f5608f 100644
--- a/include/uapi/asm-generic/mman-common.h
+++ b/include/uapi/asm-generic/mman-common.h
@@ -17,6 +17,7 @@
17 17
18#define MAP_SHARED 0x01 /* Share changes */ 18#define MAP_SHARED 0x01 /* Share changes */
19#define MAP_PRIVATE 0x02 /* Changes are private */ 19#define MAP_PRIVATE 0x02 /* Changes are private */
20#define MAP_SHARED_VALIDATE 0x03 /* share + validate extension flags */
20#define MAP_TYPE 0x0f /* Mask for type of mapping */ 21#define MAP_TYPE 0x0f /* Mask for type of mapping */
21#define MAP_FIXED 0x10 /* Interpret addr exactly */ 22#define MAP_FIXED 0x10 /* Interpret addr exactly */
22#define MAP_ANONYMOUS 0x20 /* don't use a file */ 23#define MAP_ANONYMOUS 0x20 /* don't use a file */
diff --git a/include/uapi/asm-generic/mman.h b/include/uapi/asm-generic/mman.h
index 2dffcbf705b3..653687d9771b 100644
--- a/include/uapi/asm-generic/mman.h
+++ b/include/uapi/asm-generic/mman.h
@@ -13,6 +13,7 @@
13#define MAP_NONBLOCK 0x10000 /* do not block on IO */ 13#define MAP_NONBLOCK 0x10000 /* do not block on IO */
14#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ 14#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
15#define MAP_HUGETLB 0x40000 /* create a huge page mapping */ 15#define MAP_HUGETLB 0x40000 /* create a huge page mapping */
16#define MAP_SYNC 0x80000 /* perform synchronous page faults for the mapping */
16 17
17/* Bits [26:31] are reserved, see mman-common.h for MAP_HUGETLB usage */ 18/* Bits [26:31] are reserved, see mman-common.h for MAP_HUGETLB usage */
18 19