From patchwork Wed Mar 14 13:44:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10282203 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 500F4601E9 for ; Wed, 14 Mar 2018 13:45:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D3122884E for ; Wed, 14 Mar 2018 13:45:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3119A28900; Wed, 14 Mar 2018 13:45:22 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 839C92884E for ; Wed, 14 Mar 2018 13:45:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=8yynd0QS7+YmGHrwbZKTmPJ++ot2/4SAYgyjwqKvCy4=; b=QLw qdC956NADWU8BKxrNPVERJ19eXdNzrkcsZf04aIaKLd28VTbGlJ9ZA7VoZUmOCrhbMvHGwjZhR43B 7ul9VxBmxwAzD2RiOIluEpVJ5/7WIJAvrXOxQn/nJX0cwaZh69V3wJEXYraQqy956BRIownlYwHP1 GBVG9s8QSD0KEe41MCzIyepsJIL0B7JmtMVN46EYn2MWEYRW8Ayzwjd15a5m51ZmpsmFun8LgogPV 8HmP04azFKNdj3A8POPLekitLts7AUMyDriAmT+Hl47sVsVSQAtCQHCVSfk25fAoDFm9RdIdpaUlL O38QlTwyKm2+7ZvaGbdTj5pJhIN/Wvg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ew6iT-0001c9-CT; Wed, 14 Mar 2018 13:45:17 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ew6iP-0000xd-5j for linux-arm-kernel@lists.infradead.org; Wed, 14 Mar 2018 13:45:15 +0000 Received: by mail-wm0-x241.google.com with SMTP id u10so3970360wmu.4 for ; Wed, 14 Mar 2018 06:45:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=fExZklkEoVcmZvZgVefFGf9w/rpVghSfwHQEq5UrJT0=; b=k0AHqD53u0cEK3SySSh/Y+HTZZno1HGLLYCDVGLMiRaJ3IXdCjevvn6gQdqwoh3m2Q SxbScE+R/KQZnt03BYvDVIJvaF/J2cCygf5Ca2av8n+AdRLgRU5XogMSZwTryqCNfSWB bYXQNyeAPE3D/Ziv6nzTlnUAh3SUhTih93RDA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=fExZklkEoVcmZvZgVefFGf9w/rpVghSfwHQEq5UrJT0=; b=N4AfQXSTDxxxgIX+6EPJ7c9wpjtGmXf0x3wdY4lNoi8WSSTj+ZERDWACN+K3UL68ay XE1609o91gZX/wcNFEJvwbLUDhUGoKYDczcg7qaAj2BMgvmMTzoHRBCAhe2RbHcXusEb 7FPD29d7V73BmuSQigiKcBU6sTPovJ00KYwnD7CCSWaj8RRoHi2O6TTpof032TQku6LA qMkkZxFFevLmzvFewfFFfkV35CXHAQL3qkweopK2SvAnCcWlJ7Ib5ky9ZCXDELNn0VMv gRoYY/+fOfyhEnYFKRRLjJcUvOVT1eIIjU2iikl7OAT2ouEV60bXik/XlwKA/x4u+Flz u1Cw== X-Gm-Message-State: AElRT7FVceHdgSOJh8XnvV6Mp1HhCjp9hNPHti4iXcH54P5DZ+JBluYq DR5C3d18Cf+k7Qm4K6rDqaHFTEbmqMM= X-Google-Smtp-Source: AG47ELuoU6BVCJJtJ0sgwMed45i/e5dwwluOAxW/SfpgSj45SeI8kTTaR95GG7ovLFwXNJuAhQZl3g== X-Received: by 10.28.218.1 with SMTP id r1mr1661305wmg.156.1521035100714; Wed, 14 Mar 2018 06:45:00 -0700 (PDT) Received: from localhost.localdomain ([105.148.128.186]) by smtp.gmail.com with ESMTPSA id q9sm3041064wrf.11.2018.03.14.06.44.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Mar 2018 06:44:59 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] Revert "mm/page_alloc: fix memmap_init_zone pageblock alignment" Date: Wed, 14 Mar 2018 13:44:31 +0000 Message-Id: <20180314134431.13241-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.15.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180314_064513_326567_F239C17E X-CRM114-Status: GOOD ( 16.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, Michal Hocko , Paul Burton , Ard Biesheuvel , marc.zyngier@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, Pavel Tatashin , Linus Torvalds , Andrew Morton , Mel Gorman , Daniel Vacek , Vlastimil Babka MIME-Version: 1.0 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 This reverts commit 864b75f9d6b0100bb24fdd9a20d156e7cda9b5ae. It breaks the boot on my Socionext SynQuacer based system, because it enters an infinite loop iterating over the pfns. Adding the following debug output to memmap_init_zone() --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5365,6 +5365,11 @@ * the valid region but still depends on correct page * metadata. */ + pr_err("pfn:%lx oldnext:%lx newnext:%lx\n", pfn, + memblock_next_valid_pfn(pfn, end_pfn) - 1, + (memblock_next_valid_pfn(pfn, end_pfn) & + ~(pageblock_nr_pages-1)) - 1); + pfn = (memblock_next_valid_pfn(pfn, end_pfn) & ~(pageblock_nr_pages-1)) - 1; #endif results in Booting Linux on physical CPU 0x0000000000 [0x410fd034] Linux version 4.16.0-rc5-00004-gfc6eabbbf8ef-dirty (ard@dogfood) ... Machine model: Socionext Developer Box earlycon: pl11 at MMIO 0x000000002a400000 (options '') bootconsole [pl11] enabled efi: Getting EFI parameters from FDT: efi: EFI v2.70 by Linaro efi: SMBIOS 3.0=0xff580000 ESRT=0xf9948198 MEMATTR=0xf83b1a98 RNG=0xff7ac898 random: fast init done efi: seeding entropy pool esrt: Reserving ESRT space from 0x00000000f9948198 to 0x00000000f99481d0. cma: Reserved 16 MiB at 0x00000000fd800000 NUMA: No NUMA configuration found NUMA: Faking a node at [mem 0x0000000000000000-0x0000000fffffffff] NUMA: NODE_DATA [mem 0xffffd8d80-0xffffda87f] Zone ranges: DMA32 [mem 0x0000000080000000-0x00000000ffffffff] Normal [mem 0x0000000100000000-0x0000000fffffffff] Movable zone start for each node Early memory node ranges node 0: [mem 0x0000000080000000-0x00000000febeffff] node 0: [mem 0x00000000febf0000-0x00000000fefcffff] node 0: [mem 0x00000000fefd0000-0x00000000ff43ffff] node 0: [mem 0x00000000ff440000-0x00000000ff7affff] node 0: [mem 0x00000000ff7b0000-0x00000000ffffffff] node 0: [mem 0x0000000880000000-0x0000000fffffffff] Initmem setup node 0 [mem 0x0000000080000000-0x0000000fffffffff] pfn:febf0 oldnext:febf0 newnext:fe9ff pfn:febf0 oldnext:febf0 newnext:fe9ff pfn:febf0 oldnext:febf0 newnext:fe9ff etc etc and the boot never proceeds after this point. So the logic is obviously flawed, and so it is best to revert this at the current -rc stage (unless someone can fix the logic instead) Fixes: 864b75f9d6b0 ("mm/page_alloc: fix memmap_init_zone pageblock alignment") Cc: Daniel Vacek Cc: Mel Gorman Cc: Michal Hocko Cc: Paul Burton Cc: Pavel Tatashin Cc: Vlastimil Babka Cc: Andrew Morton Cc: Linus Torvalds Signed-off-by: Ard Biesheuvel --- mm/page_alloc.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 3d974cb2a1a1..cb416723538f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5359,14 +5359,9 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, /* * Skip to the pfn preceding the next valid one (or * end_pfn), such that we hit a valid pfn (or end_pfn) - * on our next iteration of the loop. Note that it needs - * to be pageblock aligned even when the region itself - * is not. move_freepages_block() can shift ahead of - * the valid region but still depends on correct page - * metadata. + * on our next iteration of the loop. */ - pfn = (memblock_next_valid_pfn(pfn, end_pfn) & - ~(pageblock_nr_pages-1)) - 1; + pfn = memblock_next_valid_pfn(pfn, end_pfn) - 1; #endif continue; }