[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7bc3a332-10f7-4a31-33ce-7507a2791bf3@intel.com>
Date: Fri, 20 May 2022 16:40:26 +0800
From: "Chen, Rong A" <rong.a.chen@...el.com>
To: Eric Dumazet <edumazet@...gle.com>,
kernel test robot <lkp@...el.com>
Cc: Eric Dumazet <eric.dumazet@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, llvm@...ts.linux.dev,
kbuild-all@...ts.01.org, netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next 10/10] inet: add READ_ONCE(sk->sk_bound_dev_if)
in INET_MATCH()
On 5/13/2022 12:13 AM, Eric Dumazet wrote:
> On Thu, May 12, 2022 at 6:16 AM kernel test robot <lkp@...el.com> wrote:
>>
>> Hi Eric,
>>
>> I love your patch! Perhaps something to improve:
>>
>> [auto build test WARNING on net-next/master]
>>
>> url: https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/net-add-annotations-for-sk-sk_bound_dev_if/20220512-073914
>> base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git b57c7e8b76c646cf77ce4353a779a8b781592209
>> config: hexagon-randconfig-r035-20220512 (https://download.01.org/0day-ci/archive/20220512/202205122132.HUrst9JA-lkp@intel.com/config)
>> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 18dd123c56754edf62c7042dcf23185c3727610f)
>> 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
>> # https://github.com/intel-lab-lkp/linux/commit/c92cfd9f3ecb483ff055edb02f7498494b96ba68
>> git remote add linux-review https://github.com/intel-lab-lkp/linux
>> git fetch --no-tags linux-review Eric-Dumazet/net-add-annotations-for-sk-sk_bound_dev_if/20220512-073914
>> git checkout c92cfd9f3ecb483ff055edb02f7498494b96ba68
>> # save the config file
>> mkdir build_dir && cp config build_dir/.config
>> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash net/ipv4/
>
> Thank you for the instructions.
> Unfortunately this is failing for me.
Hi Eric,
Can you share the problem you met?
Best Regards,
Rong Chen
>
> I have tested ARCH=i386 before sending the series, I am not sure what
> the issue is for ARCH=hexagon and the cross compiler.
>
> Maybe __always_unused is not yet understood for this combination.
>
> It might be the time to just use __addrpair even on 32bit arches...
>
> Then we can remove saddr,daddr args from INET_MATCH()
>
> diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
> index 5d3fa071d754601149c9ad0dd559f074ac58deaa..34ddb54506dd02e702dd20cbe8b7dba006130c5a
> 100644
> --- a/include/net/inet_hashtables.h
> +++ b/include/net/inet_hashtables.h
> @@ -295,7 +295,6 @@ static inline struct sock
> *inet_lookup_listener(struct net *net,
> ((__force __portpair)(((__u32)(__dport) << 16) | (__force
> __u32)(__be16)(__sport)))
> #endif
>
> -#if (BITS_PER_LONG == 64)
> #ifdef __BIG_ENDIAN
> #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
> const __addrpair __name = (__force __addrpair) ( \
> @@ -325,30 +324,6 @@ static inline bool INET_MATCH(const struct sock
> *sk, struct net *net,
> bound_dev_if = READ_ONCE(sk->sk_bound_dev_if);
> return bound_dev_if == dif || bound_dev_if == sdif;
> }
> -#else /* 32-bit arch */
> -#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
> - const int __name __deprecated __always_unused
> -
> -static inline bool INET_MATCH(const struct sock *sk, struct net *net,
> - const __addrpair __always_unused cookie,
> - const __be32 saddr,
> - const __be32 daddr,
> - const __portpair ports,
> - const int dif,
> - const int sdif)
> -{
> - int bound_dev_if;
> -
> - if (!net_eq(sock_net(sk), net) ||
> - sk->sk_portpair != ports ||
> - sk->sk_daddr != saddr ||
> - sk->sk_rcv_saddr != daddr)
> - return false;
> -
> - bound_dev_if = READ_ONCE(sk->sk_bound_dev_if);
> - return bound_dev_if == dif || bound_dev_if == sdif;
> -}
> -#endif /* 64-bit arch */
>
>
> I will cook a small patch to simplify INET_MATCH(), then if/when
> merged, I will resend the pach series about sk_bound_dev_if.
>
> Thanks.
>
>
>
>
>>
>> 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 >>):
>>
>>>> net/ipv4/inet_hashtables.c:413:34: warning: variable 'acookie' is uninitialized when used here [-Wuninitialized]
>> if (likely(INET_MATCH(sk, net, acookie,
>> ^~~~~~~
>> include/linux/compiler.h:77:40: note: expanded from macro 'likely'
>> # define likely(x) __builtin_expect(!!(x), 1)
>> ^
>> net/ipv4/inet_hashtables.c:398:2: note: variable 'acookie' is declared here
>> INET_ADDR_COOKIE(acookie, saddr, daddr);
>> ^
>> include/net/inet_hashtables.h:330:2: note: expanded from macro 'INET_ADDR_COOKIE'
>> const int __name __deprecated __always_unused
>> ^
>> net/ipv4/inet_hashtables.c:468:35: warning: variable 'acookie' is uninitialized when used here [-Wuninitialized]
>> if (likely(INET_MATCH(sk2, net, acookie,
>> ^~~~~~~
>> include/linux/compiler.h:77:40: note: expanded from macro 'likely'
>> # define likely(x) __builtin_expect(!!(x), 1)
>> ^
>> net/ipv4/inet_hashtables.c:452:2: note: variable 'acookie' is declared here
>> INET_ADDR_COOKIE(acookie, saddr, daddr);
>> ^
>> include/net/inet_hashtables.h:330:2: note: expanded from macro 'INET_ADDR_COOKIE'
>> const int __name __deprecated __always_unused
>> ^
>> net/ipv4/inet_hashtables.c:535:38: warning: variable 'acookie' is uninitialized when used here [-Wuninitialized]
>> if (unlikely(INET_MATCH(esk, net, acookie,
>> ^~~~~~~
>> include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
>> # define unlikely(x) __builtin_expect(!!(x), 0)
>> ^
>> net/ipv4/inet_hashtables.c:529:2: note: variable 'acookie' is declared here
>> INET_ADDR_COOKIE(acookie, sk->sk_daddr, sk->sk_rcv_saddr);
>> ^
>> include/net/inet_hashtables.h:330:2: note: expanded from macro 'INET_ADDR_COOKIE'
>> const int __name __deprecated __always_unused
>> ^
>> 3 warnings generated.
>> --
>>>> net/ipv4/udp.c:2566:27: warning: variable 'acookie' is uninitialized when used here [-Wuninitialized]
>> if (INET_MATCH(sk, net, acookie, rmt_addr,
>> ^~~~~~~
>> net/ipv4/udp.c:2561:2: note: variable 'acookie' is declared here
>> INET_ADDR_COOKIE(acookie, rmt_addr, loc_addr);
>> ^
>> include/net/inet_hashtables.h:330:2: note: expanded from macro 'INET_ADDR_COOKIE'
>> const int __name __deprecated __always_unused
>> ^
>> 1 warning generated.
>>
>>
>> vim +/acookie +413 net/ipv4/inet_hashtables.c
>>
>> 2c13270b441054 Eric Dumazet 2015-03-15 391
>> c67499c0e77206 Pavel Emelyanov 2008-01-31 392 struct sock *__inet_lookup_established(struct net *net,
>> c67499c0e77206 Pavel Emelyanov 2008-01-31 393 struct inet_hashinfo *hashinfo,
>> 77a5ba55dab7b4 Pavel Emelyanov 2007-12-20 394 const __be32 saddr, const __be16 sport,
>> 77a5ba55dab7b4 Pavel Emelyanov 2007-12-20 395 const __be32 daddr, const u16 hnum,
>> 3fa6f616a7a4d0 David Ahern 2017-08-07 396 const int dif, const int sdif)
>> 77a5ba55dab7b4 Pavel Emelyanov 2007-12-20 397 {
>> c7228317441f4d Joe Perches 2014-05-13 398 INET_ADDR_COOKIE(acookie, saddr, daddr);
>> 77a5ba55dab7b4 Pavel Emelyanov 2007-12-20 399 const __portpair ports = INET_COMBINED_PORTS(sport, hnum);
>> 77a5ba55dab7b4 Pavel Emelyanov 2007-12-20 400 struct sock *sk;
>> 3ab5aee7fe840b Eric Dumazet 2008-11-16 401 const struct hlist_nulls_node *node;
>> 77a5ba55dab7b4 Pavel Emelyanov 2007-12-20 402 /* Optimize here for direct hit, only listening connections can
>> 77a5ba55dab7b4 Pavel Emelyanov 2007-12-20 403 * have wildcards anyways.
>> 77a5ba55dab7b4 Pavel Emelyanov 2007-12-20 404 */
>> 9f26b3add3783c Pavel Emelyanov 2008-06-16 405 unsigned int hash = inet_ehashfn(net, daddr, hnum, saddr, sport);
>> f373b53b5fe67a Eric Dumazet 2009-10-09 406 unsigned int slot = hash & hashinfo->ehash_mask;
>> 3ab5aee7fe840b Eric Dumazet 2008-11-16 407 struct inet_ehash_bucket *head = &hashinfo->ehash[slot];
>> 77a5ba55dab7b4 Pavel Emelyanov 2007-12-20 408
>> 3ab5aee7fe840b Eric Dumazet 2008-11-16 409 begin:
>> 3ab5aee7fe840b Eric Dumazet 2008-11-16 410 sk_nulls_for_each_rcu(sk, node, &head->chain) {
>> ce43b03e888947 Eric Dumazet 2012-11-30 411 if (sk->sk_hash != hash)
>> ce43b03e888947 Eric Dumazet 2012-11-30 412 continue;
>> ce43b03e888947 Eric Dumazet 2012-11-30 @413 if (likely(INET_MATCH(sk, net, acookie,
>> 3fa6f616a7a4d0 David Ahern 2017-08-07 414 saddr, daddr, ports, dif, sdif))) {
>> 41c6d650f6537e Reshetova, Elena 2017-06-30 415 if (unlikely(!refcount_inc_not_zero(&sk->sk_refcnt)))
>> 05dbc7b59481ca Eric Dumazet 2013-10-03 416 goto out;
>> ce43b03e888947 Eric Dumazet 2012-11-30 417 if (unlikely(!INET_MATCH(sk, net, acookie,
>> 3fa6f616a7a4d0 David Ahern 2017-08-07 418 saddr, daddr, ports,
>> 3fa6f616a7a4d0 David Ahern 2017-08-07 419 dif, sdif))) {
>> 05dbc7b59481ca Eric Dumazet 2013-10-03 420 sock_gen_put(sk);
>> 3ab5aee7fe840b Eric Dumazet 2008-11-16 421 goto begin;
>> 77a5ba55dab7b4 Pavel Emelyanov 2007-12-20 422 }
>> 05dbc7b59481ca Eric Dumazet 2013-10-03 423 goto found;
>> 3ab5aee7fe840b Eric Dumazet 2008-11-16 424 }
>> 3ab5aee7fe840b Eric Dumazet 2008-11-16 425 }
>> 3ab5aee7fe840b Eric Dumazet 2008-11-16 426 /*
>> 3ab5aee7fe840b Eric Dumazet 2008-11-16 427 * if the nulls value we got at the end of this lookup is
>> 3ab5aee7fe840b Eric Dumazet 2008-11-16 428 * not the expected one, we must restart lookup.
>> 3ab5aee7fe840b Eric Dumazet 2008-11-16 429 * We probably met an item that was moved to another chain.
>> 3ab5aee7fe840b Eric Dumazet 2008-11-16 430 */
>> 3ab5aee7fe840b Eric Dumazet 2008-11-16 431 if (get_nulls_value(node) != slot)
>> 3ab5aee7fe840b Eric Dumazet 2008-11-16 432 goto begin;
>> 77a5ba55dab7b4 Pavel Emelyanov 2007-12-20 433 out:
>> 05dbc7b59481ca Eric Dumazet 2013-10-03 434 sk = NULL;
>> 05dbc7b59481ca Eric Dumazet 2013-10-03 435 found:
>> 77a5ba55dab7b4 Pavel Emelyanov 2007-12-20 436 return sk;
>> 77a5ba55dab7b4 Pavel Emelyanov 2007-12-20 437 }
>> 77a5ba55dab7b4 Pavel Emelyanov 2007-12-20 438 EXPORT_SYMBOL_GPL(__inet_lookup_established);
>> 77a5ba55dab7b4 Pavel Emelyanov 2007-12-20 439
>>
>> --
>> 0-DAY CI Kernel Test Service
>> https://01.org/lkp
>
Powered by blists - more mailing lists