lkml.org 
[lkml]   [2021]   [Jun]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 16/16] objtool,x86: Rewrite retpoline thunk calls
From
Date
On 6/9/2021 8:08 AM, Peter Zijlstra wrote:
> On Wed, Jun 09, 2021 at 02:23:28PM +0200, Lukasz Majczak wrote:
>> śr., 9 cze 2021 o 09:20 Peter Zijlstra <peterz@infradead.org> napisał(a):
>>>
>>> On Wed, Jun 09, 2021 at 09:11:18AM +0200, Lukasz Majczak wrote:
>>>
>>>> I'm sorry I was on vacation last week - do you still need the requested debugs?
>>>
>>> If the patch here:
>>>
>>> https://lkml.kernel.org/r/YL3q1qFO9QIRL/BA@hirez.programming.kicks-ass.net
>>>
>>> does not fix things for you (don't think it actually will), then yes,
>>> please send me the information requested.
>>
>> Ok, it didn't help. Peter, Josh I have sent you a private email with
>> requested information.
>
> OK, I think I've found it. Check this one:
>
> 5d5: 0f 85 00 00 00 00 jne 5db <cpuidle_reflect+0x22> 5d7: R_X86_64_PLT32 __x86_indirect_thunk_r11-0x4
>
>
> +Relocation section '.rela.altinstructions' at offset 0 contains 14 entries:
> + Offset Info Type Symbol's Value Symbol's Name + Addend
>
> +0000000000000018 0000000200000002 R_X86_64_PC32 0000000000000000 .text + 5d5
> +000000000000001c 0000009200000002 R_X86_64_PC32 0000000000000000 __x86_indirect_alt_call_r11 + 0
>
> Apparently we get conditional branches to retpoline thunks and objtool
> completely messes that up. I'm betting this also explains the problems
> Nathan is having.

Yes, the below patch gets my kernel back to booting so it seems the root
cause is the same.

> *groan*,.. not sure what to do about this, except return to having
> objtool generate code, which everybody hated on. For now I'll make it
> skip the conditional branches.
>
> I wonder if the compiler will also generate conditional tail calls, and
> what that does with static_call... now I have to check all that.
>
> ---

Tested-by: Nathan Chancellor <nathan@kernel.org>

> diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
> index 24295d39713b..523aa4157f80 100644
> --- a/tools/objtool/arch/x86/decode.c
> +++ b/tools/objtool/arch/x86/decode.c
> @@ -747,6 +747,10 @@ int arch_rewrite_retpolines(struct objtool_file *file)
>
> list_for_each_entry(insn, &file->retpoline_call_list, call_node) {
>
> + if (insn->type != INSN_JUMP_DYNAMIC &&
> + insn->type != INSN_CALL_DYNAMIC)
> + continue;
> +
> if (!strcmp(insn->sec->name, ".text.__x86.indirect_thunk"))
> continue;
>
>

\
 
 \ /
  Last update: 2021-06-09 17:56    [W:0.137 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site