public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/2] arm64: hibernate: Don't hibernate on systems with stuck CPUs
Date: Wed, 22 Jun 2016 11:02:54 +0100	[thread overview]
Message-ID: <20160622100253.GB25837@leverpostej> (raw)
In-Reply-To: <1466586373-11836-3-git-send-email-james.morse@arm.com>

On Wed, Jun 22, 2016 at 10:06:13AM +0100, James Morse wrote:
> Hibernate relies on cpu hotplug to prevent secondary cores executing
> the kernel text while it is being restored.
> 
> Add a call to cpus_are_stuck_in_kernel() to determine if there are
> CPUs not counted by 'num_online_cpus()', and prevent hibernate in this
> case.
> 
> Fixes: 82869ac57b5 ("arm64: kernel: Add support for hibernate/suspend-to-disk")
> Signed-off-by: James Morse <james.morse@arm.com>

Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.

> ---
>  arch/arm64/kernel/hibernate.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c
> index f8df75d740f4..21ab5df9fa76 100644
> --- a/arch/arm64/kernel/hibernate.c
> +++ b/arch/arm64/kernel/hibernate.c
> @@ -33,6 +33,7 @@
>  #include <asm/pgtable.h>
>  #include <asm/pgtable-hwdef.h>
>  #include <asm/sections.h>
> +#include <asm/smp.h>
>  #include <asm/suspend.h>
>  #include <asm/virt.h>
>  
> @@ -236,6 +237,11 @@ int swsusp_arch_suspend(void)
>  	unsigned long flags;
>  	struct sleep_stack_data state;
>  
> +	if (cpus_are_stuck_in_kernel()) {
> +		pr_err("Can't hibernate: no mechanism to offline secondary CPUs.\n");
> +		return -EBUSY;
> +	}
> +
>  	local_dbg_save(flags);
>  
>  	if (__cpu_suspend_enter(&state)) {
> -- 
> 2.8.0.rc3
> 

      reply	other threads:[~2016-06-22 10:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-22  9:06 [PATCH v2 0/2] Fix hibernate on SMP spin-table systems James Morse
2016-06-22  9:06 ` [PATCH v2 1/2] arm64: smp: Add function to determine if cpus are stuck in the kernel James Morse
2016-06-22  9:06 ` [PATCH v2 2/2] arm64: hibernate: Don't hibernate on systems with stuck CPUs James Morse
2016-06-22 10:02   ` Mark Rutland [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=20160622100253.GB25837@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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