linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jiaqi Yan <jiaqiyan@google.com>
To: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Liu Shixin <liushixin2@huawei.com>,
	 Miaohe Lin <linmiaohe@huawei.com>,
	Muchun Song <muchun.song@linux.dev>,
	 Naoya Horiguchi <naoya.horiguchi@nec.com>,
	Tony Luck <tony.luck@intel.com>,
	 linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH -next] mm: hwpoison: support recovery from HugePage copy-on-write faults
Date: Thu, 13 Apr 2023 05:57:17 -0700	[thread overview]
Message-ID: <CACw3F53m3SNhe7gVZ7W4RKcEffAK98en3ZUZw1NknF=iDH+1OA@mail.gmail.com> (raw)
In-Reply-To: <20230412181350.GA22818@monkey>

[-- Attachment #1: Type: text/plain, Size: 2838 bytes --]

On Wed, Apr 12, 2023 at 11:14 AM Mike Kravetz <mike.kravetz@oracle.com>
wrote:

> On 04/11/23 17:27, Liu Shixin wrote:
> > Patch a873dfe1032a ("mm, hwpoison: try to recover from copy-on write
> faults")
> > introduced a new copy_user_highpage_mc() function, and fix the kernel
> crash
> > when the kernel is copying a normal page as the result of a copy-on-write
> > fault and runs into an uncorrectable error. But it doesn't work for
> HugeTLB.
>
> Andrew asked about user-visible effects.  Perhaps, a better way of
> stating this in the commit message might be:
>
> Commit a873dfe1032a ("mm, hwpoison: try to recover from copy-on write
> faults") introduced the routine copy_user_highpage_mc() to gracefully
> handle copying of user pages with uncorrectable errors.  Previously,
> such copies would result in a kernel crash.  hugetlb has separate code
> paths for copy-on-write and does not benefit from the changes made in
> commit a873dfe1032a.
>
> Modify hugetlb copy-on-write code paths to use copy_mc_user_highpage()
> so that they can also gracefully handle uncorrectable errors in user
> pages.  This involves changing the hugetlb specific routine
> ?copy_user_folio()? from type void to int so that it can return an error.
> Modify the hugetlb userfaultfd code in the same way so that it can return
> -EHWPOISON if it encounters an uncorrectable error.
>
> NOTE - There is still some churn in the series that introduces
> copy_user_folio() and the name may change.
>
> > This is to support HugeTLB by using copy_mc_user_highpage() in
> copy_subpage()
> > and copy_user_gigantic_page() too.
> >
> > Moreover, this is also used by userfaultfd, it will return -EHWPOISON if
> > running into an uncorrectable error.
> >
> > Signed-off-by: Liu Shixin <liushixin2@huawei.com>
> > ---
> >  include/linux/mm.h |  6 ++---
> >  mm/hugetlb.c       | 19 +++++++++++----
> >  mm/memory.c        | 59 +++++++++++++++++++++++++++++-----------------
> >  3 files changed, 56 insertions(+), 28 deletions(-)
>
> Code changes look good to me.
>
> Acked-by: Mike Kravetz <mike.kravetz@oracle.com>
>
> Related question perhaps for Tony not directly impacting this patch.
> This patch touches the hugetlb clear page paths withour consequence.
>
> Just wondering if we can/should create something like
> clear_mc_user_highpage
> to address clearing pages as well?  Apologies if this was previously
> discussed.


Tony may have better answers but allow me to chime in for this question:
Memory related #MC only happens when kernel reads encounter hw
uncorrectbale memory errors. Writes(clearing memory page) are “safe” to
kernel, at least generating no #MC. So I don’t think clear_user_highpage
needs a #MC handled version (or even possible at all).


> --
> Mike Kravetz
>
>

[-- Attachment #2: Type: text/html, Size: 3735 bytes --]

      parent reply	other threads:[~2023-04-13 12:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-11  9:27 Liu Shixin
2023-04-12  0:26 ` Andrew Morton
2023-04-12 18:13 ` Mike Kravetz
2023-04-12 21:57   ` Andrew Morton
2023-04-12 22:21     ` Mike Kravetz
2023-04-12 22:56       ` Andrew Morton
2023-04-12 23:37         ` Mike Kravetz
2023-04-13  0:47           ` Luck, Tony
2023-04-13  1:55         ` Liu Shixin
2023-04-13  1:51       ` Liu Shixin
2023-04-13  1:49     ` Liu Shixin
2023-04-13 12:57   ` Jiaqi Yan [this message]

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='CACw3F53m3SNhe7gVZ7W4RKcEffAK98en3ZUZw1NknF=iDH+1OA@mail.gmail.com' \
    --to=jiaqiyan@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liushixin2@huawei.com \
    --cc=mike.kravetz@oracle.com \
    --cc=muchun.song@linux.dev \
    --cc=naoya.horiguchi@nec.com \
    --cc=tony.luck@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