Re: [RFC v2 1/6] x86: introduce kernel restartable sequence
From: Andy Lutomirski
Date: Mon Dec 31 2018 - 15:09:02 EST
On Sun, Dec 30, 2018 at 11:20 PM Nadav Amit <namit@xxxxxxxxxx> 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 indication for instruction in such a sequence. Before
> calling the schedule IRQ routine, if the "magic" prefix is found, we
> call a routine to adjust the instruction pointer. It is expected that
> this opcode is not in common use.
> The following patch will make use of this function. Since there are no
> other users (yet?), the patch does not bother to create a general
> infrastructure and API that others can use for such sequences. Yet, it
> should not be hard to make such extension later.
The following patch does not use it. Can you update this?
> +asmlinkage __visible void restart_kernel_rseq(struct pt_regs *regs)
> + if (user_mode(regs) || *(u8 *)regs->ip != KERNEL_RESTARTABLE_PREFIX)
> + return;
I suspect something is missing here. Or I'm very confused.