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: <20250318220605.6ac40f6d@pumpkin>
Date: Tue, 18 Mar 2025 22:06:05 +0000
From: David Laight <david.laight.linux@...il.com>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>, x86@...nel.org,
 linux-kernel@...r.kernel.org, Peter Zijlstra <peterz@...radead.org>,
 Borislav Petkov <bp@...en8.de>, "H. Peter Anvin" <hpa@...or.com>, Uros
 Bizjak <ubizjak@...il.com>, Andrew Cooper <andrew.cooper3@...rix.com>, Ingo
 Molnar <mingo@...nel.org>
Subject: Re: [PATCH 14/20] x86/barrier: Use alternative_io() in 32-bit
 barrier functions

On Mon, 17 Mar 2025 17:11:58 -0700
Josh Poimboeuf <jpoimboe@...nel.org> wrote:

> On Mon, Mar 17, 2025 at 08:04:32PM +0000, David Laight wrote:
> > Is the ARG() necessary just to handle the comma separated lists?
> > If so is it only actually needed if there is more than one item?  
> 
> No, but my preference is to require the use of the macro even for single
> constraints as it helps visually separate the lists.
> 
> > Another option is to just require () and add the ARG in the expansion.
> > So with:
> > #define __asm_call(qual, alt, out, in, clobber) \
> > 	asm("zzz", ARG out, ARG in, ARG clobber)
> > 
> > __asm_call(qual, ALT(), \
> > 		([var] "+m" (__my_cpu_var(_var)), "+a" (old__.low),	\
> > 		    "+d" (old__.high)),					\
> > 		("b" (new__.low), "c" (new__.high), "S" (&(_var))),	\
> > 		("memory"));
> > 
> > would get expanded the same as the line below.  
> 
> Interesting idea, though I still prefer the self-documenting ASM_OUTPUT
> / ASM_INPUT / ASM_CLOBBER macros which are self-documenting and make it
> easier to read and visually distinguish the constraint lists.

Except that non of this really makes it easier to get out/in in the correct
order or to use the right constraints.
So are you just adding 'syntactic sugar' for no real gain?

Looking back at one of the changes:
-#define mb() asm volatile(ALTERNATIVE("lock addl $0,-4(%%esp)", "mfence", \
-				      X86_FEATURE_XMM2) ::: "memory", "cc")
+#define mb() alternative_io("lock addl $0,-4(%%esp)",			\
+			    "mfence", X86_FEATURE_XMM2,			\
+			    ARG(),					\
+			    ARG(),					\
+			    ARG("memory", "cc")) 

is it really an improvement?

	David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