Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+27 -11
+6
MAINTAINERS
··· 3499 3499 R: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 3500 3500 R: Rasmus Villemoes <linux@rasmusvillemoes.dk> 3501 3501 S: Maintained 3502 + F: include/linux/bitfield.h 3502 3503 F: include/linux/bitmap.h 3504 + F: include/linux/bits.h 3503 3505 F: include/linux/cpumask.h 3504 3506 F: include/linux/find.h 3505 3507 F: include/linux/nodemask.h 3508 + F: include/vdso/bits.h 3506 3509 F: lib/bitmap.c 3507 3510 F: lib/cpumask.c 3508 3511 F: lib/cpumask_kunit.c 3509 3512 F: lib/find_bit.c 3510 3513 F: lib/find_bit_benchmark.c 3511 3514 F: lib/test_bitmap.c 3515 + F: tools/include/linux/bitfield.h 3512 3516 F: tools/include/linux/bitmap.h 3517 + F: tools/include/linux/bits.h 3513 3518 F: tools/include/linux/find.h 3519 + F: tools/include/vdso/bits.h 3514 3520 F: tools/lib/bitmap.c 3515 3521 F: tools/lib/find_bit.c 3516 3522
+3 -5
include/linux/bitmap.h
··· 302 302 #endif 303 303 304 304 /* 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. 309 307 */ 310 - #if (BITS_PER_LONG == 32) && defined(__BIG_ENDIAN) 308 + #if BITS_PER_LONG == 32 311 309 void bitmap_from_arr64(unsigned long *bitmap, const u64 *buf, unsigned int nbits); 312 310 void bitmap_to_arr64(u64 *buf, const unsigned long *bitmap, unsigned int nbits); 313 311 #else
+1 -1
include/linux/nodemask.h
··· 385 385 #if MAX_NUMNODES > 1 386 386 #define for_each_node_mask(node, mask) \ 387 387 for ((node) = first_node(mask); \ 388 - (node >= 0) && (node) < MAX_NUMNODES; \ 388 + (node) < MAX_NUMNODES; \ 389 389 (node) = next_node((node), (mask))) 390 390 #else /* MAX_NUMNODES == 1 */ 391 391 #define for_each_node_mask(node, mask) \
+1 -1
lib/bitmap.c
··· 1495 1495 EXPORT_SYMBOL(bitmap_to_arr32); 1496 1496 #endif 1497 1497 1498 - #if (BITS_PER_LONG == 32) && defined(__BIG_ENDIAN) 1498 + #if BITS_PER_LONG == 32 1499 1499 /** 1500 1500 * bitmap_from_arr64 - copy the contents of u64 array of bits to bitmap 1501 1501 * @bitmap: array of unsigned longs, the destination bitmap
+1 -1
lib/cpumask.c
··· 157 157 static DEFINE_PER_CPU(int, distribute_cpu_mask_prev); 158 158 159 159 /** 160 - * Returns an arbitrary cpu within srcp1 & srcp2. 160 + * cpumask_any_and_distribute - Return an arbitrary cpu within srcp1 & srcp2. 161 161 * 162 162 * Iterated calls using the same srcp1 and srcp2 will be distributed within 163 163 * their intersection.
+15 -3
lib/test_bitmap.c
··· 470 470 if (err != ptest.errno) { 471 471 pr_err("parselist: %d: input is %s, errno is %d, expected %d\n", 472 472 i, ptest.in, err, ptest.errno); 473 + failed_tests++; 473 474 continue; 474 475 } 475 476 ··· 479 478 pr_err("parselist: %d: input is %s, result is 0x%lx, expected 0x%lx\n", 480 479 i, ptest.in, bmap[0], 481 480 *ptest.expected); 481 + failed_tests++; 482 482 continue; 483 483 } 484 484 ··· 513 511 514 512 if (ret != slen + 1) { 515 513 pr_err("bitmap_print_to_pagebuf: result is %d, expected %d\n", ret, slen); 514 + failed_tests++; 516 515 goto out; 517 516 } 518 517 519 518 if (strncmp(buf, expected, slen)) { 520 519 pr_err("bitmap_print_to_pagebuf: result is %s, expected %s\n", buf, expected); 520 + failed_tests++; 521 521 goto out; 522 522 } 523 523 ··· 587 583 if (err != test.errno) { 588 584 pr_err("parse: %d: input is %s, errno is %d, expected %d\n", 589 585 i, test.in, err, test.errno); 586 + failed_tests++; 590 587 continue; 591 588 } 592 589 ··· 596 591 pr_err("parse: %d: input is %s, result is 0x%lx, expected 0x%lx\n", 597 592 i, test.in, bmap[0], 598 593 *test.expected); 594 + failed_tests++; 599 595 continue; 600 596 } 601 597 ··· 621 615 622 616 next_bit = find_next_bit(bmap2, 623 617 round_up(nbits, BITS_PER_LONG), nbits); 624 - if (next_bit < round_up(nbits, BITS_PER_LONG)) 618 + if (next_bit < round_up(nbits, BITS_PER_LONG)) { 625 619 pr_err("bitmap_copy_arr32(nbits == %d:" 626 620 " tail is not safely cleared: %d\n", 627 621 nbits, next_bit); 622 + failed_tests++; 623 + } 628 624 629 625 if (nbits < EXP1_IN_BITS - 32) 630 626 expect_eq_uint(arr[DIV_ROUND_UP(nbits, 32)], ··· 649 641 expect_eq_bitmap(bmap2, exp1, nbits); 650 642 651 643 next_bit = find_next_bit(bmap2, round_up(nbits, BITS_PER_LONG), nbits); 652 - if (next_bit < round_up(nbits, BITS_PER_LONG)) 644 + if (next_bit < round_up(nbits, BITS_PER_LONG)) { 653 645 pr_err("bitmap_copy_arr64(nbits == %d:" 654 646 " tail is not safely cleared: %d\n", nbits, next_bit); 647 + failed_tests++; 648 + } 655 649 656 650 if ((nbits % 64) && 657 - (arr[(nbits - 1) / 64] & ~GENMASK_ULL((nbits - 1) % 64, 0))) 651 + (arr[(nbits - 1) / 64] & ~GENMASK_ULL((nbits - 1) % 64, 0))) { 658 652 pr_err("bitmap_to_arr64(nbits == %d): tail is not safely cleared: 0x%016llx (must be 0x%016llx)\n", 659 653 nbits, arr[(nbits - 1) / 64], 660 654 GENMASK_ULL((nbits - 1) % 64, 0)); 655 + failed_tests++; 656 + } 661 657 662 658 if (nbits < EXP1_IN_BITS - 64) 663 659 expect_eq_uint(arr[DIV_ROUND_UP(nbits, 64)], 0xa5a5a5a5);