mm: make __get_user_pages return -EHWPOISON for HWPOISON page optionally
authorHuang Ying <ying.huang@intel.com>
Sun, 30 Jan 2011 03:15:48 +0000 (11:15 +0800)
committerMarcelo Tosatti <mtosatti@redhat.com>
Thu, 17 Mar 2011 16:08:27 +0000 (13:08 -0300)
commit69ebb83e13e514222b0ae4f8bd813a17679ed876
tree62ccc7ee1e840d0a6cc01a9fc1c44a5f4e6f1edd
parent0014bd990e69063b0fb78940b35439d7980ce3ee
mm: make __get_user_pages return -EHWPOISON for HWPOISON page optionally

Make __get_user_pages return -EHWPOISON for HWPOISON page only if
FOLL_HWPOISON is specified.  With this patch, the interested callers
can distinguish HWPOISON pages from general FAULT pages, while other
callers will still get -EFAULT for all these pages, so the user space
interface need not to be changed.

This feature is needed by KVM, where UCR MCE should be relayed to
guest for HWPOISON page, while instruction emulation and MMIO will be
tried for general FAULT page.

The idea comes from Andrew Morton.

Signed-off-by: Huang Ying <ying.huang@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/alpha/include/asm/errno.h
arch/mips/include/asm/errno.h
arch/parisc/include/asm/errno.h
arch/sparc/include/asm/errno.h
include/asm-generic/errno.h
include/linux/mm.h
mm/memory.c