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: <24007667-1ff3-4c86-9c17-a361c3f9f072@app.fastmail.com>
Date:   Fri, 03 Feb 2023 18:25:04 +0100
From:   "Arnd Bergmann" <arnd@...db.de>
To:     "Peter Zijlstra" <peterz@...radead.org>,
        "Linus Torvalds" <torvalds@...ux-foundation.org>
Cc:     "Jonathan Corbet" <corbet@....net>,
        "Will Deacon" <will@...nel.org>,
        "Boqun Feng" <boqun.feng@...il.com>,
        "Mark Rutland" <mark.rutland@....com>,
        "Catalin Marinas" <catalin.marinas@....com>, dennis@...nel.org,
        "Tejun Heo" <tj@...nel.org>, "Christoph Lameter" <cl@...ux.com>,
        "Heiko Carstens" <hca@...ux.ibm.com>, gor@...ux.ibm.com,
        "Alexander Gordeev" <agordeev@...ux.ibm.com>,
        borntraeger@...ux.ibm.com, "Sven Schnelle" <svens@...ux.ibm.com>,
        "Thomas Gleixner" <tglx@...utronix.de>,
        "Ingo Molnar" <mingo@...hat.com>, "Borislav Petkov" <bp@...en8.de>,
        "Dave Hansen" <dave.hansen@...ux.intel.com>, x86@...nel.org,
        "H. Peter Anvin" <hpa@...or.com>, "Joerg Roedel" <joro@...tes.org>,
        suravee.suthikulpanit@....com,
        "Robin Murphy" <robin.murphy@....com>, dwmw2@...radead.org,
        "Baolu Lu" <baolu.lu@...ux.intel.com>,
        "Herbert Xu" <herbert@...dor.apana.org.au>,
        "David S . Miller" <davem@...emloft.net>,
        "Pekka Enberg" <penberg@...nel.org>,
        "David Rientjes" <rientjes@...gle.com>,
        "Joonsoo Kim" <iamjoonsoo.kim@....com>,
        "Andrew Morton" <akpm@...ux-foundation.org>,
        "Vlastimil Babka" <vbabka@...e.cz>,
        "Roman Gushchin" <roman.gushchin@...ux.dev>,
        "Hyeonggon Yoo" <42.hyeyoo@...il.com>, linux-doc@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        linux-s390@...r.kernel.org, iommu@...ts.linux.dev,
        Linux-Arch <linux-arch@...r.kernel.org>,
        linux-crypto@...r.kernel.org
Subject: Re: [PATCH v2 05/10] percpu: Wire up cmpxchg128

On Thu, Feb 2, 2023, at 15:50, Peter Zijlstra wrote:
> In order to replace cmpxchg_double() with the newly minted
> cmpxchg128() family of functions, wire it up in this_cpu_cmpxchg().
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>

I commented on this in the previous version but never got any
reply from you:

https://lore.kernel.org/all/1d88ba9f-5541-4b67-9cc8-a361eef36547@app.fastmail.com/

Unless I have misunderstood what you are doing, my concerns are
still the same:

>  #define this_cpu_cmpxchg(pcp, oval, nval) \
> -	__pcpu_size_call_return2(this_cpu_cmpxchg_, pcp, oval, nval)
> +	__pcpu_size16_call_return2(this_cpu_cmpxchg_, pcp, oval, nval)
>  #define this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, 
> nval2) \
>  	__pcpu_double_call_return_bool(this_cpu_cmpxchg_double_, pcp1, pcp2, 
> oval1, oval2, nval1, nval2)

Having a variable-length this_cpu_cmpxchg() that turns into cmpxchg128()
and cmpxchg64() even on CPUs where this traps (!X86_FEATURE_CX16) seems
like a bad design to me.

I would much prefer fixed-length this_cpu_cmpxchg64()/this_cpu_cmpxchg128()
calls that never trap but fall back to the generic version on CPUs that
are lacking the atomics.

     Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