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] [day] [month] [year] [list]
Message-ID: <CAFULd4Z9_5oUA2aNUd5+4MM=N2Tphj4NDuYDrtwE6sXRKy-tXw@mail.gmail.com>
Date: Sun, 9 Mar 2025 10:57:19 +0100
From: Uros Bizjak <ubizjak@...il.com>
To: David Laight <david.laight.linux@...il.com>
Cc: "H. Peter Anvin" <hpa@...or.com>, Dave Hansen <dave.hansen@...el.com>, x86@...nel.org, 
	linux-kernel@...r.kernel.org, Peter Zijlstra <peterz@...radead.org>, 
	Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...nel.org>, Borislav Petkov <bp@...en8.de>, 
	Dave Hansen <dave.hansen@...ux.intel.com>
Subject: Re: [PATCH -tip] x86/locking/atomic: Use asm_inline for atomic
 locking insns

On Sun, Mar 9, 2025 at 10:46 AM David Laight
<david.laight.linux@...il.com> wrote:
>
> On Sun, 9 Mar 2025 08:50:08 +0100
> Uros Bizjak <ubizjak@...il.com> wrote:
>
> > On Sat, Mar 8, 2025 at 8:08 PM H. Peter Anvin <hpa@...or.com> wrote:
> ...
> > > In fact, I would wonder if we shouldn't simply do:
> > >
> > > #define asm __asm__ __inline__
> > > #define asm_noinline __asm__
> > >
> > > ... in other words, to make asm inline an opt-out instead of an opt-in.
>
> The asm statements themselves get inlined (typically they are in an
> always_inline wrapper), the size affects whether the calling code is inlined.
> You are now in the 'games' of I$ fetches, overall code size and TLB lookups
> (not helped by the speculative execution mitigations for 'ret').
>
> > > It is comparatively unusual that we do complex things in inline assembly
> > > that we would want gcc to treat as something that should be avoided.
> >
> > I don't think we need such radical changes. There are only a few
> > groups of instructions, nicely hidden behind macros, that need asm
> > noinline. Alternatives (gcc counted them as 20 - 23 instructions) are
> > already using asm inline (please see
> > arch/x86/include/asm/alternative.h) in their high-level macros, and my
> > proposed patch converts all asm using LOCK_PREFIX by amending macros
> > in 7 header files.
>
> The other ones that are likely to get mis-sized are the ones that change
> the section to add annotations.
> The size overestimate may be better in order to reduce the number of
> annotations?

Yes, this is why I think it is better to use asm inline on a per-case
basis. While ALTERNATIVE and LOCK_HERE instructions result in one insn
(and can be trivially amended with asm inline to instruct the compiler
about this fact), this may not always be the case.

Uros.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