Re: [PATCH v3] x86,mm: print likely CPU at segfault time

From: Ingo Molnar
Date: Sat Aug 06 2022 - 04:59:23 EST



* Ingo Molnar <mingo@xxxxxxxxxx> wrote:

> > instrumentation_begin();
> > - handle_page_fault(regs, error_code, address);
> > + handle_page_fault(regs, error_code, address, cpu);
>
> Not convinced that this is a good change: this will bloat all the
> affected code by a couple of dozen instructions - for no good reason in
> the context of this patch.
>
> Boris, why should we do this? Extracting a parameter at higher levels and
> passing it down to lower levels is almost always a bad idea from a code
> generation POV, unless the majority of lower levels needs this
> information anyway (which isn't the case here).

Oh, I just got to this series in my mbox:

[RFC PATCH 0/5] Print CPU at segfault time
...
[RFC PATCH 5/5] x86/entry: Store CPU info on exception entry

With that basis, printing the segfault CPU becomes a 'free' feature.

At the cost of putting ~2 new instructions into the hotpath of every
exception though. :-/

Thanks,

Ingo