mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Huang Ying <ying.huang@intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andi Kleen <andi@firstfloor.org>, Avi Kivity <avi@redhat.com>
Subject: Re: [PATCH 1/2] mm, Make __get_user_pages return -EHWPOISON for HWPOISON page
Date: Tue, 27 Apr 2010 14:47:23 -0700	[thread overview]
Message-ID: <20100427144723.a8c3d997.akpm@linux-foundation.org> (raw)
In-Reply-To: <1272351858.24125.14.camel@yhuang-dev.sh.intel.com>

On Tue, 27 Apr 2010 15:04:18 +0800
Huang Ying <ying.huang@intel.com> wrote:

> With this patch, the caller of __get_user_pages can distinguish
> HWPOISON page from general FAULT page. This 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.
> 
> Signed-off-by: Huang Ying <ying.huang@intel.com>
> ---
>  include/asm-generic/errno.h |    2 ++
>  mm/memory.c                 |    5 +++--
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> --- a/include/asm-generic/errno.h
> +++ b/include/asm-generic/errno.h
> @@ -108,4 +108,6 @@
>  
>  #define ERFKILL		132	/* Operation not possible due to RF-kill */
>  
> +#define EHWPOISON	133	/* Memory page has hardware error */
> +
>  #endif
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -1432,9 +1432,10 @@ int __get_user_pages(struct task_struct
>  				if (ret & VM_FAULT_ERROR) {
>  					if (ret & VM_FAULT_OOM)
>  						return i ? i : -ENOMEM;
> -					if (ret &
> -					    (VM_FAULT_HWPOISON|VM_FAULT_SIGBUS))
> +					if (ret & VM_FAULT_SIGBUS)
>  						return i ? i : -EFAULT;
> +					if (ret & VM_FAULT_HWPOISON)
> +						return i ? i : -EHWPOISON;
>  					BUG();
>  				}
>  				if (ret & VM_FAULT_MAJOR)
> 

This will cause various code paths (eg: fs/direct-io.c) to return
-EHWPOISON to userspace, will it not?


  reply	other threads:[~2010-04-27 21:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-27  7:04 Huang Ying
2010-04-27 21:47 ` Andrew Morton [this message]
2010-04-28  1:50   ` Huang Ying
2010-04-27 22:56     ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100427144723.a8c3d997.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=avi@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ying.huang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome