Received: by 10.192.165.148 with SMTP id m20csp723250imm; Wed, 2 May 2018 07:49:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrbXKvpRslCAqQD1eRfWx8TPmh8PO1kzU4eNBcaT0qgAVomjA2/3vzji2n8NH46PaqNrSNt X-Received: by 2002:a65:6592:: with SMTP id u18-v6mr8584176pgv.366.1525272588753; Wed, 02 May 2018 07:49:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525272588; cv=none; d=google.com; s=arc-20160816; b=e7v4JlroXp0AU8M2teLgfPIV+I4Au4sk3HwEKDzMvECRrW/zjUD2MLHEzjZMZAyVK8 ZJNWpnf2E0n1eZs6+cro48sMdBpyc+mEDiPNMNbX/BIDOKC2q+WxLZV0s/S6WLtz0/4g ZeZaIgk+kaG3Ovcf2UY8qEuuOblTDB+Mbm4g+ZNrHuki2peKzTU2RUBg3YAkjYgqzica fsoa5KVntx8VNwQMYlJMVTrWmqfd70su9w1MycLIXe5CRsq/0vAA2aXe0FOWq/gdH8Uy Ut8m2P8iaz1Vt0H7xZdYPPLefJERmYUC/JhTZdJKDfLpFX3FCGZLrL6+7SrijBXGTeJp eXCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=mTiMHUYHoHD2hA3zFZZZGOmuBFxpCtjieOMQTKy4Mec=; b=U3Kf7P0ZMGMXnb8AdAdttkU6NDu+4hgG8sHyxyJrV9u6ABupDtxG6+Zn1sCK/0hxOM cnnRboYjt/s5AAxOp0B8GpGHLLcErqQwYTQhkQ3rF7ujLd+H4cOAT0W9C+Vw60aaf1WJ t8p2nWQG3C+viu2sp/k+RGkJUkRSri4Mf9KBlISOjFzGZqApv36ln21VcfrtBnu3eTSK jZWSWAN2kmcjLEBr2tXbVYVj0EuEv8XFsdYasP+nCJLPj7L67zQJ71Uqh1cP4kXkUkAe bARlT5asLm9DtcegCE6gIu4WOFqcA+PwOOx4uHM7Ni3Ye8lkcHBeiDG0gB2LR5iQcqZY qdpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cyQRPOhy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y23si11749998pff.177.2018.05.02.07.49.34; Wed, 02 May 2018 07:49:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cyQRPOhy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751598AbeEBOtR (ORCPT + 99 others); Wed, 2 May 2018 10:49:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:40100 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751292AbeEBOtO (ORCPT ); Wed, 2 May 2018 10:49:14 -0400 Received: from mail-qt0-f177.google.com (mail-qt0-f177.google.com [209.85.216.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 20C2A22B32; Wed, 2 May 2018 14:49:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1525272554; bh=mTiMHUYHoHD2hA3zFZZZGOmuBFxpCtjieOMQTKy4Mec=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=cyQRPOhyAIro4ewjTfL2M2Sm1ZmuqaY4BLHxVE9Aa/3Ky6cUipJ5JSmbQ1+hEgsur sra9TC9/39F50yD5ryXNykXNlKit6ve/jAMi/k/Ci0eGnKRMAcuuTrBdX2yr0+qIiA 0Zi8To6BHTsudMkwwerPDk8fjpqF0MeaAzq7pwNs= Received: by mail-qt0-f177.google.com with SMTP id m5-v6so18722004qti.1; Wed, 02 May 2018 07:49:14 -0700 (PDT) X-Gm-Message-State: ALQs6tD453k5bJplr+nirlxcTihE5sXuRwQPSvn9XmoIFsMxyNF6kb49 1P7lnUM64rFYSIU95/+B9dmZz2KF5UsVjQ+VjQ== X-Received: by 2002:aed:26c3:: with SMTP id q61-v6mr17635313qtd.60.1525272553196; Wed, 02 May 2018 07:49:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.155.2 with HTTP; Wed, 2 May 2018 07:48:52 -0700 (PDT) In-Reply-To: References: <20180501213114.20183-1-robh@kernel.org> From: Rob Herring Date: Wed, 2 May 2018 09:48:52 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH] driver core: make deferring probe forever optional To: Robin Murphy Cc: "linux-kernel@vger.kernel.org" , devicetree@vger.kernel.org, boot-architecture@lists.linaro.org, Stephen Boyd , Greg Kroah-Hartman , Linus Walleij , Alexander Graf , Grant Likely , Mark Brown , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 2, 2018 at 6:40 AM, Robin Murphy wrote: > On 01/05/18 22:31, Rob Herring wrote: >> >> Deferred probe will currently wait forever on dependent devices to probe, >> but sometimes a driver will never exist. It's also not always critical for >> a driver to exist. Platforms can rely on default configuration from the >> bootloader or reset defaults for things such as pinctrl and power domains. >> This is often the case with initial platform support until various drivers >> get enabled. There's at least 2 scenarios where deferred probe can render >> a platform broken. Both involve using a DT which has more devices and >> dependencies than the kernel supports. The 1st case is a driver may be >> disabled in the kernel config. The 2nd case is the kernel version may >> simply not have the dependent driver. This can happen if using a newer DT >> (provided by firmware perhaps) with a stable kernel version. >> >> Unfortunately, this change breaks with modules as we have no way of >> knowing when modules are done loading. One possibility is to make this >> opt in or out based on compatible strings rather than at a subsystem >> level. >> Ideally this information could be extracted automatically somehow. OTOH, >> maybe the lists are pretty small. There's only a handful of subsystems >> that can be optional, and then only so many drivers in those that can be >> modules (at least for pinctrl, many drivers are built-in only). > > > Ooh, this is exactly what I wanted for of_iommu_xlate(), and would be much > nicer than the current bodge using system_state that I ended up with. The > context there is very similar - if the device has a parent IOMMU then we > want to wait for that to probe first if possible, but with a deadline such > that if it doesn't show up then we can go ahead and make progress without it > (on the assumption that DMA ops can fall back to CMA). The modules problem > doesn't currently apply to IOMMU drivers either, although we do use a > special of_device_id table for detecting built-in drivers via > OF_IOMMU_DECLARE() to avoid deferring at all when we know it would be > pointless - a more generic solution for that could certainly be useful too. Ah, so you kept the IOMMU_OF_DECLARE() but it does nothing but define a table. We already have the driver match table which should pretty much be the same data, so it would be better if we could use that if possible. If we used MODULE_DEVICE_TABLE somehow, we could avoid modifying lots of drivers. Though many built-in only drivers omit that. The other problem is it would become a large set of tables to search thru because it is global. That would probably end up slower than just deferring. So we need something like _DEVICE_TABLE() to have per subsystem tables. Then this function in this patch would need to be told which table to use. However, this is all really just an optimization to avoid deferring at all and could be addressed later. Is there any data on how much time you save avoiding deferring? This has come up in the past and I don't think it is much. I've also been thinking about if we could use MODULE_DEVICE_TABLE to provide a list compatible strings from modules as a whitelist of devices to keep deferring probe on. That would require building modules to build the kernel which I don't think would work. I think my conclusion is that the cases we care about may be short enough to just manually maintain such a list. > > I agree with Greg that the naming here is a bit tricky - FWIW my initial > thought would be something like driver_defer_until_init(), which is still > clunky but at least imperative. Yeah, I didn't give it much thought as I expected more comments on the general idea... Maybe my poor naming is a good diversion. :) Rob