Re: [PATCH v3 3/3] KVM: MMU: retry #PF for softmmu

From: Marcelo Tosatti
Date: Wed Dec 01 2010 - 21:50:16 EST


On Tue, Nov 30, 2010 at 05:37:36PM +0800, Xiao Guangrong wrote:
> Retry #PF for softmmu only when the current vcpu has the same root shadow page
> as the time when #PF occurs. it means they have same paging environment
>
> Signed-off-by: Xiao Guangrong <xiaoguangrong@xxxxxxxxxxxxxx>
> ---
> arch/x86/include/asm/kvm_host.h | 5 +++++
> arch/x86/kvm/mmu.c | 33 ++++++++++++++++++++++++++++++++-
> arch/x86/kvm/paging_tmpl.h | 34 +++++++++++++++++++++++-----------
> arch/x86/kvm/x86.c | 13 ++++++++++++-
> virt/kvm/async_pf.c | 1 +
> 5 files changed, 73 insertions(+), 13 deletions(-)
>
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 209da89..5acbcab 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -191,6 +191,7 @@ union kvm_mmu_page_role {
> struct kvm_mmu_page {
> struct list_head link;
> struct hlist_node hash_link;
> + struct kref apfs_counter;
>
> /*
> * The following two entries are used to key the shadow page in the
> @@ -602,6 +603,7 @@ struct kvm_x86_ops {
> struct kvm_arch_async_pf {
> u32 token;
> gfn_t gfn;
> + struct kvm_mmu_page *root_sp;
> bool direct_map;
> };

Can't you just compare cr3 value? Its harmless to instantiate an spte
for an unused translation.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/