[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] x86/shadow: reduce flush_tlb's scope in shadow_track_dirty_vram()



commit 1146b4f52457c2048ed8cb52ecab799719e21f92
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu May 21 09:11:33 2026 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu May 21 09:11:33 2026 +0200

    x86/shadow: reduce flush_tlb's scope in shadow_track_dirty_vram()
    
    It's set only in the main "else", so the declaration as well as the sole
    consumer can also move into that more narrow scope. This may in particular
    help with possible future locking changes.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/arch/x86/mm/shadow/hvm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index ff4dd1f94c..e6fb97c4b6 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -1003,7 +1003,6 @@ int shadow_track_dirty_vram(struct domain *d,
     int rc = 0;
     unsigned long end_pfn = begin_pfn + nr_frames;
     unsigned int dirty_size = DIV_ROUND_UP(nr_frames, BITS_PER_BYTE);
-    int flush_tlb = 0;
     unsigned long i;
     p2m_type_t t;
     struct sh_dirty_vram *dirty_vram;
@@ -1078,7 +1077,7 @@ int shadow_track_dirty_vram(struct domain *d,
     {
         mfn_t map_mfn = INVALID_MFN;
         void *map_sl1p = NULL;
-        bool any_dirty = false;
+        bool any_dirty = false, flush_tlb = false;
         s_time_t now;
 
         /* Iterate over VRAM to track dirty bits. */
@@ -1139,7 +1138,7 @@ int shadow_track_dirty_vram(struct domain *d,
                              * _PAGE_ACCESSED set by another processor.
                              */
                             l1e_remove_flags(*sl1e, _PAGE_DIRTY);
-                            flush_tlb = 1;
+                            flush_tlb = true;
                         }
                     }
                     break;
@@ -1182,9 +1181,10 @@ int shadow_track_dirty_vram(struct domain *d,
             }
             dirty_vram->last_dirty = -1;
         }
+
+        if ( flush_tlb )
+            guest_flush_tlb_mask(d, d->dirty_cpumask);
     }
-    if ( flush_tlb )
-        guest_flush_tlb_mask(d, d->dirty_cpumask);
     goto out;
 
  out_sl1ma:
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.