]> xenbits.xensource.com Git - xen.git/commitdiff
x86/mm: drop log-dirty-enable's log_global parameter
authorJan Beulich <jbeulich@suse.com>
Tue, 2 May 2023 10:03:18 +0000 (12:03 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 2 May 2023 10:03:18 +0000 (12:03 +0200)
As of XSA-397 the only caller passes true for it. Simplify things by
getting rid of the parameter for both the internal paging function and
the involved hook.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/include/asm/domain.h
xen/arch/x86/mm/hap/hap.c
xen/arch/x86/mm/paging.c
xen/arch/x86/mm/shadow/common.c
xen/arch/x86/mm/shadow/none.c

index ad5729d5c233a073aaee46c6feb29b7e9fb3eaaa..c2d9fc333be5902a9cea1eca060354cbefa1b0ee 100644 (file)
@@ -186,7 +186,7 @@ struct log_dirty_domain {
 
     /* functions which are paging mode specific */
     const struct log_dirty_ops {
-        int        (*enable  )(struct domain *d, bool log_global);
+        int        (*enable  )(struct domain *d);
         int        (*disable )(struct domain *d);
         void       (*clean   )(struct domain *d);
     } *ops;
index de1b8189d9248c1a4cf0fbd3afdb1836ab0108a0..d05f1b7a95438ca5714f901e3019cd1059127654 100644 (file)
@@ -164,10 +164,10 @@ out:
 /*
  * hap code to call when log_dirty is enable. return 0 if no problem found.
  *
- * NB: Domain that having device assigned should not set log_global. Because
+ * NB: Domains having a device assigned should not come here, because
  * there is no way to track the memory updating from device.
  */
-static int cf_check hap_enable_log_dirty(struct domain *d, bool log_global)
+static int cf_check hap_enable_log_dirty(struct domain *d)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
 
@@ -175,7 +175,7 @@ static int cf_check hap_enable_log_dirty(struct domain *d, bool log_global)
      * Refuse to turn on global log-dirty mode if
      * there are outstanding p2m_ioreq_server pages.
      */
-    if ( log_global && read_atomic(&p2m->ioreq.entry_count) )
+    if ( read_atomic(&p2m->ioreq.entry_count) )
         return -EBUSY;
 
     /* turn on PG_log_dirty bit in paging mode */
@@ -186,15 +186,13 @@ static int cf_check hap_enable_log_dirty(struct domain *d, bool log_global)
     /* Enable hardware-assisted log-dirty if it is supported. */
     p2m_enable_hardware_log_dirty(d);
 
-    if ( log_global )
-    {
-        /*
-         * Switch to log dirty mode, either by setting l1e entries of P2M table
-         * to be read-only, or via hardware-assisted log-dirty.
-         */
-        p2m_change_entry_type_global(d, p2m_ram_rw, p2m_ram_logdirty);
-        guest_flush_tlb_mask(d, d->dirty_cpumask);
-    }
+    /*
+     * Switch to log dirty mode, either by setting l1e entries of P2M table
+     * to be read-only, or via hardware-assisted log-dirty.
+     */
+    p2m_change_entry_type_global(d, p2m_ram_rw, p2m_ram_logdirty);
+    guest_flush_tlb_mask(d, d->dirty_cpumask);
+
     return 0;
 }
 
index 9ec305730a6d5d1fb3ba0d2bd844a0c96e1d5406..b1d6bfe10efa9381d372c1ca518bde154254ab5a 100644 (file)
@@ -201,11 +201,11 @@ static int paging_free_log_dirty_bitmap(struct domain *d, int rc)
     return rc;
 }
 
-static int paging_log_dirty_enable(struct domain *d, bool log_global)
+static int paging_log_dirty_enable(struct domain *d)
 {
     int ret;
 
-    if ( has_arch_pdevs(d) && log_global )
+    if ( has_arch_pdevs(d) )
     {
         /*
          * Refuse to turn on global log-dirty mode
@@ -218,7 +218,7 @@ static int paging_log_dirty_enable(struct domain *d, bool log_global)
         return -EINVAL;
 
     domain_pause(d);
-    ret = d->arch.paging.log_dirty.ops->enable(d, log_global);
+    ret = d->arch.paging.log_dirty.ops->enable(d);
     domain_unpause(d);
 
     return ret;
@@ -728,7 +728,7 @@ int paging_domctl(struct domain *d, struct xen_domctl_shadow_op *sc,
             break;
         /* Else fall through... */
     case XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY:
-        return paging_log_dirty_enable(d, true);
+        return paging_log_dirty_enable(d);
 
     case XEN_DOMCTL_SHADOW_OP_OFF:
         if ( (rc = paging_log_dirty_disable(d, resuming)) != 0 )
index 6d84ff3d99c2731c5f27849cabf88293fc1945b6..e522267325cd998fb4dda2014719ce980ff648db 100644 (file)
@@ -67,7 +67,7 @@ const uint8_t sh_type_to_size[] = {
 
 DEFINE_PER_CPU(uint32_t,trace_shadow_path_flags);
 
-static int cf_check sh_enable_log_dirty(struct domain *, bool log_global);
+static int cf_check sh_enable_log_dirty(struct domain *);
 static int cf_check sh_disable_log_dirty(struct domain *);
 static void cf_check sh_clean_dirty_bitmap(struct domain *);
 
@@ -3030,7 +3030,7 @@ static int shadow_test_disable(struct domain *d)
 /* Shadow specific code which is called in paging_log_dirty_enable().
  * Return 0 if no problem found.
  */
-static int cf_check sh_enable_log_dirty(struct domain *d, bool log_global)
+static int cf_check sh_enable_log_dirty(struct domain *d)
 {
     int ret;
 
index f28fb76a9b61e0e80b9ed8c97be3f4ac0e4fc3ee..c462639eabe046d998ce91aed19256208d233d4f 100644 (file)
@@ -1,13 +1,7 @@
 #include <xen/mm.h>
 #include <asm/shadow.h>
 
-static int cf_check _enable_log_dirty(struct domain *d, bool log_global)
-{
-    ASSERT(is_pv_domain(d));
-    return -EOPNOTSUPP;
-}
-
-static int cf_check _disable_log_dirty(struct domain *d)
+static int cf_check _toggle_log_dirty(struct domain *d)
 {
     ASSERT(is_pv_domain(d));
     return -EOPNOTSUPP;
@@ -27,8 +21,8 @@ int shadow_domain_init(struct domain *d)
 {
     /* For HVM set up pointers for safety, then fail. */
     static const struct log_dirty_ops sh_none_ops = {
-        .enable  = _enable_log_dirty,
-        .disable = _disable_log_dirty,
+        .enable  = _toggle_log_dirty,
+        .disable = _toggle_log_dirty,
         .clean   = _clean_dirty_bitmap,
     };