[PATCH net-next 08/16] net: Convert nfnl_queue_net_ops

2018-03-07 Thread Kirill Tkhai
These pernet_operations register and unregister net::nf::queue_handler and /proc entry. The handler is accessed only under RCU, so this looks safe to convert them. Signed-off-by: Kirill Tkhai --- net/netfilter/nfnetlink_queue.c |1 + 1 file changed, 1 insertion(+) diff --git a/net

[PATCH net-next 10/16] net: Convert arptable_filter_net_ops

2018-03-07 Thread Kirill Tkhai
These pernet_operations unregister net::ipv4::arptable_filter. Another net/pernet_operations do not send arp packets to foreign net namespaces. So, we mark them async. Signed-off-by: Kirill Tkhai --- net/ipv4/netfilter/arptable_filter.c |1 + 1 file changed, 1 insertion(+) diff --git a/net

[PATCH net-next 09/16] net: Convert pg_net_ops

2018-03-07 Thread Kirill Tkhai
These pernet_operations create per-net pktgen threads and /proc entries. These pernet subsys looks closed in itself, and there are no pernet_operations outside this file, which are interested in the threads. Init and/or exit methods look safe to be executed in parallel. Signed-off-by: Kirill

[PATCH net-next 11/16] net: Convert iptable_mangle_net_ops

2018-03-07 Thread Kirill Tkhai
These pernet_operations unregister net::ipv4::iptable_mangle table. Another net/pernet_operations do not send ipv4 packets to foreign net namespaces. So, we mark them async. Signed-off-by: Kirill Tkhai --- net/ipv4/netfilter/iptable_mangle.c |1 + 1 file changed, 1 insertion(+) diff --git

[PATCH net-next 12/16] net: Convert iptable_nat_net_ops

2018-03-07 Thread Kirill Tkhai
These pernet_operations unregister net::ipv4::nat_table table. Another net/pernet_operations do not send ipv4 packets to foreign net namespaces. So, we mark them async. Signed-off-by: Kirill Tkhai --- net/ipv4/netfilter/iptable_nat.c |1 + 1 file changed, 1 insertion(+) diff --git a/net

[PATCH net-next 13/16] net: Convert iptable_raw_net_ops

2018-03-07 Thread Kirill Tkhai
These pernet_operations unregister net::ipv4::iptable_raw table. Another net/pernet_operations do not send ipv4 packets to foreign net namespaces. So, we mark them async. Signed-off-by: Kirill Tkhai --- net/ipv4/netfilter/iptable_raw.c |1 + 1 file changed, 1 insertion(+) diff --git a/net

[PATCH net-next 15/16] net: Convert ipv4_net_ops

2018-03-07 Thread Kirill Tkhai
second one is just RO memory dereference. So, these pernet_operations are safe to be marked as async. Signed-off-by: Kirill Tkhai --- net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4

[PATCH net-next 16/16] net: Convet ipv6_net_ops

2018-03-07 Thread Kirill Tkhai
These pernet_operations are similar to ipv4_net_ops. They are safe to be async. Signed-off-by: Kirill Tkhai --- net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter

[PATCH net-next 14/16] net: Convert iptable_security_net_ops

2018-03-07 Thread Kirill Tkhai
These pernet_operations unregister net::ipv4::iptable_security table. Another net/pernet_operations do not send ipv4 packets to foreign net namespaces. So, we mark them async. Signed-off-by: Kirill Tkhai --- net/ipv4/netfilter/iptable_security.c |1 + 1 file changed, 1 insertion(+) diff

Re: [for-next V2 03/13] net/mlx5e: Wait for FPGA command responses with a timeout

2018-03-07 Thread Kirill Tkhai
On 07.03.2018 09:35, Saeed Mahameed wrote: > From: Aviad Yehezkel > > Generally, FPGA IPSec commands must always complete. > We want to wait for one minute for them to complete gracefully also > when killing a process. > > Signed-off-by: Aviad Yehezkel > Signed-off-by: Saeed Mahameed > --- >

Re: [PATCH v3 net-next 2/5] net/ipv6: Address checks need to consider the L3 domain

2018-03-07 Thread Kirill Tkhai
On 07.03.2018 06:58, David Ahern wrote: > ipv6_chk_addr_and_flags determines if an address is a local address. It > is called by ip6_route_info_create to validate a gateway address is not a > local address. It currently does not consider L3 domains and as a result > does not allow a route to be add

Re: [PATCH v3 net-next 2/5] net/ipv6: Address checks need to consider the L3 domain

2018-03-07 Thread Kirill Tkhai
On 07.03.2018 14:53, Kirill Tkhai wrote: > On 07.03.2018 06:58, David Ahern wrote: >> ipv6_chk_addr_and_flags determines if an address is a local address. It >> is called by ip6_route_info_create to validate a gateway address is not a >> local address. It currently does not co

Re: [PATCH net-next] ip6mr: remove synchronize_rcu() in favor of SOCK_RCU_FREE

