public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: "Dong, Eddie" <eddie.dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: pre-preparation for in-kernel device model
Date: Tue, 05 Jun 2007 14:32:38 +0300	[thread overview]
Message-ID: <466549D6.903@qumranet.com> (raw)
In-Reply-To: <10EA09EFD8728347A513008B6B0DA77A018E0662-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>

Dong, Eddie wrote:
> When in kernel device model is introduced, the guest interrupt status 
> may get changed when after it injected an IRQ and thus guest see a 
> messed interrupt state. This patch tries to disable irq at that window 
> to avoid the confusion.
>
>
>      Signed-off-by: Yaozu (Eddie) Dong <eddie.dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>
>
>
> diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
> index ef9e32b..0cf6ea7 100644
> --- a/drivers/kvm/vmx.c
> +++ b/drivers/kvm/vmx.c
> @@ -1977,9 +1977,6 @@ static int vmx_vcpu_run(struct kvm_vcpu *vcpu,
> struct kvm_run *kvm_run)
>  	int r;
>  
>  preempted:
> -	if (!vcpu->mmio_read_completed)
> -		do_interrupt_requests(vcpu, kvm_run);
> -
>  	if (vcpu->guest_debug.enabled)
>  		kvm_guest_debug_pre(vcpu);
>  
> @@ -1996,9 +1993,16 @@ again:
>  	 */
>  	vmcs_writel(HOST_CR0, read_cr0());
>  
> +	/*
> +	 * Disable interrupt to avoid future in kernel 
> +	 * APIC interrupt state confuse.
> +	 */
> +	asm ( "pushf; cli \n\t");
> +	if (!vcpu->mmio_read_completed)
> +		do_interrupt_requests(vcpu, kvm_run);
> +
>   

This is broken.  pushf changes %rsp, and if the compiler uses %rsp based 
addressing (-fomit-frame-pointer), it will use the wrong addresses for 
variables.

Suggest using local_irq_disable()/local_irq_enable() (and removing 
pushf/popf from the entry/exit sequence).

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


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

  parent reply	other threads:[~2007-06-05 11:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-05  9:28 pre-preparation for in-kernel device model Dong, Eddie
     [not found] ` <10EA09EFD8728347A513008B6B0DA77A018E0662-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-06-05 11:32   ` Avi Kivity [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-06-05 12:13 Gregory Haskins

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=466549D6.903@qumranet.com \
    --to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=eddie.dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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