[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0d887118-114a-b7af-ffa3-9a633e74e2e9@citrix.com>
Date: Wed, 13 Oct 2021 23:47:54 +0100
From: Andrew Cooper <andrew.cooper3@...rix.com>
To: Peter Zijlstra <peterz@...radead.org>,
Josh Poimboeuf <jpoimboe@...hat.com>
CC: <x86@...nel.org>, <linux-kernel@...r.kernel.org>,
<alexei.starovoitov@...il.com>, <ndesaulniers@...gle.com>
Subject: Re: [PATCH 4/9] x86/alternative: Implement .retpoline_sites support
On 13/10/2021 23:10, Peter Zijlstra wrote:
>> If performance of the linear lookup were a real concern then you could
>> just put rax and r11 at the beginning of the array.
> That would mean the table would have to be { __thunk, reg_idx }, which
> is even more yuck.
Yeah - it's nasty because it is a reverse lookup you need.
In both cases, it is %rax (GCC) or %r11 (Clang) and change for the other
regs, so you can construct a search which will hit on the first lookup
most of the time.
Either:
1) an array of { __thunk } with a hole for rsp. Bias searching entry 0
or 11 first based on compiler, then a 16 step linear search.
or
2) an array of { __thunk, reg }, sorted by thunk address. This has an
odd number of entries, so arrange the thunk generation to emit rax or
r11 as the 7th thunk, so it ends up in the middle when sorted.
~Andrew
Powered by blists - more mailing lists