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: <20250514064624.GA24938@noisy.programming.kicks-ass.net>
Date: Wed, 14 May 2025 08:46:24 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: dan.j.williams@...el.com, linux-cxl@...r.kernel.org,
	linux-kernel@...r.kernel.org, David Lechner <dlechner@...libre.com>,
	Ingo Molnar <mingo@...nel.org>,
	"Fabio M. De Francesco" <fabio.maria.de.francesco@...ux.intel.com>,
	Davidlohr Bueso <dave@...olabs.net>,
	Jonathan Cameron <jonathan.cameron@...wei.com>,
	Dave Jiang <dave.jiang@...el.com>,
	Alison Schofield <alison.schofield@...el.com>,
	Vishal Verma <vishal.l.verma@...el.com>,
	Ira Weiny <ira.weiny@...el.com>
Subject: Re: [PATCH 1/7] cleanup: Introduce DEFINE_ACQUIRE() a CLASS() for
 conditional locking

On Tue, May 13, 2025 at 12:46:29PM -0700, Linus Torvalds wrote:
> On Tue, 13 May 2025 at 01:50, Peter Zijlstra <peterz@...radead.org> wrote:
> >
> > +#define __GUARD_IS_ERR(_ptr) \
> > +       ({ unsigned long _var = (__force unsigned long)(_ptr); \
> > +          bool _s; \
> > +          asm_inline volatile ("cmp %[val], %[var]" \
> > +                               : "=@...s" (_s) \
> > +                               : [val] "i" (-MAX_ERRNO), \
> > +                                 [var] "r" (_var)); \
> > +          unlikely(_s); })
> 
> I think that this might be acceptable if it was some actual common operation.
> 
> But for just the conditional guard test, I think it's cute, but I
> don't think it's really worth it.

Its actually every guard, the destructor is shared between unconditional
and conditional locks.

> Right now IS_ERR_OR_NULL() generates pretty disgusting code, with
> clang doing things like this:
> 
>         testq   %rdi, %rdi
>         sete    %al
>         cmpq    $-4095, %rdi                    # imm = 0xF001
>         setae   %cl
>         orb     %al, %cl
>         je      .LBB3_1

Whee, that is creative indeed :-)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