linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saravana Kannan <saravanak@google.com>
To: Alexander Stein <alexander.stein@ew.tq-group.com>
Cc: Tony Lindgren <tony@atomide.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Kevin Hilman <khilman@kernel.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	David Ahern <dsahern@kernel.org>,
	kernel-team@android.com, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org, iommu@lists.linux-foundation.org,
	netdev@vger.kernel.org, linux-gpio@vger.kernel.org,
	Geert Uytterhoeven <geert@linux-m68k.org>
Subject: Re: (EXT) Re: (EXT) Re: [PATCH v2 1/9] PM: domains: Delete usage of driver_deferred_probe_check_state()
Date: Mon, 4 Jul 2022 18:24:33 -0700	[thread overview]
Message-ID: <CAGETcx8KGOTanmnVTLJ=SSDgv71ofhUcRxXRiqnUBNB3RZsY=A@mail.gmail.com> (raw)
In-Reply-To: <5717577.DvuYhMxLoT@steina-w>

[-- Attachment #1: Type: text/plain, Size: 6179 bytes --]

On Mon, Jul 4, 2022 at 12:07 AM Alexander Stein
<alexander.stein@ew.tq-group.com> wrote:
>
> Am Freitag, 1. Juli 2022, 09:02:22 CEST schrieb Saravana Kannan:
> > On Thu, Jun 30, 2022 at 11:02 PM Alexander Stein
> >
> > <alexander.stein@ew.tq-group.com> wrote:
> > > Hi Saravana,
> > >
> > > Am Freitag, 1. Juli 2022, 02:37:14 CEST schrieb Saravana Kannan:
> > > > On Thu, Jun 23, 2022 at 5:08 AM Alexander Stein
> > > >
> > > > <alexander.stein@ew.tq-group.com> wrote:
> > > > > Hi,
> > > > >
> > > > > Am Dienstag, 21. Juni 2022, 09:28:43 CEST schrieb Tony Lindgren:
> > > > > > Hi,
> > > > > >
> > > > > > * Saravana Kannan <saravanak@google.com> [700101 02:00]:
> > > > > > > Now that fw_devlink=on by default and fw_devlink supports
> > > > > > > "power-domains" property, the execution will never get to the
> > > > > > > point
> > > > > > > where driver_deferred_probe_check_state() is called before the
> > > > > > > supplier
> > > > > > > has probed successfully or before deferred probe timeout has
> > > > > > > expired.
> > > > > > >
> > > > > > > So, delete the call and replace it with -ENODEV.
> > > > > >
> > > > > > Looks like this causes omaps to not boot in Linux next. With this
> > > > > > simple-pm-bus fails to probe initially as the power-domain is not
> > > > > > yet available. On platform_probe() genpd_get_from_provider() returns
> > > > > > -ENOENT.
> > > > > >
> > > > > > Seems like other stuff is potentially broken too, any ideas on
> > > > > > how to fix this?
> > > > >
> > > > > I think I'm hit by this as well, although I do not get a lockup.
> > > > > In my case I'm using
> > > > > arch/arm64/boot/dts/freescale/imx8mq-tqma8mq-mba8mx.dts and probing of
> > > > > 38320000.blk-ctrl fails as the power-domain is not (yet) registed.
> > > >
> > > > Ok, took a look.
> > > >
> > > > The problem is that there are two drivers for the same device and they
> > > > both initialize this device.
> > > >
> > > >     gpc: gpc@303a0000 {
> > > >
> > > >         compatible = "fsl,imx8mq-gpc";
> > > >
> > > >     }
> > > >
> > > > $ git grep -l "fsl,imx7d-gpc" -- drivers/
> > > > drivers/irqchip/irq-imx-gpcv2.c
> > > > drivers/soc/imx/gpcv2.c
> > > >
> > > > IMHO, this is a bad/broken design.
> > > >
> > > > So what's happening is that fw_devlink will block the probe of
> > > > 38320000.blk-ctrl until 303a0000.gpc is initialized. And it stops
> > > > blocking the probe of 38320000.blk-ctrl as soon as the first driver
> > > > initializes the device. In this case, it's the irqchip driver.
> > > >
> > > > I'd recommend combining these drivers into one. Something like the
> > > > patch I'm attaching (sorry for the attachment, copy-paste is mangling
> > > > the tabs). Can you give it a shot please?
> > >
> > > I tried this patch and it delayed the driver initialization (those of UART
> > > as
> > > well BTW). Unfortunately the driver fails the same way:
> > Thanks for testing the patch!
> >
> > > > [    1.125253] imx8m-blk-ctrl 38320000.blk-ctrl: error -ENODEV: failed
> > > > to
> > >
> > > attach power domain "bus"
> > >
> > > More than that it even introduced some more errors:
> > > > [    0.008160] irq: no irq domain found for gpc@303a0000 !
> >
> > So the idea behind my change was that as long as the irqchip isn't the
> > root of the irqdomain (might be using the terms incorrectly) like the
> > gic, you can make it a platform driver. And I was trying to hack up a
> > patch that's the equivalent of platform_irqchip_probe() (which just
> > ends up eventually calling the callback you use in IRQCHIP_DECLARE().
> > I probably made some mistake in the quick hack that I'm sure if
> > fixable.
> >
> > > > [    0.013251] Failed to map interrupt for
> > > > /soc@0/bus@30400000/timer@306a0000
> >
> > However, this timer driver also uses TIMER_OF_DECLARE() which can't
> > handle failure to get the IRQ (because it's can't -EPROBE_DEFER). So,
> > this means, the timer driver inturn needs to be converted to a
> > platform driver if it's supposed to work with the IRQCHIP_DECLARE()
> > being converted to a platform driver.
> >
> > But that's a can of worms not worth opening. But then I remembered
> > this simpler workaround will work and it is pretty much a variant of
> > the workaround that's already in the gpc's irqchip driver to allow two
> > drivers to probe the same device (people really should stop doing
> > that).
> >
> > Can you drop my previous hack patch and try this instead please? I'm
> > 99% sure this will work.
> >
> > diff --git a/drivers/irqchip/irq-imx-gpcv2.c
> > b/drivers/irqchip/irq-imx-gpcv2.c index b9c22f764b4d..8a0e82067924 100644
> > --- a/drivers/irqchip/irq-imx-gpcv2.c
> > +++ b/drivers/irqchip/irq-imx-gpcv2.c
> > @@ -283,6 +283,7 @@ static int __init imx_gpcv2_irqchip_init(struct
> > device_node *node,
> >          * later the GPC power domain driver will not be skipped.
> >          */
> >         of_node_clear_flag(node, OF_POPULATED);
> > +       fwnode_dev_initialized(domain->fwnode, false);
> >         return 0;
> >  }
>
> Just to be sure here, I tried this patch on top of next-20220701 but
> unfortunately this doesn't fix the original problem either. The timer errors
> are gone though.

