From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [patch 1/4] QEMU/KVM: only use KVM apic registers if vm is running Date: Sun, 06 Apr 2008 12:09:55 +0300 Message-ID: <47F89363.9010707@qumranet.com> References: <20080405182246.761430758@localhost.localdomain> <20080405182319.970264704@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel@lists.sourceforge.net To: Marcelo Tosatti Return-path: In-Reply-To: <20080405182319.970264704@localhost.localdomain> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org Marcelo Tosatti wrote: > In the -incoming case the apic regs are not initialized and therefore > bogus. > > Signed-off-by: Marcelo Tosatti > > Index: kvm-userspace.io/qemu/qemu-kvm-x86.c > =================================================================== > --- kvm-userspace.io.orig/qemu/qemu-kvm-x86.c > +++ kvm-userspace.io/qemu/qemu-kvm-x86.c > @@ -27,6 +27,8 @@ static int kvm_has_msr_star; > > static int lm_capable_kernel; > > +extern int vm_running; > + > int kvm_arch_qemu_create_context(void) > { > int i; > @@ -248,7 +250,7 @@ void kvm_arch_load_regs(CPUState *env) > sregs.cr3 = env->cr[3]; > sregs.cr4 = env->cr[4]; > > - if (kvm_irqchip_in_kernel(kvm_context)) { > + if (kvm_irqchip_in_kernel(kvm_context) && vm_running) { > sregs.cr8 = kvm_get_cr8(kvm_context, env->cpu_index); > sregs.apic_base = kvm_get_apic_base(kvm_context, env->cpu_index); > } else { > Fishy. What if the vm is stopped using the monitor? -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Register now and save $200. Hurry, offer ends at 11:59 p.m., Monday, April 7! Use priority code J8TLD2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone