netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 00/25] Replacing net_mutex with rw_semaphore
@ 2017-11-17 18:27 Kirill Tkhai
  2017-11-17 18:27 ` [PATCH RFC 01/25] net: Assign net to net_namespace_list in setup_net() Kirill Tkhai
                   ` (25 more replies)
  0 siblings, 26 replies; 27+ messages in thread
From: Kirill Tkhai @ 2017-11-17 18:27 UTC (permalink / raw)
  To: davem, vyasevic, kstewart, pombredanne, vyasevich, mark.rutland,
	gregkh, adobriyan, fw, nicolas.dichtel, xiyou.wangcong,
	roman.kapl, paul, dsahern, daniel, lucien.xin, mschiffer,
	rshearma, linux-kernel, netdev, ktkhai, ebiederm, avagin,
	gorcunov, eric.dumazet, stephen, ktkhai

Hi,

this is continuation of discussion from here:

https://lkml.org/lkml/2017/11/14/298

The plan has changed a little bit, so I'd be happy to hear
people's comments, before I dived into all 400+ pernet subsys
and devices.

The patch set adds pernet sys list ahead of subsys and device,
and it's used for pernet_operations, which may be executed
in parallel with any other pernet_operations methods. Also,
some high-priority ops converted (up to registered using
postcore_initcall(), and some subsys_initcall()) in order
of appearance. The sequence in setup_net() is following:

1)execute all the callbacks from pernet_sys list
2)lock net_mutex
3)execute all the callbacks from pernet_subsys list
4)execute all the callbacks from pernet_device list
5)unlock net_mutex

There was not pernet_operations, requiring additional
synchronization, yet, but I've bumped in another problem.
The problem is that some drivers may be compiled as modules
and as kernel-image part. They register pernet_operations
from device_initcall() for example. This initcall executes
in different time comparing to in-kernel built-in only
drivers.

Imagine, we have three state driverA, and boolean driverB.
driverA registers pernet_subsys from subsys_initcall().
driverB registers pernet_subsys from fs_initcall().
So, here we have two cases:

driverA is module              driverA is built-in
--------------------           -------------------
register driverB ops           register driverA ops
register driverA ops           register driverB ops

So, the order is different. When converting driver one-by-one,
it's impossible to make the order true for all .config
states, because of the above. So, the bisect won't work.

And it seems, it's just the same as to convert pernet_operations
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_list in setup_net()
      net: Cleanup copy_net_ns()
      net: Introduce net_sem for protection of pernet_list
      net: Move mutex_unlock() in cleanup_net() up
      net: Add primitives to update heads of pernet_list sublists
      net: Add pernet sys and registration functions
      net: Make sys sublist pernet_operations executed out of net_mutex
      net: Move proc_net_ns_ops to pernet_sys list
      net: Move net_ns_ops to pernet_sys list
      net: Move sysctl_pernet_ops to pernet_sys list
      net: Move netfilter_net_ops to pernet_sys list
      net: Move nf_log_net_ops to pernet_sys list
      net: Move net_inuse_ops to pernet_sys list
      net: Move net_defaults_ops to pernet_sys list
      net: Move netlink_net_ops to pernet_sys list
      net: Move rtnetlink_net_ops to pernet_sys list
      net: Move audit_net_ops to pernet_sys list
      net: Move uevent_net_ops to pernet_sys list
      net: Move proto_net_ops to pernet_sys list
      net: Move pernet_subsys, registered via net_dev_init(), to pernet_sys list
      net: Move fib_* pernet_operations, registered via subsys_initcall(), to pernet_sys list
      net: Move subsys_initcall() registered pernet_operations from net/sched to pernet_sys list
      net: Move genl_pernet_ops to pernet_sys list
      net: Move wext_pernet_ops to pernet_sys list
      net: Move sysctl_core_ops to pernet_sys list


 fs/proc/proc_net.c          |    2 
 include/linux/rtnetlink.h   |    1 
 include/net/net_namespace.h |    2 
 kernel/audit.c              |    2 
 lib/kobject_uevent.c        |    2 
 net/core/dev.c              |    2 
 net/core/fib_notifier.c     |    2 
 net/core/fib_rules.c        |    2 
 net/core/net-procfs.c       |    4 -
 net/core/net_namespace.c    |  203 +++++++++++++++++++++++++++++++++----------
 net/core/rtnetlink.c        |    6 +
 net/core/sock.c             |    4 -
 net/core/sysctl_net_core.c  |    2 
 net/netfilter/core.c        |    2 
 net/netfilter/nf_log.c      |    2 
 net/netlink/af_netlink.c    |    2 
 net/netlink/genetlink.c     |    2 
 net/sched/act_api.c         |    2 
 net/sched/sch_api.c         |    2 
 net/sysctl_net.c            |    2 
 net/wireless/wext-core.c    |    2 
 21 files changed, 183 insertions(+), 67 deletions(-)