To clarify, you had the timer issue only with my "combine drivers" patch, right?

> The probe of imx8m-blk-ctrl got slightly delayed (from 0.74 to 0.90s printk
> time) but results in the identical error message.

My guess is that the probe attempt of blk-ctrl is delayed now till gpc
probes (because of the device links getting created with the
fwnode_dev_initialized() fix), but by the time gpc probe finishes, the
power domains aren't registered yet because of the additional level of
device addition and probing.

Can you try the attached patch please?

And if that doesn't fix the issues, then enable the debug logs in the
following functions please and share the logs from boot till the
failure? If you can enable CONFIG_PRINTK_CALLER, that'd help too.
device_link_add()
fwnode_link_add()
fw_devlink_relax_cycle()

Btw, part of the reason I'm trying to make sure we fix it the right
way is that when we try to enable async boot by default, we don't run
into issues.

Thanks,
Saravana

[-- Attachment #2: 0001-imx-fix-and-logs.patch --]
[-- Type: text/x-patch, Size: 1755 bytes --]

From 34ae4fa9c7efca26e5946422ab9a0925ce4a5293 Mon Sep 17 00:00:00 2001
From: Saravana Kannan <saravanak@google.com>
Date: Fri, 1 Jul 2022 01:25:56 -0700
Subject: [PATCH] imx-fix and logs

---
 drivers/irqchip/irq-imx-gpcv2.c |  1 +
 drivers/soc/imx/gpcv2.c         | 10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-imx-gpcv2.c b/drivers/irqchip/irq-imx-gpcv2.c
index b9c22f764b4d..8a0e82067924 100644
--- a/drivers/irqchip/irq-imx-gpcv2.c
+++ b/drivers/irqchip/irq-imx-gpcv2.c
@@ -283,6 +283,7 @@ static int __init imx_gpcv2_irqchip_init(struct device_node *node,
 	 * later the GPC power domain driver will not be skipped.
 	 */
 	of_node_clear_flag(node, OF_POPULATED);
+	fwnode_dev_initialized(domain->fwnode, false);
 	return 0;
 }
 
diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c
index 85aa86e1338a..07fceaf74f19 100644
--- a/drivers/soc/imx/gpcv2.c
+++ b/drivers/soc/imx/gpcv2.c
@@ -1350,6 +1350,8 @@ static int imx_pgc_domain_probe(struct platform_device *pdev)
 		goto out_genpd_remove;
 	}
 
+	dev_info("%s: Probe succeeded\n", __func__);
+
 	return 0;
 
 out_genpd_remove:
@@ -1423,7 +1425,12 @@ static struct platform_driver imx_pgc_domain_driver = {
 	.remove   = imx_pgc_domain_remove,
 	.id_table = imx_pgc_domain_id,
 };
-builtin_platform_driver(imx_pgc_domain_driver)
+
+static int __init imx_pgc_domain_init(void)
+{
+	return platform_driver_register(&imx_pgc_domain_driver);
+}
+subsys_initcall(imx_pgc_domain_init);
 
 static int imx_gpcv2_probe(struct platform_device *pdev)
 {
@@ -1518,6 +1525,7 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
 		}
 	}
 
+	dev_info("%s: Probe succeeded\n", __func__);
 	return 0;
 }
 
-- 
2.37.0.rc0.161.g10f37bed90-goog


  reply	other threads:[~2022-07-05  1:25 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01  7:06 [PATCH v2 0/9] deferred_probe_timeout logic clean up Saravana Kannan
2022-06-01  7:06 ` [PATCH v2 1/9] PM: domains: Delete usage of driver_deferred_probe_check_state() Saravana Kannan
2022-06-09 11:44   ` Ulf Hansson
2022-06-09 19:29     ` Saravana Kannan
2022-06-21  7:28   ` Tony Lindgren
2022-06-21 19:34     ` Saravana Kannan
2022-06-22  4:58       ` Tony Lindgren
2022-06-22 19:09         ` Saravana Kannan
2022-06-23  7:01           ` Tony Lindgren
2022-06-23  8:21             ` Saravana Kannan
2022-06-27  9:10               ` Tony Lindgren
2022-06-30 23:10                 ` Saravana Kannan
2022-06-30 23:26                   ` Rob Herring
2022-06-30 23:30                     ` Saravana Kannan
2022-07-01  5:33                       ` Tony Lindgren
2022-07-01  6:12                         ` Tony Lindgren
2022-07-01  8:10                           ` Saravana Kannan
2022-07-01  8:26                             ` Saravana Kannan
2022-07-01 13:00                               ` Tony Lindgren
2022-07-12  7:12                                 ` Tony Lindgren
2022-07-13  0:49                                   ` Saravana Kannan
2022-07-13  8:06                                     ` Tony Lindgren
2022-07-01 15:08                               ` Sudeep Holla
2022-07-01 19:13                                 ` Saravana Kannan
2022-07-05  8:44                                   ` Saravana Kannan
2022-07-01  7:38                   ` Geert Uytterhoeven
2022-06-23 12:08     ` Alexander Stein
2022-07-01  0:37       ` Saravana Kannan
2022-07-01  6:01         ` (EXT) " Alexander Stein
2022-07-01  7:02           ` Saravana Kannan
2022-07-04  7:07             ` (EXT) " Alexander Stein
2022-07-05  1:24               ` Saravana Kannan [this message]
2022-07-06 13:02                 ` Re: " Alexander Stein
2022-07-13  0:45                   ` Saravana Kannan
2022-07-14  6:41                     ` Alexander Stein
2022-07-15 22:08                       ` Saravana Kannan
2022-07-01  7:30         ` Geert Uytterhoeven
2022-06-01  7:06 ` [PATCH v2 2/9] pinctrl: devicetree: " Saravana Kannan
2022-06-01  7:06 ` [PATCH v2 3/9] net: mdio: " Saravana Kannan
2022-07-05  9:11   ` Geert Uytterhoeven
2022-07-13  1:40     ` Saravana Kannan
2022-07-13 11:39       ` Geert Uytterhoeven
2022-08-15  8:38     ` Geert Uytterhoeven
2022-06-01  7:07 ` [PATCH v2 4/9] driver core: Add wait_for_init_devices_probe helper function Saravana Kannan
2022-06-01  7:07 ` [PATCH v2 5/9] net: ipconfig: Relax fw_devlink if we need to mount a network rootfs Saravana Kannan
2022-06-01  7:07 ` [PATCH v2 6/9] Revert "driver core: Set default deferred_probe_timeout back to 0." Saravana Kannan
2022-07-20 17:31   ` Geert Uytterhoeven
2022-07-20 19:01     ` Saravana Kannan
2022-07-21  8:40       ` Geert Uytterhoeven
2022-06-01  7:07 ` [PATCH v2 7/9] driver core: Set fw_devlink.strict=1 by default Saravana Kannan
2022-06-22  7:47   ` Sascha Hauer
2022-06-22  8:44     ` Linus Walleij
2022-06-22 10:52       ` Andy Shevchenko
2022-06-22 11:18         ` Sascha Hauer
2022-06-22 19:40       ` Saravana Kannan
2022-06-22 20:35         ` Saravana Kannan
2022-06-22 22:30           ` Saravana Kannan
2022-06-28 13:09         ` Linus Walleij
2022-06-01  7:07 ` [PATCH v2 8/9] iommu/of: Delete usage of driver_deferred_probe_check_state() Saravana Kannan
2022-08-19 14:26   ` Jean-Philippe Brucker
2022-06-01  7:07 ` [PATCH v2 9/9] driver core: Delete driver_deferred_probe_check_state() Saravana Kannan
2022-06-07 18:07 ` [PATCH v2 0/9] deferred_probe_timeout logic clean up Geert Uytterhoeven
2022-06-08  0:55   ` Saravana Kannan
2022-06-08  4:17     ` Saravana Kannan
2022-06-08 10:25       ` Geert Uytterhoeven
2022-06-08 18:12         ` Saravana Kannan
2022-06-08 18:47           ` Geert Uytterhoeven
2022-06-08 21:07             ` Saravana Kannan
2022-06-08 22:49               ` Jakub Kicinski
2022-06-08 23:15                 ` Saravana Kannan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGETcx8KGOTanmnVTLJ=SSDgv71ofhUcRxXRiqnUBNB3RZsY=A@mail.gmail.com' \
    --to=saravanak@google.com \
    --cc=alexander.stein@ew.tq-group.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hkallweit1@gmail.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=kernel-team@android.com \
    --cc=khilman@kernel.org \
    --cc=kuba@kernel.org \
    --cc=len.brown@intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavel@ucw.cz \
    --cc=rafael@kernel.org \
    --cc=tony@atomide.com \
    --cc=ulf.hansson@linaro.org \
    --cc=will@kernel.org \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).