[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdmW+n_g4C_pXnF+8wh2q0gZZyXAfaYR9cVNm3p1QeJ-xA@mail.gmail.com>
Date: Fri, 18 Sep 2020 12:39:26 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Gilad Ben-Yossef <gilad@...yossef.com>
Cc: kernel test robot <lkp@...el.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
Rob Herring <robh+dt@...nel.org>, kbuild-all@...ts.01.org,
clang-built-linux <clang-built-linux@...glegroups.com>,
Network Development <netdev@...r.kernel.org>,
Ofir Drang <ofir.drang@....com>,
Linux Crypto Mailing List <linux-crypto@...r.kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@...r.kernel.org>,
Linux kernel mailing list <linux-kernel@...r.kernel.org>,
Sami Tolvanen <samitolvanen@...gle.com>,
Alex Elder <elder@...aro.org>, Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH 2/2] crypto: ccree - add custom cache params from DT file
On Thu, Sep 17, 2020 at 12:20 AM Gilad Ben-Yossef <gilad@...yossef.com> wrote:
>
> hmm...
>
> On Wed, Sep 16, 2020 at 4:48 PM kernel test robot <lkp@...el.com> wrote:
> >
> > url: https://github.com/0day-ci/linux/commits/Gilad-Ben-Yossef/add-optional-cache-params-from-DT/20200916-152151
> > base: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
> > config: arm64-randconfig-r015-20200916 (attached as .config)
> > compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 9e3842d60351f986d77dfe0a94f76e4fd895f188)
> > 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 arm64 cross compiling tool for clang build
> > # apt-get install binutils-aarch64-linux-gnu
> > # save the attached .config to linux build tree
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@...el.com>
> >
> > All warnings (new ones prefixed by >>):
> >
> > >> drivers/crypto/ccree/cc_driver.c:120:18: warning: result of comparison of constant 18446744073709551615 with expression of type 'u32' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
> > cache_params |= FIELD_PREP(mask, val);
> > ^~~~~~~~~~~~~~~~~~~~~
> > include/linux/bitfield.h:94:3: note: expanded from macro 'FIELD_PREP'
> > __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > include/linux/bitfield.h:52:28: note: expanded from macro '__BF_FIELD_CHECK'
> > BUILD_BUG_ON_MSG((_mask) > (typeof(_reg))~0ull, \
> > ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > 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:319:22: note: expanded from macro 'compiletime_assert'
> > _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
> > ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > include/linux/compiler_types.h:307:23: note: expanded from macro '_compiletime_assert'
> > __compiletime_assert(condition, msg, prefix, suffix)
> > ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > include/linux/compiler_types.h:299:9: note: expanded from macro '__compiletime_assert'
> > if (!(condition)) \
> > ^~~~~~~~~
>
> I am unable to understand this warning. It looks like it is
> complaining about a FIELD_GET sanity check that is always false, which
> makes sense since we're using a constant.
>
> Anyone can enlighten me if I've missed something?
Looked at some of this code recently. I think it may have an issue
for masks where sizeof(mask) < sizeof(unsigned long long).
In your code, via 0day bot:
107 u32 cache_params, ace_const, val, mask;
...
> 120 cache_params |= FIELD_PREP(mask, val);
then in include/linux/bitfield.h, we have:
92 #define FIELD_PREP(_mask, _val) \
93 ({ \
94 __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
44 #define __BF_FIELD_CHECK(_mask, _reg, _val, _pfx) \
...
52 BUILD_BUG_ON_MSG((_mask) > (typeof(_reg))~0ull, \
53 _pfx "type of reg too small for mask"); \
so the 0ULL in FIELD_PREP is important. In __BF_FIELD_CHECK, the
typeof(_reg) is unsigned long long (because 0ULL was passed). So we
have a comparison between a u32 and a u64; indeed any u32 can never be
greater than a u64 that we know has the value of ULLONG_MAX.
I did send a series splitting these up, I wonder if they'd help here:
https://lore.kernel.org/lkml/20200708230402.1644819-3-ndesaulniers@google.com/
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists