From: Pavel Tatashin <hidden> Date: 2017-08-02 20:39:38
Changelog:
v3 - v2
- Rewrote code to zero sturct pages in __init_single_page() as
suggested by Michal Hocko
- Added code to handle issues related to accessing struct page
memory before they are initialized.
v2 - v3
- Addressed David Miller comments about one change per patch:
* Splited changes to platforms into 4 patches
* Made "do not zero vmemmap_buf" as a separate patch
v1 - v2
- Per request, added s390 to deferred "struct page" zeroing
- Collected performance data on x86 which proofs the importance to
keep memset() as prefetch (see below).
SMP machines can benefit from the DEFERRED_STRUCT_PAGE_INIT config option,
which defers initializing struct pages until all cpus have been started so
it can be done in parallel.
However, this feature is sub-optimal, because the deferred page
initialization code expects that the struct pages have already been zeroed,
and the zeroing is done early in boot with a single thread only. Also, we
access that memory and set flags before struct pages are initialized. All
of this is fixed in this patchset.
In this work we do the following:
- Never read access struct page until it was initialized
- Never set any fields in struct pages before they are initialized
- Zero struct page at the beginning of struct page initialization
Performance improvements on x86 machine with 8 nodes:
Intel(R) Xeon(R) CPU E7-8895 v3 @ 2.60GHz
Single threaded struct page init: 7.6s/T improvement
Deferred struct page init: 10.2s/T improvement
Pavel Tatashin (15):
x86/mm: reserve only exiting low pages
x86/mm: setting fields in deferred pages
sparc64/mm: setting fields in deferred pages
mm: discard memblock data later
mm: don't accessed uninitialized struct pages
sparc64: simplify vmemmap_populate
mm: defining memblock_virt_alloc_try_nid_raw
mm: zero struct pages during initialization
sparc64: optimized struct page zeroing
x86/kasan: explicitly zero kasan shadow memory
arm64/kasan: explicitly zero kasan shadow memory
mm: explicitly zero pagetable memory
mm: stop zeroing memory during allocation in vmemmap
mm: optimize early system hash allocations
mm: debug for raw alloctor
arch/arm64/mm/kasan_init.c | 32 ++++++++
arch/sparc/include/asm/pgtable_64.h | 18 +++++
arch/sparc/mm/init_64.c | 31 +++-----
arch/x86/kernel/setup.c | 5 +-
arch/x86/mm/init_64.c | 9 ++-
arch/x86/mm/kasan_init_64.c | 29 +++++++
include/linux/bootmem.h | 11 +++
include/linux/memblock.h | 10 ++-
include/linux/mm.h | 9 +++
mm/memblock.c | 152 ++++++++++++++++++++++++++++--------
mm/nobootmem.c | 16 ----
mm/page_alloc.c | 29 ++++---
mm/sparse-vmemmap.c | 10 ++-
mm/sparse.c | 6 +-
14 files changed, 279 insertions(+), 88 deletions(-)
--
2.13.3
From: Pavel Tatashin <hidden> Date: 2017-08-02 20:39:34
Remove duplicating code by using common functions
vmemmap_pud_populate and vmemmap_pgd_populate.
Signed-off-by: Pavel Tatashin <redacted>
Reviewed-by: Steven Sistare <redacted>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: Bob Picco <redacted>
---
arch/sparc/mm/init_64.c | 23 ++++++-----------------
1 file changed, 6 insertions(+), 17 deletions(-)
@@ -2567,30 +2567,19 @@ int __meminit vmemmap_populate(unsigned long vstart, unsigned long vend,vstart=vstart&PMD_MASK;vend=ALIGN(vend,PMD_SIZE);for(;vstart<vend;vstart+=PMD_SIZE){-pgd_t*pgd=pgd_offset_k(vstart);+pgd_t*pgd=vmemmap_pgd_populate(vstart,node);unsignedlongpte;pud_t*pud;pmd_t*pmd;-if(pgd_none(*pgd)){-pud_t*new=vmemmap_alloc_block(PAGE_SIZE,node);+if(!pgd)+return-ENOMEM;-if(!new)-return-ENOMEM;-pgd_populate(&init_mm,pgd,new);-}--pud=pud_offset(pgd,vstart);-if(pud_none(*pud)){-pmd_t*new=vmemmap_alloc_block(PAGE_SIZE,node);--if(!new)-return-ENOMEM;-pud_populate(&init_mm,pud,new);-}+pud=vmemmap_pud_populate(pgd,vstart,node);+if(!pud)+return-ENOMEM;pmd=pmd_offset(pud,vstart);-pte=pmd_val(*pmd);if(!(pte&_PAGE_VALID)){void*block=vmemmap_alloc_block(PMD_SIZE,node);
From: Pavel Tatashin <hidden> Date: 2017-08-02 20:39:35
Without deferred struct page feature (CONFIG_DEFERRED_STRUCT_PAGE_INIT),
flags and other fields in "struct page"es are never changed prior to first
initializing struct pages by going through __init_single_page().
With deferred struct page feature enabled there is a case where we set some
fields prior to initializing:
mem_init() {
register_page_bootmem_info();
free_all_bootmem();
...
}
When register_page_bootmem_info() is called only non-deferred struct pages
are initialized. But, this function goes through some reserved pages which
might be part of the deferred, and thus are not yet initialized.
mem_init
register_page_bootmem_info
register_page_bootmem_info_node
get_page_bootmem
.. setting fields here ..
such as: page->freelist = (void *)type;
We end-up with similar issue as in the previous patch, where currently we
do not observe problem as memory is zeroed. But, if flag asserts are
changed we can start hitting issues.
Also, because in this patch series we will stop zeroing struct page memory
during allocation, we must make sure that struct pages are properly
initialized prior to using them.
The deferred-reserved pages are initialized in free_all_bootmem().
Therefore, the fix is to switch the above calls.
Signed-off-by: Pavel Tatashin <redacted>
Reviewed-by: Steven Sistare <redacted>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: Bob Picco <redacted>
---
arch/sparc/mm/init_64.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
@@ -2464,9 +2464,15 @@ void __init mem_init(void){high_memory=__va(last_valid_pfn<<PAGE_SHIFT);-register_page_bootmem_info();free_all_bootmem();+/* Must be done after boot memory is put on freelist, because here we+*mightsetfieldsindeferredstructpagesthathavenotyetbeen+*initialized,andfree_all_bootmem()initializesallthereserved+*deferredpagesforus.+*/+register_page_bootmem_info();+/**Setupthezeropage,markitreserved,sothatpagecount*isnotmanipulatedwhenfreeingthepagefromuserptes.
From: Pavel Tatashin <hidden> Date: 2017-08-02 20:39:46
Replace allocators in sprase-vmemmap to use the non-zeroing version. So,
we will get the performance improvement by zeroing the memory in parallel
when struct pages are zeroed.
Signed-off-by: Pavel Tatashin <redacted>
Reviewed-by: Steven Sistare <redacted>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: Bob Picco <redacted>
---
mm/sparse-vmemmap.c | 6 +++---
mm/sparse.c | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
From: Pavel Tatashin <hidden> Date: 2017-08-02 20:39:50
Clients can call alloc_large_system_hash() with flag: HASH_ZERO to specify
that memory that was allocated for system hash needs to be zeroed,
otherwise the memory does not need to be zeroed, and client will initialize
it.
If memory does not need to be zero'd, call the new
memblock_virt_alloc_raw() interface, and thus improve the boot performance.
Signed-off-by: Pavel Tatashin <redacted>
Reviewed-by: Steven Sistare <redacted>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: Bob Picco <redacted>
---
mm/page_alloc.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
From: Pavel Tatashin <hidden> Date: 2017-08-02 20:39:57
Add struct page zeroing as a part of initialization of other fields in
__init_single_page().
Signed-off-by: Pavel Tatashin <redacted>
Reviewed-by: Steven Sistare <redacted>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: Bob Picco <redacted>
---
include/linux/mm.h | 9 +++++++++
mm/page_alloc.c | 1 +
2 files changed, 10 insertions(+)
From: Pavel Tatashin <hidden> Date: 2017-08-02 20:39:59
There is existing use after free bug when deferred struct pages are
enabled:
The memblock_add() allocates memory for the memory array if more than
128 entries are needed. See comment in e820__memblock_setup():
* The bootstrap memblock region count maximum is 128 entries
* (INIT_MEMBLOCK_REGIONS), but EFI might pass us more E820 entries
* than that - so allow memblock resizing.
This memblock memory is freed here:
free_low_memory_core_early()
We access the freed memblock.memory later in boot when deferred pages are
initialized in this path:
deferred_init_memmap()
for_each_mem_pfn_range()
__next_mem_pfn_range()
type = &memblock.memory;
One possible explanation for why this use-after-free hasn't been hit
before is that the limit of INIT_MEMBLOCK_REGIONS has never been exceeded
at least on systems where deferred struct pages were enabled.
Another reason why we want this problem fixed in this patch series is,
in the next patch, we will need to access memblock.reserved from
deferred_init_memmap().
Signed-off-by: Pavel Tatashin <redacted>
Reviewed-by: Steven Sistare <redacted>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: Bob Picco <redacted>
---
include/linux/memblock.h | 7 +++++--
mm/memblock.c | 38 +++++++++++++++++---------------------
mm/nobootmem.c | 16 ----------------
mm/page_alloc.c | 2 ++
4 files changed, 24 insertions(+), 39 deletions(-)
@@ -146,22 +146,6 @@ static unsigned long __init free_low_memory_core_early(void)NULL)count+=__free_memory_core(start,end);-#ifdef CONFIG_ARCH_DISCARD_MEMBLOCK-{-phys_addr_tsize;--/* Free memblock.reserved array if it was allocated */-size=get_allocated_memblock_reserved_regions_info(&start);-if(size)-count+=__free_memory_core(start,start+size);--/* Free memblock.memory array if it was allocated */-size=get_allocated_memblock_memory_regions_info(&start);-if(size)-count+=__free_memory_core(start,start+size);-}-#endif-returncount;}
@@ -1584,6 +1584,8 @@ void __init page_alloc_init_late(void)/* Reinit limits that are based on free pages after the kernel is up */files_maxfiles_init();#endif+/* Discard memblock private memory */+memblock_discard();for_each_populated_zone(zone)set_zone_contiguous(zone);
From: Pavel Tatashin <hidden> Date: 2017-08-02 20:40:05
A new variant of memblock_virt_alloc_* allocations:
memblock_virt_alloc_try_nid_raw()
- Does not zero the allocated memory
- Does not panic if request cannot be satisfied
Signed-off-by: Pavel Tatashin <redacted>
Reviewed-by: Steven Sistare <redacted>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: Bob Picco <redacted>
---
include/linux/bootmem.h | 11 ++++++++++
mm/memblock.c | 53 ++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 57 insertions(+), 7 deletions(-)
@@ -160,6 +160,9 @@ extern void *__alloc_bootmem_low_node(pg_data_t *pgdat,#define BOOTMEM_ALLOC_ANYWHERE (~(phys_addr_t)0)/* FIXME: Move to memblock.h at a point where we remove nobootmem.c */+void*memblock_virt_alloc_try_nid_raw(phys_addr_tsize,phys_addr_talign,+phys_addr_tmin_addr,+phys_addr_tmax_addr,intnid);void*memblock_virt_alloc_try_nid_nopanic(phys_addr_tsize,phys_addr_talign,phys_addr_tmin_addr,phys_addr_tmax_addr,intnid);
From: Pavel Tatashin <hidden> Date: 2017-08-02 20:40:17
Soon vmemmap_alloc_block() will no longer zero the block, so zero memory
at its call sites for everything except struct pages. Struct page memory
is zero'd by struct page initialization.
Signed-off-by: Pavel Tatashin <redacted>
Reviewed-by: Steven Sistare <redacted>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: Bob Picco <redacted>
---
mm/sparse-vmemmap.c | 4 ++++
1 file changed, 4 insertions(+)
From: Pavel Tatashin <hidden> Date: 2017-08-02 20:41:01
When CONFIG_DEBUG_VM is enabled, this patch sets all the memory that is
returned by memblock_virt_alloc_try_nid_raw() to ones to ensure that no
places excpect zeroed memory.
Signed-off-by: Pavel Tatashin <redacted>
Reviewed-by: Steven Sistare <redacted>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: Bob Picco <redacted>
---
mm/memblock.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
From: Pavel Tatashin <hidden> Date: 2017-08-02 20:41:30
To optimize the performance of struct page initialization,
vmemmap_populate() will no longer zero memory.
We must explicitly zero the memory that is allocated by vmemmap_populate()
for kasan, as this memory does not go through struct page initialization
path.
Signed-off-by: Pavel Tatashin <redacted>
Reviewed-by: Steven Sistare <redacted>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: Bob Picco <redacted>
---
arch/arm64/mm/kasan_init.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
@@ -135,6 +135,31 @@ static void __init clear_pgds(unsigned long start,set_pgd(pgd_offset_k(start),__pgd(0));}+/*+*Memorythatwasallocatedbyvmemmap_populateisnotzeroed,sowemust+*zeroithereexplicitly.+*/+staticvoid+zero_vemmap_populated_memory(void)+{+structmemblock_region*reg;+u64start,end;++for_each_memblock(memory,reg){+start=__phys_to_virt(reg->base);+end=__phys_to_virt(reg->base+reg->size);++if(start>=end)+break;++memset((void*)start,0,end-start);+}++start=(u64)kasan_mem_to_shadow(_stext);+end=(u64)kasan_mem_to_shadow(_end);+memset((void*)start,0,end-start);+}+void__initkasan_init(void){u64kimg_shadow_start,kimg_shadow_end;
@@ -205,6 +230,13 @@ void __init kasan_init(void)pfn_pte(sym_to_pfn(kasan_zero_page),PAGE_KERNEL_RO));memset(kasan_zero_page,0,PAGE_SIZE);++/*+*vmemmap_populatedoesnotzerothememory,soweneedtozeroit+*explicitly+*/+zero_vemmap_populated_memory();+cpu_replace_ttbr1(lm_alias(swapper_pg_dir));/* At this point kasan is fully initialized. Enable error messages */
From: Pavel Tatashin <hidden> Date: 2017-08-02 20:42:02
In deferred_init_memmap() where all deferred struct pages are initialized
we have a check like this:
if (page->flags) {
VM_BUG_ON(page_zone(page) != zone);
goto free_range;
}
This way we are checking if the current deferred page has already been
initialized. It works, because memory for struct pages has been zeroed, and
the only way flags are not zero if it went through __init_single_page()
before. But, once we change the current behavior and won't zero the memory
in memblock allocator, we cannot trust anything inside "struct page"es
until they are initialized. This patch fixes this.
This patch defines a new accessor memblock_get_reserved_pfn_range()
which returns successive ranges of reserved PFNs. deferred_init_memmap()
calls it to determine if a PFN and its struct page has already been
initialized.
Signed-off-by: Pavel Tatashin <redacted>
Reviewed-by: Steven Sistare <redacted>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: Bob Picco <redacted>
---
include/linux/memblock.h | 3 +++
mm/memblock.c | 54 ++++++++++++++++++++++++++++++++++++++++++------
mm/page_alloc.c | 11 +++++++++-
3 files changed, 61 insertions(+), 7 deletions(-)
@@ -1622,7 +1632,7 @@ int __init_memblock memblock_search_pfn_nid(unsigned long pfn,unsignedlong*start_pfn,unsignedlong*end_pfn){structmemblock_type*type=&memblock.memory;-intmid=memblock_search(type,PFN_PHYS(pfn));+intmid=memblock_search(type,PFN_PHYS(pfn),NULL);if(mid==-1)return-1;
@@ -1646,7 +1656,7 @@ int __init_memblock memblock_search_pfn_nid(unsigned long pfn,*/int__init_memblockmemblock_is_region_memory(phys_addr_tbase,phys_addr_tsize){-intidx=memblock_search(&memblock.memory,base);+intidx=memblock_search(&memblock.memory,base,NULL);phys_addr_tend=base+memblock_cap_size(base,&size);if(idx==-1)
@@ -1656,6 +1666,38 @@ int __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size}/**+*memblock_get_reserved_pfn_range-searchforthenextreservedregion+*+*@pfn:startsearchingfromthispfn.+*+*RETURNS:+*[start_pfn,end_pfn),wherestart_pfn>=pfn.Ifnoneisfound+*start_pfn,andend_pfnarebothsettoULONG_MAX.+*/+void__init_memblockmemblock_get_reserved_pfn_range(unsignedlongpfn,+unsignedlong*start_pfn,+unsignedlong*end_pfn)+{+structmemblock_type*type=&memblock.reserved;+intnext_idx,idx;++idx=memblock_search(type,PFN_PHYS(pfn),&next_idx);+if(idx==-1&&next_idx==-1){+*start_pfn=ULONG_MAX;+*end_pfn=ULONG_MAX;+return;+}++if(idx==-1){+idx=next_idx;+*start_pfn=PFN_DOWN(type->regions[idx].base);+}else{+*start_pfn=pfn;+}+*end_pfn=PFN_DOWN(type->regions[idx].base+type->regions[idx].size);+}++/***memblock_is_region_reserved-checkifaregionintersectsreservedmemory*@base:baseofregiontocheck*@size:sizeofregiontocheck
From: Pavel Tatashin <hidden> Date: 2017-08-02 20:42:04
Without deferred struct page feature (CONFIG_DEFERRED_STRUCT_PAGE_INIT),
flags and other fields in "struct page"es are never changed prior to first
initializing struct pages by going through __init_single_page().
With deferred struct page feature enabled there is a case where we set some
fields prior to initializing:
mem_init() {
register_page_bootmem_info();
free_all_bootmem();
...
}
When register_page_bootmem_info() is called only non-deferred struct pages
are initialized. But, this function goes through some reserved pages which
might be part of the deferred, and thus are not yet initialized.
mem_init
register_page_bootmem_info
register_page_bootmem_info_node
get_page_bootmem
.. setting fields here ..
such as: page->freelist = (void *)type;
We end-up with similar issue as in the previous patch, where currently we
do not observe problem as memory is zeroed. But, if flag asserts are
changed we can start hitting issues.
Also, because in this patch series we will stop zeroing struct page memory
during allocation, we must make sure that struct pages are properly
initialized prior to using them.
The deferred-reserved pages are initialized in free_all_bootmem().
Therefore, the fix is to switch the above calls.
Signed-off-by: Pavel Tatashin <redacted>
Reviewed-by: Steven Sistare <redacted>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: Bob Picco <redacted>
---
arch/x86/mm/init_64.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
@@ -1165,12 +1165,17 @@ void __init mem_init(void)/* clear_bss() already clear the empty_zero_page */-register_page_bootmem_info();-/* this will put all memory onto the freelists */free_all_bootmem();after_bootmem=1;+/* Must be done after boot memory is put on freelist, because here we+*mightsetfieldsindeferredstructpagesthathavenotyetbeen+*initialized,andfree_all_bootmem()initializesallthereserved+*deferredpagesforus.+*/+register_page_bootmem_info();+/* Register memory areas for /proc/kcore */kclist_add(&kcore_vsyscall,(void*)VSYSCALL_ADDR,PAGE_SIZE,KCORE_OTHER);
From: Pavel Tatashin <hidden> Date: 2017-08-02 20:42:06
To optimize the performance of struct page initialization,
vmemmap_populate() will no longer zero memory.
We must explicitly zero the memory that is allocated by vmemmap_populate()
for kasan, as this memory does not go through struct page initialization
path.
Signed-off-by: Pavel Tatashin <redacted>
Reviewed-by: Steven Sistare <redacted>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: Bob Picco <redacted>
---
arch/x86/mm/kasan_init_64.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
@@ -156,6 +178,13 @@ void __init kasan_init(void)pte_tpte=__pte(__pa(kasan_zero_page)|__PAGE_KERNEL_RO);set_pte(&kasan_zero_pte[i],pte);}++/*+*vmemmap_populatedoesnotzerothememory,soweneedtozeroit+*explicitly+*/+zero_vemmap_populated_memory();+/* Flush TLBs again to be sure that write protection applied. */__flush_tlb_all();
From: Pavel Tatashin <hidden> Date: 2017-08-02 20:42:58
Add an optimized mm_zero_struct_page(), so struct page's are zeroed without
calling memset(). We do eight regular stores, thus avoid cost of membar.
Signed-off-by: Pavel Tatashin <redacted>
Reviewed-by: Steven Sistare <redacted>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: Bob Picco <redacted>
---
arch/sparc/include/asm/pgtable_64.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
@@ -230,6 +230,24 @@ extern unsigned long _PAGE_ALL_SZ_BITS;externstructpage*mem_map_zero;#define ZERO_PAGE(vaddr) (mem_map_zero)+/* This macro must be updated when the size of struct page changes,+*sousestaticasserttoenforcetheassumedsize.+*/+#define mm_zero_struct_page(pp) \+do{\+unsignedlong*_pp=(void*)(pp);\+\+BUILD_BUG_ON(sizeof(structpage)!=64);\+_pp[0]=0;\+_pp[1]=0;\+_pp[2]=0;\+_pp[3]=0;\+_pp[4]=0;\+_pp[5]=0;\+_pp[6]=0;\+_pp[7]=0;\+}while(0)+/* PFNs are real physical page numbers. However, mem_map only begins to record*per-pageinformationstartingatpfn_base.Thisistohandlesystemswhere*thefirstphysicalpageinthemachineisatsomehugephysicaladdress,
From: Pavel Tatashin <hidden> Date: 2017-08-02 20:43:15
Struct pages are initialized by going through __init_single_page(). Since
the existing physical memory in memblock is represented in memblock.memory
list, struct page for every page from this list goes through
__init_single_page().
The second memblock list: memblock.reserved, manages the allocated memory.
The memory that won't be available to kernel allocator. So, every page from
this list goes through reserve_bootmem_region(), where certain struct page
fields are set, the assumption being that the struct pages have been
initialized beforehand.
In trim_low_memory_range() we unconditionally reserve memoryfrom PFN 0, but
memblock.memory might start at a later PFN. For example, in QEMU,
e820__memblock_setup() can use PFN 1 as the first PFN in memblock.memory,
so PFN 0 is not on memblock.memory (and hence isn't initialized via
__init_single_page) but is on memblock.reserved (and hence we set fields in
the uninitialized struct page).
Currently, the struct page memory is always zeroed during allocation,
which prevents this problem from being detected. But, if some asserts
provided by CONFIG_DEBUG_VM_PGFLAGS are tighten, this problem may become
visible in existing kernels.
In this patchset we will stop zeroing struct page memory during allocation.
Therefore, this bug must be fixed in order to avoid random assert failures
caused by CONFIG_DEBUG_VM_PGFLAGS triggers.
The fix is to reserve memory from the first existing PFN.
Signed-off-by: Pavel Tatashin <redacted>
Reviewed-by: Steven Sistare <redacted>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: Bob Picco <redacted>
---
arch/x86/kernel/setup.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
From: kbuild test robot <hidden> Date: 2017-08-03 04:30:32
Hi Pavel,
[auto build test ERROR on mmotm/master]
[also build test ERROR on v4.13-rc3]
[cannot apply to next-20170802]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Pavel-Tatashin/complete-deferred-page-initialization/20170803-081025
base: git://git.cmpxchg.org/linux-mmotm.git master
config: mips-allmodconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips
All error/warnings (new ones prefixed by >>):
mm/page_alloc.c: In function 'alloc_large_system_hash':
quoted
mm/page_alloc.c:7369:13: error: implicit declaration of function 'memblock_virt_alloc_raw' [-Werror=implicit-function-declaration]
From: kbuild test robot <hidden> Date: 2017-08-03 04:30:33
Hi Pavel,
[auto build test ERROR on mmotm/master]
[also build test ERROR on v4.13-rc3 next-20170802]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Pavel-Tatashin/complete-deferred-page-initialization/20170803-081025
base: git://git.cmpxchg.org/linux-mmotm.git master
config: tile-allmodconfig (attached as .config)
compiler: tilegx-linux-gcc (GCC) 4.6.2
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=tile
All errors (new ones prefixed by >>):
mm/page_alloc.c: In function 'page_alloc_init_late':
quoted
mm/page_alloc.c:1588:2: error: implicit declaration of function 'memblock_discard'
cc1: some warnings being treated as errors
vim +/memblock_discard +1588 mm/page_alloc.c
1567
1568 void __init page_alloc_init_late(void)
1569 {
1570 struct zone *zone;
1571
1572 #ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT
1573 int nid;
1574
1575 /* There will be num_node_state(N_MEMORY) threads */
1576 atomic_set(&pgdat_init_n_undone, num_node_state(N_MEMORY));
1577 for_each_node_state(nid, N_MEMORY) {
1578 kthread_run(deferred_init_memmap, NODE_DATA(nid), "pgdatinit%d", nid);
1579 }
1580
1581 /* Block until all are initialised */
1582 wait_for_completion(&pgdat_init_all_done_comp);
1583
1584 /* Reinit limits that are based on free pages after the kernel is up */
1585 files_maxfiles_init();
1586 #endif
1587 /* Discard memblock private memory */
1588 memblock_discard();
1589
1590 for_each_populated_zone(zone)
1591 set_zone_contiguous(zone);
1592 }
1593
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
From: kbuild test robot <hidden> Date: 2017-08-03 04:46:31
Hi Pavel,
[auto build test ERROR on mmotm/master]
[also build test ERROR on v4.13-rc3]
[cannot apply to next-20170802]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Pavel-Tatashin/complete-deferred-page-initialization/20170803-081025
base: git://git.cmpxchg.org/linux-mmotm.git master
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sh
All error/warnings (new ones prefixed by >>):
mm/sparse.c: In function 'sparse_mem_maps_populate_node':
quoted
mm/sparse.c:444:8: error: implicit declaration of function 'memblock_virt_alloc_try_nid_raw' [-Werror=implicit-function-declaration]
From: kbuild test robot <hidden> Date: 2017-08-03 05:15:33
Hi Pavel,
[auto build test ERROR on mmotm/master]
[also build test ERROR on v4.13-rc3 next-20170802]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Pavel-Tatashin/complete-deferred-page-initialization/20170803-081025
base: git://git.cmpxchg.org/linux-mmotm.git master
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64
All error/warnings (new ones prefixed by >>):
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from mm/page_alloc.c:17:
mm/page_alloc.c: In function '__init_single_page':
quoted
include/linux/compiler.h:542:38: error: call to '__compiletime_assert_1171' declared with attribute error: BUILD_BUG_ON failed: sizeof(struct page) != 64
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:525:4: note: in definition of macro '__compiletime_assert'
prefix ## suffix(); \
^~~~~~
include/linux/compiler.h:542:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:46:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:70:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^~~~~~~~~~~~~~~~
quoted
arch/sparc/include/asm/pgtable_64.h:240:3: note: in expansion of macro 'BUILD_BUG_ON'
mm/page_alloc.c:1171:2: note: in expansion of macro 'mm_zero_struct_page'
mm_zero_struct_page(page);
^~~~~~~~~~~~~~~~~~~
vim +/__compiletime_assert_1171 +542 include/linux/compiler.h
c361d3e5 Daniel Santos 2013-02-21 519
9a8ab1c3 Daniel Santos 2013-02-21 520 #define __compiletime_assert(condition, msg, prefix, suffix) \
9a8ab1c3 Daniel Santos 2013-02-21 521 do { \
9a8ab1c3 Daniel Santos 2013-02-21 522 bool __cond = !(condition); \
9a8ab1c3 Daniel Santos 2013-02-21 523 extern void prefix ## suffix(void) __compiletime_error(msg); \
9a8ab1c3 Daniel Santos 2013-02-21 524 if (__cond) \
9a8ab1c3 Daniel Santos 2013-02-21 525 prefix ## suffix(); \
9a8ab1c3 Daniel Santos 2013-02-21 526 __compiletime_error_fallback(__cond); \
9a8ab1c3 Daniel Santos 2013-02-21 527 } while (0)
9a8ab1c3 Daniel Santos 2013-02-21 528
9a8ab1c3 Daniel Santos 2013-02-21 529 #define _compiletime_assert(condition, msg, prefix, suffix) \
9a8ab1c3 Daniel Santos 2013-02-21 530 __compiletime_assert(condition, msg, prefix, suffix)
9a8ab1c3 Daniel Santos 2013-02-21 531
9a8ab1c3 Daniel Santos 2013-02-21 532 /**
9a8ab1c3 Daniel Santos 2013-02-21 533 * compiletime_assert - break build and emit msg if condition is false
9a8ab1c3 Daniel Santos 2013-02-21 534 * @condition: a compile-time constant condition to check
9a8ab1c3 Daniel Santos 2013-02-21 535 * @msg: a message to emit if condition is false
9a8ab1c3 Daniel Santos 2013-02-21 536 *
9a8ab1c3 Daniel Santos 2013-02-21 537 * In tradition of POSIX assert, this macro will break the build if the
9a8ab1c3 Daniel Santos 2013-02-21 538 * supplied condition is *false*, emitting the supplied error message if the
9a8ab1c3 Daniel Santos 2013-02-21 539 * compiler has support to do so.
9a8ab1c3 Daniel Santos 2013-02-21 540 */
9a8ab1c3 Daniel Santos 2013-02-21 541 #define compiletime_assert(condition, msg) \
9a8ab1c3 Daniel Santos 2013-02-21 @542 _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
9a8ab1c3 Daniel Santos 2013-02-21 543
:::::: The code at line 542 was first introduced by commit
:::::: 9a8ab1c39970a4938a72d94e6fd13be88a797590 bug.h, compiler.h: introduce compiletime_assert & BUILD_BUG_ON_MSG
:::::: TO: Daniel Santos [off-list ref]
:::::: CC: Linus Torvalds [off-list ref]
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation