linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Amit Daniel Kachhap <amit.daniel@samsung.com>
Cc: "linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	Catalin Marinas <Catalin.Marinas@arm.com>,
	Mark Rutland <Mark.Rutland@arm.com>,
	Ashwin Chaugule <ashwin.chaugule@linaro.org>,
	Vladimir Murzin <Vladimir.Murzin@arm.com>
Subject: Re: [PATCH 1/3] arm64: psci: warn if psci_power_state variable is not initialised
Date: Thu, 30 Oct 2014 10:29:48 +0000	[thread overview]
Message-ID: <20141030102948.GB17843@red-moon> (raw)
In-Reply-To: <1414641338-25279-1-git-send-email-amit.daniel@samsung.com>

On Thu, Oct 30, 2014 at 03:55:36AM +0000, Amit Daniel Kachhap wrote:
> Without this cpu_suspend may cause crash dump when psci cpuidle
> is not initialised and cpu_suspend is called.
> 
> Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
> ---
>  arch/arm64/kernel/psci.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c
> index 866c1c8..2178d6e 100644
> --- a/arch/arm64/kernel/psci.c
> +++ b/arch/arm64/kernel/psci.c
> @@ -523,9 +523,11 @@ static int __maybe_unused cpu_psci_cpu_suspend(unsigned long index)
>  	struct psci_power_state *state = __get_cpu_var(psci_power_state);
>  	/*
>  	 * idle state index 0 corresponds to wfi, should never be called
> -	 * from the cpu_suspend operations
> +	 * from the cpu_suspend operations.
> +	 * Also psci_power_state variable should have been populated by
> +	 * above init idle routine.
>  	 */
> -	if (WARN_ON_ONCE(!index))
> +	if (WARN_ON_ONCE(!index || !state))
>  		return -EINVAL;

I thought about this when developing the code, at the moment this can't
happen so I did not add any check for that. I would wait for the dust
to settle on the API usage (and if we need it for something different
than idle) before adding checks that might turn out useless, so we will
keep this patch on the back-burner for now.

Thanks,
Lorenzo

  parent reply	other threads:[~2014-10-30 10:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-30  3:55 [PATCH 1/3] arm64: psci: warn if psci_power_state variable is not initialised Amit Daniel Kachhap
2014-10-30  3:55 ` [PATCH 2/3] arm64: psci: fix cpu_suspend to check idle state type for index Amit Daniel Kachhap
2014-10-30 10:19   ` Lorenzo Pieralisi
2014-10-30 11:31     ` amit daniel kachhap
2014-10-30  3:55 ` [PATCH 3/3] arm64: psci: Add support to call cpu_suspend with deepest C state Amit Daniel Kachhap
2014-10-30 10:46   ` Lorenzo Pieralisi
2014-10-30 11:22     ` amit daniel kachhap
2014-12-01  8:08     ` amit daniel kachhap
2014-12-15 18:34       ` Lorenzo Pieralisi
2014-10-30 10:29 ` Lorenzo Pieralisi [this message]
2014-10-30 11:35   ` [PATCH 1/3] arm64: psci: warn if psci_power_state variable is not initialised Amit Kachhap

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=20141030102948.GB17843@red-moon \
    --to=lorenzo.pieralisi@arm.com \
    --cc=Catalin.Marinas@arm.com \
    --cc=Mark.Rutland@arm.com \
    --cc=Vladimir.Murzin@arm.com \
    --cc=amit.daniel@samsung.com \
    --cc=ashwin.chaugule@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).