[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20101027092135.GE2472@basil.fritz.box>
Date: Wed, 27 Oct 2010 11:21:35 +0200
From: Andi Kleen <andi@...stfloor.org>
To: Ingo Molnar <mingo@...e.hu>
Cc: Andi Kleen <andi@...stfloor.org>, torvalds@...ux-foundation.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
n-horiguchi@...jp.nec.com, x86@...nel.org
Subject: Re: [GIT PULL] Please pull hwpoison updates for 2.6.37
On Wed, Oct 27, 2010 at 11:09:03AM +0200, Ingo Molnar wrote:
>
> * Andi Kleen <andi@...stfloor.org> wrote:
>
> > > You are welcome! How about the cleanliness feedback that i gave?
> > > (the stuff in parentheses)
> >
> > Could move the ifdef into mm.h for the flags and let the optimizer
> > eliminate the code. I can do that in a followup patch.
>
> Yeah. If it does not work out due to architectural differences then
> do not push it too hard (the code is small enough) - we only want to
> factor this out if it makes things cleaner.
Here's the patch I came up with. I'll keep it in my tree for now.
-Andi
---
x86/HWPOISON: Move do_sigbus ifdef into header
Ingo asked for moving the MEMORY_FAILURE ifdef in the x86's
fault handler's do_sigbus elsewhere. This patch moves the
ifdef into mm.h by defining the HWPOISON return flags
of handle_mm_fault() to 0 if MEMORY_FAILURE is not enabled.
This way the optimizer can eliminate the code without ifdef.
Reported-by: Ingo Molnar <mingo@...e.hu>
Signed-off-by: Andi Kleen <ak@...ux.intel.com>
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 852b319..8b76d79 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -812,14 +812,12 @@ do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
tsk->thread.error_code = error_code;
tsk->thread.trap_no = 14;
-#ifdef CONFIG_MEMORY_FAILURE
if (fault & (VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) {
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, fault);
}
diff --git a/include/linux/mm.h b/include/linux/mm.h
index a4c6684..d9a6af5 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -718,8 +718,13 @@ static inline int page_mapped(struct page *page)
#define VM_FAULT_SIGBUS 0x0002
#define VM_FAULT_MAJOR 0x0004
#define VM_FAULT_WRITE 0x0008 /* Special case for get_user_pages */
+#ifdef CONFIG_MEMORY_FAILURE
#define VM_FAULT_HWPOISON 0x0010 /* Hit poisoned small page */
#define VM_FAULT_HWPOISON_LARGE 0x0020 /* Hit poisoned large page. Index encoded in upper bits */
+#else
+#define VM_FAULT_HWPOISON 0
+#define VM_FAULT_HWPOISON_LARGE 0
+#endif
#define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */
#define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */
--
ak@...ux.intel.com -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists