Skip to contentSkip to conversation

KVM: arm/arm64: Fix check for hugepage size when allocating at Stage 2

PATCH Applied Punit Agrawal 3 participants 3 messages Feb 28, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: arm/arm64: Fix check for hugepage size when allocating at Stage 2

Commit 45ee9d5e97a4 ("KVM: arm/arm64: Check pagesize when allocating a hugepage at Stage 2") lost the check for PMD_SIZE during the backport to 4.9.

Fix this by correcting the condition to detect hugepages during stage 2 allocation.

Fixes 45ee9d5e97a4 ("KVM: arm/arm64: Check pagesize when allocating a hugepage at Stage 2")
Cc Marc Zyngier <[email protected]>
Cc Christoffer Dall <[email protected]>

--
Hi Greg,

This patch fixes a commit in the stable tree that was backported from upstream. I am not sure what the tag convention is for such a commit - so sending as a fix.

Thanks,
Punit

---
 arch/arm/kvm/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kvm/mmu.c +1 -1
index 2a35c1963f6d..7f868d9bb5ed 100644
@@ -1284,7 +1284,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
 		return -EFAULT;
 	}
 
-	if (vma_kernel_pagesize(vma) && !logging_active) {
+	if (vma_kernel_pagesize(vma) == PMD_SIZE && !logging_active) {
 		hugetlb = true;
 		gfn = (fault_ipa & PMD_MASK) >> PAGE_SHIFT;
 	} else {
Signature · 1 line
2.16.1
#1 lore raw
Quoted 12 lines · Punit Agrawal

Commit 45ee9d5e97a4 ("KVM: arm/arm64: Check pagesize when allocating a hugepage at Stage 2") lost the check for PMD_SIZE during the backport to 4.9.

Fix this by correcting the condition to detect hugepages during stage 2 allocation.

Fixes 45ee9d5e97a4 ("KVM: arm/arm64: Check pagesize when allocating a hugepage at Stage 2")
Cc Marc Zyngier <[email protected]>
Cc Christoffer Dall <[email protected]>
Quoted 6 lines

--
Hi Greg,

This patch fixes a commit in the stable tree that was backported from upstream. I am not sure what the tag convention is for such a commit - so sending as a fix.

What you did here was just fine, now queued up, thanks.

greg k-h

maintainer Applied
#2 lore raw

Patch "KVM: arm/arm64: Fix check for hugepage size when allocating at Stage 2" has been added to the 4.9-stable tree

In reply to Punit Agrawal

This is a note to let you know that I've just added the patch titled

KVM: arm/arm64: Fix check for hugepage size when allocating at Stage 2

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
kvm-arm-arm64-fix-check-for-hugepage-size-when-allocating-at-stage-2.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From [email protected] Wed Feb 28 18:44:38 2018

From: Punit Agrawal <[email protected]>
Date: Wed, 28 Feb 2018 16:40:09 +0000
Subject: KVM: arm/arm64: Fix check for hugepage size when allocating at Stage 2
To: [email protected]
Cc: [email protected], Punit Agrawal <[email protected]>, Marc Zyngier <[email protected]>, Christoffer Dall <[email protected]>
Message-ID: <[email protected]>

From: Punit Agrawal <[email protected]>

Commit 45ee9d5e97a4 ("KVM: arm/arm64: Check pagesize when allocating a hugepage at Stage 2") lost the check for PMD_SIZE during the backport to 4.9.

Fix this by correcting the condition to detect hugepages during stage 2 allocation.

Fixes 45ee9d5e97a4 ("KVM: arm/arm64: Check pagesize when allocating a hugepage at Stage 2")
Cc Marc Zyngier <[email protected]>
Cc Christoffer Dall <[email protected]>
---
 arch/arm/kvm/mmu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kvm/mmu.c +1 -1
@@ -1284,7 +1284,7 @@ static int user_mem_abort(struct kvm_vcp
 		return -EFAULT;
 	}
 
-	if (vma_kernel_pagesize(vma) && !logging_active) {
+	if (vma_kernel_pagesize(vma) == PMD_SIZE && !logging_active) {
 		hugetlb = true;
 		gfn = (fault_ipa & PMD_MASK) >> PAGE_SHIFT;
 	} else {

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/kvm-arm-arm64-fix-check-for-hugepage-size-when-allocating-at-stage-2.patch