Skip to content

Commit 3ff1b28

Browse files
committed
Merge tag 'libnvdimm-for-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm updates from Ross Zwisler: - Require struct page by default for filesystem DAX to remove a number of surprising failure cases. This includes failures with direct I/O, gdb and fork(2). - Add support for the new Platform Capabilities Structure added to the NFIT in ACPI 6.2a. This new table tells us whether the platform supports flushing of CPU and memory controller caches on unexpected power loss events. - Revamp vmem_altmap and dev_pagemap handling to clean up code and better support future future PCI P2P uses. - Deprecate the ND_IOCTL_SMART_THRESHOLD command whose payload has become out-of-sync with recent versions of the NVDIMM_FAMILY_INTEL spec, and instead rely on the generic ND_CMD_CALL approach used by the two other IOCTL families, NVDIMM_FAMILY_{HPE,MSFT}. - Enhance nfit_test so we can test some of the new things added in version 1.6 of the DSM specification. This includes testing firmware download and simulating the Last Shutdown State (LSS) status. * tag 'libnvdimm-for-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: (37 commits) libnvdimm, namespace: remove redundant initialization of 'nd_mapping' acpi, nfit: fix register dimm error handling libnvdimm, namespace: make min namespace size 4K tools/testing/nvdimm: force nfit_test to depend on instrumented modules libnvdimm/nfit_test: adding support for unit testing enable LSS status libnvdimm/nfit_test: add firmware download emulation nfit-test: Add platform cap support from ACPI 6.2a to test libnvdimm: expose platform persistence attribute for nd_region acpi: nfit: add persistent memory control flag for nd_region acpi: nfit: Add support for detect platform CPU cache flush on power loss device-dax: Fix trailing semicolon libnvdimm, btt: fix uninitialized err_lock dax: require 'struct page' by default for filesystem dax ext2: auto disable dax instead of failing mount ext4: auto disable dax instead of failing mount mm, dax: introduce pfn_t_special() mm: Fix devm_memremap_pages() collision handling mm: Fix memory size alignment in devm_memremap_pages_release() memremap: merge find_dev_pagemap into get_dev_pagemap memremap: change devm_memremap_pages interface to use struct dev_pagemap ...
2 parents 105cf3c + ee95f40 commit 3ff1b28

52 files changed

Lines changed: 1120 additions & 525 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎arch/arm64/mm/mmu.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,12 +685,14 @@ int kern_addr_valid(unsigned long addr)
685685
}
686686
#ifdef CONFIG_SPARSEMEM_VMEMMAP
687687
#if !ARM64_SWAPPER_USES_SECTION_MAPS
688-
int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
688+
int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
689+
struct vmem_altmap *altmap)
689690
{
690691
return vmemmap_populate_basepages(start, end, node);
691692
}
692693
#else /* !ARM64_SWAPPER_USES_SECTION_MAPS */
693-
int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
694+
int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
695+
struct vmem_altmap *altmap)
694696
{
695697
unsigned long addr = start;
696698
unsigned long next;
@@ -725,7 +727,8 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
725727
return 0;
726728
}
727729
#endif /* CONFIG_ARM64_64K_PAGES */
728-
void vmemmap_free(unsigned long start, unsigned long end)
730+
void vmemmap_free(unsigned long start, unsigned long end,
731+
struct vmem_altmap *altmap)
729732
{
730733
}
731734
#endif /* CONFIG_SPARSEMEM_VMEMMAP */

‎arch/ia64/mm/discontig.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,12 +754,14 @@ void arch_refresh_nodedata(int update_node, pg_data_t *update_pgdat)
754754
#endif
755755

756756
#ifdef CONFIG_SPARSEMEM_VMEMMAP
757-
int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
757+
int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
758+
struct vmem_altmap *altmap)
758759
{
759760
return vmemmap_populate_basepages(start, end, node);
760761
}
761762

762-
void vmemmap_free(unsigned long start, unsigned long end)
763+
void vmemmap_free(unsigned long start, unsigned long end,
764+
struct vmem_altmap *altmap)
763765
{
764766
}
765767
#endif

‎arch/ia64/mm/init.c‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -501,17 +501,18 @@ virtual_memmap_init(u64 start, u64 end, void *arg)
501501
if (map_start < map_end)
502502
memmap_init_zone((unsigned long)(map_end - map_start),
503503
args->nid, args->zone, page_to_pfn(map_start),
504-
MEMMAP_EARLY);
504+
MEMMAP_EARLY, NULL);
505505
return 0;
506506
}
507507

