Re: [patch 8/8] x86/vdso: Implement __vdso_futex_robust_try_unlock()

From: Thomas Gleixner

Date: Wed Mar 18 2026 - 04:23:50 EST


On Tue, Mar 17 2026 at 16:33, Uros Bizjak wrote:
> On 3/16/26 18:13, Thomas Gleixner wrote:
>> +#ifdef CONFIG_COMPAT
>
> The following asm template can be substantially improved.

In theory.

>> +# define ASM_CLEAR_PTR \
>> + " testl $1, (%[pop]) \n" \
>
> Please use byte-wide instruction, TESTB with address operand modifier,
> "%a[pop]" instead of "(%[pop])":
>
> testb $1, %a[pop]

New fangled %a syntax seems to work. Didn't know about that. Though I'm
not convinced that this is an improvement. At least not for someone who
is used to read/write plain old school ASM for several decades.

>> + " jz .Lop64 \n" \
>> + " movl $0, (%[pad]) \n" \
>
> Here you can reuse zero-valued operand "val" and use address operand
> modifier. Please note %k modifier.
>
> movl %k[val], %a[pad]
...
> movq %[val], %a[pad]

But this one does not and _cannot_ work.

Error: incorrect register `%rcx' used with `l' suffix

Which is obvious because of the initalization:

[val] "r" (0UL)

which makes it explicitely R$$. If you change the initialization back to

[val] "r" (0) // or (0U)

the failure unsurprisingly becomes

Error: incorrect register `%ecx' used with `q' suffix

So much for the theory....

<SNIP>
>> + ASM_PAD_CONSTRAINT

tons of useless quoted text

>> +#endif /* _ASM_X86_FUTEX_ROBUST_H */
</SNIP>

Can you please trim your replies properly?

Thanks,

tglx