[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <52cf5d90-5e65-4878-b214-7e1809224688@redhat.com>
Date: Tue, 21 Jan 2020 16:12:46 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Sean Christopherson <sean.j.christopherson@...el.com>
Cc: Paul Mackerras <paulus@...abs.org>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Marc Zyngier <maz@...nel.org>,
James Morse <james.morse@....com>,
Julien Thierry <julien.thierry.kdev@...il.com>,
Suzuki K Poulose <suzuki.poulose@....com>,
kvm-ppc@...r.kernel.org, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.cs.columbia.edu,
syzbot+c9d1fb51ac9d0d10c39d@...kaller.appspotmail.com,
Andrea Arcangeli <aarcange@...hat.com>,
Dan Williams <dan.j.williams@...el.com>,
Barret Rhoden <brho@...gle.com>,
David Hildenbrand <david@...hat.com>,
Jason Zeng <jason.zeng@...el.com>,
Dave Jiang <dave.jiang@...el.com>,
Liran Alon <liran.alon@...cle.com>,
linux-nvdimm <linux-nvdimm@...ts.01.org>
Subject: Re: [PATCH 12/14] KVM: x86/mmu: Fold max_mapping_level() into
kvm_mmu_hugepage_adjust()
On 08/01/20 21:24, Sean Christopherson wrote:
> - level = host_pfn_mapping_level(vcpu, gfn, pfn);
> + slot = kvm_vcpu_gfn_to_memslot(vcpu, gfn);
> + if (!memslot_valid_for_gpte(slot, true))
> + return PT_PAGE_TABLE_LEVEL;
Following up on my remark to patch 7, this can also use
gfn_to_memslot_dirty_bitmap.
Paolo
> +
> + max_level = min(max_level, kvm_x86_ops->get_lpage_level());
> + for ( ; max_level > PT_PAGE_TABLE_LEVEL; max_level--) {
> + if (!__mmu_gfn_lpage_is_disallowed(gfn, max_level, slot))
> + break;
> + }
> +
> + if (max_level == PT_PAGE_TABLE_LEVEL)
> + return PT_PAGE_TABLE_LEVEL;
> +
> + level = host_pfn_mapping_level(vcpu, gfn, pfn, slot);
> if (level == PT_PAGE_TABLE_LEVEL)
> return level;
>
> @@ -4182,8 +4172,6 @@ static int direct_page_fault(struct kvm_vcpu *vcpu, gpa_t gpa, u32 error_code,
> if (lpage_disallowed)
> max_level = PT_PAGE_TABLE_LEVEL;
>
> - max_level = max_mapping_level(vcpu, gfn, max_level);
> -
> if (fast_page_fault(vcpu, gpa, error_code))
> return RET_PF_RETRY;
>
> diff --git a/arch/x86/kvm/mmu/paging_tmpl.h b/arch/x86/kvm/mmu/paging_tmpl.h
> index 0560982eda8b..ea174d85700a 100644
> --- a/arch/x86/kvm/mmu/paging_tmpl.h
> +++ b/arch/x86/kvm/mmu/paging_tmpl.h
> @@ -817,8 +817,6 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gpa_t addr, u32 error_code,
> else
> max_level = walker.level;
>
> - max_level = max_mapping_level(vcpu, walker.gfn, max_level);
> -
> mmu_seq = vcpu->kvm->mmu_notifier_seq;
> smp_rmb();
>
>
Powered by blists - more mailing lists