qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 1f7104: qemu-img: Fix division by zero for ze


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 1f7104: qemu-img: Fix division by zero for zero size image...
Date: Mon, 29 Oct 2012 10:30:20 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 1f71049523f4fc0738f96c74bfcce012521fa0f0
      
https://github.com/qemu/qemu/commit/1f71049523f4fc0738f96c74bfcce012521fa0f0
  Author: Kevin Wolf <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M qemu-img.c

  Log Message:
  -----------
  qemu-img: Fix division by zero for zero size images

Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>


  Commit: ee17f9d5fd44fba950ab2290dd30f38d1cd2b625
      
https://github.com/qemu/qemu/commit/ee17f9d5fd44fba950ab2290dd30f38d1cd2b625
  Author: Kevin Wolf <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    A tests/qemu-iotests/042
    A tests/qemu-iotests/042.out
    M tests/qemu-iotests/group

  Log Message:
  -----------
  qemu-iotests: Test qemu-img operation on zero size image

Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>


  Commit: b3d0380ec245d73e5233366f541497ef92b2e283
      
https://github.com/qemu/qemu/commit/b3d0380ec245d73e5233366f541497ef92b2e283
  Author: Jeff Cody <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M QMP/qmp.py

  Log Message:
  -----------
  qmp: fix __accept() in qmp.py

In QEMUMonitorProtocol, commit e9d17b6 removed the __sockfile creation
from __negotiate_capabilities(), which breaks _accept().  This causes
failures in qemu-io python based tests (i.e. tests 030 and 040).

This patch creates the sockfile in __accept() as well.

Signed-off-by: Jeff Cody <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Acked-by: Luiz Capitulino <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: a616673dd1c2e00db5e3458d2ba4b6619b78876a
      
https://github.com/qemu/qemu/commit/a616673dd1c2e00db5e3458d2ba4b6619b78876a
  Author: Alex Bligh <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M qemu-img.c
    M qemu-img.texi

  Log Message:
  -----------
  qemu-img rebase: use empty string to rebase without backing file

This patch allows an empty filename to be passed as the new base image name
for qemu-img rebase to mean base the image on no backing file (i.e.
independent of any backing file). According to Eric Blake, qemu-img rebase
already supports this when '-u' is used; this adds support when -u is not
used.

Signed-off-by: Alex Bligh <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: b1b1d783eabdb6ac4e4578b2c04b0c24483dce77
      
https://github.com/qemu/qemu/commit/b1b1d783eabdb6ac4e4578b2c04b0c24483dce77
  Author: Jeff Cody <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M block.c

  Log Message:
  -----------
  block: make bdrv_find_backing_image compare canonical filenames

Currently, bdrv_find_backing_image compares bs->backing_file with
what is passed in as a backing_file name.  Mismatches may occur,
however, when bs->backing_file and backing_file are not both
absolute or relative.

Use path_combine() to make sure any relative backing filenames are
relative to the current image filename being searched, and then use
realpath() to make all comparisons based on absolute filenames.

If either backing_file or bs->backing_file is determine to be a
protocol, then no filename normalization is performed.

This also changes bdrv_find_backing_image to no longer be recursive,
but iterative.

Signed-off-by: Jeff Cody <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: d5208c45be38ab858db6ec5a5097aa1c1a8ebbc9
      
https://github.com/qemu/qemu/commit/d5208c45be38ab858db6ec5a5097aa1c1a8ebbc9
  Author: Jeff Cody <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M block/commit.c
    M blockdev.c
    M tests/qemu-iotests/040

  Log Message:
  -----------
  block: in commit, determine base image from the top image

This simplifies some code and error checking, and also fixes a bug.

bdrv_find_backing_image() should only be passed absolute filenames,
or filenames relative to the chain.  In the QMP message handler for
block commit, when looking up the base do so from the determined top
image, so we know it is reachable from top.

Some of the error messages put out by block-commit have changed
slightly, which causes 2 tests cases for block-commit to fail.
This patch updates the test cases to look for the correct error
output.

Signed-off-by: Jeff Cody <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 6bf0d1f478a5a425c0c024994375592805d591c0
      
https://github.com/qemu/qemu/commit/6bf0d1f478a5a425c0c024994375592805d591c0
  Author: Jeff Cody <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M tests/qemu-iotests/040
    M tests/qemu-iotests/040.out

  Log Message:
  -----------
  qemu-iotests: add relative backing file tests for block-commit (040)

The previous block commit used absolute filenames for all block-commit
images and commands; this adds relative filenames for the same tests.

Signed-off-by: Jeff Cody <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 9699bf0d06eb42625779216586a28d19d8fc005d
      
https://github.com/qemu/qemu/commit/9699bf0d06eb42625779216586a28d19d8fc005d
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M qemu-img.c

  Log Message:
  -----------
  qemu-img: Add --backing-chain option to info command

The qemu-img info --backing-chain option enumerates the backing file
chain.  For example, for base.qcow2 <- snap1.qcow2 <- snap2.qcow2 the
output becomes:

  $ qemu-img info --backing-chain snap2.qcow2
  image: snap2.qcow2
  file format: qcow2
  virtual size: 100M (104857600 bytes)
  disk size: 196K
  cluster_size: 65536
  backing file: snap1.qcow2
  backing file format: qcow2

  image: snap1.qcow2
  file format: qcow2
  virtual size: 100M (104857600 bytes)
  disk size: 196K
  cluster_size: 65536
  backing file: base.qcow2
  backing file format: qcow2

  image: base.qcow2
  file format: qcow2
  virtual size: 100M (104857600 bytes)
  disk size: 136K
  cluster_size: 65536

Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 514d9da5a9a820b43a2cb90b439dd570a7835114
      
https://github.com/qemu/qemu/commit/514d9da5a9a820b43a2cb90b439dd570a7835114
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    A tests/qemu-iotests/043
    A tests/qemu-iotests/043.out
    M tests/qemu-iotests/common.rc
    M tests/qemu-iotests/group

  Log Message:
  -----------
  qemu-iotests: Add 043 backing file chain infinite loop test

