Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > media > main-src > by-pkgid > aadbe78a25743146bb784eee19f007c5 > files > 122

kvm-83-164.el5_5.9.src.rpm

From aff7d21858173c4e461fc3fe08d58907c8c64797 Mon Sep 17 00:00:00 2001
From: Juan Quintela <quintela@redhat.com>
Date: Tue, 5 May 2009 22:41:46 +0200
Subject: [PATCH 12/15] Fix migration with smp (Bz 485966)

Problem with migration and smp was that all cpus ended with apic=0
after migration.  Kernel and qemu have a different concept of apic id.

This fixes the problem.  Box now survive migration with high IO load,
and cpu overcommit (8 vcpus on 4 physical cores)

Signed-off-by: Juan Quintela <quintela@redhat.com>

From:	Glauber Costa <glommer@redhat.com>
Subject: [PATCH 2/2] Present kvm with corret apic phys id.
To:	kvm@vger.kernel.org
Cc:	avi@redhat.com, ehabkost@redhat.com
Date:	Wed, 29 Apr 2009 16:31:41 -0400

KVM will 24-shift bits in addr 0x20 (APIC_ID) before actually
using it. We currently load phys_id as "s->id". After shifted
by 24 bits, it will result in a meaningless value. We should really
be doing "s->id << 24", which, after shifted, will lead to the correct
value.

This is for the load function. save has the invert problem.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Message-ID: <m37i0v7051.fsf@neno.mitica>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Upstream-status: submitted(kvm)
Bugzilla: 500263
Acked-by: Glauber Costa <glommer@redhat.com>
Acked-by: Avi Kivity <avi@redhat.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Zachary Amsden <zamsden@redhat.com>
Acked-by: Rik van Riel <riel@redhat.com>
---
 qemu/hw/apic.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/qemu/hw/apic.c b/qemu/hw/apic.c
index 416eee9..94bea3e 100644
--- a/qemu/hw/apic.c
+++ b/qemu/hw/apic.c
@@ -831,7 +831,7 @@ static void kvm_kernel_lapic_save_to_user(APICState *s)
 
     kvm_get_lapic(kvm_context, s->cpu_env->cpu_index, kapic);
 
-    s->id = kapic_reg(kapic, 0x2);
+    s->id = kapic_reg(kapic, 0x2) >> 24;
     s->tpr = kapic_reg(kapic, 0x8);
     s->arb_id = kapic_reg(kapic, 0x9);
     s->log_dest = kapic_reg(kapic, 0xd) >> 24;
@@ -864,7 +864,7 @@ static void kvm_kernel_lapic_load_from_user(APICState *s)
     int i;
 
     memset(klapic, 0, sizeof apic);
-    kapic_set_reg(klapic, 0x2, s->id);
+    kapic_set_reg(klapic, 0x2, s->id << 24);
     kapic_set_reg(klapic, 0x8, s->tpr);
     kapic_set_reg(klapic, 0xd, s->log_dest << 24);
     kapic_set_reg(klapic, 0xe, s->dest_mode << 28 | 0x0fffffff);
-- 
1.6.3.rc4.29.g8146