Skip to content

Commit 20fd2ed

Browse files
committed
Merge branch 'for-next/mm' into for-next/core
* for-next/mm: Documentation: vmcoreinfo: Fix htmldocs warning arm64/mm: Drop use_1G_block() arm64: avoid flushing icache multiple times on contiguous HugeTLB arm64: crash_core: Export MODULES, VMALLOC, and VMEMMAP ranges arm64/hugetlb: Define __hugetlb_valid_size() arm64/mm: avoid fixmap race condition when create pud mapping arm64/mm: Consolidate TCR_EL1 fields
2 parents b3ea0ea + 3c3dd2c commit 20fd2ed

8 files changed

Lines changed: 53 additions & 38 deletions

File tree

Documentation/admin-guide/kdump/vmcoreinfo.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,14 @@ architecture which is used to lookup the page-tables for the Virtual
494494
addresses in the higher VA range (refer to ARMv8 ARM document for
495495
more details).
496496

497+
MODULES_VADDR|MODULES_END|VMALLOC_START|VMALLOC_END|VMEMMAP_START|VMEMMAP_END
498+
-----------------------------------------------------------------------------
499+
500+
Used to get the correct ranges:
501+
MODULES_VADDR ~ MODULES_END-1 : Kernel module space.
502+
VMALLOC_START ~ VMALLOC_END-1 : vmalloc() / ioremap() space.
503+
VMEMMAP_START ~ VMEMMAP_END-1 : vmemmap region, used for struct page array.
504+
497505
arm
498506
===
499507

arch/arm64/include/asm/pgtable-hwdef.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@
273273
#define TCR_NFD1 (UL(1) << 54)
274274
#define TCR_E0PD0 (UL(1) << 55)
275275
#define TCR_E0PD1 (UL(1) << 56)
276+
#define TCR_TCMA0 (UL(1) << 57)
277+
#define TCR_TCMA1 (UL(1) << 58)
276278

277279
/*
278280
* TTBR.

arch/arm64/include/asm/sysreg.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,10 +1101,6 @@
11011101
#define CPACR_EL1_ZEN_EL0EN (BIT(17)) /* enable EL0 access, if EL1EN set */
11021102
#define CPACR_EL1_ZEN (CPACR_EL1_ZEN_EL1EN | CPACR_EL1_ZEN_EL0EN)
11031103

1104-
/* TCR EL1 Bit Definitions */
1105-
#define SYS_TCR_EL1_TCMA1 (BIT(58))
1106-
#define SYS_TCR_EL1_TCMA0 (BIT(57))
1107-
11081104
/* GCR_EL1 Definitions */
11091105
#define SYS_GCR_EL1_RRND (BIT(16))
11101106
#define SYS_GCR_EL1_EXCL_MASK 0xffffUL

