From patchwork Sat Mar 2 03:35:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zenghui Yu X-Patchwork-Id: 10836367 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 4C51C922 for ; Sat, 2 Mar 2019 03:39:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29E0D2CD04 for ; Sat, 2 Mar 2019 03:39:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 166852CD17; Sat, 2 Mar 2019 03:39:13 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 B23232CD04 for ; Sat, 2 Mar 2019 03:39:12 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=IQgv0xFaUVEQbmIYj0fYqV0MnOHLbzgsw1edBCCXpng=; b=Vi2hvwN4F5MaS5 EgVksL0v9A8RKyXcC1W9tYNtfZIe8bv7ioUqSTv0lm0//OXxF4gRo9pWKuGRGIB4KHt4IN1oBHyLO p50R4gvEOImQuBBhriGAZzbWRIOkVLmubeh8o35MEHNcYhwSCj6uzVRbpPZZdfCsOvEJUJjZG98+f u/b6kKTlI1pEMLYgKipQb8HPh/iheT7ogf4J9Pmz/vnGqmTgFDjc8+33rK4hsGzjGc0dyDifnb2c2 NMNjaW76zq/qpGca7y0ni/01rkkG8H1dFBLIJjnZ/mw8W8RprBlgpFM939Fcni5++JAYx6iGIF9Pd 9gsS/hfsiryjagCwvsMA==; 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 1gzvUP-00012h-8j; Sat, 02 Mar 2019 03:39:05 +0000 Received: from szxga07-in.huawei.com ([45.249.212.35] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzvUL-00011X-F1 for linux-arm-kernel@lists.infradead.org; Sat, 02 Mar 2019 03:39:03 +0000 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id A4143D35FE599429F0AD; Sat, 2 Mar 2019 11:38:54 +0800 (CST) Received: from HGHY2Y004646261.china.huawei.com (10.184.12.158) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.408.0; Sat, 2 Mar 2019 11:38:48 +0800 From: Zenghui Yu To: , Subject: [RFC PATCH] KVM: arm64: Force a PTE mapping when logging is enabled Date: Sat, 2 Mar 2019 03:35:28 +0000 Message-ID: <1551497728-12576-1-git-send-email-yuzenghui@huawei.com> X-Mailer: git-send-email 2.6.4.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.184.12.158] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190301_193901_666899_195D346F X-CRM114-Status: GOOD ( 10.21 ) 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: Punit Agrawal , suzuki.poulose@arm.com, julien.thierry@arm.com, linux-kernel@vger.kernel.org, james.morse@arm.com, Zenghui Yu , wanghaibin.wang@huawei.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org 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 The idea behind this is: we don't want to keep tracking of huge pages when logging_active is true, which will result in performance degradation. We still need to set vma_pagesize to PAGE_SIZE, so that we can make use of it to force a PTE mapping. Cc: Suzuki K Poulose Cc: Punit Agrawal Signed-off-by: Zenghui Yu --- Atfer looking into https://patchwork.codeaurora.org/patch/647985/ , the "vma_pagesize = PAGE_SIZE" logic was not intended to be deleted. As far as I can tell, we used to have "hugetlb" to force the PTE mapping, but we have "vma_pagesize" currently instead. We should set it properly for performance reasons (e.g, in VM migration). Did I miss something important? --- virt/kvm/arm/mmu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c index 30251e2..7d41b16 100644 --- a/virt/kvm/arm/mmu.c +++ b/virt/kvm/arm/mmu.c @@ -1705,6 +1705,13 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, (vma_pagesize == PUD_SIZE && kvm_stage2_has_pmd(kvm))) && !force_pte) { gfn = (fault_ipa & huge_page_mask(hstate_vma(vma))) >> PAGE_SHIFT; + } else { + /* + * Fallback to PTE if it's not one of the stage2 + * supported hugepage sizes or the corresponding level + * doesn't exist, or logging is enabled. + */ + vma_pagesize = PAGE_SIZE; } up_read(¤t->mm->mmap_sem);