Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3169285pxb; Tue, 19 Jan 2021 16:04:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJw2tdbcW93v03mVb4vIIyEwbozsfQsNLfGL4YRwezRzBwvs4tHyLEVvDDCEt02IgzZhi/E1 X-Received: by 2002:a17:906:1987:: with SMTP id g7mr4862280ejd.316.1611101058506; Tue, 19 Jan 2021 16:04:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611101058; cv=none; d=google.com; s=arc-20160816; b=lUS1sIaNEnVoJaX+ukIgoZq6icVtZDe4NVZV5hKmrAwbb1cmoCxhRNmnIxL9WFLSJ7 q69N6yGS5Wqt+T7fZth3dOMuvtv+Qv7vmuw57X/+UYCVk+VzSdAZlJsxANEGKnSrci1S 9jyRNpbek5b2fNfcG2kt9Jh5Sw2fWMIATmUedKeoA6X95kBDhcMXESxGpac87yOSUFbw rlZZ848pmA6leurZmFSZ7yEDi5a63wCjQuzxeByype9PRDQwa34xzxfjCI7okRCATGFG XWvnlNv1AjXVXg0rnnC9alN14adlelgPr3pq6opQ0kTuo10Bes3d97nlFQ1PRikaJNyi R+KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=sXowcYDvZcXKMzrFe9FqqTDON419/OKr3sdTZYFlcNc=; b=F3fV2MC8vZXywz8nz12ZF0iCSMYkdnOBisy/sBMiByGqNbAaWY53QSd//ccz9uQ4VX iP0cb7YCf86UZkhOimWo/b6XozGWG/Ff4+uG1cItvsSa+EepoxsXRfgkbo7ADKSzu426 Uhsukowy4Gn7JwewJTUcUON0TwvRQqnB437oZqI/qyIyicWaefN6IF52Lz/AQrw1qe0C FBx3/Uag2j9IpBZh4DOcwMuRt/i6dzqkHu/I3ISY4ywMX0n2/w7u48sCHKGana44jhK8 ut91vy2/CIdTREUoIxlcsb9K8fUhTv7By+Wt8/2mWpvkpXzsu+ngx19DVg35QtjYgQjK BxdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="j0I/oY65"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ce20si156852edb.138.2021.01.19.16.03.26; Tue, 19 Jan 2021 16:04:18 -0800 (PST) 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=@google.com header.s=20161025 header.b="j0I/oY65"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731296AbhATACe (ORCPT + 99 others); Tue, 19 Jan 2021 19:02:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730958AbhATABa (ORCPT ); Tue, 19 Jan 2021 19:01:30 -0500 Received: from mail-yb1-xb2a.google.com (mail-yb1-xb2a.google.com [IPv6:2607:f8b0:4864:20::b2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E6D3C061575 for ; Tue, 19 Jan 2021 16:00:50 -0800 (PST) Received: by mail-yb1-xb2a.google.com with SMTP id k132so10610213ybf.2 for ; Tue, 19 Jan 2021 16:00:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sXowcYDvZcXKMzrFe9FqqTDON419/OKr3sdTZYFlcNc=; b=j0I/oY65AvJ7CU54ULhJ1qeloJ+tUy7Suv13S/8UGRdct5S1U8jqJtgzxSw4bqgHo0 yrK3A/QwKI/9olI6wVBRt2hybEi1JNg5UciXh8FDI9oyJqGr4kiAc6bZq48259pH9cpX gd1k93jSKgdDgnpcNnX/C73ZSypJxkVZUOHBO48boKgjMvSsPr1EDj6vsQdL9axQLRrc /T9nB0wQRj1MlR7RxqmLvOKSgoyko5pIvX7rcpazCz4FXZxcCfzIn5VY9zfwABcTcn07 g/eariP4frZx7HX41ZYN8COsV2lZk0Yg3ygglu2ORdvSh6nAzSQrZCHIGkIzxBcFmSlY uO+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sXowcYDvZcXKMzrFe9FqqTDON419/OKr3sdTZYFlcNc=; b=UUlY0duU9nFR1eKKQvhaytZKacZ4wkW6kBzAUWypOE7QjDqhMtnbfzsC6OP+3Q4iCJ zzaIxEGBzSjbcrGHdJ9o5JemavXucyre4h5cgirnRqgvQEjLXTntQ/BXtBJ61usFHqiO o5xc2x78TqaEYIfOPU09lz7jFgYTLyrclYbHThr1z0T2vCaPeNB8K6pvohJdvrowRqzR ryifFFLJ5RE5O6kqzOW2SDT3w0yhHQqlc9EiiuRiapZ6XXEnyGhn8Nb7QaaLK6SX6g+o V8u+6L0wcf7qrGghfwP4bmPEwIaHF4cjCi3lk+LntMnMKamU8t4Hs6viPMxZ/uExkLrA tnrQ== X-Gm-Message-State: AOAM530dBmueFLOLqYsW9xrqukE0MNR7SIL5B46Nr4QTxKd3tQjI2NaV d8krwL9YqJB68aZM6Q9BwTm9w3aDDGWkvRS9nblraQ== X-Received: by 2002:a25:77d4:: with SMTP id s203mr10670708ybc.32.1611100849671; Tue, 19 Jan 2021 16:00:49 -0800 (PST) MIME-Version: 1.0 References: <20201218031703.3053753-6-saravanak@google.com> <20210117230134.32042-1-michael@walle.cc> <4b9ae679b6f76d2f7e340e2ec229dd53@walle.cc> In-Reply-To: <4b9ae679b6f76d2f7e340e2ec229dd53@walle.cc> From: Saravana Kannan Date: Tue, 19 Jan 2021 16:00:13 -0800 Message-ID: Subject: Re: [PATCH v1 5/5] driver core: Set fw_devlink=on by default To: Michael Walle Cc: Jisheng Zhang , Greg Kroah-Hartman , John Stultz , Android Kernel Team , Kevin Hilman , LKML , Marc Zyngier , Nicolas Saenz Julienne , "Rafael J. Wysocki" , minghuan.Lian@nxp.com, mingkai.hu@nxp.com, roy.zang@nxp.com, Linux PCI Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 19, 2021 at 2:41 AM Michael Walle wrote: > > Am 2021-01-18 22:01, schrieb Saravana Kannan: > > On Sun, Jan 17, 2021 at 3:01 PM Michael Walle wrote: > >> > Cyclic dependencies in some firmware was one of the last remaining > >> > reasons fw_devlink=on couldn't be set by default. Now that cyclic > >> > dependencies don't block probing, set fw_devlink=on by default. > >> > > >> > Setting fw_devlink=on by default brings a bunch of benefits (currently, > >> > only for systems with device tree firmware): > >> > * Significantly cuts down deferred probes. > >> > * Device probe is effectively attempted in graph order. > >> > * Makes it much easier to load drivers as modules without having to > >> > worry about functional dependencies between modules (depmod is still > >> > needed for symbol dependencies). > >> > > >> > If this patch prevents some devices from probing, it's very likely due > >> > to the system having one or more device drivers that "probe"/set up a > >> > device (DT node with compatible property) without creating a struct > >> > device for it. If we hit such cases, the device drivers need to be > >> > fixed so that they populate struct devices and probe them like normal > >> > device drivers so that the driver core is aware of the devices and their > >> > status. See [1] for an example of such a case. > >> > > >> > [1] - https://lore.kernel.org/lkml/CAGETcx9PiX==mLxB9PO8Myyk6u2vhPVwTMsA5NkD-ywH5xhusw@mail.gmail.com/ > >> > Signed-off-by: Saravana Kannan > >> > >> This breaks (at least) probing of the PCIe controllers of my board. > >> The > >> driver in question is > >> drivers/pci/controller/dwc/pci-layerscape.c > >> I've also put the maintainers of this driver on CC. Looks like it uses > >> a > >> proper struct device. But it uses builtin_platform_driver_probe() and > >> apparently it waits for the iommu which uses module_platform_driver(). > >> Dunno if that will work together. > > > > Yeah, the builtin vs module doesn't matter. I've had fw_devlink work > > multiple times with the consumer driver being built in and the > > supplier actually loaded as a module. Making that work is one of the > > goals of fw_devlink. > > Ok. Hi Michael, My bad, I spoke too soon. I thought you were talking about builtin_ vs module_. My response is correct in that context. But the problem here is related to builtin_platform_driver_probe(). That macro expects the device (PCI) to be added and ready to probe by the time it's called. If not, it just gives up and frees the code. That's why it's not getting called after the first attempt. Can you please convert it into builtin_platform_driver()? It should be a pretty trivial change. -Saravana > > >> The board device tree can be found here: > >> arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var3-ads2.dts > >> > >> Attached is the log with enabled "probe deferral" messages enabled. > > > > I took a look at the logs. As you said, pci seems to be waiting on > > iommu, but it's not clear why the iommu didn't probe by then. Can you > > add initcall_debug=1 and enable the logs in device_link_add()? Btw, I > > realize one compromise on the logs is to send them as an attachment > > instead of inline. That way, it's still archived in the list, but I > > don't have to deal with log lines getting wrapped, etc. > > > > Thanks for reporting the issues. Also, could you try picking up all of > > these changes and giving it a shot. It's unlikely to help, but I want > > to rule out issues related to fixes in progress. > > > > https://lore.kernel.org/lkml/20210116011412.3211292-1-saravanak@google.com/ > > https://lore.kernel.org/lkml/20210115210159.3090203-1-saravanak@google.com/ > > https://lore.kernel.org/lkml/20201218210750.3455872-1-saravanak@google.com/ > > Did pick them up, the last one had a conflict due some superfluous > lines. > Maybe they got reordered in that arrray. > > Issue still persist. I've enabled the debug in device_link_add(), in > device_links_check_suppliers() and booted with initcall_debug. Please > see attached log. Lets see how that goes ;) > > [ 0.132687] calling ls_pcie_driver_init+0x0/0x38 @ 1 > [ 0.132762] platform 3400000.pcie: probe deferral - supplier > 5000000.iommu not ready > [ 0.132777] platform 3500000.pcie: probe deferral - supplier > 5000000.iommu not ready > [ 0.132818] initcall ls_pcie_driver_init+0x0/0x38 returned -19 after > 119 usecs > > After that, ls_pcie_driver_init() is never called again. > > -michael