mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	kvmarm@lists.cs.columbia.edu, julien.thierry@arm.com,
	christoffer.dall@arm.com, marc.zyngier@arm.com,
	andrew.murray@arm.com, eric.auger@redhat.com,
	zhengxiang9@huawei.com, yuzenghui@huawei.com,
	wanghaibin.wang@huawei.com,
	Suzuki K Poulose <suzuki.poulose@arm.com>
Subject: [PATCH 1/2] kvm: arm: Clean up the checking for huge mapping
Date: Wed, 10 Apr 2019 16:23:51 +0100	[thread overview]
Message-ID: <1554909832-7169-2-git-send-email-suzuki.poulose@arm.com> (raw)
In-Reply-To: <1554909832-7169-1-git-send-email-suzuki.poulose@arm.com>

If we are checking whether the stage2 can map PAGE_SIZE,
we don't have to do the boundary checks as both the host
VMA and the guest memslots are page aligned. Bail the case
easily.

Cc: Christoffer Dall <christoffer.dall@arm.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 virt/kvm/arm/mmu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c
index a39dcfd..6d73322 100644
--- a/virt/kvm/arm/mmu.c
+++ b/virt/kvm/arm/mmu.c
@@ -1624,6 +1624,10 @@ static bool fault_supports_stage2_huge_mapping(struct kvm_memory_slot *memslot,
 	hva_t uaddr_start, uaddr_end;
 	size_t size;
 
+	/* The memslot and the VMA are guaranteed to be aligned to PAGE_SIZE */
+	if (map_size == PAGE_SIZE)
+		return true;
+
 	size = memslot->npages * PAGE_SIZE;
 
 	gpa_start = memslot->base_gfn << PAGE_SHIFT;
-- 
2.7.4


  reply	other threads:[~2019-04-10 15:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10 15:14 [PATCH v2] kvm: arm: Skip stage2 huge mappings for unaligned ipa backed by THP Suzuki K Poulose
2019-04-10 15:23 ` [PATCH 0/2] kvm: arm: Unify stage2 mapping for THP backed memory Suzuki K Poulose
2019-04-10 15:23   ` Suzuki K Poulose [this message]
2019-04-11  1:48     ` [PATCH 1/2] kvm: arm: Clean up the checking for huge mapping Zenghui Yu
2019-04-11  9:47       ` Suzuki K Poulose
2019-04-10 15:23   ` [PATCH 2/2] kvm: arm: Unify handling THP backed host memory Suzuki K Poulose
2019-04-11  1:59     ` Zenghui Yu
2019-04-11 15:16       ` Suzuki K Poulose
2019-04-12  9:34         ` Zenghui Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1554909832-7169-2-git-send-email-suzuki.poulose@arm.com \
    --to=suzuki.poulose@arm.com \
    --cc=andrew.murray@arm.com \
    --cc=christoffer.dall@arm.com \
    --cc=eric.auger@redhat.com \
    --cc=julien.thierry@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=wanghaibin.wang@huawei.com \
    --cc=yuzenghui@huawei.com \
    --cc=zhengxiang9@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®