All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: fanwenyi0529@gmail.com, jmattson@google.com, kvm@vger.kernel.org,
	Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH 1/2] x86: irq: Define a global vector for nested posted interrupts
Date: Fri, 28 Apr 2017 12:16:20 +0200	[thread overview]
Message-ID: <b6f5c9e8-bb6d-3914-9da1-01aece19054c@redhat.com> (raw)
In-Reply-To: <1493356439-7293-2-git-send-email-fanwenyi0529@gmail.com>

Ingo,

can you please ack this patch?

Thanks,

Paolo

On 28/04/2017 07:13, fanwenyi0529@gmail.com wrote:
> From: Wincy Van <fanwenyi0529@gmail.com>
> 
> We are using the same vector for nested/non-nested posted
> interrupts delivery, this may cause interrupts latency in
> L1 since we can't kick the L2 vcpu out of vmx-nonroot mode.
> 
> This patch introduces a new vector which is only for nested
> posted interrupts to solve the problems above.
> 
> Signed-off-by: Wincy Van <fanwenyi0529@gmail.com>
> ---
>  arch/x86/entry/entry_64.S          |  1 +
>  arch/x86/include/asm/entry_arch.h  |  2 ++
>  arch/x86/include/asm/hardirq.h     |  1 +
>  arch/x86/include/asm/hw_irq.h      |  2 ++
>  arch/x86/include/asm/irq_vectors.h |  1 +
>  arch/x86/kernel/irq.c              | 13 +++++++++++++
>  arch/x86/kernel/irqinit.c          |  2 ++
>  7 files changed, 22 insertions(+)
> 
> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
> index 044d18e..c01e62c 100644
> --- a/arch/x86/entry/entry_64.S
> +++ b/arch/x86/entry/entry_64.S
> @@ -710,6 +710,7 @@ apicinterrupt X86_PLATFORM_IPI_VECTOR		x86_platform_ipi		smp_x86_platform_ipi
>  #ifdef CONFIG_HAVE_KVM
>  apicinterrupt3 POSTED_INTR_VECTOR		kvm_posted_intr_ipi		smp_kvm_posted_intr_ipi
>  apicinterrupt3 POSTED_INTR_WAKEUP_VECTOR	kvm_posted_intr_wakeup_ipi	smp_kvm_posted_intr_wakeup_ipi
> +apicinterrupt3 POSTED_INTR_NESTED_VECTOR	kvm_posted_intr_nested_ipi	smp_kvm_posted_intr_nested_ipi
>  #endif
>  
>  #ifdef CONFIG_X86_MCE_THRESHOLD
> diff --git a/arch/x86/include/asm/entry_arch.h b/arch/x86/include/asm/entry_arch.h
> index df00299..07b0695 100644
> --- a/arch/x86/include/asm/entry_arch.h
> +++ b/arch/x86/include/asm/entry_arch.h
> @@ -25,6 +25,8 @@
>  		 smp_kvm_posted_intr_ipi)
>  BUILD_INTERRUPT3(kvm_posted_intr_wakeup_ipi, POSTED_INTR_WAKEUP_VECTOR,
>  		 smp_kvm_posted_intr_wakeup_ipi)
> +BUILD_INTERRUPT3(kvm_posted_intr_nested_ipi, POSTED_INTR_NESTED_VECTOR,
> +		 smp_kvm_posted_intr_nested_ipi)
>  #endif
>  
>  /*
> diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h
> index 59405a2..3a81b21 100644
> --- a/arch/x86/include/asm/hardirq.h
> +++ b/arch/x86/include/asm/hardirq.h
> @@ -15,6 +15,7 @@
>  #ifdef CONFIG_HAVE_KVM
>  	unsigned int kvm_posted_intr_ipis;
>  	unsigned int kvm_posted_intr_wakeup_ipis;
> +	unsigned int kvm_posted_intr_nested_ipis;
>  #endif
>  	unsigned int x86_platform_ipis;	/* arch dependent */
>  	unsigned int apic_perf_irqs;
> diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
> index b90e105..d6dbafb 100644
> --- a/arch/x86/include/asm/hw_irq.h
> +++ b/arch/x86/include/asm/hw_irq.h
> @@ -30,6 +30,7 @@
>  extern asmlinkage void x86_platform_ipi(void);
>  extern asmlinkage void kvm_posted_intr_ipi(void);
>  extern asmlinkage void kvm_posted_intr_wakeup_ipi(void);
> +extern asmlinkage void kvm_posted_intr_nested_ipi(void);
>  extern asmlinkage void error_interrupt(void);
>  extern asmlinkage void irq_work_interrupt(void);
>  
> @@ -62,6 +63,7 @@
>  #define trace_reboot_interrupt  reboot_interrupt
>  #define trace_kvm_posted_intr_ipi kvm_posted_intr_ipi
>  #define trace_kvm_posted_intr_wakeup_ipi kvm_posted_intr_wakeup_ipi
> +#define trace_kvm_posted_intr_nested_ipi kvm_posted_intr_nested_ipi
>  #endif /* CONFIG_TRACING */
>  
>  #ifdef	CONFIG_X86_LOCAL_APIC
> diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
> index 6ca9fd6..30f2bc5 100644
> --- a/arch/x86/include/asm/irq_vectors.h
> +++ b/arch/x86/include/asm/irq_vectors.h
> @@ -98,6 +98,7 @@
>  /* Vector for KVM to deliver posted interrupt IPI */
>  #ifdef CONFIG_HAVE_KVM
>  #define POSTED_INTR_VECTOR		0xf2
> +#define POSTED_INTR_NESTED_VECTOR	0xf0
>  #endif
>  
>  /*
> diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
> index 4d8183b..9fed1e1 100644
> --- a/arch/x86/kernel/irq.c
> +++ b/arch/x86/kernel/irq.c
> @@ -313,6 +313,19 @@ __visible void smp_kvm_posted_intr_wakeup_ipi(struct pt_regs *regs)
>  	exiting_irq();
>  	set_irq_regs(old_regs);
>  }
> +
> +/*
> + * Handler for POSTED_INTERRUPT_NESTED_VECTOR.
> + */
> +__visible void smp_kvm_posted_intr_nested_ipi(struct pt_regs *regs)
> +{
> +	struct pt_regs *old_regs = set_irq_regs(regs);
> +
> +	entering_ack_irq();
> +	inc_irq_stat(kvm_posted_intr_nested_ipis);
> +	exiting_irq();
> +	set_irq_regs(old_regs);
> +}
>  #endif
>  
>  __visible void __irq_entry smp_trace_x86_platform_ipi(struct pt_regs *regs)
> diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c
> index 1423ab1..4c86c92 100644
> --- a/arch/x86/kernel/irqinit.c
> +++ b/arch/x86/kernel/irqinit.c
> @@ -150,6 +150,8 @@ static void __init apic_intr_init(void)
>  	alloc_intr_gate(POSTED_INTR_VECTOR, kvm_posted_intr_ipi);
>  	/* IPI for KVM to deliver interrupt to wake up tasks */
>  	alloc_intr_gate(POSTED_INTR_WAKEUP_VECTOR, kvm_posted_intr_wakeup_ipi);
> +	/* IPI for KVM to deliver nested posted interrupt */
> +	alloc_intr_gate(POSTED_INTR_NESTED_VECTOR, kvm_posted_intr_nested_ipi);
>  #endif
>  
>  	/* IPI vectors for APIC spurious and error interrupts */
> 

  reply	other threads:[~2017-04-28 10:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-28  5:13 [PATCH 0/2] KVM: nVMX: Fix nested posted interrupts delivery fanwenyi0529
2017-04-28  5:13 ` [PATCH 1/2] x86: irq: Define a global vector for nested posted interrupts fanwenyi0529
2017-04-28 10:16   ` Paolo Bonzini [this message]
2017-05-16 14:55     ` Paolo Bonzini
2017-04-28  5:13 ` [PATCH 2/2] KVM: nVMX: Fix posted intr delivery when vcpu is in guest mode fanwenyi0529
2017-07-24 17:08 ` [PATCH 0/2] KVM: nVMX: Fix nested posted interrupts delivery Paolo Bonzini
2017-07-25  1:25   ` Wincy Van

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=b6f5c9e8-bb6d-3914-9da1-01aece19054c@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=fanwenyi0529@gmail.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=mingo@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.