Re: [PATCH] x86/locking: Remove semicolon from "lock" prefix
From: Peter Zijlstra
Date: Fri Feb 28 2025 - 04:15:52 EST
On Fri, Feb 28, 2025 at 09:51:15AM +0100, Uros Bizjak wrote:
> Minimum version of binutils required to compile the kernel is 2.25.
> This version correctly handles the "lock" prefix, so it is possible
> to remove the semicolon, which was used to support ancient versions
> of GNU as.
>
> Due to the semicolon, the compiler considers "lock; insn" as two
> separate instructions. Removing the semicolon makes asm length
> calculations more accurate, consequently making scheduling and
> inlining decisions of the compiler more accurate.
>
> Removing the semicolon also enables assembler checks involving lock
> prefix. Trying to assemble e.g. "lock andl %eax, %ebx" results in:
>
> Error: expecting lockable instruction after `lock'
>
> Signed-off-by: Uros Bizjak <ubizjak@xxxxxxxxx>
Ah, I always wondered why that ; was there.
Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>