Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760624AbZFIMfT (ORCPT ); Tue, 9 Jun 2009 08:35:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753877AbZFIMfI (ORCPT ); Tue, 9 Jun 2009 08:35:08 -0400 Received: from mga03.intel.com ([143.182.124.21]:51579 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752208AbZFIMfG (ORCPT ); Tue, 9 Jun 2009 08:35:06 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.41,331,1241420400"; d="scan'208";a="152239181" Date: Tue, 9 Jun 2009 20:34:16 +0800 From: Wu Fengguang To: Nick Piggin Cc: Andi Kleen , "akpm@linux-foundation.org" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" Subject: [PATCH] HWPOISON: define VM_FAULT_HWPOISON to 0 when feature is disabled Message-ID: <20090609123416.GD5589@localhost> References: <20090603846.816684333@firstfloor.org> <20090603184640.4FD751D0290@basil.firstfloor.org> <20090609095423.GB14820@wotan.suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090609095423.GB14820@wotan.suse.de> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2393 Lines: 75 On Tue, Jun 09, 2009 at 05:54:23PM +0800, Nick Piggin wrote: > On Wed, Jun 03, 2009 at 08:46:40PM +0200, Andi Kleen wrote: > > - force_sig_info_fault(SIGBUS, BUS_ADRERR, address, tsk); > > +#ifdef CONFIG_MEMORY_FAILURE > > + if (fault & VM_FAULT_HWPOISON) { > > + printk(KERN_ERR > > + "MCE: Killing %s:%d due to hardware memory corruption fault at %lx\n", > > + tsk->comm, tsk->pid, address); > > + code = BUS_MCEERR_AR; > > + } > > +#endif > > If you make VM_FAULT_HWPOISON 0 when !CONFIG_MEMORY_FAILURE, then > you can remove this ifdef, can't you? Sure we can. Here is the incremental patch. --- HWPOISON: define VM_FAULT_HWPOISON to 0 when feature is disabled So as to eliminate one #ifdef in the c source. Proposed by Nick Piggin. CC: Nick Piggin Signed-off-by: Wu Fengguang --- arch/x86/mm/fault.c | 3 +-- include/linux/mm.h | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) --- sound-2.6.orig/arch/x86/mm/fault.c +++ sound-2.6/arch/x86/mm/fault.c @@ -819,14 +819,13 @@ do_sigbus(struct pt_regs *regs, unsigned tsk->thread.error_code = error_code; tsk->thread.trap_no = 14; -#ifdef CONFIG_MEMORY_FAILURE if (fault & VM_FAULT_HWPOISON) { printk(KERN_ERR "MCE: Killing %s:%d due to hardware memory corruption fault at %lx\n", tsk->comm, tsk->pid, address); code = BUS_MCEERR_AR; } -#endif + force_sig_info_fault(SIGBUS, code, address, tsk); } --- sound-2.6.orig/include/linux/mm.h +++ sound-2.6/include/linux/mm.h @@ -702,11 +702,16 @@ static inline int page_mapped(struct pag #define VM_FAULT_SIGBUS 0x0002 #define VM_FAULT_MAJOR 0x0004 #define VM_FAULT_WRITE 0x0008 /* Special case for get_user_pages */ -#define VM_FAULT_HWPOISON 0x0010 /* Hit poisoned page */ #define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */ #define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */ +#ifdef CONFIG_MEMORY_FAILURE +#define VM_FAULT_HWPOISON 0x0010 /* Hit poisoned page */ +#else +#define VM_FAULT_HWPOISON 0 +#endif + #define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_HWPOISON) /* -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/