This new test verifies that qemu-img info --backing-chain safely aborts
when an image file has a backing file infinite loop.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: e53575606aa5567bde3246cdc3af1fdc757f77c8
      
https://github.com/qemu/qemu/commit/e53575606aa5567bde3246cdc3af1fdc757f77c8
  Author: Kashyap Chamarthy <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M qemu-img-cmds.hx
    M qemu-img.texi

  Log Message:
  -----------
  qemu-img: document 'info --backing-chain'

Signed-off-by: Kashyap Chamarthy <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 80168bff43760bde98388480dc7c93f94693421c
      
https://github.com/qemu/qemu/commit/80168bff43760bde98388480dc7c93f94693421c
  Author: Luiz Capitulino <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M block.c

  Log Message:
  -----------
  block: bdrv_create(): don't leak cco.filename on error

Signed-off-by: Luiz Capitulino <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 9ac54af0c35d3f931653efae5698ef0f465eac7c
      
https://github.com/qemu/qemu/commit/9ac54af0c35d3f931653efae5698ef0f465eac7c
  Author: Corey Bryant <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M monitor.c
    M qapi-schema.json

  Log Message:
  -----------
  monitor: Allow add-fd to any specified fd set

The first call to add an fd to an fd set was previously not
allowed to choose the fd set ID.  The ID was generated as
the first available and ensuing calls could add more fds by
specifying the fd set ID.  This change allows users to
choose the fd set ID on the first call.

Signed-off-by: Corey Bryant <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: e446f70d54b4920e8ca5af509271b69eab86e37b
      
https://github.com/qemu/qemu/commit/e446f70d54b4920e8ca5af509271b69eab86e37b
  Author: Corey Bryant <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M monitor.c
    M monitor.h

  Log Message:
  -----------
  monitor: Enable adding an inherited fd to an fd set

qmp_add_fd() gets an fd that was received over a socket with
SCM_RIGHTS and adds it to an fd set.  This patch adds support
that will enable adding an fd that was inherited on the
command line to an fd set.

Note: All of the code added to monitor_fdset_add_fd(), with the
exception of the error path for non-valid fdset-id, is code motion
from qmp_add_fd().

Signed-off-by: Corey Bryant <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: ebe52b592dd5867fce7238f49b8c0416c3eedb6c
      
https://github.com/qemu/qemu/commit/ebe52b592dd5867fce7238f49b8c0416c3eedb6c
  Author: Corey Bryant <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M monitor.c

  Log Message:
  -----------
  monitor: Prevent removing fd from set during init

If an fd is added to an fd set via the command line, and it is not
referenced by another command line option (ie. -drive), then clean
it up after QEMU initialization is complete.

Signed-off-by: Corey Bryant <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 587ed6be0b6331b11169da8846b8442840d5428c
      
https://github.com/qemu/qemu/commit/587ed6be0b6331b11169da8846b8442840d5428c
  Author: Corey Bryant <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M qemu-config.c
    M qemu-options.hx
    M vl.c

  Log Message:
  -----------
  qemu-config: Add new -add-fd command line option

This option can be used for passing file descriptors on the
command line.  It mirrors the existing add-fd QMP command which
allows an fd to be passed to QEMU via SCM_RIGHTS and added to an
fd set.

This can be combined with commands such as -drive to link file
descriptors in an fd set to a drive:

    qemu-kvm -add-fd fd=3,set=2,opaque="rdwr:/path/to/file"
       -add-fd fd=4,set=2,opaque="rdonly:/path/to/file"
       -drive file=/dev/fdset/2,index=0,media=disk

This example adds dups of fds 3 and 4, and the accompanying opaque
strings to the fd set with ID=2.  qemu_open() already knows how
to handle a filename of this format.  qemu_open() searches the
corresponding fd set for an fd and when it finds a match, QEMU
goes on to use a dup of that fd just like it would have used an
fd that it opened itself.

Signed-off-by: Corey Bryant <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: ac84adac48963653638a1c95dd7c6ab8b4d5a4f3
      
https://github.com/qemu/qemu/commit/ac84adac48963653638a1c95dd7c6ab8b4d5a4f3
  Author: Paolo Bonzini <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M block.c
    M block.h

  Log Message:
  -----------
  block: add bdrv_query_info

Extract it out of the implementation of "info block".

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 9887b616619f62977682e76927a9b5a6134cc8bf
      
https://github.com/qemu/qemu/commit/9887b616619f62977682e76927a9b5a6134cc8bf
  Author: Paolo Bonzini <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M block.c
    M block.h

  Log Message:
  -----------
  block: add bdrv_query_stats

qmp_query_blockstat cannot have errors, remove the Error argument and
create a new public function bdrv_query_stats out of it.

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 9156df12a4f3b3db63d1b292d081d814f02e311a
      
https://github.com/qemu/qemu/commit/9156df12a4f3b3db63d1b292d081d814f02e311a
  Author: Paolo Bonzini <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M block.c
    M block.h

  Log Message:
  -----------
  block: add bdrv_open_backing_file

Mirroring runs without the backing file so that it can be copied outside
QEMU.  However, we need to add it at the time the job is completed and
QEMU switches to the target.  Factor out the common bits of opening an
image and completing a mirroring operation.

The new function does not assume that the file is closed immediately after
it returns failure, so it keeps the BDRV_O_NO_BACKING flag up-to-date.

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 1755da16e32c15b22a521e8a38539e4b5cf367f3
      
https://github.com/qemu/qemu/commit/1755da16e32c15b22a521e8a38539e4b5cf367f3
  Author: Paolo Bonzini <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M block.c
    M block.h

  Log Message:
  -----------
  block: introduce new dirty bitmap functionality

Assert that write_compressed is never used with the dirty bitmap.
Setting the bits early is wrong, because a coroutine might concurrently
examine them and copy incomplete data from the source.

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: b9a9b3a4626aa099f829e2a6036bfaa0c8e47700
      
