Skip to content

Commits

Permalink
work/accel-ope…
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Commits on Mar 6, 2015

  1. kvm: Move /dev/kvm opening/closing to open/close methods

    This will allow TYPE_KVM_ACCEL objects to be created for querying host
    capabilities without affecting global QEMU state.
    
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    ehabkost committed Mar 6, 2015
    Copy the full SHA
    36a250e View commit details
    Browse the repository at this point in the history
  2. kvm: Improve error reporting by kvm_init()

    On many simple error cases in kvm_init(), we can easily call
    error_setg*() instead of printing to stderr and using strerr(), so
    convert them.
    
    On some other cases, stderr printing is being kept because it includes a
    long explanation for the user, which doesn't seem to be appropriate as
    an error_setg() message.
    
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    ehabkost committed Mar 6, 2015
    Copy the full SHA
    34adf07 View commit details
    Browse the repository at this point in the history
  3. accel: Add "opened" property and open/close methods

    The new open/close methods will allow basic accel operations that don't
    affect global state (such as opening files or querying host
    capabilities) to be performed on an accelerator object.
    
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    ehabkost committed Mar 6, 2015
    Copy the full SHA
    4327a4e View commit details
    Browse the repository at this point in the history
  4. qom: Add helper for open/close boolean properties

    Properties that will call open/close functions when changed to
    true/false are a common pattern in QEMU (e.g. the DeviceState "realized"
    property and the RNG backend "opened" property). So to reduce the amount
    of boilerplate code needed for those properties, introduce a
    object_add_flip_property() helper that will register the property and
    call the open/close functions when necessary.
    
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    ehabkost committed Mar 6, 2015
    Copy the full SHA
    76e06ce View commit details
    Browse the repository at this point in the history
  5. accel: Add Error** parameter to init_machine() method

    Instead of returning errors using negative return values, use a Error**
    parameter to report errors.
    
    To keep the patch small, existing kvm_init() stderr error reporting code
    is being kept, except that sterror(ret) is being used as the error
    message before returning. It can be changed later to only call
    error_setg() instead of printing to stderr.
    
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    ehabkost committed Mar 6, 2015
    Copy the full SHA
    e9f4289 View commit details
    Browse the repository at this point in the history
  6. target-i386: Remove icc_bridge parameter from cpu_x86_create()

    Instead of passing icc_bridge from the PC initialization code to
    cpu_x86_create(), make the PC initialization code attach the CPU to
    icc_bridge.
    
    The only difference here is that icc_bridge attachment will now be done
    after x86_cpu_parse_featurestr() is called. But this shouldn't make any
    difference, as property setters shouldn't depend on icc_bridge.
    
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    ehabkost committed Mar 6, 2015
    Copy the full SHA
    2644ae9 View commit details
    Browse the repository at this point in the history
  7. target-i386: Call cpu_exec_init() on realize

    To allow new code to ask the CPU classes for CPU model information and
    allow QOM properties to be queried by qmp_device_list_properties(), we
    need to be able to safely instantiate a X86CPU object without any
    side-effects.
    
    cpu_exec_init() has lots of side-effects on global QEMU state, move it
    to realize so it will be called only if the X86CPU instance is realized.
    
    For reference, this is the current cpu_exec_init() code:
    
    > void cpu_exec_init(CPUArchState *env)
    > {
    >     CPUState *cpu = ENV_GET_CPU(env);
    >     CPUClass *cc = CPU_GET_CLASS(cpu);
    >     CPUState *some_cpu;
    >     int cpu_index;
    >
    > #ifndef CONFIG_USER_ONLY
    >     cpu->as = &address_space_memory;
    >     cpu->thread_id = qemu_get_thread_id();
    > #endif
    
    Those fields should be used only after actually starting the VCPU and can be
    initialized on realize.
    
    >
    > #if defined(CONFIG_USER_ONLY)
    >     cpu_list_lock();
    > #endif
    >     cpu_index = 0;
    >     CPU_FOREACH(some_cpu) {
    >         cpu_index++;
    >     }
    >     cpu->cpu_index = cpu_index;
    >     QTAILQ_INSERT_TAIL(&cpus, cpu, node);
    > #if defined(CONFIG_USER_ONLY)
    >     cpu_list_unlock();
    > #endif
    
    The above initializes cpu_index and add the CPU to the global CPU list.
    This affects QEMU global state and must be done only on realize.
    
    >     if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {
    >         vmstate_register(NULL, cpu_index, &vmstate_cpu_common, cpu);
    >     }
    > #if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY)
    >     register_savevm(NULL, "cpu", cpu_index, CPU_SAVE_VERSION,
    >                     cpu_save, cpu_load, env);
    >     assert(cc->vmsd == NULL);
    >     assert(qdev_get_vmsd(DEVICE(cpu)) == NULL);
    > #endif
    >     if (cc->vmsd != NULL) {
    >         vmstate_register(NULL, cpu_index, cc->vmsd, cpu);
    >     }
    
    vmstate and savevm registration also affects global QEMU state and should be
    done only on realize.
    
    > }
    
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    ehabkost committed Mar 6, 2015
    Copy the full SHA
    a9e7000 View commit details
    Browse the repository at this point in the history
  8. target-i386: Move TCG initialization to realize time

    To ask the CPU classes for CPU model information and allow QOM
    properties to be queried by qmp_device_list_properties(), we need to be
    able to safely instantiate a X86CPU object without any side-effects.
    
    Move TCG initialization to realize time so it won't be called when just
    doing object_new() on a X86CPU subclass.
    
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    ---
    Changes v1 -> v2:
     * Now the inited/tcg_initialized variable doesn't exist anymore
    ehabkost committed Mar 6, 2015
    Copy the full SHA
    c1ae975 View commit details
    Browse the repository at this point in the history
  9. target-i386: Move initialization check to tcg_x86_init()

    Instead of requiring cpu.c to check if TCG was already initialized,
    simply let the function be called multiple times.
    
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    ehabkost committed Mar 6, 2015
    Copy the full SHA
    084b85e View commit details
    Browse the repository at this point in the history
  10. target-i386: Rename optimize_flags_init()

    Rename the function so that the reason for its existence is clearer: it
    does x86-specific initialization of TCG structures.
    
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    ehabkost committed Mar 6, 2015
    Copy the full SHA
    08ee8e5 View commit details
    Browse the repository at this point in the history
  11. cpu: Reorder cpu->as and cpu->thread_id initialization

    Instead of initializing cpu->as and cpu->thread_id while holding
    cpu_list_lock(), initialize it earlier.
    
    This allows the code handling cpu_index and global CPU list to be
    isolated from the rest.
    
    Reviewed-by: Igor Mammedov <imammedo@redhat.com>
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    ehabkost committed Mar 6, 2015
    Copy the full SHA
    4feea7a View commit details
    Browse the repository at this point in the history
  12. cpu: Initialize breakpoint/watchpoint lists on cpu_common_initfn()

    One small step in the simplification of cpu_exec_init().
    
    Reviewed-by: Igor Mammedov <imammedo@redhat.com>
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    ehabkost committed Mar 6, 2015
    Copy the full SHA
    3dbc1ee View commit details
    Browse the repository at this point in the history
  13. cpu: No need to zero-initialize numa_node

    QOM objects are already zero-filled when instantiated, there's no need
    to explicitly set numa_node to 0.
    
    Reviewed-by: Igor Mammedov <imammedo@redhat.com>
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    ehabkost committed Mar 6, 2015
    Copy the full SHA
    b04b3ce View commit details
    Browse the repository at this point in the history
  14. target-i386: Require APIC ID to be explicitly set before CPU realize

    On softmuu, instead of setting APIC ID automatically when creating a
    X86CPU, require the property to be set before realizing the object
    (which is already done by the CPU creation code on PC).
    
    Keep apic_id = 0 by default on *-user so it can simply create a new CPU
    object and realize it without extra steps (so target-i386 will be able
    to use cpu_generic_init() eventually).
    
    Reviewed-by: Andreas Färber <afaerber@suse.de>
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    ehabkost committed Mar 6, 2015
    Copy the full SHA
    57cc6fe View commit details
    Browse the repository at this point in the history
  15. target-i386: Move APIC ID compatibility code to pc.c

    The APIC ID compatibility code is required only for PC, and now that
    x86_cpu_initfn() doesn't use x86_cpu_apic_id_from_index() anymore, that
    code can be moved to pc.c.
    
    Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
    Reviewed-by: Andreas Färber <afaerber@suse.de>
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    ehabkost committed Mar 6, 2015
    Copy the full SHA
    ecd8d11 View commit details
    Browse the repository at this point in the history
  16. target-i386: Move CPUX86State::cpuid_apic_id to X86CPU::apic_id

    The field doesn't need to be inside CPUX86State, and it is not specific
    for the CPUID instruction, so move and rename it.
    
    Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
    Reviewed-by: Andreas Färber <afaerber@suse.de>
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    ehabkost committed Mar 6, 2015
    Copy the full SHA
    d7d3a19 View commit details
    Browse the repository at this point in the history
  17. target-i386: Remove unused APIC ID default code

    The existing apic_id = cpu_index code has no visible effect: the PC code
    already initializes the APIC ID according to the topology on
    pc_new_cpu(), and linux-user memcpy()s the CPU state (including
    cpuid_apic_id) on cpu_copy().
    
    Remove the dead code and simply let APIC ID to to be 0 by default. This
    doesn't change behavior of PC because apic-id is already explicitly set,
    and doesn't affect linux-user because APIC ID was already always 0.
    
    Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
    Reviewed-by: Andreas Färber <afaerber@suse.de>
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    ehabkost committed Mar 6, 2015
    Copy the full SHA
    d0f6777 View commit details
    Browse the repository at this point in the history

Commits on Mar 5, 2015

  1. target-i386: Eliminate unnecessary get_cpuid_vendor() function

    The function was used in only two places. In one of them, the function
    made the code less readable by requiring temporary te[bcd]x variables.
    In the other one we can simply inline the existing code.
    
    Reviewed-by: Andreas Färber <afaerber@suse.de>
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    ehabkost committed Mar 5, 2015
    Copy the full SHA
    e269fb7 View commit details
    Browse the repository at this point in the history
  2. target-i386: Simplify listflags() function

    listflags() had lots of unnecessary complexity. Instead of printing to a
    buffer that will be immediately printed, simply call the printing
    function directly. Also, remove the fbits and flags arguments that were
    always set to the same value. Also, there's no need to list the flags in
    reverse order.
    
    Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    ehabkost committed Mar 5, 2015
    Copy the full SHA
    b3fec09 View commit details
    Browse the repository at this point in the history
  3. target-i386: Move topology.h to include/hw/i386

    This will allow the PC code to use the header, and lets us eliminate the
    QEMU_INCLUDES hack inside tests/Makefile.
    
    Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
    Reviewed-by: Andreas Färber <afaerber@suse.de>
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    ehabkost committed Mar 5, 2015
    Copy the full SHA
    6cae498 View commit details
    Browse the repository at this point in the history

Commits on Mar 4, 2015

  1. Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20150…

    …302.0' into staging
    
    Updates for QEMU 2.3-rc0:
     - Error reporting and static cleanup (Alexey Kardashevskiy)
     - Runtime mmap disable for tracing (Samuel Pitoiset)
     - Support for host directed device request (Alex Williamson)
    
    # gpg: Signature made Mon Mar  2 18:42:50 2015 GMT using RSA key ID 3BB08B22
    # gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>"
    # gpg:                 aka "Alex Williamson <alex@shazbot.org>"
    # gpg:                 aka "Alex Williamson <alwillia@redhat.com>"
    # gpg:                 aka "Alex Williamson <alex.l.williamson@gmail.com>"
    
    * remotes/awilliam/tags/vfio-update-20150302.0:
      vfio-pci: Enable device request notification support
      vfio: allow to disable MMAP per device with -x-mmap=off option
      vfio: Make type1 listener symbols static
      vfio: Add ioctl number to error report
    
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    pm215 committed Mar 4, 2015
    Copy the full SHA
    3539bbb View commit details
    Browse the repository at this point in the history

Commits on Mar 3, 2015

  1. vl: take iothread lock very early

    If the iothread lock isn't taken by the main thread, the RCU callbacks
    might run concurrently with the main thread.  QEMU's not ready for that.
    
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
    Tested-by: Gonglei <arei.gonglei@huawei.com>
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    bonzini authored and pm215 committed Mar 3, 2015
    Copy the full SHA
    576a94d View commit details
    Browse the repository at this point in the history
  2. Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into…

    … staging
    
    - more config options
    - bootdevice, iscsi, virtio-scsi fixes
    - build system patches for MinGW and config-devices.mak
    - qemu_mutex_lock_iothread deadlock fixes
    - another tiny patch from the record/replay series
    
    # gpg: Signature made Mon Mar  2 09:59:14 2015 GMT using RSA key ID 78C7AE83
    # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
    # gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"
    # gpg: WARNING: This key is not certified with a trusted signature!
    # gpg:          There is no indication that the signature belongs to the owner.
    # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
    #      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83
    
    * remotes/bonzini/tags/for-upstream:
      cpus: be more paranoid in avoiding deadlocks
      cpus: fix deadlock and segfault in qemu_mutex_lock_iothread
      virtio-scsi: Allocate op blocker reason before blocking
      Makefile.target: binary depends on config-devices
      Makefile: don't silence mak file test with V=1
      Makefile: fix up parallel building under MSYS+MinGW
      iscsi: Handle write protected case in reopen
      Give ivshmem its own config option
      Create specific config option for "platform-bus"
      Add specific config options for PCI-E bridges
      bootdevice: fix segment fault when booting guest with '-kernel' and '-initrd'
      timer: replace time() with QEMU_CLOCK_HOST
      virtio-scsi-dataplane: Call blk_set_aio_context within BQL
      block: Forbid bdrv_set_aio_context outside BQL
      scsi: give device a parent before setting properties
    
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    pm215 committed Mar 3, 2015
    Copy the full SHA
    3180aad View commit details
    Browse the repository at this point in the history
  3. Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2015-02-…

    …26' into staging
    
    QemuOpts: Convert various setters to Error
    
    # gpg: Signature made Thu Feb 26 13:56:43 2015 GMT using RSA key ID EB918653
    # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
    # gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"
    
    * remotes/armbru/tags/pull-error-2015-02-26:
      qtest: Use qemu_opt_set() instead of qemu_opts_parse()
      pc: Use qemu_opt_set() instead of qemu_opts_parse()
      qemu-sockets: Simplify setting numeric and boolean options
      block: Simplify setting numeric options
      qemu-img: Suppress unhelpful extra errors in convert, amend
      QemuOpts: Propagate errors through opts_parse()
      QemuOpts: Propagate errors through opts_do_parse()
      QemuOpts: Drop qemu_opt_set(), rename qemu_opt_set_err(), fix use
      block: Suppress unhelpful extra errors in bdrv_img_create()
      qemu-img: Suppress unhelpful extra errors in convert, resize
      QemuOpts: Convert qemu_opts_set() to Error, fix its use
      QemuOpts: Convert qemu_opt_set_number() to Error, fix its use
      QemuOpts: Convert qemu_opt_set_bool() to Error, fix its use
    
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    pm215 committed Mar 3, 2015
    Copy the full SHA
    5efde22 View commit details
    Browse the repository at this point in the history
  4. Revert "Merge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-…

    …request' into staging"
    
    This reverts commit b8a173b, reversing
    changes made to 5de0904.
    
    (I applied this pull request when I should not have done so, and
    am now immediately reverting it.)
    
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    pm215 committed Mar 3, 2015
    Copy the full SHA
    0856579 View commit details
    Browse the repository at this point in the history

Commits on Mar 2, 2015

  1. vfio-pci: Enable device request notification support

    Linux v4.0-rc1 vfio-pci introduced a new virtual interrupt to allow
    the kernel to request a device from the user.  When signaled, QEMU
    will by default attmempt to hot-unplug the device.  This is a one-
    shot attempt with the expectation that the kernel will continue to
    poll for the device if it is not returned.  Returning the device when
    requested is the expected standard model of cooperative usage, but we
    also add an option option to disable this feature.  Initially this
    opt-out is set as an experimental option because we really should
    honor kernel requests for the device.
    
    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    awilliam committed Mar 2, 2015
    Copy the full SHA
    47cbe50 View commit details
    Browse the repository at this point in the history
  2. vfio: allow to disable MMAP per device with -x-mmap=off option

    Disabling MMAP support uses the slower read/write accesses but allows to
    trace all MMIO accesses, which is not good for performance, but very
    useful for reverse engineering PCI drivers. This option allows to
    disable MMAP per device without a compile-time change.
    
    Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    hakzsam authored and awilliam committed Mar 2, 2015
    Copy the full SHA
    6ee47c9 View commit details
    Browse the repository at this point in the history
  3. vfio: Make type1 listener symbols static

    They are not used from anywhere but common.c which is where these are
    defined so make them static.
    
    Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    aik authored and awilliam committed Mar 2, 2015
    Copy the full SHA
    51b833f View commit details
    Browse the repository at this point in the history
  4. vfio: Add ioctl number to error report

    This makes the error report more informative.
    
    Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    aik authored and awilliam committed Mar 2, 2015
    Copy the full SHA
    46f770d View commit details
    Browse the repository at this point in the history
  5. Merge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request'…

    … into staging
    
    * remotes/ehabkost/tags/x86-pull-request:
      target-i386: Move APIC ID compatibility code to pc.c
      target-i386: Require APIC ID to be explicitly set before CPU realize
      target-i386: Set APIC ID using cpu_index on CONFIG_USER
      linux-user: Check for cpu_init() errors
      target-i386: Move CPUX86State.cpuid_apic_id to X86CPU.apic_id
      target-i386: Simplify error handling on cpu_x86_init_user()
      target-i386: Eliminate cpu_init() function
      target-i386: Rename cpu_x86_init() to cpu_x86_init_user()
      target-i386: Move topology.h to include/hw/i386
      target-i386: Eliminate unnecessary get_cpuid_vendor() function
      target-i386: Simplify listflags() function
    
    Conflicts:
    	target-i386/cpu.c
    
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    pm215 committed Mar 2, 2015
    Copy the full SHA
    b8a173b View commit details
    Browse the repository at this point in the history
  6. Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-p…

    …eter' into staging
    
    QOM infrastructure fixes and device conversions
    
    * Assertion fix for device_add with non-device types
    * Documentation fix
    * qdev_init() error reporting cleanups
    
    # gpg: Signature made Tue Feb 24 13:56:33 2015 GMT using RSA key ID 3E7E013F
    # gpg: Good signature from "Andreas Färber <afaerber@suse.de>"
    # gpg:                 aka "Andreas Färber <afaerber@suse.com>"
    
    * remotes/afaerber/tags/qom-devices-for-peter:
      parallel: parallel_hds_isa_init() shouldn't fail
      parallel: Factor out common parallel_hds_isa_init()
      serial: serial_hds_isa_init() shouldn't fail
      serial: Factor out common serial_hds_isa_init()
      etsec: Replace qdev_init() by qdev_init_nofail()
      leon3: Replace unchecked qdev_init() by qdev_init_nofail()
      ide/isa: Replace unchecked qdev_init() by qdev_init_nofail()
      qdev: Improve qdev_init_nofail()'s error reporting
      qom: Fix typo, 'my_class_init' -> 'derived_class_init'
      qdev: Avoid type assertion in qdev_build_hotpluggable_device_list()
    
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    pm215 committed Mar 2, 2015
    Copy the full SHA
    5de0904 View commit details
    Browse the repository at this point in the history
  7. Merge remote-tracking branch 'remotes/ehabkost/tags/numa-pull-request…

    …' into staging
    
    NUMA fixes queue
    
    # gpg: Signature made Mon Feb 23 19:28:42 2015 GMT using RSA key ID 984DC5A6
    # gpg: Can't check signature: public key not found
    
    * remotes/ehabkost/tags/numa-pull-request:
      numa: Rename set_numa_modes() to numa_post_machine_init()
      numa: Rename option parsing functions
      numa: Move QemuOpts parsing to set_numa_nodes()
      numa: Make max_numa_nodeid static
      numa: Move NUMA globals to numa.c
      vl.c: Remove unnecessary zero-initialization of NUMA globals
      numa: Move NUMA declarations from sysemu.h to numa.h
    
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    pm215 committed Mar 2, 2015
    Copy the full SHA
    2dffe55 View commit details
    Browse the repository at this point in the history
  8. cpus: be more paranoid in avoiding deadlocks

    For good measure, ensure that the following sequence:
    
       thread 1 calls qemu_mutex_lock_iothread
       thread 2 calls qemu_mutex_lock_iothread
       VCPU thread are created
       VCPU thread enters execution loop
    
    results in the VCPU threads letting the other two threads run
    and obeying iothread_requesting_mutex even if the VCPUs are
    not halted.  To do this, check iothread_requesting_mutex
    before execution starts.
    
    Tested-by: Leon Alrae <leon.alrae@imgtec.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    bonzini committed Mar 2, 2015
    Copy the full SHA
    21618b3 View commit details
    Browse the repository at this point in the history
  9. cpus: fix deadlock and segfault in qemu_mutex_lock_iothread

    When two threads (other than the low-priority TCG VCPU thread)
    are competing for the iothread lock, a deadlock can happen.  This
    is because iothread_requesting_mutex is set to false by the first
    thread that gets the mutex, and then the VCPU thread might never
    yield from the execution loop.  If iothread_requesting_mutex is
    changed from a bool to a counter, the deadlock is fixed.
    
    However, there is another bug in qemu_mutex_lock_iothread that
    can be triggered by the new call_rcu thread.  The bug happens
    if qemu_mutex_lock_iothread is called before the CPUs are
    created.  In that case, first_cpu is NULL and the caller
    segfaults in qemu_mutex_lock_iothread.  To fix this, just
    do not do the kick if first_cpu is NULL.
    
    Reported-by: Leon Alrae <leon.alrae@imgtec.com>
    Reported-by: Andreas Gustafsson <gson@gson.org>
    Tested-by: Leon Alrae <leon.alrae@imgtec.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    bonzini committed Mar 2, 2015
    Copy the full SHA
    6b49809 View commit details
    Browse the repository at this point in the history
  10. virtio-scsi: Allocate op blocker reason before blocking

    s->blocker is really only used in hw/scsi/virtio-scsi.c; the only places
    where it is used in hw/scsi/virtio-scsi-dataplane.c is when it is
    allocated and when it is freed. That does not make a whole lot of sense
    (and is actually wrong because this leads to s->blocker potentially
    being NULL when blk_op_block_all() is called in virtio-scsi.c), so move
    the allocation and destruction of s->blocker to the device realization
    and unrealization in virtio-scsi.c, respectively.
    
    Case in point:
    
    $ echo -e 'eject drv\nquit' | \
        x86_64-softmmu/qemu-system-x86_64 \
            -monitor stdio -machine accel=qtest -display none \
            -object iothread,id=thr -device virtio-scsi-pci,iothread=thr \
            -drive if=none,file=test.qcow2,format=qcow2,id=drv \
            -device scsi-cd,drive=drv
    
    Without this patch:
    
    (qemu) eject drv
    [1]    10102 done
           10103 segmentation fault (core dumped)
    
    With this patch:
    
    (qemu) eject drv
    Device 'drv' is busy: block device is in use by data plane
    (qemu) quit
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Message-Id: <1425057113-26940-1-git-send-email-mreitz@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    XanClic authored and bonzini committed Mar 2, 2015
    Copy the full SHA
    f6758f7 View commit details
    Browse the repository at this point in the history
Older