Re: [PATCH V5 3/7] x86/entry: Move PUSH_AND_CLEAR_REGS out of error_entry()

From: Borislav Petkov
Date: Tue Apr 12 2022 - 10:31:09 EST


On Tue, Apr 12, 2022 at 09:52:44PM +0800, Lai Jiangshan wrote:
> The mapped size for the text is always 2M when the kernel is booted
> since it is 2M-aligned. So I don't think the size is a concern.

This is not how this argumentation works: you add 0.01% size increase
here, 0.01% slowdown there and it all soon adds up into a bloated
kernel. Besides, nowadays the kernel runs a lot as a guest and guest
kernel size does matter.

So no, just because you want to turn error_entry() into C code and for
that you'll add some bloat doesn't justify it in my book. All changes to
core code need to be absolutely needed and justifiable.

> For example, a heavy page fault and IPI or timer at the same time.
> I'm not sure if it is a real case.

I wouldn't be surprised if it shows in some perf profiles.

> I'm Okay with asm_error_entry(). And also we can use an ASM function
> containing PUSH_AND_CLEAR_REGS only.

Just do the necessary and minimal thing - this is core code and in asm
for that matter, so be conservative pls. This is not some random driver.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette