Re: [PATCH] x86/microcode: move @microcode_mutex definition near usage

From: Borislav Petkov
Date: Fri Mar 24 2023 - 12:44:54 EST


On Fri, Mar 24, 2023 at 05:39:35PM +0106, John Ogness wrote:
> Note that an unused mutex is being defined, even when the compiler is
> not warning about it.

Are you sure?

$ make arch/x86/kernel/cpu/microcode/core.s
grep microcode_mutex arch/x86/kernel/cpu/microcode/core.s
$
$ make CC=clang arch/x86/kernel/cpu/microcode/core.s
$ grep microcode_mutex arch/x86/kernel/cpu/microcode/core.s
$

Looks to me like it gets optimized away.

> OK, but the kernel test robots will probably beat me to it. ;-)

That's exactly the question: they haven't because this is not a new
situation. Their compilers are optimizing unused stuff away too.

:-)

--
Regards/Gruss,
Boris.

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