RE: [PATCH -next v4 2/3] x86/mce: rename MCE_IN_KERNEL_COPYIN to MCE_IN_KERNEL_COPY_MC

From: Luck, Tony
Date: Fri Feb 02 2024 - 17:46:45 EST


> Now, since you're explaining things today :) pls explain to me what this
> patchset is all about? You having reviewed patch 3 and all?
>
> Why is this pattern:
>
> if (copy_mc_user_highpage(dst, src, addr, vma)) {
> memory_failure_queue(page_to_pfn(src), 0);
>
> not good anymore?
>
> Or is the goal here to poison straight from the #MC handler and not
> waste time and potentially get another #MC while memory_failure_queue()
> on the source address is done?
>
> Or something completely different?

See the comment above memory_failure_queue()

* The function is primarily of use for corruptions that
* happen outside the current execution context (e.g. when
* detected by a background scrubber)

In the copy_mc_user_highpage() case the fault happens in
the current execution context. So scheduling someone else
to handle it at some future point is risky. Just deal with it
right away.

-Tony