Skip to content

Commit

Permalink
Merge tag 'bitmap-6.5-rc5' of https://github.com:/norov/linux
Browse files Browse the repository at this point in the history
Pull bitmap fixes from Yury Norov:

 - Fix for bitmap documentation

 - Fix for kernel build under certain configurations

* tag 'bitmap-6.5-rc5' of https://github.com:/norov/linux:
  lib/bitmap: workaround const_eval test build failure
  cpumask: eliminate kernel-doc warnings
  • Loading branch information
Linus Torvalds committed Aug 3, 2023
2 parents 4b95459 + 2356d19 commit a4e98a3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
8 changes: 6 additions & 2 deletions include/linux/cpumask.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ static inline unsigned int cpumask_first_zero(const struct cpumask *srcp)

/**
* cpumask_first_and - return the first cpu from *srcp1 & *srcp2
* @src1p: the first input
* @src2p: the second input
* @srcp1: the first input
* @srcp2: the second input
*
* Returns >= nr_cpu_ids if no cpus set in both. See also cpumask_next_and().
*/
Expand Down Expand Up @@ -1197,6 +1197,10 @@ cpumap_print_bitmask_to_buf(char *buf, const struct cpumask *mask,
/**
* cpumap_print_list_to_buf - copies the cpumask into the buffer as
* comma-separated list of cpus
* @buf: the buffer to copy into
* @mask: the cpumask to copy
* @off: in the string from which we are copying, we copy to @buf
* @count: the maximum number of bytes to print
*
* Everything is same with the above cpumap_print_bitmask_to_buf()
* except the print format.
Expand Down
6 changes: 6 additions & 0 deletions lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,13 @@ obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_key_base.o
obj-$(CONFIG_TEST_DYNAMIC_DEBUG) += test_dynamic_debug.o
obj-$(CONFIG_TEST_PRINTF) += test_printf.o
obj-$(CONFIG_TEST_SCANF) += test_scanf.o

obj-$(CONFIG_TEST_BITMAP) += test_bitmap.o
ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_KASAN),yy)
# FIXME: Clang breaks test_bitmap_const_eval when KASAN and GCOV are enabled
GCOV_PROFILE_test_bitmap.o := n
endif

obj-$(CONFIG_TEST_UUID) += test_uuid.o
obj-$(CONFIG_TEST_XARRAY) += test_xarray.o
obj-$(CONFIG_TEST_MAPLE_TREE) += test_maple_tree.o
Expand Down
5 changes: 4 additions & 1 deletion lib/cpumask.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ EXPORT_SYMBOL(cpumask_next_wrap);
* alloc_cpumask_var_node - allocate a struct cpumask on a given node
* @mask: pointer to cpumask_var_t where the cpumask is returned
* @flags: GFP_ flags
* @node: memory node from which to allocate or %NUMA_NO_NODE
*
* Only defined when CONFIG_CPUMASK_OFFSTACK=y, otherwise is
* a nop returning a constant 1 (in <linux/cpumask.h>)
Expand Down Expand Up @@ -157,7 +158,9 @@ EXPORT_SYMBOL(cpumask_local_spread);
static DEFINE_PER_CPU(int, distribute_cpu_mask_prev);

/**
* cpumask_any_and_distribute - Return an arbitrary cpu within srcp1 & srcp2.
* cpumask_any_and_distribute - Return an arbitrary cpu within src1p & src2p.
* @src1p: first &cpumask for intersection
* @src2p: second &cpumask for intersection
*
* Iterated calls using the same srcp1 and srcp2 will be distributed within
* their intersection.
Expand Down
8 changes: 4 additions & 4 deletions lib/test_bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,10 @@ static void __init test_bitmap_print_buf(void)
}
}

/*
* FIXME: Clang breaks compile-time evaluations when KASAN and GCOV are enabled.
* To workaround it, GCOV is force-disabled in Makefile for this configuration.
*/
static void __init test_bitmap_const_eval(void)
{
DECLARE_BITMAP(bitmap, BITS_PER_LONG);
Expand All @@ -1186,11 +1190,7 @@ static void __init test_bitmap_const_eval(void)
* the compiler is fixed.
*/
bitmap_clear(bitmap, 0, BITS_PER_LONG);
#if defined(__s390__) && defined(__clang__)
if (!const_test_bit(7, bitmap))
#else
if (!test_bit(7, bitmap))
#endif
bitmap_set(bitmap, 5, 2);

/* Equals to `unsigned long bitopvar = BIT(20)` */
Expand Down

0 comments on commit a4e98a3

Please sign in to comment.