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

[Xen-changelog] [xen stable-4.8] xen/page_alloc: Cover memory unreserved after boot in first_valid_mfn



commit 1a535c3614a4b35e5e94c4bdeaf08d4685d2435e
Author:     Julien Grall <julien.grall@xxxxxxx>
AuthorDate: Fri Oct 6 15:06:23 2017 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Oct 6 15:06:23 2017 +0200

    xen/page_alloc: Cover memory unreserved after boot in first_valid_mfn
    
    On Arm, some regions (e.g Initramfs, Dom0 Kernel...) are marked as
    reserved until the hardware domain is built and they are copied into its
    memory. Therefore, they will not be added in the boot allocator via
    init_boot_pages.
    
    Instead, init_xenheap_pages will be called once the region are not used
    anymore.
    
    Update first_valid_mfn in both init_heap_pages and init_boot_pages
    (already exist) to cover all the cases.
    
    This is XSA-245.
    
    Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
    [Adjust comment, added locking around first_valid_mfn update]
    Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
    Acked-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
    Reported-and-Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
    master commit: ec6d9023e1f54cdccbf2e4c63cf947f1be2b1e8e
    master date: 2017-09-29 13:22:52 -0700
---
 xen/common/page_alloc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 217a467..80c91de 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1278,6 +1278,16 @@ static void init_heap_pages(
 {
     unsigned long i;
 
+    /*
+     * Some pages may not go through the boot allocator (e.g reserved
+     * memory at boot but released just after --- kernel, initramfs,
+     * etc.).
+     * Update first_valid_mfn to ensure those regions are covered.
+     */
+    spin_lock(&heap_lock);
+    first_valid_mfn = min_t(unsigned long, page_to_mfn(pg), first_valid_mfn);
+    spin_unlock(&heap_lock);
+
     for ( i = 0; i < nr_pages; i++ )
     {
         unsigned int nid = phys_to_nid(page_to_maddr(pg+i));
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.8

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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