[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <877ede2s1t.fsf@toke.dk>
Date: Mon, 04 Mar 2019 23:28:14 +0100
From: Toke Høiland-Jørgensen <toke@...hat.com>
To: Jakub Kicinski <jakub.kicinski@...ronome.com>
Cc: David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
Jesper Dangaard Brouer <brouer@...hat.com>,
Daniel Borkmann <daniel@...earbox.net>,
Alexei Starovoitov <ast@...nel.org>
Subject: Re: [PATCH net-next v3 2/3] xdp: Always use a devmap for XDP_REDIRECT to a device
Jakub Kicinski <jakub.kicinski@...ronome.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
Powered by blists - more mailing lists