public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Kirill Tkhai <ktkhai@virtuozzo.com>
Cc: davem@davemloft.net, vyasevic@redhat.com,
	kstewart@linuxfoundation.org, pombredanne@nexb.com,
	vyasevich@gmail.com, mark.rutland@arm.com,
	gregkh@linuxfoundation.org, adobriyan@gmail.com, fw@strlen.de,
	nicolas.dichtel@6wind.com, xiyou.wangcong@gmail.com,
	roman.kapl@sysgo.com, paul@paul-moore.com, dsahern@gmail.com,
	daniel@iogearbox.net, lucien.xin@gmail.com,
	mschiffer@universe-factory.net, rshearma@brocade.com,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	avagin@virtuozzo.com, gorcunov@virtuozzo.com,
	eric.dumazet@gmail.com, stephen@networkplumber.org
Subject: Re: [PATCH RFC 00/25] Replacing net_mutex with rw_semaphore
Date: Sat, 18 Nov 2017 19:52:09 -0600	[thread overview]
Message-ID: <87mv3jujau.fsf@xmission.com> (raw)
In-Reply-To: <151094119999.20009.6955267140148739392.stgit@localhost.localdomain> (Kirill Tkhai's message of "Fri, 17 Nov 2017 21:27:13 +0300")

Kirill Tkhai <ktkhai@virtuozzo.com> writes:

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

I think there is an solution in the center.  Just have a count
(protected by down_write net_sem) of the number of modules that still
need net_mutex.

If the count is non-zero we take net_mutex in setup_net and cleanup_net.

That way limited network stacks can see the benefit and actively test
the parallism, while other configurations can be safe in still having
the same behavior.

Eric


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

      parent reply	other threads:[~2017-11-19  1:52 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Eric W. Biederman [this message]

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=87mv3jujau.fsf@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=adobriyan@gmail.com \
    --cc=avagin@virtuozzo.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=eric.dumazet@gmail.com \
    --cc=fw@strlen.de \
    --cc=gorcunov@virtuozzo.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kstewart@linuxfoundation.org \
    --cc=ktkhai@virtuozzo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=mschiffer@universe-factory.net \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --cc=paul@paul-moore.com \
    --cc=pombredanne@nexb.com \
    --cc=roman.kapl@sysgo.com \
    --cc=rshearma@brocade.com \
    --cc=stephen@networkplumber.org \
    --cc=vyasevic@redhat.com \
    --cc=vyasevich@gmail.com \
    --cc=xiyou.wangcong@gmail.com \
    /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