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

[Xen-changelog] [xen staging-4.11] xen/page_alloc: Keep away MFN 0 from the buddy allocator



commit 32bdae275064da0eb745dd371c27088c0ad80088
Author:     Julien Grall <julien.grall@xxxxxxx>
AuthorDate: Mon Sep 23 14:37:04 2019 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Sep 23 14:37:04 2019 +0200

    xen/page_alloc: Keep away MFN 0 from the buddy allocator
    
    Combining of buddies happens only such that the resulting larger buddy
    is still order-aligned. To cross a zone boundary while merging, the
    implication is that both the buddy [0, 2^n-1] and the buddy
    [2^n, 2^(n+1)-1] are free.
    
    Ideally we want to fix the allocator, but for now we can just prevent
    adding the MFN 0 in the allocator to avoid merging across zone
    boundaries.
    
    On x86, the MFN 0 is already kept away from the buddy allocator. So the
    bug can only happen on Arm platform where the first memory bank is
    starting at 0.
    
    As this is a specific to the allocator, the MFN 0 is removed in the common 
code
    to cater all the architectures (current and future).
    
    [Stefano: improve commit message]
    
    Reported-by: Jeff Kubascik <jeff.kubascik@xxxxxxxxxxxxxxx>
    Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
    Tested-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
    Signed-off-by: Stefano Stabellini <stefanos@xxxxxxxxxx>
    master commit: 762b9a2d990bba1f3aefe660cff0c37ad2e375bc
    master date: 2019-08-09 11:12:55 -0700
---
 xen/common/page_alloc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 41a23cd84f..57f65460e3 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1728,6 +1728,18 @@ static void init_heap_pages(
     unsigned long i;
 
     /*
+     * Keep MFN 0 away from the buddy allocator to avoid crossing zone
+     * boundary when merging two buddies.
+     */
+    if ( !mfn_x(page_to_mfn(pg)) )
+    {
+        if ( nr_pages-- <= 1 )
+            return;
+        pg++;
+    }
+
+
+    /*
      * Some pages may not go through the boot allocator (e.g reserved
      * memory at boot but released just after --- kernel, initramfs,
      * etc.).
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
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®.