LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [linuxppc:next-test 71/141] drivers/net/ethernet/sfc/falcon/farch.c:994:10: warning: shift count is negative
@ 2021-09-01 2:54 kernel test robot
2021-09-01 13:20 ` Christophe Leroy
0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2021-09-01 2:54 UTC (permalink / raw)
To: Christophe Leroy; +Cc: llvm, kbuild-all, linux-kernel, Michael Ellerman
[-- Attachment #1: Type: text/plain, Size: 12602 bytes --]
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)
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.
vim +994 drivers/net/ethernet/sfc/falcon/farch.c
5a6681e22c1409 Edward Cree 2016-11-28 970
5a6681e22c1409 Edward Cree 2016-11-28 971 /* Handle a packet received event
5a6681e22c1409 Edward Cree 2016-11-28 972 *
5a6681e22c1409 Edward Cree 2016-11-28 973 * The NIC gives a "discard" flag if it's a unicast packet with the
5a6681e22c1409 Edward Cree 2016-11-28 974 * wrong destination address
5a6681e22c1409 Edward Cree 2016-11-28 975 * Also "is multicast" and "matches multicast filter" flags can be used to
5a6681e22c1409 Edward Cree 2016-11-28 976 * discard non-matching multicast packets.
5a6681e22c1409 Edward Cree 2016-11-28 977 */
5a6681e22c1409 Edward Cree 2016-11-28 978 static void
5a6681e22c1409 Edward Cree 2016-11-28 979 ef4_farch_handle_rx_event(struct ef4_channel *channel, const ef4_qword_t *event)
5a6681e22c1409 Edward Cree 2016-11-28 980 {
5a6681e22c1409 Edward Cree 2016-11-28 981 unsigned int rx_ev_desc_ptr, rx_ev_byte_cnt;
5a6681e22c1409 Edward Cree 2016-11-28 982 unsigned int rx_ev_hdr_type, rx_ev_mcast_pkt;
5a6681e22c1409 Edward Cree 2016-11-28 983 unsigned expected_ptr;
5a6681e22c1409 Edward Cree 2016-11-28 984 bool rx_ev_pkt_ok, rx_ev_sop, rx_ev_cont;
5a6681e22c1409 Edward Cree 2016-11-28 985 u16 flags;
5a6681e22c1409 Edward Cree 2016-11-28 986 struct ef4_rx_queue *rx_queue;
5a6681e22c1409 Edward Cree 2016-11-28 987 struct ef4_nic *efx = channel->efx;
5a6681e22c1409 Edward Cree 2016-11-28 988
6aa7de059173a9 Mark Rutland 2017-10-23 989 if (unlikely(READ_ONCE(efx->reset_pending)))
5a6681e22c1409 Edward Cree 2016-11-28 990 return;
5a6681e22c1409 Edward Cree 2016-11-28 991
5a6681e22c1409 Edward Cree 2016-11-28 992 rx_ev_cont = EF4_QWORD_FIELD(*event, FSF_AZ_RX_EV_JUMBO_CONT);
5a6681e22c1409 Edward Cree 2016-11-28 993 rx_ev_sop = EF4_QWORD_FIELD(*event, FSF_AZ_RX_EV_SOP);
5a6681e22c1409 Edward Cree 2016-11-28 @994 WARN_ON(EF4_QWORD_FIELD(*event, FSF_AZ_RX_EV_Q_LABEL) !=
5a6681e22c1409 Edward Cree 2016-11-28 995 channel->channel);
5a6681e22c1409 Edward Cree 2016-11-28 996
5a6681e22c1409 Edward Cree 2016-11-28 997 rx_queue = ef4_channel_get_rx_queue(channel);
5a6681e22c1409 Edward Cree 2016-11-28 998
5a6681e22c1409 Edward Cree 2016-11-28 999 rx_ev_desc_ptr = EF4_QWORD_FIELD(*event, FSF_AZ_RX_EV_DESC_PTR);
5a6681e22c1409 Edward Cree 2016-11-28 1000 expected_ptr = ((rx_queue->removed_count + rx_queue->scatter_n) &
5a6681e22c1409 Edward Cree 2016-11-28 1001 rx_queue->ptr_mask);
5a6681e22c1409 Edward Cree 2016-11-28 1002
5a6681e22c1409 Edward Cree 2016-11-28 1003 /* Check for partial drops and other errors */
5a6681e22c1409 Edward Cree 2016-11-28 1004 if (unlikely(rx_ev_desc_ptr != expected_ptr) ||
5a6681e22c1409 Edward Cree 2016-11-28 1005 unlikely(rx_ev_sop != (rx_queue->scatter_n == 0))) {
5a6681e22c1409 Edward Cree 2016-11-28 1006 if (rx_ev_desc_ptr != expected_ptr &&
5a6681e22c1409 Edward Cree 2016-11-28 1007 !ef4_farch_handle_rx_bad_index(rx_queue, rx_ev_desc_ptr))
5a6681e22c1409 Edward Cree 2016-11-28 1008 return;
5a6681e22c1409 Edward Cree 2016-11-28 1009
5a6681e22c1409 Edward Cree 2016-11-28 1010 /* Discard all pending fragments */
5a6681e22c1409 Edward Cree 2016-11-28 1011 if (rx_queue->scatter_n) {
5a6681e22c1409 Edward Cree 2016-11-28 1012 ef4_rx_packet(
5a6681e22c1409 Edward Cree 2016-11-28 1013 rx_queue,
5a6681e22c1409 Edward Cree 2016-11-28 1014 rx_queue->removed_count & rx_queue->ptr_mask,
5a6681e22c1409 Edward Cree 2016-11-28 1015 rx_queue->scatter_n, 0, EF4_RX_PKT_DISCARD);
5a6681e22c1409 Edward Cree 2016-11-28 1016 rx_queue->removed_count += rx_queue->scatter_n;
5a6681e22c1409 Edward Cree 2016-11-28 1017 rx_queue->scatter_n = 0;
5a6681e22c1409 Edward Cree 2016-11-28 1018 }
5a6681e22c1409 Edward Cree 2016-11-28 1019
5a6681e22c1409 Edward Cree 2016-11-28 1020 /* Return if there is no new fragment */
5a6681e22c1409 Edward Cree 2016-11-28 1021 if (rx_ev_desc_ptr != expected_ptr)
5a6681e22c1409 Edward Cree 2016-11-28 1022 return;
5a6681e22c1409 Edward Cree 2016-11-28 1023
5a6681e22c1409 Edward Cree 2016-11-28 1024 /* Discard new fragment if not SOP */
5a6681e22c1409 Edward Cree 2016-11-28 1025 if (!rx_ev_sop) {
5a6681e22c1409 Edward Cree 2016-11-28 1026 ef4_rx_packet(
5a6681e22c1409 Edward Cree 2016-11-28 1027 rx_queue,
5a6681e22c1409 Edward Cree 2016-11-28 1028 rx_queue->removed_count & rx_queue->ptr_mask,
5a6681e22c1409 Edward Cree 2016-11-28 1029 1, 0, EF4_RX_PKT_DISCARD);
5a6681e22c1409 Edward Cree 2016-11-28 1030 ++rx_queue->removed_count;
5a6681e22c1409 Edward Cree 2016-11-28 1031 return;
5a6681e22c1409 Edward Cree 2016-11-28 1032 }
5a6681e22c1409 Edward Cree 2016-11-28 1033 }
5a6681e22c1409 Edward Cree 2016-11-28 1034
5a6681e22c1409 Edward Cree 2016-11-28 1035 ++rx_queue->scatter_n;
5a6681e22c1409 Edward Cree 2016-11-28 1036 if (rx_ev_cont)
5a6681e22c1409 Edward Cree 2016-11-28 1037 return;
5a6681e22c1409 Edward Cree 2016-11-28 1038
5a6681e22c1409 Edward Cree 2016-11-28 1039 rx_ev_byte_cnt = EF4_QWORD_FIELD(*event, FSF_AZ_RX_EV_BYTE_CNT);
5a6681e22c1409 Edward Cree 2016-11-28 1040 rx_ev_pkt_ok = EF4_QWORD_FIELD(*event, FSF_AZ_RX_EV_PKT_OK);
5a6681e22c1409 Edward Cree 2016-11-28 1041 rx_ev_hdr_type = EF4_QWORD_FIELD(*event, FSF_AZ_RX_EV_HDR_TYPE);
5a6681e22c1409 Edward Cree 2016-11-28 1042
5a6681e22c1409 Edward Cree 2016-11-28 1043 if (likely(rx_ev_pkt_ok)) {
5a6681e22c1409 Edward Cree 2016-11-28 1044 /* If packet is marked as OK then we can rely on the
5a6681e22c1409 Edward Cree 2016-11-28 1045 * hardware checksum and classification.
5a6681e22c1409 Edward Cree 2016-11-28 1046 */
5a6681e22c1409 Edward Cree 2016-11-28 1047 flags = 0;
5a6681e22c1409 Edward Cree 2016-11-28 1048 switch (rx_ev_hdr_type) {
5a6681e22c1409 Edward Cree 2016-11-28 1049 case FSE_CZ_RX_EV_HDR_TYPE_IPV4V6_TCP:
5a6681e22c1409 Edward Cree 2016-11-28 1050 flags |= EF4_RX_PKT_TCP;
df561f6688fef7 Gustavo A. R. Silva 2020-08-23 1051 fallthrough;
5a6681e22c1409 Edward Cree 2016-11-28 1052 case FSE_CZ_RX_EV_HDR_TYPE_IPV4V6_UDP:
5a6681e22c1409 Edward Cree 2016-11-28 1053 flags |= EF4_RX_PKT_CSUMMED;
df561f6688fef7 Gustavo A. R. Silva 2020-08-23 1054 fallthrough;
5a6681e22c1409 Edward Cree 2016-11-28 1055 case FSE_CZ_RX_EV_HDR_TYPE_IPV4V6_OTHER:
5a6681e22c1409 Edward Cree 2016-11-28 1056 case FSE_AZ_RX_EV_HDR_TYPE_OTHER:
5a6681e22c1409 Edward Cree 2016-11-28 1057 break;
5a6681e22c1409 Edward Cree 2016-11-28 1058 }
5a6681e22c1409 Edward Cree 2016-11-28 1059 } else {
5a6681e22c1409 Edward Cree 2016-11-28 1060 flags = ef4_farch_handle_rx_not_ok(rx_queue, event);
5a6681e22c1409 Edward Cree 2016-11-28 1061 }
5a6681e22c1409 Edward Cree 2016-11-28 1062
5a6681e22c1409 Edward Cree 2016-11-28 1063 /* Detect multicast packets that didn't match the filter */
5a6681e22c1409 Edward Cree 2016-11-28 1064 rx_ev_mcast_pkt = EF4_QWORD_FIELD(*event, FSF_AZ_RX_EV_MCAST_PKT);
5a6681e22c1409 Edward Cree 2016-11-28 1065 if (rx_ev_mcast_pkt) {
5a6681e22c1409 Edward Cree 2016-11-28 1066 unsigned int rx_ev_mcast_hash_match =
5a6681e22c1409 Edward Cree 2016-11-28 1067 EF4_QWORD_FIELD(*event, FSF_AZ_RX_EV_MCAST_HASH_MATCH);
5a6681e22c1409 Edward Cree 2016-11-28 1068
5a6681e22c1409 Edward Cree 2016-11-28 1069 if (unlikely(!rx_ev_mcast_hash_match)) {
5a6681e22c1409 Edward Cree 2016-11-28 1070 ++channel->n_rx_mcast_mismatch;
5a6681e22c1409 Edward Cree 2016-11-28 1071 flags |= EF4_RX_PKT_DISCARD;
5a6681e22c1409 Edward Cree 2016-11-28 1072 }
5a6681e22c1409 Edward Cree 2016-11-28 1073 }
5a6681e22c1409 Edward Cree 2016-11-28 1074
5a6681e22c1409 Edward Cree 2016-11-28 1075 channel->irq_mod_score += 2;
5a6681e22c1409 Edward Cree 2016-11-28 1076
5a6681e22c1409 Edward Cree 2016-11-28 1077 /* Handle received packet */
5a6681e22c1409 Edward Cree 2016-11-28 1078 ef4_rx_packet(rx_queue,
5a6681e22c1409 Edward Cree 2016-11-28 1079 rx_queue->removed_count & rx_queue->ptr_mask,
5a6681e22c1409 Edward Cree 2016-11-28 1080 rx_queue->scatter_n, rx_ev_byte_cnt, flags);
5a6681e22c1409 Edward Cree 2016-11-28 1081 rx_queue->removed_count += rx_queue->scatter_n;
5a6681e22c1409 Edward Cree 2016-11-28 1082 rx_queue->scatter_n = 0;
5a6681e22c1409 Edward Cree 2016-11-28 1083 }
5a6681e22c1409 Edward Cree 2016-11-28 1084
:::::: The code at line 994 was first introduced by commit
:::::: 5a6681e22c1409089132085811857d6da828761b sfc: separate out SFC4000 ("Falcon") support into new sfc-falcon driver
:::::: TO: Edward Cree <ecree@solarflare.com>
:::::: CC: David S. Miller <davem@davemloft.net>
---
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: 35247 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [linuxppc:next-test 71/141] drivers/net/ethernet/sfc/falcon/farch.c:994:10: warning: shift count is negative
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
0 siblings, 0 replies; 2+ messages in thread
From: Christophe Leroy @ 2021-09-01 13:20 UTC (permalink / raw)
To: kernel test robot; +Cc: llvm, kbuild-all, linux-kernel, Michael Ellerman
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-09-01 13:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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).