From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl0-f66.google.com ([209.85.160.66]:40333 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933441AbeBVSSI (ORCPT ); Thu, 22 Feb 2018 13:18:08 -0500 Received: by mail-pl0-f66.google.com with SMTP id i6so3332000plt.7 for ; Thu, 22 Feb 2018 10:18:08 -0800 (PST) Message-ID: <1519323485.55655.59.camel@gmail.com> Subject: Re: [PATCH bpf v2] bpf: fix rcu lockdep warning for lpm_trie map_free callback From: Eric Dumazet To: Yonghong Song , ast@fb.com, daniel@iogearbox.net, edumazet@google.com, netdev@vger.kernel.org Cc: kernel-team@fb.com Date: Thu, 22 Feb 2018 10:18:05 -0800 In-Reply-To: <20180222181035.2163332-1-yhs@fb.com> References: <20180222181035.2163332-1-yhs@fb.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org List-ID: On Thu, 2018-02-22 at 10:10 -0800, Yonghong Song wrote: > Commit 9a3efb6b661f ("bpf: fix memory leak in lpm_trie map_free callback function") > fixed a memory leak and removed unnecessary locks in map_free callback function. > Unfortrunately, it introduced a lockdep warning. When lockdep checking is turned on, > running tools/testing/selftests/bpf/test_lpm_map will have: > > Fixes: 9a3efb6b661f ("bpf: fix memory leak in lpm_trie map_free callback function") > Reported-by: Eric Dumazet > Suggested-by: Eric Dumazet > Signed-off-by: Yonghong Song > --- > kernel/bpf/lpm_trie.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > v1 -> v2: > . fix sparse warning which is introduced by v1, suggested by Eric. > > diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c > index a75e02c..b4b5b81 100644 > --- a/kernel/bpf/lpm_trie.c > +++ b/kernel/bpf/lpm_trie.c > @@ -569,8 +569,7 @@ static void trie_free(struct bpf_map *map) > slot = &trie->root; > > for (;;) { > - node = rcu_dereference_protected(*slot, > - lockdep_is_held(&trie->lock)); > + node = rcu_dereference_protected(*slot, 1); > if (!node) > goto out; SGTM, thanks ! Reviewed-by: Eric Dumazet