Re: [RFC v2 1/6] x86: introduce kernel restartable sequence

2019-01-03 Thread hpa
On December 30, 2018 11:21:07 PM PST, Nadav Amit wrote: >It is sometimes beneficial to have a restartable sequence - very few >instructions which if they are preempted jump to a predefined point. > >To provide such functionality on x86-64, we use an empty REX-prefix >(opcode 0x40) as an

Re: [RFC v2 1/6] x86: introduce kernel restartable sequence

2019-01-03 Thread Nadav Amit
> On Jan 3, 2019, at 3:40 PM, Andi Kleen wrote: > >> Thanks for the explanations. I don’t think it would work (e.g., IRQs). I can >> avoid generalizing and just detect the "magic sequence” of the code, but let >> me give it some more thought. > > If you ask me I would just use compiler profile

Re: [RFC v2 1/6] x86: introduce kernel restartable sequence

2019-01-03 Thread Andi Kleen
> Thanks for the explanations. I don’t think it would work (e.g., IRQs). I can > avoid generalizing and just detect the "magic sequence” of the code, but let > me give it some more thought. If you ask me I would just use compiler profile feedback or autofdo (if your compiler has a working

Re: [RFC v2 1/6] x86: introduce kernel restartable sequence

2019-01-03 Thread Nadav Amit
> On Jan 3, 2019, at 2:48 PM, Andi Kleen wrote: > >> Ok… I’ll try to think about another solution. Just note that this is just >> used as a hint to avoid unnecessary lookups. (IOW, nothing will break if the >> prefix is used.) > > Are you sure actually? > > The empty prefix could mean 8bit

Re: [RFC v2 1/6] x86: introduce kernel restartable sequence

2019-01-03 Thread Andi Kleen
> Ok… I’ll try to think about another solution. Just note that this is just > used as a hint to avoid unnecessary lookups. (IOW, nothing will break if the > prefix is used.) Are you sure actually? The empty prefix could mean 8bit register accesses. > > You're doing the equivalent of patching a

Re: [RFC v2 1/6] x86: introduce kernel restartable sequence

2019-01-03 Thread Nadav Amit
> On Jan 3, 2019, at 2:21 PM, Andi Kleen wrote: > > Nadav Amit writes: > > I see another poor man's attempt to reinvent TSX. > >> It is sometimes beneficial to have a restartable sequence - very few >> instructions which if they are preempted jump to a predefined point. >> >> To provide such

Re: [RFC v2 1/6] x86: introduce kernel restartable sequence

2019-01-03 Thread Andi Kleen
Nadav Amit writes: I see another poor man's attempt to reinvent TSX. > It is sometimes beneficial to have a restartable sequence - very few > instructions which if they are preempted jump to a predefined point. > > To provide such functionality on x86-64, we use an empty REX-prefix > (opcode

Re: [RFC v2 1/6] x86: introduce kernel restartable sequence

2018-12-31 Thread Nadav Amit
> On Dec 31, 2018, at 12:08 PM, Andy Lutomirski wrote: > > On Sun, Dec 30, 2018 at 11:20 PM Nadav Amit wrote: >> It is sometimes beneficial to have a restartable sequence - very few >> instructions which if they are preempted jump to a predefined point. >> >> To provide such functionality on

Re: [RFC v2 1/6] x86: introduce kernel restartable sequence

2018-12-31 Thread Andy Lutomirski
On Sun, Dec 30, 2018 at 11:20 PM Nadav Amit wrote: > > It is sometimes beneficial to have a restartable sequence - very few > instructions which if they are preempted jump to a predefined point. > > To provide such functionality on x86-64, we use an empty REX-prefix > (opcode 0x40) as an

[RFC v2 1/6] x86: introduce kernel restartable sequence

2018-12-30 Thread Nadav Amit
It is sometimes beneficial to have a restartable sequence - very few instructions which if they are preempted jump to a predefined point. To provide such functionality on x86-64, we use an empty REX-prefix (opcode 0x40) as an indication for instruction in such a sequence. Before calling the