Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/mm: Handle hypervisor pte insert failure in __hash_page_huge

If the hypervisor gives us an error on a hugepage insert we panic. The
normal page code already handles this by returning an error instead and we end
calling low_hash_fault which will just kill the task if possible.

The patch below does a similar thing for the hugepage case.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Anton Blanchard and committed by
Benjamin Herrenschmidt
b1623e7e b37fa16e

+9 -2
+9 -2
arch/powerpc/mm/hugetlbpage-hash64.c
··· 121 121 } 122 122 } 123 123 124 - if (unlikely(slot == -2)) 125 - panic("hash_huge_page: pte_insert failed\n"); 124 + /* 125 + * Hypervisor failure. Restore old pte and return -1 126 + * similar to __hash_page_* 127 + */ 128 + if (unlikely(slot == -2)) { 129 + *ptep = __pte(old_pte); 130 + err = -1; 131 + goto out; 132 + } 126 133 127 134 new_pte |= (slot << 12) & (_PAGE_F_SECOND | _PAGE_F_GIX); 128 135 }