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

From: Tong Tiangen
Date: Sat Feb 03 2024 - 02:56:26 EST




在 2024/2/3 6:46, Luck, Tony 写道:
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

The goal of this patch:
When #MC is triggered by copy_mc_user_highpage(), #MC is directly
processed in the synchronously triggered do_machine_check() ->
kill_me_never() -> memory_failure().

And the current handling is to call memory_failure_queue() ->
schedule_work_on() in the execution context, I think that's what
"scheduling someone else to handle it at some future point is risky."

Thanks.
Tong.