public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Abel Vesa <abel.vesa@linaro.org>
To: Saravana Kannan <saravanak@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	linux-arm-msm@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC v2] driver core: Fix repeated device_is_dependent check for same link
Date: Thu, 7 Jul 2022 13:41:57 +0300	[thread overview]
Message-ID: <Ysa4dUhSbgz+VDIf@linaro.org> (raw)
In-Reply-To: <CAGETcx_MV8QsAFC_ztY6CjysshxPSZZ2ZbgpyXhSpH1v2knhzA@mail.gmail.com>

On 22-07-06 21:51:34, Saravana Kannan wrote:
> On Wed, Jul 6, 2022 at 8:54 AM Abel Vesa <abel.vesa@linaro.org> wrote:
> >
> > In case of a cyclic dependency, if the supplier is not yet available,
> > the parent of the supplier is checked for dependency. But if there are
> > more than one suppliers with the same parent, the first check returns
> > true while the next ones skip that specific link entirely because of
> > having DL_FLAG_MANAGED and DL_FLAG_SYNC_STATE_ONLY set, which is what
> > the relaxing of the link does. But if we check for the target being
> > a consumer before the check for those flags, we can check as many
> > times as needed the same link and it will always return true, This is
> > safe to do, since the relaxing of the link will be done only once
> > because those flags will be set and it will bail early.
> >
> > Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
> > ---
> >  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 753e7cca0f40..2c3b860dfe80 100644
> > --- a/drivers/base/core.c
> > +++ b/drivers/base/core.c
> > @@ -297,13 +297,13 @@ int device_is_dependent(struct device *dev, void *target)
> >                 return ret;
> >
> >         list_for_each_entry(link, &dev->links.consumers, s_node) {
> > +               if (link->consumer == target)
> > +                       return 1;
> > +
> >                 if ((link->flags & ~DL_FLAG_INFERRED) ==
> >                     (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED))
> >                         continue;
>
> Thanks for trying to fix this issue, but I'll have to Nack this patch.
>
> The whole point of the SYNC_STATE_ONLY flag is to allow cycles. It's
> needed to maintain correctness of sync_state(). I think I described
> those in the commit text that added the SYNC_STATE_ONLY flag. Check it
> out if you are interested. So this change of yours will break
> sync_state() functionality.
>

Fair enough.

> There's a bunch of nuance to fixing the dual cycle issue and I don't
> mind fixing this myself in a week or two if you can wait.
>

Please cc me on it.

> Thanks,
> Saravana
>
> >
> > -               if (link->consumer == target)
> > -                       return 1;
> > -
> >                 ret = device_is_dependent(link->consumer, target);
> >                 if (ret)
> >                         break;
> > --
> > 2.34.3
> >

      reply	other threads:[~2022-07-07 10:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-06 15:53 [RFC v2] driver core: Fix repeated device_is_dependent check for same link Abel Vesa
2022-07-06 15:56 ` Greg Kroah-Hartman
2022-07-07  4:51 ` Saravana Kannan
2022-07-07 10:41   ` Abel Vesa [this message]

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=Ysa4dUhSbgz+VDIf@linaro.org \
    --to=abel.vesa@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --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