From patchwork Thu Apr 28 17:31:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Morse X-Patchwork-Id: 8973921 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 848C99F1D3 for ; Thu, 28 Apr 2016 17:34:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AAF32202DD for ; Thu, 28 Apr 2016 17:34:52 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D6579202E5 for ; Thu, 28 Apr 2016 17:34:51 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1avpoX-0001Th-IS; Thu, 28 Apr 2016 17:33:21 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1avpoV-0001SC-AM for linux-arm-kernel@lists.infradead.org; Thu, 28 Apr 2016 17:33:19 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 92E023A; Thu, 28 Apr 2016 10:32:57 -0700 (PDT) Received: from [10.1.209.158] (melchizedek.cambridge.arm.com [10.1.209.158]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 64D5E3F218; Thu, 28 Apr 2016 10:32:54 -0700 (PDT) Message-ID: <572248E0.6050009@arm.com> Date: Thu, 28 Apr 2016 18:31:12 +0100 From: James Morse User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.6.0 MIME-Version: 1.0 To: Will Deacon Subject: Re: [PATCH v9 00/14] arm64: kernel: Add support for hibernate/suspend-to-disk References: <1461775633-29715-1-git-send-email-james.morse@arm.com> <20160428124054.GC30834@arm.com> In-Reply-To: <20160428124054.GC30834@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160428_103319_374567_190D9E2B X-CRM114-Status: GOOD ( 16.37 ) X-Spam-Score: -7.9 (-------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lorenzo Pieralisi , AKASHI Takahiro , Geoff Levand , Catalin Marinas , "Rafael J . Wysocki" , Marc Zyngier , Pavel Machek , Sudeep Holla , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Will, 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. -----------------------%<----------------------- -----------------------%<----------------------- Thanks, James 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