On Mon, 19 Apr 2021 11:36:58 +0900 Naoya Horiguchi <nao.horiguchi@xxxxxxxxx> wrote: > > > 2. In the function hwpoison_pte_range(): > > > if (pfn <= hwp->pfn && hwp->pfn < pfn + PMD_SIZE) this check seem we should use PMD_SIZE/PAGE_SIZE or some macro like this? > > > > Thanks, that's right. HPAGE_PMD_NR seems to fit here. > > We also need "#ifdef CONFIG_TRANSPARENT_HUGEPAGE" to use it. > > I found that the #ifdef is not necessary because the whole > "if (ptl)" is compiled out. So I don't add #ifdef. > > Here's the v2 of 3/3. > > Aili, could you test with it? > > Thanks, > Naoya Horiguchi > I tested this v2 version, In my test, this patches worked as expected and the previous issues didn't happen again. Test-by: Aili Yao <yaoaili@xxxxxxxxxxxx> Thanks, Aili Yao > ----- > From: Naoya Horiguchi <naoya.horiguchi@xxxxxxx> > Date: Tue, 13 Apr 2021 07:26:25 +0900 > Subject: [PATCH v2 3/3] mm,hwpoison: add kill_accessing_process() to find error > virtual address > > The previous patch solves the infinite MCE loop issue when multiple > MCE events races. The remaining issue is to make sure that all threads > processing Action Required MCEs send to the current processes the > SIGBUS with the proper virtual address and the error size. > > This patch suggests to do page table walk to find the error virtual > address. If we find multiple virtual addresses in walking, we now can't > determine which one is correct, so we fall back to sending SIGBUS in > kill_me_maybe() without error info as we do now. This corner case needs > to be solved in the future. > > Signed-off-by: Naoya Horiguchi <naoya.horiguchi@xxxxxxx> > --- > change log v1 -> v2: > - initialize local variables in check_hwpoisoned_entry() and > hwpoison_pte_range() > - fix and improve logic to calculate error address offset. > --- > arch/x86/kernel/cpu/mce/core.c | 13 ++- > include/linux/swapops.h | 5 ++ > mm/memory-failure.c | 147 ++++++++++++++++++++++++++++++++- > 3 files changed, 161 insertions(+), 4 deletions(-) >