[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] x86/altp2m: propagate ept.ad changes to all active altp2ms
commit 303cee10a677dd8c5c130e50ddad6517c12e0276 Author: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx> AuthorDate: Thu Nov 15 13:35:08 2018 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Thu Nov 15 13:35:08 2018 +0100 x86/altp2m: propagate ept.ad changes to all active altp2ms This patch is a pre-requisite for fixing the logdirty VGA issue (display freezes when switching to a new altp2m view early in a domain's lifetime). The new ept_set_ad_sync() function has been added to update all active altp2ms' ept.ad. New altp2ms will inherit the hostp2m's ept.ad value. The p2m_{en,dis}able_hardware_log_dirty() hostp2m locking has been moved to the new ept_{en,dis}able_hardware_log_dirty() functions as part of the code refactoring, while locks for the individual altp2ms are taken in ept_set_ad_sync() (called by ept_{en,dis}able_pml()). Suggested-by: George Dunlap <george.dunlap@xxxxxxxxxx> Signed-off-by: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx> Tested-by: Tamas K Lengyel <tamas@xxxxxxxxxxxxx> Acked-by: George Dunlap <george.dunlap@xxxxxxxxxx> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx> --- xen/arch/x86/mm/p2m-ept.c | 57 +++++++++++++++++++++++++++++++++++++++++++---- xen/arch/x86/mm/p2m.c | 8 ------- 2 files changed, 53 insertions(+), 12 deletions(-) diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c index 407e299e50..fabcd06f07 100644 --- a/xen/arch/x86/mm/p2m-ept.c +++ b/xen/arch/x86/mm/p2m-ept.c @@ -17,6 +17,7 @@ #include <xen/domain_page.h> #include <xen/sched.h> +#include <asm/altp2m.h> #include <asm/current.h> #include <asm/paging.h> #include <asm/types.h> @@ -1222,6 +1223,34 @@ static void ept_tlb_flush(struct p2m_domain *p2m) ept_sync_domain_mask(p2m, p2m->domain->dirty_cpumask); } +static void ept_set_ad_sync(struct domain *d, bool value) +{ + struct p2m_domain *hostp2m = p2m_get_hostp2m(d); + + ASSERT(p2m_locked_by_me(hostp2m)); + + hostp2m->ept.ad = value; + + if ( unlikely(altp2m_active(d)) ) + { + unsigned int i; + + for ( i = 0; i < MAX_ALTP2M; i++ ) + { + struct p2m_domain *p2m; + + if ( d->arch.altp2m_eptp[i] == mfn_x(INVALID_MFN) ) + continue; + + p2m = d->arch.altp2m_p2m[i]; + + p2m_lock(p2m); + p2m->ept.ad = value; + p2m_unlock(p2m); + } + } +} + static void ept_enable_pml(struct p2m_domain *p2m) { /* Domain must have been paused */ @@ -1236,7 +1265,7 @@ static void ept_enable_pml(struct p2m_domain *p2m) return; /* Enable EPT A/D bit for PML */ - p2m->ept.ad = 1; + ept_set_ad_sync(p2m->domain, true); vmx_domain_update_eptp(p2m->domain); } @@ -1248,10 +1277,28 @@ static void ept_disable_pml(struct p2m_domain *p2m) vmx_domain_disable_pml(p2m->domain); /* Disable EPT A/D bit */ - p2m->ept.ad = 0; + ept_set_ad_sync(p2m->domain, false); vmx_domain_update_eptp(p2m->domain); } +static void ept_enable_hardware_log_dirty(struct p2m_domain *p2m) +{ + struct p2m_domain *hostp2m = p2m_get_hostp2m(p2m->domain); + + p2m_lock(hostp2m); + ept_enable_pml(hostp2m); + p2m_unlock(hostp2m); +} + +static void ept_disable_hardware_log_dirty(struct p2m_domain *p2m) +{ + struct p2m_domain *hostp2m = p2m_get_hostp2m(p2m->domain); + + p2m_lock(hostp2m); + ept_disable_pml(hostp2m); + p2m_unlock(hostp2m); +} + static void ept_flush_pml_buffers(struct p2m_domain *p2m) { /* Domain must have been paused */ @@ -1281,8 +1328,8 @@ int ept_p2m_init(struct p2m_domain *p2m) if ( cpu_has_vmx_pml ) { - p2m->enable_hardware_log_dirty = ept_enable_pml; - p2m->disable_hardware_log_dirty = ept_disable_pml; + p2m->enable_hardware_log_dirty = ept_enable_hardware_log_dirty; + p2m->disable_hardware_log_dirty = ept_disable_hardware_log_dirty; p2m->flush_hardware_cached_dirty = ept_flush_pml_buffers; } @@ -1390,8 +1437,10 @@ void setup_ept_dump(void) void p2m_init_altp2m_ept(struct domain *d, unsigned int i) { struct p2m_domain *p2m = d->arch.altp2m_p2m[i]; + struct p2m_domain *hostp2m = p2m_get_hostp2m(d); struct ept_data *ept; + p2m->ept.ad = hostp2m->ept.ad; p2m->min_remapped_gfn = gfn_x(INVALID_GFN); p2m->max_remapped_gfn = 0; ept = &p2m->ept; diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index 4bdc5e34e0..6a1abb6df5 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -360,11 +360,7 @@ void p2m_enable_hardware_log_dirty(struct domain *d) struct p2m_domain *p2m = p2m_get_hostp2m(d); if ( p2m->enable_hardware_log_dirty ) - { - p2m_lock(p2m); p2m->enable_hardware_log_dirty(p2m); - p2m_unlock(p2m); - } } void p2m_disable_hardware_log_dirty(struct domain *d) @@ -372,11 +368,7 @@ void p2m_disable_hardware_log_dirty(struct domain *d) struct p2m_domain *p2m = p2m_get_hostp2m(d); if ( p2m->disable_hardware_log_dirty ) - { - p2m_lock(p2m); p2m->disable_hardware_log_dirty(p2m); - p2m_unlock(p2m); - } } void p2m_flush_hardware_cached_dirty(struct domain *d) -- generated by git-patchbot for /home/xen/git/xen.git#staging _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |