Skip to content

Commit ad8258e

Browse files
committed
Merge tag 'bitmap-6.5-rc1' of https://github.com/norov/linux
Pull bitmap updates from Yury Norov: "Fixes for different bitmap pieces: - lib/test_bitmap: increment failure counter properly The tests that don't use expect_eq() macro to determine that a test is failured must increment failed_tests explicitly. - lib/bitmap: drop optimization of bitmap_{from,to}_arr64 bitmap_{from,to}_arr64() optimization is overly optimistic on 32-bit LE architectures when it's wired to bitmap_copy_clear_tail(). - nodemask: Drop duplicate check in for_each_node_mask() As the return value type of first_node() became unsigned, the node >= 0 became unnecessary. - cpumask: fix function description kernel-doc notation - MAINTAINERS: Add bits.h and bitfield.h to the BITMAP API record Add linux/bits.h and linux/bitfield.h for visibility" * tag 'bitmap-6.5-rc1' of https://github.com/norov/linux: MAINTAINERS: Add bitfield.h to the BITMAP API record MAINTAINERS: Add bits.h to the BITMAP API record cpumask: fix function description kernel-doc notation nodemask: Drop duplicate check in for_each_node_mask() lib/bitmap: drop optimization of bitmap_{from,to}_arr64 lib/test_bitmap: increment failure counter properly
2 parents 8689f4f + 2a3110e commit ad8258e

File tree

6 files changed

+27
-11
lines changed

6 files changed

+27
-11
lines changed

MAINTAINERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3499,18 +3499,24 @@ M: Yury Norov <[email protected]>
34993499
R: Andy Shevchenko <[email protected]>
35003500
R: Rasmus Villemoes <[email protected]>
35013501
S: Maintained
3502+
F: include/linux/bitfield.h
35023503
F: include/linux/bitmap.h
3504+
F: include/linux/bits.h
35033505
F: include/linux/cpumask.h
35043506
F: include/linux/find.h
35053507
F: include/linux/nodemask.h
3508+
F: include/vdso/bits.h
35063509
F: lib/bitmap.c
35073510
F: lib/cpumask.c
35083511
F: lib/cpumask_kunit.c
35093512
F: lib/find_bit.c
35103513
F: lib/find_bit_benchmark.c
35113514
F: lib/test_bitmap.c
3515+
F: tools/include/linux/bitfield.h
35123516
F: tools/include/linux/bitmap.h
3517+
F: tools/include/linux/bits.h
35133518
F: tools/include/linux/find.h
3519+
F: tools/include/vdso/bits.h
35143520
F: tools/lib/bitmap.c
35153521
F: tools/lib/find_bit.c
35163522

