[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-xen master] pc: fix crash in rtc_set_memory() if initial cpu is marked as hotplugged



commit e88462aaa2f19e1238e77c1bcebbab7ef5380d7a
Author:     Igor Mammedov <imammedo@xxxxxxxxxx>
AuthorDate: Fri Dec 30 15:33:11 2016 +0100
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Thu Feb 16 14:12:48 2017 -0800

    pc: fix crash in rtc_set_memory() if initial cpu is marked as hotplugged
    
    'hotplugged' propperty is meant to be used on migration side when migrating
    source with hotplugged devices.
    However though it not exacly correct usage of 'hotplugged' property
    it's possible to set generic hotplugged property for CPU using
     -cpu foo,hotplugged=on
    or
     -global foo.hotplugged=on
    
    in this case qemu crashes with following backtrace:
    
    ...
    
    because pc_cpu_plug() assumes that hotplugged CPU could appear only after
    rtc/fw_cfg are initialized.
    Fix crash by replacing assumption with explicit checks of rtc/fw_cfg
    and updating them only if they were initialized.
    
    Cc: qemu-stable@xxxxxxxxxx
    Reported-by: Eduardo Habkost <ehabkost@xxxxxxxxxx>
    Reviewed-by: Eduardo Habkost <ehabkost@xxxxxxxxxx>
    Signed-off-by: Igor Mammedov <imammedo@xxxxxxxxxx>
    Message-Id: <1483108391-199542-1-git-send-email-imammedo@xxxxxxxxxx>
    Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
---
 hw/i386/pc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index a9e64a8..02cc5a2 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1818,8 +1818,10 @@ static void pc_cpu_plug(HotplugHandler *hotplug_dev,
 
     /* increment the number of CPUs */
     pcms->boot_cpus++;
-    if (dev->hotplugged) {
+    if (pcms->rtc) {
         rtc_set_cpus_count(pcms->rtc, pcms->boot_cpus);
+    }
+    if (pcms->fw_cfg) {
         fw_cfg_modify_i16(pcms->fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus);
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.