From patchwork Tue May 28 20:35:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 2626261 Return-Path: X-Original-To: patchwork-linux-parisc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 68B2B3FDBC for ; Tue, 28 May 2013 20:36:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756005Ab3E1Uf7 (ORCPT ); Tue, 28 May 2013 16:35:59 -0400 Received: from mout.gmx.net ([212.227.17.22]:58024 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755999Ab3E1Uf7 (ORCPT ); Tue, 28 May 2013 16:35:59 -0400 Received: from mailout-de.gmx.net ([10.1.76.4]) by mrigmx.server.lan (mrigmx002) with ESMTP (Nemesis) id 0MQbrP-1Ur9vs39Yb-00U1jM for ; Tue, 28 May 2013 22:35:57 +0200 Received: (qmail invoked by alias); 28 May 2013 20:35:57 -0000 Received: from p54AD2792.dip0.t-ipconnect.de (EHLO p100.box) [84.173.39.146] by mail.gmx.net (mp004) with SMTP; 28 May 2013 22:35:57 +0200 X-Authenticated: #1045983 X-Provags-ID: V01U2FsdGVkX19CI79YsCxCcx/d8tOmwnCpY/pWr4R4U3K4QVTd9h XOWyS1bibJJD8w Date: Tue, 28 May 2013 22:35:54 +0200 From: Helge Deller To: linux-parisc@vger.kernel.org, James Bottomley Subject: [PATCH] parisc: fix kernel BUG at arch/parisc/include/asm/mmzone.h:50 Message-ID: <20130528203554.GA18344@p100.box> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Y-GMX-Trusted: 0 Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org With CONFIG_DISCONTIGMEM=y and multiple physical memory areas, cat /proc/kpageflags triggers this kernel bug: kernel BUG at arch/parisc/include/asm/mmzone.h:50! CPU: 2 PID: 7848 Comm: cat Tainted: G D W 3.10.0-rc3-64bit #44 IAOQ[0]: kpageflags_read0x128/0x238 IAOQ[1]: kpageflags_read0x12c/0x238 RP(r2): proc_reg_read0xbc/0x130 Backtrace: [<00000000402ca2d4>] proc_reg_read0xbc/0x130 [<0000000040235bcc>] vfs_read0xc4/0x1d0 [<0000000040235f0c>] SyS_read0x94/0xf0 [<0000000040105fc0>] syscall_exit0x0/0x14 kpageflags_read() walks through the whole memory, even if some memory areas are physically not available. So, we should better not BUG on an unavailable pfn in pfn_to_nid() but just return the expected value -1 or 0. Signed-off-by: Helge Deller --- To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/parisc/include/asm/mmzone.h b/arch/parisc/include/asm/mmzone.h index 0e625ab..cc50d33 100644 --- a/arch/parisc/include/asm/mmzone.h +++ b/arch/parisc/include/asm/mmzone.h @@ -39,17 +39,14 @@ extern unsigned char pfnnid_map[PFNNID_MAP_MAX]; static inline int pfn_to_nid(unsigned long pfn) { unsigned int i; - unsigned char r; if (unlikely(pfn_is_io(pfn))) return 0; i = pfn >> PFNNID_SHIFT; BUG_ON(i >= ARRAY_SIZE(pfnnid_map)); - r = pfnnid_map[i]; - BUG_ON(r == 0xff); - return (int)r; + return (int)pfnnid_map[i]; } static inline int pfn_valid(int pfn)