linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: 黄秋钧 <hqjagain@gmail.com>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Cc: akpm@linux-foundation.org, ira.weiny@intel.com, jgg@ziepe.ca,
	 dan.j.williams@intel.com, rppt@linux.ibm.com,
	jhubbard@nvidia.com,  keith.busch@intel.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] mm:fix gup_pud_range
Date: Sat, 21 Sep 2019 00:32:38 +0800	[thread overview]
Message-ID: <CAJRQjocKqUSZJE5n8OG3F-ZOr5pDD0Q4CmiLOkVN=jGuEBYpPA@mail.gmail.com> (raw)
In-Reply-To: <2b9d2a82-ad48-f493-b53e-b34de28980c7@linux.ibm.com>

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

>On Fri, Sep 20, 2019 at 11:58 PM Aneesh Kumar K.V <
aneesh.kumar@linux.ibm.com> wrote:

> >On 9/20/19 9:21 PM, Qiujun Huang wrote:
> >> __get_user_pages_fast try to walk the page table but the
> > >hugepage pte is replace by hwpoison swap entry by mca path.
> > >...
> >
> >

 >Can you describe this in more details. I guess you are facing the issue

> >with respect PUD level PTE entry that got updated by hwpoison as a swap
> >entry. Since we don't specifically check for pud_present(), we walk the
> >page table with wrong values and that results in corruption?
>

Yes, in the case using 2G hugepage.

>
>
> >> [15798.177437] mce: Uncorrected hardware memory error in
> >>                               user-access at 224f1761c0
> > >[15798.180171] MCE 0x224f176: Killing pal_main:6784 due to
> > >                              hardware memory corruption
> > >[15798.180176] MCE 0x224f176: Killing qemu-system-x86:167336
> > >                             due to hardware memory corruption
> >> ...
> >> [15798.180206] BUG: unable to handle kernel
> >> [15798.180226] paging request at ffff891200003000
> >> [15798.180236] IP: [<ffffffff8106edae>] gup_pud_range+
> >>                               0x13e/0x1e0
> >> ...
> >>
> >> We need to skip the hwpoison entry in gup_pud_range.
> >>
> >> Signed-off-by: Qiujun Huang <hqjagain@gmail.com>
> >> ---
> >>   mm/gup.c | 2 ++
> >>   1 file changed, 2 insertions(+)
> >>
> >> diff --git a/mm/gup.c b/mm/gup.c
> >> index 98f13ab..6157ed9 100644
> >> --- a/mm/gup.c
> >> +++ b/mm/gup.c
> >> @@ -2230,6 +2230,8 @@ static int gup_pud_range(p4d_t p4d, unsigned long
> addr, unsigned long end,
> >>               next = pud_addr_end(addr, end);
> >>               if (pud_none(pud))
> >>                       return 0;
> >> +             if (unlikely(!pud_present(pud)))
> >> +                     return 0;
>
>
>You should be able to remove that if (pud_none(pud)) check and just keep
> >the pud_present() check?
>
 indeed

>
> >>               if (unlikely(pud_huge(pud))) {
> >>                       if (!gup_huge_pud(pud, pudp, addr, next, flags,
> >>                                         pages, nr))
> >>
>
>
diff --git a/mm/gup.c b/mm/gup.c
index 98f13ab..2e3a1d3 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -2228,7 +2228,7 @@ static int gup_pud_range(p4d_t p4d, unsigned long
addr, unsigned long end,
                pud_t pud = READ_ONCE(*pudp);
                next = pud_addr_end(addr, end);
-               if (pud_none(pud))
+              if (!pud_present(pud))
                        return 0;
                if (unlikely(pud_huge(pud))) {
                        if (!gup_huge_pud(pud, pudp, addr, next, flags,

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

  reply	other threads:[~2019-09-20 16:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-20 15:51 Qiujun Huang
2019-09-20 15:58 ` Aneesh Kumar K.V
2019-09-20 16:32   ` 黄秋钧 [this message]
2019-09-20 19:37 ` John Hubbard
2019-09-21  0:20   ` 黄秋钧
2019-09-21  0:33   ` Qiujun Huang
2019-09-21  1:19     ` John Hubbard
2019-09-21  1:47       ` Qiujun Huang

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='CAJRQjocKqUSZJE5n8OG3F-ZOr5pDD0Q4CmiLOkVN=jGuEBYpPA@mail.gmail.com' \
    --to=hqjagain@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=dan.j.williams@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=jgg@ziepe.ca \
    --cc=jhubbard@nvidia.com \
    --cc=keith.busch@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rppt@linux.ibm.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