[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <80407e4a-36e1-e606-ed9f-74429f850e77@redhat.com>
Date: Wed, 10 Nov 2021 23:44:54 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Ben Gardon <bgardon@...gle.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Cc: Peter Xu <peterx@...hat.com>,
Sean Christopherson <seanjc@...gle.com>,
Peter Shier <pshier@...gle.com>,
David Matlack <dmatlack@...gle.com>,
Mingwei Zhang <mizhang@...gle.com>,
Yulei Zhang <yulei.kernel@...il.com>,
Wanpeng Li <kernellwp@...il.com>,
Xiao Guangrong <xiaoguangrong.eric@...il.com>,
Kai Huang <kai.huang@...el.com>,
Keqian Zhu <zhukeqian1@...wei.com>,
David Hildenbrand <david@...hat.com>
Subject: Re: [RFC 11/19] KVM: x86/mmu: Factor shadow_zero_check out of
make_spte
On 11/10/21 23:30, Ben Gardon wrote:
> - WARN_ONCE(is_rsvd_spte(&vcpu->arch.mmu->shadow_zero_check, spte, level),
> + WARN_ONCE(is_rsvd_spte(shadow_zero_check, spte, level),
> "spte = 0x%llx, level = %d, rsvd bits = 0x%llx", spte, level,
> - get_rsvd_bits(&vcpu->arch.mmu->shadow_zero_check, spte, level));
> + get_rsvd_bits(shadow_zero_check, spte, level));
Hmm, there is a deeper issue here, in that when using EPT/NPT (on either
the legacy aka shadow or the TDP MMU) large parts of vcpu->arch.mmu are
really the same for all vCPUs. The only thing that varies is those
parts that actually depend on the guest's paging mode---the extended
role, the reserved bits, etc. Those are needed by the emulator, but
don't really belong in vcpu->arch.mmu when EPT/NPT is in use.
I wonder if there's room for splitting kvm_mmu in two parts, such as
kvm_mmu and kvm_guest_paging_context, and possibly change the walk_mmu
pointer into a pointer to kvm_guest_paging_context. This way the
EPT/NPT MMU (again either shadow or TDP) can be moved to kvm->arch. It
should simplify this series and also David's work on eager page splitting.
I'm not asking you to do this, of course, but perhaps I can trigger
Sean's itch to refactor stuff. :)
Paolo
Powered by blists - more mailing lists