[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250403082508.GAZ-5F5EMVZq3-6Zoo@fat_crate.local>
Date: Thu, 3 Apr 2025 10:25:08 +0200
From: Borislav Petkov <bp@...en8.de>
To: Uros Bizjak <ubizjak@...il.com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>, kernel test robot <lkp@...el.com>
Subject: Re: [PATCH -tip] x86/idle: Work around LLVM assembler bug with
MONITOR and MWAIT insn
On Thu, Apr 03, 2025 at 09:04:37AM +0200, Uros Bizjak wrote:
> LLVM assembler is not able to assemble correct forms of MONITOR
> and MWAIT instructions with explicit operands:
>
> error: invalid operand for instruction
> monitor %rax,%ecx,%edx
> ^~~~
>
> Use instruction mnemonics with implicit operands when LLVM assembler
> is detected to work around this issue.
>
> Signed-off-by: Uros Bizjak <ubizjak@...il.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Ingo Molnar <mingo@...nel.org>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: Dave Hansen <dave.hansen@...ux.intel.com>
> Cc: "H. Peter Anvin" <hpa@...or.com>
> Fixes: cd3b85b27542 ("x86/idle: Use MONITOR and MWAIT mnemonics in <asm/mwait.h>")
No, you should whack that one - the toolchains are clearly not ready yet...
> +#ifdef CONFIG_LD_IS_LLD
> +# define ASM_MONITOR "monitor"
> +# define ASM_MWAIT "mwait"
> +#else
> +# define ASM_MONITOR "monitor %[eax], %[ecx], %[edx]"
> +# define ASM_MWAIT "mwait %[eax], %[ecx]"
> +#endif
... instead of piling more ifdeffery ontop and making the code uglier than
before.
Go fix the LLVM assembler to deal with explicit operands or GCC and LLVM
should agree on common syntax they both assemble or whatever and the kernel
should do *one* thing exactly and not carry toolchain-specific ifdeffery at
every spot.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists