All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Saravana Kannan <saravanak@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Michael Walle <michael@walle.cc>,
	"Cc: Android Kernel" <kernel-team@android.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] driver core: Update device link status correctly for SYNC_STATE_ONLY links
Date: Tue, 26 May 2020 10:28:43 +0200	[thread overview]
Message-ID: <CAJZ5v0i9yyvf0JAAUfj1DiFPgHHUdXkE3T6fWSxFEB1Mo_fx3Q@mail.gmail.com> (raw)
In-Reply-To: <20200526070518.107333-1-saravanak@google.com>

On Tue, May 26, 2020 at 9:05 AM Saravana Kannan <saravanak@google.com> wrote:
>
> When SYNC_STATE_ONLY support was added in commit 05ef983e0d65 ("driver
> core: Add device link support for SYNC_STATE_ONLY flag"),
> SYNC_STATE_ONLY links were treated similar to STATELESS links in terms
> of not blocking consumer probe if the supplier hasn't probed yet.
>
> That caused a SYNC_STATE_ONLY device link's status to not get updated.
> Since SYNC_STATE_ONLY device link is no longer useful once the
> consumer probes, commit 21c27f06587d ("driver core: Fix
> SYNC_STATE_ONLY device link implementation") addresses the status
> update issue by deleting the SYNC_STATE_ONLY device link instead of
> complicating the status update code.
>
> However, there are still some cases where we need to update the status
> of a SYNC_STATE_ONLY device link.  A SYNC_STATE_ONLY device link can
> later get converted into a normal MANAGED device link when a normal
> MANAGED device link is created between a supplier and consumer that
> already have a SYNC_STATE_ONLY device link between them. If a
> SYNC_STATE_ONLY device link's status isn't maintained correctly till
> it's converted to a normal MANAGED device link, then the normal
> MANAGED device link will end up with a wrong link status. This can
> cause a warning stack trace[1] when the consumer device probes.
>
> This commit fixes the SYNC_STATE_ONLY device link status update issue
> where it wouldn't transition correctly from DL_STATE_AVAILABLE to
> DL_STATE_CONSUMER_PROBE.
>
> [1] - https://lore.kernel.org/lkml/20200522204120.3b3c9ed6@apollo/
> Fixes: 05ef983e0d65 ("driver core: Add device link support for SYNC_STATE_ONLY flag")
> Fixes: 21c27f06587d ("driver core: Fix SYNC_STATE_ONLY device link implementation")
> Reported-by: Michael Walle <michael@walle.cc>
> Signed-off-by: Saravana Kannan <saravanak@google.com>

Tentatively

Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

->

> ---
> Greg,
>
> I think this is the issue Michael ran into. I'd like him to test the fix
> before it's pulled in.
>
> Michael,
>
> If you can test this on the branch you saw the issue in and give a
> Tested-by if it works, that'd be great.

-> provided that the patch works.

Thanks!

>  drivers/base/core.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 791b7530599f..9511be3f9a32 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -687,11 +687,11 @@ int device_links_check_suppliers(struct device *dev)
>         device_links_write_lock();
>
>         list_for_each_entry(link, &dev->links.suppliers, c_node) {
> -               if (!(link->flags & DL_FLAG_MANAGED) ||
> -                   link->flags & DL_FLAG_SYNC_STATE_ONLY)
> +               if (!(link->flags & DL_FLAG_MANAGED))
>                         continue;
>
> -               if (link->status != DL_STATE_AVAILABLE) {
> +               if (link->status != DL_STATE_AVAILABLE &&
> +                   !(link->flags & DL_FLAG_SYNC_STATE_ONLY)) {
>                         device_links_missing_supplier(dev);
>                         ret = -EPROBE_DEFER;
>                         break;
> --
> 2.27.0.rc0.183.gde8f92d652-goog
>

  parent reply	other threads:[~2020-05-26  8:28 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-16  8:07 [PATCH v1] driver core: Fix memory leak when adding SYNC_STATE_ONLY device links Saravana Kannan
2020-05-18  7:48 ` Saravana Kannan
2020-05-18  8:03   ` Greg Kroah-Hartman
2020-05-18 19:47     ` Saravana Kannan
2020-05-19  3:00     ` [PATCH v2] driver core: Fix SYNC_STATE_ONLY device link implementation Saravana Kannan
2020-05-19  5:48       ` Greg Kroah-Hartman
2020-05-19  6:30     ` [PATCH v3] " Saravana Kannan
2020-05-19 10:47       ` Rafael J. Wysocki
2020-05-22 18:41       ` Michael Walle
2020-05-22 22:21         ` Saravana Kannan
2020-05-22 22:47           ` Michael Walle
2020-05-25 11:31             ` Michael Walle
2020-05-25 18:39               ` Saravana Kannan
2020-05-25 19:04                 ` Michael Walle
2020-05-25 21:24                   ` Saravana Kannan
2020-05-25 21:38                     ` Michael Walle
2020-05-26  7:05                       ` [PATCH v1] driver core: Update device link status correctly for SYNC_STATE_ONLY links Saravana Kannan
2020-05-26  7:07                         ` Saravana Kannan
2020-05-26 11:04                           ` Michael Walle
2020-05-26 18:08                             ` Saravana Kannan
2020-05-26  8:28                         ` Rafael J. Wysocki [this message]
2020-05-26 19:43                       ` [PATCH v2] " Saravana Kannan
2020-05-26 21:13                         ` Michael Walle
2020-05-26 21:45                           ` Saravana Kannan
2020-05-26 21:53                             ` Michael Walle
2020-05-26 22:00                               ` Saravana Kannan
2020-05-26 22:09                       ` [PATCH v3] " Saravana Kannan
2020-05-27  8:26                         ` Rafael J. Wysocki
2020-05-28 16:09                           ` 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=CAJZ5v0i9yyvf0JAAUfj1DiFPgHHUdXkE3T6fWSxFEB1Mo_fx3Q@mail.gmail.com \
    --to=rafael@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael@walle.cc \
    --cc=rafael.j.wysocki@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.