2018-03-07 Thread Kirill Tkhai
..1000}; do unshare -n /bin/false;done > > Before : real 7m18.911s > After : real 10.187s > > Fixes: 8571ab479a6e ("ip6mr: Make mroute_sk rcu-based") > Signed-off-by: Eric Dumazet > Reported-by: Kirill Tkhai > Cc: Yuval Mintz Reviewed-by: Kirill Tkhai &

Re: [PATCH net-next 03/13] net: sched: extend Qdisc with rcu

2018-09-06 Thread Kirill Tkhai
On 06.09.2018 11:30, Eric Dumazet wrote: > > > On 09/06/2018 12:58 AM, Vlad Buslov wrote: > > ... > >> diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h >> index 18e22a5a6550..239c73f29471 100644 >> --- a/include/net/sch_generic.h >> +++ b/include/net/sch_generic.h >> @@ -90,6

Re: [Patch net-next] ipv4: initialize ra_mutex in inet_init_net()

2018-09-17 Thread Kirill Tkhai
ace ip_ra_lock with per-net mutex") > Cc: Kirill Tkhai > Signed-off-by: Cong Wang > --- > net/core/net_namespace.c | 1 - > net/ipv4/af_inet.c | 2 ++ > 2 files changed, 2 insertions(+), 1 deletion(-) > > diff --git a/net/core/net_namespace.c b/net/core/net_n

Re: [Patch net-next] ipv4: initialize ra_mutex in inet_init_net()

2018-09-19 Thread Kirill Tkhai
On 18.09.2018 23:17, Cong Wang wrote: > On Mon, Sep 17, 2018 at 12:25 AM Kirill Tkhai wrote: >> In inet_init() the order of registration is: >> >> ip_mr_init(); >> init_inet_pernet_ops(); >> >> This means, ipmr_net_ops pernet operations are b

Re: [Patch net-next] ipv4: initialize ra_mutex in inet_init_net()

2018-09-20 Thread Kirill Tkhai
On 20.09.2018 0:28, Cong Wang wrote: > On Wed, Sep 19, 2018 at 1:25 AM Kirill Tkhai wrote: >> >> On 18.09.2018 23:17, Cong Wang wrote: >>> On Mon, Sep 17, 2018 at 12:25 AM Kirill Tkhai wrote: >>>> In inet_init() the order of registrat

[PATCH 1/3] net: Remove inet_exit_net()

2018-09-20 Thread Kirill Tkhai
This function does nothing, and since ops_exit_list() checks for NULL ->exit method, we do not need stub here. Signed-off-by: Kirill Tkhai --- net/ipv4/af_inet.c |5 - 1 file changed, 5 deletions(-) diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 1fbe2f815474..f4ecbe0aa

[PATCH 2/3] net: Register af_inet_ops earlier

2018-09-20 Thread Kirill Tkhai
This function just initializes locks and defaults. Let register it before other pernet operation, since some of them potentially may relay on that. Signed-off-by: Kirill Tkhai --- net/ipv4/af_inet.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/ipv4/af_inet.c

[PATCH net-next 0/3] Refactorings on af_inet pernet initialization

2018-09-20 Thread Kirill Tkhai
This patch set makes several cleanups around inet_init_net(). --- Cong Wang (1): ipv4: initialize ra_mutex in inet_init_net() Kirill Tkhai (2): net: Remove inet_exit_net() net: Register af_inet_ops earlier net/core/net_namespace.c |1 - net/ipv4/af_inet.c | 13

[PATCH 3/3] ipv4: initialize ra_mutex in inet_init_net()

2018-09-20 Thread Kirill Tkhai
f-by: Cong Wang Acked-by: Kirill Tkhai --- net/core/net_namespace.c |1 - net/ipv4/af_inet.c |2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 670c84b1bfc2..b272ccfcbf63 100644 --- a/net/core/net_namespace.c

Re: [PATCH bpf-next 1/8] bpf: offload: don't require rtnl for dev list manipulation

2017-12-20 Thread Kirill Tkhai
e > held for read. > > Suggested-by: Kirill Tkhai > Signed-off-by: Jakub Kicinski > Reviewed-by: Quentin Monnet Reviewed-by: Kirill Tkhai > --- > kernel/bpf/offload.c | 21 + > 1 file changed, 17 insertions(+), 4 deletions(-) > > diff --git a/kern

[PATCH 3/3] net: Remove spinlock from get_net_ns_by_id()

2017-12-21 Thread Kirill Tkhai
idr_find() is safe under rcu_read_lock() and maybe_get_net() guarantees that net is alive. Signed-off-by: Kirill Tkhai --- net/core/net_namespace.c |2 -- 1 file changed, 2 deletions(-) diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 6a4eab438221..a675f35a18ff 100644

[PATCH 2/3] net: Add BUG_ON() to get_net()

2017-12-21 Thread Kirill Tkhai
igned-off-by: Kirill Tkhai --- include/net/net_namespace.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 10f99dafd5ac..ff0e47471d5b 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -

[PATCH 1/3] net: Fix possible race in peernet2id_alloc()

2017-12-21 Thread Kirill Tkhai
it in wrong context. Signed-off-by: Kirill Tkhai --- net/core/net_namespace.c | 23 +++ 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 60a71be75aea..6a4eab438221 100644 --- a/net/core/net_namesp

Re: [PATCH 1/3] net: Fix possible race in peernet2id_alloc()

2017-12-22 Thread Kirill Tkhai
Hi, Eric, On 21.12.2017 20:39, Eric W. Biederman wrote: > Kirill Tkhai writes: > >> peernet2id_alloc() is racy without rtnl_lock() as atomic_read(&peer->count) >> under net->nsid_lock does not guarantee, peer is alive: >> >

Re: [PATCH bpf-next v2 1/8] bpf: offload: don't require rtnl for dev list manipulation

2017-12-26 Thread Kirill Tkhai
info will only need it partially. We will also > be able to remove the waitqueue in following patches. > > Use struct rw_semaphore because map offload will require sleeping > with the semaphore held for read. > > Suggested-by: Kirill Tkhai > Signed-off-by: Jakub Kicinski > Rev

Re: [PATCH 1/3] net: Fix possible race in peernet2id_alloc()

2017-12-28 Thread Kirill Tkhai
larify the status or what I should do with the patchset (because it's not clear for me)? Thanks, Kirill On 22.12.2017 13:30, Kirill Tkhai wrote: > Hi, Eric, > > On 21.12.2017 20:39, Eric W. Biederman wrote: >> Kirill Tkhai writes: >> >>> peernet2id_alloc()

[PATCH RESEND 2/3] net: Add BUG_ON() to get_net()

2017-12-28 Thread Kirill Tkhai
igned-off-by: Kirill Tkhai --- include/net/net_namespace.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 10f99dafd5ac..ff0e47471d5b 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -

[PATCH RESEND 1/3] net: Fix possible race in peernet2id_alloc()

2017-12-28 Thread Kirill Tkhai
it in wrong context. Signed-off-by: Kirill Tkhai --- net/core/net_namespace.c | 23 +++ 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 60a71be75aea..6a4eab438221 100644 --- a/net/core/net_namesp

[PATCH RESEND 3/3] net: Remove spinlock from get_net_ns_by_id()

2017-12-28 Thread Kirill Tkhai
idr_find() is safe under rcu_read_lock() and maybe_get_net() guarantees that net is alive. Signed-off-by: Kirill Tkhai --- net/core/net_namespace.c |2 -- 1 file changed, 2 deletions(-) diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 6a4eab438221..a675f35a18ff 100644

Re: [PATCH RESEND 1/3] net: Fix possible race in peernet2id_alloc()

2017-12-30 Thread Kirill Tkhai
On 29.12.2017 21:18, Eric W. Biederman wrote: > Kirill Tkhai writes: > >> peernet2id_alloc() is racy without rtnl_lock() as atomic_read(&peer->count) >> under net->nsid_lock does not guarantee, peer is alive: >> >

[PATCH v2 1/3] net: Fix possible race in peernet2id_alloc()

2018-01-09 Thread Kirill Tkhai
it in wrong context. Signed-off-by: Kirill Tkhai --- net/core/net_namespace.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 60a71be75aea..497135f314ce 100644 --- a/net/core/net_namespace.c +++ b

[PATCH v2 3/3] net: Remove spinlock from get_net_ns_by_id()

2018-01-09 Thread Kirill Tkhai
idr_find() is safe under rcu_read_lock() and maybe_get_net() guarantees that net is alive. Signed-off-by: Kirill Tkhai --- net/core/net_namespace.c |2 -- 1 file changed, 2 deletions(-) diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 497135f314ce..5f9e18b31a1a 100644

[PATCH v2 2/3] net: Add BUG_ON() to get_net()

2018-01-09 Thread Kirill Tkhai
igned-off-by: Kirill Tkhai --- include/net/net_namespace.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 10f99dafd5ac..ff0e47471d5b 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -

Re: [PATCH v2 2/3] net: Add BUG_ON() to get_net()

2018-01-09 Thread Kirill Tkhai
On 09.01.2018 21:52, Eric Dumazet wrote: > On Tue, 2018-01-09 at 18:00 +0300, Kirill Tkhai wrote: >> Since people may mistakenly obtain destroying net >> from net_namespace_list and from net::netns_ids >> without checking for its net::counter, let's protect >> ag

Re: [PATCH v2 2/3] net: Add BUG_ON() to get_net()

2018-01-10 Thread Kirill Tkhai
On 10.01.2018 12:58, Eric Dumazet wrote: > On Wed, 2018-01-10 at 10:37 +0300, Kirill Tkhai wrote: >> On 09.01.2018 21:52, Eric Dumazet wrote: >>> On Tue, 2018-01-09 at 18:00 +0300, Kirill Tkhai wrote: >>>> Since people may mistakenly obtain destroying net >>>

[PATCH] net: Convert atomic_t net::count to refcount_t

2018-01-12 Thread Kirill Tkhai
and allmodconfig are OK. Suggested-by: Eric Dumazet Signed-off-by: Kirill Tkhai --- include/net/net_namespace.h |8 net/core/net-sysfs.c |6 +++--- net/core/net_namespace.c |8 net/ipv4/inet_timewait_sock.c |4 ++-- net/ipv4/tcp_metrics.c

Re: [PATCH] net: Convert atomic_t net::count to refcount_t

2018-01-12 Thread Kirill Tkhai
On 12.01.2018 18:53, Eric Dumazet wrote: > On Fri, 2018-01-12 at 18:28 +0300, Kirill Tkhai wrote: >> Since net could be obtained from RCU lists, >> and there is a race with net destruction, >> the patch converts net::count to refcount_t. >> >> This provid

[PATCH v3 1/2] net: Fix possible race in peernet2id_alloc()

2018-01-16 Thread Kirill Tkhai
use it in wrong context. v2: Don't place refcount_read(&net->count) under net->nsid_lock as suggested by Eric W. Biederman v3: Rebase on top of net-next Signed-off-by: Kirill Tkhai --- net/core/net_namespace.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deleti

[PATCH v3 2/2] net: Remove spinlock from get_net_ns_by_id()

2018-01-16 Thread Kirill Tkhai
idr_find() is safe under rcu_read_lock() and maybe_get_net() guarantees that net is alive. Signed-off-by: Kirill Tkhai --- net/core/net_namespace.c |2 -- 1 file changed, 2 deletions(-) diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 3c77d84ad60d..1ccb953b3b09 100644

Re: Dead lock condition occured ipanic during register_netdevice_notifier call in 4.9.102

2018-05-31 Thread Kirill Tkhai
Hi, Illyas, On 31.05.2018 11:43, Mansoor, Illyas wrote: > We are facing mutex dead lock condition that we think might be related to a > fix that you have provided in: > Merge branch > 'Close-race-between-un-register_netdevice_notifier-and-pernet_operations' > commit b9a12601541eb55d07e00261a511

Re: [RFC PATCH] kcm: hold rx mux lock when updating the receive queue.

2018-06-06 Thread Kirill Tkhai
Hi, Paolo, below is couple my thoughts about this. On 06.06.2018 12:44, Paolo Abeni wrote: > On Tue, 2018-06-05 at 18:06 +0200, Paolo Abeni wrote: >> On Tue, 2018-06-05 at 08:35 -0700, Tom Herbert wrote: >>> Paolo, thanks for looking into this! Can you try replacing >>> __skb_dequeue in requeue_r

Re: [PATCH net] kcm: fix races on sk_receive_queue

2018-06-06 Thread Kirill Tkhai
On 06.06.2018 16:16, Paolo Abeni wrote: > KCM removes the packets from sk_receive_queue in requeue_rx_msgs() > > without acquiring any lock. Moreover, in R() when the MSG_PEEK > flag is not present, the skb is peeked and dequeued with two > separate, non-atomic, calls. > > The above create room f

[PATCH] net: Fix device name resolving crash in default_device_exit()

2018-06-14 Thread Kirill Tkhai
ck trace snipped] This patch gives more variability during choosing new name of device and fixes the problem. Signed-off-by: Kirill Tkhai --- net/core/dev.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 6e18242a1cae..6c9b9303ded6 1006

