Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751512AbaG1StF (ORCPT ); Mon, 28 Jul 2014 14:49:05 -0400 Received: from cantor2.suse.de ([195.135.220.15]:58812 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751389AbaG1StE (ORCPT ); Mon, 28 Jul 2014 14:49:04 -0400 Date: Mon, 28 Jul 2014 20:48:58 +0200 From: "Luis R. Rodriguez" To: Yuval Mintz Cc: "Luis R. Rodriguez" , "gregkh@linuxfoundation.org" , linux-kernel , Tetsuo Handa , Joseph Salisbury , Kay Sievers , One Thousand Gnomes , Tim Gardner , Pierre Fersing , Andrew Morton , Oleg Nesterov , Benjamin Poirier , Nagalakshmi Nandigama , Praveen Krishnamoorthy , Sreekanth Reddy , Abhijit Mahajan , Hariprasad S , Santosh Rastapur , "MPT-FusionLinux.pdl@avagotech.com" , linux-scsi , netdev Subject: Re: [PATCH 1/3] driver core: enable drivers to use deferred probe from init Message-ID: <20140728184858.GK21930@wotan.suse.de> References: <1406558067-25308-1-git-send-email-mcgrof@do-not-panic.com> <20140728153811.GD21930@wotan.suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 28, 2014 at 06:30:29PM +0000, Yuval Mintz wrote: > > On Mon, Jul 28, 2014 at 06:52:48PM +0200, Luis R. Rodriguez wrote: > > > On Mon, Jul 28, 2014 at 03:46:32PM +0000, Yuval Mintz wrote: > > > > Sorry for not being clear, but I didn't meant 'what guarantees that the device > > > > will be added to the deferred probe', but rather what guarantees that the > > > > deferred workqueue will be scheduled. > > > > > > > > To the best of my knowledge the deferring mechanism works only if one device > > > > is dependent upon another, e.g., for Multi-function devices where one device > > > > probe is dependent upon the others - which are soon-to-be probed. > > > > > > The workqueue will be kicked when driver_deferred_probe_trigger() gets > > > poked, we do that in the late_initcall(deferred_probe_initcall), it > > > also gets flushed there with a flush_workqueue(deferred_wq). > > > But come to think of it that will work well for devices already plugged in > > so indeed I think that driver_deferred_probe_add() needs a check added > > for for if (!driver_deferred_probe_enable) then we have to > > driver_deferred_probe_trigger(). The driver_deferred_probe_enable is set > > to false upon init, but later on late init it gets set to true so with > > that check we'd only generate the trigger after late init call. > > > I can fold that in the v2. > > > Luis > > But what about modules being added after the init-calls? If they try try to use this > mechanism, what guarantees they'll eventually get probed? bus_probe_device --> device_attach() --> __device_attach() --> driver_probe_device() --> __driver_probe_device() --> driver_deferred_probe_add() And with the new hunk I mentioned I'd add then we'd trigger the workqueue if its after late init. The change is in v2 series. Luis -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/