Re: [PATCH -tip] x86/idle: Work around LLVM assembler bug with MONITOR and MWAIT insn

From: Uros Bizjak
Date: Thu Apr 03 2025 - 05:11:39 EST


On Thu, Apr 3, 2025 at 10:25 AM Borislav Petkov <bp@xxxxxxxxx> wrote:
>
> 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@xxxxxxxxx>
> > Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> > Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> > Cc: Borislav Petkov <bp@xxxxxxxxx>
> > Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
> > Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
> > 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...

The least common denominator is an insn with implicit operands. I'll
post V2 that fixes it that way.

Uros.