[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <30e43e0b-4d16-433f-845d-dd026adfb252@app.fastmail.com>
Date: Mon, 06 Feb 2023 13:19:38 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Peter Zijlstra" <peterz@...radead.org>
Cc: "Linus Torvalds" <torvalds@...ux-foundation.org>,
"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 Mon, Feb 6, 2023, at 12:24, Peter Zijlstra wrote:
> On Fri, Feb 03, 2023 at 06:25:04PM +0100, Arnd Bergmann wrote:
>> 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.
>
> You're thinking acidental usage etc..? Lemme see what I can do.
I wouldn't even call it accidental when the dependency is so subtle:
Having to call system_has_cmpxchg64() beforce calling cmpxchg64()
is already somewhat awkward but has some logic to it. Having to
call system_has_cmpxchg64()/system_has_cmpxchg128() before calling
this_cpu_cmpxchg() depending on the argument size on architectures
that sometimes have cmpxchg128 but not on architectures that always
have it or that never have it makes it useless as an abstraction.
Arnd
Powered by blists - more mailing lists