powerpc/mm: Fix crashes with 16G huge pages
To support memory keys, we moved the hash pte slot information to the
second half of the page table. This was ok with PTE entries at level
4 (PTE page) and level 3 (PMD). We already allocate larger page table
pages at those levels to accomodate extra details. For level 4 we
already have the extra space which was used to track 4k hash page
table entry details and at level 3 the extra space was allocated to
track the THP details.
With hugetlbfs PTE, we used this extra space at the PMD level to store
the slot details. But we also support hugetlbfs PTE at PUD level for
16GB pages and PUD level page didn't allocate extra space. This
resulted in memory corruption.
Fix this by allocating extra space at PUD level when HUGETLB is
enabled.
Fixes: bf9a95f9a6
("powerpc: Free up four 64K PTE bits in 64K backed HPTE pages")
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Reviewed-by: Ram Pai <linuxram@us.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Esse commit está contido em:

commit de
Michael Ellerman

pai
62e984ddfd
commit
fae2211697
@@ -1008,6 +1008,7 @@ void __init hash__early_init_mmu(void)
|
||||
__pmd_index_size = H_PMD_INDEX_SIZE;
|
||||
__pud_index_size = H_PUD_INDEX_SIZE;
|
||||
__pgd_index_size = H_PGD_INDEX_SIZE;
|
||||
__pud_cache_index = H_PUD_CACHE_INDEX;
|
||||
__pmd_cache_index = H_PMD_CACHE_INDEX;
|
||||
__pte_table_size = H_PTE_TABLE_SIZE;
|
||||
__pmd_table_size = H_PMD_TABLE_SIZE;
|
||||
|
@@ -100,6 +100,6 @@ void pgtable_cache_init(void)
|
||||
* same size as either the pgd or pmd index except with THP enabled
|
||||
* on book3s 64
|
||||
*/
|
||||
if (PUD_INDEX_SIZE && !PGT_CACHE(PUD_INDEX_SIZE))
|
||||
pgtable_cache_add(PUD_INDEX_SIZE, pud_ctor);
|
||||
if (PUD_CACHE_INDEX && !PGT_CACHE(PUD_CACHE_INDEX))
|
||||
pgtable_cache_add(PUD_CACHE_INDEX, pud_ctor);
|
||||
}
|
||||
|
@@ -553,6 +553,7 @@ void __init radix__early_init_mmu(void)
|
||||
__pmd_index_size = RADIX_PMD_INDEX_SIZE;
|
||||
__pud_index_size = RADIX_PUD_INDEX_SIZE;
|
||||
__pgd_index_size = RADIX_PGD_INDEX_SIZE;
|
||||
__pud_cache_index = RADIX_PUD_INDEX_SIZE;
|
||||
__pmd_cache_index = RADIX_PMD_INDEX_SIZE;
|
||||
__pte_table_size = RADIX_PTE_TABLE_SIZE;
|
||||
__pmd_table_size = RADIX_PMD_TABLE_SIZE;
|
||||
|
@@ -82,6 +82,8 @@ unsigned long __pgd_index_size;
|
||||
EXPORT_SYMBOL(__pgd_index_size);
|
||||
unsigned long __pmd_cache_index;
|
||||
EXPORT_SYMBOL(__pmd_cache_index);
|
||||
unsigned long __pud_cache_index;
|
||||
EXPORT_SYMBOL(__pud_cache_index);
|
||||
unsigned long __pte_table_size;
|
||||
EXPORT_SYMBOL(__pte_table_size);
|
||||
unsigned long __pmd_table_size;
|
||||
|
Referência em uma nova issue
Block a user