[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC 05/12] x86/np2m: add np2m_generation
Add np2m_generation variable to both p2m_domain and nestedvcpu. np2m's generation will be incremented each time the np2m is flushed. This will allow to detect if a nested vcpu has the stale np2m. Signed-off-by: Sergey Dyasli <sergey.dyasli@xxxxxxxxxx> --- xen/arch/x86/hvm/nestedhvm.c | 1 + xen/arch/x86/mm/p2m.c | 3 +++ xen/include/asm-x86/hvm/vcpu.h | 1 + xen/include/asm-x86/p2m.h | 1 + 4 files changed, 6 insertions(+) diff --git a/xen/arch/x86/hvm/nestedhvm.c b/xen/arch/x86/hvm/nestedhvm.c index f2f7469d86..32b8acca6a 100644 --- a/xen/arch/x86/hvm/nestedhvm.c +++ b/xen/arch/x86/hvm/nestedhvm.c @@ -56,6 +56,7 @@ nestedhvm_vcpu_reset(struct vcpu *v) nv->nv_vvmcxaddr = INVALID_PADDR; nv->nv_flushp2m = 0; nv->nv_p2m = NULL; + nv->np2m_generation = 0; hvm_asid_flush_vcpu_asid(&nv->nv_n2asid); diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index e7bd0dbac8..4fc2d94b46 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -73,6 +73,7 @@ static int p2m_initialise(struct domain *d, struct p2m_domain *p2m) p2m->p2m_class = p2m_host; p2m->np2m_base = P2M_BASE_EADDR; + p2m->np2m_generation = 0; for ( i = 0; i < ARRAY_SIZE(p2m->pod.mrp.list); ++i ) p2m->pod.mrp.list[i] = gfn_x(INVALID_GFN); @@ -1735,6 +1736,7 @@ p2m_flush_table_locked(struct p2m_domain *p2m) /* This is no longer a valid nested p2m for any address space */ p2m->np2m_base = P2M_BASE_EADDR; + p2m->np2m_generation++; /* Make sure nobody else is using this p2m table */ nestedhvm_vmcx_flushtlb(p2m); @@ -1811,6 +1813,7 @@ static void assign_np2m(struct vcpu *v, struct p2m_domain *p2m) nv->nv_flushp2m = 0; nv->nv_p2m = p2m; + nv->np2m_generation = p2m->np2m_generation; cpumask_set_cpu(v->processor, p2m->dirty_cpumask); } diff --git a/xen/include/asm-x86/hvm/vcpu.h b/xen/include/asm-x86/hvm/vcpu.h index 6c54773f1c..91651581db 100644 --- a/xen/include/asm-x86/hvm/vcpu.h +++ b/xen/include/asm-x86/hvm/vcpu.h @@ -115,6 +115,7 @@ struct nestedvcpu { bool_t nv_flushp2m; /* True, when p2m table must be flushed */ struct p2m_domain *nv_p2m; /* used p2m table for this vcpu */ + uint64_t np2m_generation; struct hvm_vcpu_asid nv_n2asid; diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h index cc1bab9eb7..eedc7fd412 100644 --- a/xen/include/asm-x86/p2m.h +++ b/xen/include/asm-x86/p2m.h @@ -209,6 +209,7 @@ struct p2m_domain { * to set it to any other value. */ #define P2M_BASE_EADDR (~0ULL) uint64_t np2m_base; + uint64_t np2m_generation; /* Nested p2ms: linked list of n2pms allocated to this domain. * The host p2m hasolds the head of the list and the np2ms are -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |