linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: kernel test robot <lkp@intel.com>
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org,
	Michael Ellerman <mpe@ellerman.id.au>
Subject: Re: [linuxppc:next-test 71/141] drivers/net/ethernet/sfc/falcon/farch.c:994:10: warning: shift count is negative
Date: Wed, 1 Sep 2021 15:20:47 +0200	[thread overview]
Message-ID: <f96f87e8-1a9c-a43c-82ef-787de35deef2@csgroup.eu> (raw)
In-Reply-To: <202109011018.QFMpsm0d-lkp@intel.com>



Le 01/09/2021 à 04:54, kernel test robot a écrit :
> tree:   https://github.com/linuxppc/linux next-test
> head:   c7dee506ec3450717e84518ab3a6a3f2ce755cf6
> commit: 1e688dd2a3d6759d416616ff07afc4bb836c4213 [71/141] powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto
> config: powerpc-randconfig-r031-20210901 (attached as .config)
> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 4b1fde8a2b681dad2ce0c082a5d6422caa06b0bc)

Apparently a clang problem. This doesn't happen with GCC.


> 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 powerpc cross compiling tool for clang build
>          # apt-get install binutils-powerpc64-linux-gnu
>          # https://github.com/linuxppc/linux/commit/1e688dd2a3d6759d416616ff07afc4bb836c4213
>          git remote add linuxppc https://github.com/linuxppc/linux
>          git fetch --no-tags linuxppc next-test
>          git checkout 1e688dd2a3d6759d416616ff07afc4bb836c4213
>          # save the attached .config to linux build tree
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc
> 
> 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/net/ethernet/sfc/falcon/farch.c:994:10: warning: shift count is negative [-Wshift-count-negative]
>             WARN_ON(EF4_QWORD_FIELD(*event, FSF_AZ_RX_EV_Q_LABEL) !=
>             ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     drivers/net/ethernet/sfc/falcon/bitfield.h:222:26: note: expanded from macro 'EF4_QWORD_FIELD'
>     #define EF4_QWORD_FIELD         EF4_QWORD_FIELD64
>                                     ^
>     drivers/net/ethernet/sfc/falcon/bitfield.h:173:2: note: expanded from macro 'EF4_QWORD_FIELD64'
>             EF4_EXTRACT_QWORD64(qword, EF4_LOW_BIT(field),          \
>             ^
>     drivers/net/ethernet/sfc/falcon/bitfield.h:149:3: note: expanded from macro 'EF4_EXTRACT_QWORD64'
>             (EF4_EXTRACT64((qword).u64[0], 0, 63, low, high) &              \
>              ^
>     note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
>     arch/powerpc/include/asm/bug.h:122:30: note: expanded from macro 'WARN_ON'
>                                        __label_warn_on, "r" (x));   \
>                                        ~~~~~~~~~~~~~~~~~~~~~~^~~
>     arch/powerpc/include/asm/bug.h:75:7: note: expanded from macro 'WARN_ENTRY'
>                       ##__VA_ARGS__ : : label)
>                       ~~^~~~~~~~~~~~~~~~~~~~~~
>     include/linux/compiler_types.h:254:42: note: expanded from macro 'asm_volatile_goto'
>     #define asm_volatile_goto(x...) asm goto(x)
>                                              ^
>     1 warning generated.


Complete with -fmacro-backtrace-limit=0 :

   CC      drivers/net/ethernet/sfc/falcon/farch.o
drivers/net/ethernet/sfc/falcon/farch.c:994:10: warning: shift count is 
negative [-Wshift-count-negative]
         WARN_ON(EF4_QWORD_FIELD(*event, FSF_AZ_RX_EV_Q_LABEL) !=
         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/sfc/falcon/bitfield.h:222:26: note: expanded from 
macro 'EF4_QWORD_FIELD'
#define EF4_QWORD_FIELD         EF4_QWORD_FIELD64
                                 ^
drivers/net/ethernet/sfc/falcon/bitfield.h:173:2: note: expanded from 
macro 'EF4_QWORD_FIELD64'
         EF4_EXTRACT_QWORD64(qword, EF4_LOW_BIT(field),          \
         ^
drivers/net/ethernet/sfc/falcon/bitfield.h:149:3: note: expanded from 
macro 'EF4_EXTRACT_QWORD64'
         (EF4_EXTRACT64((qword).u64[0], 0, 63, low, high) &              \
          ^
drivers/net/ethernet/sfc/falcon/bitfield.h:134:2: note: expanded from 
macro 'EF4_EXTRACT64'
         EF4_EXTRACT_NATIVE(le64_to_cpu(element), min, max, low, high)
         ^
drivers/net/ethernet/sfc/falcon/bitfield.h:127:20: note: expanded from 
macro 'EF4_EXTRACT_NATIVE'
          (native_element) << ((min) - (low)))
                           ^
./arch/powerpc/include/asm/bug.h:122:30: note: expanded from macro 'WARN_ON'
                                    __label_warn_on, "r" (x));   \
                                    ~~~~~~~~~~~~~~~~~~~~~~^~~
./arch/powerpc/include/asm/bug.h:75:7: note: expanded from macro 
'WARN_ENTRY'
                   ##__VA_ARGS__ : : label)
                   ~~^~~~~~~~~~~~~~~~~~~~~~
./include/linux/compiler_types.h:254:42: note: expanded from macro 
'asm_volatile_goto'
#define asm_volatile_goto(x...) asm goto(x)
                                          ^
1 warning generated.



The warning makes no sense because this part of the macro is as follows 
so there is no way the shift can be negative.

	 (low) > (min) ?					\
	 (native_element) >> ((low) - (min)) :			\
	 (native_element) << ((min) - (low)))


Christophe

      reply	other threads:[~2021-09-01 13:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01  2:54 [linuxppc:next-test 71/141] drivers/net/ethernet/sfc/falcon/farch.c:994:10: warning: shift count is negative kernel test robot
2021-09-01 13:20 ` Christophe Leroy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f96f87e8-1a9c-a43c-82ef-787de35deef2@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=mpe@ellerman.id.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).