[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87lf8lfizj.ffs@nanos.tec.linutronix.de>
Date: Tue, 11 May 2021 16:22:24 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: "H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Andy Lutomirski <luto@...nel.org>
Cc: Steve Wahl <steve.wahl@....com>, Mike Travis <mike.travis@....com>,
Dimitri Sivanich <dimitri.sivanich@....com>,
Russ Anderson <russ.anderson@....com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"H. Peter Anvin \(Intel\)" <hpa@...or.com>
Subject: Re: [PATCH 4/6] x86/irq: merge common code in DEFINE_IDTENTRY_SYSVEC[_SIMPLE]
On Mon, May 10 2021 at 17:55, H. Peter Anvin wrote:
> +/**
> + * IDTENTRY_INVOKE_SYSVEC - Common code for system vector IDT entry points
> + * @what: What should be called
> + *
> + * Common code for DEFINE_IDTENTRY_SYSVEC and _SYSVEC_SIMPLE
> + */
> +#define IDTENTRY_INVOKE_SYSVEC(what) \
> +do { \
> + irqentry_state_t state = irqentry_enter(regs); \
> + \
> + instrumentation_begin(); \
> + kvm_set_cpu_l1tf_flush_l1d(); \
> + what; \
> + instrumentation_end(); \
> + irqentry_exit(regs, state); \
> +} while (0) \
> +
> /**
> * DEFINE_IDTENTRY_SYSVEC - Emit code for system vector IDT entry points
> * @func: Function name of the entry point
> @@ -233,13 +250,7 @@ static void __##func(struct pt_regs *regs); \
> \
> __visible noinstr void func(struct pt_regs *regs) \
> { \
> - irqentry_state_t state = irqentry_enter(regs); \
> - \
> - instrumentation_begin(); \
> - kvm_set_cpu_l1tf_flush_l1d(); \
> - run_sysvec_on_irqstack_cond(__##func, regs); \
> - instrumentation_end(); \
> - irqentry_exit(regs, state); \
> + IDTENTRY_INVOKE_SYSVEC(run_sysvec_on_irqstack_cond(__##func, regs)); \
> } \
> \
> static noinline void __##func(struct pt_regs *regs)
> @@ -260,15 +271,7 @@ static __always_inline void __##func(struct pt_regs *regs); \
> \
> __visible noinstr void func(struct pt_regs *regs) \
> { \
> - irqentry_state_t state = irqentry_enter(regs); \
> - \
> - instrumentation_begin(); \
> - __irq_enter_raw(); \
> - kvm_set_cpu_l1tf_flush_l1d(); \
> - __##func (regs); \
> - __irq_exit_raw(); \
> - instrumentation_end(); \
> - irqentry_exit(regs, state); \
> + IDTENTRY_INVOKE_SYSVEC(__irq_enter_raw(); __##func(regs); __irq_exit_raw()); \
That's not really making the code more readable. Something like the
below perhaps?
#define IDTENTRY_INVOKE_SYSVEC(func, regs, raw) \
do { \
irqentry_state_t state = irqentry_enter(regs); \
\
instrumentation_begin(); \
kvm_set_cpu_l1tf_flush_l1d(); \
if (raw) { \
__irq_enter_raw(); \
func(regs); \
__irq_exit_raw(); \
} else { \
run_sysvec_on_irqstack_cond(func, regs); \
} \
instrumentation_end(); \
irqentry_exit(regs, state); \
} while (0) \
Thanks,
tglx
Powered by blists - more mailing lists