Re: [PATCH] net: Fix device name resolving crash in default_device_exit()

2018-06-15 Thread Kirill Tkhai
On 14.06.2018 20:11, David Ahern wrote: > On 6/14/18 6:38 AM, Kirill Tkhai wrote: >> The following script makes kernel to crash since it can't obtain >> a name for a device, when the name is occupied by another device: >> >> #!/bin/bash >> ifconfig eth0 do

Re: [PATCH] net: Fix device name resolving crash in default_device_exit()

2018-06-18 Thread Kirill Tkhai
On 17.06.2018 21:58, David Ahern wrote: > On 6/15/18 3:44 AM, Kirill Tkhai wrote: >> Hm, but is this a likely case, when real device is moved to net ns, so it >> requires moving to init_net back? It seems the most devices moved to >> !init_net >> are virtual

Re: [PATCH] net: Fix device name resolving crash in default_device_exit()

2018-06-18 Thread Kirill Tkhai
On 18.06.2018 14:21, Kirill Tkhai wrote: > On 17.06.2018 21:58, David Ahern wrote: >> On 6/15/18 3:44 AM, Kirill Tkhai wrote: >>> Hm, but is this a likely case, when real device is moved to net ns, so it >>> requires moving to init_net back? It seems the most devi

Re: [PATCH] ipset: fix a missing check of nla_parse

2019-01-10 Thread Kirill Tkhai
On 10.01.2019 01:43, Pablo Neira Ayuso wrote: > On Wed, Dec 26, 2018 at 12:16:25PM +0300, Kirill Tkhai wrote: >> On 26.12.2018 06:50, Kangjie Lu wrote: >>> When nla_parse fails, we should not use the results (the first >>> argument). The fix checks if it fails, and if

