linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Bara <bbara93@gmail.com>
To: dmitry.osipenko@collabora.com
Cc: bbara93@gmail.com, benjamin.bara@skidata.com, broonie@kernel.org,
	jneanne@baylibre.com, jonathanh@nvidia.com, lee@kernel.org,
	lgirdwood@gmail.com, linux-kernel@vger.kernel.org,
	linux-omap@vger.kernel.org, linux-tegra@vger.kernel.org,
	peng.fan@oss.nxp.com, rafael.j.wysocki@intel.com,
	thierry.reding@gmail.com, tony@atomide.com, treding@nvidia.com
Subject: Re: [PATCH v2 3/6] soc/tegra: pmc: Specify restart mode
Date: Thu, 17 Aug 2023 10:48:12 +0200	[thread overview]
Message-ID: <20230817084812.323742-1-bbara93@gmail.com> (raw)
In-Reply-To: <76da3727-a4da-ac70-aa8e-b362b9114061@collabora.com>

Hi Dmitry,

thanks for your feedback!

On Tue, 15 Aug 2023 at 00:38, Dmitry Osipenko <dmitry.osipenko@collabora.com> wrote:
> On 8/9/23 22:24, Benjamin Bara wrote:
> > From: Benjamin Bara <benjamin.bara@skidata.com>
> >
> > The current restart handler registration does not specify whether the
> > restart is a cold or a warm one. Now, as do_kernel_restart() knows about
> > the type, the priorization is implicitly done (cold restarts are
> > executed first) and the reboot_mode kernel parameter (which is currently
> > mostly ignored) can be respected.
> >
> > Acked-by: Thierry Reding <treding@nvidia.com>
> > Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
> > ---
> > v2:
> > - improve commit message
> > ---
> >  drivers/soc/tegra/pmc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
> > index 162f52456f65..4f42febb9b0f 100644
> > --- a/drivers/soc/tegra/pmc.c
> > +++ b/drivers/soc/tegra/pmc.c
> > @@ -2962,7 +2962,7 @@ static int tegra_pmc_probe(struct platform_device *pdev)
> >       }
> > 
> >       err = devm_register_sys_off_handler(&pdev->dev,
> > -                                         SYS_OFF_MODE_RESTART,
> > +                                         SYS_OFF_MODE_RESTART_WARM,
> >                                           SYS_OFF_PRIO_LOW,
> >                                           tegra_pmc_restart_handler, NULL);
> >       if (err) {
> >
>
> You have tegra-pmc restart handler that uses low priority. And then
> you're adding cold/warm handlers to tps65219 and pca9450 drivers with a
> default priorities. 

Exactly, but I guess it makes sense to also use the handler with default
priority for the pmc reboot. The reason I kept it low prio was because
there is a comment that PMC should be last resort, but the reason
applies to any other soft restart handler too. I will adapt in the next
version.

> Hence this cold/warm separation of handlers doesn't do any practical
> difference in yours case because tegra-pmc will never be used as it
> did before your changes?

The change is e.g. relevant for platforms without PMIC-based soft reset,
e.g. when the tps6586x is in use. AFAIK, there is no possibility to
actually do a soft reboot, as the hard reboot will always be executed
first. This also happens if I set the kernel parameter "reboot_mode"
(also available via SysFS) to "soft" and a soft restart handler is
registered.

> Previously you wanted to make tps6586x driver to skip the warm reboot,
> but you're not touching tps6586x in this patchset.

True, there might also be other affected patches which are currently not
in linux-next yet. Will adapt the tps6586x too and depend on the whole
series in the next version.

> There is no real problem that is solved by these patches?

I think another problem is if the user sets the "reboot_mode" to "cold",
but there is no cold handler registered (as it was the case for me with
the pca9450), a warning should indicate that. AFAIK, there is no
possibility in user-space to find out if a cold restart handler is
registered, there is just this knob which can be switched to "cold". I
can also add a SysFS entry with "supported_modes" and check if the new
"mode" is supported on a store.

My other idea was to add a flags field to the notifier_block which
indicates (in case of a reboot notifier) the supported reboot_modes of
the registered handler, but I guess other notifier_block users won't
really benefit from an additional field, therefore I decided to add a
second list instead.

Best regards
Benjamin

  reply	other threads:[~2023-08-17  8:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-09 19:24 [PATCH v2 0/6] regulator: pca9450: register restart handlers Benjamin Bara
2023-08-09 19:24 ` [PATCH v2 1/6] kernel/reboot: distinguish between cold and warm Benjamin Bara
2023-08-09 19:24 ` [PATCH v2 2/6] mfd: rk8xx: Specify restart mode Benjamin Bara
2023-08-18 16:06   ` Lee Jones
2023-08-09 19:24 ` [PATCH v2 3/6] soc/tegra: pmc: " Benjamin Bara
2023-08-14 22:38   ` Dmitry Osipenko
2023-08-17  8:48     ` Benjamin Bara [this message]
2023-08-09 19:24 ` [PATCH v2 4/6] mfd: tps65219: " Benjamin Bara
2023-08-18 16:10   ` Lee Jones
2023-08-09 19:24 ` [PATCH v2 5/6] kernel/reboot: remove generic " Benjamin Bara
2023-08-09 19:24 ` [PATCH v2 6/6] regulator: pca9450: register restart handlers Benjamin Bara
2023-08-18 16:12 ` [PATCH v2 0/6] " Lee Jones

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=20230817084812.323742-1-bbara93@gmail.com \
    --to=bbara93@gmail.com \
    --cc=benjamin.bara@skidata.com \
    --cc=broonie@kernel.org \
    --cc=dmitry.osipenko@collabora.com \
    --cc=jneanne@baylibre.com \
    --cc=jonathanh@nvidia.com \
    --cc=lee@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=peng.fan@oss.nxp.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=thierry.reding@gmail.com \
    --cc=tony@atomide.com \
    --cc=treding@nvidia.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).