508508
void __meminit
509509
memmap_init (unsigned long size, int nid, unsigned long zone,
510510
unsigned long start_pfn)
511511
{
512-
if (!vmem_map)
513-
memmap_init_zone(size, nid, zone, start_pfn, MEMMAP_EARLY);
514-
else {
512+
if (!vmem_map) {
513+
memmap_init_zone(size, nid, zone, start_pfn, MEMMAP_EARLY,
514+
NULL);
515+
} else {
515516
struct page *start;
516517
struct memmap_init_callback_data args;
517518

@@ -647,13 +648,14 @@ mem_init (void)
647648
}
648649

649650
#ifdef CONFIG_MEMORY_HOTPLUG
650-
int arch_add_memory(int nid, u64 start, u64 size, bool want_memblock)
651+
int arch_add_memory(int nid, u64 start, u64 size, struct vmem_altmap *altmap,
652+
bool want_memblock)
651653
{
652654
unsigned long start_pfn = start >> PAGE_SHIFT;
653655
unsigned long nr_pages = size >> PAGE_SHIFT;
654656
int ret;
655657

656-
ret = __add_pages(nid, start_pfn, nr_pages, want_memblock);
658+
ret = __add_pages(nid, start_pfn, nr_pages, altmap, want_memblock);
657659
if (ret)
658660
printk("%s: Problem encountered in __add_pages() as ret=%d\n",
659661
__func__, ret);
@@ -662,15 +664,15 @@ int arch_add_memory(int nid, u64 start, u64 size, bool want_memblock)
662664
}
663665

664666
#ifdef CONFIG_MEMORY_HOTREMOVE
665-
int arch_remove_memory(u64 start, u64 size)
667+
int arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
666668
{
667669
unsigned long start_pfn = start >> PAGE_SHIFT;
668670
unsigned long nr_pages = size >> PAGE_SHIFT;
669671
struct zone *zone;
670672
int ret;
671673

672674
zone = page_zone(pfn_to_page(start_pfn));
673-
ret = __remove_pages(zone, start_pfn, nr_pages);
675+
ret = __remove_pages(zone, start_pfn, nr_pages, altmap);
674676
if (ret)
675677
pr_warn("%s: Problem encountered in __remove_pages() as"
676678
" ret=%d\n", __func__, ret);

‎arch/powerpc/mm/init_64.c‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ static __meminit void vmemmap_list_populate(unsigned long phys,
183183
vmemmap_list = vmem_back;
184184
}
185185

186-
int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
186+
int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
187+
struct vmem_altmap *altmap)
187188
{
188189
unsigned long page_size = 1 << mmu_psize_defs[mmu_vmemmap_psize].shift;
189190

@@ -193,17 +194,16 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
193194
pr_debug("vmemmap_populate %lx..%lx, node %d\n", start, end, node);
194195

195196
for (; start < end; start += page_size) {
196-
struct vmem_altmap *altmap;
197197
void *p;
198198
int rc;
199199

200200
if (vmemmap_populated(start, page_size))
201201
continue;
202202

203-
/* altmap lookups only work at section boundaries */
204-
altmap = to_vmem_altmap(SECTION_ALIGN_DOWN(start));
205-
206-
p = __vmemmap_alloc_block_buf(page_size, node, altmap);
203+
if (altmap)
204+
p = altmap_alloc_block_buf(page_size, altmap);
205+
else
206+
p = vmemmap_alloc_block_buf(page_size, node);
207207
if (!p)
208208
return -ENOMEM;
209209

@@ -256,7 +256,8 @@ static unsigned long vmemmap_list_free(unsigned long start)
256256
return vmem_back->phys;
257257
}
258258

259-
void __ref vmemmap_free(unsigned long start, unsigned long end)
259+
void __ref vmemmap_free(unsigned long start, unsigned long end,
260+
struct vmem_altmap *altmap)
260261
{
261262
unsigned long page_size = 1 << mmu_psize_defs[mmu_vmemmap_psize].shift;
262263
unsigned long page_order = get_order(page_size);
@@ -267,7 +268,6 @@ void __ref vmemmap_free(unsigned long start, unsigned long end)
267268

268269
for (; start < end; start += page_size) {
269270
unsigned long nr_pages, addr;
270-
struct vmem_altmap *altmap;
271271
struct page *section_base;
272272
struct page *page;
273273

@@ -287,7 +287,6 @@ void __ref vmemmap_free(unsigned long start, unsigned long end)
287287
section_base = pfn_to_page(vmemmap_section_start(start));
288288
nr_pages = 1 << page_order;
289289

290-
altmap = to_vmem_altmap((unsigned long) section_base);
291290
if (altmap) {
292291
vmem_altmap_free(altmap, nr_pages);
293292
} else if (PageReserved(page)) {

‎arch/powerpc/mm/mem.c‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ int __weak remove_section_mapping(unsigned long start, unsigned long end)
127127
return -ENODEV;
128128
}
129129

130-
int arch_add_memory(int nid, u64 start, u64 size, bool want_memblock)
130+
int arch_add_memory(int nid, u64 start, u64 size, struct vmem_altmap *altmap,
131+
bool want_memblock)
131132
{
132133
unsigned long start_pfn = start >> PAGE_SHIFT;
133134
unsigned long nr_pages = size >> PAGE_SHIFT;
@@ -143,15 +144,14 @@ int arch_add_memory(int nid, u64 start, u64 size, bool want_memblock)
143144
return -EFAULT;
144145
}
145146

146-
return __add_pages(nid, start_pfn, nr_pages, want_memblock);
147+
return __add_pages(nid, start_pfn, nr_pages, altmap, want_memblock);
147148
}
148149

149150
#ifdef CONFIG_MEMORY_HOTREMOVE
150-
int arch_remove_memory(u64 start, u64 size)
151+
int arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
151152
{
152153
unsigned long start_pfn = start >> PAGE_SHIFT;
153154
unsigned long nr_pages = size >> PAGE_SHIFT;
154-
struct vmem_altmap *altmap;
155155
struct page *page;
156156
int ret;
157157

@@ -160,11 +160,10 @@ int arch_remove_memory(u64 start, u64 size)
160160
* when querying the zone.
161161
*/
162162
page = pfn_to_page(start_pfn);
163-
altmap = to_vmem_altmap((unsigned long) page);
164163
if (altmap)
165164
page += vmem_altmap_offset(altmap);
166165

167-
ret = __remove_pages(page_zone(page), start_pfn, nr_pages);
166+
ret = __remove_pages(page_zone(page), start_pfn, nr_pages, altmap);
168167
if (ret)
169168
return ret;
170169

‎arch/s390/mm/init.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ device_initcall(s390_cma_mem_init);
222222

223223
#endif /* CONFIG_CMA */
224224

225-
int arch_add_memory(int nid, u64 start, u64 size, bool want_memblock)
225+
int arch_add_memory(int nid, u64 start, u64 size, struct vmem_altmap *altmap,
226+
bool want_memblock)
226227
{
227228
unsigned long start_pfn = PFN_DOWN(start);
228229
unsigned long size_pages = PFN_DOWN(size);
@@ -232,14 +233,14 @@ int arch_add_memory(int nid, u64 start, u64 size, bool want_memblock)
232233
if (rc)
233234
return rc;
234235

235-
rc = __add_pages(nid, start_pfn, size_pages, want_memblock);
236+
rc = __add_pages(nid, start_pfn, size_pages, altmap, want_memblock);
236237
if (rc)
237238
vmem_remove_mapping(start, size);
238239
return rc;
239240
}
240241

241242
#ifdef CONFIG_MEMORY_HOTREMOVE
242-
int arch_remove_memory(u64 start, u64 size)
243+
int arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
243244
{
244245
/*
245246
* There is no hardware or firmware interface which could trigger a

‎arch/s390/mm/vmem.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ static void vmem_remove_range(unsigned long start, unsigned long size)
211211
/*
212212
* Add a backed mem_map array to the virtual mem_map array.
213213
*/
214-
int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
214+
int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
215+
struct vmem_altmap *altmap)
215216
{
216217
unsigned long pgt_prot, sgt_prot;
217218
unsigned long address = start;
@@ -296,7 +297,8 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
296297
return ret;
297298
}
298299

299-
void vmemmap_free(unsigned long start, unsigned long end)
300+
void vmemmap_free(unsigned long start, unsigned long end,
301+
struct vmem_altmap *altmap)
300302
{
301303
}
302304

‎arch/sh/mm/init.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -485,20 +485,20 @@ void free_initrd_mem(unsigned long start, unsigned long end)
485485
#endif
486486

487487
#ifdef CONFIG_MEMORY_HOTPLUG
488-
int arch_add_memory(int nid, u64 start, u64 size, bool want_memblock)
488+
int arch_add_memory(int nid, u64 start, u64 size, struct vmem_altmap *altmap,
489+
bool want_memblock)
489490
{
490491
unsigned long start_pfn = PFN_DOWN(start);
491492
unsigned long nr_pages = size >> PAGE_SHIFT;
492493
int ret;
493494

494495
/* We only have ZONE_NORMAL, so this is easy.. */
495-
ret = __add_pages(nid, start_pfn, nr_pages, want_memblock);
496+
ret = __add_pages(nid, start_pfn, nr_pages, altmap, want_memblock);
496497
if (unlikely(ret))
497498
printk("%s: Failed, __add_pages() == %d\n", __func__, ret);
498499

499500
return ret;
500501
}
501-
EXPORT_SYMBOL_GPL(arch_add_memory);
502502

503503
#ifdef CONFIG_NUMA
504504
int memory_add_physaddr_to_nid(u64 addr)
@@ -510,15 +510,15 @@ EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
510510
#endif
511511

512512
#ifdef CONFIG_MEMORY_HOTREMOVE
513-
int arch_remove_memory(u64 start, u64 size)
513+
int arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
514514
{
515515
unsigned long start_pfn = PFN_DOWN(start);
516516
unsigned long nr_pages = size >> PAGE_SHIFT;
517517
struct zone *zone;
518518
int ret;
519519

520520
zone = page_zone(pfn_to_page(start_pfn));
521-
ret = __remove_pages(zone, start_pfn, nr_pages);
521+
ret = __remove_pages(zone, start_pfn, nr_pages, altmap);
522522
if (unlikely(ret))
523523
pr_warn("%s: Failed, __remove_pages() == %d\n", __func__,
524524
ret);

‎arch/sparc/mm/init_64.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2628,7 +2628,7 @@ EXPORT_SYMBOL(_PAGE_CACHE);
26282628

26292629
#ifdef CONFIG_SPARSEMEM_VMEMMAP
26302630
int __meminit vmemmap_populate(unsigned long vstart, unsigned long vend,
2631-
int node)
2631+
int node, struct vmem_altmap *altmap)
26322632
{
26332633
unsigned long pte_base;
26342634

@@ -2671,7 +2671,8 @@ int __meminit vmemmap_populate(unsigned long vstart, unsigned long vend,
26712671
return 0;
26722672
}
26732673

2674-
void vmemmap_free(unsigned long start, unsigned long end)
2674+
void vmemmap_free(unsigned long start, unsigned long end,
2675+
struct vmem_altmap *altmap)
26752676
{
26762677
}
26772678
#endif /* CONFIG_SPARSEMEM_VMEMMAP */

‎arch/x86/mm/init_32.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -829,23 +829,24 @@ void __init mem_init(void)
829829
}
830830

831831
#ifdef CONFIG_MEMORY_HOTPLUG
832-
int arch_add_memory(int nid, u64 start, u64 size, bool want_memblock)
832+
int arch_add_memory(int nid, u64 start, u64 size, struct vmem_altmap *altmap,
833+
bool want_memblock)
833834
{
834835
unsigned long start_pfn = start >> PAGE_SHIFT;
835836
unsigned long nr_pages = size >> PAGE_SHIFT;
836837

837-
return __add_pages(nid, start_pfn, nr_pages, want_memblock);
838+
return __add_pages(nid, start_pfn, nr_pages, altmap, want_memblock);
838839
}
839840

840841
#ifdef CONFIG_MEMORY_HOTREMOVE
841-
int arch_remove_memory(u64 start, u64 size)
842+
int arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
842843
{
843844
unsigned long start_pfn = start >> PAGE_SHIFT;
844845
unsigned long nr_pages = size >> PAGE_SHIFT;
845846
struct zone *zone;
846847

847848
zone = page_zone(pfn_to_page(start_pfn));
848-
return __remove_pages(zone, start_pfn, nr_pages);
849+
return __remove_pages(zone, start_pfn, nr_pages, altmap);
849850
}
850851
#endif
851852
#endif

0 commit comments

Comments
 (0)