public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: "Dong, Eddie" <eddie.dong@intel.com>
Cc: Avi Kivity <avi@redhat.com>, "kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: Enable IRQ windows after exception injection if there are pending virq
Date: Tue, 12 May 2009 18:27:14 +0300	[thread overview]
Message-ID: <20090512152714.GN19446@redhat.com> (raw)
In-Reply-To: <9832F13BD22FB94A829F798DA4A8280501B24E5674@pdsmsx503.ccr.corp.intel.com>

On Tue, May 12, 2009 at 11:06:39PM +0800, Dong, Eddie wrote:
> 
> I didn't take many test since our PTS system stop working now due to KVM userspace
> build changes. But since the logic is pretty simple, so I want to post here to see comments.
> Thx, eddie
> 
> 
> 
> 
> If there is pending irq after an virtual exception is injected,
> KVM needs to enable IRQ window to trap back earlier once 
> the exception is handled.
> 
I already posted patch to do that http://patchwork.kernel.org/patch/21830/
Is you patch different?

> Signed-off-by: Eddie Dong <eddie.dong@intel.com>
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 308d8e9..f8ceaea 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -3154,15 +3154,18 @@ static void inject_irq(struct kvm_vcpu *vcpu)
>  	}
>  }
>  
> -static void inject_pending_irq(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
> +static void inject_pending_irq(struct kvm_vcpu *vcpu)
>  {
> -	bool req_int_win = !irqchip_in_kernel(vcpu->kvm) &&
> -		kvm_run->request_interrupt_window;
> -
>  	if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP)
>  		kvm_x86_ops->drop_interrupt_shadow(vcpu);
>  
>  	inject_irq(vcpu);
> +}
> +
> +static void set_pending_virq(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
> +{
> +	bool req_int_win = !irqchip_in_kernel(vcpu->kvm) &&
> +		kvm_run->request_interrupt_window;
>  
>  	/* enable NMI/IRQ window open exits if needed */
>  	if (vcpu->arch.nmi_pending)
> @@ -3229,7 +3232,9 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
>  	if (vcpu->arch.exception.pending)
>  		__queue_exception(vcpu);
>  	else
> -		inject_pending_irq(vcpu, kvm_run);
> +		inject_pending_irq(vcpu);
> +
> +	set_pending_virq(vcpu, kvm_run);
>  
>  	if (kvm_lapic_enabled(vcpu)) {
>  		if (!vcpu->arch.apic->vapic_addr)


--
			Gleb.

  reply	other threads:[~2009-05-12 15:27 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-30  7:24 Implement generic double fault generation mechanism Dong, Eddie
2009-05-03 10:53 ` Gleb Natapov
2009-05-08  8:27   ` Dong, Eddie
2009-05-08  9:53     ` Gleb Natapov
2009-05-08 10:39       ` Dong, Eddie
2009-05-08 10:46         ` Dong, Eddie
2009-05-08 12:23           ` Gleb Natapov
2009-05-08 15:00             ` Dong, Eddie
2009-05-08 18:44               ` Gleb Natapov
2009-05-11  1:04                 ` Dong, Eddie
2009-05-11  6:02                   ` Gleb Natapov
2009-05-12  5:35                     ` Dong, Eddie
2009-05-12  7:01                       ` Gleb Natapov
2009-05-12 15:06                         ` Enable IRQ windows after exception injection if there are pending virq Dong, Eddie
2009-05-12 15:27                           ` Gleb Natapov [this message]
2009-05-13  7:45                             ` Dong, Eddie
2009-05-13 10:29                               ` Gleb Natapov
2009-05-13 14:05                         ` Implement generic double fault generation mechanism Dong, Eddie
2009-05-11  6:17                   ` Avi Kivity
2009-05-12  7:38                     ` event injection MACROs Dong, Eddie
2009-05-12  8:49                       ` Gleb Natapov
2009-05-13  9:49                       ` Avi Kivity
2009-05-13 14:20                         ` Dong, Eddie
2009-05-14  9:27                           ` Avi Kivity
2009-05-14 13:43                             ` Dong, Eddie
2009-05-14 14:16                               ` Gleb Natapov
2009-05-14 14:34                                 ` Dong, Eddie
2009-05-14 15:44                                   ` Gleb Natapov
2009-05-15  7:57                                     ` Dong, Eddie
2009-05-17  9:44                                       ` Gleb Natapov
2009-05-08 12:16         ` Implement generic double fault generation mechanism Gleb Natapov
2009-05-08  8:19 ` Dong, Eddie
2009-05-08  8:28   ` Avi Kivity

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=20090512152714.GN19446@redhat.com \
    --to=gleb@redhat.com \
    --cc=avi@redhat.com \
    --cc=eddie.dong@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox