lkml.org 
[lkml]   [2022]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [PATCH 3/5] lib/bitmap: add test for bitmap_{from,to}_arr64
    On Thu, May 19, 2022 at 08:09:29AM -0700, Guenter Roeck wrote:
    > On Thu, Apr 28, 2022 at 01:51:14PM -0700, Yury Norov wrote:
    > > Test newly added bitmap_{from,to}_arr64() functions similarly to
    > > already existing bitmap_{from,to}_arr32() tests.
    > >
    > > Signed-off-by: Yury Norov <yury.norov@gmail.com>
    >
    > With this patch in linux-next (including next-20220519), I see lots of
    > bitmap test errors when booting 32-bit ppc images in qemu. Examples:
    >
    > test_bitmap: [lib/test_bitmap.c:600] bitmaps contents differ: expected "0", got "0,65"
    > ...
    > test_bitmap: [lib/test_bitmap.c:600] bitmaps contents differ: expected "0,65", got "0,65,128"
    > test_bitmap: [lib/test_bitmap.c:600] bitmaps contents differ: expected "0,65", got "0,65,128-129"
    > test_bitmap: [lib/test_bitmap.c:600] bitmaps contents differ: expected "0,65", got "0,65,128-130"
    > ...
    > test_bitmap: [lib/test_bitmap.c:600] bitmaps contents differ: expected "0,65,128-143", got "0,65,128-143,208-209"
    > test_bitmap: [lib/test_bitmap.c:600] bitmaps contents differ: expected "0,65,128-143", got "0,65,128-143,208-210"
    >
    > and so on. It only gets worse from there, and ends with:
    >
    > test_bitmap: parselist: 14: input is '0-2047:128/256' OK, Time: 4274
    > test_bitmap: bitmap_print_to_pagebuf: input is '0-32767
    > ', Time: 127267
    > test_bitmap: failed 337 out of 3801 tests
    >
    > Other architectures and 64-bit ppc builds seem to be fine.

    So, the problem is in previous patch. I'll fold-in the following fix
    into that if no objections.

    diff --git a/lib/bitmap.c b/lib/bitmap.c
    index 52b9912a71ea..97c14845f452 100644
    --- a/lib/bitmap.c
    +++ b/lib/bitmap.c
    @@ -1585,7 +1585,7 @@ void bitmap_to_arr64(u64 *buf, const unsigned long *bitmap, unsigned int nbits)

    /* Clear tail bits in the last element of array beyond nbits. */
    if (nbits % 64)
    - buf[-1] &= GENMASK_ULL(nbits, 0);
    + buf[-1] &= GENMASK_ULL(nbits % 64, 0);
    }
    EXPORT_SYMBOL(bitmap_to_arr64);
    #endif
    \
     
     \ /
      Last update: 2022-05-21 09:42    [W:2.449 / U:0.584 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site