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

[xen staging] dom0/pvh: fix processing softirqs during memory map population



commit 10d33220f2363a21a52a394159118ab4ddaed50e
Author:     Roger Pau Monne <roger.pau@xxxxxxxxxx>
AuthorDate: Mon Feb 7 12:20:08 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Mon Feb 7 17:41:24 2022 +0000

    dom0/pvh: fix processing softirqs during memory map population
    
    Make sure softirqs are processed after every successful call to
    guest_physmap_add_page. Even if only a single page is to be added,
    it's unknown whether the p2m or the IOMMU will require splitting the
    provided page into smaller ones, and thus in case of having to break
    a 1G page into 4K entries the amount of time taken by a single of
    those additions will be non-trivial. Stay on the safe side and check
    for pending softirqs on every successful loop iteration.
    
    Fixes: 5427134eae ('x86: populate PVHv2 Dom0 physical memory map')
    Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/hvm/dom0_build.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index afba6e7dfd..f9e17249dc 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -113,10 +113,9 @@ static int __init pvh_populate_memory_range(struct domain 
*d,
         { .align = PFN_DOWN(MB(2)), .order = PAGE_ORDER_2M },
         { .align = PFN_DOWN(KB(4)), .order = PAGE_ORDER_4K },
     };
-    unsigned int max_order = MAX_ORDER, i = 0;
+    unsigned int max_order = MAX_ORDER;
     struct page_info *page;
     int rc;
-#define MAP_MAX_ITER 64
 
     while ( nr_pages != 0 )
     {
@@ -185,12 +184,16 @@ static int __init pvh_populate_memory_range(struct domain 
*d,
         start += 1UL << order;
         nr_pages -= 1UL << order;
         order_stats[order]++;
-        if ( (++i % MAP_MAX_ITER) == 0 )
-            process_pending_softirqs();
+        /*
+         * Process pending softirqs on every successful loop: it's unknown
+         * whether the p2m/IOMMU code will have split the page into multiple
+         * smaller entries, and thus the time consumed would be much higher
+         * than populating a single entry.
+         */
+        process_pending_softirqs();
     }
 
     return 0;
-#undef MAP_MAX_ITER
 }
 
 /* Steal RAM from the end of a memory region. */
--
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®.