powerpc/mm: Handle hypervisor pte insert failure in __hash_page_huge
authorAnton Blanchard <anton@samba.org>
Wed, 14 Jul 2010 19:31:48 +0000 (19:31 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 22 Jul 2010 22:44:51 +0000 (08:44 +1000)
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>
arch/powerpc/mm/hugetlbpage-hash64.c

index 199539882f927620d6a435b92241e1f08f9aa4a1..c9acd7910eea3adbcb4fda92c17df27036df699d 100644 (file)
@@ -121,8 +121,15 @@ repeat:
                         }
                }
 
-               if (unlikely(slot == -2))
-                       panic("hash_huge_page: pte_insert failed\n");
+               /*
+                * Hypervisor failure. Restore old pte and return -1
+                * similar to __hash_page_*
+                */
+               if (unlikely(slot == -2)) {
+                       *ptep = __pte(old_pte);
+                       err = -1;
+                       goto out;
+               }
 
                new_pte |= (slot << 12) & (_PAGE_F_SECOND | _PAGE_F_GIX);
        }