From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758364Ab3APEYu (ORCPT ); Tue, 15 Jan 2013 23:24:50 -0500 Received: from ozlabs.org ([203.10.76.45]:45874 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757347Ab3APEYs (ORCPT ); Tue, 15 Jan 2013 23:24:48 -0500 From: Rusty Russell To: Tejun Heo , Linus Torvalds Cc: Ming Lei , Alex Riesen , Alan Stern , Jens Axboe , USB list , Linux Kernel Mailing List , Arjan van de Ven Subject: Re: [PATCH] module, async: async_synchronize_full() on module init iff async is used In-Reply-To: <20130116025251.GM2668@htj.dyndns.org> References: <20130115183204.GE2668@htj.dyndns.org> <20130115235043.GJ2668@htj.dyndns.org> <20130116025251.GM2668@htj.dyndns.org> User-Agent: Notmuch/0.14 (http://notmuchmail.org) Emacs/23.4.1 (i686-pc-linux-gnu) Date: Wed, 16 Jan 2013 14:54:11 +1030 Message-ID: <87vcaxycus.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tejun Heo writes: > --- a/kernel/module.c > +++ b/kernel/module.c > @@ -3058,8 +3064,25 @@ static int do_init_module(struct module > blocking_notifier_call_chain(&module_notify_list, > MODULE_STATE_LIVE, mod); > > - /* We need to finish all async code before the module init sequence is done */ > - async_synchronize_full(); Linus put async_synchronize_full() here as a fix but beware: you can start using the module before this call. Normally the potential caller is the one requesting the module load so it works, but if we get more async stuff we may land in that hole. Changing every caller of any async-initializing service is not going to be pretty, but maybe put an async_cookie_t in struct module for module_init to use, and sync it in try_module_get()? Which would now need a can_sleep flag... but the result would be more async. Cheers, Rusty.