Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dhruva Gole <d-gole@ti.com>
To: "Maulik Shah (mkshah)" <quic_mkshah@quicinc.com>
Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>, <andersson@kernel.org>,
	<ulf.hansson@linaro.org>, <linux-arm-msm@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-pm@vger.kernel.org>, <quic_lsrao@quicinc.com>,
	<stable@vger.kernel.org>
Subject: Re: [PATCH] firmware/psci: Move psci_init_system_suspend() to late_initcall()
Date: Fri, 23 Feb 2024 14:34:10 +0530	[thread overview]
Message-ID: <20240223090410.mgsu47wqinw33wep@dhruva> (raw)
In-Reply-To: <dc16acc1-6ad1-4a81-8eeb-aadaf837ff2c@quicinc.com>

On Feb 20, 2024 at 11:18:39 +0530, Maulik Shah (mkshah) wrote:
> 
> 
> On 2/19/2024 10:59 PM, Lorenzo Pieralisi wrote:
> > On Mon, Feb 19, 2024 at 03:02:04PM +0530, Maulik Shah wrote:
> > > psci_init_system_suspend() invokes suspend_set_ops() very early during
> > > bootup even before kernel command line for mem_sleep_default is setup.
> > > This leads to kernel command line mem_sleep_default=s2idle not working
> > > as mem_sleep_current gets changed to deep via suspend_set_ops() and never
> > > changes back to s2idle.
> > > 
> > > Move psci_init_system_suspend() to late_initcall() to make sure kernel
> > > command line mem_sleep_default=s2idle sets up s2idle as default suspend
> > > mode.
> > 
> > Why can't we fix it the other way around, namely enforce
> > mem_sleep_current according to the mem_sleep_default command line
> > even if suspend_set_ops() was already called ?
> 
> yes, this may be fixed other way also and i did not implement other way
> since mem_sleep_default_setup() only update mem_sleep_default and to avoid
> this race, it needs to also need to update mem_sleep_current along
> with it. Below change also resolves the issue.
> 
> --- a/kernel/power/suspend.c
> +++ b/kernel/power/suspend.c
> @@ -192,6 +192,7 @@ static int __init mem_sleep_default_setup(char *str)
>                 if (mem_sleep_labels[state] &&
>                     !strcmp(str, mem_sleep_labels[state])) {
>                         mem_sleep_default = state;
> +                       mem_sleep_current = state;
>                         break;
>                 }
> 
> however it may be erasing thin line between mem_sleep_default v/s
> mem_sleep_current as both gets updated while set up of mem_sleep_default.
> 
> if this change looks Ok, i can send v2 with it.

Honestly, I don't see too much of a problem with this, it only makes
sense that we're starting off with a default sleep state which means
that it will be considered as "current" sleep state.

For the issue that you described originally, I think this is a fine
solution.

> 
> > 
> > Just asking, I am not super keen on using initcalls ordering, it
> > looks fragile to me.
> 
> i agree with above.

Same.


-- 
Best regards,
Dhruva Gole <d-gole@ti.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2024-02-23  9:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19  9:32 [PATCH] firmware/psci: Move psci_init_system_suspend() to late_initcall() Maulik Shah
2024-02-19 17:29 ` Lorenzo Pieralisi
2024-02-20  5:48   ` Maulik Shah (mkshah)
2024-02-23  9:04     ` Dhruva Gole [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=20240223090410.mgsu47wqinw33wep@dhruva \
    --to=d-gole@ti.com \
    --cc=andersson@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=quic_lsrao@quicinc.com \
    --cc=quic_mkshah@quicinc.com \
    --cc=stable@vger.kernel.org \
    --cc=ulf.hansson@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox