Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1135198pxb; Fri, 27 Aug 2021 01:56:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkDJ/SFftrI8uQhsPXlMzptCePnByhr/6JamUeBwPeTV3WT1CdvX+iRRYeV9SFMnJTrsSx X-Received: by 2002:a92:b308:: with SMTP id p8mr5774222ilh.296.1630054576078; Fri, 27 Aug 2021 01:56:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630054576; cv=none; d=google.com; s=arc-20160816; b=j7gYyN/juG9gAXlvuJWnD33/xnaaShloFKA98zgCxbyFE/AxC78Bee1FWjvhaQe2G5 Voo3bQX3Tl9jyDjF16nY4mMEFoBpKf3mE8mPkXlk9oOp+zNDNOEFTsnHDacUq3YzfSTy 3X6qy8OBlvbZzCy5aIzBfK0joEWa65oS5eJXoL/CGs0b2CmzTmZH/KYGimF1xHAQuEDH iUMxgPqwt2k+Ql17GuGLE1+nPfwoFEBH6M5UIQ6a87kNSteW+XU4t0SZsCoU6ZWfc0PW 8fpUWKgn3piSTD7g5PI6rdxMfXGn7IYpzDHBNwpVAkKyu6zlS1gz9+/taoVMWsA6vY2s B8iQ== 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=gPQhK1qtQV8NwST5mSUs/RIjk3cF+9djzWG6uDFSxUI=; b=iselGTDd9OeS2Zn4PiAm9l58dTPcKCv748nLrgEs+uc6vTd66pXUti2Q5vcehTAfhR FUCkt98P1xRRUZAvEYSpDIR/8ylIWySYKzPG034fiXCHXr8wAwV6IK58krp1gkJcjeEi KbgMCieaoKLeOBM9PP606gQeO/kWuYAluaprUX0wI99yA8Fzej/Gpssv8wTHIM1c39ky IuHDMjQ32esdLQ2kYs4rfdZ5hgjdeCqRXScjgcwHEbdXN/Km1XkO0AEnTQr3og8K8qy0 Lel+uG8mKLWDqbjMQKs2YFNm40gP8hNgOVTyM/VsATEPo8HM7lo4e6UzIPOgBTp5bVTb 6xPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zbF4yT77; 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 h11si5831653ild.67.2021.08.27.01.56.04; Fri, 27 Aug 2021 01:56:16 -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=zbF4yT77; 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 S244674AbhH0Ize (ORCPT + 99 others); Fri, 27 Aug 2021 04:55:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:49600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244633AbhH0Izd (ORCPT ); Fri, 27 Aug 2021 04:55:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8B1D460FD7; Fri, 27 Aug 2021 08:54:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1630054484; bh=I4OSagZ5PhshquG/nT4l4loCANal63pPThrGcodwOGk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=zbF4yT77K3mYeol+bTXUObOaGi0srbXejTzNVTatAEScCBdCTAERYMj26WCrBmUJl bfSY0JmAJimOL29Eu3RxGnTo8rd9YFnJdZfYNyrj0mrTQJSryRYnPSMg8kquwL+K2J MgfPvoVgNNVB1A8wtBlg8dUhQDl75qxsWFYwdOZY= Date: Fri, 27 Aug 2021 10:54:40 +0200 From: Greg Kroah-Hartman To: Saravana Kannan Cc: Marek Szyprowski , Russell King , Philipp Zabel , Rob Herring , Ulf Hansson , John Stultz , Linus Walleij , Sudeep Holla , Nicolas Saenz Julienne , Geert Uytterhoeven , Android Kernel Team , LKML Subject: Re: [PATCH v3] amba: Remove deferred device addition Message-ID: References: <20210304195101.3843496-1-saravanak@google.com> <30b4141e-11bd-45a2-b890-fddf444548ea@samsung.com> <077fcc5b-cd09-d587-6906-d10bcc991eaf@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 24, 2021 at 12:26:16PM -0700, Saravana Kannan wrote: > On Mon, Mar 8, 2021 at 11:15 AM Saravana Kannan wrote: > > > > On Sun, Mar 7, 2021 at 11:28 PM Marek Szyprowski > > wrote: > > > > > > Hi Saravana, > > > > > > On 05.03.2021 19:02, Saravana Kannan wrote: > > > > On Fri, Mar 5, 2021 at 3:45 AM Marek Szyprowski > > > > wrote: > > > >> On 04.03.2021 20:51, Saravana Kannan wrote: > > > >>> The uevents generated for an amba device need PID and CID information > > > >>> that's available only when the amba device is powered on, clocked and > > > >>> out of reset. So, if those resources aren't available, the information > > > >>> can't be read to generate the uevents. To workaround this requirement, > > > >>> if the resources weren't available, the device addition was deferred and > > > >>> retried periodically. > > > >>> > > > >>> However, this deferred addition retry isn't based on resources becoming > > > >>> available. Instead, it's retried every 5 seconds and causes arbitrary > > > >>> probe delays for amba devices and their consumers. > > > >>> > > > >>> Also, maintaining a separate deferred-probe like mechanism is > > > >>> maintenance headache. > > > >>> > > > >>> With this commit, instead of deferring the device addition, we simply > > > >>> defer the generation of uevents for the device and probing of the device > > > >>> (because drivers needs PID and CID to match) until the PID and CID > > > >>> information can be read. This allows us to delete all the amba specific > > > >>> deferring code and also avoid the arbitrary probing delays. > > > >>> > > > >>> Cc: Rob Herring > > > >>> Cc: Ulf Hansson > > > >>> Cc: John Stultz > > > >>> Cc: Saravana Kannan > > > >>> Cc: Linus Walleij > > > >>> Cc: Sudeep Holla > > > >>> Cc: Nicolas Saenz Julienne > > > >>> Cc: Geert Uytterhoeven > > > >>> Cc: Marek Szyprowski > > > >>> Cc: Russell King > > > >>> Signed-off-by: Saravana Kannan > > > >>> --- > > > >>> > > > >>> v1 -> v2: > > > >>> - Dropped RFC tag > > > >>> - Complete rewrite to not use stub devices. > > > >>> v2 -> v3: > > > >>> - Flipped the if() condition for hard-coded periphids. > > > >>> - Added a stub driver to handle the case where all amba drivers are > > > >>> modules loaded by uevents. > > > >>> - Cc Marek after I realized I forgot to add him. > > > >>> > > > >>> Marek, > > > >>> > > > >>> Would you mind testing this? It looks okay with my limited testing. > > > >> It looks it works fine on my test systems. I've checked current > > > >> linux-next and this patch. You can add: > > > >> > > > >> Tested-by: Marek Szyprowski > > > > Hi Marek, > > > > > > > > Thanks! Does your test set up have amda drivers that are loaded based > > > > on uevents? That's the one I couldn't test. > > > > > > I've checked both, the built-in and all amba drivers compiled as > > > modules, loaded by udev. Both works fine here. > > > > > > >> I've briefly scanned the code and I'm curious how does it work. Does it > > > >> depend on the recently introduced "fw_devlink=on" feature? I don't see > > > >> other mechanism, which would trigger matching amba device if pm domains, > > > >> clocks or resets were not available on time to read pid/cid while adding > > > >> a device... > > > > No, it does not depend on fw_devlink or device links in any way. > > > > > > > > When a device is attempted to be probed (when it's added or during > > > > deferred probe), it's matched with all the drivers on the bus. > > > > When a new driver is registered to a bus, all devices in that bus are > > > > matched with the driver to see if they'll work together. > > > > That's how match is called. And match() can return -EPROBE_DEFER and > > > > that'll cause the device to be put in the deferred probe list by > > > > driver core. > > > > > > > > The tricky part in this patch was the uevent handling and the > > > > chicken-and-egg issue I talk about in the comments. > > > > > > Thanks for the explanation. This EPROBE_DEFER support in match() > > > callback must be something added after I crafted that periodic retry > > > based workaround. > > > > > > > I think it got in just a few months before your patches, but your > > patches worked :) I actually don't like match returning -EPROBE_DEFER, > > but I can work around it for some of my fw_devlink optimization plans. > > > > More context here: > > https://lore.kernel.org/lkml/CAGETcx_qO4vxTSyBtBR2k7fd_3rGJF42iBbJH37HPNw=FheDKg@mail.gmail.com/ > > I just noticed that this still hasn't been picked up. > > Russell/Greg, can we please pick this up. This finally cleans up > deferred probing of AMBA devices so that they don't have any special > case. Now picked up, thanks. greg k-h