On 28/04/2017 12:16, Paolo Bonzini wrote: > Ingo, > > can you please ack this patch? Ping. We would like to have this in 4.12. Thanks, Paolo > Thanks, > > Paolo > > On 28/04/2017 07:13, fanwenyi0529@xxxxxxxxx wrote: >> From: Wincy Van <fanwenyi0529@xxxxxxxxx> >> >> 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@xxxxxxxxx> >> --- >> 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 */ >> >