Re: [patch V5 24/38] x86/entry: Provide IDTENTRY_SYSVEC

From: Boris Ostrovsky
Date: Thu May 14 2020 - 20:21:41 EST


On 5/12/20 5:01 PM, Thomas Gleixner wrote:
> +
> +/**
> + * DEFINE_IDTENTRY_SYSVEC - Emit code for system vector IDT entry points
> + * @func: Function name of the entry point
> + *
> + * idtentry_enter/exit() and irq_enter/exit_rcu() are invoked before the
> + * function body. KVM L1D flush request is set.


This is used for entry points for Xen and hyperV as well. Even though
it's harmless at the moment, do we still want to set this flag for non-KVM?


-boris


> + *
> + * Runs the function on the interrupt stack if the entry hit kernel mode
> + */
> +#define DEFINE_IDTENTRY_SYSVEC(func) \
> +static void __##func(struct pt_regs *regs); \
> + \
> +__visible noinstr void func(struct pt_regs *regs) \
> +{ \
> + idtentry_enter(regs); \
> + instrumentation_begin(); \
> + irq_enter_rcu(); \
> + kvm_set_cpu_l1tf_flush_l1d(); \
> + if (!irq_needs_irq_stack(regs)) \
> + __##func (regs); \
> + else \
> + run_on_irqstack(__##func, regs); \
> + irq_exit_rcu(); \
> + lockdep_hardirq_exit(); \
> + instrumentation_end(); \
> + idtentry_exit(regs); \
> +} \
> + \
> +static noinline void __##func(struct pt_regs *regs)