|
Message-ID: <20170724122327.z6p4w5yvirnbuvfd@hirez.programming.kicks-ass.net> Date: Mon, 24 Jul 2017 14:23:27 +0200 From: Peter Zijlstra <peterz@...radead.org> To: Michael Ellerman <mpe@...erman.id.au> Cc: Kees Cook <keescook@...omium.org>, Andrew Morton <akpm@...ux-foundation.org>, Ingo Molnar <mingo@...nel.org>, Josh Poimboeuf <jpoimboe@...hat.com>, Christoph Hellwig <hch@...radead.org>, "Eric W. Biederman" <ebiederm@...ssion.com>, Jann Horn <jannh@...gle.com>, Eric Biggers <ebiggers3@...il.com>, Elena Reshetova <elena.reshetova@...el.com>, Hans Liljestrand <ishkamiel@...il.com>, Greg KH <gregkh@...uxfoundation.org>, Alexey Dobriyan <adobriyan@...il.com>, "Serge E. Hallyn" <serge@...lyn.com>, arozansk@...hat.com, Davidlohr Bueso <dave@...olabs.net>, Manfred Spraul <manfred@...orfullife.com>, "axboe@...nel.dk" <axboe@...nel.dk>, James Bottomley <James.Bottomley@...senpartnership.com>, "x86@...nel.org" <x86@...nel.org>, Arnd Bergmann <arnd@...db.de>, "David S. Miller" <davem@...emloft.net>, Rik van Riel <riel@...hat.com>, LKML <linux-kernel@...r.kernel.org>, linux-arch <linux-arch@...r.kernel.org>, "kernel-hardening@...ts.openwall.com" <kernel-hardening@...ts.openwall.com> Subject: Re: [PATCH v6 0/2] x86: Implement fast refcount overflow protection On Mon, Jul 24, 2017 at 10:09:32PM +1000, Michael Ellerman wrote: > Peter Zijlstra <peterz@...radead.org> writes: > > anyway, and the fact that your LL/SC is horrendously slow in any case. > > Boo :/ :-) > Just kidding. I suspect you're right that we can probably pack a > reasonable amount of tests in the body of the LL/SC and not notice. > > > Also, I still haven't seen an actual benchmark where our cmpxchg loop > > actually regresses anything, just a lot of yelling about potential > > regressions :/ > > Heh yeah. Though I have looked at the code it generates on PPC and it's > not sleek, though I guess that's not a benchmark is it :) Oh for sure, GCC still can't sanely convert a cmpxchg loop (esp. if the cmpxchg is implemented using asm) into a native LL/SC sequence, so the generic code will end up looking pretty horrendous. A native implementation of the same semantics should look loads better. One thing that might help you is that refcount_dec_and_test() is weaker than atomic_dec_and_test() wrt ordering, so that might help some (RELEASE vs fully ordered).
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.