Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp458792pxb; Wed, 18 Aug 2021 06:25:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkgq2Oc3IdWJ+q7eD72ArpdA9nSOd4RNiDP//E0OioHAiA4t3OA+oD7jM6muqwyI0RyCZd X-Received: by 2002:a05:6638:419e:: with SMTP id az30mr8236404jab.14.1629293140731; Wed, 18 Aug 2021 06:25:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629293140; cv=none; d=google.com; s=arc-20160816; b=ITzP1QoVEkCRA9sA+5GFQiHocwJAygHXOej6okSp6vkivHwLIyCQBRXDz0+bV4dtdL wNPYIG8So8ZcZeMMq4kC7/zTA3lfjCs0MhwwY/giT1gwlWbvWDQ+qsqkZRxe0CbXskEH AxfazgPvmpTHWJ7Xxi0ZRAf3TmAdFhEyDTjA7a7eoLQIVbmHxwv27W5mgd92qy9TFucA 8fPaY4eupoCDSncKl0JeQ/iR3aiVAu7EC6tyzleyb1uiwI4Ywp8v2LoHcqAWb1bJZuLY BMIYs3/ufH27kuGbvn3ikJYLunhFMn13TjELoIAb5sKJ+CpmLgh/PH4g1y4Hc+nP7+OQ VzKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YwFk2IDV3Sis+5DQOQWAVrW6CjrnVlqXWpFO82ym5bU=; b=XOsm06pc8jT8csGbVt9UOxD7rA9HYgFey6B4rZvBB+Cf6mCxqQuSxPiQ1FCfMca4at VBnc7tdXl2KuKlo63bavFr3S5xhr6ctRZAEv0/Q80DQ7n1IKKU9mM1pEwweFNsmReBDV 3KHt0ZgRh8LvUbZvdX93Y8Y25dnaQwYjHt21QhYYEC0YMENGXWgbx/fHp+yYGFLtPO1B R/AFkx6Jou0rONGbBLKXPUe0TUvFkQJqx/lvyoOeFyYVyGmue5dvF4hEnUeYhFtntxLI 9zaUb57l3EmOTM+1iQ2tlNpN8xIgp6oebXGyC3X/vQRdOLSJlcmdXMl67AKcwCoHXZS7 hUwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="D/jrowO1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s20si6647091ioa.93.2021.08.18.06.25.28; Wed, 18 Aug 2021 06:25:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="D/jrowO1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236930AbhHRNW5 (ORCPT + 99 others); Wed, 18 Aug 2021 09:22:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:35734 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236892AbhHRNW4 (ORCPT ); Wed, 18 Aug 2021 09:22:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A0D7160232; Wed, 18 Aug 2021 13:22:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1629292942; bh=mUS2XHoBNSYTIuTRFqsUU57sxADOx3BgsDP98f3EzMY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=D/jrowO11usaVNWUNbge+kprse4L+XNseJefutlHU6ZDzNuidRBevYMPNo/9Scubx W7zY9wGu29+Wfb+b2voB6OMjqKXLQfMtNJj2oqiQhxnyOkRIVF2/fCxoxuvNdvB5/t LqtqTz1iIBHfptgtYoXwhTo/5uyyCjwpQEZFFMFk= Date: Wed, 18 Aug 2021 15:22:19 +0200 From: Greg Kroah-Hartman To: Mark Brown Cc: Pierre-Louis Bossart , alsa-devel@alsa-project.org, tiwai@suse.de, vkoul@kernel.org, liam.r.girdwood@linux.intel.com, Andy Shevchenko , Dan Williams , Jason Gunthorpe , Christoph Hellwig , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: Re: [RFC PATCH 1/2] driver core: export driver_deferred_probe_trigger() Message-ID: References: <20210817190057.255264-1-pierre-louis.bossart@linux.intel.com> <20210817190057.255264-2-pierre-louis.bossart@linux.intel.com> <20210818115736.GA4177@sirena.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210818115736.GA4177@sirena.org.uk> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 18, 2021 at 12:57:36PM +0100, Mark Brown wrote: > On Wed, Aug 18, 2021 at 07:44:39AM +0200, Greg Kroah-Hartman wrote: > > On Tue, Aug 17, 2021 at 02:00:56PM -0500, Pierre-Louis Bossart wrote: > > > > In these cases, there is no way to notify the deferred probe > > > infrastructure of the enablement of resources after the driver > > > binding. > > > Then just wait for it to happen naturally? > > Through what mechanism will it happen naturally? Deferred probe > currently only does things if things are being registered or if probes > complete. > > > > The driver_deferred_probe_trigger() function is currently used > > > 'anytime a driver is successfully bound to a device', this patch > > > suggest exporing by exporting it so that drivers can kick-off > > > re-probing of deferred devices at the end of a deferred processing. > > > I really do not want to export this as it will get really messy very > > quickly with different drivers/busses attempting to call this. > > I'm not sure I see the mess here - it's just queueing some work, one of > the things that the workqueue stuff does well is handle things getting > scheduled while they're already queued. Honestly having understood > their problem I think we need to be adding these calls into all the > resource provider APIs. > > > Either handle it in your driver (why do you have to defer probe at all, > > just succeed and move on to register the needed stuff after you are > > initialized) or rely on the driver core here. > > That's exactly what they're doing currently and the driver core isn't > delivering. > > Driver A is slow to start up and providing a resource to driver B, this > gets handled in driver A by succeeding immediately and then registering > the resource once the startup has completed. Unfortunately while that > was happening not only has driver B registered and deferred but the rest > of the probes/defers in the system have completed so the deferred probe > mechanism is idle. Nothing currently tells the deferred probe mechanism > that a new resource is now available so it never retries the probe of > driver B. The only way I can see to fix this without modifying the > driver core is to make driver A block during probe but that would at > best slow down boot. > > The issue is that the driver core is using drivers completing probe as a > proxy for resources becoming available. That works most of the time > because most probes are fully synchronous but it breaks down if a > resource provider registers resources outside of probe, we might still > be fine if system boot is still happening and something else probes but > only through luck. The driver core is not using that as a proxy, that is up to the driver itself or not. All probe means is "yes, this driver binds to this device, thank you!" for that specific bus/class type. That's all, if the driver needs to go off and do real work before it can properly control the device, wonderful, have it go and do that async. So if you know you should be binding to the device, great, kick off some other work and return success from probe. There's no reason you have to delay or defer for no good reason, right? But yes, if you do get new resources, the probe should be called again, that's what the deferred logic is for (or is that the link logic, I can't recall) This shouldn't be a new thing, no needing to call the driver core directly like this at all, it should "just happen", right? thanks, greg k-h