Re: [PATCH v8 03/11] x86/cpufeatures: Add TDX Guest CPU feature

From: Borislav Petkov
Date: Wed Oct 06 2021 - 12:20:52 EST


On Wed, Oct 06, 2021 at 08:43:48AM -0700, Kuppuswamy, Sathyanarayanan wrote:
> Yes. But, Joerg Roedel in his review recommended using variable
> similar to sme_me_mask to avoid function call in Intel platform in
> cc_platform_has().

That would normally make sense if this were a fast path. But I don't see
that being one. Besides, the subsequent runs will be the function call +
a couple of instructions:

# arch/x86/kernel/tdx.c:22: if (tdx_guest >= 0)
movl tdx_guest(%rip), %eax # tdx_guest,
testl %eax, %eax #
jns .L11 #,

...

.L11:
# arch/x86/kernel/tdx.c:23: return tdx_guest;
setne %al #, <retval>
# arch/x86/kernel/tdx.c:35: }
ret

which is not the end of the world.

And it if it is really used in a fast path, then we can do a static
branch etc.

Thx.

--
Regards/Gruss,
Boris.

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