RE: [PATCH v2 4/5] mm/hwpoison: Fix incorrect "not recovered" report for recovered clean pages

From: Luck, Tony
Date: Wed Feb 19 2025 - 12:44:33 EST


> > The caller kill_me_maybe will do set_mce_nospec + sync_core again.
> >
> > static void kill_me_maybe(struct callback_head *cb)
> > {
> > struct task_struct *p = container_of(cb, struct task_struct, mce_kill_me);
> > int flags = MF_ACTION_REQUIRED;
> > ...
> > ret = memory_failure(pfn, flags);
> > if (!ret) {
> > set_mce_nospec(pfn);
> > sync_core();
> > return;
> > }
> >
> > Is this expected?
> >
>
> the second set_mce_nospec do nothing and have no side affect.
>
> sync_core() is introduced by Tony [1]:
>
> Also moved sync_core(). The comments for this function say that it should
> only be called when instructions have been changed/re-mapped. Recovery for
> an instruction fetch may change the physical address. But that doesn't happen
> until the scheduled work runs (which could be on another CPU).
>
> [1]https://lore.kernel.org/all/20200824221237.5397-1-tony.luck@xxxxxxxxx/T/#u
>
> IMHO, I think it also has no side affect.
>
> @Tony, could you help to confirm this?

Correct. Re-runing these calls is harmless.

-Tony