From patchwork Tue Nov 1 16:55:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Richter, Robert" X-Patchwork-Id: 9407679 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 83951600C8 for ; Tue, 1 Nov 2016 16:58:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7385829A6B for ; Tue, 1 Nov 2016 16:58:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 679B329A6F; Tue, 1 Nov 2016 16:58:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id D58C329A6B for ; Tue, 1 Nov 2016 16:58:11 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c1cMO-00063G-4r; Tue, 01 Nov 2016 16:56:28 +0000 Received: from mail-by2nam01on0052.outbound.protection.outlook.com ([104.47.34.52] helo=NAM01-BY2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c1cMJ-00061L-0w for linux-arm-kernel@lists.infradead.org; Tue, 01 Nov 2016 16:56:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=O/Ja6hN/WOhuF14cYEW3vug2oFYnYWwEDVlXnOueqYU=; b=MZsCBGmWkUiF6xoyVww30rWKc3D5948uuTJCS6at6kpdN+k4unpTgtBqm1yT8N2TJ6p+ZTq6t40D1A+HcHh4WQ9xtjggbyy1n4sxxrAgR9EoHFFc0RJ0Z/82ap1U3Ey9MpSXvjkBfV/zs3Nx3OQJqtWp45jDj1ArLavbalIOxk4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Robert.Richter@cavium.com; Received: from rric.localdomain (92.229.80.109) by SN1PR07MB2351.namprd07.prod.outlook.com (10.169.127.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.693.12; Tue, 1 Nov 2016 16:55:58 +0000 Date: Tue, 1 Nov 2016 17:55:44 +0100 From: Robert Richter To: Catalin Marinas , Will Deacon Subject: Re: [PATCH] arm64: mm: Fix memmap to be initialized for the entire section Message-ID: <20161101165544.GP22012@rric.localdomain> References: <1475747527-32387-1-git-send-email-rrichter@cavium.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1475747527-32387-1-git-send-email-rrichter@cavium.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Originating-IP: [92.229.80.109] X-ClientProxiedBy: HE1PR01CA0074.eurprd01.prod.exchangelabs.com (10.165.170.170) To SN1PR07MB2351.namprd07.prod.outlook.com (10.169.127.17) X-MS-Office365-Filtering-Correlation-Id: 69680f12-642d-42a4-2299-08d40277f555 X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2351; 2:Mpy/zm4nM58njm9VLdJXJirLuo0SvDHNJ32E/mPL0FVy3nv256r7it6OZL8FfKMdU/9u7jxGnlIfP0IGzlY8Ze5EHwjfG5l+rUy27dAxgwxC3SYZoLbEJ/wlstk7sAm+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daoC3gP1GeVnS95w0NI/XT1kHDamuWtgXomUgTp3w5AFUp1pH0u+CVc8xo44tdyTORGU72GofE2gcCia+AZhKNhnaMpL7oaC0r0hcC0BTg2OzTcQpV0+X5myhsReLGOjWTI= X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2351; 31:tozdjPRLBOGpxU5b5CkptXwADwxxAHd5nhsjikXA16LqEOuKeW+A1o5WWQfOChYQtVsiI8wwJ6NoFPLF+cYcAVNVXC9yoif2DoMVP3RY4lA4+oJuLeUvAG6mykemrRvDx0tHVO1uq64EnU4IT0gGXdQKyk6VpTZgUvybdPFazv7O3TSZ4rPK8VBA2tP3g3OxPo/V5R5D1ga5rThd40jAmw0qiVfkeThxRZk0PDjI8beDfIHiHwkZyGYEIpDXWD2dRfh0x3eGB6+PJjr/QyyDNUf605T8u8P2IYU5nnC7jU0=; 20:ZRD0Z6fjX8G8S1Utsp57/DuZ8ctRdhOYmUVsmrBWD0ljotM9PRKuWcWz+WtW1r6ynMtHhkezNL750FosIlhD72OqL8W8Xn6OSph49YSC1y4gUZDJAC9tbQaNWiLFSLrEExX7rJATynndRpY9BN993Md64f5yUrFCAfrai/7gSBHAFhc+zJeYK1Bp1PxNXmi9Z+b45LWPW070RG0XIRAS5XRqOO1p+2HsTshtnNWwQhrPdyjQ/FY+Q9JtaOEzdzXlgE/hJXX4KGLYTYxsr+lpdpE7b7DTj6UNQNBrDjh07d84Bjbad5mTt0piv/7omo5zEwjqkk/7ZBGFJQtqSyXyPAEM2JGatcW6tOdMfPA9duoE0PJvhF1CcK8BOmZ3PSwl9rsx8PUZMc57xexWMapVkMYIGrIMFQ+ar5SDooAp6lTagbPni/bV0IvdNIEpaB3wBYzhG3eNI7KExXHdK5itD2h5VAMyA16Dgo4tDqHy+XbUW0xSWH/CFJadgdXdHcmJ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(20558992708506); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(102415321)(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:SN1PR07MB2351; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2351; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2351; 4:O6LNJvQrGLnUeo0wbwKSFl74VzXe8u6hHeYtTqa1/ji0KRJKK1DC00TEbVLixrqh0eeWsBKjMpYfsTKJapVkAeersO9bvVpALxMhhXLkbz9OWxewbNAOJUsTE6p07S8L2/3225Uogif9pvAKji54nu3hC77dK8bB7z3wTAGIwnPssn1QbaBQ2w6odMln1jZbQKPdmkf5064+GF/vd2p9/pdaplR0AmkBHL2ZVKWkyVqJqi4uu/LUxqqUky5JpQuiNoKGftgZjO7PxYqkVS10fG0K60aJHMPTt8YCPdbNTU1bU2PER6GbNKVDIpevxOOQr9A6awn1gseFJHU26C23sYrrwP8xpBe/qt6+37ujfhuuStjUyf47TOFKn3pLTWxvH/W75qwWCUoawSPsGWSasMjbOsxYGIpLeafnV6AMHDlV4oMIns31nRDThVSCOKvJbTG7pZKfwL0RqV5DGHas4A== X-Forefront-PRVS: 01136D2D90 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(24454002)(189002)(199003)(66066001)(84326002)(42186005)(86362001)(5001770100001)(54356999)(76176999)(97736004)(4326007)(189998001)(568964002)(4001350100001)(260700001)(50986999)(105586002)(106356001)(305945005)(68736007)(101416001)(19580395003)(19580405001)(7736002)(7846002)(5660300001)(77096005)(512954002)(81156014)(8676002)(81166006)(6666003)(33656002)(2950100002)(2476003)(92566002)(6116002)(1076002)(3846002)(586003)(5890100001)(2906002)(4610100001)(9686002)(83506001)(18370500001)(2700100001)(47845001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2351; H:rric.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us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6iN3OqlhDFWJgraHo5PcxPoAVvAA==; 24:FGhJ3nrXFhSGgTdYiP9lmn8Zrx+535EIRCzkag+n9JnRP6GAd9XMdsYd41Xou60nbKzToYXRoPSqIzsHIJS80rXkdrChhfm7F2+HSPZWBxY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2351; 7:e2SXxoXIZbv8TIB2NhkQ481gWlWoPoFQVMS7X8bWIzaVIqsPuSqyhu6Dahw2yPnAjEPJW/4ZOr28i6xkhb4If4Sg8urvrPTPFLUhRR+zGa+4Fx5/G0XsEys3bDhf6Jhy4LR3XjeOr3ui6ZR8TrFXx+15X2mfb0b/JxNZ6GqNLXqmrnghmfXqofowj8f/txsf/hltU/OEcVw2vlWPNdQt6LJuDlpKhqEK8sAdbiaxdTx/LKe7F4dAHJ7uIPxwh0TyB9GAKdz2WCbFAnTpM0c6iq+PWvk+t1O07ew+79609qUoBBLOTte2vxNEefxicplOviN2Q/Wp/EhD8Jy0GYNQxbrnnm0xQEG4T8Lqtc5njns= X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2016 16:55:58.2964 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2351 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161101_095623_219348_AD21E358 X-CRM114-Status: GOOD ( 26.69 ) 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: Mark Rutland , linux-efi@vger.kernel.org, David Daney , Ard Biesheuvel , linux-kernel@vger.kernel.org, Hanjun Guo , 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-Virus-Scanned: ClamAV using ClamSMTP On 06.10.16 11:52:07, Robert Richter wrote: > There is a memory setup problem on ThunderX systems with certain > memory configurations. The symptom is > > kernel BUG at mm/page_alloc.c:1848! > > This happens for some configs with 64k page size enabled. The bug > triggers for page zones with some pages in the zone not assigned to > this particular zone. In my case some pages that are marked as nomap > were not reassigned to the new zone of node 1, so those are still > assigned to node 0. > > The reason for the mis-configuration is a change in pfn_valid() which > reports pages marked nomap as invalid: > > 68709f45385a arm64: only consider memblocks with NOMAP cleared for linear mapping > > This causes pages marked as nomap being no long reassigned to the new > zone in memmap_init_zone() by calling __init_single_pfn(). > > Fixing this by restoring the old behavior of pfn_valid() to use > memblock_is_memory(). Also changing users of pfn_valid() in arm64 code > to use memblock_is_map_memory() where necessary. This only affects > code in ioremap.c. The code in mmu.c still can use the new version of > pfn_valid(). Below a reproducer for non-numa systems. Note that invalidating the node id just simulates a different node in reality. The patch injects a (pageblock_order) unaligned NOMAP mem range at the end of a memory block and then tries to free that area. This causes a BUG_ON() (log attached). -Robert From 20d853e300c99be5420c7ee3f072c318804cac1b Mon Sep 17 00:00:00 2001 From: root Date: Tue, 1 Nov 2016 15:04:43 +0000 Subject: [PATCH] mm-fault-reproducer Signed-off-by: root --- arch/arm64/mm/init.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++ mm/page_alloc.c | 4 ++- 2 files changed, 81 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 21c489bdeb4e..feaa7ab97551 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -301,6 +302,80 @@ void __init arm64_memblock_init(void) memblock_allow_resize(); } +static struct page *inject_pageblock; + +static void __init inject_nomap_create(void) +{ + phys_addr_t start, end; + unsigned long start_pfn, end_pfn; + u64 i; + int ret = -ENOMEM; + + pr_info("%s: PAGES_PER_SECTION=%08lx pageblock_nr_pages=%08lx PAGE_SIZE=%08lx\n", + __func__, PAGES_PER_SECTION, pageblock_nr_pages, PAGE_SIZE); + + /* + * find a mem range with a complet pageblock in it + */ + for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE, &start, &end, NULL) { + start_pfn = PFN_DOWN(start); + end_pfn = PFN_UP(end); + if (end_pfn - (start_pfn & ~(pageblock_nr_pages-1)) > 2 * pageblock_nr_pages) + break; + } + + if (i == ULLONG_MAX) + goto fail; + + start = PFN_PHYS(start_pfn); + end = PFN_PHYS(end_pfn) - 1; + + pr_info("%s: Injecting into range: [%pa-%pa]\n", __func__, &start, &end); + + /* mark the upper 5 pages nomap of a complete pageblock */ + start_pfn = end_pfn & ~(pageblock_nr_pages-1); + start_pfn -= 5; /* unalign by 5 pages */ + + start = PFN_PHYS(start_pfn); + end = PFN_PHYS(end_pfn) - 1; + + ret = memblock_mark_nomap(start, end - start + 1); + if (ret) + goto fail; + + inject_pageblock = pfn_to_page(start_pfn & ~(pageblock_nr_pages-1)); + + pr_info("%s: Injected nomap range at: [%pa-%pa] zones: %p %p\n", __func__, + &start, &end, page_zone(inject_pageblock), + page_zone(inject_pageblock + pageblock_nr_pages - 1)); + + return; +fail: + pr_err("%s: Could not inject_unaligned_range: %d\n", __func__, ret); +} + +static void __init inject_nomap_move(void) +{ + phys_addr_t start, end; + int ret; + + if (!inject_pageblock) + return; + + start = PFN_PHYS(page_to_pfn(inject_pageblock)); + end = PFN_PHYS(page_to_pfn(inject_pageblock) + pageblock_nr_pages) - 1; + + pr_info("%s: Moving [%pa-%pa] zones: %p %p\n", __func__, + &start, &end, page_zone(inject_pageblock), + page_zone(inject_pageblock + pageblock_nr_pages - 1)); + + ret = move_freepages_block(page_zone(inject_pageblock), + inject_pageblock, + gfpflags_to_migratetype(GFP_KERNEL)); + + pr_info("%s: Moved %d pages\n", __func__, ret); +} + void __init bootmem_init(void) { unsigned long min, max; @@ -320,6 +395,7 @@ void __init bootmem_init(void) arm64_memory_present(); sparse_init(); + inject_nomap_create(); zone_sizes_init(min, max); high_memory = __va((max << PAGE_SHIFT) - 1) + 1; @@ -479,6 +555,8 @@ void __init mem_init(void) */ sysctl_overcommit_memory = OVERCOMMIT_ALWAYS; } + + inject_nomap_move(); } void free_initmem(void) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 2b3bf6767d54..19d74637e242 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5077,8 +5077,10 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, if (context != MEMMAP_EARLY) goto not_early; - if (!early_pfn_valid(pfn)) + if (!early_pfn_valid(pfn)) { + set_page_node(pfn_to_page(pfn), NUMA_NO_NODE); continue; + } if (!early_pfn_in_nid(pfn, nid)) continue; if (!update_defer_init(pgdat, pfn, end_pfn, &nr_initialised))