linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "HORIGUCHI NAOYA(堀口 直也)" <naoya.horiguchi@nec.com>
To: Miaohe Lin <linmiaohe@huawei.com>
Cc: Naoya Horiguchi <naoya.horiguchi@linux.dev>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@redhat.com>,
	Mike Kravetz <mike.kravetz@oracle.com>,
	Liu Shixin <liushixin2@huawei.com>,
	Yang Shi <shy828301@gmail.com>,
	Oscar Salvador <osalvador@suse.de>,
	Muchun Song <songmuchun@bytedance.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Linux-MM <linux-mm@kvack.org>
Subject: Re: [PATCH v1 5/5] mm, hwpoison: enable memory error handling on 1GB hugepage
Date: Wed, 8 Jun 2022 06:16:36 +0000	[thread overview]
Message-ID: <20220608061635.GA1413099@hori.linux.bs1.fc.nec.co.jp> (raw)
In-Reply-To: <ff58b65d-e55d-04c0-e26d-3c92830b5912@huawei.com>

On Tue, Jun 07, 2022 at 10:11:24PM +0800, Miaohe Lin wrote:
> On 2022/6/2 13:06, Naoya Horiguchi wrote:
> > From: Naoya Horiguchi <naoya.horiguchi@nec.com>
> > 
> > Now error handling code is prepared, so remove the blocking code and
> > enable memory error handling on 1GB hugepage.
> > 
> 
> I'm nervous about this change. It seems there are many code paths not awared of pud swap entry.
> I browsed some of them:
> apply_to_pud_range called from apply_to_page_range:
> 
> apply_to_pud_range:
> 	next = pud_addr_end(addr, end);
> 	if (pud_none(*pud) && !create)
> 		continue;
> 	if (WARN_ON_ONCE(pud_leaf(*pud)))
> 		return -EINVAL;
> 	if (!pud_none(*pud) && WARN_ON_ONCE(pud_bad(*pud))) {
> 		if (!create)
> 			continue;
> 		pud_clear_bad(pud);
> 	}
> 	err = apply_to_pmd_range(mm, pud, addr, next,
> 				 fn, data, create, mask);
> 
> For !pud_present case, it will mostly reach apply_to_pmd_range and call pmd_offset on it. And invalid
> pointer will be de-referenced.

apply_to_pmd_range() has BUG_ON(pud_huge(*pud)) and apply_to_pte_range() has
BUG_ON(pmd_huge(*pmd)), so this page table walking code seems to not expect
to handle pmd/pud level mapping.

> 
> Another example might be copy_pud_range and so on. So I think it might not be prepared to enable the
> 1GB hugepage or all of these places should be fixed?

I think that most of page table walker for user address space should first
check is_vm_hugetlb_page() and call hugetlb specific walking code for vma
with VM_HUGETLB.
copy_page_range() is a good example.  It calls copy_hugetlb_page_range()
for vma with VM_HUGETLB and the function should support hwpoison entry.
But I feel that I need testing for confirmation.

And I'm not sure that all other are prepared for non-present pud-mapping,
so I'll need somehow code inspection and testing for each.

Thanks,
Naoya Horiguchi

  reply	other threads:[~2022-06-08  6:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-02  5:06 [PATCH v1 0/5] mm, hwpoison: enable 1GB hugepage support Naoya Horiguchi
2022-06-02  5:06 ` [PATCH v1 1/5] mm, hwpoison, hugetlb: introduce SUBPAGE_INDEX_HWPOISON to save raw error page Naoya Horiguchi
2022-06-07 12:45   ` Miaohe Lin
2022-06-07 13:04   ` David Hildenbrand
2022-06-08  1:31     ` HORIGUCHI NAOYA(堀口 直也)
2022-06-08  9:19       ` David Hildenbrand
2022-06-02  5:06 ` [PATCH v1 2/5] mm,hwpoison: set PG_hwpoison for busy hugetlb pages Naoya Horiguchi
2022-06-07 12:50   ` Miaohe Lin
2022-06-02  5:06 ` [PATCH v1 3/5] mm, hwpoison: make __page_handle_poison returns int Naoya Horiguchi
2022-06-07 12:54   ` Miaohe Lin
2022-06-08  1:40     ` HORIGUCHI NAOYA(堀口 直也)
2022-06-02  5:06 ` [PATCH v1 4/5] mm, hwpoison: skip raw hwpoison page in freeing 1GB hugepage Naoya Horiguchi
2022-06-07 13:56   ` Miaohe Lin
2022-06-02  5:06 ` [PATCH v1 5/5] mm, hwpoison: enable memory error handling on " Naoya Horiguchi
2022-06-07 14:11   ` Miaohe Lin
2022-06-08  6:16     ` HORIGUCHI NAOYA(堀口 直也) [this message]
2022-06-08 12:57       ` Miaohe Lin
2022-06-09  8:45         ` HORIGUCHI NAOYA(堀口 直也)
2022-06-09 11:28           ` Miaohe Lin

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=20220608061635.GA1413099@hori.linux.bs1.fc.nec.co.jp \
    --to=naoya.horiguchi@nec.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --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=naoya.horiguchi@linux.dev \
    --cc=osalvador@suse.de \
    --cc=shy828301@gmail.com \
    --cc=songmuchun@bytedance.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;
as well as URLs for NNTP newsgroup(s).