public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* QEMU/KVM: make kvm_arch_load_regs() aware of in kernel APIC
@ 2008-04-03 23:24 Marcelo Tosatti
  2008-04-04 16:23 ` Ryan Harper
  2008-04-04 21:23 ` Avi Kivity
  0 siblings, 2 replies; 3+ messages in thread
From: Marcelo Tosatti @ 2008-04-03 23:24 UTC (permalink / raw)
  To: Anthony Liguori, Avi Kivity; +Cc: kvm-devel


kvm_arch_load_regs() might load APIC base and APIC TPR from the
uninitialized userspace APIC emulation.

This happened when running X11 on SMP guest in my case, disabling the
APIC for vcpu3:

vcpu not ready for apic_round_robin
vcpu not ready for apic_round_robin
vcpu not ready for apic_round_robin
...


Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>


diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
index 78490c5..401fbc6 100644
--- a/qemu/qemu-kvm-x86.c
+++ b/qemu/qemu-kvm-x86.c
@@ -250,9 +250,15 @@ void kvm_arch_load_regs(CPUState *env)
     sregs.cr3 = env->cr[3];
     sregs.cr4 = env->cr[4];
 
-    sregs.apic_base = cpu_get_apic_base(env);
+    if (kvm_irqchip_in_kernel(kvm_context)) {
+        sregs.cr8 = kvm_get_cr8(kvm_context, env->cpu_index);
+        sregs.apic_base = kvm_get_apic_base(kvm_context, env->cpu_index);
+    } else {
+        sregs.cr8 = cpu_get_apic_tpr(env);
+        sregs.apic_base = cpu_get_apic_base(env);
+    }
+
     sregs.efer = env->efer;
-    sregs.cr8 = cpu_get_apic_tpr(env);
 
     kvm_set_sregs(kvm_context, env->cpu_index, &sregs);
 

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: QEMU/KVM: make kvm_arch_load_regs() aware of in kernel APIC
  2008-04-03 23:24 QEMU/KVM: make kvm_arch_load_regs() aware of in kernel APIC Marcelo Tosatti
@ 2008-04-04 16:23 ` Ryan Harper
  2008-04-04 21:23 ` Avi Kivity
  1 sibling, 0 replies; 3+ messages in thread
From: Ryan Harper @ 2008-04-04 16:23 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm-devel, Avi Kivity

* Marcelo Tosatti <mtosatti@redhat.com> [2008-04-03 18:22]:
> 
> kvm_arch_load_regs() might load APIC base and APIC TPR from the
> uninitialized userspace APIC emulation.
> 
> This happened when running X11 on SMP guest in my case, disabling the
> APIC for vcpu3:
> 
> vcpu not ready for apic_round_robin
> vcpu not ready for apic_round_robin
> vcpu not ready for apic_round_robin

With this patch applied, I can start up my fedora8 guest with SMP and I
no longer get X11 video corruption.

-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
ryanh@us.ibm.com

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: QEMU/KVM: make kvm_arch_load_regs() aware of in kernel APIC
  2008-04-03 23:24 QEMU/KVM: make kvm_arch_load_regs() aware of in kernel APIC Marcelo Tosatti
  2008-04-04 16:23 ` Ryan Harper
@ 2008-04-04 21:23 ` Avi Kivity
  1 sibling, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2008-04-04 21:23 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm-devel

Marcelo Tosatti wrote:
> kvm_arch_load_regs() might load APIC base and APIC TPR from the
> uninitialized userspace APIC emulation.
>
> This happened when running X11 on SMP guest in my case, disabling the
> APIC for vcpu3:
>
> vcpu not ready for apic_round_robin
> vcpu not ready for apic_round_robin
> vcpu not ready for apic_round_robin
> ...
>   

Applied, thanks.

-- 
Any sufficiently difficult bug is indistinguishable from a feature.


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-04-04 21:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-03 23:24 QEMU/KVM: make kvm_arch_load_regs() aware of in kernel APIC Marcelo Tosatti
2008-04-04 16:23 ` Ryan Harper
2008-04-04 21:23 ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox