Re: [PATCH v2 1/2] asm-generic: Unify uapi bitsperlong.h for arm64, riscv and loongarch

From: kernel test robot
Date: Wed Jun 21 2023 - 16:05:27 EST


Hi Tiezhu,

kernel test robot noticed the following build warnings:

[auto build test WARNING on arnd-asm-generic/master]
[also build test WARNING on soc/for-next arm64/for-next/core linus/master v6.4-rc7 next-20230621]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Tiezhu-Yang/asm-generic-Unify-uapi-bitsperlong-h-for-arm64-riscv-and-loongarch/20230621-172223
base: https://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git master
patch link: https://lore.kernel.org/r/1687336748-4898-2-git-send-email-yangtiezhu%40loongson.cn
patch subject: [PATCH v2 1/2] asm-generic: Unify uapi bitsperlong.h for arm64, riscv and loongarch
config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20230622/202306220334.C80BpATp-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
reproduce: (https://download.01.org/0day-ci/archive/20230622/202306220334.C80BpATp-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306220334.C80BpATp-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

In file included from lib/kunit/test.c:9:
In file included from include/kunit/resource.h:12:
In file included from include/kunit/test.h:12:
In file included from include/kunit/assert.h:12:
In file included from include/linux/err.h:5:
In file included from include/linux/compiler.h:246:
In file included from ./arch/x86/include/generated/asm/rwonce.h:1:
In file included from include/asm-generic/rwonce.h:26:
In file included from include/linux/kasan-checks.h:5:
In file included from include/linux/types.h:6:
In file included from include/uapi/linux/types.h:5:
In file included from ./arch/x86/include/generated/uapi/asm/types.h:1:
In file included from include/uapi/asm-generic/types.h:7:
In file included from include/asm-generic/int-ll64.h:11:
In file included from include/uapi/asm-generic/int-ll64.h:12:
In file included from arch/x86/include/uapi/asm/bitsperlong.h:11:
In file included from include/asm-generic/bitsperlong.h:5:
>> include/uapi/asm-generic/bitsperlong.h:13:9: warning: '__BITS_PER_LONG' macro redefined [-Wmacro-redefined]
#define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
^
arch/x86/include/uapi/asm/bitsperlong.h:6:10: note: previous definition is here
# define __BITS_PER_LONG 64
^
1 warning generated.
--
>> include/uapi/asm-generic/bitsperlong.h:13:9: warning: '__BITS_PER_LONG' macro redefined [-Wmacro-redefined], err: false
--
In file included from lib/decompress_inflate.c:21:
In file included from include/linux/zutil.h:17:
In file included from include/linux/string.h:5:
In file included from include/linux/compiler.h:246:
In file included from ./arch/x86/include/generated/asm/rwonce.h:1:
In file included from include/asm-generic/rwonce.h:26:
In file included from include/linux/kasan-checks.h:5:
In file included from include/linux/types.h:6:
In file included from include/uapi/linux/types.h:5:
In file included from ./arch/x86/include/generated/uapi/asm/types.h:1:
In file included from include/uapi/asm-generic/types.h:7:
In file included from include/asm-generic/int-ll64.h:11:
In file included from include/uapi/asm-generic/int-ll64.h:12:
In file included from arch/x86/include/uapi/asm/bitsperlong.h:11:
In file included from include/asm-generic/bitsperlong.h:5:
>> include/uapi/asm-generic/bitsperlong.h:13:9: warning: '__BITS_PER_LONG' macro redefined [-Wmacro-redefined]
#define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
^
arch/x86/include/uapi/asm/bitsperlong.h:6:10: note: previous definition is here
# define __BITS_PER_LONG 64
^
lib/decompress_inflate.c:42:17: warning: no previous prototype for function '__gunzip' [-Wmissing-prototypes]
STATIC int INIT __gunzip(unsigned char *buf, long len,
^
lib/decompress_inflate.c:42:8: note: declare 'static' if the function is not intended to be used outside of this translation unit
STATIC int INIT __gunzip(unsigned char *buf, long len,
^
static
2 warnings generated.
--
In file included from lib/decompress_unxz.c:107:
In file included from include/linux/decompress/mm.h:79:
In file included from include/linux/kernel.h:16:
In file included from include/linux/limits.h:6:
In file included from include/linux/types.h:6:
In file included from include/uapi/linux/types.h:5:
In file included from ./arch/x86/include/generated/uapi/asm/types.h:1:
In file included from include/uapi/asm-generic/types.h:7:
In file included from include/asm-generic/int-ll64.h:11:
In file included from include/uapi/asm-generic/int-ll64.h:12:
In file included from arch/x86/include/uapi/asm/bitsperlong.h:11:
In file included from include/asm-generic/bitsperlong.h:5:
>> include/uapi/asm-generic/bitsperlong.h:13:9: warning: '__BITS_PER_LONG' macro redefined [-Wmacro-redefined]
#define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
^
arch/x86/include/uapi/asm/bitsperlong.h:6:10: note: previous definition is here
# define __BITS_PER_LONG 64
^
lib/decompress_unxz.c:251:17: warning: no previous prototype for function 'unxz' [-Wmissing-prototypes]
STATIC int INIT unxz(unsigned char *in, long in_size,
^
lib/decompress_unxz.c:251:8: note: declare 'static' if the function is not intended to be used outside of this translation unit
STATIC int INIT unxz(unsigned char *in, long in_size,
^
static
2 warnings generated.
--
In file included from lib/decompress_unzstd.c:74:
In file included from include/linux/decompress/mm.h:79:
In file included from include/linux/kernel.h:16:
In file included from include/linux/limits.h:6:
In file included from include/linux/types.h:6:
In file included from include/uapi/linux/types.h:5:
In file included from ./arch/x86/include/generated/uapi/asm/types.h:1:
In file included from include/uapi/asm-generic/types.h:7:
In file included from include/asm-generic/int-ll64.h:11:
In file included from include/uapi/asm-generic/int-ll64.h:12:
In file included from arch/x86/include/uapi/asm/bitsperlong.h:11:
In file included from include/asm-generic/bitsperlong.h:5:
>> include/uapi/asm-generic/bitsperlong.h:13:9: warning: '__BITS_PER_LONG' macro redefined [-Wmacro-redefined]
#define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
^
arch/x86/include/uapi/asm/bitsperlong.h:6:10: note: previous definition is here
# define __BITS_PER_LONG 64
^
lib/decompress_unzstd.c:331:17: warning: no previous prototype for function 'unzstd' [-Wmissing-prototypes]
STATIC int INIT unzstd(unsigned char *buf, long len,
^
lib/decompress_unzstd.c:331:8: note: declare 'static' if the function is not intended to be used outside of this translation unit
STATIC int INIT unzstd(unsigned char *buf, long len,
^
static
2 warnings generated.
--
In file included from lib/maple_tree.c:54:
In file included from include/linux/maple_tree.h:11:
In file included from include/linux/kernel.h:16:
In file included from include/linux/limits.h:6:
In file included from include/linux/types.h:6:
In file included from include/uapi/linux/types.h:5:
In file included from ./arch/x86/include/generated/uapi/asm/types.h:1:
In file included from include/uapi/asm-generic/types.h:7:
In file included from include/asm-generic/int-ll64.h:11:
In file included from include/uapi/asm-generic/int-ll64.h:12:
In file included from arch/x86/include/uapi/asm/bitsperlong.h:11:
In file included from include/asm-generic/bitsperlong.h:5:
>> include/uapi/asm-generic/bitsperlong.h:13:9: warning: '__BITS_PER_LONG' macro redefined [-Wmacro-redefined]
#define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
^
arch/x86/include/uapi/asm/bitsperlong.h:6:10: note: previous definition is here
# define __BITS_PER_LONG 64
^
lib/maple_tree.c:331:21: warning: unused function 'mte_set_full' [-Wunused-function]
static inline void *mte_set_full(const struct maple_enode *node)
^
lib/maple_tree.c:336:21: warning: unused function 'mte_clear_full' [-Wunused-function]
static inline void *mte_clear_full(const struct maple_enode *node)
^
lib/maple_tree.c:341:20: warning: unused function 'mte_has_null' [-Wunused-function]
static inline bool mte_has_null(const struct maple_enode *node)
^
4 warnings generated.
--
In file included from lib/radix-tree.c:12:
In file included from include/linux/bitmap.h:8:
In file included from include/linux/bitops.h:5:
In file included from ./arch/x86/include/generated/uapi/asm/types.h:1:
In file included from include/uapi/asm-generic/types.h:7:
In file included from include/asm-generic/int-ll64.h:11:
In file included from include/uapi/asm-generic/int-ll64.h:12:
In file included from arch/x86/include/uapi/asm/bitsperlong.h:11:
In file included from include/asm-generic/bitsperlong.h:5:
>> include/uapi/asm-generic/bitsperlong.h:13:9: warning: '__BITS_PER_LONG' macro redefined [-Wmacro-redefined]
#define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
^
arch/x86/include/uapi/asm/bitsperlong.h:6:10: note: previous definition is here
# define __BITS_PER_LONG 64
^
lib/radix-tree.c:288:6: warning: no previous prototype for function 'radix_tree_node_rcu_free' [-Wmissing-prototypes]
void radix_tree_node_rcu_free(struct rcu_head *head)
^
lib/radix-tree.c:288:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void radix_tree_node_rcu_free(struct rcu_head *head)
^
static
lib/radix-tree.c:1134:50: warning: parameter 'slot' set but not used [-Wunused-but-set-parameter]
void __rcu **radix_tree_iter_resume(void __rcu **slot,
^
3 warnings generated.
--
In file included from lib/zstd/compress/huf_compress.c:23:
In file included from lib/zstd/compress/../common/zstd_deps.h:29:
In file included from include/linux/limits.h:6:
In file included from include/linux/types.h:6:
In file included from include/uapi/linux/types.h:5:
In file included from ./arch/x86/include/generated/uapi/asm/types.h:1:
In file included from include/uapi/asm-generic/types.h:7:
In file included from include/asm-generic/int-ll64.h:11:
In file included from include/uapi/asm-generic/int-ll64.h:12:
In file included from arch/x86/include/uapi/asm/bitsperlong.h:11:
In file included from include/asm-generic/bitsperlong.h:5:
>> include/uapi/asm-generic/bitsperlong.h:13:9: warning: '__BITS_PER_LONG' macro redefined [-Wmacro-redefined]
#define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
^
arch/x86/include/uapi/asm/bitsperlong.h:6:10: note: previous definition is here
# define __BITS_PER_LONG 64
^
lib/zstd/compress/huf_compress.c:471:16: warning: unused function 'HUF_isSorted' [-Wunused-function]
MEM_STATIC int HUF_isSorted(nodeElt huffNode[], U32 const maxSymbolValue1) {
^
2 warnings generated.
--
In file included from lib/zstd/compress/zstd_lazy.c:11:
In file included from lib/zstd/compress/zstd_compress_internal.h:21:
In file included from lib/zstd/compress/../common/zstd_internal.h:23:
In file included from lib/zstd/compress/../common/cpu.h:19:
In file included from lib/zstd/compress/../common/mem.h:18:
In file included from ./arch/x86/include/generated/asm/unaligned.h:1:
In file included from include/asm-generic/unaligned.h:9:
In file included from include/linux/unaligned/packed_struct.h:4:
In file included from include/linux/types.h:6:
In file included from include/uapi/linux/types.h:5:
In file included from ./arch/x86/include/generated/uapi/asm/types.h:1:
In file included from include/uapi/asm-generic/types.h:7:
In file included from include/asm-generic/int-ll64.h:11:
In file included from include/uapi/asm-generic/int-ll64.h:12:
In file included from arch/x86/include/uapi/asm/bitsperlong.h:11:
In file included from include/asm-generic/bitsperlong.h:5:
>> include/uapi/asm-generic/bitsperlong.h:13:9: warning: '__BITS_PER_LONG' macro redefined [-Wmacro-redefined]
#define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
^
arch/x86/include/uapi/asm/bitsperlong.h:6:10: note: previous definition is here
# define __BITS_PER_LONG 64
^
lib/zstd/compress/zstd_lazy.c:835:16: warning: unused function 'ZSTD_isAligned' [-Wunused-function]
MEM_STATIC int ZSTD_isAligned(void const* ptr, size_t align) {
^
2 warnings generated.
--
In file included from arch/x86/kernel/cpu/common.c:5:
In file included from include/linux/memblock.h:11:
In file included from include/linux/init.h:5:
In file included from include/linux/build_bug.h:5:
In file included from include/linux/compiler.h:246:
In file included from ./arch/x86/include/generated/asm/rwonce.h:1:
In file included from include/asm-generic/rwonce.h:26:
In file included from include/linux/kasan-checks.h:5:
In file included from include/linux/types.h:6:
In file included from include/uapi/linux/types.h:5:
In file included from ./arch/x86/include/generated/uapi/asm/types.h:1:
In file included from include/uapi/asm-generic/types.h:7:
In file included from include/asm-generic/int-ll64.h:11:
In file included from include/uapi/asm-generic/int-ll64.h:12:
In file included from arch/x86/include/uapi/asm/bitsperlong.h:11:
In file included from include/asm-generic/bitsperlong.h:5:
>> include/uapi/asm-generic/bitsperlong.h:13:9: warning: '__BITS_PER_LONG' macro redefined [-Wmacro-redefined]
#define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
^
arch/x86/include/uapi/asm/bitsperlong.h:6:10: note: previous definition is here
# define __BITS_PER_LONG 64
^
arch/x86/kernel/cpu/common.c:366:19: warning: unused function 'flag_is_changeable_p' [-Wunused-function]
static inline int flag_is_changeable_p(u32 flag)
^
2 warnings generated.
--
In file included from lib/mpi/mpi-inv.c:20:
In file included from lib/mpi/mpi-internal.h:20:
In file included from include/linux/module.h:12:
In file included from include/linux/list.h:5:
In file included from include/linux/container_of.h:5:
In file included from include/linux/build_bug.h:5:
In file included from include/linux/compiler.h:246:
In file included from ./arch/x86/include/generated/asm/rwonce.h:1:
In file included from include/asm-generic/rwonce.h:26:
In file included from include/linux/kasan-checks.h:5:
In file included from include/linux/types.h:6:
In file included from include/uapi/linux/types.h:5:
In file included from ./arch/x86/include/generated/uapi/asm/types.h:1:
In file included from include/uapi/asm-generic/types.h:7:
In file included from include/asm-generic/int-ll64.h:11:
In file included from include/uapi/asm-generic/int-ll64.h:12:
In file included from arch/x86/include/uapi/asm/bitsperlong.h:11:
In file included from include/asm-generic/bitsperlong.h:5:
>> include/uapi/asm-generic/bitsperlong.h:13:9: warning: '__BITS_PER_LONG' macro redefined [-Wmacro-redefined]
#define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
^
arch/x86/include/uapi/asm/bitsperlong.h:6:10: note: previous definition is here
# define __BITS_PER_LONG 64
^
lib/mpi/mpi-inv.c:34:15: warning: variable 'k' set but not used [-Wunused-but-set-variable]
unsigned int k;
^
2 warnings generated.
..


vim +/__BITS_PER_LONG +13 include/uapi/asm-generic/bitsperlong.h

4
5 /*
6 * In order to keep safe and avoid regression, only unify uapi
7 * bitsperlong.h for some archs which are using newer toolchains
8 * that have the definitions of __CHAR_BIT__ and __SIZEOF_LONG__.
9 * See the following link for more info:
10 * https://lore.kernel.org/linux-arch/b9624545-2c80-49a1-ac3c-39264a591f7b@xxxxxxxxxxxxxxxx/
11 */
12 #if defined(__CHAR_BIT__) && defined(__SIZEOF_LONG__)
> 13 #define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
14 #else
15 /*
16 * There seems to be no way of detecting this automatically from user
17 * space, so 64 bit architectures should override this in their
18 * bitsperlong.h. In particular, an architecture that supports
19 * both 32 and 64 bit user space must not rely on CONFIG_64BIT
20 * to decide it, but rather check a compiler provided macro.
21 */
22 #ifndef __BITS_PER_LONG
23 #define __BITS_PER_LONG 32
24 #endif
25 #endif
26

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki