bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Martin KaFai Lau <kafai@fb.com>
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org,
	Hangbin Liu <liuhangbin@gmail.com>,
	Jesper Dangaard Brouer <brouer@redhat.com>,
	Magnus Karlsson <magnus.karlsson@gmail.com>,
	"Paul E . McKenney" <paulmck@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	kernel test robot <lkp@intel.com>
Subject: Re: [PATCH bpf-next] bpf/devmap: convert remaining READ_ONCE() to rcu_dereference()
Date: Tue, 29 Jun 2021 11:37:42 +0200	[thread overview]
Message-ID: <87h7hhj9jt.fsf@toke.dk> (raw)
In-Reply-To: <20210628235559.sgq7txsjmz3s2zeb@kafai-mbp.dhcp.thefacebook.com>

Martin KaFai Lau <kafai@fb.com> writes:

> On Tue, Jun 29, 2021 at 01:00:51AM +0200, Toke Høiland-Jørgensen wrote:
>> There were a couple of READ_ONCE()-invocations left-over by the devmap RCU
>> conversion. Convert these to rcu_dereference() as well to avoid complaints
>> from sparse.
>> 
>> Fixes: 782347b6bcad ("xdp: Add proper __rcu annotations to redirect map entries")
>> Reported-by: kernel test robot <lkp@intel.com>
>> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
>> ---
>>  kernel/bpf/devmap.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
>> index 2f6bd75cd682..7a0c008f751b 100644
>> --- a/kernel/bpf/devmap.c
>> +++ b/kernel/bpf/devmap.c
>> @@ -558,7 +558,7 @@ int dev_map_enqueue_multi(struct xdp_buff *xdp, struct net_device *dev_rx,
>>  
>>  	if (map->map_type == BPF_MAP_TYPE_DEVMAP) {
>>  		for (i = 0; i < map->max_entries; i++) {
>> -			dst = READ_ONCE(dtab->netdev_map[i]);
>> +			dst = rcu_dereference(dtab->netdev_map[i]);
> __dev_map_lookup_elem() uses rcu_dereference_check(dtab->netdev_map[key], rcu_read_lock_bh_held()).
> It is not needed here?

Hmm, I somehow managed to convince myself last night that it wasn't, but
looking at it again now I think you're right. Will send a v2.

-Toke


      reply	other threads:[~2021-06-29  9:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-28 23:00 [PATCH bpf-next] bpf/devmap: convert remaining READ_ONCE() to rcu_dereference() Toke Høiland-Jørgensen
2021-06-28 23:05 ` Paul E. McKenney
2021-06-28 23:55 ` Martin KaFai Lau
2021-06-29  9:37   ` Toke Høiland-Jørgensen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h7hhj9jt.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=bpf@vger.kernel.org \
    --cc=brouer@redhat.com \
    --cc=kafai@fb.com \
    --cc=kuba@kernel.org \
    --cc=liuhangbin@gmail.com \
    --cc=lkp@intel.com \
    --cc=magnus.karlsson@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=paulmck@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).