Re: [PATCH 1/6] x86/fpu/regset: Use boot_cpu_has()

From: Borislav Petkov
Date: Tue Apr 05 2016 - 11:12:05 EST


On Tue, Apr 05, 2016 at 09:51:55AM -0400, Brian Gerst wrote:
> I think the general rule should be always use static_cpu_has() for
> runtime checks, since it reduces down to a single jmp/nop instruction
> after alternatives run. Even if it's not a hot path, it saves a bit
> of runtime memory.

So gcc generates a MOV and a TEST for boot_cpu_has(). Not exactly the
bloat or slowdown.

So I look at those differently: static_cpu_has()

a) should be used on hotpaths

b) is used as such to annotate those - i.e., "ah, there's a
static_cpu_has(), this is a hot path, I better be careful what I'm doing
here."

boot_cpu_has() in all the rest.

And saving a couple of bytes per call site but increasing alternatives
application time by milli- or microseconds... Meh. I don't see it being
really worth the trouble. But this is just me.

--
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.