From patchwork Thu Jul 15 05:31:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Blanchard X-Patchwork-Id: 58964 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 3EED2B729B for ; Thu, 15 Jul 2010 15:34:50 +1000 (EST) Received: by ozlabs.org (Postfix) id 56BB3B6F0C; Thu, 15 Jul 2010 15:34:42 +1000 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: by ozlabs.org (Postfix, from userid 1010) id 545A51007D1; Thu, 15 Jul 2010 15:34:42 +1000 (EST) Date: Thu, 15 Jul 2010 15:31:48 +1000 From: Anton Blanchard To: benh@kernel.crashing.org, dwg@au1.ibm.com Subject: [PATCH] powerpc/mm: Handle hypervisor pte insert failure in __hash_page_huge Message-ID: <20100715053148.GD10155@kryten> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Cc: linuxppc-dev@ozlabs.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org 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 Index: powerpc.git/arch/powerpc/mm/hugetlbpage-hash64.c =================================================================== --- powerpc.git.orig/arch/powerpc/mm/hugetlbpage-hash64.c 2010-07-15 15:24:19.520742137 +1000 +++ powerpc.git/arch/powerpc/mm/hugetlbpage-hash64.c 2010-07-15 15:24:30.343243050 +1000 @@ -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); }