include/linux/bitmap.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,12 +302,10 @@ void bitmap_to_arr32(u32 *buf, const unsigned long *bitmap,
302302
#endif
303303

304304
/*
305-
* On 64-bit systems bitmaps are represented as u64 arrays internally. On LE32
306-
* machines the order of hi and lo parts of numbers match the bitmap structure.
307-
* In both cases conversion is not needed when copying data from/to arrays of
308-
* u64.
305+
* On 64-bit systems bitmaps are represented as u64 arrays internally. So,
306+
* the conversion is not needed when copying data from/to arrays of u64.
309307
*/
310-
#if (BITS_PER_LONG == 32) && defined(__BIG_ENDIAN)
308+
#if BITS_PER_LONG == 32
311309
void bitmap_from_arr64(unsigned long *bitmap, const u64 *buf, unsigned int nbits);
312310
void bitmap_to_arr64(u64 *buf, const unsigned long *bitmap, unsigned int nbits);
313311
#else

include/linux/nodemask.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ static inline void __nodes_fold(nodemask_t *dstp, const nodemask_t *origp,
385385
#if MAX_NUMNODES > 1
386386
#define for_each_node_mask(node, mask) \
387387
for ((node) = first_node(mask); \
388-
(node >= 0) && (node) < MAX_NUMNODES; \
388+
(node) < MAX_NUMNODES; \
389389
(node) = next_node((node), (mask)))
390390
#else /* MAX_NUMNODES == 1 */
391391
#define for_each_node_mask(node, mask) \

lib/bitmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,7 @@ void bitmap_to_arr32(u32 *buf, const unsigned long *bitmap, unsigned int nbits)
14951495
EXPORT_SYMBOL(bitmap_to_arr32);
14961496
#endif
14971497

1498-
#if (BITS_PER_LONG == 32) && defined(__BIG_ENDIAN)
1498+
#if BITS_PER_LONG == 32
14991499
/**
15001500
* bitmap_from_arr64 - copy the contents of u64 array of bits to bitmap
15011501
* @bitmap: array of unsigned longs, the destination bitmap

lib/cpumask.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ EXPORT_SYMBOL(cpumask_local_spread);
157157
static DEFINE_PER_CPU(int, distribute_cpu_mask_prev);
158158

159159
/**
160-
* Returns an arbitrary cpu within srcp1 & srcp2.
160+
* cpumask_any_and_distribute - Return an arbitrary cpu within srcp1 & srcp2.
161161
*
162162
* Iterated calls using the same srcp1 and srcp2 will be distributed within
163163
* their intersection.

lib/test_bitmap.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ static void __init test_bitmap_parselist(void)
470470
if (err != ptest.errno) {
471471
pr_err("parselist: %d: input is %s, errno is %d, expected %d\n",
472472
i, ptest.in, err, ptest.errno);
473+
failed_tests++;
473474
continue;
474475
}
475476

@@ -478,6 +479,7 @@ static void __init test_bitmap_parselist(void)
478479
pr_err("parselist: %d: input is %s, result is 0x%lx, expected 0x%lx\n",
479480
i, ptest.in, bmap[0],
480481
*ptest.expected);
482+
failed_tests++;
481483
continue;
482484
}
483485

@@ -511,11 +513,13 @@ static void __init test_bitmap_printlist(void)
511513

512514
if (ret != slen + 1) {
513515
pr_err("bitmap_print_to_pagebuf: result is %d, expected %d\n", ret, slen);
516+
failed_tests++;
514517
goto out;
515518
}
516519

517520
if (strncmp(buf, expected, slen)) {
518521
pr_err("bitmap_print_to_pagebuf: result is %s, expected %s\n", buf, expected);
522+
failed_tests++;
519523
goto out;
520524
}
521525

@@ -583,6 +587,7 @@ static void __init test_bitmap_parse(void)
583587
if (err != test.errno) {
584588
pr_err("parse: %d: input is %s, errno is %d, expected %d\n",
585589
i, test.in, err, test.errno);
590+
failed_tests++;
586591
continue;
587592
}
588593

@@ -591,6 +596,7 @@ static void __init test_bitmap_parse(void)
591596
pr_err("parse: %d: input is %s, result is 0x%lx, expected 0x%lx\n",
592597
i, test.in, bmap[0],
593598
*test.expected);
599+
failed_tests++;
594600
continue;
595601
}
596602

@@ -615,10 +621,12 @@ static void __init test_bitmap_arr32(void)
615621

616622
next_bit = find_next_bit(bmap2,
617623
round_up(nbits, BITS_PER_LONG), nbits);
618-
if (next_bit < round_up(nbits, BITS_PER_LONG))
624+
if (next_bit < round_up(nbits, BITS_PER_LONG)) {
619625
pr_err("bitmap_copy_arr32(nbits == %d:"
620626
" tail is not safely cleared: %d\n",
621627
nbits, next_bit);
628+
failed_tests++;
629+
}
622630

623631
if (nbits < EXP1_IN_BITS - 32)
624632
expect_eq_uint(arr[DIV_ROUND_UP(nbits, 32)],
@@ -641,15 +649,19 @@ static void __init test_bitmap_arr64(void)
641649
expect_eq_bitmap(bmap2, exp1, nbits);
642650

643651
next_bit = find_next_bit(bmap2, round_up(nbits, BITS_PER_LONG), nbits);
644-
if (next_bit < round_up(nbits, BITS_PER_LONG))
652+
if (next_bit < round_up(nbits, BITS_PER_LONG)) {
645653
pr_err("bitmap_copy_arr64(nbits == %d:"
646654
" tail is not safely cleared: %d\n", nbits, next_bit);
655+
failed_tests++;
656+
}
647657

648658
if ((nbits % 64) &&
649-
(arr[(nbits - 1) / 64] & ~GENMASK_ULL((nbits - 1) % 64, 0)))
659+
(arr[(nbits - 1) / 64] & ~GENMASK_ULL((nbits - 1) % 64, 0))) {
650660
pr_err("bitmap_to_arr64(nbits == %d): tail is not safely cleared: 0x%016llx (must be 0x%016llx)\n",
651661
nbits, arr[(nbits - 1) / 64],
652662
GENMASK_ULL((nbits - 1) % 64, 0));
663+
failed_tests++;
664+
}
653665

654666
if (nbits < EXP1_IN_BITS - 64)
655667
expect_eq_uint(arr[DIV_ROUND_UP(nbits, 64)], 0xa5a5a5a5);

0 commit comments

Comments
 (0)