* [peterz-queue:x86/wip.extable 1/22] drivers/crypto/ccree/cc_driver.c:117:18: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned shor...
@ 2021-11-05 10:17 kernel test robot
2021-11-05 12:21 ` Peter Zijlstra
0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2021-11-05 10:17 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: llvm, kbuild-all, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 15725 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git x86/wip.extable
head: a4d149db054a77aa35b04bb088f749cbb9a2edea
commit: 4b9e954553a4137f7504e068438851c27edc6b22 [1/22] bitfield.h: Fix "type of reg too small for mask" test
config: riscv-randconfig-r032-20211105 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 847a6807332b13f43704327c2d30103ec0347c77)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?id=4b9e954553a4137f7504e068438851c27edc6b22
git remote add peterz-queue https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git
git fetch --no-tags peterz-queue x86/wip.extable
git checkout 4b9e954553a4137f7504e068438851c27edc6b22
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/crypto/ccree/cc_driver.c:117:18: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (mask)))' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
cache_params |= FIELD_PREP(mask, val);
^~~~~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:111:3: note: expanded from macro 'FIELD_PREP'
__BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:68:53: note: expanded from macro '__BF_FIELD_CHECK'
BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
include/linux/build_bug.h:39:58: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
include/linux/compiler_types.h:322:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:310:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:302:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
drivers/crypto/ccree/cc_driver.c:121:18: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (mask)))' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
cache_params |= FIELD_PREP(mask, val);
^~~~~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:111:3: note: expanded from macro 'FIELD_PREP'
__BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:68:53: note: expanded from macro '__BF_FIELD_CHECK'
BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
include/linux/build_bug.h:39:58: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
include/linux/compiler_types.h:322:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:310:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:302:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
drivers/crypto/ccree/cc_driver.c:125:18: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (mask)))' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
cache_params |= FIELD_PREP(mask, val);
^~~~~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:111:3: note: expanded from macro 'FIELD_PREP'
__BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:68:53: note: expanded from macro '__BF_FIELD_CHECK'
BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
include/linux/build_bug.h:39:58: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
include/linux/compiler_types.h:322:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:310:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:302:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
drivers/crypto/ccree/cc_driver.c:143:15: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (mask)))' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
ace_const |= FIELD_PREP(mask, val);
^~~~~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:111:3: note: expanded from macro 'FIELD_PREP'
__BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:68:53: note: expanded from macro '__BF_FIELD_CHECK'
BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
include/linux/build_bug.h:39:58: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
include/linux/compiler_types.h:322:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:310:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:302:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
drivers/crypto/ccree/cc_driver.c:147:15: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (mask)))' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
ace_const |= FIELD_PREP(mask, val);
^~~~~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:111:3: note: expanded from macro 'FIELD_PREP'
__BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:68:53: note: expanded from macro '__BF_FIELD_CHECK'
BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
include/linux/build_bug.h:39:58: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
include/linux/compiler_types.h:322:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:310:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
vim +117 drivers/crypto/ccree/cc_driver.c
27b3b22dd98cae Gilad Ben-Yossef 2018-02-19 102
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 103 static void init_cc_cache_params(struct cc_drvdata *drvdata)
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 104 {
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 105 struct device *dev = drvdata_to_dev(drvdata);
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 106 u32 cache_params, ace_const, val, mask;
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 107
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 108 /* compute CC_AXIM_CACHE_PARAMS */
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 109 cache_params = cc_ioread(drvdata, CC_REG(AXIM_CACHE_PARAMS));
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 110 dev_dbg(dev, "Cache params previous: 0x%08X\n", cache_params);
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 111
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 112 /* non cached or write-back, write allocate */
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 113 val = drvdata->coherent ? 0xb : 0x2;
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 114
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 115 mask = CC_GENMASK(CC_AXIM_CACHE_PARAMS_AWCACHE);
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 116 cache_params &= ~mask;
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 @117 cache_params |= FIELD_PREP(mask, val);
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 118
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 119 mask = CC_GENMASK(CC_AXIM_CACHE_PARAMS_AWCACHE_LAST);
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 120 cache_params &= ~mask;
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 121 cache_params |= FIELD_PREP(mask, val);
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 122
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 123 mask = CC_GENMASK(CC_AXIM_CACHE_PARAMS_ARCACHE);
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 124 cache_params &= ~mask;
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 125 cache_params |= FIELD_PREP(mask, val);
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 126
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 127 drvdata->cache_params = cache_params;
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 128
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 129 dev_dbg(dev, "Cache params current: 0x%08X\n", cache_params);
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 130
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 131 if (drvdata->hw_rev <= CC_HW_REV_710)
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 132 return;
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 133
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 134 /* compute CC_AXIM_ACE_CONST */
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 135 ace_const = cc_ioread(drvdata, CC_REG(AXIM_ACE_CONST));
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 136 dev_dbg(dev, "ACE-const previous: 0x%08X\n", ace_const);
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 137
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 138 /* system or outer-sharable */
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 139 val = drvdata->coherent ? 0x2 : 0x3;
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 140
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 141 mask = CC_GENMASK(CC_AXIM_ACE_CONST_ARDOMAIN);
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 142 ace_const &= ~mask;
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 143 ace_const |= FIELD_PREP(mask, val);
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 144
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 145 mask = CC_GENMASK(CC_AXIM_ACE_CONST_AWDOMAIN);
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 146 ace_const &= ~mask;
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 147 ace_const |= FIELD_PREP(mask, val);
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 148
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 149 dev_dbg(dev, "ACE-const current: 0x%08X\n", ace_const);
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 150
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 151 drvdata->ace_const = ace_const;
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 152 }
05c2a705917b77 Gilad Ben-Yossef 2020-11-22 153
:::::: The code at line 117 was first introduced by commit
:::::: 05c2a705917b77e0915cca3551583583f4eafcf8 crypto: ccree - rework cache parameters handling
:::::: TO: Gilad Ben-Yossef <gilad@benyossef.com>
:::::: CC: Herbert Xu <herbert@gondor.apana.org.au>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 42835 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [peterz-queue:x86/wip.extable 1/22] drivers/crypto/ccree/cc_driver.c:117:18: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned shor...
2021-11-05 10:17 [peterz-queue:x86/wip.extable 1/22] drivers/crypto/ccree/cc_driver.c:117:18: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned shor kernel test robot
@ 2021-11-05 12:21 ` Peter Zijlstra
2021-11-05 21:06 ` Nick Desaulniers
0 siblings, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2021-11-05 12:21 UTC (permalink / raw)
To: kernel test robot; +Cc: llvm, kbuild-all, linux-kernel
On Fri, Nov 05, 2021 at 06:17:44PM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git x86/wip.extable
> head: a4d149db054a77aa35b04bb088f749cbb9a2edea
> commit: 4b9e954553a4137f7504e068438851c27edc6b22 [1/22] bitfield.h: Fix "type of reg too small for mask" test
> config: riscv-randconfig-r032-20211105 (attached as .config)
> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 847a6807332b13f43704327c2d30103ec0347c77)
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # install riscv cross compiling tool for clang build
> # apt-get install binutils-riscv64-linux-gnu
> # https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?id=4b9e954553a4137f7504e068438851c27edc6b22
> git remote add peterz-queue https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git
> git fetch --no-tags peterz-queue x86/wip.extable
> git checkout 4b9e954553a4137f7504e068438851c27edc6b22
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
>
> >> drivers/crypto/ccree/cc_driver.c:117:18: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (mask)))' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
> cache_params |= FIELD_PREP(mask, val);
> ^~~~~~~~~~~~~~~~~~~~~
> include/linux/bitfield.h:111:3: note: expanded from macro 'FIELD_PREP'
> __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/bitfield.h:68:53: note: expanded from macro '__BF_FIELD_CHECK'
> BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
> include/linux/build_bug.h:39:58: note: expanded from macro 'BUILD_BUG_ON_MSG'
> #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
> include/linux/compiler_types.h:322:22: note: expanded from macro 'compiletime_assert'
> _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
> ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/compiler_types.h:310:23: note: expanded from macro '_compiletime_assert'
> __compiletime_assert(condition, msg, prefix, suffix)
> ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/compiler_types.h:302:9: note: expanded from macro '__compiletime_assert'
> if (!(condition)) \
> ^~~~~~~~~
I'm confused here.. the code reads:
#define __scalar_type_to_unsigned_cases(type) \
unsigned type: (unsigned type)0, \
signed type: (unsigned type)0
#define __unsigned_scalar_typeof(x) typeof( \
_Generic((x), \
char: (unsigned char)0, \
__scalar_type_to_unsigned_cases(char), \
__scalar_type_to_unsigned_cases(short), \
__scalar_type_to_unsigned_cases(int), \
__scalar_type_to_unsigned_cases(long), \
__scalar_type_to_unsigned_cases(long long), \
default: (x)))
#define __bf_cast_unsigned(type, x) ((__unsigned_scalar_typeof(type))(x))
#define __BF_FIELD_CHECK(_mask, _reg, _val, _pfx) \
({ \
BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask), \
_pfx "mask is not constant"); \
BUILD_BUG_ON_MSG((_mask) == 0, _pfx "mask is zero"); \
BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \
~((_mask) >> __bf_shf(_mask)) & (_val) : 0, \
_pfx "value too large for the field"); \
BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \
__bf_cast_unsigned(_reg, ~0ull), \
_pfx "type of reg too small for mask"); \
__BUILD_BUG_ON_NOT_POWER_OF_2((_mask) + \
(1ULL << __bf_shf(_mask))); \
})
#define FIELD_PREP(_mask, _val) \
({ \
__BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask); \
})
static void init_cc_cache_params(struct cc_drvdata *drvdata)
{
struct device *dev = drvdata_to_dev(drvdata);
u32 cache_params, ace_const, val, mask;
...
mask = CC_GENMASK(CC_AXIM_CACHE_PARAMS_AWCACHE); <-- *BOOM*
cache_params &= ~mask;
cache_params |= FIELD_PREP(mask, val);
...
}
So we're having "(unsigned int)mask > (unsigned long long)~0ull" as
a compile time constant input to the BUILD_BUG_ON_MSG(), and clang-14 is
now complaining it's a constant ?!?
It is that by design.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [peterz-queue:x86/wip.extable 1/22] drivers/crypto/ccree/cc_driver.c:117:18: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned shor...
2021-11-05 12:21 ` Peter Zijlstra
@ 2021-11-05 21:06 ` Nick Desaulniers
2021-11-06 0:34 ` Peter Zijlstra
0 siblings, 1 reply; 4+ messages in thread
From: Nick Desaulniers @ 2021-11-05 21:06 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: kernel test robot, llvm, kbuild-all, linux-kernel
On Fri, Nov 5, 2021 at 5:21 AM Peter Zijlstra <peterz@infradead.org> wrote:
>
> On Fri, Nov 05, 2021 at 06:17:44PM +0800, kernel test robot wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git x86/wip.extable
> > head: a4d149db054a77aa35b04bb088f749cbb9a2edea
> > commit: 4b9e954553a4137f7504e068438851c27edc6b22 [1/22] bitfield.h: Fix "type of reg too small for mask" test
> > config: riscv-randconfig-r032-20211105 (attached as .config)
> > compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 847a6807332b13f43704327c2d30103ec0347c77)
> > reproduce (this is a W=1 build):
> > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > chmod +x ~/bin/make.cross
> > # install riscv cross compiling tool for clang build
> > # apt-get install binutils-riscv64-linux-gnu
> > # https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?id=4b9e954553a4137f7504e068438851c27edc6b22
> > git remote add peterz-queue https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git
> > git fetch --no-tags peterz-queue x86/wip.extable
> > git checkout 4b9e954553a4137f7504e068438851c27edc6b22
> > # save the attached .config to linux build tree
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> >
> > All warnings (new ones prefixed by >>):
> >
> > >> drivers/crypto/ccree/cc_driver.c:117:18: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (mask)))' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
> > cache_params |= FIELD_PREP(mask, val);
> > ^~~~~~~~~~~~~~~~~~~~~
> > include/linux/bitfield.h:111:3: note: expanded from macro 'FIELD_PREP'
> > __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > include/linux/bitfield.h:68:53: note: expanded from macro '__BF_FIELD_CHECK'
> > BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
> > include/linux/build_bug.h:39:58: note: expanded from macro 'BUILD_BUG_ON_MSG'
> > #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
> > ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
> > include/linux/compiler_types.h:322:22: note: expanded from macro 'compiletime_assert'
> > _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
> > ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > include/linux/compiler_types.h:310:23: note: expanded from macro '_compiletime_assert'
> > __compiletime_assert(condition, msg, prefix, suffix)
> > ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > include/linux/compiler_types.h:302:9: note: expanded from macro '__compiletime_assert'
> > if (!(condition)) \
> > ^~~~~~~~~
>
> I'm confused here.. the code reads:
>
>
> #define __scalar_type_to_unsigned_cases(type) \
> unsigned type: (unsigned type)0, \
> signed type: (unsigned type)0
>
> #define __unsigned_scalar_typeof(x) typeof( \
> _Generic((x), \
> char: (unsigned char)0, \
> __scalar_type_to_unsigned_cases(char), \
> __scalar_type_to_unsigned_cases(short), \
> __scalar_type_to_unsigned_cases(int), \
> __scalar_type_to_unsigned_cases(long), \
> __scalar_type_to_unsigned_cases(long long), \
> default: (x)))
>
> #define __bf_cast_unsigned(type, x) ((__unsigned_scalar_typeof(type))(x))
>
> #define __BF_FIELD_CHECK(_mask, _reg, _val, _pfx) \
> ({ \
> BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask), \
> _pfx "mask is not constant"); \
> BUILD_BUG_ON_MSG((_mask) == 0, _pfx "mask is zero"); \
> BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \
> ~((_mask) >> __bf_shf(_mask)) & (_val) : 0, \
> _pfx "value too large for the field"); \
> BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \
> __bf_cast_unsigned(_reg, ~0ull), \
> _pfx "type of reg too small for mask"); \
> __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) + \
> (1ULL << __bf_shf(_mask))); \
> })
>
> #define FIELD_PREP(_mask, _val) \
> ({ \
> __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
> ((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask); \
> })
>
>
> static void init_cc_cache_params(struct cc_drvdata *drvdata)
> {
> struct device *dev = drvdata_to_dev(drvdata);
> u32 cache_params, ace_const, val, mask;
>
> ...
>
> mask = CC_GENMASK(CC_AXIM_CACHE_PARAMS_AWCACHE); <-- *BOOM*
> cache_params &= ~mask;
> cache_params |= FIELD_PREP(mask, val);
>
> ...
> }
>
> So we're having "(unsigned int)mask > (unsigned long long)~0ull" as
> a compile time constant input to the BUILD_BUG_ON_MSG(), and clang-14 is
> now complaining it's a constant ?!?
No, the error message (trimmed for clarity):
>> warning: result of comparison of constant 18446744073709551615 (ie ~0ull / ULLONG_MAX) with expression of type ... 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
Is `val` an int, but should be a long long? We're comparing if an
unsigned int is greater than ULLONG_MAX, which is impossible (or
rather a tautology; something that's always either true or false, in
this case false). Or maybe mask and reg are different widths?
>
> It is that by design.
>
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [peterz-queue:x86/wip.extable 1/22] drivers/crypto/ccree/cc_driver.c:117:18: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned shor...
2021-11-05 21:06 ` Nick Desaulniers
@ 2021-11-06 0:34 ` Peter Zijlstra
0 siblings, 0 replies; 4+ messages in thread
From: Peter Zijlstra @ 2021-11-06 0:34 UTC (permalink / raw)
To: Nick Desaulniers; +Cc: kernel test robot, llvm, kbuild-all, linux-kernel
On Fri, Nov 05, 2021 at 02:06:22PM -0700, Nick Desaulniers wrote:
> On Fri, Nov 5, 2021 at 5:21 AM Peter Zijlstra <peterz@infradead.org> wrote:
> > I'm confused here.. the code reads:
> >
> >
> > #define __scalar_type_to_unsigned_cases(type) \
> > unsigned type: (unsigned type)0, \
> > signed type: (unsigned type)0
> >
> > #define __unsigned_scalar_typeof(x) typeof( \
> > _Generic((x), \
> > char: (unsigned char)0, \
> > __scalar_type_to_unsigned_cases(char), \
> > __scalar_type_to_unsigned_cases(short), \
> > __scalar_type_to_unsigned_cases(int), \
> > __scalar_type_to_unsigned_cases(long), \
> > __scalar_type_to_unsigned_cases(long long), \
> > default: (x)))
> >
> > #define __bf_cast_unsigned(type, x) ((__unsigned_scalar_typeof(type))(x))
> >
> > #define __BF_FIELD_CHECK(_mask, _reg, _val, _pfx) \
> > ({ \
> > BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask), \
> > _pfx "mask is not constant"); \
> > BUILD_BUG_ON_MSG((_mask) == 0, _pfx "mask is zero"); \
> > BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \
> > ~((_mask) >> __bf_shf(_mask)) & (_val) : 0, \
> > _pfx "value too large for the field"); \
> > BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \
> > __bf_cast_unsigned(_reg, ~0ull), \
> > _pfx "type of reg too small for mask"); \
> > __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) + \
> > (1ULL << __bf_shf(_mask))); \
> > })
> >
> > #define FIELD_PREP(_mask, _val) \
> > ({ \
> > __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
> > ((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask); \
> > })
> >
> >
> > static void init_cc_cache_params(struct cc_drvdata *drvdata)
> > {
> > struct device *dev = drvdata_to_dev(drvdata);
> > u32 cache_params, ace_const, val, mask;
> >
> > ...
> >
> > mask = CC_GENMASK(CC_AXIM_CACHE_PARAMS_AWCACHE); <-- *BOOM*
> > cache_params &= ~mask;
> > cache_params |= FIELD_PREP(mask, val);
> >
> > ...
> > }
> >
> > So we're having "(unsigned int)mask > (unsigned long long)~0ull" as
> > a compile time constant input to the BUILD_BUG_ON_MSG(), and clang-14 is
> > now complaining it's a constant ?!?
>
> No, the error message (trimmed for clarity):
> >> warning: result of comparison of constant 18446744073709551615 (ie ~0ull / ULLONG_MAX) with expression of type ... 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
>
> Is `val` an int, but should be a long long? We're comparing if an
> unsigned int is greater than ULLONG_MAX, which is impossible (or
> rather a tautology; something that's always either true or false, in
> this case false). Or maybe mask and reg are different widths?
They are, for FIELD_PREP() as is the case here, _mask is u32 while _reg
is typeof(0ULL). In my reading of the code this is on purpose to
basically disable the test for this caller.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-06 0:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05 10:17 [peterz-queue:x86/wip.extable 1/22] drivers/crypto/ccree/cc_driver.c:117:18: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mask), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned shor kernel test robot
2021-11-05 12:21 ` Peter Zijlstra
2021-11-05 21:06 ` Nick Desaulniers
2021-11-06 0:34 ` Peter Zijlstra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).