From patchwork Wed Nov 16 11:53:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 20991 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp101913wru; Wed, 16 Nov 2022 04:07:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf4E/wBTIl6fr4MnSO6CsgIAdf5QEsjeztxbl8gvSAFp/yVjZ1YC14sudiUCXqptHhFuQteV X-Received: by 2002:a05:6a02:108:b0:476:f92e:f7a5 with SMTP id bg8-20020a056a02010800b00476f92ef7a5mr42498pgb.188.1668600449530; Wed, 16 Nov 2022 04:07:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668600449; cv=none; d=google.com; s=arc-20160816; b=ZZZ08b77U33TiHH1tg7QPT22N7Kp/pBVTgnpngl9+jnOOZRenj8gMbDvtmCYeeUpyX VHD6d0mAmY3zv2prys4Haksblt+B6fg1OE73OvToPVmaqCqLCoo0qMt9wB2vfh7yW+6G V8WlVDQXiE/fA/52Ly6NrAtsJBmpr27v3EfoCk3jEFaQBshuunABomLjlXf27dj4xjEV 1HpFTrlndiBEi08ioORLT6cixCdLTedkY8CLwZQcu5fjeOHDhdb5eiQOOXjgvb98xchV U22Dgy4EgTEZMjANu2UXxoGxpb1NGS31zwJifmJy45RB88NvB4GyhiQnlzZ1N+Xhuuhe kdKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YSf6lqgrQaBsJ/0K/DNRpP5ozpW+gGv/TdDdDL02QJw=; b=Tegpz9ZIx2y9UWh8j856AYHG74uhLRD3VbjQXZet9J6cbMCMAPsf5wtdyzygtOmEUp Hy7P/hjFLxyH1xcY7qwlyQxXSjWP1rSZI6kIP07uu8VWEgowtCRaw64rE7WTIe8Q22CT eTkaFT0dlFJj36RsUVNeuaGWk5QkK2FQEfhGS+TYbX3SOrFVX6N4lJRr0Ut2tgxDQTnE XbaKVJXjYS3jeg64AdCT9r+iy5WZAfUBERDJhOCI04nbwc87n2D62s/FuAG5hIJe0EqR 7H5GwW/hbIojmSgqAze8k5I3tKkZNzOvy08elQSPvcHPF4kvSIMFJaRd7txe7g9Yc/vT dyNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FsLKCX7S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s207-20020a632cd8000000b0044d72a10aafsi14826358pgs.34.2022.11.16.04.07.11; Wed, 16 Nov 2022 04:07:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FsLKCX7S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233506AbiKPMD0 (ORCPT + 99 others); Wed, 16 Nov 2022 07:03:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233082AbiKPMCl (ORCPT ); Wed, 16 Nov 2022 07:02:41 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD2001D0F4 for ; Wed, 16 Nov 2022 03:54:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668599651; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YSf6lqgrQaBsJ/0K/DNRpP5ozpW+gGv/TdDdDL02QJw=; b=FsLKCX7SARWHlN2STo569LXtDTj/gVSjc0p/iDXGnJGQ/TWbVJu5KxNNkKfdE6FEZOjfEx Xh8lvbDlOO3aFqWUZcbnv8aJDsdJ/oesI48uGNnjOTyLpZGQQkio9lu/u9Q8/kmVsexjFV T8dD7AxJ23y2fxaQI0YHchBhoLQ2dsI= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-584-W-SSFQZGNyC-xodecIby_Q-1; Wed, 16 Nov 2022 06:54:10 -0500 X-MC-Unique: W-SSFQZGNyC-xodecIby_Q-1 Received: by mail-wm1-f71.google.com with SMTP id 203-20020a1c02d4000000b003cfe9e8e3f9so162746wmc.0 for ; Wed, 16 Nov 2022 03:54:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YSf6lqgrQaBsJ/0K/DNRpP5ozpW+gGv/TdDdDL02QJw=; b=ri6fmDzqWsQ8HO8WVlkzFXzOlqN930p+csUrTbM4VM+MRjj8qUNQJCafgJ9LkHgGT1 JHzAFTPK34S3KiVKoeCKFVhnYYaPeubWXwoTGXhM2xE3vtR8Loe2yLwPzpTYp7jBcMiO WOvjYf9gJjyxTDbOm2Kr6sR1JGO0WttXodTyo6GBu7d34zUStpPl2X8oZEShGIzh6k7K IuIzUZY9YzjJNa7NizNppiy6foaNY04DEE5qJ+uUDqWrIK+gYC7vv/BFRT64zN8GNl63 65s3aYWJ9ydFUAyj26TXPOuMP0Bg06sKNdSItHKJ451B3ZIXPfeMmim41PwBynwdACwP pEag== X-Gm-Message-State: ANoB5pntSCNfdvEkGT+YFbM8x9aId3pUJpEOk+ZoIpEiyHrabP7dMhBk SpY/SZWz3Zz24RBguvGz9xxDJKx49aFInWPnC7XBmrMDQi9pH7/Y7fGU3tOGlqZ0JJRsBhVbIj3 jGefK/LOxET0HEVj/6i7waSWxxLTvSIxqfr0F4sfftPAU6VeqanoybaHnY01dCkBIDWq3I6HD4a E= X-Received: by 2002:a5d:4525:0:b0:236:5d8d:630d with SMTP id j5-20020a5d4525000000b002365d8d630dmr13215847wra.462.1668599647053; Wed, 16 Nov 2022 03:54:07 -0800 (PST) X-Received: by 2002:a5d:4525:0:b0:236:5d8d:630d with SMTP id j5-20020a5d4525000000b002365d8d630dmr13215823wra.462.1668599646828; Wed, 16 Nov 2022 03:54:06 -0800 (PST) Received: from minerva.home (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id m28-20020a05600c3b1c00b003cf37c5ddc0sm2059939wms.22.2022.11.16.03.54.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 03:54:06 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Brian Masney , Bjorn Andersson , Douglas Anderson , John Stultz , Peter Robinson , Enric Balletbo i Serra , Steev Klimaszewski , Rob Herring , Daniel Vetter , linux-arm-msm@vger.kernel.org, Saravana Kannan , Greg Kroah-Hartman , Javier Martinez Canillas , Alexei Starovoitov , Jakub Kicinski , Krzysztof Kozlowski , "Rafael J. Wysocki" Subject: [PATCH v2 1/4] driver core: Make driver_deferred_probe_timeout a static variable Date: Wed, 16 Nov 2022 12:53:45 +0100 Message-Id: <20221116115348.517599-2-javierm@redhat.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116115348.517599-1-javierm@redhat.com> References: <20221116115348.517599-1-javierm@redhat.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749654384655951846?= X-GMAIL-MSGID: =?utf-8?q?1749654384655951846?= It is not used outside of its compilation unit, so there's no need to export this variable. Signed-off-by: Javier Martinez Canillas Reviewed-by: Andrew Halaney Acked-by: John Stultz --- (no changes since v1) drivers/base/dd.c | 6 ++---- include/linux/device/driver.h | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 3dda62503102..040b4060f903 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -257,13 +257,11 @@ static int deferred_devs_show(struct seq_file *s, void *data) DEFINE_SHOW_ATTRIBUTE(deferred_devs); #ifdef CONFIG_MODULES -int driver_deferred_probe_timeout = 10; +static int driver_deferred_probe_timeout = 10; #else -int driver_deferred_probe_timeout; +static int driver_deferred_probe_timeout; #endif -EXPORT_SYMBOL_GPL(driver_deferred_probe_timeout); - static int __init deferred_probe_timeout_setup(char *str) { int timeout; diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h index 2114d65b862f..50d0a416a5e7 100644 --- a/include/linux/device/driver.h +++ b/include/linux/device/driver.h @@ -240,7 +240,6 @@ driver_find_device_by_acpi_dev(struct device_driver *drv, const void *adev) } #endif -extern int driver_deferred_probe_timeout; void driver_deferred_probe_add(struct device *dev); int driver_deferred_probe_check_state(struct device *dev); void driver_init(void); From patchwork Wed Nov 16 12:00:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 21003 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp103545wru; Wed, 16 Nov 2022 04:10:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf4BUhkIWTKvv1V0pjHL5mBJLaYyul7U7/OLrjDSmBpy0XsWF5ZHo196buxJ8KcLv9kGC+jr X-Received: by 2002:a05:6402:22ba:b0:462:2410:9720 with SMTP id cx26-20020a05640222ba00b0046224109720mr18513798edb.84.1668600635855; Wed, 16 Nov 2022 04:10:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668600635; cv=none; d=google.com; s=arc-20160816; b=t2Roi4rsDPOZe5BxAhn9yr7X7VVsT/DxNaxQBd9FlMilJMfLsLRbOEPzYTCvW8vorH e1IFd6Fa2KH4EdUm6SACx2Qi95Bp0Jv6uxQfaCFjST8zjJ+BqcARC2456nYkOBcXMwUg i6UW3cW4yZo1EP5uJIgUBp+SHyFLaAgx2+ZZaV5tehP2V1CYdx4xBINP925sasD0WunK DJzOUM/+D1n77nQ8OWk77tw3i4lglok5Va4VA+QI8dzscr6QeFoDcGdpCL9otN9WiVGP X38PJ/bnQaOaMpDjnXwib5Ampu0bNTNrQD2Qm9ZAnUlv0p75P+RNrYAdTmpJYbrekVuS Hn2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qXpS5ogY+quOVBSqhFr3jD7fUFESPhWtnRgSpqA/kiQ=; b=Z1E9c4zs4Ls5s7AOYcZrFxqgsIUAoamWmfc/G2vOMs3l8kxqRy5jpf10KXRPZVXYaf 7OKpBR+yQOFn+lle+KYv8yjfr4Vl79w93mJAbXVGMJQPHY/BslXTBU0Zuofh0Cg4mZG/ N6eYx3Cl7T9MfnimTS8f2bAwDwHJ/g/1P/scIYSvRkMEgRc60S5qPTNwZKxsivRbF/oy wgL/0m8R1o28deY/BqG0fQXKEEPHrMs6mN622hBUo+15FV44UI/qcvctdvSDLcHNzNny FyAVKhKpJ3DrXE46jh4zRvMZvXrvbphUf4Nhqh/rhHd0leEgNiEWOdQCfMZHc4N3HB4o tXIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CQGDJjRx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h20-20020a05640250d400b004637f0abb77si16848012edb.487.2022.11.16.04.10.08; Wed, 16 Nov 2022 04:10:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CQGDJjRx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233720AbiKPMJ1 (ORCPT + 99 others); Wed, 16 Nov 2022 07:09:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229617AbiKPMIF (ORCPT ); Wed, 16 Nov 2022 07:08:05 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AFB6A3 for ; Wed, 16 Nov 2022 04:01:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668600074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qXpS5ogY+quOVBSqhFr3jD7fUFESPhWtnRgSpqA/kiQ=; b=CQGDJjRxtH3VgVhznwqsBhGuMANrybOgdJX4e7yc28wZPW3Gjet7o+EdeUGPG2HVs2jD71 mVJTDNHJI6SJoJtgLJ7rWZ4hgAerv7D73YkJGXma/t+x+CdUtIvkXvCY7U4LNf+ltrB9ue EmbpMoq/HJJcWhAlj5npcOJ2trKZx5Y= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-321-tDjxHqfVMVWS_e0R1uoHMQ-1; Wed, 16 Nov 2022 07:01:07 -0500 X-MC-Unique: tDjxHqfVMVWS_e0R1uoHMQ-1 Received: by mail-wm1-f69.google.com with SMTP id x10-20020a05600c420a00b003cfa33f2e7cso9895431wmh.2 for ; Wed, 16 Nov 2022 04:01:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qXpS5ogY+quOVBSqhFr3jD7fUFESPhWtnRgSpqA/kiQ=; b=fHxxx4+2r8T7mKQuov9MbQwdHvwMgTJCy6po91dRsUfpWhXiUBh4S0S1iU4aD0tnqR IkMPcL8mO2U193S+8GKFG5LTSqc7C4qC8iOIfy0IyM2rJUF3YF7oKHgK0dnf6IOl5ylN cUJka2kymer2jTTVMipQU1BpNOmTtipA+tzF0Mrub2lYedEOT5Dj24JAsR9H7/x646zh wfNZDScEnAilJ+c/CtucRH8GGkbZ8bfzWvRqwDtneoVfpJmGlMYx6QKq8RC/gU91vD9v xX7hYvMzEKSeAR3pEYoUoctcZ0O5piYG0U/Y6fjXObB0zvqOK2JjVgxg5VGaxYr44rc2 /eAg== X-Gm-Message-State: ANoB5pmxnVhoOu4cplZZghMlwvWtHuKldcAopq5v2nBy7E140iC0hy4s hWEW+FYw43fR5/jKUAkDfhqCy4sKwxENWdlavTfuYbl+Hgoa5J6RbnEisi1w4Ww65Ybw6HzhkB7 +ZmiQ/O0gRlk+URJlAbcTfJrjblGrvk0pXkj/T9AB17tMCnS99ifb0HrbD/iWOD4eRECxo/Ex4A k= X-Received: by 2002:a5d:6752:0:b0:236:73b2:f026 with SMTP id l18-20020a5d6752000000b0023673b2f026mr13799536wrw.396.1668600066375; Wed, 16 Nov 2022 04:01:06 -0800 (PST) X-Received: by 2002:a5d:6752:0:b0:236:73b2:f026 with SMTP id l18-20020a5d6752000000b0023673b2f026mr13799498wrw.396.1668600066055; Wed, 16 Nov 2022 04:01:06 -0800 (PST) Received: from minerva.home (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id by7-20020a056000098700b002368a6deaf8sm15112370wrb.57.2022.11.16.04.01.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 04:01:05 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: "Rafael J . Wysocki" , Douglas Anderson , Saravana Kannan , Daniel Vetter , linux-arm-msm@vger.kernel.org, John Stultz , Peter Robinson , Steev Klimaszewski , Greg Kroah-Hartman , Enric Balletbo i Serra , Bjorn Andersson , Brian Masney , Rob Herring , Javier Martinez Canillas Subject: [PATCH v2 2/4] driver core: Set deferred probe timeout to 0 if modules are disabled Date: Wed, 16 Nov 2022 13:00:43 +0100 Message-Id: <20221116120043.519614-1-javierm@redhat.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116115348.517599-1-javierm@redhat.com> References: <20221116115348.517599-1-javierm@redhat.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749654580114280149?= X-GMAIL-MSGID: =?utf-8?q?1749654580114280149?= There is no point to schedule the work queue to timeout the deferred probe if all the initcalls are done and modules are not enabled. The default for this case is already 0 but can be overridden by the deferred_probe_timeout parameter. Let's just disable to avoid queuing a work that is not needed. Signed-off-by: Javier Martinez Canillas --- (no changes since v1) drivers/base/dd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 040b4060f903..1e8f1afeac98 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -350,8 +350,10 @@ static int deferred_probe_initcall(void) flush_work(&deferred_probe_work); initcalls_done = true; - if (!IS_ENABLED(CONFIG_MODULES)) + if (!IS_ENABLED(CONFIG_MODULES)) { + driver_deferred_probe_timeout = 0; fw_devlink_drivers_done(); + } /* * Trigger deferred probe again, this time we won't defer anything From patchwork Wed Nov 16 12:01:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 21005 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp103871wru; Wed, 16 Nov 2022 04:11:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf68CqkToFyYXgFaLCjGXvN7etEa5rAuSOFlPX8hGWjO82tQ8Qa0m6DLPTxdt4llxcDwTtdY X-Received: by 2002:a17:906:ca4f:b0:7ae:5a4:5356 with SMTP id jx15-20020a170906ca4f00b007ae05a45356mr17836136ejb.748.1668600676877; Wed, 16 Nov 2022 04:11:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668600676; cv=none; d=google.com; s=arc-20160816; b=00LUUev+Kg07Q+7UwS0X3LqyO/W8eF8rXijJXV6EO8X/FWoxwK/cx4PNJdID1N/4hg FfTw1qEkiRp7vvESyli24XMs+OGzOFdLi9YOD5CZDRWKLHJBOxNuaZgQaBYTrMIQCCYo 7EK0ExNcpvUKEDhxH5nlCbjt5ZABZTUU7AVYLCNrYLxlhlhgJWw9R3Dw9fVfJwlRvK6h SSoSNgW/t9/+wjm5C3n1esUqfnfnnyHZ6oUVfRAawYql9QW3GyHTk0LnvyD6X204pyyl 6XtAGTJUBJN5affZmFbwvr/P6PCKgQ186GwUD3VwUuFSEcR2nuYqCqut4EnbhOjai2xs /+UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sBCDaltTnEkyasPr95FrZvMKGG7154FaBt72snWNmEY=; b=Qbkvn4bc6kF9ptMlpoT+VfXYfmEr1ZTVJwF0amm/AQGiYN3FfXMe9mSKYkQeu1gHui L/fzp6A0NxPE4nS51u/idLlN9ogwivCrbETQkLvDMJSBX6lORKy7BiBaL0+W+2wnVP1o 1be0o4CgX1arf5DzYGx4ckVnj4VncjQX5ZPZGkhmdod8YyhV/1cwjt4Y4QQpMDMOaqgw hktSAEX3CNPB5Q1ZwfG+ca1ENv3pn+DzmAeUFHqP/LygwmKbvbk9t/NHleLyykKTOqUM yQ8gBZeaYP6ZA6+VY54mhqwl7xoXx0ATaINmQ1K289jlMy0yPIeLtr1bCp0YUWK9cKs2 jOaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=atfodMCY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg9-20020a170907970900b0078db6f56d51si12854419ejc.808.2022.11.16.04.10.52; Wed, 16 Nov 2022 04:11:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=atfodMCY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232367AbiKPMJn (ORCPT + 99 others); Wed, 16 Nov 2022 07:09:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232190AbiKPMIi (ORCPT ); Wed, 16 Nov 2022 07:08:38 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 728E013D3C for ; Wed, 16 Nov 2022 04:02:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668600128; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sBCDaltTnEkyasPr95FrZvMKGG7154FaBt72snWNmEY=; b=atfodMCYdecfbDQJ60P8Lqw4eVD3Amu/pklU3y2Xzo6mUL1x5BAthVnWaiHVCJ+hD9WUcz rCfKPbyOqQVw1+GM+5HkHyrcLG1R/clgrK2EJdbmI4JTDupTolclD4ozM6SALDgvxnxaDa PeYDUxY/O7GJV6ZUySr0uXE0Ofkjits= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-118-kvOeMQtxNNOVcn-WRH_5qw-1; Wed, 16 Nov 2022 07:02:07 -0500 X-MC-Unique: kvOeMQtxNNOVcn-WRH_5qw-1 Received: by mail-wr1-f71.google.com with SMTP id r4-20020adfbb04000000b00236639438e9so3663704wrg.11 for ; Wed, 16 Nov 2022 04:02:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sBCDaltTnEkyasPr95FrZvMKGG7154FaBt72snWNmEY=; b=PRTxuDIZVxo0vuRN2k53pI2Il+k4c3zeL0Lcm1N/fNBMmL0qqwpAw02Bm2qDNa/gdJ b3CqUPrTVR8/m+uH4KVGPqQDNQHR1+uhyJWUI764MBNlBTpcKKLBIzw4nz3fT+x7OeEz xFwhdSwLTAWBdcO8lzdpG72bGX0wnr5D1sl12aWEOohbfwrM1LP3c17vDmbwdQ7WKOhh NExdV8LP/1vCxmlxR+c13BP1J+uHO6lEnEKaIyWoanji7fnF/JgGLzcCJJIWaNzn7IqD yhCgiW3SUM00NtJ9AB0oq1LgUcvslUWJESljQQf9Q4hh+FhuJMuhzggtaQkiB75tz41Z 5aBw== X-Gm-Message-State: ANoB5plGJPym+HD0oRJE3MiS0FJqaFa95DqhrMsFyWqNVnUJrqja1l3G llxhGVFgsV6N86cCcTZyeouXTGMeKn5elu22br084wcEo2Y3pXBvV3y61Zv6BHcjKJ7cWi1F7FC TSDi7l9820XsNzJPMX9+I5JkQM0UruT02yfV3OegJ9b50auuG7A+rD3iutZ9eAr7lH4HQjLmrD1 4= X-Received: by 2002:a05:600c:4b17:b0:3cf:8b22:b567 with SMTP id i23-20020a05600c4b1700b003cf8b22b567mr1858796wmp.144.1668600126409; Wed, 16 Nov 2022 04:02:06 -0800 (PST) X-Received: by 2002:a05:600c:4b17:b0:3cf:8b22:b567 with SMTP id i23-20020a05600c4b1700b003cf8b22b567mr1858754wmp.144.1668600126011; Wed, 16 Nov 2022 04:02:06 -0800 (PST) Received: from minerva.home (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id i17-20020adfefd1000000b00236b2804d79sm15327240wrp.2.2022.11.16.04.02.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 04:02:05 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: "Rafael J . Wysocki" , Douglas Anderson , Saravana Kannan , Daniel Vetter , linux-arm-msm@vger.kernel.org, John Stultz , Peter Robinson , Steev Klimaszewski , Greg Kroah-Hartman , Enric Balletbo i Serra , Bjorn Andersson , Brian Masney , Rob Herring , Javier Martinez Canillas Subject: [PATCH v2 3/4] driver core: Add fw_devlink.timeout param to stop waiting for devlinks Date: Wed, 16 Nov 2022 13:01:59 +0100 Message-Id: <20221116120159.519908-1-javierm@redhat.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116115348.517599-1-javierm@redhat.com> References: <20221116115348.517599-1-javierm@redhat.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749654623572747508?= X-GMAIL-MSGID: =?utf-8?q?1749654623572747508?= Currently, the probe deferral timeout does two things: 1) Call to fw_devlink_drivers_done() to relax the device dependencies and allow drivers to be probed if these dependencies are optional. 2) Disable the probe deferral mechanism so that drivers will fail to probe if the required dependencies are not present, instead of adding them to the deferred probe pending list. But there is no need to couple these two, for example the probe deferral can be used even when the device links are disable (i.e: fw_devlink=off). So let's add a separate fw_devlink.timeout command line parameter to allow relaxing the device links and prevent drivers to wait for these to probe. Signed-off-by: Javier Martinez Canillas Acked-by: Andrew Halaney --- (no changes since v1) .../admin-guide/kernel-parameters.txt | 7 ++++ drivers/base/dd.c | 38 ++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index a465d5242774..38138a44d5ed 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -1581,6 +1581,13 @@ dependencies. This only applies for fw_devlink=on|rpm. Format: + fw_devlink.timeout= + [KNL] Debugging option to set a timeout in seconds for + drivers to give up waiting on dependencies and to probe + these are optional. A timeout of 0 will timeout at the + end of initcalls. If the time out hasn't expired, it'll + be restarted by each successful driver registration. + gamecon.map[2|3]= [HW,JOY] Multisystem joystick and NES/SNES/PSX pad support via parallel port (up to 5 devices per port) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 1e8f1afeac98..ea448df94d24 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -261,6 +261,7 @@ static int driver_deferred_probe_timeout = 10; #else static int driver_deferred_probe_timeout; #endif +static int fw_devlink_timeout = -1; static int __init deferred_probe_timeout_setup(char *str) { @@ -272,6 +273,16 @@ static int __init deferred_probe_timeout_setup(char *str) } __setup("deferred_probe_timeout=", deferred_probe_timeout_setup); +static int __init fw_devlink_timeout_setup(char *str) +{ + int timeout; + + if (!kstrtoint(str, 10, &timeout)) + fw_devlink_timeout = timeout; + return 1; +} +__setup("fw_devlink.timeout=", fw_devlink_timeout_setup); + /** * driver_deferred_probe_check_state() - Check deferred probe state * @dev: device to check @@ -318,6 +329,15 @@ static void deferred_probe_timeout_work_func(struct work_struct *work) } static DECLARE_DELAYED_WORK(deferred_probe_timeout_work, deferred_probe_timeout_work_func); +static void fw_devlink_timeout_work_func(struct work_struct *work) +{ + fw_devlink_drivers_done(); + + driver_deferred_probe_trigger(); + flush_work(&deferred_probe_work); +} +static DECLARE_DELAYED_WORK(fw_devlink_timeout_work, fw_devlink_timeout_work_func); + void deferred_probe_extend_timeout(void) { /* @@ -330,6 +350,13 @@ void deferred_probe_extend_timeout(void) pr_debug("Extended deferred probe timeout by %d secs\n", driver_deferred_probe_timeout); } + + if (cancel_delayed_work(&fw_devlink_timeout_work)) { + schedule_delayed_work(&fw_devlink_timeout_work, + fw_devlink_timeout * HZ); + pr_debug("Extended fw_devlink timeout by %d secs\n", + fw_devlink_timeout); + } } /** @@ -352,9 +379,12 @@ static int deferred_probe_initcall(void) if (!IS_ENABLED(CONFIG_MODULES)) { driver_deferred_probe_timeout = 0; - fw_devlink_drivers_done(); + fw_devlink_timeout = 0; } + if (!fw_devlink_timeout) + fw_devlink_drivers_done(); + /* * Trigger deferred probe again, this time we won't defer anything * that is optional @@ -366,6 +396,12 @@ static int deferred_probe_initcall(void) schedule_delayed_work(&deferred_probe_timeout_work, driver_deferred_probe_timeout * HZ); } + + if (fw_devlink_timeout > 0) { + schedule_delayed_work(&fw_devlink_timeout_work, + fw_devlink_timeout * HZ); + } + return 0; } late_initcall(deferred_probe_initcall); From patchwork Wed Nov 16 12:02:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 21008 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp104639wru; Wed, 16 Nov 2022 04:12:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf79rbG12GwnkA5s0C+3GfMDMTnz6ChZ6RbO5xNAHyt7hxGg9kBQml0NaJAezsyIe+wjPAvU X-Received: by 2002:a17:906:53c7:b0:780:8144:a41f with SMTP id p7-20020a17090653c700b007808144a41fmr18066133ejo.189.1668600765628; Wed, 16 Nov 2022 04:12:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668600765; cv=none; d=google.com; s=arc-20160816; b=YjTVFmDndxjz9aMCEVTcKuksCxkUfk8v3A5Ant0YbxVQ0aArhEmb7FdW3VyDi7wUmI I4qF4aTYNaWalP+PAj+qjUvBZf+7ZVYJGFgO58Y00HNdHkkpblniek2WjxBFgnP/FC+c QwsHa2cjnIMYg0LoP0Elza6Abjalc4IRkPt55jGI63zE7w9rx49Po/Vo89/SYZO1rH3g rfXkwoQXvH0M17XnwVFqBwvJXalUrivRQBYRFe7HJ06e3yv9VrvE9RQhYL8ieEWXmItC XcKcNl3HiBCxbojGFUOeYvpZZM/Frok8K0FkB9Wm7VFasy+a10X78sFA4/8xX5+Xo62E 0PSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2bKdDWjb/yR9GkUK+RJy2/FRw0utp2NjQXlBH9JbbvI=; b=t4+bFhunmrXMoZAP+upUER58eCVahbggZplgflEPj2nGjfXNrs8B3fpeoWseIMTZ3r N0OMV6lSkLmEWC7xwN6EHfYpqbvVwXYE1+T8498ttheLKLYc3/rEsomuXvq/e1KNr2Ln QdWUGyz+uW5VPQzXXFVhl72v3NZKKK40myxI7e0w8b9y9zFhHeJ6xtny+Ibb8FCW/AjI 7VGnCVq0bfYtanfTUu2kH6q8MrxVnX3woSOV646kMzm6KvF/vnDgiGGny9mBYZINrfVj mIG+OKTff+u6KAK2Me3FuKUNezlYIyfYdsH6lstoKAZ35S224c32uypFYCenCuH6G8Kc GQ8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IPV8qyDF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq12-20020a1709073f0c00b0073daf6b44a5si13332369ejc.775.2022.11.16.04.12.20; Wed, 16 Nov 2022 04:12:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IPV8qyDF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238577AbiKPMKz (ORCPT + 99 others); Wed, 16 Nov 2022 07:10:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238531AbiKPMKg (ORCPT ); Wed, 16 Nov 2022 07:10:36 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AC013FBAE for ; Wed, 16 Nov 2022 04:03:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668600180; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2bKdDWjb/yR9GkUK+RJy2/FRw0utp2NjQXlBH9JbbvI=; b=IPV8qyDFPFjzs88q2JZ0G5xDmcAD5RmYhWZTeX5irfUPpnbQLJol7cIvTDMEsR8b2NYbQQ 4UcVPdJXb/6vUm91iVoRg5zq7z+aitwKVn9tDzrboJhguafbBz4lJqABilmk6+GxqNEi28 0JOOp/XdQq2nQ8bRyeErbgIijYR/86M= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-536--b3yZEGGOti0GIw-WAcLvA-1; Wed, 16 Nov 2022 07:02:59 -0500 X-MC-Unique: -b3yZEGGOti0GIw-WAcLvA-1 Received: by mail-wr1-f69.google.com with SMTP id w11-20020adfbacb000000b002418a90da01so2208217wrg.16 for ; Wed, 16 Nov 2022 04:02:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2bKdDWjb/yR9GkUK+RJy2/FRw0utp2NjQXlBH9JbbvI=; b=kKBks5zrT3/BN46pu+JEXq9o6a6eO+ccJi5q/eD4zSlevdRIrFYfSNGc3D3NFVjqNI bsId0U//ZudF1taN3agtiisypGTbrHRiXR+RbDGZAlLGyRPY9S8R2YoTOdwv5+U9y5x6 Cw8fvriL/EKBlAqbULfz2N72FxjdWf7rhFeCLYXxdxMvm/R/Cj5PZxUGDzO/4dMhuyAq BU+R8fZ/jV2zi3QodVMxh83rADeuNQu3oAnTXhaU4W7wFKuk5XAhtr7GxM4rvoF6qZLY YqIIg6ncKeffAsJKwIRIiZQwnff1kqS4upgcMKZYnv5PG4dhXle81+LJVMWwcwY1qNw3 rIPQ== X-Gm-Message-State: ANoB5pnfq8+fdCRs9SRZQj0sudg5QHuFf5n7R94mAMXZhXtIyHwo2Hzi HchUtm3ofqihNoyZMpZeOwcXn8QUAnSEW1CCNtXL95MWsOWugDAS8I9BlPq62FLgbcxiPNTSbH5 ghpEkSZSJlHJVJY0w7i7A7cyVD0YkaxMcyLzo3BZd8+nsWH32ey/wlDVu4Jvrt3O3A+v9dMu296 A= X-Received: by 2002:adf:e6ca:0:b0:22c:e009:a201 with SMTP id y10-20020adfe6ca000000b0022ce009a201mr13972081wrm.70.1668600177657; Wed, 16 Nov 2022 04:02:57 -0800 (PST) X-Received: by 2002:adf:e6ca:0:b0:22c:e009:a201 with SMTP id y10-20020adfe6ca000000b0022ce009a201mr13972045wrm.70.1668600177318; Wed, 16 Nov 2022 04:02:57 -0800 (PST) Received: from minerva.home (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id h3-20020a05600c2ca300b003b49bd61b19sm2025563wmc.15.2022.11.16.04.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 04:02:56 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: "Rafael J . Wysocki" , Douglas Anderson , Saravana Kannan , Daniel Vetter , linux-arm-msm@vger.kernel.org, John Stultz , Peter Robinson , Steev Klimaszewski , Greg Kroah-Hartman , Enric Balletbo i Serra , Bjorn Andersson , Brian Masney , Rob Herring , Javier Martinez Canillas Subject: [PATCH v2 4/4] driver core: Disable driver deferred probe timeout by default Date: Wed, 16 Nov 2022 13:02:36 +0100 Message-Id: <20221116120236.520017-1-javierm@redhat.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116115348.517599-1-javierm@redhat.com> References: <20221116115348.517599-1-javierm@redhat.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749654716531376139?= X-GMAIL-MSGID: =?utf-8?q?1749654716531376139?= The driver_deferred_probe_timeout value has a long history. It was first set to -1 when was introduced by commit 25b4e70dcce9 ("driver core: allow stopping deferred probe after init"), meaning that the driver core would defer the probe forever unless a subsystem would opt-in by checking if the initcalls where done using the driver_deferred_probe_check_state() helper, or if a timeout was explicitly set with a "deferred_probe_timeout" param. Only the power domain, IOMMU and MDIO subsystems currently opt-in to check if the initcalls have completed with driver_deferred_probe_check_state(). Commit c8c43cee29f6 ("driver core: Fix driver_deferred_probe_check_state() logic") then changed the driver_deferred_probe_check_state() helper logic, to take into account whether modules have been enabled or not and also to return -EPROBE_DEFER if the probe deferred timeout work was still running. Then in commit e2cec7d68537 ("driver core: Set deferred_probe_timeout to a longer default if CONFIG_MODULES is set"), the timeout was increased to 30 seconds if modules are enabled. Because seems that some of the subsystems that were opt-in to not return -EPROBE_DEFER after the initcall where done could still have dependencies whose drivers were built as a module. This commit did a fundamental change to how probe deferral worked though, since now the default was not to attempt probing for drivers indefinitely but instead to timeout after 30 seconds, unless a different timeout is set using the "deferred_probe_timeout" command line parameter. The behavior was changed even more with commit ce68929f07de ("driver core: Revert default driver_deferred_probe_timeout value to 0"), since the value was set to 0 by default. Meaning that the probe deferral would be disabled after the initcalls where done. Unless a timeout was set in the cmdline. Notice that the commit said that it was reverting the default value to 0, but this was never 0. The default was -1 at the beginning and then changed to 30 in a later commit. This default value of 0 was reverted again by commit f516d01b9df2 ("Revert "driver core: Set default deferred_probe_timeout back to 0."") and set to 10 seconds instead. Which was still less than the 30 seconds that was set at some point, to allow systems with drivers built as modules and loaded later by user-land to probe drivers that were still in the deferred list. The 10 seconds timeout isn't enough in some cases, for example the Fedora kernel builds as much drivers as possible as modules. And this leads to an Snapdragon SC7180 based HP X2 Chromebook to not have display, due the DRM driver failing to probe if CONFIG_ARM_SMMU=y and CONFIG_SC_GPUCC_7180=m. So let's change the default again to -1 as it was at the beginning. That's how probe deferral always worked. The kernel should try to avoid guessing when it should be safe to give up on deferred drivers to be probed. The reason why the default "deferred_probe_timeout" was changed from -1 to the other values was to allow drivers that have only optional dependencies to probe even if the suppliers are not available. But now there is a "fw_devlink.timeout" parameter to timeout the links and allow drivers to probe even when the dependencies are not present. Let's set the default for that timeout to 10 seconds, to give the same behaviour as expected by these driver with optional device links. Signed-off-by: Javier Martinez Canillas Acked-by: Andrew Halaney --- Changes in v2: - Mention in the commit messsage the specific machine and drivers that are affected by the issue (Greg). - Double check the commit message for accuracy (John). - Add a second workqueue to timeout the devlink enforcing and allow drivers to probe even without their optional dependencies available. drivers/base/dd.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index ea448df94d24..5f18cd497850 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -256,12 +256,8 @@ static int deferred_devs_show(struct seq_file *s, void *data) } DEFINE_SHOW_ATTRIBUTE(deferred_devs); -#ifdef CONFIG_MODULES -static int driver_deferred_probe_timeout = 10; -#else -static int driver_deferred_probe_timeout; -#endif -static int fw_devlink_timeout = -1; +static int driver_deferred_probe_timeout = -1; +static int fw_devlink_timeout = 10; static int __init deferred_probe_timeout_setup(char *str) {