From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D25AC4742C for ; Sun, 1 Nov 2020 17:02:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 422CF22265 for ; Sun, 1 Nov 2020 17:02:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604250155; bh=HP+ZQ6Ps8oAsoYLOvWAk4ExSXyhayG0jX2yWoBMUttE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=uRg7a5VkJGirtDskz7e+F5jN5rD+wdeOTyI5501ujlJqKWdJeazqa9oK/cNQelTmK 6tp9tJ+O4ZD6hi0a9Z3zDtPx41eTQdjMe1eELO6xNt6+6QuLom2ycFB22jaG6DmRlU A7fD1RGi7tzGIyfBJ2PgvsZj2HxUdXYMKIXE7aw8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726938AbgKARCc (ORCPT ); Sun, 1 Nov 2020 12:02:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:37840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726790AbgKARCb (ORCPT ); Sun, 1 Nov 2020 12:02:31 -0500 Received: from kernel.org (unknown [87.71.17.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 420992074F; Sun, 1 Nov 2020 17:02:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604250150; bh=HP+ZQ6Ps8oAsoYLOvWAk4ExSXyhayG0jX2yWoBMUttE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bxsex5hsLdBiTg92b0MNJxCbBPD+lO6NtdRjasPNMfUBXD6k5B0KcdxvFVYiQIEmX Bjfz+dfRQJnD6lyaCaBO97eSNhn6o7BX84zyBBhpcPltXScqdjcB1tCqstPvndRKPK MacevoYxMeN6oYR+VtqyVfF6MF53cPKygLmGPOBs= Date: Sun, 1 Nov 2020 19:02:17 +0200 From: Mike Rapoport To: "Edgecombe, Rick P" Cc: "david@redhat.com" , "cl@linux.com" , "gor@linux.ibm.com" , "hpa@zytor.com" , "peterz@infradead.org" , "catalin.marinas@arm.com" , "dave.hansen@linux.intel.com" , "borntraeger@de.ibm.com" , "penberg@kernel.org" , "linux-mm@kvack.org" , "iamjoonsoo.kim@lge.com" , "will@kernel.org" , "aou@eecs.berkeley.edu" , "kirill@shutemov.name" , "rientjes@google.com" , "rppt@linux.ibm.com" , "paulus@samba.org" , "hca@linux.ibm.com" , "bp@alien8.de" , "pavel@ucw.cz" , "sparclinux@vger.kernel.org" , "akpm@linux-foundation.org" , "luto@kernel.org" , "davem@davemloft.net" , "mpe@ellerman.id.au" , "benh@kernel.crashing.org" , "linuxppc-dev@lists.ozlabs.org" , "rjw@rjwysocki.net" , "tglx@linutronix.de" , "linux-riscv@lists.infradead.org" , "x86@kernel.org" , "linux-pm@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "palmer@dabbelt.com" , "Brown, Len" , "mingo@redhat.com" , "linux-s390@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "paul.walmsley@sifive.com" Subject: Re: [PATCH 2/4] PM: hibernate: improve robustness of mapping pages in the direct map Message-ID: <20201101170217.GD14628@kernel.org> References: <20201025101555.3057-1-rppt@kernel.org> <20201025101555.3057-3-rppt@kernel.org> <3b4b2b3559bd3dc68adcddf99415bae57152cb6b.camel@intel.com> <20201029075416.GJ1428094@kernel.org> <604554805defb03d158c09aba4b5cced3416a7fb.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <604554805defb03d158c09aba4b5cced3416a7fb.camel@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On Thu, Oct 29, 2020 at 11:19:18PM +0000, Edgecombe, Rick P wrote: > On Thu, 2020-10-29 at 09:54 +0200, Mike Rapoport wrote: > > __kernel_map_pages() on arm64 will also bail out if rodata_full is > > false: > > void __kernel_map_pages(struct page *page, int numpages, int enable) > > { > > if (!debug_pagealloc_enabled() && !rodata_full) > > return; > > > > set_memory_valid((unsigned long)page_address(page), numpages, > > enable); > > } > > > > So using set_direct_map() to map back pages removed from the direct > > map > > with __kernel_map_pages() seems safe to me. > > Heh, one of us must have some simple boolean error in our head. I hope > its not me! :) I'll try on more time. Well, then it's me :) You are right, I misread this and I could not understand why !rodata_full bothers you. > __kernel_map_pages() will bail out if rodata_full is false **AND** > debug page alloc is off. So it will only bail under conditions where > there could be nothing unmapped on the direct map. > > Equivalent logic would be: > if (!(debug_pagealloc_enabled() || rodata_full)) > return; > > Or: > if (debug_pagealloc_enabled() || rodata_full) > set_memory_valid(blah) > > So if either is on, the existing code will try to re-map. But the > set_direct_map_()'s will only work if rodata_full is on. So switching > hibernate to set_direct_map() will cause the remap to be missed for the > debug page alloc case, with !rodata_full. > > It also breaks normal debug page alloc usage with !rodata_full for > similar reasons after patch 3. The pages would never get unmapped. I've updated the patches, there should be no regression now. -- Sincerely yours, Mike. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17940C2D0A3 for ; Sun, 1 Nov 2020 17:02:45 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BAD472074F for ; Sun, 1 Nov 2020 17:02:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eDgQvpAu"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="bxsex5hs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BAD472074F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SZ3zfIjGP1tpQF/cjnTACGkfRyHrxby/Skev1Lm1qIo=; b=eDgQvpAuGIvEzUSwkSZwB5nhP F/Klf7KvPVQh6m/o3OA5/2IRyd2GB3uHAcFDSxfXq67rIHy/dOz1pNdGum+Y3L1G3YBkLO07mC277 L6StkyxDAA3I7fn2fsZ9HT70YTRIc29JiHEJpYVbQ9TA4jbt5IyYuioY+oOBYQf3oCaIaAnR7QpB4 MU9vXRckqgeBSL3WGxn0s4JVlbWai5U8PIO/dfKo988DinLzjeNtuvcMbnGfsi0227gwYZk5DO0+y PoiWGZMNLFxmo8JXGC/MH4IpILyw+WDJePIewh9QJwbGFJRoxjhkqRq0BtLFnLTQo5J3PhV4SXIev aLkHPkaLA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZGkW-0001zo-4n; Sun, 01 Nov 2020 17:02:36 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZGkR-0001xx-OX; Sun, 01 Nov 2020 17:02:32 +0000 Received: from kernel.org (unknown [87.71.17.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 420992074F; Sun, 1 Nov 2020 17:02:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604250150; bh=HP+ZQ6Ps8oAsoYLOvWAk4ExSXyhayG0jX2yWoBMUttE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bxsex5hsLdBiTg92b0MNJxCbBPD+lO6NtdRjasPNMfUBXD6k5B0KcdxvFVYiQIEmX Bjfz+dfRQJnD6lyaCaBO97eSNhn6o7BX84zyBBhpcPltXScqdjcB1tCqstPvndRKPK MacevoYxMeN6oYR+VtqyVfF6MF53cPKygLmGPOBs= Date: Sun, 1 Nov 2020 19:02:17 +0200 From: Mike Rapoport To: "Edgecombe, Rick P" Subject: Re: [PATCH 2/4] PM: hibernate: improve robustness of mapping pages in the direct map Message-ID: <20201101170217.GD14628@kernel.org> References: <20201025101555.3057-1-rppt@kernel.org> <20201025101555.3057-3-rppt@kernel.org> <3b4b2b3559bd3dc68adcddf99415bae57152cb6b.camel@intel.com> <20201029075416.GJ1428094@kernel.org> <604554805defb03d158c09aba4b5cced3416a7fb.camel@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <604554805defb03d158c09aba4b5cced3416a7fb.camel@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201101_120231_942324_78F5389F X-CRM114-Status: GOOD ( 19.08 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "benh@kernel.crashing.org" , "david@redhat.com" , "peterz@infradead.org" , "catalin.marinas@arm.com" , "dave.hansen@linux.intel.com" , "linux-mm@kvack.org" , "paulus@samba.org" , "pavel@ucw.cz" , "hpa@zytor.com" , "sparclinux@vger.kernel.org" , "cl@linux.com" , "will@kernel.org" , "linux-riscv@lists.infradead.org" , "linux-s390@vger.kernel.org" , "mpe@ellerman.id.au" , "x86@kernel.org" , "rppt@linux.ibm.com" , "borntraeger@de.ibm.com" , "mingo@redhat.com" , "rientjes@google.com" , "Brown, Len" , "aou@eecs.berkeley.edu" , "gor@linux.ibm.com" , "linux-pm@vger.kernel.org" , "hca@linux.ibm.com" , "bp@alien8.de" , "luto@kernel.org" , "paul.walmsley@sifive.com" , "kirill@shutemov.name" , "tglx@linutronix.de" , "iamjoonsoo.kim@lge.com" , "linux-arm-kernel@lists.infradead.org" , "rjw@rjwysocki.net" , "linux-kernel@vger.kernel.org" , "penberg@kernel.org" , "palmer@dabbelt.com" , "akpm@linux-foundation.org" , "linuxppc-dev@lists.ozlabs.org" , "davem@davemloft.net" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Thu, Oct 29, 2020 at 11:19:18PM +0000, Edgecombe, Rick P wrote: > On Thu, 2020-10-29 at 09:54 +0200, Mike Rapoport wrote: > > __kernel_map_pages() on arm64 will also bail out if rodata_full is > > false: > > void __kernel_map_pages(struct page *page, int numpages, int enable) > > { > > if (!debug_pagealloc_enabled() && !rodata_full) > > return; > > > > set_memory_valid((unsigned long)page_address(page), numpages, > > enable); > > } > > > > So using set_direct_map() to map back pages removed from the direct > > map > > with __kernel_map_pages() seems safe to me. > > Heh, one of us must have some simple boolean error in our head. I hope > its not me! :) I'll try on more time. Well, then it's me :) You are right, I misread this and I could not understand why !rodata_full bothers you. > __kernel_map_pages() will bail out if rodata_full is false **AND** > debug page alloc is off. So it will only bail under conditions where > there could be nothing unmapped on the direct map. > > Equivalent logic would be: > if (!(debug_pagealloc_enabled() || rodata_full)) > return; > > Or: > if (debug_pagealloc_enabled() || rodata_full) > set_memory_valid(blah) > > So if either is on, the existing code will try to re-map. But the > set_direct_map_()'s will only work if rodata_full is on. So switching > hibernate to set_direct_map() will cause the remap to be missed for the > debug page alloc case, with !rodata_full. > > It also breaks normal debug page alloc usage with !rodata_full for > similar reasons after patch 3. The pages would never get unmapped. I've updated the patches, there should be no regression now. -- Sincerely yours, Mike. _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8ABB4C2D0A3 for ; Sun, 1 Nov 2020 17:04:18 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9EDED2074F for ; Sun, 1 Nov 2020 17:04:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="bxsex5hs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9EDED2074F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4CPMpR00cZzDqVd for ; Mon, 2 Nov 2020 04:04:15 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=198.145.29.99; helo=mail.kernel.org; envelope-from=rppt@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=default header.b=bxsex5hs; dkim-atps=neutral Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4CPMmT6TXJzDqSR for ; Mon, 2 Nov 2020 04:02:33 +1100 (AEDT) Received: from kernel.org (unknown [87.71.17.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 420992074F; Sun, 1 Nov 2020 17:02:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604250150; bh=HP+ZQ6Ps8oAsoYLOvWAk4ExSXyhayG0jX2yWoBMUttE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bxsex5hsLdBiTg92b0MNJxCbBPD+lO6NtdRjasPNMfUBXD6k5B0KcdxvFVYiQIEmX Bjfz+dfRQJnD6lyaCaBO97eSNhn6o7BX84zyBBhpcPltXScqdjcB1tCqstPvndRKPK MacevoYxMeN6oYR+VtqyVfF6MF53cPKygLmGPOBs= Date: Sun, 1 Nov 2020 19:02:17 +0200 From: Mike Rapoport To: "Edgecombe, Rick P" Subject: Re: [PATCH 2/4] PM: hibernate: improve robustness of mapping pages in the direct map Message-ID: <20201101170217.GD14628@kernel.org> References: <20201025101555.3057-1-rppt@kernel.org> <20201025101555.3057-3-rppt@kernel.org> <3b4b2b3559bd3dc68adcddf99415bae57152cb6b.camel@intel.com> <20201029075416.GJ1428094@kernel.org> <604554805defb03d158c09aba4b5cced3416a7fb.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <604554805defb03d158c09aba4b5cced3416a7fb.camel@intel.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "david@redhat.com" , "peterz@infradead.org" , "catalin.marinas@arm.com" , "dave.hansen@linux.intel.com" , "linux-mm@kvack.org" , "paulus@samba.org" , "pavel@ucw.cz" , "hpa@zytor.com" , "sparclinux@vger.kernel.org" , "cl@linux.com" , "will@kernel.org" , "linux-riscv@lists.infradead.org" , "linux-s390@vger.kernel.org" , "x86@kernel.org" , "rppt@linux.ibm.com" , "borntraeger@de.ibm.com" , "mingo@redhat.com" , "rientjes@google.com" , "Brown, Len" , "aou@eecs.berkeley.edu" , "gor@linux.ibm.com" , "linux-pm@vger.kernel.org" , "hca@linux.ibm.com" , "bp@alien8.de" , "luto@kernel.org" , "paul.walmsley@sifive.com" , "kirill@shutemov.name" , "tglx@linutronix.de" , "iamjoonsoo.kim@lge.com" , "linux-arm-kernel@lists.infradead.org" , "rjw@rjwysocki.net" , "linux-kernel@vger.kernel.org" , "penberg@kernel.org" , "palmer@dabbelt.com" , "akpm@linux-foundation.org" , "linuxppc-dev@lists.ozlabs.org" , "davem@davemloft.net" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Thu, Oct 29, 2020 at 11:19:18PM +0000, Edgecombe, Rick P wrote: > On Thu, 2020-10-29 at 09:54 +0200, Mike Rapoport wrote: > > __kernel_map_pages() on arm64 will also bail out if rodata_full is > > false: > > void __kernel_map_pages(struct page *page, int numpages, int enable) > > { > > if (!debug_pagealloc_enabled() && !rodata_full) > > return; > > > > set_memory_valid((unsigned long)page_address(page), numpages, > > enable); > > } > > > > So using set_direct_map() to map back pages removed from the direct > > map > > with __kernel_map_pages() seems safe to me. > > Heh, one of us must have some simple boolean error in our head. I hope > its not me! :) I'll try on more time. Well, then it's me :) You are right, I misread this and I could not understand why !rodata_full bothers you. > __kernel_map_pages() will bail out if rodata_full is false **AND** > debug page alloc is off. So it will only bail under conditions where > there could be nothing unmapped on the direct map. > > Equivalent logic would be: > if (!(debug_pagealloc_enabled() || rodata_full)) > return; > > Or: > if (debug_pagealloc_enabled() || rodata_full) > set_memory_valid(blah) > > So if either is on, the existing code will try to re-map. But the > set_direct_map_()'s will only work if rodata_full is on. So switching > hibernate to set_direct_map() will cause the remap to be missed for the > debug page alloc case, with !rodata_full. > > It also breaks normal debug page alloc usage with !rodata_full for > similar reasons after patch 3. The pages would never get unmapped. I've updated the patches, there should be no regression now. -- Sincerely yours, Mike. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Rapoport Date: Sun, 01 Nov 2020 17:02:17 +0000 Subject: Re: [PATCH 2/4] PM: hibernate: improve robustness of mapping pages in the direct map Message-Id: <20201101170217.GD14628@kernel.org> List-Id: References: <20201025101555.3057-1-rppt@kernel.org> <20201025101555.3057-3-rppt@kernel.org> <3b4b2b3559bd3dc68adcddf99415bae57152cb6b.camel@intel.com> <20201029075416.GJ1428094@kernel.org> <604554805defb03d158c09aba4b5cced3416a7fb.camel@intel.com> In-Reply-To: <604554805defb03d158c09aba4b5cced3416a7fb.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: "Edgecombe, Rick P" Cc: "benh@kernel.crashing.org" , "david@redhat.com" , "peterz@infradead.org" , "catalin.marinas@arm.com" , "dave.hansen@linux.intel.com" , "linux-mm@kvack.org" , "paulus@samba.org" , "pavel@ucw.cz" , "hpa@zytor.com" , "sparclinux@vger.kernel.org" , "cl@linux.com" , "will@kernel.org" , "linux-riscv@lists.infradead.org" , "linux-s390@vger.kernel.org" , "mpe@ellerman.id.au" , "x86@kernel.org" , "rppt@linux.ibm.com" , "borntraeger@de.ibm.com" , "mingo@redhat.com" , "rientjes@google.com" , "Brown, Len" , "aou@eecs.berkeley.edu" , "gor@linux.ibm.com" , "linux-pm@vger.kernel.org" , "hca@linux.ibm.com" , "bp@alien8.de" , "luto@kernel.org" , "paul.walmsley@sifive.com" , "kirill@shutemov.name" , "tglx@linutronix.de" , "iamjoonsoo.kim@lge.com" , "linux-arm-kernel@lists.infradead.org" , "rjw@rjwysocki.net" , "linux-kernel@vger.kernel.org" , "penberg@kernel.org" , "palmer@dabbelt.com" , "akpm@linux-foundation.org" , "linuxppc-dev@lists.ozlabs.org" , "davem@davemloft.net" On Thu, Oct 29, 2020 at 11:19:18PM +0000, Edgecombe, Rick P wrote: > On Thu, 2020-10-29 at 09:54 +0200, Mike Rapoport wrote: > > __kernel_map_pages() on arm64 will also bail out if rodata_full is > > false: > > void __kernel_map_pages(struct page *page, int numpages, int enable) > > { > > if (!debug_pagealloc_enabled() && !rodata_full) > > return; > > > > set_memory_valid((unsigned long)page_address(page), numpages, > > enable); > > } > > > > So using set_direct_map() to map back pages removed from the direct > > map > > with __kernel_map_pages() seems safe to me. > > Heh, one of us must have some simple boolean error in our head. I hope > its not me! :) I'll try on more time. Well, then it's me :) You are right, I misread this and I could not understand why !rodata_full bothers you. > __kernel_map_pages() will bail out if rodata_full is false **AND** > debug page alloc is off. So it will only bail under conditions where > there could be nothing unmapped on the direct map. > > Equivalent logic would be: > if (!(debug_pagealloc_enabled() || rodata_full)) > return; > > Or: > if (debug_pagealloc_enabled() || rodata_full) > set_memory_valid(blah) > > So if either is on, the existing code will try to re-map. But the > set_direct_map_()'s will only work if rodata_full is on. So switching > hibernate to set_direct_map() will cause the remap to be missed for the > debug page alloc case, with !rodata_full. > > It also breaks normal debug page alloc usage with !rodata_full for > similar reasons after patch 3. The pages would never get unmapped. I've updated the patches, there should be no regression now. -- Sincerely yours, Mike. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96F50C2D0A3 for ; Sun, 1 Nov 2020 17:03:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 212292074F for ; Sun, 1 Nov 2020 17:03:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ecEHrGqB"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="bxsex5hs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 212292074F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fz8HYI2zCtxHWPzYrN8N+IZ66NjAU8+WqW4VotBy+UQ=; b=ecEHrGqBG0isbXKKzAIoeyZba YGUlfP9PjkNeAn7tGlpmd2pHO++h+IQqrYzIqwfeiBmyioesqG+qxeWEPjGqNMX/wyUTFx+1vx2Q5 jFRQqfly5K5Kx7KrxYsl85ufuYny4tPhHApBwflts5xXnaBFE/qopvS8mVL2AEA8yhkpdwE5MIqor 6RirrSdgwzUjOmqtOg3W+ub9qRg9gtp/Xq9r7zrqmR3F/u5bSXHy5Cy8xcpNXgVUkxRUJoO//1X7K +Z9DtdHpK7ucNMK5LT01x9x+E0vcbTy0uH90oFibr4nMG2oqmxjqvLJ18M5AYchgpX5iU0WaeftJT VVViAkRaA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZGkU-0001zM-RX; Sun, 01 Nov 2020 17:02:34 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZGkR-0001xx-OX; Sun, 01 Nov 2020 17:02:32 +0000 Received: from kernel.org (unknown [87.71.17.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 420992074F; Sun, 1 Nov 2020 17:02:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604250150; bh=HP+ZQ6Ps8oAsoYLOvWAk4ExSXyhayG0jX2yWoBMUttE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bxsex5hsLdBiTg92b0MNJxCbBPD+lO6NtdRjasPNMfUBXD6k5B0KcdxvFVYiQIEmX Bjfz+dfRQJnD6lyaCaBO97eSNhn6o7BX84zyBBhpcPltXScqdjcB1tCqstPvndRKPK MacevoYxMeN6oYR+VtqyVfF6MF53cPKygLmGPOBs= Date: Sun, 1 Nov 2020 19:02:17 +0200 From: Mike Rapoport To: "Edgecombe, Rick P" Subject: Re: [PATCH 2/4] PM: hibernate: improve robustness of mapping pages in the direct map Message-ID: <20201101170217.GD14628@kernel.org> References: <20201025101555.3057-1-rppt@kernel.org> <20201025101555.3057-3-rppt@kernel.org> <3b4b2b3559bd3dc68adcddf99415bae57152cb6b.camel@intel.com> <20201029075416.GJ1428094@kernel.org> <604554805defb03d158c09aba4b5cced3416a7fb.camel@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <604554805defb03d158c09aba4b5cced3416a7fb.camel@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201101_120231_942324_78F5389F X-CRM114-Status: GOOD ( 19.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "benh@kernel.crashing.org" , "david@redhat.com" , "peterz@infradead.org" , "catalin.marinas@arm.com" , "dave.hansen@linux.intel.com" , "linux-mm@kvack.org" , "paulus@samba.org" , "pavel@ucw.cz" , "hpa@zytor.com" , "sparclinux@vger.kernel.org" , "cl@linux.com" , "will@kernel.org" , "linux-riscv@lists.infradead.org" , "linux-s390@vger.kernel.org" , "mpe@ellerman.id.au" , "x86@kernel.org" , "rppt@linux.ibm.com" , "borntraeger@de.ibm.com" , "mingo@redhat.com" , "rientjes@google.com" , "Brown, Len" , "aou@eecs.berkeley.edu" , "gor@linux.ibm.com" , "linux-pm@vger.kernel.org" , "hca@linux.ibm.com" , "bp@alien8.de" , "luto@kernel.org" , "paul.walmsley@sifive.com" , "kirill@shutemov.name" , "tglx@linutronix.de" , "iamjoonsoo.kim@lge.com" , "linux-arm-kernel@lists.infradead.org" , "rjw@rjwysocki.net" , "linux-kernel@vger.kernel.org" , "penberg@kernel.org" , "palmer@dabbelt.com" , "akpm@linux-foundation.org" , "linuxppc-dev@lists.ozlabs.org" , "davem@davemloft.net" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Oct 29, 2020 at 11:19:18PM +0000, Edgecombe, Rick P wrote: > On Thu, 2020-10-29 at 09:54 +0200, Mike Rapoport wrote: > > __kernel_map_pages() on arm64 will also bail out if rodata_full is > > false: > > void __kernel_map_pages(struct page *page, int numpages, int enable) > > { > > if (!debug_pagealloc_enabled() && !rodata_full) > > return; > > > > set_memory_valid((unsigned long)page_address(page), numpages, > > enable); > > } > > > > So using set_direct_map() to map back pages removed from the direct > > map > > with __kernel_map_pages() seems safe to me. > > Heh, one of us must have some simple boolean error in our head. I hope > its not me! :) I'll try on more time. Well, then it's me :) You are right, I misread this and I could not understand why !rodata_full bothers you. > __kernel_map_pages() will bail out if rodata_full is false **AND** > debug page alloc is off. So it will only bail under conditions where > there could be nothing unmapped on the direct map. > > Equivalent logic would be: > if (!(debug_pagealloc_enabled() || rodata_full)) > return; > > Or: > if (debug_pagealloc_enabled() || rodata_full) > set_memory_valid(blah) > > So if either is on, the existing code will try to re-map. But the > set_direct_map_()'s will only work if rodata_full is on. So switching > hibernate to set_direct_map() will cause the remap to be missed for the > debug page alloc case, with !rodata_full. > > It also breaks normal debug page alloc usage with !rodata_full for > similar reasons after patch 3. The pages would never get unmapped. I've updated the patches, there should be no regression now. -- Sincerely yours, Mike. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel