All of lore.kernel.org
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v9 00/14] arm64: kernel: Add support for hibernate/suspend-to-disk
Date: Thu, 28 Apr 2016 19:37:02 +0100	[thread overview]
Message-ID: <20160428183702.GI30834@arm.com> (raw)
In-Reply-To: <572248E0.6050009@arm.com>

On Thu, Apr 28, 2016 at 06:31:12PM +0100, James Morse wrote:
> On 28/04/16 13:40, Will Deacon wrote:
> > On Wed, Apr 27, 2016 at 05:46:59PM +0100, James Morse wrote:
> >> This is the today's version of hibernate for arm64, based on arm64's
> >> for-next/core with latest commit 6a1f54711447 ("arm64: acpi: add acpi=on
> >> cmdline option to prefer ACPI boot over DT").
> > 
> > I've queued this locally, but it breaks an allmodconfig build:
> 
> ... I should have tested that ...
> 
> 
> > kernel/built-in.o: In function `saveable_page':
> > memremap.c:(.text+0x100f90): undefined reference to `kernel_page_present'
> > kernel/built-in.o: In function `swsusp_save':
> > memremap.c:(.text+0x1026f0): undefined reference to `kernel_page_present'
> > make: *** [vmlinux] Error 1
> > 
> > Can you take a look, please?
> 
> This is caused by DEBUG_PAGEALLOC, which clears the PTE_VALID bit from 'free'
> pages. Hibernate uses it as a hint that it shouldn't save/access that page. This
> function is used to test whether the PTE_VALID bit has been cleared by
> kernel_map_pages(), hibernate is the only user.
> 
> Fixing this exposes a bigger problem with that configuration though: if the
> resume kernel has cut free pages out of the linear map, we copy this
> swiss-cheese view of memory, and try to use it to restore...
> 
> We can fixup the copy of the linear map, but it then explodes in my lazy 'clean
> the whole kernel to PoC' after resume, as now both the kernel and linear map
> have holes in them.
> 
> For now I think forbidding this configuration is best. ARCH_HIBERNATION_POSSIBLE
> depends on !DEBUG_PAGEALLOC would be best, but we can't do that, as
> DEBUG_PAGEALLOC has:
> > depends on !HIBERNATION || ARCH_SUPPORTS_DEBUG_PAGEALLOC && !PPC && !SPARC
> which causes kconfig to winge about loops in its dependencies.

That dependency looks really fishy. It's saying that, if we disable
HIBERNATION, then DEBUG_PAGEALLOC will work regardless of
ARCH_SUPPORTS_DEBUGALLOC.

So I tried disabling ARCH_SUPPORTS_DEBUGALLOC for arm64 and removing our
definition of __kernel_map_pages from arch/arm64/mm/pageattr.c and...

... it bloody linked.

Turns out mm/page_poison.c has this gem:

#ifndef CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC
void __kernel_map_pages(struct page *page, int numpages, int enable)
{
	/* This function does nothing, all work is done via poison pages */
}
#endif

and DEBUG_PAGEALLOC selects PAGE_POISONING if
!ARCH_SUPPORTS_DEBUG_PAGEALLOC. Maybe somebody understands all of this
crazy config indirection but, for the time being, I'm happy to take your
patch.

We should probably look at making this all work with the debug options
for 4.8, however.

Will

> -----------------------%<-----------------------
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index b87f303765d4..0a7ff709a851 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -579,6 +579,7 @@ source kernel/Kconfig.hz
> 
>  config ARCH_SUPPORTS_DEBUG_PAGEALLOC
>         def_bool y
> +       depends on !HIBERNATION
> 
>  config ARCH_HAS_HOLES_MEMORYMODEL
>         def_bool y if SPARSEMEM
> -----------------------%<-----------------------
> 
> 
> Thanks,
> 
> James
> 

  reply	other threads:[~2016-04-28 18:37 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-27 16:46 [PATCH v9 00/14] arm64: kernel: Add support for hibernate/suspend-to-disk James Morse
2016-04-27 16:47 ` [PATCH v9 01/14] arm64: Fold proc-macros.S into assembler.h James Morse
2016-04-27 16:47 ` [PATCH v9 02/14] arm64: Cleanup SCTLR flags James Morse
2016-04-27 16:47 ` [PATCH v9 03/14] arm64: kvm: Move lr save/restore from do_el2_call into EL1 James Morse
2016-04-27 16:47 ` [PATCH v9 04/14] arm64: hyp/kvm: Make hyp-stub extensible James Morse
2016-04-27 16:47 ` [PATCH v9 05/14] arm64: hyp/kvm: Make hyp-stub reject kvm_call_hyp() James Morse
2016-04-27 16:47 ` [PATCH v9 06/14] arm64: kvm: allows kvm cpu hotplug James Morse
2016-04-27 16:47 ` [PATCH v9 07/14] arm64: kernel: Rework finisher callback out of __cpu_suspend_enter() James Morse
2016-04-27 16:47 ` [PATCH v9 08/14] arm64: Change cpu_resume() to enable mmu early then access sleep_sp by va James Morse
2016-04-27 16:47 ` [PATCH v9 09/14] arm64: kernel: Include _AC definition in page.h James Morse
2016-04-27 16:47 ` [PATCH v9 10/14] arm64: Promote KERNEL_START/KERNEL_END definitions to a header file James Morse
2016-04-27 16:47 ` [PATCH v9 11/14] arm64: Add new asm macro copy_page James Morse
2016-04-27 16:47 ` [PATCH v9 12/14] PM / Hibernate: Call flush_icache_range() on pages restored in-place James Morse
2016-04-28 12:15   ` Will Deacon
2016-04-28 12:23     ` James Morse
2016-04-28 12:27       ` Will Deacon
2016-04-27 16:47 ` [PATCH v9 13/14] arm64: kernel: Add support for hibernate/suspend-to-disk James Morse
2016-04-28  9:26   ` Catalin Marinas
2016-04-27 16:47 ` [PATCH v9 14/14] arm64: hibernate: Refuse to hibernate if the boot cpu is offline James Morse
2016-04-28 12:40 ` [PATCH v9 00/14] arm64: kernel: Add support for hibernate/suspend-to-disk Will Deacon
2016-04-28 17:31   ` James Morse
2016-04-28 18:37     ` Will Deacon [this message]
2016-04-29 17:27 ` [PATCH] arm64: kvm: Fix kvm teardown for systems using the extended idmap James Morse
2016-05-02 12:05   ` Marc Zyngier
2016-05-03  8:36     ` Christoffer Dall
2016-05-03  8:41       ` Marc Zyngier
2016-05-03  8:57         ` Will Deacon

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=20160428183702.GI30834@arm.com \
    --to=will.deacon@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 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.