Re: [PATCH] mm,hwpoison: return -EBUSY when page already poisoned

From: Aili Yao
Date: Wed Mar 31 2021 - 06:57:27 EST


On Thu, 25 Feb 2021 12:39:30 +0100
Oscar Salvador <osalvador@xxxxxxx> wrote:

> On Thu, Feb 25, 2021 at 11:28:18AM +0000, HORIGUCHI NAOYA(堀口 直也) wrote:
> > Hi Aili,
> >
> > I agree that this set_mce_nospec() is not expected to be called for
> > "already hwpoisoned" page because in the reported case the error
> > page is already contained and no need to resort changing cache mode.
>
> Out of curiosity, what is the current behavour now?
> Say we have an ongoing MCE which has marked the page as HWPoison but
> memory_failure did not take any action on the page yet.
> And then, we have another MCE, which ends up there.
> set_mce_nospec might clear _PAGE_PRESENT bit.
>
> Does that have any impact on the first MCE?
>
> > It seems to me that memory_failure() does not return MF_XXX. But yes,
> > returning some positive value for the reported case could be a solution.
>
> No, you are right. I somehow managed to confuse myself.
> I see now that MF_XXX return codes are filtered out in page_action.
>
> > We could use some negative value (error code) to report the reported case,
> > then as you mentioned above, some callers need change to handle the
> > new case, and the same is true if you use some positive value.
> > My preference is -EHWPOISON, but other options are fine if justified well.
>
> -EHWPOISON seems like a good fit.
>

Hi Oscar, david:

Long away fron this topic, but i noticed today I made a stupid mistake that EHWPOISON is already
been declared, so we should better return EHWPOISON for this case.

Really sorry for this!

As the patch is still under review, I will post a new version for this, if I change this, may I add
your review tag here please?

--
Thanks!
Aili Yao