Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp663888ybt; Wed, 8 Jul 2020 08:45:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhLLfjOjwNFJ7t3f8QMo5JxL9XPAeVbj2dlmy4zc84t06q8fkXpI3wfCycXHaqCo17CJlt X-Received: by 2002:aa7:d50d:: with SMTP id y13mr67179369edq.230.1594223113042; Wed, 08 Jul 2020 08:45:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594223113; cv=none; d=google.com; s=arc-20160816; b=bkuBGlw7SSTXicPe68uht5KqHVSyS2dCJdn2a5fmpIoSXHDL5oCdLoi82ZSlbnzg+T OZkgiOixShHdp0Q8kwd8lwQ+hk7U9rcsebiz+uKS3lu//7164lK7AlTYKe+i0JkZCzBJ i7u9gGy8Ktz/7gUTpsYNOUbANX6TJMRLr9py+yBsFBWc1jmXemE4QrklOavtXgfwj/a8 KCE/N520LwLQXUW55P54I+bfgziWHcKPwEVOUpTnCo8qGvTnxE8y3xFAvlHmBI2ej+6H 5Rv6Iir69W0++xUY7Wpbg7c0CpBgKJ3MbhxGyt7hkeITJbdU6rJRqyA16NwFT9aY5aZJ zyPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5J+E9M80APltcRsyi5XIy9MC6DnDidJsMWP2eZYrTec=; b=c7hWw7soXqo2wT8krB7705WrLLdizdUyRqtEp+yMO3TkAv1SpKaNbmrgUh4iWdXO8f rYx6li3vSKB0dE6Vd6NDYjy9ot6KAfO9Gzal4vXFOAuDbjXCqkpC/sXTZ8oF5/xpkJeg fIsXeU4YC+jxKvXTAPhmow/4yb9joTjKjcXp0pE/qN6mbOeDSSHJ1RPkOA/+l+AZsLPf zToFzesIuTFHF3353Ivjwvmd4iv84g+HJGTRNcw/WUCUnwdF610k6X0djeRuSoV6dDKl O6jtJ6afNC6lILuVccWnfevilEqP045q8HI+QyL4GqPJ6JrupDeMcSjqnSMvv5pyti44 lRuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xuvixON5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c95si230379edf.304.2020.07.08.08.44.50; Wed, 08 Jul 2020 08:45:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xuvixON5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730490AbgGHPlj (ORCPT + 99 others); Wed, 8 Jul 2020 11:41:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:48176 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730460AbgGHPld (ORCPT ); Wed, 8 Jul 2020 11:41:33 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CC8A620870; Wed, 8 Jul 2020 15:41:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594222892; bh=45jm8z0oH/KPMCdl/hxMxI2KDUiB/6BgrBctVihFt0Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xuvixON59YIyX/y2eEEdXZpF5upnYeOOiEYdwz4ee2JMOOyhLgj/DNAE3E0Mv4flG 5sdFe1oXwntGj83UG659QCqAvUK3zQ5cci8eA3mAya8/bSmI0bXRZ1yJgYf6YzwGm7 cCJJ7NJWr5mAgj7zul7JC0zESwk2lGFskjq/5Q04= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mike Rapoport , Greg Ungerer , Sasha Levin , linux-m68k@lists.linux-m68k.org Subject: [PATCH AUTOSEL 5.7 12/30] m68k: nommu: register start of the memory with memblock Date: Wed, 8 Jul 2020 11:40:58 -0400 Message-Id: <20200708154116.3199728-12-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200708154116.3199728-1-sashal@kernel.org> References: <20200708154116.3199728-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Rapoport [ Upstream commit d63bd8c81d8ab64db506ffde569cc8ff197516e2 ] The m68k nommu setup code didn't register the beginning of the physical memory with memblock because it was anyway occupied by the kernel. However, commit fa3354e4ea39 ("mm: free_area_init: use maximal zone PFNs rather than zone sizes") changed zones initialization to use memblock.memory to detect the zone extents and this caused inconsistency between zone PFNs and the actual PFNs: BUG: Bad page state in process swapper pfn:20165 page:41fe0ca0 refcount:0 mapcount:1 mapping:00000000 index:0x0 flags: 0x0() raw: 00000000 00000100 00000122 00000000 00000000 00000000 00000000 00000000 page dumped because: nonzero mapcount CPU: 0 PID: 1 Comm: swapper Not tainted 5.8.0-rc1-00001-g3a38f8a60c65-dirty #1 Stack from 404c9ebc: 404c9ebc 4029ab28 4029ab28 40088470 41fe0ca0 40299e21 40299df1 404ba2a4 00020165 00000000 41fd2c10 402c7ba0 41fd2c04 40088504 41fe0ca0 40299e21 00000000 40088a12 41fe0ca0 41fe0ca4 0000020a 00000000 00000001 402ca000 00000000 41fe0ca0 41fd2c10 41fd2c10 00000000 00000000 402b2388 00000001 400a0934 40091056 404c9f44 404c9f44 40088db4 402c7ba0 00000001 41fd2c04 41fe0ca0 41fd2000 41fe0ca0 40089e02 4026ecf4 40089e4e 41fe0ca0 ffffffff Call Trace: [<40088470>] 0x40088470 [<40088504>] 0x40088504 [<40088a12>] 0x40088a12 [<402ca000>] 0x402ca000 [<400a0934>] 0x400a0934 Adjust the memory registration with memblock to include the beginning of the physical memory and make sure that the area occupied by the kernel is marked as reserved. Signed-off-by: Mike Rapoport Signed-off-by: Greg Ungerer Signed-off-by: Sasha Levin --- arch/m68k/kernel/setup_no.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c index a63483de7a422..5dacba392c74e 100644 --- a/arch/m68k/kernel/setup_no.c +++ b/arch/m68k/kernel/setup_no.c @@ -139,7 +139,8 @@ void __init setup_arch(char **cmdline_p) pr_debug("MEMORY -> ROMFS=0x%p-0x%06lx MEM=0x%06lx-0x%06lx\n ", __bss_stop, memory_start, memory_start, memory_end); - memblock_add(memory_start, memory_end - memory_start); + memblock_add(_rambase, memory_end - _rambase); + memblock_reserve(_rambase, memory_start - _rambase); /* Keep a copy of command line */ *cmdline_p = &command_line[0]; -- 2.25.1