All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saravana Kannan <saravanak@google.com>
To: swboyd@chromium.org
Cc: daniel@ffwll.ch, dri-devel@lists.freedesktop.org,
	gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	rafael@kernel.org, rmk+kernel@arm.linux.org.uk,
	robdclark@gmail.com, Saravana Kannan <saravanak@google.com>,
	kernel-team@android.com
Subject: Re: [PATCH] component: Move host device to end of device lists on binding
Date: Tue, 11 May 2021 12:12:58 -0700	[thread overview]
Message-ID: <20210511191259.1139635-1-saravanak@google.com> (raw)
In-Reply-To: <CAE-0n53AcL807G3WLp7phQUNN6umuwUikiz_5bNfcHdRbThu=Q@mail.gmail.com>

Quoting Stephen Boyd <swboyd@chromium.org>:
> Quoting Daniel Vetter (2021-05-11 06:39:36)
> > On Tue, May 11, 2021 at 12:52 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
> > >
> > > On Mon, May 10, 2021 at 9:08 PM Stephen Boyd <swboyd@chromium.org> wrote:
> > >
> > > [cut]
> > >
> > > >
> > > > >
> > > > > > I will try it, but then I wonder about things like system wide
> > > > > > suspend/resume too. The drm encoder chain would need to reimplement the
> > > > > > logic for system wide suspend/resume so that any PM ops attached to the
> > > > > > msm device run in the correct order. Right now the bridge PM ops will
> > > > > > run, the i2c bus PM ops will run, and then the msm PM ops will run.
> > > > > > After this change, the msm PM ops will run, the bridge PM ops will run,
> > > > > > and then the i2c bus PM ops will run. It feels like that could be a
> > > > > > problem if we're suspending the DSI encoder while the bridge is still
> > > > > > active.
> > > > >
> > > > > Yup suspend/resume has the exact same problem as shutdown.
> > > >
> > > > I think suspend/resume has the exact opposite problem. At least I think
> > > > the correct order is to suspend the bridge, then the encoder, i.e. DSI,
> > > > like is happening today. It looks like drm_atomic_helper_shutdown()
> > > > operates from the top down when we want bottom up? I admit I have no
> > > > idea what is supposed to happen here.
> > >
> > > Why would the system-wide suspend ordering be different from the
> > > shutdown ordering?
> >
> > At least my point was that both shutdown and suspend/resume have the
> > same problem, and the righ fix is (I think at least) to add these
> > hooks to the component.c aggregate ops structure. Hence just adding
> > new callbacks for shutdown will be an incomplete solution.
> 
> To add proper hooks to component.c we'll need to make the aggregate
> device into a 'struct device' and make a bus for them that essentially
> adds the aggregate device to the bus once all the components are
> registered. The bind/unbind can be ported to probe/remove, and then the
> aggregate driver can get PM ops that run before the component devices
> run their PM ops.
> 
> Let me go try it out and see if I can make it minimally invasive so that
> the migration path is simple.

Yes, please! This is the right solution. We should put all these aggregate
devices in some "aggregate" bus (needs a better name) and NOT a drm bus because
AFAICT components are not specific to the drm framework.

You can also create device links (without the STATELESS flag, and a bunch of
other flags) from the aggregate device to all the component devices and this
will automatically fix all the ordering issues too.

I'd be happy to help with this if you want and happy to review this too. Please
Cc me when you send out this series.

-Saravana

> 
> >
> > I don't feel like changing the global device order is the right
> > approach, since essentially that's what component was meant to fix.
> > Except it's incomplete since it only provides a solution for
> > bind/unbind and not for shutdown or suspend/resume as other global
> > state changes. I think some drivers "fixed" this by putting stuff like
> > drm_atomic_helper_shutdown/suspend/resume into early/late hooks, to
> > make sure that everything is ready with that trick. But that doesn't
> > compose very well :-/
> 
> Yeah it looks like msm is using prepare/complete for this so that it can
> jump in early and suspend the display pipeline before the components
> suspend themselves. The shutdown path only has one callback so we can't
> play the same games.

WARNING: multiple messages have this Message-ID (diff)
From: Saravana Kannan <saravanak@google.com>
To: swboyd@chromium.org
Cc: Saravana Kannan <saravanak@google.com>,
	rafael@kernel.org, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	rmk+kernel@arm.linux.org.uk, kernel-team@android.com
Subject: Re: [PATCH] component: Move host device to end of device lists on binding
Date: Tue, 11 May 2021 12:12:58 -0700	[thread overview]
Message-ID: <20210511191259.1139635-1-saravanak@google.com> (raw)
In-Reply-To: <CAE-0n53AcL807G3WLp7phQUNN6umuwUikiz_5bNfcHdRbThu=Q@mail.gmail.com>

Quoting Stephen Boyd <swboyd@chromium.org>:
> Quoting Daniel Vetter (2021-05-11 06:39:36)
> > On Tue, May 11, 2021 at 12:52 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
> > >
> > > On Mon, May 10, 2021 at 9:08 PM Stephen Boyd <swboyd@chromium.org> wrote:
> > >
> > > [cut]
> > >
> > > >
> > > > >
> > > > > > I will try it, but then I wonder about things like system wide
> > > > > > suspend/resume too. The drm encoder chain would need to reimplement the
> > > > > > logic for system wide suspend/resume so that any PM ops attached to the
> > > > > > msm device run in the correct order. Right now the bridge PM ops will
> > > > > > run, the i2c bus PM ops will run, and then the msm PM ops will run.
> > > > > > After this change, the msm PM ops will run, the bridge PM ops will run,
> > > > > > and then the i2c bus PM ops will run. It feels like that could be a
> > > > > > problem if we're suspending the DSI encoder while the bridge is still
> > > > > > active.
> > > > >
> > > > > Yup suspend/resume has the exact same problem as shutdown.
> > > >
> > > > I think suspend/resume has the exact opposite problem. At least I think
> > > > the correct order is to suspend the bridge, then the encoder, i.e. DSI,
> > > > like is happening today. It looks like drm_atomic_helper_shutdown()
> > > > operates from the top down when we want bottom up? I admit I have no
> > > > idea what is supposed to happen here.
> > >
> > > Why would the system-wide suspend ordering be different from the
> > > shutdown ordering?
> >
> > At least my point was that both shutdown and suspend/resume have the
> > same problem, and the righ fix is (I think at least) to add these
> > hooks to the component.c aggregate ops structure. Hence just adding
> > new callbacks for shutdown will be an incomplete solution.
> 
> To add proper hooks to component.c we'll need to make the aggregate
> device into a 'struct device' and make a bus for them that essentially
> adds the aggregate device to the bus once all the components are
> registered. The bind/unbind can be ported to probe/remove, and then the
> aggregate driver can get PM ops that run before the component devices
> run their PM ops.
> 
> Let me go try it out and see if I can make it minimally invasive so that
> the migration path is simple.

Yes, please! This is the right solution. We should put all these aggregate
devices in some "aggregate" bus (needs a better name) and NOT a drm bus because
AFAICT components are not specific to the drm framework.

You can also create device links (without the STATELESS flag, and a bunch of
other flags) from the aggregate device to all the component devices and this
will automatically fix all the ordering issues too.

I'd be happy to help with this if you want and happy to review this too. Please
Cc me when you send out this series.

-Saravana

> 
> >
> > I don't feel like changing the global device order is the right
> > approach, since essentially that's what component was meant to fix.
> > Except it's incomplete since it only provides a solution for
> > bind/unbind and not for shutdown or suspend/resume as other global
> > state changes. I think some drivers "fixed" this by putting stuff like
> > drm_atomic_helper_shutdown/suspend/resume into early/late hooks, to
> > make sure that everything is ready with that trick. But that doesn't
> > compose very well :-/
> 
> Yeah it looks like msm is using prepare/complete for this so that it can
> jump in early and suspend the display pipeline before the components
> suspend themselves. The shutdown path only has one callback so we can't
> play the same games.

  parent reply	other threads:[~2021-05-11 19:13 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-08  7:41 [PATCH] component: Move host device to end of device lists on binding Stephen Boyd
2021-05-08  7:41 ` Stephen Boyd
2021-05-10 11:59 ` Rafael J. Wysocki
2021-05-10 11:59   ` Rafael J. Wysocki
2021-05-11 17:59   ` Saravana Kannan
2021-05-11 17:59     ` Saravana Kannan
2021-05-10 16:05 ` Daniel Vetter
2021-05-10 16:05   ` Daniel Vetter
2021-05-10 17:52   ` Stephen Boyd
2021-05-10 17:52     ` Stephen Boyd
2021-05-10 18:26     ` Daniel Vetter
2021-05-10 18:26       ` Daniel Vetter
2021-05-10 19:08       ` Stephen Boyd
2021-05-10 19:08         ` Stephen Boyd
2021-05-11 10:52         ` Rafael J. Wysocki
2021-05-11 10:52           ` Rafael J. Wysocki
2021-05-11 13:39           ` Daniel Vetter
2021-05-11 13:39             ` Daniel Vetter
2021-05-11 17:19             ` Stephen Boyd
2021-05-11 17:19               ` Stephen Boyd
2021-05-11 17:25               ` Daniel Vetter
2021-05-11 17:25                 ` Daniel Vetter
2021-05-11 19:12               ` Saravana Kannan [this message]
2021-05-11 19:12                 ` Saravana Kannan
2021-05-11 17:00           ` Stephen Boyd
2021-05-11 17:00             ` Stephen Boyd
2021-05-11 17:20             ` Rafael J. Wysocki
2021-05-11 17:20               ` Rafael J. Wysocki
2021-05-13 13:40   ` Russell King - ARM Linux admin
2021-05-13 13:40     ` Russell King - ARM Linux admin
2021-05-11 14:42 ` Russell King - ARM Linux admin
2021-05-11 14:42   ` Russell King - ARM Linux admin
2021-05-11 17:22   ` Stephen Boyd
2021-05-11 17:22     ` Stephen Boyd

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=20210511191259.1139635-1-saravanak@google.com \
    --to=saravanak@google.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=robdclark@gmail.com \
    --cc=swboyd@chromium.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 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.