From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: David Miller <davem@davemloft.net>,
netdev@vger.kernel.org,
Jesper Dangaard Brouer <brouer@redhat.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Alexei Starovoitov <ast@kernel.org>
Subject: Re: [PATCH net-next v3 2/3] xdp: Always use a devmap for XDP_REDIRECT to a device
Date: Mon, 04 Mar 2019 23:28:14 +0100 [thread overview]
Message-ID: <877ede2s1t.fsf@toke.dk> (raw)
In-Reply-To: <20190304141558.061824a7@cakuba.netronome.com>
Jakub Kicinski <jakub.kicinski@netronome.com> writes:
> On Mon, 04 Mar 2019 20:05:30 +0100, Toke Høiland-Jørgensen wrote:
>> > Hm. I think you'll still need a lock (mutex?) on the alloc path, but
>> > the free path should be fine as long as you load the map pointer before
>> > looking at the refcnt (atomic op ensuring the barrier there).
>>
>> Yeah, for the per-namespace refcnt it's pretty straight forward, the
>> trouble is the global count that needs to iterate over all namespaces;
>> probably need to put that all behind a (non-spin)lock, right?
>
> Because net iteration is under RCU? You can switch to taking net_rwsem
> for that one, no? I'm probably confused again ;)
Because there's a single refcount that needs to trigger
creation/deletion of *all* the default maps. I.e.
if (atomic_dec_return(&global_refcnt))
for_each_namespace(net)
destroy_default_map(net);
which needs to not step on the toes of a subsequent
if (atomic_inc_return(&global_refcnt) == 1)
for_each_namespace(net)
create_default_map(net);
(or vice versa, of course).
Not sure there's a way to do that without wrapping both of those
constructs (including the refcnt inc/dec) in a mutex?
-Toke
next prev parent reply other threads:[~2019-03-04 22:28 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-01 14:12 [PATCH net-next v3 0/3] xdp: Use a default map for xdp_redirect helper Toke Høiland-Jørgensen
2019-03-01 14:12 ` [PATCH net-next v3 2/3] xdp: Always use a devmap for XDP_REDIRECT to a device Toke Høiland-Jørgensen
2019-03-02 2:09 ` Jakub Kicinski
2019-03-04 11:58 ` Toke Høiland-Jørgensen
2019-03-04 17:44 ` Jakub Kicinski
2019-03-04 19:05 ` Toke Høiland-Jørgensen
2019-03-04 22:15 ` Jakub Kicinski
2019-03-04 22:28 ` Toke Høiland-Jørgensen [this message]
2019-03-04 22:49 ` Jakub Kicinski
2019-03-05 9:53 ` Toke Høiland-Jørgensen
2019-03-01 14:12 ` [PATCH net-next v3 1/3] xdp: Refactor devmap code in preparation for subsequent additions Toke Høiland-Jørgensen
2019-03-02 1:08 ` Jakub Kicinski
2019-03-04 12:47 ` Toke Høiland-Jørgensen
2019-03-04 17:08 ` Jakub Kicinski
2019-03-04 17:37 ` Toke Høiland-Jørgensen
2019-03-01 14:12 ` [PATCH net-next v3 3/3] xdp: Add devmap_idx map type for looking up devices by ifindex Toke Høiland-Jørgensen
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=877ede2s1t.fsf@toke.dk \
--to=toke@redhat.com \
--cc=ast@kernel.org \
--cc=brouer@redhat.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=jakub.kicinski@netronome.com \
--cc=netdev@vger.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).