Re: [RFC][PATCH 6/6] objtool,x86: Rewrite retpoline thunk calls

2021-02-21 Thread Borislav Petkov
On Sat, Feb 20, 2021 at 11:51:00PM +0100, Peter Zijlstra wrote: > > 11 patches and one beer later, it even boots :-) Yah, beer and coding sometimes works. But only sometimes, ask rostedt and tglx. :-P > > Saves more than 6k on a defconfig build. Uuh, niice. And that will be a lot more on a

Re: [RFC][PATCH 6/6] objtool,x86: Rewrite retpoline thunk calls

2021-02-21 Thread Borislav Petkov
On Sun, Feb 21, 2021 at 06:45:54AM +0100, Jürgen Groß wrote: > If you want I can cook up a patch and include it in my paravirt > cleanup series. Sure, Linus already pulled the first part of your cleanup so you can base off the rest ontop. Thx. -- Regards/Gruss, Boris.

Re: [RFC][PATCH 6/6] objtool,x86: Rewrite retpoline thunk calls

2021-02-20 Thread Jürgen Groß
On 20.02.21 23:32, Peter Zijlstra wrote: On Sat, Feb 20, 2021 at 06:41:01PM +0100, Borislav Petkov wrote: - if we had negative alternatives objtool doesn't need to actually rewrite code in this case. It could simply emit alternative entries and call it a day. I don't mind the

Re: [RFC][PATCH 6/6] objtool,x86: Rewrite retpoline thunk calls

2021-02-20 Thread Peter Zijlstra
On Sat, Feb 20, 2021 at 11:28:02PM +0100, Peter Zijlstra wrote: > On Sat, Feb 20, 2021 at 06:41:01PM +0100, Borislav Petkov wrote: > > > - I have more cases for objtool to rewrite code (I'll see if I can > > >rebase and post that this weekend -- no promises). > > > > Oh noes. > > 11 patches

Re: [RFC][PATCH 6/6] objtool,x86: Rewrite retpoline thunk calls

2021-02-20 Thread Peter Zijlstra
On Sat, Feb 20, 2021 at 06:41:01PM +0100, Borislav Petkov wrote: > > - if we had negative alternatives objtool doesn't need to actually > >rewrite code in this case. It could simply emit alternative entries > >and call it a day. > > I don't mind the negative alt per se - I mind the

Re: [RFC][PATCH 6/6] objtool,x86: Rewrite retpoline thunk calls

2021-02-20 Thread Peter Zijlstra
On Sat, Feb 20, 2021 at 06:41:01PM +0100, Borislav Petkov wrote: > > - I have more cases for objtool to rewrite code (I'll see if I can > >rebase and post that this weekend -- no promises). > > Oh noes. 11 patches and one beer later, it even boots :-) Saves more than 6k on a defconfig

Re: [RFC][PATCH 6/6] objtool,x86: Rewrite retpoline thunk calls

2021-02-20 Thread Borislav Petkov
On Sat, Feb 20, 2021 at 05:48:46PM +0100, Peter Zijlstra wrote: > - straight line execution is always better than a round-trip to >somewhere else, no matter how trivial. Sure, but not at that price. Especially not if it is waaay down in perf profiles. > - supposely EIBRS (yeah, I know,

Re: [RFC][PATCH 6/6] objtool,x86: Rewrite retpoline thunk calls

2021-02-20 Thread Peter Zijlstra
On Sat, Feb 20, 2021 at 01:39:20AM +0100, Borislav Petkov wrote: > On Fri, Feb 19, 2021 at 11:01:58PM +0100, Peter Zijlstra wrote: > > We could, but it so happens Joerg is also wanting negative features. > > Juergen. Argh! I should stick to jgross. Sorry. > > So I was thikning that perhaps we

Re: [RFC][PATCH 6/6] objtool,x86: Rewrite retpoline thunk calls

2021-02-19 Thread Borislav Petkov
On Fri, Feb 19, 2021 at 11:01:58PM +0100, Peter Zijlstra wrote: > We could, but it so happens Joerg is also wanting negative features. Juergen. > So I was thikning that perhaps we can convince Boris they're not > really all that aweful after all :-) Well, I'm not crazy about this, TBH - I

Re: [RFC][PATCH 6/6] objtool,x86: Rewrite retpoline thunk calls

2021-02-19 Thread Peter Zijlstra
On Fri, Feb 19, 2021 at 03:55:30PM -0600, Josh Poimboeuf wrote: > On Fri, Feb 19, 2021 at 09:43:06PM +0100, Peter Zijlstra wrote: > > Arguably it would be simpler to do the other way around, but > > unfortunately alternatives don't work that way, we cannot say: > > > > ALTERNATIVE "call

Re: [RFC][PATCH 6/6] objtool,x86: Rewrite retpoline thunk calls

2021-02-19 Thread Josh Poimboeuf
On Fri, Feb 19, 2021 at 09:43:06PM +0100, Peter Zijlstra wrote: > Arguably it would be simpler to do the other way around, but > unfortunately alternatives don't work that way, we cannot say: > > ALTERNATIVE "call __x86_indirect_thunk_\reg", > "call *%reg",

[RFC][PATCH 6/6] objtool,x86: Rewrite retpoline thunk calls

2021-02-19 Thread Peter Zijlstra
When the compiler emits: "CALL __x86_indirect_thunk_\reg" for an indirect call, have objtool rewrite it to: ALTERNATIVE "call *%reg", "call __x86_indirect_thunk_\reg", X86_FEATURE_RETPOLINE That is, rewrite the thunk calls into actual indirect calls and emit