Hi John,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
[also build test WARNING on net/master sparc-next/master linus/master v5.8 next-20200813]
[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]
url:
https://github.com/0day-ci/linux/commits/John-Ogness/af_packet-TPACKET_V3...
base:
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
bfdd5aaa54b0a44d9df550fe4c9db7e1470a11b8
config: i386-randconfig-s002-20200813 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-168-g9554805c-dirty
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
> net/packet/af_packet.c:1008:13: sparse: sparse: context imbalance
in '__packet_lookup_frame_in_block' - different lock contexts for basic block
> net/packet/af_packet.c:2402:17: sparse: sparse: context imbalance in
'tpacket_rcv' - unexpected unlock
vim +/__packet_lookup_frame_in_block +1008 net/packet/af_packet.c
f6fb8f100b80737 chetan loke 2011-08-19 1006
f6fb8f100b80737 chetan loke 2011-08-19 1007 /* Assumes caller has the
sk->rx_queue.lock */
f6fb8f100b80737 chetan loke 2011-08-19 @1008 static void
*__packet_lookup_frame_in_block(struct packet_sock *po,
f6fb8f100b80737 chetan loke 2011-08-19 1009 struct sk_buff *skb,
f6fb8f100b80737 chetan loke 2011-08-19 1010 unsigned int len
f6fb8f100b80737 chetan loke 2011-08-19 1011 )
f6fb8f100b80737 chetan loke 2011-08-19 1012 {
bc59ba399113fcb chetan loke 2011-08-25 1013 struct tpacket_kbdq_core *pkc;
bc59ba399113fcb chetan loke 2011-08-25 1014 struct tpacket_block_desc *pbd;
f6fb8f100b80737 chetan loke 2011-08-19 1015 char *curr, *end;
f6fb8f100b80737 chetan loke 2011-08-19 1016
e3192690a3c8897 Joe Perches 2012-06-03 1017 pkc =
GET_PBDQC_FROM_RB(&po->rx_ring);
f6fb8f100b80737 chetan loke 2011-08-19 1018 pbd = GET_CURR_PBLOCK_DESC_FROM_CORE(pkc);
f6fb8f100b80737 chetan loke 2011-08-19 1019
f6fb8f100b80737 chetan loke 2011-08-19 1020 /* Queue is frozen when user space is
lagging behind */
f6fb8f100b80737 chetan loke 2011-08-19 1021 if (prb_queue_frozen(pkc)) {
f6fb8f100b80737 chetan loke 2011-08-19 1022 /*
f6fb8f100b80737 chetan loke 2011-08-19 1023 * Check if that last block which caused
the queue to freeze,
f6fb8f100b80737 chetan loke 2011-08-19 1024 * is still in_use by user-space.
f6fb8f100b80737 chetan loke 2011-08-19 1025 */
878cd3ba37f77de Rosen, Rami 2017-05-24 1026 if (prb_curr_blk_in_use(pbd)) {
f6fb8f100b80737 chetan loke 2011-08-19 1027 /* Can't record this packet */
f6fb8f100b80737 chetan loke 2011-08-19 1028 return NULL;
f6fb8f100b80737 chetan loke 2011-08-19 1029 } else {
f6fb8f100b80737 chetan loke 2011-08-19 1030 /*
f6fb8f100b80737 chetan loke 2011-08-19 1031 * Ok, the block was released by
user-space.
f6fb8f100b80737 chetan loke 2011-08-19 1032 * Now let's open that block.
f6fb8f100b80737 chetan loke 2011-08-19 1033 * opening a block also thaws the queue.
f6fb8f100b80737 chetan loke 2011-08-19 1034 * Thawing is a side effect.
f6fb8f100b80737 chetan loke 2011-08-19 1035 */
f6fb8f100b80737 chetan loke 2011-08-19 1036 prb_open_block(pkc, pbd);
f6fb8f100b80737 chetan loke 2011-08-19 1037 }
f6fb8f100b80737 chetan loke 2011-08-19 1038 }
f6fb8f100b80737 chetan loke 2011-08-19 1039
f6fb8f100b80737 chetan loke 2011-08-19 1040 smp_mb();
f6fb8f100b80737 chetan loke 2011-08-19 1041 curr = pkc->nxt_offset;
f6fb8f100b80737 chetan loke 2011-08-19 1042 pkc->skb = skb;
e3192690a3c8897 Joe Perches 2012-06-03 1043 end = (char *)pbd + pkc->kblk_size;
f6fb8f100b80737 chetan loke 2011-08-19 1044
f6fb8f100b80737 chetan loke 2011-08-19 1045 /* first try the current block */
f6fb8f100b80737 chetan loke 2011-08-19 1046 if (curr+TOTAL_PKT_LEN_INCL_ALIGN(len) <
end) {
f6fb8f100b80737 chetan loke 2011-08-19 1047 prb_fill_curr_block(curr, pkc, pbd, len);
f6fb8f100b80737 chetan loke 2011-08-19 1048 return (void *)curr;
f6fb8f100b80737 chetan loke 2011-08-19 1049 }
f6fb8f100b80737 chetan loke 2011-08-19 1050
f6fb8f100b80737 chetan loke 2011-08-19 1051 /* Ok, close the current block */
f6fb8f100b80737 chetan loke 2011-08-19 1052 prb_retire_current_block(pkc, po, 0);
f6fb8f100b80737 chetan loke 2011-08-19 1053
f6fb8f100b80737 chetan loke 2011-08-19 1054 /* Now, try to dispatch the next block */
f6fb8f100b80737 chetan loke 2011-08-19 1055 curr = (char *)prb_dispatch_next_block(pkc,
po);
f6fb8f100b80737 chetan loke 2011-08-19 1056 if (curr) {
f6fb8f100b80737 chetan loke 2011-08-19 1057 pbd =
GET_CURR_PBLOCK_DESC_FROM_CORE(pkc);
f6fb8f100b80737 chetan loke 2011-08-19 1058 prb_fill_curr_block(curr, pkc, pbd, len);
f6fb8f100b80737 chetan loke 2011-08-19 1059 return (void *)curr;
f6fb8f100b80737 chetan loke 2011-08-19 1060 }
f6fb8f100b80737 chetan loke 2011-08-19 1061
f6fb8f100b80737 chetan loke 2011-08-19 1062 /*
f6fb8f100b80737 chetan loke 2011-08-19 1063 * No free blocks are available.user_space
hasn't caught up yet.
f6fb8f100b80737 chetan loke 2011-08-19 1064 * Queue was just frozen and now this
packet will get dropped.
f6fb8f100b80737 chetan loke 2011-08-19 1065 */
f6fb8f100b80737 chetan loke 2011-08-19 1066 return NULL;
f6fb8f100b80737 chetan loke 2011-08-19 1067 }
f6fb8f100b80737 chetan loke 2011-08-19 1068
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org