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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 20E45C433B4 for ; Wed, 12 May 2021 03:08:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8FF3D61941 for ; Wed, 12 May 2021 03:08:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8FF3D61941 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F3F126B0036; Tue, 11 May 2021 23:08:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F02AD6B006E; Tue, 11 May 2021 23:08:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DCB1F6B0070; Tue, 11 May 2021 23:08:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0050.hostedemail.com [216.40.44.50]) by kanga.kvack.org (Postfix) with ESMTP id C48F36B0036 for ; Tue, 11 May 2021 23:08:23 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 7D3AE8249980 for ; Wed, 12 May 2021 03:08:23 +0000 (UTC) X-FDA: 78131095686.22.5F457C2 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf10.hostedemail.com (Postfix) with ESMTP id 7AA8040002F0 for ; Wed, 12 May 2021 03:08:06 +0000 (UTC) Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Fg05N6X4Tzmg6C; Wed, 12 May 2021 11:04:56 +0800 (CST) Received: from [10.174.177.243] (10.174.177.243) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.498.0; Wed, 12 May 2021 11:08:15 +0800 Subject: Re: arm32: panic in move_freepages (Was [PATCH v2 0/4] arm64: drop pfn_valid_within() and simplify pfn_valid()) To: Mike Rapoport CC: David Hildenbrand , , Andrew Morton , Anshuman Khandual , Ard Biesheuvel , Catalin Marinas , Marc Zyngier , Mark Rutland , "Mike Rapoport" , Will Deacon , , , References: <24b37c01-fc75-d459-6e61-d67e8f0cf043@redhat.com> <82cfbb7f-dd4f-12d8-dc76-847f06172200@huawei.com> <33c67e13-dc48-9a2f-46d8-a532e17380fb@huawei.com> From: Kefeng Wang Message-ID: Date: Wed, 12 May 2021 11:08:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.243] X-CFilter-Loop: Reflected Authentication-Results: imf10.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=huawei.com; spf=pass (imf10.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 7AA8040002F0 X-Stat-Signature: utxy9gp1f1g8izpckr13yjh8upbm6y5f Received-SPF: none (huawei.com>: No applicable sender policy available) receiver=imf10; identity=mailfrom; envelope-from=""; helo=szxga04-in.huawei.com; client-ip=45.249.212.190 X-HE-DKIM-Result: none/none X-HE-Tag: 1620788886-908808 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2021/5/11 16:48, Mike Rapoport wrote: > On Mon, May 10, 2021 at 11:10:20AM +0800, Kefeng Wang wrote: >> >>>> The memory is not continuous, see MEMBLOCK: >>>> memory size = 0x4c0fffff reserved size = 0x027ef058 >>>> memory.cnt = 0xa >>>> memory[0x0] [0x80a00000-0x855fffff], 0x04c00000 bytes flags: 0x0 >>>> memory[0x1] [0x86a00000-0x87dfffff], 0x01400000 bytes flags: 0x0 >>>> memory[0x2] [0x8bd00000-0x8c4fffff], 0x00800000 bytes flags: 0x0 >>>> memory[0x3] [0x8e300000-0x8ecfffff], 0x00a00000 bytes flags: 0x0 >>>> memory[0x4] [0x90d00000-0xbfffffff], 0x2f300000 bytes flags: 0x0 >>>> memory[0x5] [0xcc000000-0xdc9fffff], 0x10a00000 bytes flags: 0x0 >>>> memory[0x6] [0xde700000-0xde9fffff], 0x00300000 bytes flags: 0x0 >>>> ... >>>> >>>> The pfn_range [0xde600,0xde700] => addr_range [0xde600000,0xde700000] >>>> is not available memory, and we won't create memmap , so with or without >>>> your patch, we can't see the range in free_memmap(), right? >>> >>> This is not available memory and we won't see the reange in free_memmap(), >>> but we still should create memmap for it and that's what my patch tried to >>> do. >>> >>> There are a lot of places in core mm that operate on pageblocks and >>> free_unused_memmap() should make sure that any pageblock has a valid memory >>> map. >>> >>> Currently, that's not the case when SPARSEMEM=y and my patch tried to fix >>> it. >>> >>> Can you please send log with my patch applied and with the printing of >>> ranges that are freed in free_unused_memmap() you've used in previous >>> mails? > >> with your patch[1] and debug print in free_memmap, >> ----> free_memmap, start_pfn = 85800, 85800000 end_pfn = 86800, 86800000 >> ----> free_memmap, start_pfn = 8c800, 8c800000 end_pfn = 8e000, 8e000000 >> ----> free_memmap, start_pfn = 8f000, 8f000000 end_pfn = 90000, 90000000 >> ----> free_memmap, start_pfn = dcc00, dcc00000 end_pfn = de400, de400000 >> ----> free_memmap, start_pfn = dec00, dec00000 end_pfn = e0000, e0000000 >> ----> free_memmap, start_pfn = e0c00, e0c00000 end_pfn = e4000, e4000000 >> ----> free_memmap, start_pfn = f7000, f7000000 end_pfn = f8000, f8000000 > > It seems that freeing of the memory map is suboptimal still because that > code was not designed for memory layout that has more holes than Swiss > cheese. > > Still, the range [0xde600,0xde700] is not freed and there should be struct > pages for this range. > > Can you add > > dump_page(pfn_to_page(0xde600), ""); > > say, in the end of memblock_free_all()? > > The range [0xde600,0xde700] is not memory, so it won't create struct page for it when sparse_init? After apply patch[1], the dump_page log, page:ef3cc000 is uninitialized and poisoned raw: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff page dumped because: [1] https://lore.kernel.org/linux-mm/20210512031057.13580-3-wangkefeng.wang@huawei.com/T/#u