Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5218925pxb; Mon, 15 Feb 2021 13:01:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJy9XC4x/qEhFPGdgGEGENlgud5Jgwy8A6bIq7KUvQSXB0NNW2qBXAarVm7U3sHYBCqm5A4/ X-Received: by 2002:a05:6402:22ce:: with SMTP id dm14mr17836361edb.256.1613422914649; Mon, 15 Feb 2021 13:01:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613422914; cv=none; d=google.com; s=arc-20160816; b=O8oGeAkNIDxqRAc34zJWJT/o/ii+ys4E7aez460LK9rd4ZvJ+STibj+xwn5VXu1Syw ji7NrlnrsWXj9tPG4HcvEKuMmHGDdgoZW4yxNgnRbssD3mw8HqlixhfnvA6bt6eQZzdG nHkKCTXllLI9S9SFJKYI4ux9PO8oq8Ybbgwo+ebNVBRlTzhOBnubblOvry6n+kyvZdeg G24nO2/3Xm9ixBduSXP9pAydVirhEjrxsoKGxv2cadADW4dDnxuS9BfYtkVn/RTZ3pie coWqZHxsgTj1o9zfQj6Ch79zEWsK8Sd+xpAtG7Kke1TIQNgXp3aWapN7l25lceByFNqP vtfw== 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=3dLgveZdM46x2bbwg0HqxOz9RVwmEkJteT9c43w2RHs=; b=p2Ct6SD6eaJUMRbKOj7Ho56La1LIjqWqgBvEgpPzzR/CbS9lgKhnflcUSdn3QPurVh FlQDN+gA9rxQKsryBXpmo8dEufUIZnHFLAv4//wZ+pkC28e+qGsPuj+KtTcgEn5y/sws pQ+HOW3O/iaoplaAXqlsBe0BsZsNjEKIrhnFixN6iBRYqXvJj3wS3nWAfIzoG4Vi/S45 s4Fw2CjAV5jGwB2WpGtGPnF+ZChuZu23Zh09ioNPV9+5gy2LY0xFVdVCMNQHAB16AqgV 6RrVSh+r3kdoP54xVxi4OtQF6f/tnfWC7vsy8PGVlHQzKNVqMN3MxE7Goaj7kliqUxG0 U/tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=SPONsPUW; 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 p20si12647455ejf.307.2021.02.15.13.01.31; Mon, 15 Feb 2021 13:01:54 -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=SPONsPUW; 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 S229520AbhBOVAh (ORCPT + 99 others); Mon, 15 Feb 2021 16:00:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbhBOVAd (ORCPT ); Mon, 15 Feb 2021 16:00:33 -0500 Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B8E0C061756 for ; Mon, 15 Feb 2021 12:59:53 -0800 (PST) Received: by mail-yb1-xb33.google.com with SMTP id f4so8398790ybk.11 for ; Mon, 15 Feb 2021 12:59:53 -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=3dLgveZdM46x2bbwg0HqxOz9RVwmEkJteT9c43w2RHs=; b=SPONsPUWVt8jXmzvcypXB2jQqpK3eFXkZUNBCSIDdaqTC7/FdkjuFaFJSA+tC7aBK3 juscsNZufCi9yDHiFPIc3jEmB12dCLvZHGxN8qTIxEGQC8T4+Tj5KBgjYVxCZvYJ08zV TpCEDRjY0Cn764gGGuzDGN6JdAUEZvhnBh78QgSnZITZkHD8wzSHmHSYman3GvS/PQ4B /A4W3S8lv3hN0PvaocLDCzWX+6OuOrN5kPV+bUVJDs0vdQp0YCGu7+DAATUHmSwq24tb MGXsu/qO2cCs2lqFKhNT4LWh9PTNHNGMuqmAQx0PkGhuWxDvRtrbr0QJt18vPciIXesV ZalQ== 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=3dLgveZdM46x2bbwg0HqxOz9RVwmEkJteT9c43w2RHs=; b=N7vkH/XeRp0i6YeJQrpRNH2vRDIdS+qZJsQuNP2wV7QD2mOAkyJdTRyVD9kRB9kN2y Wf9Ah4EvghPNDMPdBJqkXbmNbkQVyY0k4m7JAlcrsyCQNgS4kKqwclWgTJvmG0lVQaff Gb5zq3g5lfPXaWT3rPxaBzvW2jfLQf3cRvPg3D7tOA1GWehVywsSuo/VH6pe7nnR0LvB y/1+K/nBYzhRtCLTgtru7Pq+lf+4lOOz1ROHrJ6KVOOUaqvHsCzbZ5x7WBAK/7gUKKax awTU0Yaict88DXritmWssGA+m48nakPgLvJlHL4UoeNhA3x1GIhCeam1BYravWn41uzY OPLw== X-Gm-Message-State: AOAM5303dZia+Ay1yWisquhc2jER4yQHjE8HRpaaZRw3n/x1RxExAZus mB6bdaArS+imoMuaCcfkt5ohCINS77U7GXBHUWf1Mg== X-Received: by 2002:a25:af0b:: with SMTP id a11mr24804601ybh.228.1613422792220; Mon, 15 Feb 2021 12:59:52 -0800 (PST) MIME-Version: 1.0 References: <20210215111619.2385030-1-geert+renesas@glider.be> In-Reply-To: From: Saravana Kannan Date: Mon, 15 Feb 2021 12:59:16 -0800 Message-ID: Subject: Re: [PATCH] driver core: Fix double failed probing with fw_devlink=on To: Geert Uytterhoeven Cc: "Rafael J. Wysocki" , Geert Uytterhoeven , Greg Kroah-Hartman , Linux-Renesas , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 15, 2021 at 11:08 AM Geert Uytterhoeven wrote: > > Hi Saravana, > > On Mon, Feb 15, 2021 at 7:27 PM Saravana Kannan wrote: > > On Mon, Feb 15, 2021 at 6:59 AM Rafael J. Wysocki wrote: > > > On Mon, Feb 15, 2021 at 12:16 PM Geert Uytterhoeven > > > wrote: > > > > With fw_devlink=permissive, devices are added to the deferred probe > > > > pending list if their driver's .probe() method returns -EPROBE_DEFER. > > > > > > > > With fw_devlink=on, devices are added to the deferred probe pending list > > > > if they are determined to be a consumer, > > > > If they are determined to be a consumer or if they are determined to > > have a supplier that hasn't probed yet? > > When the supplier has probed: > > bus: 'platform': driver_probe_device: matched device > e6150000.clock-controller with driver renesas-cpg-mssr > bus: 'platform': really_probe: probing driver renesas-cpg-mssr > with device e6150000.clock-controller > PM: Added domain provider from /soc/clock-controller@e6150000 > driver: 'renesas-cpg-mssr': driver_bound: bound to device > 'e6150000.clock-controller' > platform e6055800.gpio: Added to deferred list > [...] > platform e6020000.watchdog: Added to deferred list > [...] > platform fe000000.pcie: Added to deferred list > > > > > which happens before their > > > > driver's .probe() method is called. If the actual probe fails later > > > > (real failure, not -EPROBE_DEFER), the device will still be on the > > > > deferred probe pending list, and it will be probed again when deferred > > > > probing kicks in, which is futile. > > > > > > > > Fix this by explicitly removing the device from the deferred probe > > > > pending list in case of probe failures. > > > > > > > > Fixes: e590474768f1cc04 ("driver core: Set fw_devlink=on by default") > > > > Signed-off-by: Geert Uytterhoeven > > > > > > Good catch: > > > > > > Reviewed-by: Rafael J. Wysocki > > > > The issue is real and needs to be fixed. But I'm confused how this can > > happen. We won't even enter really_probe() if the driver isn't ready. > > We also won't get to run the driver's .probe() if the suppliers aren't > > ready. So how does the device get added to the deferred probe list > > before the driver is ready? Is this due to device_links_driver_bound() > > on the supplier? > > > > Can you give a more detailed step by step on the case you are hitting? > > The device is added to the list due to device_links_driver_bound() > calling driver_deferred_probe_add() on all consumer devices. Thanks for the explanation. Maybe add more details like this to the commit text or in the code? For the code: Reviewed-by: Saravana Kanna -Saravana > > > > > +++ b/drivers/base/dd.c > > > > @@ -639,11 +639,13 @@ static int really_probe(struct device *dev, struct device_driver *drv) > > > > case -ENXIO: > > > > pr_debug("%s: probe of %s rejects match %d\n", > > > > drv->name, dev_name(dev), ret); > > > > + driver_deferred_probe_del(dev); > > > > break; > > > > default: > > > > /* driver matched but the probe failed */ > > > > pr_warn("%s: probe of %s failed with error %d\n", > > > > drv->name, dev_name(dev), ret); > > > > + driver_deferred_probe_del(dev); > > > > } > > > > /* > > > > * Ignore errors returned by ->probe so that the next driver can try > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like that. > -- Linus Torvalds