From patchwork Mon Jun 9 08:49:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 31539 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 34D0421330 for ; Mon, 9 Jun 2014 09:18:13 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id m1sf34966341oag.2 for ; Mon, 09 Jun 2014 02:18:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=6LOsQz4EdOu6lL7YNS4bBQOWjuR2Wce9H9qDMqjXJiI=; b=CbfqFjpAw5B8Nju866V7l04zXGNcdf/J57onmGdRy5Q6wkyYIN5Q9DayejoUqzNK0P xpEDKdssJ4znXm1b+5GVn/WD5ZIHOv9KbQP9ijjjihQUtJkxSJAcYGGY9f6AuxsCageI qcd7X0gFGM8jQ3WQq355ynJtcEJ14hUAT8tiP/38KFz5xCeiLPHTz+6tt8qFWVYHRYOc qVrmlV5IFORkmCKYP+PqmFG9AKC+sJpriaBxyEQrBzTZfRyG3BuItHTHRqZ9gViEbOTo FZo6cMEM+8RCFMDxQHg9SSqKlB0N7HyHrT2yFxHEbkwp/rTf/HY/Pz0nZpHRr9+AOpTs vLtg== X-Gm-Message-State: ALoCoQnba2rsGpsK8I+0Y+d/ACaUG8KUMvCpB59z+pjfJ02oedNrN5hFhXgXn3J0ffnucqeukDED X-Received: by 10.42.123.148 with SMTP id s20mr10513462icr.8.1402305492724; Mon, 09 Jun 2014 02:18:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.83.50 with SMTP id i47ls1552495qgd.38.gmail; Mon, 09 Jun 2014 02:18:12 -0700 (PDT) X-Received: by 10.52.92.5 with SMTP id ci5mr550721vdb.62.1402305492463; Mon, 09 Jun 2014 02:18:12 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id lo19si11630115vdb.15.2014.06.09.02.18.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Jun 2014 02:18:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id hy4so1632182vcb.34 for ; Mon, 09 Jun 2014 02:18:12 -0700 (PDT) X-Received: by 10.221.59.194 with SMTP id wp2mr60351vcb.59.1402305492375; Mon, 09 Jun 2014 02:18:12 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp127691vcb; Mon, 9 Jun 2014 02:18:11 -0700 (PDT) X-Received: by 10.66.251.233 with SMTP id zn9mr3293329pac.67.1402305490954; Mon, 09 Jun 2014 02:18:10 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id nj1si30117981pbc.95.2014.06.09.02.18.10; Mon, 09 Jun 2014 02:18:10 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964812AbaFIJRs (ORCPT + 27 others); Mon, 9 Jun 2014 05:17:48 -0400 Received: from ip4-83-240-18-248.cust.nbox.cz ([83.240.18.248]:58401 "EHLO ip4-83-240-18-248.cust.nbox.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754824AbaFIIvY (ORCPT ); Mon, 9 Jun 2014 04:51:24 -0400 Received: from ku by ip4-83-240-18-248.cust.nbox.cz with local (Exim 4.80.1) (envelope-from ) id 1WtvIY-0007dU-4C; Mon, 09 Jun 2014 10:51:22 +0200 From: Jiri Slaby To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Mark Salter , Catalin Marinas , Jiri Slaby Subject: [PATCH 3.12 031/146] arm64: fix pud_huge() for 2-level pagetables Date: Mon, 9 Jun 2014 10:49:26 +0200 Message-Id: X-Mailer: git-send-email 1.9.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linux-kernel-owner@vger.kernel.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Mark Salter 3.12-stable review patch. If anyone has any objections, please let me know. =============== commit 4797ec2dc83a43be35bad56037d1b53db9e2b5d5 upstream. The following happens when trying to run a kvm guest on a kernel configured for 64k pages. This doesn't happen with 4k pages: BUG: failure at include/linux/mm.h:297/put_page_testzero()! Kernel panic - not syncing: BUG! CPU: 2 PID: 4228 Comm: qemu-system-aar Tainted: GF 3.13.0-0.rc7.31.sa2.k32v1.aarch64.debug #1 Call trace: [] dump_backtrace+0x0/0x16c [] show_stack+0x14/0x1c [] dump_stack+0x84/0xb0 [] panic+0xf4/0x220 [] free_reserved_area+0x0/0x110 [] free_pages+0x50/0x88 [] kvm_free_stage2_pgd+0x30/0x40 [] kvm_arch_destroy_vm+0x18/0x44 [] kvm_put_kvm+0xf0/0x184 [] kvm_vm_release+0x10/0x1c [] __fput+0xb0/0x288 [] ____fput+0xc/0x14 [] task_work_run+0xa8/0x11c [] do_notify_resume+0x54/0x58 In arch/arm/kvm/mmu.c:unmap_range(), we end up doing an extra put_page() on the stage2 pgd which leads to the BUG in put_page_testzero(). This happens because a pud_huge() test in unmap_range() returns true when it should always be false with 2-level pages tables used by 64k pages. This patch removes support for huge puds if 2-level pagetables are being used. Signed-off-by: Mark Salter [catalin.marinas@arm.com: removed #ifndef around PUD_SIZE check] Signed-off-by: Catalin Marinas Signed-off-by: Jiri Slaby --- arch/arm64/mm/hugetlbpage.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c index 5e9aec358306..31eb959e9aa8 100644 --- a/arch/arm64/mm/hugetlbpage.c +++ b/arch/arm64/mm/hugetlbpage.c @@ -51,7 +51,11 @@ int pmd_huge(pmd_t pmd) int pud_huge(pud_t pud) { +#ifndef __PAGETABLE_PMD_FOLDED return !(pud_val(pud) & PUD_TABLE_BIT); +#else + return 0; +#endif } int pmd_huge_support(void)