From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Saravana Kannan <saravanak@google.com>
Cc: Jon Hunter <jonathanh@nvidia.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Android Kernel Team <kernel-team@android.com>,
LKML <linux-kernel@vger.kernel.org>,
Jisheng Zhang <Jisheng.Zhang@synaptics.com>,
Kevin Hilman <khilman@baylibre.com>,
John Stultz <john.stultz@linaro.org>,
Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
Marc Zyngier <maz@kernel.org>,
linux-tegra <linux-tegra@vger.kernel.org>
Subject: Re: [PATCH v1 0/5] Enable fw_devlink=on by default
Date: Thu, 11 Feb 2021 16:03:43 +0100 [thread overview]
Message-ID: <CAJZ5v0iv9fRzM8cbGrPhutPNpod-gLWcZ8fWzDpfJ=NUVmm5Og@mail.gmail.com> (raw)
In-Reply-To: <CAGETcx9ZaBLRVPqiSkPf_4Tm5dDLNbLBM2RmHk1jr7yLp_1CCQ@mail.gmail.com>
On Thu, Feb 11, 2021 at 1:02 AM Saravana Kannan <saravanak@google.com> wrote:
>
> On Thu, Jan 28, 2021 at 7:03 AM Jon Hunter <jonathanh@nvidia.com> wrote:
> >
> >
> > On 14/01/2021 16:56, Jon Hunter wrote:
> > >
> > > On 14/01/2021 16:47, Saravana Kannan wrote:
> > >
> > > ...
> > >
> > >>> Yes this is the warning shown here [0] and this is coming from
> > >>> the 'Generic PHY stmmac-0:00' device.
> > >>
> > >> Can you print the supplier and consumer device when this warning is
> > >> happening and let me know? That'd help too. I'm guessing the phy is
> > >> the consumer.
> > >
> > >
> > > Sorry I should have included that. I added a print to dump this on
> > > another build but failed to include here.
> > >
> > > WARNING KERN Generic PHY stmmac-0:00: supplier 2200000.gpio (status 1)
> > >
> > > The status is the link->status and looks like the supplier is the
> > > gpio controller. I have verified that the gpio controller is probed
> > > before this successfully.
> > >
> > >> So the warning itself isn't a problem -- it's not breaking anything or
> > >> leaking memory or anything like that. But the device link is jumping
> > >> states in an incorrect manner. With enough context of this code (why
> > >> the device_bind_driver() is being called directly instead of going
> > >> through the normal probe path), it should be easy to fix (I'll just
> > >> need to fix up the device link state).
> > >
> > > Correct, the board seems to boot fine, we just get this warning.
> >
> >
> > Have you had chance to look at this further?
>
> Hi Jon,
>
> I finally got around to looking into this. Here's the email[1] that
> describes why it's done this way.
>
> [1] - https://lore.kernel.org/lkml/YCRjmpKjK0pxKTCP@lunn.ch/
>
> >
> > The following does appear to avoid the warning, but I am not sure if
> > this is the correct thing to do ...
> >
> > index 9179825ff646..095aba84f7c2 100644
> > --- a/drivers/base/dd.c
> > +++ b/drivers/base/dd.c
> > @@ -456,6 +456,10 @@ int device_bind_driver(struct device *dev)
> > {
> > int ret;
> >
> > + ret = device_links_check_suppliers(dev);
> > + if (ret)
> > + return ret;
> > +
> > ret = driver_sysfs_add(dev);
> > if (!ret)
> > driver_bound(dev);
>
> So digging deeper into the usage of device_bind_driver and looking at
> [1], it doesn't look like returning an error here is a good option.
> When device_bind_driver() is called, the driver's probe function isn't
> even called. So, there's no way for the driver to even defer probing
> based on any of the suppliers. So, we have a couple of options:
>
> 1. Delete all the links to suppliers that haven't bound.
Or maybe convert them to stateless links? Would that be doable at all?
> We'll still leave the links to active suppliers alone in case it helps with
> suspend/resume correctness.
> 2. Fix the warning to not warn on suppliers that haven't probed if the
> device's driver has no probe function. But this will also need fixing
> up the cleanup part when device_release_driver() is called. Also, I'm
> not sure if device_bind_driver() is ever called when the driver
> actually has a probe() function.
>
> Rafael,
>
> Option 1 above is pretty straightforward.
I would prefer this ->
> Option 2 would look something like what's at the end of this email +
> caveat about whether the probe check is sufficient.
-> because "fix the warning" really means that we haven't got the
device link state machine right and getting it right may imply a major
redesign.
Overall, I'd prefer to take a step back and allow things to stabilize
for a while to let people catch up with this.
> Do you have a preference between Option 1 vs 2? Or do you have some
> other option in mind?
>
> Thanks,
> Saravana
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 5481b6940a02..8102b3c48bbc 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -1247,7 +1247,8 @@ void device_links_driver_bound(struct device *dev)
> */
> device_link_drop_managed(link);
> } else {
> - WARN_ON(link->status != DL_STATE_CONSUMER_PROBE);
> + WARN_ON(link->status != DL_STATE_CONSUMER_PROBE &&
> + dev->driver->probe);
> WRITE_ONCE(link->status, DL_STATE_ACTIVE);
> }
>
> @@ -1302,7 +1303,8 @@ static void __device_links_no_driver(struct device *dev)
> if (link->supplier->links.status == DL_DEV_DRIVER_BOUND) {
> WRITE_ONCE(link->status, DL_STATE_AVAILABLE);
> } else {
> - WARN_ON(!(link->flags & DL_FLAG_SYNC_STATE_ONLY));
> + WARN_ON(!(link->flags & DL_FLAG_SYNC_STATE_ONLY) &&
> + dev->driver->probe);
> WRITE_ONCE(link->status, DL_STATE_DORMANT);
> }
> }
next prev parent reply other threads:[~2021-02-11 15:29 UTC|newest]
Thread overview: 89+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-18 3:16 [PATCH v1 0/5] Enable fw_devlink=on by default Saravana Kannan
2020-12-18 3:16 ` [PATCH v1 1/5] driver core: Add debug logs for device link related probe deferrals Saravana Kannan
2020-12-18 3:17 ` [PATCH v1 2/5] driver core: Add device link support for INFERRED flag Saravana Kannan
2020-12-18 3:17 ` [PATCH v1 3/5] driver core: Have fw_devlink use DL_FLAG_INFERRED Saravana Kannan
2020-12-18 3:17 ` [PATCH v1 4/5] driver core: Handle cycles in device links created by fw_devlink Saravana Kannan
2020-12-18 6:39 ` kernel test robot
2020-12-18 6:39 ` [RFC PATCH] driver core: fw_devlink_relax_cycle() can be static kernel test robot
2020-12-18 6:48 ` [PATCH v1 4/5] driver core: Handle cycles in device links created by fw_devlink kernel test robot
2020-12-18 7:12 ` kernel test robot
2020-12-18 3:17 ` [PATCH v1 5/5] driver core: Set fw_devlink=on by default Saravana Kannan
[not found] ` <CGME20210111111245eucas1p15acde7ecc2ca7f7782beb8ed74c72022@eucas1p1.samsung.com>
2021-01-11 11:12 ` Marek Szyprowski
[not found] ` <CGME20210111141814eucas1p1f388df07b789693a999042b27f0d8c2a@eucas1p1.samsung.com>
2021-01-11 14:18 ` Marek Szyprowski
2021-01-11 21:47 ` Saravana Kannan
2021-01-12 7:11 ` Marek Szyprowski
2021-01-12 20:51 ` Saravana Kannan
2021-01-13 7:04 ` Marek Szyprowski
2021-01-13 19:23 ` Saravana Kannan
2021-01-14 7:36 ` Marek Szyprowski
2021-01-14 18:08 ` Saravana Kannan
2021-01-18 17:43 ` Geert Uytterhoeven
2021-01-17 23:01 ` Michael Walle
2021-01-18 21:01 ` Saravana Kannan
2021-01-19 10:41 ` Michael Walle
2021-01-20 0:00 ` Saravana Kannan
2021-01-18 17:39 ` Geert Uytterhoeven
2021-01-18 17:59 ` Marc Zyngier
2021-01-18 19:16 ` Geert Uytterhoeven
2021-01-18 19:30 ` Marc Zyngier
2021-01-18 21:18 ` Saravana Kannan
2021-01-19 9:05 ` Geert Uytterhoeven
2021-01-19 18:08 ` Saravana Kannan
2021-01-19 21:50 ` Saravana Kannan
2021-01-20 9:40 ` Geert Uytterhoeven
2021-01-20 14:26 ` Geert Uytterhoeven
2021-01-20 17:22 ` Saravana Kannan
2021-01-21 16:04 ` Geert Uytterhoeven
2021-01-25 23:30 ` Saravana Kannan
2021-01-26 8:25 ` Geert Uytterhoeven
2021-01-20 9:11 ` Geert Uytterhoeven
2021-01-21 8:22 ` [TEST PATCH v1] driver: core: Make fw_devlink=on more forgiving Saravana Kannan
2021-01-21 8:27 ` Saravana Kannan
2021-01-21 10:37 ` Geert Uytterhoeven
2021-01-22 1:07 ` Saravana Kannan
2021-01-21 10:33 ` Marek Szyprowski
2021-01-25 17:05 ` [PATCH v1 5/5] driver core: Set fw_devlink=on by default Tudor.Ambarus
2021-01-25 18:16 ` Saravana Kannan
2021-01-28 10:59 ` Tudor.Ambarus
2021-01-28 17:04 ` Saravana Kannan
2021-02-10 5:54 ` Guenter Roeck
2021-02-10 8:20 ` Saravana Kannan
2021-02-10 15:10 ` Guenter Roeck
2021-02-10 20:52 ` Saravana Kannan
2021-02-10 21:21 ` Guenter Roeck
2021-02-17 2:39 ` Saravana Kannan
2021-02-17 3:05 ` Guenter Roeck
2021-02-17 3:13 ` Saravana Kannan
2020-12-18 21:11 ` [PATCH v1 0/5] Enable " Saravana Kannan
2020-12-21 8:18 ` Jisheng Zhang
[not found] ` <CAHp75VfqL1QuvjCZ7p23e_2qhY3DUgVNaS--Uk1mEoEHsD8GBA@mail.gmail.com>
2021-01-14 16:49 ` Saravana Kannan
2020-12-21 9:48 ` Rafael J. Wysocki
2021-01-07 20:05 ` Greg Kroah-Hartman
2021-01-07 21:53 ` Saravana Kannan
2021-01-13 11:11 ` Marc Zyngier
2021-01-13 15:27 ` Jon Hunter
2021-01-13 21:29 ` Saravana Kannan
2021-01-14 11:34 ` Jon Hunter
2021-01-14 16:40 ` Saravana Kannan
2021-01-14 16:47 ` Jon Hunter
2021-01-14 16:52 ` Saravana Kannan
2021-01-14 18:55 ` Jon Hunter
2021-01-14 21:50 ` Saravana Kannan
2021-01-15 16:12 ` Jon Hunter
2021-01-15 17:44 ` Saravana Kannan
2021-01-13 20:56 ` Saravana Kannan
2021-01-13 11:30 ` Jon Hunter
2021-01-13 21:26 ` Saravana Kannan
2021-01-14 16:11 ` Jon Hunter
2021-01-14 16:47 ` Saravana Kannan
2021-01-14 16:56 ` Jon Hunter
2021-01-28 15:03 ` Jon Hunter
2021-01-28 17:27 ` Saravana Kannan
2021-02-11 0:02 ` Saravana Kannan
2021-02-11 15:03 ` Rafael J. Wysocki [this message]
2021-02-11 17:14 ` Saravana Kannan
2021-02-11 17:48 ` Rafael J. Wysocki
2021-02-12 3:04 ` Saravana Kannan
2021-01-13 11:44 ` Nicolas Saenz Julienne
2021-01-13 11:48 ` Marc Zyngier
2021-01-13 21:27 ` 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='CAJZ5v0iv9fRzM8cbGrPhutPNpod-gLWcZ8fWzDpfJ=NUVmm5Og@mail.gmail.com' \
--to=rafael@kernel.org \
--cc=Jisheng.Zhang@synaptics.com \
--cc=gregkh@linuxfoundation.org \
--cc=john.stultz@linaro.org \
--cc=jonathanh@nvidia.com \
--cc=kernel-team@android.com \
--cc=khilman@baylibre.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=maz@kernel.org \
--cc=nsaenzjulienne@suse.de \
--cc=saravanak@google.com \
/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).