From patchwork Wed Apr 22 20:32:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 185699 Delivered-To: patches@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp1229878ilf; Wed, 22 Apr 2020 13:33:03 -0700 (PDT) X-Received: by 2002:a63:b256:: with SMTP id t22mr810758pgo.92.1587587583482; Wed, 22 Apr 2020 13:33:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587587583; cv=none; d=google.com; s=arc-20160816; b=em1IzfmQKFdRfGCT0Dq4Icf1T4c64IMyqvac1OxZPzzm4SAbWlimv3f0/rgzQkUqk4 luylrHygQr1RwdrQMwi27a51uZNmCSUE46XJm4/+gPF8RNnehxlPg1s3dmgK+AbEeVsU bII7grE7ShHOsg6a0xNszjYpg6W0RvY5JRXitJlzmnLDDhPHqTHaSqfU/6sbbM0FAVh0 Bh/3QcuIaYqsGsFYY6CmPoNHWfT902RxtBnOD+FmfDC5cpslEMCQpy+cmQXYljvBAuEm eMRQzC8ICN5IblvkpiQKrpOh2SVFm3ODiKwAV5KRzXyAb1thGjSy8a2jDbK1SHLpTbef bGaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tKbiuFbiZC2D1ImIHBQi0x36vK7Jcd27HL1H3KbbNwE=; b=lITv2zDjlQjP2ayf96/lbUxJyIKl2Z0WzhAcFg6fmM/hk/Uvd7XmSEZgRlVya0kc05 OCZpN2PvLJr/OnF/4zcLA2QWqun2kKKj2KFVFLabO9nPeAgOegGE2nk+T57eMY7/uNm4 ibHlWCZ2GFsAI1R5qSzWsA0cFABBV5GOnMgeQvqwjTyJcVcQ1Iq3x+tAVgczeSe6grZT j+digTb/E62Z4/a/EIGoMjgbFx6tIVhffI8x2YVuLoCGRouWM4zlK5r6KYHfQbLTskzG 1x/BO2EYNS960YPdwOJXntwj/IeMN+tkKhmyQJL/Sl5aviMy9IjuWC1ZO4EihXQacEQg CjoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jtXnZxTj; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id u15sor665344plq.16.2020.04.22.13.33.03 for (Google Transport Security); Wed, 22 Apr 2020 13:33:03 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jtXnZxTj; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tKbiuFbiZC2D1ImIHBQi0x36vK7Jcd27HL1H3KbbNwE=; b=jtXnZxTje+esnJi9OvNJ9lL0EfuD8nLu8pEU2HsoVZcg/CcP2zGyKA3ip87zMACuqC 8IlyHWtGZ3RDEGhMv1ojVcGzgcQ2UzGav1z8V9DVG46RPsrPFRbAQJKI1wqNKsZ/VnLa g3d28TJUfTOc2mB+OAcyAD67MLfZPLhPHuZLuE4I0tNKuDK5j5se4VPIjC56kkPNukxW nKMInSzxn/+VkR9MDaoQqWec8Mas1GxhOcVr5cZg3aNUZJBGcm5thaecm/GrELurVIjW 8OlM2Vqbe0pj6/rPfZGfZSokntDvKsAiIJnmF8cDaXKsHjGu82Twh55kz59Q60VlC2ct 0XDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tKbiuFbiZC2D1ImIHBQi0x36vK7Jcd27HL1H3KbbNwE=; b=LYCOzTZ5i7hu1x1NtMZVkALv0JH+yL2Iw1vfnZHT7bJo048tq+l64LU+VqVlC2dYNe jXXAffK865MTpew0TDKTS/HW9qb+P2PpIN/EVNVzYsjGslUo/8QvuoKupaQ1o8LGYGil NWm1w7GHV1dYxla1XyGAJFXxQSaEi6RfE9op6hihD1HJtTAoBVJYXTUJ8Y6XLzeZ6ydG 2Q3JC8e1fPi9NlxAFmKVZIjo2DO3s2CbNw25hMQfoR1fJ4nL8Joh87IgeHLyppHOxbTS N5wCRz9XXTHhlM/NHPRR+BAKUIAfR8LKvJsIj346bjYOYnWnIoomwRZZmIGvDl21uMiJ 2XfA== X-Gm-Message-State: AGi0Pua/BKnHYIxob0EyZtrxV2kuPUn3O5yhSRrQa/JdRt+ybHi9RfW1 NdcjnL70AwA8Bo1IFGgT+jC7UNWV X-Google-Smtp-Source: APiQypJU20peyuHuafIh34ajjRyIE0Frxlgkvku9w3XkjEew13yPlsFgnIJ3FqXvus+Ek2lmVgQrQg== X-Received: by 2002:a17:902:9347:: with SMTP id g7mr432520plp.77.1587587583090; Wed, 22 Apr 2020 13:33:03 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id b24sm360292pfd.175.2020.04.22.13.33.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2020 13:33:02 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , "David S. Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , Jakub Kicinski , Greg Kroah-Hartman , "Rafael J . Wysocki" , Rob Herring , Geert Uytterhoeven , Yoshihiro Shimoda , Robin Murphy , Andy Shevchenko , Sudeep Holla , Andy Shevchenko , Naresh Kamboju , Basil Eljuse , Ferry Toth , Arnd Bergmann , Anders Roxell , netdev , linux-pm@vger.kernel.org Subject: [PATCH v3 1/3] driver core: Revert default driver_deferred_probe_timeout value to 0 Date: Wed, 22 Apr 2020 20:32:43 +0000 Message-Id: <20200422203245.83244-2-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200422203245.83244-1-john.stultz@linaro.org> References: <20200422203245.83244-1-john.stultz@linaro.org> This patch addresses a regression in 5.7-rc1+ In commit c8c43cee29f6 ("driver core: Fix driver_deferred_probe_check_state() logic"), we both cleaned up the logic and also set the default driver_deferred_probe_timeout value to 30 seconds to allow for drivers that are missing dependencies to have some time so that the dependency may be loaded from userland after initcalls_done is set. However, Yoshihiro Shimoda reported that on his device that expects to have unmet dependencies (due to "optional links" in its devicetree), was failing to mount the NFS root. In digging further, it seemed the problem was that while the device properly probes after waiting 30 seconds for any missing modules to load, the ip_auto_config() had already failed, resulting in NFS to fail. This was due to ip_auto_config() calling wait_for_device_probe() which doesn't wait for the driver_deferred_probe_timeout to fire. Fixing that issue is possible, but could also introduce 30 second delays in bootups for users who don't have any missing dependencies, which is not ideal. So I think the best solution to avoid any regressions is to revert back to a default timeout value of zero, and allow systems that need to utilize the timeout in order for userland to load any modules that supply misisng dependencies in the dts to specify the timeout length via the exiting documented boot argument. Thanks to Geert for chasing down that ip_auto_config was why NFS was failing in this case! Cc: "David S. Miller" Cc: Alexey Kuznetsov Cc: Hideaki YOSHIFUJI Cc: Jakub Kicinski Cc: Greg Kroah-Hartman Cc: Rafael J. Wysocki Cc: Rob Herring Cc: Geert Uytterhoeven Cc: Yoshihiro Shimoda Cc: Robin Murphy Cc: Andy Shevchenko Cc: Sudeep Holla Cc: Andy Shevchenko Cc: Naresh Kamboju Cc: Basil Eljuse Cc: Ferry Toth Cc: Arnd Bergmann Cc: Anders Roxell Cc: netdev Cc: linux-pm@vger.kernel.org Reported-by: Yoshihiro Shimoda Tested-by: Yoshihiro Shimoda Fixes: c8c43cee29f6 ("driver core: Fix driver_deferred_probe_check_state() logic") Signed-off-by: John Stultz --- drivers/base/dd.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) -- 2.17.1 diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 06ec0e851fa1..908ae4d7805e 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -224,16 +224,7 @@ static int deferred_devs_show(struct seq_file *s, void *data) } DEFINE_SHOW_ATTRIBUTE(deferred_devs); -#ifdef CONFIG_MODULES -/* - * In the case of modules, set the default probe timeout to - * 30 seconds to give userland some time to load needed modules - */ -int driver_deferred_probe_timeout = 30; -#else -/* In the case of !modules, no probe timeout needed */ -int driver_deferred_probe_timeout = -1; -#endif +int driver_deferred_probe_timeout; EXPORT_SYMBOL_GPL(driver_deferred_probe_timeout); static int __init deferred_probe_timeout_setup(char *str) @@ -266,7 +257,7 @@ int driver_deferred_probe_check_state(struct device *dev) return -ENODEV; } - if (!driver_deferred_probe_timeout) { + if (!driver_deferred_probe_timeout && initcalls_done) { dev_WARN(dev, "deferred probe timeout, ignoring dependency"); return -ETIMEDOUT; } From patchwork Wed Apr 22 20:32:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 185700 Delivered-To: patches@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp1229903ilf; Wed, 22 Apr 2020 13:33:04 -0700 (PDT) X-Received: by 2002:a62:e803:: with SMTP id c3mr318886pfi.228.1587587584788; Wed, 22 Apr 2020 13:33:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587587584; cv=none; d=google.com; s=arc-20160816; b=P2TEpiBSyEjFGjiNUCm8l+/+ZXL8Gz/bT4INWjLhNAHRdqfsOdiBKCX3zC9KqouY58 s+jFUZ/s8ve2aucKqOnJtssQXUy504a4YuRseT5o/olv0Lu5t22Gf7/ED33js/74fEnB gVXhLUT6TEydDJSfbntV41Ukt2iRg679nH21XhsxQq3vfmXa0IiUF5ylkFYhE3+MIzK8 SlCvZAoS1T37K7FH+nM4Bsavjmwy58JPfCczqyoLUwDRaKABt5Dbui/ueBd6QFWZiFu4 Zq8NjJq6hk2KkGTu0JNkKxFxbTgevyxxNgqcp+yLoJKHJKeaw52FRMg0dcs7y4sRW/R8 /YYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xziF23XhQe6bvjwS9veYxd1lZuBR1P64JlqMkI6cAmE=; b=ltKWWopGNDTZS/PwjMgIhfWkb3qUvV4OAneBMhfE91zzGxAvqaSc5XYgoNv4/CaEaW vickII9AakfDGKqmqby1Dxg4Vwm+Mz4pG3vFgIh8AKzdw3GKOJ1G8US4LhXJjSXRMwIY jzpEo2bO/LzsSCPQ3uMnvZeJp4iFfyvavFhshWN4vpBFJdhCN/IofBnm9KuFe/vs4jCi +DiMvEGouuuLbqYwfoGZ4MEPqx/KSSxbS/ALtw1Blz9Ms7nSrOhDNcrK7BKLHlHP0CLE Mb9xcBMX7lEvO/6+gNykECrlzb/OYuLYk8nG9VP3rHZWFk5ZMH3/vuAYPnYjatUlM58k aINQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HptUbo00; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 185sor163756pfe.63.2020.04.22.13.33.04 for (Google Transport Security); Wed, 22 Apr 2020 13:33:04 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HptUbo00; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xziF23XhQe6bvjwS9veYxd1lZuBR1P64JlqMkI6cAmE=; b=HptUbo001ZFSajtqjlDUPswimG+lWZmWjcVQiAC069qM3jQNiQyOacxbSEJDJ3cJ4G mtKbWGAojVCmizSMwquRoCLhszE3z6++jcZks3UQRj54YwVE7Zz1AMnxl4EhXmd4p6XB +dPCT8F4TXo4fxEo0TvREbSO7QSkaLVkanzaEzTnh0gIPEviZtkwjuN40VO68JvNJUeC C2hbz3rA8CS8yqpgA+bObSMdSNjBAL2QtlqEuieiixDE3V0TGxnyNFp1VP5g94cZBVok s6hF5SvEu7ON6SHGPgPwS+7wyxM2MK2NVJ3jzlcx5ac6LUu6FR/N4/vwLzmZ1uGAOtgs JDqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xziF23XhQe6bvjwS9veYxd1lZuBR1P64JlqMkI6cAmE=; b=JfZ5JL8cyMSyCxSz1b3YFmZNRB4kLt9qucxehyHRW2GgYrG9q3fsJpn/3OxHqK0kQc Corb5zSgMpOw+Gsll+LI0LHximlyg8ZegcAFwKRS2RKOBJoZt8Q/ox3fZ3C1dRyJyGv4 FMwyOHztg25rPq7qtYCLMAeVakk47qEaPHCBJ0yKIKGdM42E/TvyVlekJ2M9mCiMQvto cOAehuClRFKzM/6dAkMyE2jpzl6pKg8/PHjxR/YRc5aNZR/eWhxuNdPWcx6fj/88QBn4 2PoNBq+xv6BVDVUa/2al54vLJxnkr/mu70qk5PqoAkomN5h7jzec8q1R20LjQoHwAB6t lEUg== X-Gm-Message-State: AGi0PuaeXB7qkd0LzijuIg+Walljw4gRUJ4tALdqfWOOQcF7AdbJm5rd JepZcGvzvobCkEO8uChWvwVmWNL0 X-Google-Smtp-Source: APiQypI1cIvO9bvDIb2+rBS+hslzcch8HwCqunDEuiMzTtSmXM7vjDtDifX/+kISDFr49NwkA5FT7w== X-Received: by 2002:aa7:8006:: with SMTP id j6mr134553pfi.187.1587587584431; Wed, 22 Apr 2020 13:33:04 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id b24sm360292pfd.175.2020.04.22.13.33.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2020 13:33:04 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , "David S. Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , Jakub Kicinski , Greg Kroah-Hartman , "Rafael J . Wysocki" , Rob Herring , Geert Uytterhoeven , Yoshihiro Shimoda , Robin Murphy , Andy Shevchenko , Sudeep Holla , Andy Shevchenko , Naresh Kamboju , Basil Eljuse , Ferry Toth , Arnd Bergmann , Anders Roxell , netdev , linux-pm@vger.kernel.org Subject: [PATCH v3 2/3] driver core: Use dev_warn() instead of dev_WARN() for deferred_probe_timeout warnings Date: Wed, 22 Apr 2020 20:32:44 +0000 Message-Id: <20200422203245.83244-3-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200422203245.83244-1-john.stultz@linaro.org> References: <20200422203245.83244-1-john.stultz@linaro.org> In commit c8c43cee29f6 ("driver core: Fix driver_deferred_probe_check_state() logic") and following changes the logic was changes slightly so that if there is no driver to match whats found in the dtb, we wait the sepcified seconds for modules to be loaded by userland, and then timeout, where as previously we'd print "ignoring dependency for device, assuming no driver" and immediately return -ENODEV after initcall_done. However, in the timeout case (which previously existed but was practicaly un-used without a boot argument), the timeout message uses dev_WARN(). This means folks are now seeing a big backtrace in their boot logs if there a entry in their dts that doesn't have a driver. To fix this, lets use dev_warn(), instead of dev_WARN() to match the previous error path. Cc: "David S. Miller" Cc: Alexey Kuznetsov Cc: Hideaki YOSHIFUJI Cc: Jakub Kicinski Cc: Greg Kroah-Hartman Cc: Rafael J. Wysocki Cc: Rob Herring Cc: Geert Uytterhoeven Cc: Yoshihiro Shimoda Cc: Robin Murphy Cc: Andy Shevchenko Cc: Sudeep Holla Cc: Andy Shevchenko Cc: Naresh Kamboju Cc: Basil Eljuse Cc: Ferry Toth Cc: Arnd Bergmann Cc: Anders Roxell Cc: netdev Cc: linux-pm@vger.kernel.org Fixes: c8c43cee29f6 ("driver core: Fix driver_deferred_probe_check_state() logic") Signed-off-by: John Stultz --- drivers/base/dd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 908ae4d7805e..9c88afa5c74a 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -258,7 +258,7 @@ int driver_deferred_probe_check_state(struct device *dev) } if (!driver_deferred_probe_timeout && initcalls_done) { - dev_WARN(dev, "deferred probe timeout, ignoring dependency"); + dev_warn(dev, "deferred probe timeout, ignoring dependency"); return -ETIMEDOUT; } From patchwork Wed Apr 22 20:32:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 185701 Delivered-To: patches@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp1229921ilf; Wed, 22 Apr 2020 13:33:06 -0700 (PDT) X-Received: by 2002:a02:aa93:: with SMTP id u19mr239975jai.70.1587587586196; Wed, 22 Apr 2020 13:33:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587587586; cv=none; d=google.com; s=arc-20160816; b=aJ6nwIOj4FUGXwrpmmcFdT1wj6Ary0HHnNNS/F2h2HqL/UxqON00LCzZwqyeb7v8U4 pzn8mzEsF28yC8PPPRKO8SUeLLscwVYRX64qEWmBavsAEgYuUfahGblOPScQ9nBr6LDc Ey5Ptrrgpsnt1NNJJtciyTwPHdJfyCdgNw76U9Umu83Xlrw6ijVv6QbBEwht6lfTX2tr Wz8/OKFWRH30LDhunLa6aVjPgwWclVB4nEvJPmi/eBhv2a47WGYgXWroxAYPlnRniif1 d9CvWO7jbWTlb/lZplF85107mct854HpRzK74XAOpYxsj513IPSnDzyt7m2qcg+GzNma Da4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pMZgWl7gaqwxky4xlW6XJbmApvfvRuOxXJn93EkCWVo=; b=JDwcM4qNz7eLnioEUptG5cnUkDL0+gAlPmFE+XAZ6YOsuTThhrUWN57ihaalJCD/En vILUqUQjwxwyUeZNdSKY+L6QLMFJiuisgLRhiI9BbRrJYkOfVopHNYloxjKYhGqKuMTT /CqzAY2Qu/N1MXyAEm8qwld25tY3IjvdEOMleXgqqv2Y3RDruBlynD+GPYIejsGWK/rj 9HreYZJf3gwFenL8kV+02m3CkpFqK3L371atSSMzi9TBniRONo+JXyGEi/9vvb/ja71O ird0+z9qgWMRqt9a6OlPrAgr6YZMokIPfBIZ69HMdi4dvZHo7M0V1ZDFUrqVwZXlKVq5 jAyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LEbaRv0d; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id p10sor191538ilg.74.2020.04.22.13.33.06 for (Google Transport Security); Wed, 22 Apr 2020 13:33:06 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LEbaRv0d; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pMZgWl7gaqwxky4xlW6XJbmApvfvRuOxXJn93EkCWVo=; b=LEbaRv0dypc5e5Wc7a84Kw/SbMBDatTaHXbP6iCorD9zGzR1nVNn357pTZEPJbSGH8 DO6J+hGiFfATe4XvgoRwKD/iyt+vOghi0A+9lXjvJKQSSngW7mtkvUKJRtMFXag3XuGi kS1lvfmsj1CAadjzqIYzXXp3EGdkoP2Vb3RtgOpOrpr9uGeAie7EZkyNnSjLFFB/VIX+ cN/PSUP9+7xo5gVqezBN8MHq4yT+hnWXekDCIk3KvZ8RWPcHzzx5WEr2650WPRMUN3Sz od9S/oDQyg22NNcbzi4ErXcO0GuJt9RE4qxMlIr7y0GU4oeBhtj10hVFiTQCWHBjJ7SA 00qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pMZgWl7gaqwxky4xlW6XJbmApvfvRuOxXJn93EkCWVo=; b=liLwJx/RK/m8ktPBHpbMzILqQRX6MG3f84aoEWCZ0CznVdxeSQmBt6s2HRWhiELT2t cStW5BzywY9LzOIBElhbdkSjkR2ssNv2zVEAnYd5KkmWThPfD4iz6r6AraSJ4oVbndh3 Eo1Jqs/3IwbuyqNdmdFpYC4/TzApR96b1pchkDG6d2IEkXfHlOrJhamb27TO/Bp3PsoP hdf76TRT5MACUq5fDFD/LBOfSuSLZ7HBOpIiYVa4bSSds0AHHB0PIK/SpdmcvwNKZosl 45Yd9Wt9o7FcriusU0mrJqAgwW527ynYiDsTs36pyW6oZHFCaGIQ2StYL9g5/eA4uMNR VYxA== X-Gm-Message-State: AGi0PubIfyLiJ0SwAnrrSWLOzrki8Bo6pvF7jkgu6Z6P18o2pecaX21x P3N7hPleIz+NdEHr7xSbEBIOabPm X-Google-Smtp-Source: APiQypIk7f8O7AVplXsto40VZokGnKKYUx0F+SKxFkELYuo0ol20r/CNbNqbITXVgN8Ro9fNiSWIaA== X-Received: by 2002:a63:ef4b:: with SMTP id c11mr760981pgk.400.1587587585769; Wed, 22 Apr 2020 13:33:05 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id b24sm360292pfd.175.2020.04.22.13.33.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2020 13:33:05 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , "David S. Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , Jakub Kicinski , Greg Kroah-Hartman , "Rafael J . Wysocki" , Rob Herring , Geert Uytterhoeven , Yoshihiro Shimoda , Robin Murphy , Andy Shevchenko , Sudeep Holla , Andy Shevchenko , Naresh Kamboju , Basil Eljuse , Ferry Toth , Arnd Bergmann , Anders Roxell , netdev , linux-pm@vger.kernel.org Subject: [PATCH v3 3/3] driver core: Ensure wait_for_device_probe() waits until the deferred_probe_timeout fires Date: Wed, 22 Apr 2020 20:32:45 +0000 Message-Id: <20200422203245.83244-4-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200422203245.83244-1-john.stultz@linaro.org> References: <20200422203245.83244-1-john.stultz@linaro.org> In commit c8c43cee29f6 ("driver core: Fix driver_deferred_probe_check_state() logic"), we set the default driver_deferred_probe_timeout value to 30 seconds to allow for drivers that are missing dependencies to have some time so that the dependency may be loaded from userland after initcalls_done is set. However, Yoshihiro Shimoda reported that on his device that expects to have unmet dependencies (due to "optional links" in its devicetree), was failing to mount the NFS root. In digging further, it seemed the problem was that while the device properly probes after waiting 30 seconds for any missing modules to load, the ip_auto_config() had already failed, resulting in NFS to fail. This was due to ip_auto_config() calling wait_for_device_probe() which doesn't wait for the driver_deferred_probe_timeout to fire. This patch tries to fix the issue by creating a waitqueue for the driver_deferred_probe_timeout, and calling wait_event() to make sure driver_deferred_probe_timeout is zero in wait_for_device_probe() to make sure all the probing is finished. The downside to this solution is that kernel functionality that uses wait_for_device_probe(), will block until the driver_deferred_probe_timeout fires, regardless of if there is any missing dependencies. However, the previous patch reverts the default timeout value to zero, so this side-effect will only affect users who specify a driver_deferred_probe_timeout= value as a boot argument, where the additional delay would be beneficial to allow modules to load later during boot. Thanks to Geert for chasing down that ip_auto_config was why NFS was failing in this case! Cc: "David S. Miller" Cc: Alexey Kuznetsov Cc: Hideaki YOSHIFUJI Cc: Jakub Kicinski Cc: Greg Kroah-Hartman Cc: Rafael J. Wysocki Cc: Rob Herring Cc: Geert Uytterhoeven Cc: Yoshihiro Shimoda Cc: Robin Murphy Cc: Andy Shevchenko Cc: Sudeep Holla Cc: Andy Shevchenko Cc: Naresh Kamboju Cc: Basil Eljuse Cc: Ferry Toth Cc: Arnd Bergmann Cc: Anders Roxell Cc: netdev Cc: linux-pm@vger.kernel.org Reported-by: Yoshihiro Shimoda Tested-by: Yoshihiro Shimoda Fixes: c8c43cee29f6 ("driver core: Fix driver_deferred_probe_check_state() logic") Signed-off-by: John Stultz --- drivers/base/dd.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.17.1 diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 9c88afa5c74a..94037be7f5d7 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -226,6 +226,7 @@ DEFINE_SHOW_ATTRIBUTE(deferred_devs); int driver_deferred_probe_timeout; EXPORT_SYMBOL_GPL(driver_deferred_probe_timeout); +static DECLARE_WAIT_QUEUE_HEAD(probe_timeout_waitqueue); static int __init deferred_probe_timeout_setup(char *str) { @@ -275,6 +276,7 @@ static void deferred_probe_timeout_work_func(struct work_struct *work) list_for_each_entry_safe(private, p, &deferred_probe_pending_list, deferred_probe) dev_info(private->device, "deferred probe pending"); + wake_up(&probe_timeout_waitqueue); } static DECLARE_DELAYED_WORK(deferred_probe_timeout_work, deferred_probe_timeout_work_func); @@ -649,6 +651,9 @@ int driver_probe_done(void) */ void wait_for_device_probe(void) { + /* wait for probe timeout */ + wait_event(probe_timeout_waitqueue, !driver_deferred_probe_timeout); + /* wait for the deferred probe workqueue to finish */ flush_work(&deferred_probe_work);