Re: net/core: BUG in copy_net_ns()

2019-01-11 Thread Kirill Tkhai
On 11.01.2019 23:33, Eric W. Biederman wrote: > zzoru writes: > >> net/core: BUG in copy_net_ns() (net_namespace.c) > > I don't understand this failure report at all. > > I don't see the connection to copy_net_ns(). And I don't see how the > suggested patch short of covering up a memory stomp

Re: [PATCH] net: check negative value for signed refcnt

2019-01-31 Thread Kirill Tkhai
Hi, Alexandre, On 31.01.2019 16:20, alexandre.besn...@softathome.com wrote: > From: Alexandre Besnard > > Device remaining references counter is get as a signed integer. > > When unregistering network devices, the loop waiting for this counter > to decrement tests the 0 strict equality. Thus if

Re: [PATCH] net: check negative value for signed refcnt

2019-01-31 Thread Kirill Tkhai
On 31.01.2019 18:14, Alexandre BESNARD wrote: > Hi Kirill, and thanks for your time, > > On 31 Jan 19 14:49, Kirill Tkhai ktk...@virtuozzo.com wrote : > >> Hi, Alexandre, > >> On 31.01.2019 16:20, alexandre.besn...@softathome.com wrote: >>> From: Alexan

Re: [PATCH] net: check negative value for signed refcnt

2019-01-31 Thread Kirill Tkhai
On 31.01.2019 18:21, Eric Dumazet wrote: > > > On 01/31/2019 07:15 AM, Eric Dumazet wrote: >> >> >> On 01/31/2019 05:49 AM, Kirill Tkhai wrote: >>> >>> 2)Not related to your patch -- it looks like we have problem in existing >>> code with

Re: [PATCH] net/net_namespace: Check the return value of register_pernet_subsys()

2018-12-24 Thread Kirill Tkhai
On 24.12.2018 04:42, Aditya Pakki wrote: > In net_ns_init(), register_pernet_subsys() could fail while registering > network namespace subsystems. The fix checks the return value and > sends a panic() on failure. > > Signed-off-by: Aditya Pakki Reviewed-by: Kirill Tkhai &g

Re: [PATCH] ipset: fix a missing check of nla_parse

2018-12-26 Thread Kirill Tkhai
On 26.12.2018 06:50, Kangjie Lu wrote: > When nla_parse fails, we should not use the results (the first > argument). The fix checks if it fails, and if so, returns its error code > upstream. > > Signed-off-by: Kangjie Lu > --- > net/netfilter/ipset/ip_set_core.c | 4 +++- > 1 file changed, 3 ins

Re: [PATCH] net: core: Fix to store new mtu setting in netdevice.

2018-12-31 Thread Kirill Tkhai
On 01.01.2019 09:42, Murali Krishna Policharla wrote: > Store newly configured mtu settings in the netdevice after mtu > configuration is successful to the dsa switch. > > Fixes: 2315dc91a5 ("net: make dev_set_mtu() honor notification return code") > Signed-off-by: Murali Krishna Policharla > Rev

Re: Expected result when racing listen(2) on two sockets bound to the same address

2018-05-23 Thread Kirill Tkhai
Hi, On 23.05.2018 14:15, Alexander Kurtz wrote: > [Please keep me CC'ed; I'm not subscribed to the list] > > Hi! > > The program shown below (also available at [0]) does the following: > > * Create two sockets > * Enable SO_REUSEADDR on both > * Bind both sockets to [::1]:12345 > * Spawn tw

Re: [PATCH] net: Convert net_mutex into rw_semaphore and down read it on net->init/->exit

2017-11-16 Thread Kirill Tkhai
On 15.11.2017 19:29, Eric W. Biederman wrote: > Kirill Tkhai writes: > >> On 15.11.2017 09:25, Eric W. Biederman wrote: >>> Kirill Tkhai writes: >>> >>>> Curently mutex is used to protect pernet operations list. It makes >>>> cleanup_net(

Re: [PATCH] net: Convert net_mutex into rw_semaphore and down read it on net->init/->exit

2017-11-17 Thread Kirill Tkhai
On 15.11.2017 19:29, Eric W. Biederman wrote: > Kirill Tkhai writes: > >> On 15.11.2017 09:25, Eric W. Biederman wrote: >>> Kirill Tkhai writes: >>> >>>> Curently mutex is used to protect pernet operations list. It makes >>>> cleanup_net(

[PATCH RFC 01/25] net: Assign net to net_namespace_list in setup_net()

2017-11-17 Thread Kirill Tkhai
nit()->proc_net_init(), which can't race with net_ns_init(), called from initcall. Signed-off-by: Kirill Tkhai --- net/core/net_namespace.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index b797832565d3..7

[PATCH RFC 00/25] Replacing net_mutex with rw_semaphore

2017-11-17 Thread Kirill Tkhai
erations from all the files in file alphabetical order. What do you think about this? (Note, the patches has no such a problem at the moment, as there are all in-kernel early core drivers). Maybe there are another comments on the code. --- Kirill Tkhai (25): net: Assign net to net_namespace_lis

[PATCH RFC 02/25] net: Cleanup copy_net_ns()

2017-11-17 Thread Kirill Tkhai
Line up destructors actions in the revers order to constructors. Next patches will add more actions, and this will be comfortable, if there is the such order. Signed-off-by: Kirill Tkhai --- net/core/net_namespace.c | 20 +--- 1 file changed, 9 insertions(+), 11 deletions

[PATCH RFC 08/25] net: Move proc_net_ns_ops to pernet_sys list

2017-11-17 Thread Kirill Tkhai
it's safe to move proc_net_ns_ops to pernet_sys list and execute its methods in parallel with another pernet operations. Signed-off-by: Kirill Tkhai --- fs/proc/proc_net.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c index a2bf

[PATCH RFC 07/25] net: Make sys sublist pernet_operations executed out of net_mutex

2017-11-17 Thread Kirill Tkhai
Move net_mutex to setup_net() and cleanup_net(), and do not hold it, while sys sublist methods are executed. Signed-off-by: Kirill Tkhai --- net/core/net_namespace.c | 44 +++- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/net/core

[PATCH RFC 12/25] net: Move nf_log_net_ops to pernet_sys list

2017-11-17 Thread Kirill Tkhai
emory allocation, which nobody else interested in, and sysctl registration. So, we move it to pernet_sys list. Signed-off-by: Kirill Tkhai --- net/netfilter/nf_log.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c index 8bb152a

[PATCH RFC 09/25] net: Move net_ns_ops to pernet_sys list

2017-11-17 Thread Kirill Tkhai
/net_ns_net_init, methods use only ida_simple_* functions, which are not need a synchronization. So it's safe to execute them in parallel with any other pernet_operations, and thus we convert net_ns_ops to pernet_sys type. Signed-off-by: Kirill Tkhai --- net/core/net_namespace.c |2 +- 1

[PATCH RFC 15/25] net: Move netlink_net_ops to pernet_sys list

2017-11-17 Thread Kirill Tkhai
t_sys list. Signed-off-by: Kirill Tkhai --- net/netlink/af_netlink.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index b9e0ee4e22f5..a4f1f5222b79 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c

[PATCH RFC 13/25] net: Move net_inuse_ops to pernet_sys list

2017-11-17 Thread Kirill Tkhai
move net_inuse_ops to pernet_sys list. Signed-off-by: Kirill Tkhai --- net/core/sock.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/sock.c b/net/core/sock.c index 13719af7b4e3..be050b044699 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -3081,7 +3081,7 @@ static s

[PATCH RFC 21/25] net: Move fib_* pernet_operations, registered via subsys_initcall(), to pernet_sys list

2017-11-17 Thread Kirill Tkhai
Both of them create and initialize lists, which are not touched by another foreing pernet_operations. Signed-off-by: Kirill Tkhai --- net/core/fib_notifier.c |2 +- net/core/fib_rules.c|2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/core/fib_notifier.c b

[PATCH RFC 19/25] net: Move proto_net_ops to pernet_sys list

2017-11-17 Thread Kirill Tkhai
which nobody else is not interested in. Signed-off-by: Kirill Tkhai --- net/core/sock.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/sock.c b/net/core/sock.c index be050b044699..ed12e115458b 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -3349,7 +3

[PATCH RFC 22/25] net: Move subsys_initcall() registered pernet_operations from net/sched to pernet_sys list

2017-11-17 Thread Kirill Tkhai
-by: Kirill Tkhai --- net/sched/act_api.c |2 +- net/sched/sch_api.c |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 4d33a50a8a6d..f1de2146e6e0 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -1470,7 +1470,7

[PATCH RFC 23/25] net: Move genl_pernet_ops to pernet_sys list

2017-11-17 Thread Kirill Tkhai
This pernet_operations create and destroy net::genl_sock. Foreign pernet_operations don't touch it. Signed-off-by: Kirill Tkhai --- net/netlink/genetlink.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index d444daf

[PATCH RFC 20/25] net: Move pernet_subsys, registered via net_dev_init(), to pernet_sys list

2017-11-17 Thread Kirill Tkhai
pernet_sys list. Signed-off-by: Kirill Tkhai --- net/core/dev.c|2 +- net/core/net-procfs.c |4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 8ee29f4f5fa9..b90a503a9e1a 100644 --- a/net/core/dev.c +++ b/net/core/dev.c

[PATCH RFC 25/25] net: Move sysctl_core_ops to pernet_sys list

2017-11-17 Thread Kirill Tkhai
These pernet_operations register and destroy sysctl directory, and it's not interested for foreign pernet_operations. Signed-off-by: Kirill Tkhai --- net/core/sysctl_net_core.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/sysctl_net_core.c b/net

[PATCH RFC 24/25] net: Move wext_pernet_ops to pernet_sys list

2017-11-17 Thread Kirill Tkhai
These pernet_operations initialize and purge net::wext_nlevents queue, and are not touched by foreign pernet_operations. Signed-off-by: Kirill Tkhai --- net/wireless/wext-core.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/wireless/wext-core.c b/net/wireless/wext

[PATCH RFC 14/25] net: Move net_defaults_ops to pernet_sys list

2017-11-17 Thread Kirill Tkhai
, move it to pernet_sys. Signed-off-by: Kirill Tkhai --- net/core/net_namespace.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 2e8295aa7003..7fc9d44c1817 100644 --- a/net/core/net_namespace.c +++ b/net/core

[PATCH RFC 18/25] net: Move uevent_net_ops to pernet_sys list

2017-11-17 Thread Kirill Tkhai
pernet_operations makes the socket disappear earlier from uevent_sock_list on ->exit. As userspace can't be interested in broadcast messages of dying net, and, as I see, no one in kernel listen them, we may safely move uevent_net_ops to pernet_sys list. Signed-off-by: Kirill Tkhai --- lib/kobject_

[PATCH RFC 17/25] net: Move audit_net_ops to pernet_sys list

2017-11-17 Thread Kirill Tkhai
. The rest of the pernet_list are not interested in the socket, so we move audit_net_ops to pernet_sys list. Signed-off-by: Kirill Tkhai --- kernel/audit.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/audit.c b/kernel/audit.c index 227db99b0f19..bb4626d7e712 100644

[PATCH RFC 16/25] net: Move rtnetlink_net_ops to pernet_sys list

2017-11-17 Thread Kirill Tkhai
rtnetlink_net_ops may be safely moved to pernet_sys list. Signed-off-by: Kirill Tkhai --- net/core/rtnetlink.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index cb06d43c4230..d9cf13554e4d 100644 --- a/net/core/rtnetlink.c +++ b/net

[PATCH RFC 10/25] net: Move sysctl_pernet_ops to pernet_sys list

2017-11-17 Thread Kirill Tkhai
any other pernet_operations. Signed-off-by: Kirill Tkhai --- net/sysctl_net.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sysctl_net.c b/net/sysctl_net.c index 9aed6fe1bf1a..1b91db88e54a 100644 --- a/net/sysctl_net.c +++ b/net/sysctl_net.c @@ -103,7 +103,7 @@ __init int net_s

[PATCH RFC 11/25] net: Move netfilter_net_ops to pernet_sys list

2017-11-17 Thread Kirill Tkhai
pernet_operations do not interested in forein net::nf::hooks or proc entries, so it's safe to move netfilter_net_ops to pernet list. Signed-off-by: Kirill Tkhai --- net/netfilter/core.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netfilter/core.c b/net/netfilter/c

[PATCH RFC 06/25] net: Add pernet sys and registration functions

2017-11-17 Thread Kirill Tkhai
the cycle. Suggested-by: Eric W. Biederman Signed-off-by: Kirill Tkhai --- include/net/net_namespace.h |2 + net/core/net_namespace.c| 75 ++- 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/include/net/net_namespace.h b/inc

[PATCH RFC 03/25] net: Introduce net_sem for protection of pernet_list

2017-11-17 Thread Kirill Tkhai
i-thread tests increase may be close to 4.6 multiplied to number of threads. This patch starts replacing net_mutex to net_sem. It adds rw_semaphore, describes the variables it protects, and makes to use where appropriate. net_mutex is still present, and next patches will kick it out step-by-step. Signed

[PATCH RFC 04/25] net: Move mutex_unlock() in cleanup_net() up

2017-11-17 Thread Kirill Tkhai
net_sem protects from pernet_list changing, while ops_free_list() makes simple kfree(), and it can't race with other pernet_operations callbacks. So we may release net_mutex earlier then it was. Signed-off-by: Kirill Tkhai --- net/core/net_namespace.c |3 ++- 1 file changed, 2 inser

[PATCH RFC 05/25] net: Add primitives to update heads of pernet_list sublists

2017-11-17 Thread Kirill Tkhai
Currently we have first_device, and device and subsys sublists. Next patches introduce one more sublist. So, move the functionality, which will be repeating, to the primitives. Signed-off-by: Kirill Tkhai --- net/core/net_namespace.c | 19 +++ 1 file changed, 15 insertions

Re: [PATCH] net: Convert net_mutex into rw_semaphore and down read it on net->init/->exit

2017-11-17 Thread Kirill Tkhai
On 15.11.2017 19:31, Eric W. Biederman wrote: > Kirill Tkhai writes: > >> On 15.11.2017 12:51, Kirill Tkhai wrote: >>> On 15.11.2017 06:19, Eric W. Biederman wrote: >>>> Kirill Tkhai writes: >>>> >>>>> On 14.11.2017 21:39, Cong Wang

Re: [PATCH] net: Convert net_mutex into rw_semaphore and down read it on net->init/->exit

2017-11-17 Thread Kirill Tkhai
On 17.11.2017 21:54, Eric W. Biederman wrote: > Kirill Tkhai writes: > >> On 15.11.2017 19:29, Eric W. Biederman wrote: >>> Kirill Tkhai writes: >>> >>>> On 15.11.2017 09:25, Eric W. Biederman wrote: >>>>> Kirill Tkhai writes: >>

Re: [PATCH] net: Convert net_mutex into rw_semaphore and down read it on net->init/->exit

2017-11-17 Thread Kirill Tkhai
On 17.11.2017 21:52, Eric W. Biederman wrote: > Kirill Tkhai writes: > >> On 15.11.2017 19:31, Eric W. Biederman wrote: >>> Kirill Tkhai writes: >>> >>>> On 15.11.2017 12:51, Kirill Tkhai wrote: >>>>> On 15.11.2017 06:19, Eric W. Bieder

[PATCH v2 01/31] net: Assign net to net_namespace_list in setup_net()

2017-11-20 Thread Kirill Tkhai
nit()->proc_net_init(), which can't race with net_ns_init(), called from initcall. Signed-off-by: Kirill Tkhai --- net/core/net_namespace.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index b797832565d3..7

[PATCH v2 21/31] net: Convert genl_pernet_ops

2017-11-20 Thread Kirill Tkhai
This pernet_operations create and destroy net::genl_sock. Foreign pernet_operations don't touch it. Signed-off-by: Kirill Tkhai --- net/netlink/genetlink.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index d444daf1ac04..a66fad4

[PATCH v2 23/31] net: Convert sysctl_core_ops

2017-11-20 Thread Kirill Tkhai
These pernet_operations register and destroy sysctl directory, and it's not interested for foreign pernet_operations. Signed-off-by: Kirill Tkhai --- net/core/sysctl_net_core.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c

[PATCH v2 27/31] net: Convert ipv4_sysctl_ops

2017-11-20 Thread Kirill Tkhai
These pernet_operations create and destroy sysctl, which are not touched by anybody else. Signed-off-by: Kirill Tkhai --- net/ipv4/sysctl_net_ipv4.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 93e172118a94..89683d868b37

[PATCH v2 29/31] net: Convert loopback_net_ops

2017-11-20 Thread Kirill Tkhai
ble for another pernet_operations. Signed-off-by: Kirill Tkhai --- drivers/net/loopback.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 30612497643c..b97a907ea5aa 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c @@ -230,4 +

[PATCH v2 31/31] net: Convert diag_net_ops

2017-11-20 Thread Kirill Tkhai
These pernet operations just create and destroy netlink socket. The socket is pernet and else operations don't touch it. Signed-off-by: Kirill Tkhai --- net/core/sock_diag.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/core/sock_diag.c b/net/core/sock_diag.c index 217f4e3

[PATCH v2 30/31] net: Convert default_device_ops

2017-11-20 Thread Kirill Tkhai
dereference. The same for default_device_exit_batch(). Similar unregisteration may happen in any time on a system. Here several lists (like todo_list), which are accessed under rtnl_lock(). After rtnl_unlock() and netdev_run_todo() all the devices are flushed. Signed-off-by: Kirill Tkhai

[PATCH v2 28/31] net: Convert addrconf_ops

2017-11-20 Thread Kirill Tkhai
These pernet_operations (un)register sysctl, which are not touched by anybody else. So, it's safe to make them async. Signed-off-by: Kirill Tkhai --- net/ipv6/addrconf.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index a0ae1c9

[PATCH v2 26/31] net: Convert packet_net_ops

2017-11-20 Thread Kirill Tkhai
These pernet_operations just create and destroy /proc entry, and another operations do not touch it. Also, nobody else are interested in foreign net::packet::sklist. Signed-off-by: Kirill Tkhai --- net/packet/af_packet.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/packet

[PATCH v2 25/31] net: Convert unix_net_ops

2017-11-20 Thread Kirill Tkhai
These pernet_operations are just create and destroy /proc and sysctl entries, and are not touched by foreign pernet_operations. So, we are able to make them async. Signed-off-by: Kirill Tkhai --- net/unix/af_unix.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/unix/af_unix.c b/net

[PATCH v2 24/31] net: Convert pernet_subsys, registered from inet_init()

2017-11-20 Thread Kirill Tkhai
of newly created net. ipv4_mib_ops creates and destroys pernet percpu statistics. raw_net_ops, tcp4_net_ops, udp4_net_ops, ping_v4_net_ops and ip_proc_ops only create/destroy pernet /proc files. ip4_frags_ops creates and destroys sysctl file. So, it's safe to make the pernet_operations async. Si

[PATCH v2 22/31] net: Convert wext_pernet_ops

2017-11-20 Thread Kirill Tkhai
These pernet_operations initialize and purge net::wext_nlevents queue, and are not touched by foreign pernet_operations. Mark them async. Signed-off-by: Kirill Tkhai --- net/wireless/wext-core.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/wireless/wext-core.c b/net/wireless/wext

<    1   2   3   4   5   >