Re: [PATCH 08/10] NOTIFIER: Take over TIF_MCE_NOTIFY and implement task return notifier

Avi Kivity
2011-06-13T16:32:18Z

On 06/13/2011 06:12 PM, Borislav Petkov wrote:
> > The best you can do is IPI everyone as soon as you've caught the #MC,
> > but you have to be prepared for multiple #MC for the same page. Once
> > you have that, global synchronization is not so important anymore.
>
> Yeah, in the multiple #MC case the memory_failure() thing should
> probably be made reentrant-safe (if it is not yet). And in that case,
> we'll be starting a worker thread on each CPU that caused an MCE from
> accessing that page. The thread that manages to clear all the mappings
> of our page simply does so while the others should be able to 'see' that
> there's no work to be done anymore (PFN is not mapped in the pagetables
> anymore) and exit without doing anything. Yeah, sounds doable with the
> irq_work_queue -> user_return_notifier flow.

I don't think a user_return_notifier is needed here. You don't just
want to do things before a userspace return, you also want to do them
soon. A user return notifier might take a very long time to run, if a
context switch occurs to a thread that spends a lot of time in the
kernel (perhaps a realtime thread).

So I think the best choice here is MCE -> irq_work -> realtime kernel
thread (or work queue)

--
error compiling committee.c: too many arguments to function