Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1544402 > unrolled thread

[PATCH 6/6] KVM: lapic: do not scan IRR when delivering an interrupt

Started byPaolo Bonzini <pbonzini@redhat.com>
First post2016-12-19 10:50 +0100
Last post2016-12-20 18:20 +0100
Articles 2 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 6/6] KVM: lapic: do not scan IRR when delivering an interrupt Paolo Bonzini <pbonzini@redhat.com> - 2016-12-19 10:50 +0100
    Re: [PATCH 6/6] KVM: lapic: do not scan IRR when delivering an  interrupt Paolo Bonzini <pbonzini@redhat.com> - 2016-12-20 18:20 +0100

#1544402 — [PATCH 6/6] KVM: lapic: do not scan IRR when delivering an interrupt

FromPaolo Bonzini <pbonzini@redhat.com>
Date2016-12-19 10:50 +0100
Subject[PATCH 6/6] KVM: lapic: do not scan IRR when delivering an interrupt
Message-ID<sQ2JY-60r-25@gated-at.bofh.it>
On interrupt delivery the PPR can only grow, so it is impossible
that interrupt delivery results in KVM_REQ_EVENT.  Make this
clear by using __apic_update_ppr, and by not using apic_*_isr
for Hyper-V auto-EOI interrupts.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kvm/lapic.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index dc4ea8bdea9c..4dc02482faf7 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -2110,6 +2110,7 @@ int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu)
 {
 	int vector = kvm_apic_has_interrupt(vcpu);
 	struct kvm_lapic *apic = vcpu->arch.apic;
+	u32 ppr;
 
 	if (vector == -1)
 		return -1;
@@ -2121,15 +2122,11 @@ int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu)
 	 * because the process would deliver it through the IDT.
 	 */
 
-	apic_set_isr(vector, apic);
-	apic_update_ppr(apic);
-	apic_clear_irr(vector, apic);
-
-	if (test_bit(vector, vcpu_to_synic(vcpu)->auto_eoi_bitmap)) {
-		apic_clear_isr(vector, apic);
-		apic_update_ppr(apic);
-	}
+	if (!test_bit(vector, vcpu_to_synic(vcpu)->auto_eoi_bitmap))
+		apic_set_isr(vector, apic);
 
+	apic_clear_irr(vector, apic);
+	__apic_update_ppr(apic, &ppr);
 	return vector;
 }
 
-- 
1.8.3.1

[toc] | [next] | [standalone]


#1545298 — Re: [PATCH 6/6] KVM: lapic: do not scan IRR when delivering an interrupt

FromPaolo Bonzini <pbonzini@redhat.com>
Date2016-12-20 18:20 +0100
SubjectRe: [PATCH 6/6] KVM: lapic: do not scan IRR when delivering an interrupt
Message-ID<sQwf0-8sT-9@gated-at.bofh.it>
In reply to#1544402

On 19/12/2016 10:47, Paolo Bonzini wrote:
> +	if (!test_bit(vector, vcpu_to_synic(vcpu)->auto_eoi_bitmap))
> +		apic_set_isr(vector, apic);
>  
> +	apic_clear_irr(vector, apic);
> +	__apic_update_ppr(apic, &ppr);

Hmm, EOI does apic_update_ppr, so for auto-EOI interrupts I think it's
safer to do apic_update_ppr instead.  You could have to interrupts
injected at the same time, and the lower-priority interrupt would be
lost if the higher-priority interrupt does automatic EOI.

Paolo

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web