https://github.com/qemu/qemu/commit/b9a9b3a4626aa099f829e2a6036bfaa0c8e47700
  Author: Paolo Bonzini <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M block.c
    M qapi-schema.json

  Log Message:
  -----------
  block: export dirty bitmap information in query-block

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 65f4632243f526958aa1f6b3911add98329c3796
      
https://github.com/qemu/qemu/commit/65f4632243f526958aa1f6b3911add98329c3796
  Author: Paolo Bonzini <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M block/commit.c
    M block/stream.c
    M blockjob.c
    M blockjob.h

  Log Message:
  -----------
  block: rename block_job_complete to block_job_completed

The imperative will be used for the QMP command.

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: aeae883baf2377b714a41529f94905046fa058f3
      
https://github.com/qemu/qemu/commit/aeae883baf2377b714a41529f94905046fa058f3
  Author: Paolo Bonzini <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M blockdev.c
    M blockjob.c
    M blockjob.h
    M hmp-commands.hx
    M hmp.c
    M hmp.h
    M qapi-schema.json
    M qerror.h
    M qmp-commands.hx
    M trace-events

  Log Message:
  -----------
  block: add block-job-complete

While streaming can be dropped as soon as it progressed through the whole
image, mirroring needs to be completed manually for two reasons: 1) so that
management knows exactly when the VM switches to the target; 2) because
for other use cases such as replication, we may leave the operation running
for the whole life of the virtual machine.

Add a new block job command that manually completes background operations.

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: a66a2a368383e627b929bf42d1b972822491404b
      
https://github.com/qemu/qemu/commit/a66a2a368383e627b929bf42d1b972822491404b
  Author: Paolo Bonzini <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M QMP/qmp-events.txt
    M blockdev.c
    M blockjob.c
    M blockjob.h
    M monitor.c
    M monitor.h
    M qapi-schema.json

  Log Message:
  -----------
  block: introduce BLOCK_JOB_READY event

Even for jobs that need to be manually completed, management may want
to take care itself of the completion, not requiring the user to issue
a command to terminate the job.  In this case we want to avoid that
they poll us continuously, waiting for completion to become available.
Thus, add a new event that signals the phase switch and the availability
of the block-job-complete command.

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 893f7ebafe4e8afc0ce4dbd9e64b3752f3036bbb
      
https://github.com/qemu/qemu/commit/893f7ebafe4e8afc0ce4dbd9e64b3752f3036bbb
  Author: Paolo Bonzini <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M block/Makefile.objs
    A block/mirror.c
    M block_int.h
    M qapi-schema.json
    M trace-events

  Log Message:
  -----------
  mirror: introduce mirror job

This patch adds the implementation of a new job that mirrors a disk to
a new image while letting the guest continue using the old image.
The target is treated as a "black box" and data is copied from the
source to the target in the background.  This can be used for several
purposes, including storage migration, continuous replication, and
observation of the guest I/O in an external program.  It is also a
first step in replacing the inefficient block migration code that is
part of QEMU.

The job is possibly never-ending, but it is logically structured into
two phases: 1) copy all data as fast as possible until the target
first gets in sync with the source; 2) keep target in sync and
ensure that reopening to the target gets a correct (full) copy
of the source data.

The second phase is indicated by the progress in "info block-jobs"
reporting the current offset to be equal to the length of the file.
When the job is cancelled in the second phase, QEMU will run the
job until the source is clean and quiescent, then it will report
successful completion of the job.

In other words, the BLOCK_JOB_CANCELLED event means that the target
may _not_ be consistent with a past state of the source; the
BLOCK_JOB_COMPLETED event means that the target is consistent with
a past state of the source.  (Note that it could already happen
that management lost the race against QEMU and got a completion
event instead of cancellation).

It is not yet possible to complete the job and switch over to the target
disk.  The next patches will fix this and add many refinements to the
basic idea introduced here.  These include improved error management,
some tunable knobs and performance optimizations.

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: d9b902db3fb71fdcdfbb2aa9cc94a410dee864e5
      
https://github.com/qemu/qemu/commit/d9b902db3fb71fdcdfbb2aa9cc94a410dee864e5
  Author: Paolo Bonzini <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M blockdev.c
    M hmp-commands.hx
    M hmp.c
    M hmp.h
    M qapi-schema.json
    M qmp-commands.hx

  Log Message:
  -----------
  qmp: add drive-mirror command

This adds the monitor commands that start the mirroring job.

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: d63ffd87acad618a4a64b8812b64ad88577ae9b1
      
https://github.com/qemu/qemu/commit/d63ffd87acad618a4a64b8812b64ad88577ae9b1
  Author: Paolo Bonzini <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M block/mirror.c

  Log Message:
  -----------
  mirror: implement completion

Switching to the target of the migration is done mostly asynchronously,
and reported to management via the BLOCK_JOB_COMPLETED event; the only
synchronous phase is opening the backing files.  bdrv_open_backing_file
can always be done, even for migration of the full image (aka sync:
'full').  In this case, qmp_drive_mirror will create the target disk
with no backing file at all, and bdrv_open_backing_file will be a no-op.

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 44c7ca5ebfb20c8086ac78f72a1bc6566828f956
      
https://github.com/qemu/qemu/commit/44c7ca5ebfb20c8086ac78f72a1bc6566828f956
  Author: Paolo Bonzini <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    A tests/qemu-iotests/041
    A tests/qemu-iotests/041.out
    M tests/qemu-iotests/group

  Log Message:
  -----------
  qemu-iotests: add mirroring test case

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 3bd293c3fdc8b4052b9fc357e0b28cba20e73099
      
https://github.com/qemu/qemu/commit/3bd293c3fdc8b4052b9fc357e0b28cba20e73099
  Author: Paolo Bonzini <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M block.c
    M blockjob.c
    M blockjob.h

  Log Message:
  -----------
  iostatus: forward block_job_iostatus_reset to block job

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: b952b5589a36114e06201c0d2e82c293dbad2b1f
      