arch/arm64/kernel/crash_core.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ void arch_crash_save_vmcoreinfo(void)
2020
{
2121
VMCOREINFO_NUMBER(VA_BITS);
2222
/* Please note VMCOREINFO_NUMBER() uses "%d", not "%x" */
23+
vmcoreinfo_append_str("NUMBER(MODULES_VADDR)=0x%lx\n", MODULES_VADDR);
24+
vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END);
25+
vmcoreinfo_append_str("NUMBER(VMALLOC_START)=0x%lx\n", VMALLOC_START);
26+
vmcoreinfo_append_str("NUMBER(VMALLOC_END)=0x%lx\n", VMALLOC_END);
27+
vmcoreinfo_append_str("NUMBER(VMEMMAP_START)=0x%lx\n", VMEMMAP_START);
28+
vmcoreinfo_append_str("NUMBER(VMEMMAP_END)=0x%lx\n", VMEMMAP_END);
2329
vmcoreinfo_append_str("NUMBER(kimage_voffset)=0x%llx\n",
2430
kimage_voffset);
2531
vmcoreinfo_append_str("NUMBER(PHYS_OFFSET)=0x%llx\n",

arch/arm64/mm/flush.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ void __sync_icache_dcache(pte_t pte)
5252
{
5353
struct page *page = pte_page(pte);
5454

55+
/*
56+
* HugeTLB pages are always fully mapped, so only setting head page's
57+
* PG_dcache_clean flag is enough.
58+
*/
59+
if (PageHuge(page))
60+
page = compound_head(page);
61+
5562
if (!test_bit(PG_dcache_clean, &page->flags)) {
5663
sync_icache_aliases((unsigned long)page_address(page),
5764
(unsigned long)page_address(page) +

arch/arm64/mm/hugetlbpage.c

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,34 @@ void __init arm64_hugetlb_cma_reserve(void)
5656
}
5757
#endif /* CONFIG_CMA */
5858

59-
#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
60-
bool arch_hugetlb_migration_supported(struct hstate *h)
59+
static bool __hugetlb_valid_size(unsigned long size)
6160
{
62-
size_t pagesize = huge_page_size(h);
63-
64-
switch (pagesize) {
61+
switch (size) {
6562
#ifndef __PAGETABLE_PMD_FOLDED
6663
case PUD_SIZE:
6764
return pud_sect_supported();
6865
#endif
69-
case PMD_SIZE:
7066
case CONT_PMD_SIZE:
67+
case PMD_SIZE:
7168
case CONT_PTE_SIZE:
7269
return true;
7370
}
74-
pr_warn("%s: unrecognized huge page size 0x%lx\n",
75-
__func__, pagesize);
71+
7672
return false;
7773
}
74+
75+
#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
76+
bool arch_hugetlb_migration_supported(struct hstate *h)
77+
{
78+
size_t pagesize = huge_page_size(h);
79+
80+
if (!__hugetlb_valid_size(pagesize)) {
81+
pr_warn("%s: unrecognized huge page size 0x%lx\n",
82+
__func__, pagesize);
83+
return false;
84+
}
85+
return true;
86+
}
7887
#endif
7988

8089
int pmd_huge(pmd_t pmd)
@@ -506,16 +515,5 @@ arch_initcall(hugetlbpage_init);
506515

507516
bool __init arch_hugetlb_valid_size(unsigned long size)
508517
{
509-
switch (size) {
510-
#ifndef __PAGETABLE_PMD_FOLDED
511-
case PUD_SIZE:
512-
return pud_sect_supported();
513-
#endif
514-
case CONT_PMD_SIZE:
515-
case PMD_SIZE:
516-
case CONT_PTE_SIZE:
517-
return true;
518-
}
519-
520-
return false;
518+
return __hugetlb_valid_size(size);
521519
}

arch/arm64/mm/mmu.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ static pmd_t bm_pmd[PTRS_PER_PMD] __page_aligned_bss __maybe_unused;
6363
static pud_t bm_pud[PTRS_PER_PUD] __page_aligned_bss __maybe_unused;
6464

6565
static DEFINE_SPINLOCK(swapper_pgdir_lock);
66+
static DEFINE_MUTEX(fixmap_lock);
6667

6768
void set_swapper_pgd(pgd_t *pgdp, pgd_t pgd)
6869
{
@@ -294,18 +295,6 @@ static void alloc_init_cont_pmd(pud_t *pudp, unsigned long addr,
294295
} while (addr = next, addr != end);
295296
}
296297

297-
static inline bool use_1G_block(unsigned long addr, unsigned long next,
298-
unsigned long phys)
299-
{
300-
if (PAGE_SHIFT != 12)
301-
return false;
302-
303-
if (((addr | next | phys) & ~PUD_MASK) != 0)
304-
return false;
305-
306-
return true;
307-
}
308-
309298
static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end,
310299
phys_addr_t phys, pgprot_t prot,
311300
phys_addr_t (*pgtable_alloc)(int),
@@ -329,6 +318,12 @@ static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end,
329318
}
330319
BUG_ON(p4d_bad(p4d));
331320

321+
/*
322+
* No need for locking during early boot. And it doesn't work as
323+
* expected with KASLR enabled.
324+
*/
325+
if (system_state != SYSTEM_BOOTING)
326+
mutex_lock(&fixmap_lock);
332327
pudp = pud_set_fixmap_offset(p4dp, addr);
333328
do {
334329
pud_t old_pud = READ_ONCE(*pudp);
@@ -338,7 +333,8 @@ static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end,
338333
/*
339334
* For 4K granule only, attempt to put down a 1GB block
340335
*/
341-
if (use_1G_block(addr, next, phys) &&
336+
if (pud_sect_supported() &&
337+
((addr | next | phys) & ~PUD_MASK) == 0 &&
342338
(flags & NO_BLOCK_MAPPINGS) == 0) {
343339
pud_set_huge(pudp, phys, prot);
344340

@@ -359,6 +355,8 @@ static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end,
359355
} while (pudp++, addr = next, addr != end);
360356

361357
pud_clear_fixmap();
358+
if (system_state != SYSTEM_BOOTING)
359+
mutex_unlock(&fixmap_lock);
362360
}
363361

364362
static void __create_pgd_mapping(pgd_t *pgdir, phys_addr_t phys,

arch/arm64/mm/proc.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#endif
4747

4848
#ifdef CONFIG_KASAN_HW_TAGS
49-
#define TCR_MTE_FLAGS SYS_TCR_EL1_TCMA1 | TCR_TBI1 | TCR_TBID1
49+
#define TCR_MTE_FLAGS TCR_TCMA1 | TCR_TBI1 | TCR_TBID1
5050
#else
5151
/*
5252
* The mte_zero_clear_page_tags() implementation uses DC GZVA, which relies on

0 commit comments

Comments
 (0)