[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200123143725.036140e7@carbon>
Date: Thu, 23 Jan 2020 14:37:25 +0100
From: Jesper Dangaard Brouer <brouer@...hat.com>
To: Amol Grover <frextrite@...il.com>
Cc: brouer@...hat.com, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <jakub.kicinski@...ronome.com>,
Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Andrii Nakryiko <andriin@...com>, netdev@...r.kernel.org,
bpf@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kernel-mentees@...ts.linuxfoundation.org,
Joel Fernandes <joel@...lfernandes.org>,
Madhuparna Bhowmik <madhuparnabhowmik04@...il.com>,
"Paul E . McKenney" <paulmck@...nel.org>
Subject: Re: [PATCH] bpf: devmap: Pass lockdep expression to RCU lists
On Thu, 23 Jan 2020 17:34:38 +0530
Amol Grover <frextrite@...il.com> wrote:
> head is traversed using hlist_for_each_entry_rcu outside an
> RCU read-side critical section but under the protection
> of dtab->index_lock.
We do hold the lock in update and delete cases, but not in the lookup
cases. Is it then still okay to add the lockdep_is_held() annotation?
If it is then it looks fine to me:
Acked-by: Jesper Dangaard Brouer <brouer@...hat.com>
> Hence, add corresponding lockdep expression to silence false-positive
> lockdep warnings, and harden RCU lists.
>
> Signed-off-by: Amol Grover <frextrite@...il.com>
> ---
> kernel/bpf/devmap.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
> index 3d3d61b5985b..b4b6b77f309c 100644
> --- a/kernel/bpf/devmap.c
> +++ b/kernel/bpf/devmap.c
> @@ -293,7 +293,8 @@ struct bpf_dtab_netdev *__dev_map_hash_lookup_elem(struct bpf_map *map, u32 key)
> struct hlist_head *head = dev_map_index_hash(dtab, key);
> struct bpf_dtab_netdev *dev;
>
> - hlist_for_each_entry_rcu(dev, head, index_hlist)
> + hlist_for_each_entry_rcu(dev, head, index_hlist,
> + lockdep_is_held(&dtab->index_lock))
> if (dev->idx == key)
> return dev;
>
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
Powered by blists - more mailing lists