1. 09 2月, 2018 1 次提交
  2. 19 1月, 2018 1 次提交
    • I
      possible_cpus: add CPUArchId::type field · d342eb76
      Igor Mammedov 提交于
      Remove dependency of possible_cpus on 1st CPU instance,
      which decouples configuration data from CPU instances that
      are created using that data.
      
      Also later it would be used for enabling early cpu to numa node
      configuration at runtime qmp_query_hotpluggable_cpus() should
      provide a list of available cpu slots at early stage,
      before machine_init() is called and the 1st cpu is created,
      so that mgmt might be able to call it and use output to set
      numa mapping.
      
      Use MachineClass::possible_cpu_arch_ids() callback to set
      cpu type info, along with the rest of possible cpu properties,
      to let machine define which cpu type* will be used.
      
      * for SPAPR it will be a spapr core type and for ARM/s390x/x86
        a respective descendant of CPUClass.
      
      Move parse_numa_opts() in vl.c after cpu_model is parsed into
      cpu_type so that possible_cpu_arch_ids() would know which
      cpu_type to use during layout initialization.
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Message-Id: <1515597770-268979-1-git-send-email-imammedo@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      d342eb76
  3. 12 1月, 2018 1 次提交
  4. 18 12月, 2017 3 次提交
  5. 02 12月, 2017 1 次提交
  6. 16 11月, 2017 2 次提交
    • D
      NUMA: Enable adding NUMA node implicitly · 7b8be49d
      Dou Liyang 提交于
      Linux and Windows need ACPI SRAT table to make memory hotplug work properly,
      however currently QEMU doesn't create SRAT table if numa options aren't present
      on CLI.
      
      Which breaks both linux and windows guests in certain conditions:
       * Windows: won't enable memory hotplug without SRAT table at all
       * Linux: if QEMU is started with initial memory all below 4Gb and no SRAT table
         present, guest kernel will use nommu DMA ops, which breaks 32bit hw drivers
         when memory is hotplugged and guest tries to use it with that drivers.
      
      Fix above issues by automatically creating a numa node when QEMU is started with
      memory hotplug enabled but without '-numa' options on CLI.
      (PS: auto-create numa node only for new machine types so not to break migration).
      
      Which would provide SRAT table to guests without explicit -numa options on CLI
      and would allow:
       * Windows: to enable memory hotplug
       * Linux: switch to SWIOTLB DMA ops, to bounce DMA transfers to 32bit allocated
         buffers that legacy drivers/hw can handle.
      
      [Rewritten by Igor]
      Reported-by: NThadeu Lima de Souza Cascardo <cascardo@canonical.com>
      Suggested-by: NIgor Mammedov <imammedo@redhat.com>
      Signed-off-by: NDou Liyang <douly.fnst@cn.fujitsu.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Marcel Apfelbaum <marcel@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Thomas Huth <thuth@redhat.com>
      Cc: Alistair Francis <alistair23@gmail.com>
      Cc: Takao Indoh <indou.takao@jp.fujitsu.com>
      Cc: Izumi Taku <izumi.taku@jp.fujitsu.com>
      Reviewed-by: NIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      7b8be49d
    • M
      hw/pci-host: Fix x86 Host Bridges 64bit PCI hole · 9fa99d25
      Marcel Apfelbaum 提交于
      Currently there is no MMIO range over 4G
      reserved for PCI hotplug. Since the 32bit PCI hole
      depends on the number of cold-plugged PCI devices
      and other factors, it is very possible is too small
      to hotplug PCI devices with large BARs.
      
      Fix it by reserving 2G for I4400FX chipset
      in order to comply with older Win32 Guest OSes
      and 32G for Q35 chipset.
      
      Even if the new defaults of pci-hole64-size will appear in
      "info qtree" also for older machines, the property was
      not implemented so no changes will be visible to guests.
      
      Note this is a regression since prev QEMU versions had
      some range reserved for 64bit PCI hotplug.
      Reviewed-by: NLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: NGerd Hoffmann <kraxel@redhat.com>
      Signed-off-by: NMarcel Apfelbaum <marcel@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      9fa99d25
  7. 27 10月, 2017 1 次提交
  8. 12 10月, 2017 1 次提交
    • I
      pc: make sure that plugged CPUs are of the same type · 6970c5ff
      Igor Mammedov 提交于
      heterogeneous cpus are not supported and hotplugging different
      cpu model crashes QEMU:
      
        qemu-system-x86_64 -cpu qemu64 -smp 1,maxcpus=2
        (qemu) device_add host-x86_64-cpu,socket-id=1,core-id=0,thread-id=0,id=foo
        (qemu) info cpus
        error: failed to get MSR 0x38d
        qemu-system-x86_64: target/i386/kvm.c:2121: kvm_get_msrs: Assertion `ret == cpu->kvm_msr_buf->nmsrs' failed.
        Aborted (core dumped)
      
      Gracefully fail hotplug process in case of user mistake.
      Reported-by: NGreg Kurz <groug@kaod.org>
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Message-Id: <1507638879-200718-1-git-send-email-imammedo@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      6970c5ff
  9. 20 9月, 2017 1 次提交
    • I
      numa: cpu: calculate/set default node-ids after all -numa CLI options are parsed · 79e07936
      Igor Mammedov 提交于
      Calculating default node-ids for CPUs in possible_cpu_arch_ids()
      is rather fragile since defaults calculation uses nb_numa_nodes but
      callback might be potentially called early before all -numa CLI
      options are parsed, which would lead to cpus assigned only upto
      nb_numa_nodes at the time possible_cpu_arch_ids() is called.
      
      Issue was introduced by
      (7c88e65d numa: mirror cpu to node mapping in MachineState::possible_cpus)
      and for example CLI:
        -smp 4 -numa node,cpus=0 -numa node
      would set props.node-id in possible_cpus array for every non
      explicitly mapped CPU to the first node.
      
      Issue is not visible to guest nor to mgmt interface due to
        1) implictly mapped cpus are forced to the first node in
           case of partial mapping
        2) in case of default mapping possible_cpu_arch_ids() is
           called after all -numa options are parsed (resulting
           in correct mapping).
      
      However it's fragile to rely on late execution of
      possible_cpu_arch_ids(), therefore add machine specific
      callback that returns node-id for CPU and use it to calculate/
      set defaults at machine_numa_finish_init() time when all -numa
      options are parsed.
      Reported-by: NEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Message-Id: <1496314408-163972-1-git-send-email-imammedo@redhat.com>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      79e07936
  10. 19 9月, 2017 3 次提交
    • A
      Convert single line fprintf(.../n) to warn_report() · 2ab4b135
      Alistair Francis 提交于
      Convert all the single line uses of fprintf(stderr, "warning:"..."\n"...
      to use warn_report() instead. This helps standardise on a single
      method of printing warnings to the user.
      
      All of the warnings were changed using this command:
        find ./* -type f -exec sed -i \
          's|fprintf(.*".*warning[,:] \(.*\)\\n"\(.*\));|warn_report("\1"\2);|Ig' \
          {} +
      
      Some of the lines were manually edited to reduce the line length to below
      80 charecters.
      
      The #include lines were manually updated to allow the code to compile.
      Signed-off-by: NAlistair Francis <alistair.francis@xilinx.com>
      Cc: Kevin Wolf <kwolf@redhat.com>
      Cc: Max Reitz <mreitz@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Aurelien Jarno <aurelien@aurel32.net>
      Cc: Yongbok Kim <yongbok.kim@imgtec.com>
      Cc: Stefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: James Hogan <james.hogan@imgtec.com> [mips]
      Message-Id: <ae8f8a7f0a88ded61743dff2adade21f8122a9e7.1505158760.git.alistair.francis@xilinx.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      2ab4b135
    • A
      hw/i386: Improve some of the warning messages · 9e5d2c52
      Alistair Francis 提交于
      Signed-off-by: NAlistair Francis <alistair.francis@xilinx.com>
      Suggested-by: NEduardo Habkost <ehabkost@redhat.com>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Message-Id: <1d6ef2ccd9667878ed5820fcf17eef35957ea5d8.1505158760.git.alistair.francis@xilinx.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      9e5d2c52
    • I
      pc: use generic cpu_model parsing · 311ca98d
      Igor Mammedov 提交于
      define default CPU type in generic way in pc_machine_class_init()
      and let common machine code to handle cpu_model parsing
      
      Patch also introduces TARGET_DEFAULT_CPU_TYPE define for 2 purposes:
        * make foo_machine_class_init() look uniform on every target
        * use define in [bsd|linux]-user targets to pick default
          cpu type
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Message-Id: <1505318697-77161-5-git-send-email-imammedo@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      311ca98d
  11. 22 8月, 2017 1 次提交
    • T
      hw/ppc/spapr: Fix segfault when instantiating a 'pc-dimm' without 'memdev' · 04790978
      Thomas Huth 提交于
      QEMU currently crashes when trying to use a 'pc-dimm' on the pseries
      machine without specifying its 'memdev' property. This happens because
      pc_dimm_get_memory_region() does not check whether the 'memdev' property
      has properly been set by the user. Looking closer at this function, it's
      also obvious that it is using &error_abort to call another function - and
      this is bad in a function that is used in the hot-plugging calling chain
      since this can also cause QEMU to exit unexpectedly.
      
      So let's fix these issues in a proper way now: Add a "Error **errp"
      parameter to pc_dimm_get_memory_region() which we use in case the 'memdev'
      property has not been set by the user, and which we can use instead of
      the &error_abort, and change the callers of get_memory_region() to make
      use of this "errp" parameter for proper error checking.
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Reviewed-by: NIgor Mammedov <imammedo@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      04790978
  12. 02 8月, 2017 1 次提交
    • I
      pc: make 'pc.rom' readonly when machine has PCI enabled · 208fa0e4
      Igor Mammedov 提交于
      looking at bios ROM mapping in QEMU it seems that only isapc
      (i.e. not PCI enabled machine) requires ROM being mapped as
      RW in other cases BIOS is mapped as RO. Do the same for option
      ROM 'pc.rom' when machine has PCI enabled.
      
      As useful side-effect pc.rom MemoryRegion stops being
      put in vhost memory map (filtered out by vhost_section()),
      which reduces number of entries by 1.
      
      Coincidentally it fixes migration failure reported in
      
      "[PATCH V2]  vhost: fix a migration failed because of vhost region merge"
      
      where following destination CLI with /sys/module/vhost/parameters/max_mem_regions = 8
      
      export DIMMSCOUNT=6
      QEMU -enable-kvm \
           -netdev type=tap,id=guest0,vhost=on,script=no,vhostforce \
           -device virtio-net-pci,netdev=guest0 \
           -m 256,slots=256,maxmem=2G \
           `i=0; while [ $i -lt $DIMMSCOUNT ]; do echo \
               "-object memory-backend-ram,id=m$i,size=128M \
                -device pc-dimm,id=d$i,memdev=m$i"; i=$(($i + 1)); \
           done`
      
      will fail to startup with error:
      
       "-device pc-dimm,id=d5,memdev=m5: a used vhost backend has no free memory slots left"
      
      while it's possible to add the 6th DIMM during hotplug
      on source.
      
      Issue is caused by the fact that number of entries in vhost map
      is bigger on 1 entry, when -device is processed, than
      after guest boots up, and that offending entry belongs to
      'pc.rom', it's not like vhost intends to do IO in ROM range
      so making it RO hides region from vhost and makes number
      of entries in vhost memory map at -device/machine_done time
      match number of entries after guest boots.
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Reported-by: NPeng Hao <peng.hao2@zte.com.cn>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      208fa0e4
  13. 15 7月, 2017 2 次提交
  14. 13 7月, 2017 2 次提交
  15. 20 6月, 2017 3 次提交
  16. 16 6月, 2017 1 次提交
    • S
      hw/i386: fix nvdimm check error path · 7f3cf2d6
      Stefan Hajnoczi 提交于
      Commit e987c37a ("hw/i386: check if
      nvdimm is enabled before plugging") introduced a check to reject nvdimm
      hotplug if -machine pc,nvdimm=on was not given.
      
      This check executes after pc_dimm_memory_plug() has already completed
      and does not reverse the effect of this function in the case of failure.
      
      Perform the check before calling pc_dimm_memory_plug().  This fixes the
      following abort:
      
        $ qemu -M accel=kvm -m 1G,slots=4,maxmem=8G \
               -object memory-backend-file,id=mem1,share=on,mem-path=nvdimm.dat,size=1G
        (qemu) device_add nvdimm,memdev=mem1
        nvdimm is not enabled: missing 'nvdimm' in '-M'
        (qemu) device_add nvdimm,memdev=mem1
        Core dumped
      
      The backtrace is:
      
        #0  0x00007fffdb5b191f in raise () at /lib64/libc.so.6
        #1  0x00007fffdb5b351a in abort () at /lib64/libc.so.6
        #2  0x00007fffdb5a9da7 in __assert_fail_base () at /lib64/libc.so.6
        #3  0x00007fffdb5a9e52 in  () at /lib64/libc.so.6
        #4  0x000055555577a5fa in qemu_ram_set_idstr (new_block=0x555556747a00, name=<optimized out>, dev=dev@entry=0x555556705590) at qemu/exec.c:1709
        #5  0x0000555555a0fe86 in vmstate_register_ram (mr=mr@entry=0x55555673a0e0, dev=dev@entry=0x555556705590) at migration/savevm.c:2293
        #6  0x0000555555965088 in pc_dimm_memory_plug (dev=dev@entry=0x555556705590, hpms=hpms@entry=0x5555566bb0e0, mr=mr@entry=0x555556705630, align=<optimized out>, errp=errp@entry=0x7fffffffc660)
            at hw/mem/pc-dimm.c:110
        #7  0x000055555581d89b in pc_dimm_plug (errp=0x7fffffffc6c0, dev=0x555556705590, hotplug_dev=<optimized out>) at qemu/hw/i386/pc.c:1713
        #8  0x000055555581d89b in pc_machine_device_plug_cb (hotplug_dev=<optimized out>, dev=0x555556705590, errp=0x7fffffffc6c0) at qemu/hw/i386/pc.c:2004
        #9  0x0000555555914da6 in device_set_realized (obj=<optimized out>, value=<optimized out>, errp=0x7fffffffc7e8) at hw/core/qdev.c:926
      
      Cc: Haozhong Zhang <haozhong.zhang@intel.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      Reviewed-by: NHaozhong Zhang <haozhong.zhang@intel.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      7f3cf2d6
  17. 06 6月, 2017 2 次提交
  18. 23 5月, 2017 1 次提交
    • E
      shutdown: Add source information to SHUTDOWN and RESET · cf83f140
      Eric Blake 提交于
      Time to wire up all the call sites that request a shutdown or
      reset to use the enum added in the previous patch.
      
      It would have been less churn to keep the common case with no
      arguments as meaning guest-triggered, and only modified the
      host-triggered code paths, via a wrapper function, but then we'd
      still have to audit that I didn't miss any host-triggered spots;
      changing the signature forces us to double-check that I correctly
      categorized all callers.
      
      Since command line options can change whether a guest reset request
      causes an actual reset vs. a shutdown, it's easy to also add the
      information to reset requests.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Acked-by: David Gibson <david@gibson.dropbear.id.au> [ppc parts]
      Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> [SPARC part]
      Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> [s390x parts]
      Message-Id: <20170515214114.15442-5-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      cf83f140
  19. 17 5月, 2017 1 次提交
    • E
      qdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable · e90f2a8c
      Eduardo Habkost 提交于
      cannot_instantiate_with_device_add_yet was introduced by commit
      efec3dd6 to replace no_user. It was
      supposed to be a temporary measure.
      
      When it was introduced, we had 54
      cannot_instantiate_with_device_add_yet=true lines in the code.
      Today (3 years later) this number has not shrunk: we now have
      57 cannot_instantiate_with_device_add_yet=true lines. I think it
      is safe to say it is not a temporary measure, and we won't see
      the flag go away soon.
      
      Instead of a long field name that misleads people to believe it
      is temporary, replace it a shorter and less misleading field:
      user_creatable.
      
      Except for code comments, changes were generated using the
      following Coccinelle patch:
      
        @@
        expression DC;
        @@
        (
        -DC->cannot_instantiate_with_device_add_yet = false;
        +DC->user_creatable = true;
        |
        -DC->cannot_instantiate_with_device_add_yet = true;
        +DC->user_creatable = false;
        )
      
        @@
        typedef ObjectClass;
        expression dc;
        identifier class, data;
        @@
         static void device_class_init(ObjectClass *class, void *data)
         {
         ...
         dc->hotpluggable = true;
        +dc->user_creatable = true;
         ...
         }
      
        @@
        @@
         struct DeviceClass {
         ...
        -bool cannot_instantiate_with_device_add_yet;
        +bool user_creatable;
         ...
        }
      
        @@
        expression DC;
        @@
        (
        -!DC->cannot_instantiate_with_device_add_yet
        +DC->user_creatable
        |
        -DC->cannot_instantiate_with_device_add_yet
        +!DC->user_creatable
        )
      
      Cc: Alistair Francis <alistair.francis@xilinx.com>
      Cc: Laszlo Ersek <lersek@redhat.com>
      Cc: Marcel Apfelbaum <marcel@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Cc: Peter Maydell <peter.maydell@linaro.org>
      Cc: Thomas Huth <thuth@redhat.com>
      Acked-by: NAlistair Francis <alistair.francis@xilinx.com>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Reviewed-by: NMarcel Apfelbaum <marcel@redhat.com>
      Acked-by: NMarcel Apfelbaum <marcel@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      Message-Id: <20170503203604.31462-2-ehabkost@redhat.com>
      [ehabkost: kept "TODO remove once we're there" comment]
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      e90f2a8c
  20. 12 5月, 2017 3 次提交
  21. 11 5月, 2017 1 次提交
  22. 24 4月, 2017 1 次提交
  23. 22 2月, 2017 6 次提交