From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750910AbdKSBw3 (ORCPT ); Sat, 18 Nov 2017 20:52:29 -0500 Received: from out02.mta.xmission.com ([166.70.13.232]:51573 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750732AbdKSBw1 (ORCPT ); Sat, 18 Nov 2017 20:52:27 -0500 From: ebiederm@xmission.com (Eric W. Biederman) To: Kirill Tkhai 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 References: <151094119999.20009.6955267140148739392.stgit@localhost.localdomain> Date: Sat, 18 Nov 2017 19:52:09 -0600 In-Reply-To: <151094119999.20009.6955267140148739392.stgit@localhost.localdomain> (Kirill Tkhai's message of "Fri, 17 Nov 2017 21:27:13 +0300") Message-ID: <87mv3jujau.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1eGEmM-0001f3-Ow;;;mid=<87mv3jujau.fsf@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=67.3.204.119;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX19+WKyC3YRKKzacBwwmvNRVM82yogji6e0= X-SA-Exim-Connect-IP: 67.3.204.119 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa05 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 0.1 XMSolicitRefs_0 Weightloss drug * 0.2 T_XMDrugObfuBody_14 obfuscated drug references X-Spam-DCC: XMission; sa05 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: *;Kirill Tkhai X-Spam-Relay-Country: X-Spam-Timing: total 5431 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 2.7 (0.1%), b_tie_ro: 1.82 (0.0%), parse: 1.50 (0.0%), extract_message_metadata: 25 (0.5%), get_uri_detail_list: 4.9 (0.1%), tests_pri_-1000: 9 (0.2%), tests_pri_-950: 1.70 (0.0%), tests_pri_-900: 1.46 (0.0%), tests_pri_-400: 39 (0.7%), check_bayes: 38 (0.7%), b_tokenize: 15 (0.3%), b_tok_get_all: 11 (0.2%), b_comp_prob: 3.8 (0.1%), b_tok_touch_all: 6 (0.1%), b_finish: 0.55 (0.0%), tests_pri_0: 1001 (18.4%), check_dkim_signature: 0.60 (0.0%), check_dkim_adsp: 10 (0.2%), tests_pri_500: 4345 (80.0%), poll_dns_idle: 4336 (79.8%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH RFC 00/25] Replacing net_mutex with rw_semaphore X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Kirill Tkhai 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