https://github.com/qemu/qemu/commit/b952b5589a36114e06201c0d2e82c293dbad2b1f
  Author: Paolo Bonzini <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M block/mirror.c
    M block_int.h
    M blockdev.c
    M hmp.c
    M qapi-schema.json
    M qmp-commands.hx

  Log Message:
  -----------
  mirror: add support for on-source-error/on-target-error

Error management is important for mirroring; otherwise, an error on the
target (even something as "innocent" as ENOSPC) requires to start again
with a full copy.  Similar to on_read_error/on_write_error, two separate
knobs are provided for on_source_error (reads) and on_target_error (writes).
The default is 'report' for both.

The 'ignore' policy will leave the sector dirty, so that it will be
retried later.  Thus, it will not cause corruption.

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 9eb80eadd498fae2ad9eecbb89646b0cc4929cac
      
https://github.com/qemu/qemu/commit/9eb80eadd498fae2ad9eecbb89646b0cc4929cac
  Author: Paolo Bonzini <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M QMP/qmp.py

  Log Message:
  -----------
  qmp: add pull_event function

This function is unlike get_events in that it makes it easy to process
one event at a time.  This is useful in the mirroring test cases, where
we want to process just one event (BLOCK_JOB_ERROR) and leave the others
to a helper function.

Acked-by: Luiz Capitulino <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 9dfa9f593045d70572ebfd94f59cd33ec99e847c
      
https://github.com/qemu/qemu/commit/9dfa9f593045d70572ebfd94f59cd33ec99e847c
  Author: Paolo Bonzini <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M tests/qemu-iotests/041
    M tests/qemu-iotests/041.out
    M tests/qemu-iotests/iotests.py

  Log Message:
  -----------
  qemu-iotests: add testcases for mirroring on-source-error/on-target-error

The new options are tested with blkdebug on both the source and the
target.

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 3b6eda2f57a5b7ed047077b6272c2b5a9e3531ca
      
https://github.com/qemu/qemu/commit/3b6eda2f57a5b7ed047077b6272c2b5a9e3531ca
  Author: Corey Bryant <address@hidden>
  Date:   2012-10-24 (Wed, 24 Oct 2012)

  Changed paths:
    M osdep.c

  Log Message:
  -----------
  osdep: Less restrictive F_SEFL in qemu_dup_flags()

qemu_dup_flags() currently limits the flags that can be set on the
fcntl() F_SETFL call to those that we currently know can be set with
fcntl() F_SETFL.  The problem with this is that it will prevent use
of new flags in the future without a code update.

This patch relaxes the checking and lets fcntl() determine the flags
it can set.

Signed-off-by: Corey Bryant <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 00a0770de3ddb803a0f81f6aea40b0f945154a68
      
https://github.com/qemu/qemu/commit/00a0770de3ddb803a0f81f6aea40b0f945154a68
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-uhci.c

  Log Message:
  -----------
  uhci: Properly unmap packets on cancel / invalid pid

Packets with an invalid pid, or which were cancelled have
usb_packet_map() called on them on init, but not usb_packet_unmap()
before being freed.

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 7c2eaca4efa46e02caaec4ca7ddf05a6e461da94
      
https://github.com/qemu/qemu/commit/7c2eaca4efa46e02caaec4ca7ddf05a6e461da94
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-uhci.c

  Log Message:
  -----------
  uhci: Move checks to continue queuing to uhci_fill_queue()

Rather then having a special check to start queuing after the first packet,
and then another check for the other packets in uhci_fill_queue(), simply
check the previous packet beforehand in uhci_fill_queue()

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 549a3c3d9665bdc0246fb6594b6e36ce3afadd21
      
https://github.com/qemu/qemu/commit/549a3c3d9665bdc0246fb6594b6e36ce3afadd21
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-ehci.c

  Log Message:
  -----------
  ehci: Get rid of packet tbytes field

This field is used in some places to track the tbytes field of the token, but
in other places the field is used directly, use it directly everywhere for
consistency.

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: cf08a8a1f600b2ac25f72cf5736247f3e95cc43d
      
https://github.com/qemu/qemu/commit/cf08a8a1f600b2ac25f72cf5736247f3e95cc43d
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-ehci.c

  Log Message:
  -----------
  ehci: Set int flag on a short input packet

According to 4.15.1.2 an interrupt must be raised when a short packet
is received. If we don't do this it may take a significant time for
the guest to notice a short trasnfer has completed, since only the last td
will have its IOC flag set, and a short transfer may complete in an earlier
packet.

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 0262f65aaae49d582e7d4e4b1b5c8cfe4cd19d6d
      
https://github.com/qemu/qemu/commit/0262f65aaae49d582e7d4e4b1b5c8cfe4cd19d6d
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-ehci.c

  Log Message:
  -----------
  ehci: Improve latency of interrupt delivery and async schedule scanning

While doing various performance tests of reading from USB mass storage devices
I noticed the following::
1) When an async handled packet completes, we don't immediately report an
   interrupt to the guest, instead we wait for the frame-timer to run and
   report it from there
2) If 1) has been fixed and an async handled packet takes a while to complete,
   then async_stepdown will become a high value, which means that there
   will be a large latency before any new packets queued by the guest in
   response to the interrupt get seen

1) was done deliberately as part of commit f0ad01f92:
http://www.kraxel.org/cgit/qemu/commit/?h=usb.57&id=f0ad01f92ca02eee7cadbfd225c5de753ebd5fce
Since setting the interrupt immediately on async packet completion was causing
issues with Linux guests, I believe this recently fixed Linux bug explains
why this is happening:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=361aabf395e4a23cf554cf4ec0c0c6963b8beb01

Note that we can *not* count on this fix being present in all Linux guests!

I was hoping that the recently added support for Interrupt Threshold Control
would fix the issues with Linux guests, but adding a simple ehci_commit_irq()
call to ehci_async_bh() still caused problems with Linux guests.

The problem is, that when doing ehci_commit_irq() from ehci_async_bh(),
the "old" frindex value is used to calculate usbsts_frindex, and when
the frame-timer then runs possibly very shortly after ehci_async_bh(),
it increases the frame-timer, and thus any interrupts raised from that
frame-timer run, will also get reported to the guest immediately, rather
then being delayed to the next frame-timer run.

Luckily the solution for this is simple, this means that we need to
increase frindex before calling ehci_commit_irq() from ehci_async_bh(),
which in the end boils down to simple calling ehci_frame_timer() instead
of ehci_async_bh() from the bh.

This may seem like it causes a lot of extra work to be done, but this
is not true. Any work done from the frame-timer processing the periodic
schedule is work which then does not need to be done the next time the
frame timer runs, also the frame-timer will re-arm itself at (possibly)
a later time then it was armed for saving a vmexit at that time.

As an additional advantage moving to simply calling the frame-timer also
fixes 2) as the packet completion will set async_stepdown to 0, and the
re-arming of the timer with an async_stepdown of 0 ensures that any
newly queued up packets get seen in a reasonable amount of time.

This improves the speed (MB/s) of a Linux guest reading from a USB mass
storage device by a factor of 1.5 - 1.7 with input pipelining disabled,
and by a factor of 1.8 with input pipelining enabled.

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 44272b0f88247e2d2960c0ef19b546c206a10080
      
https://github.com/qemu/qemu/commit/44272b0f88247e2d2960c0ef19b546c206a10080
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-ehci.c

  Log Message:
  -----------
  ehci: Speed up the timer of raising int from the async schedule

Often the guest will queue up new packets in response to a packet, in the
async schedule with its IOC flag set, completing. By speeding up the
frame-timer, we notice these new packets earlier. This increases the
speed (MB/s) of a Linux guest reading from a USB mass storage device by a
factor of 1.15 on top of the "Improve latency of interrupt delivery"
speed-ups, both with and without input pipelining enabled.

I've not tested the speed-up of this patch without the
"Improve latency of interrupt delivery" patch.

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: e3a36bce1d0123d003855f7731494e6d6f550fcc
      
https://github.com/qemu/qemu/commit/e3a36bce1d0123d003855f7731494e6d6f550fcc
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-ehci.c

  Log Message:
  -----------
  ehci: Detect going in circles when filling the queue

For ctrl endpoints Windows (atleast Win7) creates circular td lists, so far
these were not a problem because we would stop filling the queue if altnext
was set. Since further patches in this patchset remove the altnext check this
does become a problem and we need detection for going in circles.

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: b4ea86649915eca5551a5166f76e7a9d9032de50
      
https://github.com/qemu/qemu/commit/b4ea86649915eca5551a5166f76e7a9d9032de50
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-ehci.c

  Log Message:
  -----------
  ehci: Retry to fill the queue while waiting for td completion

If the guest is using multiple transfers to try and keep the usb bus busy /
used at maximum efficiency, currently we would see / do the following:

1) submit transfer 1 to the device
2) submit transfer 2 to the device
3) report transfer 1 completion to guest
4) report transfer 2 completion to guest
5) submit transfer 1 to the device
6) report transfer 1 completion to guest
7) submit transfer 2 to the device
8) report transfer 2 completion to guest
etc.

So after the initial submission we would effectively only have 1 transfer
in flight, rather then 2. This is caused by us not checking the queue for
addition of new transfers by the guest (ie the resubmission of a recently
finished transfer), while waiting for a pending transfer to complete.
This patch does add a check for this, changing the sequence to:

1) submit transfer 1 to the device
2) submit transfer 2 to the device
3) report transfer 1 completion to guest
4) submit transfer 1 to the device
5) report transfer 2 completion to guest
6) submit transfer 2 to the device
etc.

Thus keeping 2 transfers in flight (most of the time, and always 1),
as intended by the guest.

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 3151f2096dd676dc42e81ef0d55ae80780fd8769
      
https://github.com/qemu/qemu/commit/3151f2096dd676dc42e81ef0d55ae80780fd8769
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-xhci.c

  Log Message:
  -----------
  xhci: Add a xhci_ep_nuke_one_xfer helper function

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: d0ff81b871af3c6cf31c807dfdd480b9d1032780
      
https://github.com/qemu/qemu/commit/d0ff81b871af3c6cf31c807dfdd480b9d1032780
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb.h
    M hw/usb/core.c

  Log Message:
  -----------
  usb: Rename __usb_packet_complete to usb_packet_complete_one

And make it available for use outside of core.c

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 36dfe324fd4b5efd9ef1a5b4c352bbb158952e24
      
https://github.com/qemu/qemu/commit/36dfe324fd4b5efd9ef1a5b4c352bbb158952e24
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb.h
    M hw/usb/bus.c
    M hw/usb/core.c
    M hw/usb/hcd-ehci.c
    M hw/usb/hcd-musb.c
    M hw/usb/hcd-ohci.c
    M hw/usb/hcd-uhci.c
    M hw/usb/hcd-xhci.c

  Log Message:
  -----------
  usb: Add USB_RET_ADD_TO_QUEUE packet result code

This can be used by usb-device code which wishes to process an entire endpoint
queue at once, to do this the usb-device code returns USB_RET_ADD_TO_QUEUE
from its handle_data class method and defines a flush_ep_queue class method
to call when the hcd is done queuing up packets.

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 0cae7b1a004d6857e3bde3d511d7efa39d3cb48a
      
https://github.com/qemu/qemu/commit/0cae7b1a004d6857e3bde3d511d7efa39d3cb48a
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb.h
    M hw/usb/core.c
    M hw/usb/hcd-ehci.c
    M hw/usb/hcd-uhci.c
    M hw/usb/hcd-xhci.c

  Log Message:
  -----------
  usb: Move clearing of queue on halt to the core

hcds which queue up more then one packet at once (uhci, ehci and xhci),
must clear the queue after an error which has caused the queue to halt.

Currently this is handled as a special case inside the hcd code, this
patch instead adds an USB_RET_REMOVE_FROM_QUEUE packet result code, teaches
the 3 hcds about this and moves the clearing of the queue on a halt into
the USB core.

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 6ba43f1f6b60159e731b1f37ffb53ab9ab59efa9
      
https://github.com/qemu/qemu/commit/6ba43f1f6b60159e731b1f37ffb53ab9ab59efa9
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb.h
    M hw/usb/core.c
    M hw/usb/hcd-ehci.c
    M hw/usb/hcd-musb.c
    M hw/usb/hcd-ohci.c
    M hw/usb/hcd-uhci.c
    M hw/usb/hcd-xhci.c
    M hw/usb/host-linux.c
    M hw/usb/redirect.c

  Log Message:
  -----------
  usb: Move short-not-ok handling to the core

After a short-not-ok packet ending short, we should not advance the queue.
Move enforcing this to the core, rather then handling it in the hcd code.

This may result in the queue now actually containing multiple input packets
(which would not happen before), and this requires special handling in
combination with pipelining, so disable pipleining for input endpoints
(for now).

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: a6fb2ddb1417fcc2d24f3231c84035fcbd90123a
      
https://github.com/qemu/qemu/commit/a6fb2ddb1417fcc2d24f3231c84035fcbd90123a
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb.h
    M hw/usb/core.c
    M hw/usb/hcd-ehci.c
    M hw/usb/hcd-musb.c
    M hw/usb/hcd-ohci.c
    M hw/usb/hcd-uhci.c
    M hw/usb/hcd-xhci.c

  Log Message:
  -----------
  usb: Add an int_req flag to USBPacket

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: aaac74343d761947e57a1b0cbaa7f2dd0c6a40ca
      
https://github.com/qemu/qemu/commit/aaac74343d761947e57a1b0cbaa7f2dd0c6a40ca
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/core.c
    M hw/usb/hcd-ehci.c

  Log Message:
  -----------
  usb: Enforce iso endpoints never returing USB_RET_ASYNC

ehci was already testing for this, and we depend in various places
on no devices doing this, so lets move the check for this to the
usb core.

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 5b352ed537e31a6b5f9e33e26429ba8b909af234
      
https://github.com/qemu/qemu/commit/5b352ed537e31a6b5f9e33e26429ba8b909af234
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-uhci.c

  Log Message:
  -----------
  uhci: No need to handle async completion of isoc packets

No devices ever return async for isoc endpoints and the core
already enforces this.

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 2f2ee2689ffe8a784a86bf10fb946772748632c7
      
https://github.com/qemu/qemu/commit/2f2ee2689ffe8a784a86bf10fb946772748632c7
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-uhci.c

  Log Message:
  -----------
  uhci: cleanup: Add an unlink call to uhci_async_cancel()

All callers of uhci_async_cancel() call uhci_async_unlink() first, so
lets move the unlink call to uhci_async_cancel()

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: a89e255b0cbe7c5b56348201e1c0f6d427c98fc8
      
https://github.com/qemu/qemu/commit/a89e255b0cbe7c5b56348201e1c0f6d427c98fc8
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-uhci.c

  Log Message:
  -----------
  uhci: Don't retry on error

Since we are either dealing with emulated devices, where retrying is
not going to help, or with redirected devices where the host OS will
have already retried, don't bother retrying on failed transfers.

Also move some common/indentical code out of all the error cases
into the generic error path.

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 3c87c76d1a0e9ce1dde6f919e3b1b9bcabb69985
      
https://github.com/qemu/qemu/commit/3c87c76d1a0e9ce1dde6f919e3b1b9bcabb69985
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-uhci.c

  Log Message:
  -----------
  uhci: Drop unnecessary forward declaration of some static functions

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 40507377261250fe19e441300788c77b748688cb
      
https://github.com/qemu/qemu/commit/40507377261250fe19e441300788c77b748688cb
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-uhci.c

  Log Message:
  -----------
  uhci: Move emptying of the queue's asyncs' queue to uhci_queue_free

Cleanup: all callers of uhci_queue_free first unconditionally cancel
all remaining asyncs in the queue, so lets move this to uhci_queue_free().

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 1f250cc77224f9b950c867e47d9f47e4cd46d7d4
      
https://github.com/qemu/qemu/commit/1f250cc77224f9b950c867e47d9f47e4cd46d7d4
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-uhci.c

  Log Message:
  -----------
  uhci: Rename UHCIAsync->td to UHCIAsync->td_addr

We use the name td both to refer to a UHCI_TD read from guest memory as
well as to refer to the guest address where a td is stored, switch over
to always use td_addr in the second case for consistency.

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 963a68b54f8f4e5dcc7cc2c6ec8d047557ac5feb
      
https://github.com/qemu/qemu/commit/963a68b54f8f4e5dcc7cc2c6ec8d047557ac5feb
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-uhci.c

  Log Message:
  -----------
  uhci: Add uhci_read_td() helper function

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: a4f30cd766888e69e1d75cd87d251c04e829688e
      
https://github.com/qemu/qemu/commit/a4f30cd766888e69e1d75cd87d251c04e829688e
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-uhci.c

  Log Message:
  -----------
  uhci: Make uhci_fill_queue() actually operate on an UHCIQueue

And move its calling point to handle_td, this removes the ep_ret ugliness,
and prepates the way for further cleanups in the follow-up patches in this
patch-set.

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 11d15e402beec122fb11104e36c35d1a46f650ff
      
https://github.com/qemu/qemu/commit/11d15e402beec122fb11104e36c35d1a46f650ff
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-uhci.c

  Log Message:
  -----------
  uhci: Store ep in UHCIQueue

This avoids the need to repeatedly lookup the device, and ep.

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 5ad23e873c858292dc58b9296261365312b8f683
      
https://github.com/qemu/qemu/commit/5ad23e873c858292dc58b9296261365312b8f683
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-uhci.c

  Log Message:
  -----------
  uhci: Immediately free queues on device disconnect

There is no need to just cancel any in-flight packets, and then wait
for validate-end to clean things up, we can simply clean things up
immediately on device removal.

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 66a08cbe6ad1aebec8eecf58b3ba042e19dd1649
      
https://github.com/qemu/qemu/commit/66a08cbe6ad1aebec8eecf58b3ba042e19dd1649
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-uhci.c
    M trace-events

  Log Message:
  -----------
  uhci: Verify queue has not been changed by guest

According to the spec a guest can unlink a qh, and then as soon as frindex
has changed by 1 since the unlink, assume it is idle and re-use it. However
for various reasons, we cannot simply consider a qh as unlinked if we've not
seen it for 1 frame. This means that it is possible for a guest to re-use /
restart the queue while we still see its old state. This patch adds a safety
check for this, and "early" retires queues when they were changed by the guest.

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 8c75a899f85dda9f8305d25f0cc453a79115fd90
      
https://github.com/qemu/qemu/commit/8c75a899f85dda9f8305d25f0cc453a79115fd90
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-uhci.c

  Log Message:
  -----------
  uhci: Detect guest td re-use

A td can be reused by the guest in a different queue, before we notice
the original queue has been unlinked. So search for tds by addr only, detect
guest td reuse, and cancel the original queue, this is necessary to keep our
packet ids unique.

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 420ca987d5d14fabacdec86c568832d6b0056ca3
      
https://github.com/qemu/qemu/commit/420ca987d5d14fabacdec86c568832d6b0056ca3
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-uhci.c

  Log Message:
  -----------
  uhci: When the guest marks a pending td non-active, cancel the queue

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 3905097ea8ea0e1b3dd1556f3ef74a123fe8622a
      
https://github.com/qemu/qemu/commit/3905097ea8ea0e1b3dd1556f3ef74a123fe8622a
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-uhci.c

  Log Message:
  -----------
  uhci: Always mark a queue valid when we encounter it

Before this patch we would not mark a queue valid when its head was a
non-active td. This causes us to misbehave in the following scenario:

1) queue with multiple input transfers queued
2) We hit some latency issue, causing qemu to get behind processing frames
3) When qemu gets to run again, it notices the first transfer ends short,
   marking the head td non-active
4) It now processes 32+ frames in a row without giving the guest a chance
   to run since it is behind
5) valid is decreased to 0, causing the queue to get cancelled also cancelling
   already queued up further input transfers
6) guest gets to run, notices the inactive td, cleanups up further tds
   from the short transfer, and lets the queue continue at the first td of
   the next input transfer
7) we re-start the queue, issuing the second input transfer for the *second*
   time, and any data read by the first time we issued it has been lost

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 8928c9c43df1a0eeda1ae2e9582beb34dce49330
      
https://github.com/qemu/qemu/commit/8928c9c43df1a0eeda1ae2e9582beb34dce49330
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-uhci.c

  Log Message:
  -----------
  uhci: Retry to fill the queue while waiting for td completion

If the guest is using multiple transfers to try and keep the usb bus busy /
used at maximum efficiency, currently we would see / do the following:

1) submit transfer 1 to the device
2) submit transfer 2 to the device
3) report transfer 1 completion to guest
4) report transfer 2 completion to guest
5) submit transfer 1 to the device
6) report transfer 1 completion to guest
7) submit transfer 2 to the device
8) report transfer 2 completion to guest
etc.

So after the initial submission we would effectively only have 1 transfer
in flight, rather then 2. This is caused by us not checking the queue for
addition of new transfers by the guest (ie the resubmission of a recently
finished transfer), while waiting for a pending transfer to complete.
This patch does add a check for this, changing the sequence to:

1) submit transfer 1 to the device
2) submit transfer 2 to the device
3) report transfer 1 completion to guest
4) submit transfer 1 to the device
5) report transfer 2 completion to guest
6) submit transfer 2 to the device
etc.

Thus keeping 2 transfers in flight (most of the time, and always 1),
as intended by the guest.

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 6fe30910abd7e0f4af69f8e522ccfe6b5125abbb
      
https://github.com/qemu/qemu/commit/6fe30910abd7e0f4af69f8e522ccfe6b5125abbb
  Author: Hans de Goede <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-uhci.c

  Log Message:
  -----------
  uhci: Use only one queue for ctrl endpoints

ctrl endpoints use different pids for different phases of a control
transfer, this patch makes us use only one queue for a ctrl ep, rather
then 3.

Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 79a8af3509151dd1b650c996defdda13e02a7e38
      
https://github.com/qemu/qemu/commit/79a8af3509151dd1b650c996defdda13e02a7e38
  Author: Gerd Hoffmann <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-xhci.c

  Log Message:
  -----------
  xhci: fix function name in error message

Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 3f973ee84ef51e448566c08ec5cfe746c9640269
      
https://github.com/qemu/qemu/commit/3f973ee84ef51e448566c08ec5cfe746c9640269
  Author: Gerd Hoffmann <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-xhci.c

  Log Message:
  -----------
  xhci: flush endpoint context unconditinally

Not updating the endpoint context in case the state didn't change is
wrong.  Other context fields might have changed, for example the
dequeue pointer in response to a CR_SET_TR_DEQUEUE command.

Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: e099ad4b7e9ca7debdd624a0d465a33198a6844f
      
https://github.com/qemu/qemu/commit/e099ad4b7e9ca7debdd624a0d465a33198a6844f
  Author: Gerd Hoffmann <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-xhci.c

  Log Message:
  -----------
  xhci: allow disabling interrupters

For secondary interrupters this is explicitly allowed in the specs.
For the primary interrupter behavior is undefined, lets be friendly
and allow disabling too.

Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 91062ae00fd4a88a40c28288e8ac7fe50ee83adf
      
https://github.com/qemu/qemu/commit/91062ae00fd4a88a40c28288e8ac7fe50ee83adf
  Author: Gerd Hoffmann <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-xhci.c

  Log Message:
  -----------
  xhci: make number of interrupters and slots configurable

Add properties to tweak the numbers of available interrupters and slots.

Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 0ebfb144e8ad3f2da436d630fdcc5aa9ab646341
      
https://github.com/qemu/qemu/commit/0ebfb144e8ad3f2da436d630fdcc5aa9ab646341
  Author: Gerd Hoffmann <address@hidden>
  Date:   2012-10-25 (Thu, 25 Oct 2012)

  Changed paths:
    M hw/usb/hcd-xhci.c

  Log Message:
  -----------
  xhci: fix usb name in caps

Used to be "UTB" not "USB".

Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 90c45b30319dee7d4137f18817395454728ea2f9
      
https://github.com/qemu/qemu/commit/90c45b30319dee7d4137f18817395454728ea2f9
  Author: Anthony Liguori <address@hidden>
  Date:   2012-10-29 (Mon, 29 Oct 2012)

  Changed paths:
    M QMP/qmp-events.txt
    M QMP/qmp.py
    M block.c
    M block.h
    M block/Makefile.objs
    M block/commit.c
    A block/mirror.c
    M block/stream.c
    M block_int.h
    M blockdev.c
    M blockjob.c
    M blockjob.h
    M hmp-commands.hx
    M hmp.c
    M hmp.h
    M monitor.c
    M monitor.h
    M osdep.c
    M qapi-schema.json
    M qemu-config.c
    M qemu-img-cmds.hx
    M qemu-img.c
    M qemu-img.texi
    M qemu-options.hx
    M qerror.h
    M qmp-commands.hx
    M tests/qemu-iotests/040
    M tests/qemu-iotests/040.out
    A tests/qemu-iotests/041
    A tests/qemu-iotests/041.out
    A tests/qemu-iotests/042
    A tests/qemu-iotests/042.out
    A tests/qemu-iotests/043
    A tests/qemu-iotests/043.out
    M tests/qemu-iotests/common.rc
    M tests/qemu-iotests/group
    M tests/qemu-iotests/iotests.py
    M trace-events
    M vl.c

  Log Message:
  -----------
  Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony: (32 commits)
  osdep: Less restrictive F_SEFL in qemu_dup_flags()
  qemu-iotests: add testcases for mirroring on-source-error/on-target-error
  qmp: add pull_event function
  mirror: add support for on-source-error/on-target-error
  iostatus: forward block_job_iostatus_reset to block job
  qemu-iotests: add mirroring test case
  mirror: implement completion
  qmp: add drive-mirror command
  mirror: introduce mirror job
  block: introduce BLOCK_JOB_READY event
  block: add block-job-complete
  block: rename block_job_complete to block_job_completed
  block: export dirty bitmap information in query-block
  block: introduce new dirty bitmap functionality
  block: add bdrv_open_backing_file
  block: add bdrv_query_stats
  block: add bdrv_query_info
  qemu-config: Add new -add-fd command line option
  monitor: Prevent removing fd from set during init
  monitor: Enable adding an inherited fd to an fd set
  ...

Conflicts:
        vl.c

Signed-off-by: Anthony Liguori <address@hidden>


  Commit: 6b0e6468e33883c1739a7474fe6baca170eec9aa
      
https://github.com/qemu/qemu/commit/6b0e6468e33883c1739a7474fe6baca170eec9aa
  Author: Anthony Liguori <address@hidden>
  Date:   2012-10-29 (Mon, 29 Oct 2012)

  Changed paths:
    M hw/usb.h
    M hw/usb/bus.c
    M hw/usb/core.c
    M hw/usb/hcd-ehci.c
    M hw/usb/hcd-musb.c
    M hw/usb/hcd-ohci.c
    M hw/usb/hcd-uhci.c
    M hw/usb/hcd-xhci.c
    M hw/usb/host-linux.c
    M hw/usb/redirect.c
    M trace-events

  Log Message:
  -----------
  Merge remote-tracking branch 'kraxel/usb.68' into staging

* kraxel/usb.68: (36 commits)
  xhci: fix usb name in caps
  xhci: make number of interrupters and slots configurable
  xhci: allow disabling interrupters
  xhci: flush endpoint context unconditinally
  xhci: fix function name in error message
  uhci: Use only one queue for ctrl endpoints
  uhci: Retry to fill the queue while waiting for td completion
  uhci: Always mark a queue valid when we encounter it
  uhci: When the guest marks a pending td non-active, cancel the queue
  uhci: Detect guest td re-use
  uhci: Verify queue has not been changed by guest
  uhci: Immediately free queues on device disconnect
  uhci: Store ep in UHCIQueue
  uhci: Make uhci_fill_queue() actually operate on an UHCIQueue
  uhci: Add uhci_read_td() helper function
  uhci: Rename UHCIAsync->td to UHCIAsync->td_addr
  uhci: Move emptying of the queue's asyncs' queue to uhci_queue_free
  uhci: Drop unnecessary forward declaration of some static functions
  uhci: Don't retry on error
  uhci: cleanup: Add an unlink call to uhci_async_cancel()
  ...

Signed-off-by: Anthony Liguori <address@hidden>


  Commit: b308c82cbda44e138ef990af64d44a5613c16092
      
https://github.com/qemu/qemu/commit/b308c82cbda44e138ef990af64d44a5613c16092
  Author: Avi Kivity <address@hidden>
  Date:   2012-10-29 (Mon, 29 Oct 2012)

  Changed paths:
    M hw/pci_bridge.c
    M hw/pci_internals.h

  Log Message:
  -----------
  pci: avoid destroying bridge address space windows in a transaction

Calling memory_region_destroy() in a transaction is illegal (and aborts),
as until the transaction is committed, the region remains live.

Fix by moving destruction until after the transaction commits.  This requires
having an extra set of regions, so the new and old regions can coexist.

Signed-off-by: Avi Kivity <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>


Compare: https://github.com/qemu/qemu/compare/d262cb02861d...b308c82cbda4

reply via email to

[Prev in Thread] Current Thread [Next in Thread]