summaryrefslogtreecommitdiff
path: root/arch/x86/kvm/mmu/tdp_mmu.c
diff options
context:
space:
mode:
authorDavid Matlack <dmatlack@google.com>2022-01-20 02:07:38 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2022-02-10 21:50:43 +0300
commite0b728b1f1a951e0d23eef08cfa920a8104e39db (patch)
tree23a212f7a7957e0ba4a533fe661cac9bd1b9b39b /arch/x86/kvm/mmu/tdp_mmu.c
parentcb00a70bd4b7e42dcbd6cd80b3f1697b10cdb44e (diff)
downloadlinux-e0b728b1f1a951e0d23eef08cfa920a8104e39db.tar.xz
KVM: x86/mmu: Add tracepoint for splitting huge pages
Add a tracepoint that records whenever KVM eagerly splits a huge page and the error status of the split to indicate if it succeeded or failed and why. Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: David Matlack <dmatlack@google.com> Message-Id: <20220119230739.2234394-18-dmatlack@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu/tdp_mmu.c')
-rw-r--r--arch/x86/kvm/mmu/tdp_mmu.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
index dae2cebcf8b5..8def8f810cb0 100644
--- a/arch/x86/kvm/mmu/tdp_mmu.c
+++ b/arch/x86/kvm/mmu/tdp_mmu.c
@@ -1347,7 +1347,7 @@ static int tdp_mmu_split_huge_page(struct kvm *kvm, struct tdp_iter *iter,
*/
ret = tdp_mmu_link_sp(kvm, iter, sp, false, shared);
if (ret)
- return ret;
+ goto out;
/*
* tdp_mmu_link_sp_atomic() will handle subtracting the huge page we
@@ -1356,7 +1356,9 @@ static int tdp_mmu_split_huge_page(struct kvm *kvm, struct tdp_iter *iter,
*/
kvm_update_page_stats(kvm, level - 1, PT64_ENT_PER_PAGE);
- return 0;
+out:
+ trace_kvm_mmu_split_huge_page(iter->gfn, huge_spte, level, ret);
+ return ret;
}
static int tdp_mmu_split_huge_pages_root(struct kvm *kvm,
@@ -1393,6 +1395,9 @@ retry:
sp = tdp_mmu_alloc_sp_for_split(kvm, &iter, shared);
if (!sp) {
ret = -ENOMEM;
+ trace_kvm_mmu_split_huge_page(iter.gfn,
+ iter.old_spte,
+ iter.level, ret);
break;
}
@@ -1416,7 +1421,6 @@ retry:
if (sp)
tdp_mmu_free_sp(sp);
-
return ret;
}