mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: "H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>, Andy Lutomirski <luto@kernel.org>
Cc: Steve Wahl <steve.wahl@hpe.com>,
	Mike Travis <mike.travis@hpe.com>,
	Dimitri Sivanich <dimitri.sivanich@hpe.com>,
	Russ Anderson <russ.anderson@hpe.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"H. Peter Anvin \(Intel\)" <hpa@zytor.com>
Subject: Re: [PATCH 4/6] x86/irq: merge common code in DEFINE_IDTENTRY_SYSVEC[_SIMPLE]
Date: Tue, 11 May 2021 16:22:24 +0200	[thread overview]
Message-ID: <87lf8lfizj.ffs@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20210511005531.1065536-5-hpa@zytor.com>

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

  reply	other threads:[~2021-05-11 14:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11  0:55 [PATCH 0/6] x86/irq: trap and interrupt cleanups H. Peter Anvin
2021-05-11  0:55 ` [PATCH 1/6] x86/traps: add X86_NR_HW_TRAPS to <asm/trapnr.h> H. Peter Anvin
2021-05-14 22:53   ` Andy Lutomirski
2021-05-11  0:55 ` [PATCH 2/6] x86/irqvector: add NR_EXTERNAL_VECTORS and NR_SYSTEM_VECTORS H. Peter Anvin
2021-05-14 22:53   ` Andy Lutomirski
2021-05-11  0:55 ` [PATCH 3/6] x86/idt: remove address argument to idt_invalidate() H. Peter Anvin
2021-05-11  4:37   ` kernel test robot
2021-05-11 14:14   ` Thomas Gleixner
2021-05-11 14:43     ` H. Peter Anvin
2021-05-11  0:55 ` [PATCH 4/6] x86/irq: merge common code in DEFINE_IDTENTRY_SYSVEC[_SIMPLE] H. Peter Anvin
2021-05-11 14:22   ` Thomas Gleixner [this message]
2021-05-11 17:44     ` H. Peter Anvin
2021-05-12  8:38       ` Ingo Molnar
2021-05-12 18:00         ` H. Peter Anvin
2021-05-12 18:40           ` Ingo Molnar
2021-05-11  0:55 ` [PATCH 5/6] x86/irq: WARN_ONCE() if irq_move_cleanup is called on a pending interrupt H. Peter Anvin
2021-05-11 14:23   ` Thomas Gleixner
2021-05-11 15:55     ` H. Peter Anvin
2021-05-11  0:55 ` [PATCH 6/6] x86/irq: remove unused vectors from <asm/irq_vectors.h> H. Peter Anvin
2021-05-11 17:04   ` Steve Wahl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lf8lfizj.ffs@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=bp@alien8.de \
    --cc=dimitri.sivanich@hpe.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mike.travis@hpe.com \
    --cc=mingo@redhat.com \
    --cc=russ.anderson@hpe.com \
    --cc=steve.wahl@hpe.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®