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

[Xen-changelog] [xen staging] xen: actually skip the first MAX_ORDER bits in pfn_pdx_hole_setup



commit b20079da97915019ca67c23f44bf45e99eb619d7
Author:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
AuthorDate: Mon Jun 3 15:02:44 2019 -0700
Commit:     Julien Grall <julien.grall@xxxxxxx>
CommitDate: Thu Jun 6 16:08:33 2019 +0100

    xen: actually skip the first MAX_ORDER bits in pfn_pdx_hole_setup
    
    pfn_pdx_hole_setup is meant to skip the first MAX_ORDER bits, but
    actually it only skips the first MAX_ORDER-1 bits. The issue was
    probably introduced by bdb5439c3f ("x86_64: Ensure frame-table
    compression leaves MAX_ORDER aligned"), when changing to loop to start
    from MAX_ORDER-1 an adjustment by 1 was needed in the call to
    find_next_bit() but not done.
    
    Fix the issue by passing j+1 and i+1 to find_next_zero_bit and
    find_next_bit. Also add a check for i >= BITS_PER_LONG because
    find_{,next_}zero_bit() are free to assume that their last argument is
    less than their middle one.
    
    Signed-off-by: Stefano Stabellini <stefanos@xxxxxxxxxx>
    Signed-off-by: Jan Beulich <JBeulich@xxxxxxxx>
    Acked-by: Julien Grall <julien.grall@xxxxxxx>
    CC: andrew.cooper3@xxxxxxxxxx
    CC: JBeulich@xxxxxxxx
    CC: George.Dunlap@xxxxxxxxxxxxx
    CC: ian.jackson@xxxxxxxxxxxxx
    CC: konrad.wilk@xxxxxxxxxx
    CC: tim@xxxxxxx
    CC: wei.liu2@xxxxxxxxxx
---
 xen/common/pdx.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/common/pdx.c b/xen/common/pdx.c
index 50c21b6bf8..bb7e437049 100644
--- a/xen/common/pdx.c
+++ b/xen/common/pdx.c
@@ -83,8 +83,10 @@ void __init pfn_pdx_hole_setup(unsigned long mask)
      */
     for ( j = MAX_ORDER-1; ; )
     {
-        i = find_next_zero_bit(&mask, BITS_PER_LONG, j);
-        j = find_next_bit(&mask, BITS_PER_LONG, i);
+        i = find_next_zero_bit(&mask, BITS_PER_LONG, j + 1);
+        if ( i >= BITS_PER_LONG )
+            break;
+        j = find_next_bit(&mask, BITS_PER_LONG, i + 1);
         if ( j >= BITS_PER_LONG )
             break;
         if ( j - i > hole_shift )
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
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®.