From: jane.chu@oracle.com
To: Miaohe Lin <linmiaohe@huawei.com>
Cc: willy@infradead.org, peterx@redhat.com,
akpm@linux-foundation.org, kirill.shutemov@linux.intel.com,
hughd@google.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mm: make page_mapped_in_vma() hugetlb walk aware
Date: Tue, 25 Feb 2025 11:56:44 -0800 [thread overview]
Message-ID: <6277f5a3-1d12-4d6e-9fad-9e720876a4ce@oracle.com> (raw)
In-Reply-To: <3f3acf9f-f71d-77a3-ca61-5cc5c6c7f02b@huawei.com>
On 2/24/2025 10:49 PM, Miaohe Lin wrote:
> On 2025/2/25 5:14, Jane Chu wrote:
>> When a process consumes a UE in a page, the memory failure handler
>> attempts to collect information for a potential SIGBUS.
>> If the page is an anonymous page, page_mapped_in_vma(page, vma) is
>> invoked in order to
>> 1. retrieve the vaddr from the process' address space,
>> 2. verify that the vaddr is indeed mapped to the poisoned page,
>> where 'page' is the precise small page with UE.
>>
>> It's been observed that when injecting poison to a non-head subpage
>> of an anonymous hugetlb page, no SIGBUS show up; while injecting to
>> the head page produces a SIGBUS. The casue is that, though hugetlb_walk()
>> returns a valid pmd entry (on x86), but check_pte() detects mismatch
>> between the head page per the pmd and the input subpage. Thus the vaddr
>> is considered not mapped to the subpage and the process is not collected
>> for SIGBUS purpose. This is the calling stack
>> collect_procs_anon
>> page_mapped_in_vma
>> page_vma_mapped_walk
>> hugetlb_walk
>> huge_pte_lock
>> check_pte
>>
>> check_pte() header says that it
>> "check if [pvmw->pfn, @pvmw->pfn + @pvmw->nr_pages) is mapped at the @pvmw->pte"
>> but practically works only if pvmw->pfn is the head page pfn at pvmw->pte.
>> Hindsight acknowledging that some pvmw->pte could point to a hugepage of
>> some sort such that it makes sense to make check_pte() work for hugepage.
> Thanks for your patch. This patch looks good to me.
>
>> Signed-off-by: Jane Chu <jane.chu@oracle.com>
> Is a Fixes tag needed?
I don't have a clear call and here is the reason.
Since the introduction of check_pte() by ace71a19cec5e ("mm: introduce
page_vma_mapped_walk()"), it has carried the assumption that pvmw->page
(later changed to pvmw->pfn) points to the head of a huge page or a
small page and had been used in such way, so that it doesn't really
check whether a given subpage range falls within a huge leaf pte range.
When 376907f3a0b34 ("mm/memory-failure: pass the folio and the page to
collect_procs()") came along, it sort of exposed the latent issue which
hadn't been an issue before.
Thanks!
-jane
>
> Thanks.
> .
next prev parent reply other threads:[~2025-02-25 19:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 21:14 Jane Chu
2025-02-25 6:49 ` Miaohe Lin
2025-02-25 19:56 ` jane.chu [this message]
2025-02-26 15:49 ` David Hildenbrand
2025-02-26 15:53 ` David Hildenbrand
2025-02-26 19:08 ` jane.chu
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=6277f5a3-1d12-4d6e-9fad-9e720876a4ce@oracle.com \
--to=jane.chu@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterx@redhat.com \
--cc=willy@infradead.org \
/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