From patchwork Mon Oct 1 15:54:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Punit Agrawal X-Patchwork-Id: 10622379 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7B27B15A6 for ; Mon, 1 Oct 2018 15:55:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62A69286FD for ; Mon, 1 Oct 2018 15:55:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 566AC28F53; Mon, 1 Oct 2018 15:55:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CFB73286FD for ; Mon, 1 Oct 2018 15:55:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=NbB+41fnDB/IkvfMLNkBcMXR1rPSVPI6CKmq0vxHj3s=; b=nRU WfxPWCTHxslWH7thx++c2glooNVTfLyQfFZWecPo6TqYVRe8Y8BAULeIckEvFiuMNcXjya4xywVfC HEOIdyhSoBSMLQSzZmnUQ0728uXZ4MrKqIvWC0/6TM0a8lFnRWj8m5e1kxhhuwC8lBK9BroCJUni2 vx1mi4ZJNOWw34+WxxxCMzp0R1X4c6LD8PSW4gShO7SQpqoLHymBxgEG7meEO75l2MTM/msr87CsP GlBZEH7Q9NsEME0sCLM4VQ8swDZ5gCEsVPPRUFpW2Lmo/Nl3zuMnxg5z/YvzrgbGdUvSmXCppWqEw gxMszkwYK0kja/PY3cMh9hWMe9nb9aw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g70XJ-00029W-Mn; Mon, 01 Oct 2018 15:55:05 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g70XF-0001z3-Ji for linux-arm-kernel@lists.infradead.org; Mon, 01 Oct 2018 15:55:03 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3AF2B18A; Mon, 1 Oct 2018 08:54:51 -0700 (PDT) Received: from localhost (e105922-lin.emea.arm.com [10.4.13.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AA6883F5D3; Mon, 1 Oct 2018 08:54:50 -0700 (PDT) From: Punit Agrawal To: kvmarm@lists.cs.columbia.edu Subject: [PATCH v8 0/9] KVM: Support PUD hugepage at stage 2 Date: Mon, 1 Oct 2018 16:54:34 +0100 Message-Id: <20181001155443.23032-1-punit.agrawal@arm.com> X-Mailer: git-send-email 2.18.0 X-ARM-No-Footer: FoSSMail X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181001_085501_696625_92B33551 X-CRM114-Status: GOOD ( 16.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: suzuki.poulose@arm.com, marc.zyngier@arm.com, Punit Agrawal , will.deacon@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This series is an update to the PUD hugepage support previously posted at [0]. This patchset adds support for PUD hugepages at stage 2 a feature that is useful on cores that have support for large sized TLB mappings (e.g., 1GB for 4K granule). The only change in this version is to update the kvm_stage2_has_pud() helper for arm to use CONFIG_PGTABLE_LEVELS. The patches are based on v6 of the dynamic IPA support. The patches have been tested on AMD Seattle system with the following hugepage sizes - 64K, 32M, 1G. Thanks, Punit v7 -> v8 * Add kvm_stage2_has_pud() helper on arm32 * Rebased to v6 of 52bit dynamic IPA support v6 -> v7 * Restrict thp check to exclude hugetlbfs pages - Patch 1 * Don't update PUD entry if there's no change - Patch 9 * Add check for PUD level in stage 2 - Patch 9 v5 -> v6 * Split Patch 1 to move out the refactoring of exec permissions on page table entries. * Patch 4 - Initialise p*dpp pointers in stage2_get_leaf_entry() * Patch 5 - Trigger a BUG() in kvm_pud_pfn() on arm v4 -> v5: * Patch 1 - Drop helper stage2_should_exec() and refactor the condition to decide if a page table entry should be marked executable * Patch 4-6 - Introduce stage2_get_leaf_entry() and use it in this and latter patches * Patch 7 - Use stage 2 accessors instead of using the page table helpers directly * Patch 7 - Add a note to update the PUD hugepage support when number of levels of stage 2 tables differs from stage 1 v3 -> v4: * Patch 1 and 7 - Don't put down hugepages pte if logging is enabled * Patch 4-5 - Add PUD hugepage support for exec and access faults * Patch 6 - PUD hugepage support for aging page table entries v2 -> v3: * Update vma_pagesize directly if THP [1/4]. Previsouly this was done indirectly via hugetlb * Added review tag [4/4] v1 -> v2: * Create helper to check if the page should have exec permission [1/4] * Fix broken condition to detect THP hugepage [1/4] * Fix in-correct hunk resulting from a rebase [4/4] [0] https://www.spinics.net/lists/kvm-arm/msg32753.html [1] https://lkml.org/lkml/2018/9/26/936 Punit Agrawal (9): KVM: arm/arm64: Ensure only THP is candidate for adjustment KVM: arm/arm64: Share common code in user_mem_abort() KVM: arm/arm64: Re-factor setting the Stage 2 entry to exec on fault KVM: arm/arm64: Introduce helpers to manipulate page table entries KVM: arm64: Support dirty page tracking for PUD hugepages KVM: arm64: Support PUD hugepage in stage2_is_exec() KVM: arm64: Support handling access faults for PUD hugepages KVM: arm64: Update age handlers to support PUD hugepages KVM: arm64: Add support for creating PUD hugepages at stage 2 arch/arm/include/asm/kvm_mmu.h | 61 +++++ arch/arm/include/asm/stage2_pgtable.h | 9 + arch/arm64/include/asm/kvm_mmu.h | 48 ++++ arch/arm64/include/asm/pgtable-hwdef.h | 4 + arch/arm64/include/asm/pgtable.h | 9 + virt/kvm/arm/mmu.c | 320 +++++++++++++++++++------ 6 files changed, 373 insertions(+), 78 deletions(-)