Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1776930imm; Thu, 12 Jul 2018 07:41:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd7eww37OF4LDj/QZaoRX1IEp9q7D5tNnwK+tH+yXLdKK8u/DDUy52BnzeYpYbWccCdB5Jt X-Received: by 2002:a62:d544:: with SMTP id d65-v6mr2701621pfg.107.1531406486013; Thu, 12 Jul 2018 07:41:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531406485; cv=none; d=google.com; s=arc-20160816; b=BFZtzDrL9R9C0AKzEFKzeSClKFrhBy7WwlpXSNcVm+fqLd6FJbZyPatGgV1IBGgQ08 HOA/C+fjen1ZoxxMW0AEN37pau322joz5CmqjbV+BD72x7gkM+5kPgfVczlBfIf1b4QR v14JIhp4kHQRkXlMz5nzVm5dubZVEt7VIHBbvQ8GsSKThHN3AjpcjvD1blrRAYOvNsqr nYmbrr2ZS65gvlArMi1w4gEgX5ZDI5hWg22vgdtJaObV38i+UTPLRHjI+KmoWs4RnPtq l4SUYf9CY3pYbE8YnmoaK4ftFvaPpumTM7j15HmbW8OXJEEkNNxlpzrwnBKgdC4pdTGP 32Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date :arc-authentication-results; bh=cXYzqI07bDBXwlk03P2kl/M7pV1LTM/Bgw+CRIzU8EI=; b=DUnh6PY02JdyANRiwM4OIByVTslohfjEB9ouEiI6hURIndslQTg2SHbIuP3RBkMDk0 NegVNg+lGHBCOPUrOqgg6H4G4U0OFA9m9+HUKwJ4jTgemkONzUwpjJNtWgLBGUx28Bjg N+BY6ODL0OgUyGVabblTydqHdkqvBHkfT5TJpO9JuSth5XVPMfJI1mqGbf2HYveYg2Ri 1siISTs5JCCZlFrK6xbosOVazM+OXQFtZYV+iesTLoOvRWuQxzevveegMpxx7Li729qQ KdSNuzcmm2gzwHhWrK2OwDBtTXmSqGSMagRLuF+gAiua7IODNGQ5/8w92I030frVv45+ k8rg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f62-v6si23102090pfg.165.2018.07.12.07.41.02; Thu, 12 Jul 2018 07:41:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732418AbeGLOuP (ORCPT + 99 others); Thu, 12 Jul 2018 10:50:15 -0400 Received: from mail02.asahi-net.or.jp ([202.224.55.14]:54646 "EHLO mail02.asahi-net.or.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727667AbeGLOuP (ORCPT ); Thu, 12 Jul 2018 10:50:15 -0400 Received: from h61-195-96-97.vps.ablenet.jp (h61-195-96-97.vps.ablenet.jp [61.195.96.97]) (Authenticated sender: PQ4Y-STU) by mail02.asahi-net.or.jp (Postfix) with ESMTPA id F388CF4CE0; Thu, 12 Jul 2018 23:40:22 +0900 (JST) Received: from yo-satoh-debian.ysato.ml (ZM028236.ppp.dion.ne.jp [222.8.28.236]) by h61-195-96-97.vps.ablenet.jp (Postfix) with ESMTPSA id 506D724006D; Thu, 12 Jul 2018 23:40:21 +0900 (JST) Date: Thu, 12 Jul 2018 23:40:20 +0900 Message-ID: <87k1q0plez.wl-ysato@users.sourceforge.jp> From: Yoshinori Sato To: Mike Rapoport Cc: Rob Herring , mhocko@kernel.org, linux-mm@kvack.org, Johannes Weiner , Andrew Morton , "open list:GENERIC INCLUDE/ASM HEADER FILES" , "linux-kernel@vger.kernel.org" Subject: Re: h8300: BUG: Bad page state in process swapper (was: Re: why do we still need bootmem allocator?) In-Reply-To: <20180701122245.GA28969@rapoport-lnx> References: <20180625140754.GB29102@dhcp22.suse.cz> <20180627112655.GD4291@rapoport-lnx> <20180627160206.GB19182@rapoport-lnx> <20180701122245.GA28969@rapoport-lnx> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.8 EasyPG/1.0.0 Emacs/25.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 01 Jul 2018 21:22:46 +0900, Mike Rapoport wrote: > > (added Yoshinori Sato, here's the beginning of the discussion: > https://lore.kernel.org/lkml/20180625140754.GB29102@dhcp22.suse.cz/) > > On Wed, Jun 27, 2018 at 07:02:06PM +0300, Mike Rapoport wrote: > > On Wed, Jun 27, 2018 at 07:33:55AM -0600, Rob Herring wrote: > > > On Wed, Jun 27, 2018 at 5:27 AM Mike Rapoport wrote: > > > > > > > > I've tried running the current upstream on h8300 gdb simulator and it > > > > failed: > > > > > > It seems my patch[1] is still not applied. The maintainer said he applied it. > > > > I've applied it manually. Without it unflatten_and_copy_device_tree() fails > > to allocate memory. It indeed can be fixed with moving bootmem_init() > > before, as you've noted in the commit message. > > > > I'll try to dig deeper into it. > > > > > > [ 0.000000] BUG: Bad page state in process swapper pfn:00004 > > > > [ 0.000000] page:007ed080 count:0 mapcount:-128 mapping:00000000 > > > > index:0x0 > > > > [ 0.000000] flags: 0x0() > > > > [ 0.000000] raw: 00000000 0040bdac 0040bdac 00000000 00000000 00000002 > > > > ffffff7f 00000000 > > > > [ 0.000000] page dumped because: nonzero mapcount > > > > ---Type to continue, or q to quit--- > > > > [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.18.0-rc2+ #50 > > > > [ 0.000000] Stack from 00401f2c: > > > > [ 0.000000] 00401f2c 001116cb 007ed080 00401f40 000e20e6 00401f54 > > > > 0004df14 00000000 > > > > [ 0.000000] 007ed080 007ed000 00401f5c 0004df8c 00401f90 0004e982 > > > > 00000044 00401fd1 > > > > [ 0.000000] 007ed000 007ed000 00000000 00000004 00000008 00000000 > > > > 00000003 00000011 > > > > [ 0.000000] > > > > [ 0.000000] Call Trace: > > > > [ 0.000000] [<000e20e6>] [<0004df14>] [<0004df8c>] [<0004e982>] > > > > [ 0.000000] [<00051a28>] [<00001000>] [<00000100>] > > > > [ 0.000000] Disabling lock debugging due to kernel taint > > > > > > > > With v4.13 I was able to get to "no valid init found". > > > > > > > > I had a quick look at h8300 memory initialization and it seems it has > > > > starting pfn set to 0 while fdt defines memory start at 4M. > > > > > > Perhaps there's another issue. > > In my setup this is caused by __ffs() clobbering start pfn in > nobootmem.c::__free_pages_memory(). > > If I change the __ffs() implementation from the inline assembly to generic > bitops everything is fine. > > I'm using gcc 8.1.0 from [1] and gdb 8.1.0.20180625-git OK. fixed. The declaration of the destroyed register was insufficient. It works fine with NO_BOOTMEM. > [1] http://cdn.kernel.org/pub/tools/crosstool/files/bin/x86_64/ > > > -- > Sincerely yours, > -- Yosinori Sato