--
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2017-11-19  1:52 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-17 18:27 [PATCH RFC 00/25] Replacing net_mutex with rw_semaphore Kirill Tkhai
2017-11-17 18:27 ` [PATCH RFC 01/25] net: Assign net to net_namespace_list in setup_net() Kirill Tkhai
2017-11-17 18:27 ` [PATCH RFC 02/25] net: Cleanup copy_net_ns() Kirill Tkhai
2017-11-17 18:27 ` [PATCH RFC 03/25] net: Introduce net_sem for protection of pernet_list Kirill Tkhai
2017-11-17 18:27 ` [PATCH RFC 04/25] net: Move mutex_unlock() in cleanup_net() up Kirill Tkhai
2017-11-17 18:28 ` [PATCH RFC 05/25] net: Add primitives to update heads of pernet_list sublists Kirill Tkhai
2017-11-17 18:28 ` [PATCH RFC 06/25] net: Add pernet sys and registration functions Kirill Tkhai
2017-11-17 18:28 ` [PATCH RFC 07/25] net: Make sys sublist pernet_operations executed out of net_mutex Kirill Tkhai
2017-11-17 18:28 ` [PATCH RFC 08/25] net: Move proc_net_ns_ops to pernet_sys list Kirill Tkhai
2017-11-17 18:28 ` [PATCH RFC 09/25] net: Move net_ns_ops " Kirill Tkhai
2017-11-17 18:28 ` [PATCH RFC 10/25] net: Move sysctl_pernet_ops " Kirill Tkhai
2017-11-17 18:29 ` [PATCH RFC 11/25] net: Move netfilter_net_ops " Kirill Tkhai
2017-11-17 18:29 ` [PATCH RFC 12/25] net: Move nf_log_net_ops " Kirill Tkhai
2017-11-17 18:29 ` [PATCH RFC 13/25] net: Move net_inuse_ops " Kirill Tkhai
2017-11-17 18:29 ` [PATCH RFC 14/25] net: Move net_defaults_ops " Kirill Tkhai
2017-11-17 18:29 ` [PATCH RFC 15/25] net: Move netlink_net_ops " Kirill Tkhai
2017-11-17 18:29 ` [PATCH RFC 16/25] net: Move rtnetlink_net_ops " Kirill Tkhai
2017-11-17 18:29 ` [PATCH RFC 17/25] net: Move audit_net_ops " Kirill Tkhai
2017-11-17 18:30 ` [PATCH RFC 18/25] net: Move uevent_net_ops " Kirill Tkhai
2017-11-17 18:30 ` [PATCH RFC 19/25] net: Move proto_net_ops " Kirill Tkhai
2017-11-17 18:30 ` [PATCH RFC 20/25] net: Move pernet_subsys, registered via net_dev_init(), " Kirill Tkhai
2017-11-17 18:30 ` [PATCH RFC 21/25] net: Move fib_* pernet_operations, registered via subsys_initcall(), " Kirill Tkhai
2017-11-17 18:30 ` [PATCH RFC 22/25] net: Move subsys_initcall() registered pernet_operations from net/sched " Kirill Tkhai
2017-11-17 18:30 ` [PATCH RFC 23/25] net: Move genl_pernet_ops " Kirill Tkhai
2017-11-17 18:31 ` [PATCH RFC 24/25] net: Move wext_pernet_ops " Kirill Tkhai
2017-11-17 18:31 ` [PATCH RFC 25/25] net: Move sysctl_core_ops " Kirill Tkhai
2017-11-19  1:52 ` [PATCH RFC 00/25] Replacing net_mutex with rw_semaphore Eric W. Biederman

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).