All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] If interrupt injection is not possible do not scan IRR.
Date: Tue, 19 May 2009 12:50:10 +0300	[thread overview]
Message-ID: <4A1280D2.7060508@redhat.com> (raw)
In-Reply-To: <20090518111649.GA14536@redhat.com>

Gleb Natapov wrote:
> Forget to remove debug output before submitting. Resending.
>
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
> index 1ccb50c..d32ceac 100644
> --- a/arch/x86/kvm/i8259.c
> +++ b/arch/x86/kvm/i8259.c
> @@ -218,6 +218,11 @@ int kvm_pic_read_irq(struct kvm *kvm)
>  	struct kvm_pic *s = pic_irqchip(kvm);
>  
>  	pic_lock(s);
> +	if (!s->output) {
> +		pic_unlock(s);
> +		return -1;
> +	}
> +	s->output = 0;
>  	irq = pic_get_irq(&s->pics[0]);
>  	if (irq >= 0) {
>  		pic_intack(&s->pics[0], irq);
> diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
> index 96dfbb6..e93405a 100644
> --- a/arch/x86/kvm/irq.c
> +++ b/arch/x86/kvm/irq.c
> @@ -78,7 +78,6 @@ int kvm_cpu_get_interrupt(struct kvm_vcpu *v)
>  	if (vector == -1) {
>  		if (kvm_apic_accept_pic_intr(v)) {
>  			s = pic_irqchip(v->kvm);
> -			s->output = 0;		/* PIC */
>  			vector = kvm_pic_read_irq(v->kvm);
>  		}
>  	}
>   

Please split into a different patch.  Even though it is a lot simpler, 
it contains non-local changes and is therefore relatively dangerous.

> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 44e87a5..854e8c9 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -3174,10 +3174,10 @@ static void inject_pending_irq(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
>  			vcpu->arch.nmi_injected = true;
>  			kvm_x86_ops->set_nmi(vcpu);
>  		}
> -	} else if (kvm_cpu_has_interrupt(vcpu)) {
> -		if (kvm_x86_ops->interrupt_allowed(vcpu)) {
> -			kvm_queue_interrupt(vcpu, kvm_cpu_get_interrupt(vcpu),
> -					    false);
> +	} else if (kvm_x86_ops->interrupt_allowed(vcpu)) {
> +		int vec = kvm_cpu_get_interrupt(vcpu);
> +		if (vec != -1) {
> +			kvm_queue_interrupt(vcpu, vec, false);
>  			kvm_x86_ops->set_irq(vcpu);
>  		}
>  	}
>   

Again, I don't think this is a win.  Usually ->interrupts_allowed() == 
true so we'll execute the rest anyway.

Perhaps we could move the call to has_interrupt into get_interrupt.

-- 
error compiling committee.c: too many arguments to function


      reply	other threads:[~2009-05-19  9:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-18  8:44 [PATCH] If interrupt injection is not possible do not scan IRR Gleb Natapov
2009-05-18  9:00 ` Avi Kivity
2009-05-18  9:08   ` Gleb Natapov
2009-05-18 11:16 ` Gleb Natapov
2009-05-19  9:50   ` Avi Kivity [this message]

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=4A1280D2.7060508@redhat.com \
    --to=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    /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.