|
|
22c213 |
From 0d5a09173eb75b7e56122c2aefb2646a2be58400 Mon Sep 17 00:00:00 2001
|
|
|
22c213 |
From: Peter Xu <peterx@redhat.com>
|
|
|
22c213 |
Date: Fri, 31 Jan 2020 17:12:57 +0000
|
|
|
22c213 |
Subject: [PATCH 15/15] apic: Use 32bit APIC ID for migration instance ID
|
|
|
22c213 |
|
|
|
22c213 |
RH-Author: Peter Xu <peterx@redhat.com>
|
|
|
22c213 |
Message-id: <20200131171257.1066593-4-peterx@redhat.com>
|
|
|
22c213 |
Patchwork-id: 93628
|
|
|
22c213 |
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 3/3] apic: Use 32bit APIC ID for migration instance ID
|
|
|
22c213 |
Bugzilla: 1529231
|
|
|
22c213 |
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
22c213 |
RH-Acked-by: Juan Quintela <quintela@redhat.com>
|
|
|
22c213 |
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
22c213 |
|
|
|
22c213 |
Migration is silently broken now with x2apic config like this:
|
|
|
22c213 |
|
|
|
22c213 |
-smp 200,maxcpus=288,sockets=2,cores=72,threads=2 \
|
|
|
22c213 |
-device intel-iommu,intremap=on,eim=on
|
|
|
22c213 |
|
|
|
22c213 |
After migration, the guest kernel could hang at anything, due to
|
|
|
22c213 |
x2apic bit not migrated correctly in IA32_APIC_BASE on some vcpus, so
|
|
|
22c213 |
any operations related to x2apic could be broken then (e.g., RDMSR on
|
|
|
22c213 |
x2apic MSRs could fail because KVM would think that the vcpu hasn't
|
|
|
22c213 |
enabled x2apic at all).
|
|
|
22c213 |
|
|
|
22c213 |
The issue is that the x2apic bit was never applied correctly for vcpus
|
|
|
22c213 |
whose ID > 255 when migrate completes, and that's because when we
|
|
|
22c213 |
migrate APIC we use the APICCommonState.id as instance ID of the
|
|
|
22c213 |
migration stream, while that's too short for x2apic.
|
|
|
22c213 |
|
|
|
22c213 |
Let's use the newly introduced initial_apic_id for that.
|
|
|
22c213 |
|
|
|
22c213 |
Signed-off-by: Peter Xu <peterx@redhat.com>
|
|
|
22c213 |
Reviewed-by: Juan Quintela <quintela@redhat.com>
|
|
|
22c213 |
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
22c213 |
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
|
22c213 |
(cherry picked from commit 0ab994867c365db21e15f9503922c79234d8e40e)
|
|
|
22c213 |
Signed-off-by: Peter Xu <peterx@redhat.com>
|
|
|
22c213 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
22c213 |
---
|
|
|
22c213 |
hw/intc/apic_common.c | 5 ++++-
|
|
|
22c213 |
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
22c213 |
|
|
|
22c213 |
diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c
|
|
|
22c213 |
index 54b8731..b5dbeb6 100644
|
|
|
22c213 |
--- a/hw/intc/apic_common.c
|
|
|
22c213 |
+++ b/hw/intc/apic_common.c
|
|
|
22c213 |
@@ -268,7 +268,10 @@ static void apic_common_realize(DeviceState *dev, Error **errp)
|
|
|
22c213 |
APICCommonState *s = APIC_COMMON(dev);
|
|
|
22c213 |
APICCommonClass *info;
|
|
|
22c213 |
static DeviceState *vapic;
|
|
|
22c213 |
- uint32_t instance_id = s->id;
|
|
|
22c213 |
+ uint32_t instance_id = s->initial_apic_id;
|
|
|
22c213 |
+
|
|
|
22c213 |
+ /* Normally initial APIC ID should be no more than hundreds */
|
|
|
22c213 |
+ assert(instance_id != VMSTATE_INSTANCE_ID_ANY);
|
|
|
22c213 |
|
|
|
22c213 |
info = APIC_COMMON_GET_CLASS(s);
|
|
|
22c213 |
info->realize(dev, errp);
|
|
|
22c213 |
--
|
|
|
22c213 |
1.8.3.1
|
|
|
22c213 |
|