1. 14 3月, 2014 7 次提交
  2. 13 3月, 2014 33 次提交
    • P
      Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging · 57fac92c
      Peter Maydell 提交于
      Block pull request
      
      # gpg: Signature made Thu 13 Mar 2014 13:50:49 GMT using RSA key ID 81AB73C8
      # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
      # gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.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: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8
      
      * remotes/stefanha/tags/block-pull-request: (24 commits)
        block/raw-win32: bdrv_parse_filename() for hdev
        block/raw-posix: Strip protocol prefix on creation
        block/raw-posix: bdrv_parse_filename() for cdrom
        block/raw-posix: bdrv_parse_filename() for floppy
        block/raw-posix: bdrv_parse_filename() for hdev
        qemu-io: Fix warnings from static code analysis
        block: Unlink temporary file
        qcow2: Don't write with BDRV_O_INCOMING
        qcow2: Keep option in qcow2_invalidate_cache()
        qmp: add query-iothreads command
        iothread: stash thread ID away
        dataplane: replace internal thread with IOThread
        iothread: add "iothread" qdev property type
        qdev: make get_pointer() handle temporary strings
        iothread: add I/O thread object
        aio: add aio_context_acquire() and aio_context_release()
        rfifolock: add recursive FIFO lock
        object: add object_get_canonical_path_component()
        block: Rewrite the snapshot authorization mechanism for block filters.
        iotests: Test corruption during COW request
        ...
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      57fac92c
    • A
      oslib-posix: Fix build on FreeBSD · 41975b26
      Andreas Färber 提交于
      Commit 10f5bff6 (util: Split out
      exec_dir from os_find_datadir) moved code from os-posix.c to
      util/oslib-posix.c but forgot to move a FreeBSD #include alongside,
      needed for CTL_KERN among others.
      
      Cc: Fam Zheng <famz@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NAndreas Färber <andreas.faerber@web.de>
      Message-id: 1394717279-23406-1-git-send-email-andreas.faerber@web.de
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      41975b26
    • M
      block/raw-win32: bdrv_parse_filename() for hdev · 57ed25b1
      Max Reitz 提交于
      The "host_device" protocol driver should strip the "host_device:" prefix
      from filenames if present.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NBenoit Canet <benoit@irqsave.net>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      57ed25b1
    • M
      block/raw-posix: Strip protocol prefix on creation · cc28c6aa
      Max Reitz 提交于
      The hdev_create() implementation in block/raw-posix.c is used by the
      "host_device", "host_cdrom" and "host_floppy" protocol block drivers
      together. Thus, any of the associated prefixes may occur and exactly one
      should should be stripped, if it does (thus,
      "host_device:host_cdrom:/dev/cdrom" is not shortened to "/dev/cdrom").
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NBenoit Canet <benoit@irqsave.net>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      cc28c6aa
    • M
      block/raw-posix: bdrv_parse_filename() for cdrom · 18fa1c42
      Max Reitz 提交于
      The "host_cdrom" protocol drivers should strip the "host_cdrom:" prefix
      from filenames if present.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NBenoit Canet <benoit@irqsave.net>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      18fa1c42
    • M
      block/raw-posix: bdrv_parse_filename() for floppy · d3f49845
      Max Reitz 提交于
      The "host_floppy" protocol driver should strip the "host_floppy:" prefix
      from filenames if present.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NBenoit Canet <benoit@irqsave.net>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      d3f49845
    • M
      block/raw-posix: bdrv_parse_filename() for hdev · 7af803d4
      Max Reitz 提交于
      The "host_device" protocol driver should strip the "host_device:" prefix
      from filenames if present.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NBenoit Canet <benoit@irqsave.net>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      7af803d4
    • S
      qemu-io: Fix warnings from static code analysis · f9883880
      Stefan Weil 提交于
      Smatch complains about several global symbols which should be local.
      
      Add the missing 'static' attributes and move the 'extern' declaration
      of variable qemuio_misalign to qemu-io.h. This variable also changes
      the type from 'int' to 'bool' which better fits documents its use.
      Signed-off-by: NStefan Weil <sw@weilnetz.de>
      Acked-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      f9883880
    • M
      block: Unlink temporary file · 9562f69c
      Max Reitz 提交于
      If the image file cannot be opened and was created as a temporary file,
      it should be deleted; thus, in this case, we should jump to the
      "unlink_and_fail" label and not just to "fail".
      Reported-by: NBenoît Canet <benoit@irqsave.net>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Acked-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      9562f69c
    • K
      qcow2: Don't write with BDRV_O_INCOMING · 27eb6c09
      Kevin Wolf 提交于
      qcow2_open() causes writes when repairing an image with the dirty flag
      set and when clearing autoclear flags. It shouldn't do this when another
      qemu instance is still actively working on this image file.
      
      One effect of the bug is that images may have a cleared dirty flag while
      the migration source host still has it in use with lazy refcounts
      enabled, so refcounts are not accurate and the dirty flag must remain
      set.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      27eb6c09
    • K
      qcow2: Keep option in qcow2_invalidate_cache() · d475e5ac
      Kevin Wolf 提交于
      Instead of manually building a list of all options from BDRVQcowState
      values just reuse the options that were used to open the image.
      qcow2_open() won't fully use all of the options in the QDict, but that's
      okay.
      
      This fixes all of the driver-specific options in qcow2, except for
      lazy-refcounts, which was special cased before.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      d475e5ac
    • S
      qmp: add query-iothreads command · dc3dd0d2
      Stefan Hajnoczi 提交于
      The "query-iothreads" command returns a list of information about
      iothreads.  See the patch for API documentation.
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      dc3dd0d2
    • S
      iothread: stash thread ID away · 88eb7c29
      Stefan Hajnoczi 提交于
      Keep the thread ID around so we can report it via QMP.
      
      There's only one problem: qemu_get_thread_id() (gettid() wrapper on
      Linux) must be called from the thread itself.  There is no way to get
      the thread ID outside the thread.
      
      This patch uses a condvar to wait for iothread_run() to populate the
      thread_id inside the thread.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      88eb7c29
    • S
      dataplane: replace internal thread with IOThread · 48ff2692
      Stefan Hajnoczi 提交于
      Today virtio-blk dataplane uses a 1:1 device-per-thread model.  Now that
      IOThreads have been introduced we can generalize this to N:M devices per
      threads.
      
      This patch drops thread code from dataplane in favor of running inside
      an IOThread AioContext.
      
      As a bonus we solve the case where a guest keeps submitting I/O requests
      while dataplane is trying to stop.  Previously the dataplane thread
      would continue to process requests until the request gave it a break.
      Now we can shut down in bounded time thanks to
      aio_context_acquire/release.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      48ff2692
    • S
      iothread: add "iothread" qdev property type · 6e4a876b
      Stefan Hajnoczi 提交于
      Add a "iothread" qdev property type so devices can be hooked up to an
      IOThread from the comand-line:
      
        qemu -object iothread,id=iothread0 \
             -device some-device,x-iothread=iothread0
      
      Note that Paolo Bonzini <pbonzini@redhat.com> has suggested using QOM
      links instead.  This way the relationship between the objects is
      reflected in QOM.  There are currently shortcomings of
      object_property_add_link() which prevent this use case.  I will attempt
      to fix them and move to QOM links in a separate series.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      6e4a876b
    • I
      qdev: make get_pointer() handle temporary strings · 7d1de464
      Igor Mammedov 提交于
      get_pointer()'s print() callback might return a heap allocated
      string, to avoid adding dedicated get_pointer_foo for this case
      convert current print() callbacks to return temporary heap
      allocated string and make get_pointer() free it.
      Reviewed-by: NAndreas Färber <afaerber@suse.de>
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      7d1de464
    • S
      iothread: add I/O thread object · be8d8537
      Stefan Hajnoczi 提交于
      This is a stand-in for Michael Roth's QContext.  I expect this to be
      replaced once QContext is completed.
      
      The IOThread object is an AioContext event loop thread.  This patch adds
      the concept of multiple event loop threads, allowing users to define
      them.
      
      When SMP guests run on SMP hosts it makes sense to instantiate multiple
      IOThreads.  This spreads event loop processing across multiple cores.
      Note that additional patches are required to actually bind a device to
      an IOThread.
      
      [Andreas Färber <afaerber@suse.de> pointed out that the embedded parent
      object instance should be called "parent_obj" and have a newline
      afterwards.  This patch has been changed to reflect this.
      -- Stefan]
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      be8d8537
    • S
      aio: add aio_context_acquire() and aio_context_release() · 98563fc3
      Stefan Hajnoczi 提交于
      It can be useful to run an AioContext from a thread which normally does
      not "own" the AioContext.  For example, request draining can be
      implemented by acquiring the AioContext and looping aio_poll() until all
      requests have been completed.
      
      The following pattern should work:
      
        /* Event loop thread */
        while (running) {
            aio_context_acquire(ctx);
            aio_poll(ctx, true);
            aio_context_release(ctx);
        }
      
        /* Another thread */
        aio_context_acquire(ctx);
        bdrv_read(bs, 0x1000, buf, 1);
        aio_context_release(ctx);
      
      This patch implements aio_context_acquire() and aio_context_release().
      
      Note that existing aio_poll() callers do not need to worry about
      acquiring and releasing - it is only needed when multiple threads will
      call aio_poll() on the same AioContext.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      98563fc3
    • S
      rfifolock: add recursive FIFO lock · 2da61b67
      Stefan Hajnoczi 提交于
      QemuMutex does not guarantee fairness and cannot be acquired
      recursively:
      
      Fairness means each locker gets a turn and the scheduler cannot cause
      starvation.
      
      Recursive locking is useful for composition, it allows a sequence of
      locking operations to be invoked atomically by acquiring the lock around
      them.
      
      This patch adds RFifoLock, a recursive lock that guarantees FIFO order.
      Its first user is added in the next patch.
      
      RFifoLock has one additional feature: it can be initialized with an
      optional contention callback.  The callback is invoked whenever a thread
      must wait for the lock.  For example, it can be used to poke the current
      owner so that they release the lock soon.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      2da61b67
    • S
      object: add object_get_canonical_path_component() · 11f590b1
      Stefan Hajnoczi 提交于
      It is often useful to find an object's child property name.  Also use
      this new function to simplify the implementation of
      object_get_canonical_path().
      Reviewed-by: NAndreas Färber <afaerber@suse.de>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      11f590b1
    • B
      block: Rewrite the snapshot authorization mechanism for block filters. · b5042a36
      Benoît Canet 提交于
      This patch keep the recursive way of doing things but simplify it by giving
      two responsabilities to all block filters implementors.
      
      They will need to do two things:
      
      -Set the is_filter field of their block driver to true.
      
      -Implement the bdrv_recurse_is_first_non_filter method of their block driver like
      it is done on the Quorum block driver. (block/quorum.c)
      
      [Paolo Bonzini <pbonzini@redhat.com> pointed out that this patch changes
      the semantics of blkverify, which now recurses down both bs->file and
      s->test_file.
      -- Stefan]
      Reported-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NBenoit Canet <benoit@irqsave.net>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      b5042a36
    • M
      iotests: Test corruption during COW request · 98d39e34
      Max Reitz 提交于
      Extend test file 060 by a test case for corruption occuring concurrently
      to a COW request. QEMU should not crash but rather return an appropriate
      error message.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      98d39e34
    • M
      block: bs->drv may be NULL in bdrv_debug_resume() · 938789ea
      Max Reitz 提交于
      Currently, bdrv_debug_resume() requires every bs->drv in the BDS stack
      to be NULL until a bs->drv with an implementation of bdrv_debug_resume()
      is found. For a normal function, this would be fine, but this is a
      function for debugging purposes and should therefore allow intermediate
      BDS not to have a driver (i.e., be "ejected"). Otherwise, it is hard to
      debug such situations.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      938789ea
    • M
      qcow2: Check bs->drv in copy_sectors() · dba28555
      Max Reitz 提交于
      Before dereferencing bs->drv for a call to its member bdrv_co_readv(),
      copy_sectors() should check whether that pointer is indeed valid, since
      it may have been set to NULL by e.g. a concurrent write triggering the
      corruption prevention mechanism.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      dba28555
    • K
      block: Update image size in bdrv_invalidate_cache() · 3456a8d1
      Kevin Wolf 提交于
      After migration has completed, we call bdrv_invalidate_cache() so that
      drivers which cache some data drop their stale copy of the data and
      reread it from the image file to get a new version of data that the
      source modified while the migration was running.
      
      Reloading metadata from the image file is useless, though, if the size
      of the image file stays stale (this is a value that is cached for all
      image formats in block.c). Reads from (meta)data after the old EOF
      return only zeroes, causing image corruption.
      
      We need to update bs->total_sectors in all layers that could potentially
      have changed their size (i.e. backing files are not a concern - if they
      are changed, we're in bigger trouble)
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      3456a8d1
    • M
      qcow2-refcount: Sanitize refcount table entry · 26d49c46
      Max Reitz 提交于
      When reading the refcount table entry in get_refcount(), only bits which
      are actually significant for the refcount block offset should be taken
      into account.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NLaszlo Ersek <lersek@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      26d49c46
    • P
      Merge remote-tracking branch 'remotes/afaerber/tags/ppc-for-2.0' into staging · be86c53c
      Peter Maydell 提交于
      PowerPC queue for 2.0-rc0
      
      * QEMUMachine include cleanup
      * SLOF update
      * XICS reset fix
      * sPAPR PCI host bridge refactorings
      
      # gpg: Signature made Thu 13 Mar 2014 02:50:51 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/ppc-for-2.0:
        spapr-pci: Convert fprintf() to error_report()
        spapr-pci: Convert to QOM realize
        xics-kvm: Fix reset function
        pseries: Update SLOF firmware image to qemu-slof-20140304
        Move QEMUMachine typedef to qemu/typedefs.h
        Revert "KVM: Split QEMUMachine typedef into separate header"
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      be86c53c
    • P
      Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' into staging · c8d146ae
      Peter Maydell 提交于
      QOM/QTest infrastructure fixes and device conversions
      
      * QTest cleanups and test cases for some virtio devices
      * QTest for sPAPR PCI host bridge
      * qom-test now tests reading all properties beneath /machine
      * QOM API leak fixes
      * QOM cleanups for SSI devices
      * QOM conversion of QEMUMachine
      * QOM realize for buses
      * sPAPR PCI bus name change
      
      # gpg: Signature made Thu 13 Mar 2014 00:22:40 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: (31 commits)
        libqtest: Fix possible deadlock in qtest initialization
        pci: Move VMState registration/unregistration to QOM realize/unrealize
        qdev: Realize buses on device realization
        qdev: Prepare realize/unrealize hooks for BusState
        tests: Add spapr-pci-host-bridge qtest
        virtio-serial-port: Convert to QOM realize/unrealize
        virtio-console: QOM cast cleanup for VirtConsole
        tests: Add virtio-console qtest
        tests: Add virtio-serial qtest
        tests: Add virtio-scsi qtest
        tests: Add virtio-rng qtest
        tests: Add virtio-balloon qtest
        tests: Add virtio-blk qtest
        tests: Clean up IndustryPack TPCI200 gcov paths
        qom-test: Test QOM properties
        hw/boards: Convert current_machine to MachineState
        vl: Use MachineClass instead of global QEMUMachine list
        hw/core: Introduce QEMU machine as QOM object
        qdev-monitor-test: Don't test human-readable error message
        qdev-monitor-test: Simplify using g_assert_cmpstr()
        ...
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      c8d146ae
    • P
      libqtest: Avoid inline varargs functions · 0100f425
      Peter Maydell 提交于
      Older versions of gcc (eg 4.6) can't handle varargs functions declared
      inline for anything other than completely trivial uses, and complain:
      
      tests/qom-test.c: In function 'qmp': tests/libqtest.h:359:60: sorry,
      unimplemented: function 'qmp' can never be inlined because it uses
      variable argument lists
      
      Avoid this problem by putting the functions into libqtest.c instead
      of using inline definitions in libqtest.h.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NAndreas Färber <afaerber@suse.de>
      0100f425
    • A
      295d51aa
    • A
      spapr-pci: Convert to QOM realize · c6ba42f6
      Alexey Kardashevskiy 提交于
      This converts the old-style SysBusDevice::init() callback to a new-style
      DeviceClass::realize() callback.
      
      As a part of conversion, this replaces fprintf(stderr) with error_setg()
      as realize() does not "return" any value, instead it puts the extended
      error into **errp.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Reviewed-by: NMike Day <ncmike@ncultra.org>
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      c6ba42f6
    • A
      xics-kvm: Fix reset function · fb0e843a
      Alexey Kardashevskiy 提交于
      Currently interrupt priorities are set to 0 (highest) at the very
      beginning of the guest execution which is not correct and makes the guest
      produce random interrupt error messages such as:
      "Interrupt 0x1001 (real) is invalid, disabling it".
      This also prevents interrupt states from correct migration.
      
      This initializes priority to 0xFF as the emulated XICS does.
      Suggested-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      fb0e843a
    • A
      pseries: Update SLOF firmware image to qemu-slof-20140304 · 8f3babb7
      Alexey Kardashevskiy 提交于
      The changelog is:
        > version: update to 20140304
        > Introduce dummy console device
        > vio-vscsi: Fix CRQ allocation alignment
        > version: update to 20140204
        > virtio-9p: disable unused structure
        > Make "boot net:dhcp" boot from IPv4 only
        > Fix virtio device shutdown
        > Change shutdown method name for virtio-scsi
        > Add support for 64bit LE ABI v1 and v2 support
        > Change representation of string environment variable
        > cas: return error when unknown node found
        > version: update
        > Reset obp-tftp arguments before parsing
        > Enable seamless netboot on IPv6 network
        > Fix shutdown for virtio devices
        > Fix zero checksum in UDP header
        > Handle router advertisement message properly
        > [oex]hci_exit: Check before freeing/unmapping memory
        > Work around missing sc 1 traps on pHyp
        > fix print_version() to return where it came from
        > usb-xhci: memory freeing and using returns as bool uniformly
        > Output banner and initial display output in VNC window
        > use VERSION file to generate FW version
        > cas: remove warning
        > Add support for loading little endian ELF binaries.
        > Add bswap_{16,32,64}p
        > dhcpv6 and other minor net-snk fixes
        > Fix missing drop in virtio-fs setup-alias
        > Find next available alias name
        > SLOF does not exit if given 1KB disk
        > boot: enable support for bootindex
        > pci-properties: add properties to enable hotplug for spapr
        > e1000: remember node handle
        > Increase quiesce tokens array size
        > virtio: timeout after 5sec
        > Enable IPv6 support in dns
        > usb-ohci: fix warnings
        > Add ipv6 support in net-snk
        > ipv4: fix frame overwriting following arp_send_request
        > e1000: fix SLOF_dma_map_out arguments
        > Maintain single global packet buffer for tftp
        > Increase virtio-net receive queue size
        > Increase veth receive queue size
        > Fix dprintf macros at various points
        > usb-ohci: rewrite done_head processing code
        > boot: add net in default boot order
        > block 0 address in the allocator
        > scsi: make-media-alias fix
        > usb-xhci: add xhci host controller support
        > usb-xhci: add xhci support
        > Avoid veth read/write calls with zero length buffer
        > boot: include other aliases
        > usb-core: disable xhci
      
      Cc: Andreas Färber <afaerber@suse.de>
      Cc: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      8f3babb7