[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <88AE3649-C2E6-4965-86B5-C8FE9D226293@amacapital.net>
Date: Wed, 6 May 2020 12:57:02 -0700
From: Andy Lutomirski <luto@...capital.net>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Jason Baron <jbaron@...mai.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>, Nadav Amit <namit@...are.com>,
"H. Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...nel.org>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
"H.J. Lu" <hjl.tools@...il.com>,
clang-built-linux <clang-built-linux@...glegroups.com>
Subject: Re: [PATCH v4 14/18] static_call: Add static_cond_call()
> On May 6, 2020, at 10:23 AM, Linus Torvalds <torvalds@...ux-foundation.org> wrote:
>
> On Wed, May 6, 2020 at 6:51 AM Peter Zijlstra <peterz@...radead.org> wrote:
>>
>> I was hoping for:
>>
>> bar: # @bar
>> movl %edi, .L_x$local(%rip)
>> retq
>> ponies: # @ponies
>> movq .Lfoo$local(%rip), %rax
>> testq %rax, %rax
>> jz 1f
>> jmpq *%rcx # TAILCALL
>> 1:
>> retq
>
> If you want to just avoid the 'cmov', the best way to do that is to
> insert a barrier() on one side of the if-statement.
>
> That breaks the ability to turn the conditional jump into a cmov.
Having done this in the past, you can get potentially better code with asm volatile (“”); than with a barrier and its memory clobber. I don’t know if that will make a difference in this particular case.
Powered by blists - more mailing lists