Commit 69ebb83e authored by Huang Ying's avatar Huang Ying Committed by Marcelo Tosatti
Browse files

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: default avatarHuang Ying <ying.huang@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent 0014bd99
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -122,4 +122,6 @@

#define	ERFKILL		138	/* Operation not possible due to RF-kill */

#define EHWPOISON	139	/* Memory page has hardware error */

#endif
+2 −0
Original line number Diff line number Diff line
@@ -121,6 +121,8 @@

#define	ERFKILL		167	/* Operation not possible due to RF-kill */

#define EHWPOISON	168	/* Memory page has hardware error */

#define EDQUOT		1133	/* Quota exceeded */

#ifdef __KERNEL__
+2 −0
Original line number Diff line number Diff line
@@ -122,4 +122,6 @@

#define	ERFKILL		256	/* Operation not possible due to RF-kill */

#define EHWPOISON	257	/* Memory page has hardware error */

#endif
+2 −0
Original line number Diff line number Diff line
@@ -112,4 +112,6 @@

#define	ERFKILL		134	/* Operation not possible due to RF-kill */

#define EHWPOISON	135	/* Memory page has hardware error */

#endif
+2 −0
Original line number Diff line number Diff line
@@ -108,4 +108,6 @@

#define ERFKILL		132	/* Operation not possible due to RF-kill */

#define EHWPOISON	133	/* Memory page has hardware error */

#endif
Loading