net: Missed commit aff09ce303f83bd370772349238482ae422a2341 in stable trees

2015-06-09 Thread Kirill Tkhai
Hi, it looks like the bellow commit is missed in stable kernel versions. In our local 2.6.32 tree without this commit we observed a bridge dropping big packets. The fix is in mainstream kernel now. Please, look if it's need for stable 3.10 kernel etc. commit

[PATCH] net_sched: restore mpu xxx handling

2015-07-29 Thread Kirill Tkhai
/1.925 ms # tc class change dev eth0 classid 1:2 parent 1: htb rate 1mbit mpu 1000 # ping -f -c 1000 10.30.22.52 rtt min/avg/max/mdev = 15.352/22.229/38.646/2.212 ms, pipe 3, ipg/ewma 15.999/22.609 ms Signed-off-by: Kirill Tkhai ktk...@odin.com CC: Jesper Dangaard Brouer bro...@redhat.com CC

Re: [PATCH] net_sched: restore mpu xxx handling

2015-07-29 Thread Kirill Tkhai
On 29.07.2015 16:04, Eric Dumazet wrote: On Wed, 2015-07-29 at 14:24 +0300, Kirill Tkhai wrote: commit 56b765b79 (htb: improved accuracy at high rates) broke the mpu xxx handling. This patch restores the mpu xxx handling for htb: # tc class add dev eth0 classid 1:2 parent 1: htb rate 1mbit

[iproute PATCH] Add ip rule save/restore

2015-10-20 Thread Kirill Tkhai
This patch adds save and restore commands to "ip rule" similar the same is made in commit f4ff11e3e298 for "ip route". The feature is useful in checkpoint/restore for container migration, also it may be helpful in some normal situations. Signed-off-by: Kirill Tkhai <ktk..

[PATCH RFC 1/2] net: Implement net_stats callbacks

2016-08-29 Thread Kirill Tkhai
overhead of summation of percpu statistics on all possible cpus, and iterate only present cpus instead. It may give a signify growth of performance on configurations with big number of possible cpus. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- include/net/stats.h |9 ++ ne

[PATCH RFC 2/2] net: Iterate over present cpus only during ipstats calculation

2016-08-29 Thread Kirill Tkhai
Use net_stats callback to iterate only present cpus mask. This gives a signify performance growth on configurations with large number of possible cpus. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- net/ipv6/addrconf.c |4 +++- net/ipv6/af_inet6.c

[PATCH RFC 0/2] net: Iterate over cpu_present_mask during calculation of percpu statistics

2016-08-29 Thread Kirill Tkhai
t i; for(i=0; i<1; i++) do_gia(); } --- Kirill Tkhai (2): net: Implement net_stats callbacks net: Iterate over present cpus only during ipstats calculation include/net/stats.h |9 ++ net/core/Makefile |1 + net/core/stats.c| 83 ++

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

2017-11-14 Thread Kirill Tkhai
On 14.11.2017 21:39, Cong Wang wrote: > On Tue, Nov 14, 2017 at 5:53 AM, Kirill Tkhai <ktk...@virtuozzo.com> wrote: >> @@ -406,7 +406,7 @@ struct net *copy_net_ns(unsigned long flags, >> >> get_user_ns(user_ns); >> >> - rv = mut

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

2017-11-14 Thread Kirill Tkhai
On 14.11.2017 21:38, Andrei Vagin wrote: > On Tue, Nov 14, 2017 at 09:04:06PM +0300, Kirill Tkhai wrote: >> On 14.11.2017 20:44, Andrei Vagin wrote: >>> On Tue, Nov 14, 2017 at 04:53:33PM +0300, Kirill Tkhai wrote: >>>> Curently mutex is used to protect pe

Re: [RFC] bpf: offload: report device information for offloaded programs

2017-11-30 Thread Kirill Tkhai
Hi, Jakub, please, read comments below. On 30.11.2017 03:22, Jakub Kicinski wrote: > Report to the user ifindex and namespace information of offloaded > programs. Always set dev_bound to true if program was loaded for > a device which has been since removed. Specify the namespace > using

[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 <ktk...@virtuozzo.com> --- 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 +

[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 <ktk...@virtuozzo.com> --- ne

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

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

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

2017-11-17 Thread Kirill Tkhai
W. Biederman <ebied...@xmission.com> Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- include/net/net_namespace.h |2 + net/core/net_namespace.c| 75 ++- 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a

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

2017-11-17 Thread Kirill Tkhai
is 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-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- include/linux

[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 <ktk...@virtuozzo.com> --- net/core/net_namespace.c |3 ++-

[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 <ktk...@virtuozzo.com> --- net/netfilter/core.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netfilter/

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 <ktk...@virtuozzo.com> writes: > >> On 15.11.2017 12:51, Kirill Tkhai wrote: >>> On 15.11.2017 06:19, Eric W. Biederman wrote: >>>> Kirill Tkhai <ktk...@virtuozzo.com> writes: &g

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

2017-11-17 Thread Kirill Tkhai
net_inuse_ops to pernet_sys list. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- 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 @@ -

[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 <ktk...@virtuozzo.com> --- net/core/fib_notifier.c |2 +- net/core/fib_rules.c|2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git

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

2017-11-17 Thread Kirill Tkhai
nobody else is not interested in. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- 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/

[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 <ktk...@virtuozzo.com> --- 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

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

2017-11-17 Thread Kirill Tkhai
. Then, move it to pernet_sys. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- 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_names

[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 <ktk...@virtuozzo.com> --- net/wireless/wext-core.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/wireless/wext-

[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 <ktk...@virtuoz

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

2017-11-17 Thread Kirill Tkhai
it. 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 <ktk...@virtuozzo.com> --- kernel/audit.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/audit.c b/kernel/audit.c index 227db9

[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 <ktk...@virtuozzo.com> --- net/core/sysctl_net_core.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ne

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

2017-11-17 Thread Kirill Tkhai
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 <ktk...@virtuozzo.com> --- fs/proc/proc_net.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/proc/proc_net.c b/fs/pro

[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 <ktk...@virtuozzo.com> --- net/core/net_namespace.c | 44 +++- 1 file changed, 35 insertions(+), 9 deletions(-)

[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 <ktk...@virtuozzo.com> --- 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_names

[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 <ktk...@virtuozzo.com> --- net/core/net_namespace.c | 20 +--- 1 file changed, 9 inse

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

2017-11-17 Thread Kirill Tkhai
pernet_operations. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- 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

[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 <ktk...@virtuozzo.com> --- 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/ne

[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 <ktk...@virtuozzo.com> --- net/netlink/genetlink.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netlink/genetlink.c b/net/n

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

2017-11-17 Thread Kirill Tkhai
it to pernet_sys list. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- 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

[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 <ktk...@virtuozzo.com> --- net/core/net_namespace.c | 19 +++

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 <ktk...@virtuozzo.com> writes: > >> On 15.11.2017 09:25, Eric W. Biederman wrote: >>> Kirill Tkhai <ktk...@virtuozzo.com> writes: >>> >>>> Curently mutex is used to protect pernet o

[PATCH RFC 00/25] Replacing net_mutex with rw_semaphore

2017-11-17 Thread Kirill Tkhai
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_list in setup_net() net: Cleanup

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 <ktk...@virtuozzo.com> writes: > >> On 15.11.2017 19:31, Eric W. Biederman wrote: >>> Kirill Tkhai <ktk...@virtuozzo.com> writes: >>> >>>> On 15.11.2017 12:51, Kirill Tkhai wro

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 <ktk...@virtuozzo.com> writes: > >> On 15.11.2017 19:29, Eric W. Biederman wrote: >>> Kirill Tkhai <ktk...@virtuozzo.com> writes: >>> >>>> On 15.11.2017 09:25, Eric W. Biederman w

[PATCH] net: Protect iterations over net::fib_notifier_ops in fib_seq_sum()

2017-11-14 Thread Kirill Tkhai
rotection. The possible solution could be to use rtnl_lock() in fib_notifier_ops_unregister(), but this adds a possible delay during net namespace creation, so we better use rcu_read_lock() till someone really needs the mutex (if that happens). Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com>

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

2017-11-14 Thread Kirill Tkhai
CPU 2)for i in {1..1}; do unshare -n bash -c exit; done Origin: real 1m24,190s user 0m6,225s sys 0m15,132s Patched: real 0m18,235s (4.6 times faster) user 0m4,544s sys 0m13,796s This patch requires commit 76f8507f7a64 "locking/rwsem: Add down_read_killable()" from Linus tree

[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 <ktk...@virtuozzo.com> --- net/ipv6/addrconf.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c

[PATCH v2 29/31] net: Convert loopback_net_ops

2017-11-20 Thread Kirill Tkhai
pernet_operations. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- 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/loop

[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 <ktk...@virtuozzo.com> --- net/core/sock_diag.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/core/sock_diag.c b/net/core/sock_

[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 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 <ktk...@virtuozzo.com> --- net/packet/af_packet.c |1 + 1 file changed, 1 insertion(+)

[PATCH v2 10/31] net: Convert nf_log_net_ops

2017-11-20 Thread Kirill Tkhai
The pernet_operations would have had a problem in parallel execution with others, if init_net had been able to released. But it's not, and the rest is safe for that. There is memory allocation, which nobody else interested in, and sysctl registration. So, we make it async. Signed-off-by: Kirill

[PATCH v2 09/31] net: Convert netfilter_net_ops

2017-11-20 Thread Kirill Tkhai
. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- net/netfilter/core.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/netfilter/core.c b/net/netfilter/core.c index 52cd2901a097..bfe2e44244ee 100644 --- a/net/netfilter/core.c +++ b/net/netfilter/core.c @@ -600,6 +600,7 @@

[PATCH v2 11/31] net: Convert net_inuse_ops

2017-11-20 Thread Kirill Tkhai
net_inuse_ops methods expose statistics in /proc. No one from the rest of pernet_subsys or pernet_device lists does not touch net::core::inuse. So, it's safe to make net_inuse_ops async. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- net/core/sock.c |1 + 1 file changed, 1 ins

[PATCH v2 12/31] net: Convert net_defaults_ops

2017-11-20 Thread Kirill Tkhai
net_defaults_ops introduces only net_defaults_init_net method, and it acts on net::core::sysctl_somaxconn, which is not interesting for the rest of pernet_subsys and pernet_device lists. Then, make it async. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- net/core/net_namespace.c

[PATCH v2 13/31] net: Convert netlink_net_ops

2017-11-20 Thread Kirill Tkhai
The methods of netlink_net_ops create and destroy "netlink" file, which are not interesting for foreigh pernet_operations. So, netlink_net_ops may safely be made async. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- net/netlink/af_netlink.c |1 + 1 file changed, 1 in

[PATCH v2 14/31] net: Convert rtnetlink_net_ops

2017-11-20 Thread Kirill Tkhai
rtnetlink_net_init() and rtnetlink_net_exit() create and destroy netlink socket. It looks like, another pernet_operations are not interested in foreiner net::rtnl, so rtnetlink_net_ops may be safely made async. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- net/core/rtnetlink.c

[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 <ktk...@virtuozzo.com> --- net/unix/af_unix.c |1 + 1 file changed, 1 insertion(+) diff

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

2017-11-20 Thread Kirill Tkhai
. 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. Signed-off-by: Kirill Tkhai

[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 <ktk...@virtuozzo.com> --- net/wireless/wext-core.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/wireles

[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 <ktk...@virtuozzo.com> --- 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

[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 <ktk...@virtuozzo.com> --- net/core/sysctl_net_core.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/core/sysctl_net_core.c b/ne

[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 <ktk...@virtuozzo.com> --- net/netlink/genetlink.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c

[PATCH v2 06/31] net: Convert proc_net_ns_ops

2017-11-20 Thread Kirill Tkhai
oc_net and proc_net_stat. Proc filesystem privitives are synchronized on proc_subdir_lock. So, proc_net_ns_ops methods are able to be executed in parallel with methods of other pernet operations. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- fs/proc/proc_net.c |1 + 1 file changed,

[PATCH v2 04/31] net: Move mutex_unlock() in cleanup_net() up

2017-11-20 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 <ktk...@virtuozzo.com> --- net/core/net_namespace.c |3 ++-

[PATCH v2 03/31] net: Introduce net_sem for protection of pernet_list

2017-11-20 Thread Kirill Tkhai
times faster) 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-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- i

[PATCH v2 05/31] net: Allow pernet_operations to be executed in parallel

2017-11-20 Thread Kirill Tkhai
tex won't be taken for a net construction and destruction. Also, remove BUG_ON(mutex_is_locked()) from net_assign_generic() without replacing with the equivalent net_sem check, as there is one more lockdep assert below. Suggested-by: Eric W. Biederman <ebied...@xmission.com> Signed-off-by: Ki

[PATCH v2 08/31] net: Convert sysctl_pernet_ops

2017-11-20 Thread Kirill Tkhai
to execute sysctl_pernet_ops's methods in parallel with any other pernet_operations. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- net/sysctl_net.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/sysctl_net.c b/net/sysctl_net.c index 9aed6fe1bf1a..f424539829b7 100644 ---

[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 <ktk...@virtuozzo.com> --- 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_names

[PATCH v2 00/31] Replacing net_mutex with rw_semaphore

2017-11-20 Thread Kirill Tkhai
*before* real 1m40,377s user 0m9,672s sys 0m19,928s *after* real 0m17,007s user 0m5,311s sys 0m11,779 (5.8 times faster) --- Kirill Tkhai (31): net: Assign net to net_namespace_list in setup_net() net: Cleanup copy_net_ns() net: Introduce

[PATCH v2 07/31] net: Convert net_ns_ops methods

2017-11-20 Thread Kirill Tkhai
operations. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- net/core/net_namespace.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 550c766f73aa..757765d62daf 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_names

[PATCH v2 02/31] net: Cleanup copy_net_ns()

2017-11-20 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 <ktk...@virtuozzo.com> --- net/core/net_namespace.c | 20 +--- 1 file changed, 9 inse

[PATCH v2 15/31] net: Convert audit_net_ops

2017-11-20 Thread Kirill Tkhai
This patch starts to convert pernet_subsys, registered from postcore initcalls. audit_net_init() creates netlink socket, while audit_net_exit() destroys it. The rest of the pernet_list are not interested in the socket, so we make audit_net_ops async. Signed-off-by: Kirill Tkhai <

[PATCH v2 16/31] net: Convert uevent_net_ops

2017-11-20 Thread Kirill Tkhai
ges of dying net, and, as I see, no one in kernel listen them, we may safely make uevent_net_ops async. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- lib/kobject_uevent.c |1 + 1 file changed, 1 insertion(+) diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index c3e

[PATCH v2 19/31] net: Convert fib_* pernet_operations, registered via subsys_initcall

2017-11-20 Thread Kirill Tkhai
Both of them create and initialize lists, which are not touched by another foreing pernet_operations. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- net/core/fib_notifier.c |1 + net/core/fib_rules.c|1 + 2 files changed, 2 insertions(+) diff --git a/net/core/fib_noti

[PATCH v2 20/31] net: Convert subsys_initcall() registered pernet_operations from net/sched

2017-11-20 Thread Kirill Tkhai
psched_net_ops only creates and destroyes /proc entry, and safe to be executed in parallel with any foreigh pernet_operations. tcf_action_net_ops initializes and destructs tcf_action_net::egdev_ht, which is not touched by foreign pernet_operations. So, make them async. Signed-off-by: Kirill

[PATCH v2 17/31] net: Convert proto_net_ops

2017-11-20 Thread Kirill Tkhai
This patch starts to convert pernet_subsys, registered from subsys initcalls. It seems safe to be executed in parallel with others, as it's only creates/destoyes proc entry, which nobody else is not interested in. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- net/core/sock.c

[PATCH v2 18/31] net: Convert pernet_subsys ops, registered via net_dev_init()

2017-11-20 Thread Kirill Tkhai
There are: 1)dev_proc_ops and dev_mc_net_ops, which create and destroy pernet proc file and not interested to another net namespaces; 2)netdev_net_ops, which creates pernet hash, which is not touched by another pernet_operations. So, make them async. Signed-off-by: Kirill Tkhai <

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

2017-11-15 Thread Kirill Tkhai
On 15.11.2017 06:19, Eric W. Biederman wrote: > Kirill Tkhai <ktk...@virtuozzo.com> writes: > >> On 14.11.2017 21:39, Cong Wang wrote: >>> On Tue, Nov 14, 2017 at 5:53 AM, Kirill Tkhai <ktk...@virtuozzo.com> wrote: >>>> @@ -406,7 +406,7 @

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

2017-11-15 Thread Kirill Tkhai
On 15.11.2017 09:25, Eric W. Biederman wrote: > Kirill Tkhai <ktk...@virtuozzo.com> writes: > >> Curently mutex is used to protect pernet operations list. It makes >> cleanup_net() to execute ->exit methods of the same operations set, >> which was used on t

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

2017-11-14 Thread Kirill Tkhai
On 14.11.2017 20:07, Eric Dumazet wrote: > On Tue, 2017-11-14 at 16:53 +0300, Kirill Tkhai wrote: >> Curently mutex is used to protect pernet operations list. It makes >> cleanup_net() to execute ->exit methods of the same operations set, >> which was used on the time o

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

2017-11-14 Thread Kirill Tkhai
On 14.11.2017 20:44, Andrei Vagin wrote: > On Tue, Nov 14, 2017 at 04:53:33PM +0300, Kirill Tkhai wrote: >> Curently mutex is used to protect pernet operations list. It makes >> cleanup_net() to execute ->exit methods of the same operations set, >> which was used on the ti

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

2017-11-15 Thread Kirill Tkhai
On 15.11.2017 12:51, Kirill Tkhai wrote: > On 15.11.2017 06:19, Eric W. Biederman wrote: >> Kirill Tkhai <ktk...@virtuozzo.com> writes: >> >>> On 14.11.2017 21:39, Cong Wang wrote: >>>> On Tue, Nov 14, 2017 at 5:53 AM, Kirill Tkhai <ktk...@virtuozzo.com

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 <ktk...@virtuozzo.com> writes: > >> On 15.11.2017 09:25, Eric W. Biederman wrote: >>> Kirill Tkhai <ktk...@virtuozzo.com> writes: >>> >>>> Curently mutex is used to protect pernet o

Re: [PATCH v2 00/31] Replacing net_mutex with rw_semaphore

2017-12-04 Thread Kirill Tkhai
Still no comments :( Ping, ping, ping. Here is the second version of big patch set with Eric's commentaries accounted. What will we do next? On 20.11.2017 21:32, Kirill Tkhai wrote: > Hi, > > there is the second version of patchset introducing net_sem > instead of net_mutex. The p

Re: [PATCH v2 00/31] Replacing net_mutex with rw_semaphore

2017-12-04 Thread Kirill Tkhai
On 04.12.2017 19:10, David Miller wrote: > From: Kirill Tkhai <ktk...@virtuozzo.com> > Date: Mon, 4 Dec 2017 18:54:51 +0300 > >> Still no comments :( >> >> Ping, ping, ping. > > You cannot force people to prioritize reviewing your patch submission. >

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

2017-12-20 Thread Kirill Tkhai
; held for read. > > Suggested-by: Kirill Tkhai <ktk...@virtuozzo.com> > Signed-off-by: Jakub Kicinski <jakub.kicin...@netronome.com> > Reviewed-by: Quentin Monnet <quentin.mon...@netronome.com> Reviewed-by: Kirill Tkhai <ktk...@virtuozzo.com> > --- > kernel/b

Re: [PATCH net-next] tun: Do SIOCGSKNS out of rtnl_lock()

2018-05-09 Thread Kirill Tkhai
Hi, Jason, On 09.05.2018 10:18, Jason Wang wrote: > > > On 2018年05月09日 00:21, Kirill Tkhai wrote: >> Since net ns of tun device is assigned on the device creation, >> and it never changes, we do not need to use any lock to get it >> from alive tun. >> &g

[PATCH net-next] tun: Do SIOCGSKNS out of rtnl_lock()

2018-05-08 Thread Kirill Tkhai
Since net ns of tun device is assigned on the device creation, and it never changes, we do not need to use any lock to get it from alive tun. Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- drivers/net/tun.c | 18 +++--- 1 file changed, 7 insertions(+), 11 deletions(-)

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

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

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

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

2018-06-14 Thread Kirill Tkhai
ace 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 100644 --

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] 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 virt

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 down &g

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

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

2018-06-20 Thread Kirill Tkhai
From: Kirill Tkhai 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 down ifconfig eth1 down index=`cat /sys/class/net/eth1/ifindex` ip link set eth1 name dev$index unshare -n sleep 1h

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 <ktk...@virtuozzo.com> writes: > >> peernet2id_alloc() is racy without rtnl_lock() as atomic_read(>count) >> under net->nsid_lock does not guarantee, peer is alive: >> &g

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 v2 1/3] net: Fix possible race in peernet2id_alloc()

2018-01-09 Thread Kirill Tkhai
id will operate with this freed memory. Currently, peernet2id_alloc() is used under rtnl_lock() everywhere except ovs_vport_cmd_fill_info(), and this race can't occur. But peernet2id_alloc() is generic interface, and better we fix it before someone really starts use it in wrong context. Signed-off-by: Ki

[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 <ktk...@virtuozzo.com> --- 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

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

2018-01-09 Thread Kirill Tkhai
-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- 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/inclu

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

2018-01-16 Thread Kirill Tkhai
e refcount_read(>count) under net->nsid_lock as suggested by Eric W. Biederman <ebied...@xmission.com> v3: Rebase on top of net-next Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> --- net/core/net_namespace.c | 13 +++-- 1 file changed, 11 insertions(+), 2 de

  1   2   3   4   5   >