Skip to contentSkip to conversation

x86/hap: Initialise HAP logdirty function pointers once in hap_domain_init()

PATCH In review Andrew Cooper 2 participants 2 messages Aug 8, 2014 – Aug 9, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/hap: Initialise HAP logdirty function pointers once in hap_domain_init()

rather than repeatedly initialising them each time logdirty is enabled or the vram tracking area changes.

CC Jan Beulich <[email protected]>
CC Tim Deegan <[email protected]>
---
 xen/arch/x86/mm/hap/hap.c |   15 +++++----------
 xen/arch/x86/mm/paging.c  |    2 --
 xen/include/asm-x86/hap.h |    1 -
 3 files changed, 5 insertions(+), 13 deletions(-)
xen/arch/x86/mm/hap/hap.c +5 -10
index 21f57c1..abf3d7a 100644
@@ -81,7 +81,6 @@ int hap_track_dirty_vram(struct domain *d,
 
         if ( !paging_mode_log_dirty(d) )
         {
-            hap_logdirty_init(d);
             rc = paging_log_dirty_enable(d, 0);
             if ( rc )
                 goto out;
@@ -219,15 +218,6 @@ static void hap_clean_dirty_bitmap(struct domain *d)
     flush_tlb_mask(d->domain_dirty_cpumask);
 }
 
-void hap_logdirty_init(struct domain *d)
-{
-
-    /* Reinitialize logdirty mechanism */
-    paging_log_dirty_init(d, hap_enable_log_dirty,
-                          hap_disable_log_dirty,
-                          hap_clean_dirty_bitmap);
-}
-
 /************************************************/
 /*             HAP SUPPORT FUNCTIONS            */
 /************************************************/
@@ -438,6 +428,11 @@ static void hap_destroy_monitor_table(struct vcpu* v, mfn_t mmfn)
 void hap_domain_init(struct domain *d)
 {
     INIT_PAGE_LIST_HEAD(&d->arch.paging.hap.freelist);
+
+    /* Use HAP logdirty mechanism. */
+    paging_log_dirty_init(d, hap_enable_log_dirty,
+                          hap_disable_log_dirty,
+                          hap_clean_dirty_bitmap);
 }
 
 /* return 0 for success, -errno for failure */
xen/arch/x86/mm/paging.c +0 -2
index 32764ba..455000d 100644
@@ -594,8 +594,6 @@ int paging_domctl(struct domain *d, xen_domctl_shadow_op_t *sc,
             break;
         /* Else fall through... */
     case XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY:
-        if ( hap_enabled(d) )
-            hap_logdirty_init(d);
         return paging_log_dirty_enable(d, 1);
 
     case XEN_DOMCTL_SHADOW_OP_OFF:
xen/include/asm-x86/hap.h +0 -1
index 5161927..7876527 100644
@@ -56,7 +56,6 @@ int   hap_enable(struct domain *d, u32 mode);
 void  hap_final_teardown(struct domain *d);
 void  hap_teardown(struct domain *d);
 void  hap_vcpu_init(struct vcpu *v);
-void  hap_logdirty_init(struct domain *d);
 int   hap_track_dirty_vram(struct domain *d,
                            unsigned long begin_pfn,
                            unsigned long nr,
Signature · 1 line
1.7.10.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Andrew Cooper

rather than repeatedly initialising them each time logdirty is enabled or the vram tracking area changes.

I thought there was some subtlety of the ordering here, but I can't see it now so maybe other changes have made it irrelevant. So,