lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <15696bb3-126b-ef71-f838-80e1e1c1b0aa@gmail.com>
Date: Fri, 25 Apr 2025 16:05:14 +0200
From: Uros Bizjak <ubizjak@...il.com>
To: Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org
Cc: "Ahmed S . Darwish" <darwi@...utronix.de>,
 Andrew Cooper <andrew.cooper3@...rix.com>, Ard Biesheuvel <ardb@...nel.org>,
 Arnd Bergmann <arnd@...nel.org>, Borislav Petkov <bp@...en8.de>,
 Dave Hansen <dave.hansen@...ux.intel.com>, "H . Peter Anvin"
 <hpa@...or.com>, John Ogness <john.ogness@...utronix.de>,
 Linus Torvalds <torvalds@...ux-foundation.org>,
 Peter Zijlstra <peterz@...radead.org>, Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 14/15] x86/percpu: Remove !CONFIG_X86_CX8 methods



On 25. 04. 25 10:42, Ingo Molnar wrote:
> TODO: review the constraints.
> 
> NOT-Signed-off-by: Ingo Molnar <mingo@...nel.org>
> ---
>   arch/x86/include/asm/percpu.h | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
> index 5fe314a2e73e..275c76a031ee 100644
> --- a/arch/x86/include/asm/percpu.h
> +++ b/arch/x86/include/asm/percpu.h
> @@ -334,8 +334,7 @@ do {									\
>   	new__.var = _nval;						\
>   									\
>   	asm_inline qual (						\
> -		ALTERNATIVE("call this_cpu_cmpxchg8b_emu",		\
> -			    "cmpxchg8b " __percpu_arg([var]), X86_FEATURE_CX8) \
> +		"cmpxchg8b " __percpu_arg([var])			\
>   		: ALT_OUTPUT_SP([var] "+m" (__my_cpu_var(_var)),	\
>   				"+a" (old__.low), "+d" (old__.high))	\
>   		: "b" (new__.low), "c" (new__.high),			\

There is no need for asm_inline, ALT_OUTPUT_SP() macro and "S" input 
(that was used to force the compiler to put the memory argument into 
%esi register):

	asm qual ("cmpxchg8b " __percpu_arg([var])		\
		: "+m" (__my_cpu_var(_var)),			\
		  "+a" (old__.low), "+d" (old__.high)		\
		: "b" (new__.low), "c" (new__.high)		\
		: "memory");					\

> @@ -363,8 +362,7 @@ do {									\
>   	new__.var = _nval;						\
>   									\
>   	asm_inline qual (						\
> -		ALTERNATIVE("call this_cpu_cmpxchg8b_emu",		\
> -			    "cmpxchg8b " __percpu_arg([var]), X86_FEATURE_CX8) \
> +		"cmpxchg8b " __percpu_arg([var])			\
>   		CC_SET(z)						\
>   		: ALT_OUTPUT_SP(CC_OUT(z) (success),			\
>   				[var] "+m" (__my_cpu_var(_var)),	\

Same here:

	asm qual ("cmpxchg8b " __percpu_arg([var])		\
		CC_SET(z)					\
		: CC_OUT(z) (success),				\
		  [var] "+m" (__my_cpu_var(_var)),		\
		  "+a" (old__.low), "+d" (old__.high)		\
		: "b" (new__.low), "c" (new__.high)		\
		: "memory");					\

Please see the attached patch that implements the change.

Uros.
View attachment "percpu_cmpxchg.diff.txt" of type "text/plain" (1584 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