qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 00/26] Block patches
@ 2010-04-23 15:30 Kevin Wolf
  0 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2010-04-23 15:30 UTC (permalink / raw)
  To: aliguori; +Cc: kwolf, qemu-devel

Hi Anthony,

this is the first part of the block patches that accumulated in my block branch
during your absence. I consider these patches ready to be merged into master.
I've not included another 13 patches that might still need discussion/review or
depend on such patches. I'm going to send another pull request for them some
time next week.

Kevin

The following changes since commit 6c557ab975fc8e5edb4167a241266c7c4657054a:
  Serge Ziryukin (1):
        audio/sdlaudio: remove unused variable

are available in the git repository at:

  git://repo.or.cz/qemu/kevin.git for-anthony

Bruce Rogers (1):
      Remove un-needed code

Christoph Hellwig (3):
      block: get rid of the BDRV_O_FILE flag
      block: split raw_getlength
      cleanup block driver option handling in vl.c

Kevin Wolf (14):
      qemu-config: qemu_read_config_file() reads the normal config file
      qemu-config: Make qemu_config_parse more generic
      blkdebug: Basic request passthrough
      blkdebug: Inject errors
      Make qemu-config available for tools
      blkdebug: Add events and rules
      qcow2: Trigger blkdebug events
      qcow2: Fix creation of large images
      Replace calls of old bdrv_open
      qcow2: Return 0/-errno in write_l2_entries
      qcow2: Fix error return code in qcow2_alloc_cluster_link_l2
      qcow2: Return 0/-errno in write_l1_entry
      qcow2: Return 0/-errno in l2_allocate
      block.h: bdrv_create2 doesn't exist any more

Stefan Hajnoczi (8):
      block: Do not export bdrv_first
      block: Convert bdrv_first to QTAILQ
      block: Convert first_drv to QLIST
      qemu-img: Eliminate bdrv_new_open() code duplication
      qemu-img: Fix BRDV_O_FLAGS typo
      linux-aio: Fix typo in read() EINTR check
      qcow2: Use QLIST_FOREACH_SAFE macro
      block: Free iovec arrays allocated by multiwrite_merge()

 Makefile.objs          |    6 +-
 block-migration.c      |   63 ++++---
 block.c                |  119 +++++++------
 block.h                |   66 ++++++-
 block/blkdebug.c       |  475 ++++++++++++++++++++++++++++++++++++++++++++++++
 block/qcow2-cluster.c  |   78 +++++---
 block/qcow2-refcount.c |   18 ++
 block/qcow2.c          |   63 +++++--
 block/raw-posix.c      |   65 +++++---
 block/vmdk.c           |    2 +-
 block/vvfat.c          |    5 +-
 block_int.h            |    9 +-
 hw/qdev-properties.c   |   19 ++-
 hw/qdev.h              |    1 -
 hw/virtio-blk.c        |    1 -
 hw/xen_disk.c          |    2 +-
 linux-aio.c            |    2 +-
 monitor.c              |    2 +-
 qemu-config.c          |   48 +++---
 qemu-config.h          |    4 +-
 qemu-img.c             |   93 ++--------
 qemu-io.c              |   28 ++--
 qemu-nbd.c             |    2 +-
 vl.c                   |   82 +++------
 24 files changed, 902 insertions(+), 351 deletions(-)
 create mode 100644 block/blkdebug.c

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PULL 00/26] Block patches
@ 2012-11-14 18:47 Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 01/26] qemu: Document GlusterFS block driver usage Kevin Wolf
                   ` (26 more replies)
  0 siblings, 27 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

The following changes since commit ce34cf72fe508b27a78f83c184142e8d1e6a048a:

  Merge remote-tracking branch 'awilliam/tags/vfio-pci-for-qemu-1.3.0-rc0' into staging (2012-11-14 08:53:40 -0600)

are available in the git repository at:

  git://repo.or.cz/qemu/kevin.git for-anthony

Bharata B Rao (1):
      qemu: Document GlusterFS block driver usage

Gerhard Wiesinger (1):
      vmdk: Fix data corruption bug in WRITE and READ handling

Hervé Poussineau (12):
      fdc-test: split test_media_change() test, so insert part can be reused
      fdc-test: insert media before fuzzing registers
      fdc-test: add tests for non-DMA READ command
      fdc: use status0 field instead of a local variable
      fdc: fix FD_SR0_SEEK for non-DMA transfers and multi sectors transfers
      fdc: fix FD_SR0_SEEK for initial seek on DMA transfers
      fdc: fix false FD_SR0_SEEK
      fdc: implement VERIFY command
      fdc-tests: add tests for VERIFY command
      fdc: remove double affectation of FD_MSR_CMDBUSY flag
      fdc: fix typo in zero constant
      fdc: remove last usage of FD_STATE_SEEK

Kevin Wolf (6):
      qcow2: Fix refcount table size calculation
      qemu-iotests: qcow2: Test growing large refcount table
      fdc: Remove status0 parameter from fdctrl_set_fifo()
      fdc-test: Check READ ID
      megasas: Use bdrv_drain_all instead of qemu_aio_flush
      qemu-io: Use bdrv_drain_all instead of qemu_aio_flush

Nick Thomas (1):
      tests: allow qemu-iotests to be run against nbd backend

Stefan Hajnoczi (4):
      MAINTAINERS: add Stefan Hajnoczi as block and virtio-blk co-maintainer
      aio: switch aiocb_size type int -> size_t
      aio: use g_slice_alloc() for AIOCB pooling
      aio: rename AIOPool to AIOCBInfo

Stefan Weil (1):
      block: Workaround for older versions of MinGW gcc

 MAINTAINERS                      |    2 +
 block.c                          |   31 +++----
 block/blkdebug.c                 |    4 +-
 block/blkverify.c                |    4 +-
 block/curl.c                     |    4 +-
 block/gluster.c                  |    6 +-
 block/iscsi.c                    |   12 +-
 block/linux-aio.c                |    4 +-
 block/qcow2-refcount.c           |    3 +-
 block/qed.c                      |    4 +-
 block/rbd.c                      |    4 +-
 block/sheepdog.c                 |    4 +-
 block/vmdk.c                     |   10 ++-
 block/win32-aio.c                |   14 ++--
 dma-helpers.c                    |    4 +-
 hw/fdc.c                         |  121 +++++++++++++-----------
 hw/ide/core.c                    |    4 +-
 hw/megasas.c                     |    2 +-
 qemu-aio.h                       |   12 +--
 qemu-doc.texi                    |   49 ++++++++++
 qemu-io.c                        |    2 +-
 qemu-options.hx                  |   17 ++++
 tests/fdc-test.c                 |  192 +++++++++++++++++++++++++++++++++++++-
 tests/qemu-iotests/044           |  117 +++++++++++++++++++++++
 tests/qemu-iotests/044.out       |    6 +
 tests/qemu-iotests/common        |   13 ++-
 tests/qemu-iotests/common.config |   10 +-
 tests/qemu-iotests/common.rc     |   23 +++++-
 tests/qemu-iotests/group         |    1 +
 tests/qemu-iotests/iotests.py    |    6 +-
 tests/qemu-iotests/qcow2.py      |    9 +-
 thread-pool.c                    |    4 +-
 32 files changed, 556 insertions(+), 142 deletions(-)
 create mode 100755 tests/qemu-iotests/044
 create mode 100644 tests/qemu-iotests/044.out

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 01/26] qemu: Document GlusterFS block driver usage
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 02/26] qcow2: Fix refcount table size calculation Kevin Wolf
                   ` (25 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Bharata B Rao <bharata@linux.vnet.ibm.com>

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 qemu-doc.texi   |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 qemu-options.hx |   17 +++++++++++++++++
 2 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/qemu-doc.texi b/qemu-doc.texi
index d8fb2de..6ff309d 100644
--- a/qemu-doc.texi
+++ b/qemu-doc.texi
@@ -421,6 +421,7 @@ snapshots.
 * disk_images_nbd::           NBD access
 * disk_images_sheepdog::      Sheepdog disk images
 * disk_images_iscsi::         iSCSI LUNs
+* disk_images_gluster::       GlusterFS disk images
 @end menu
 
 @node disk_images_quickstart
@@ -814,7 +815,55 @@ qemu-system-i386 -iscsi initiator-name=iqn.qemu.test:my-initiator \
     -cdrom iscsi://127.0.0.1/iqn.qemu.test/2
 @end example
 
+@node disk_images_gluster
+@subsection GlusterFS disk images
 
+GlusterFS is an user space distributed file system.
+
+You can boot from the GlusterFS disk image with the command:
+@example
+qemu-system-x86_64 -drive file=gluster[+@var{transport}]://[@var{server}[:@var{port}]]/@var{volname}/@var{image}[?socket=...]
+@end example
+
+@var{gluster} is the protocol.
+
+@var{transport} specifies the transport type used to connect to gluster
+management daemon (glusterd). Valid transport types are
+tcp, unix and rdma. If a transport type isn't specified, then tcp
+type is assumed.
+
+@var{server} specifies the server where the volume file specification for
+the given volume resides. This can be either hostname, ipv4 address
+or ipv6 address. ipv6 address needs to be within square brackets [ ].
+If transport type is unix, then @var{server} field should not be specifed.
+Instead @var{socket} field needs to be populated with the path to unix domain
+socket.
+
+@var{port} is the port number on which glusterd is listening. This is optional
+and if not specified, QEMU will send 0 which will make gluster to use the
+default port. If the transport type is unix, then @var{port} should not be
+specified.
+
+@var{volname} is the name of the gluster volume which contains the disk image.
+
+@var{image} is the path to the actual disk image that resides on gluster volume.
+
+You can create a GlusterFS disk image with the command:
+@example
+qemu-img create gluster://@var{server}/@var{volname}/@var{image} @var{size}
+@end example
+
+Examples
+@example
+qemu-system-x86_64 -drive file=gluster://1.2.3.4/testvol/a.img
+qemu-system-x86_64 -drive file=gluster+tcp://1.2.3.4/testvol/a.img
+qemu-system-x86_64 -drive file=gluster+tcp://1.2.3.4:24007/testvol/dir/a.img
+qemu-system-x86_64 -drive file=gluster+tcp://[1:2:3:4:5:6:7:8]/testvol/dir/a.img
+qemu-system-x86_64 -drive file=gluster+tcp://[1:2:3:4:5:6:7:8]:24007/testvol/dir/a.img
+qemu-system-x86_64 -drive file=gluster+tcp://server.domain.com:24007/testvol/dir/a.img
+qemu-system-x86_64 -drive file=gluster+unix:///testvol/dir/a.img?socket=/tmp/glusterd.socket
+qemu-system-x86_64 -drive file=gluster+rdma://1.2.3.4:24007/testvol/a.img
+@end example
 
 @node pcsys_network
 @section Network emulation
diff --git a/qemu-options.hx b/qemu-options.hx
index fe8f15c..06aa1ae 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2054,6 +2054,23 @@ qemu-system-i386 --drive file=sheepdog:192.0.2.1:30000:MyVirtualMachine
 
 See also @url{http://http://www.osrg.net/sheepdog/}.
 
+@item GlusterFS
+GlusterFS is an user space distributed file system.
+QEMU supports the use of GlusterFS volumes for hosting VM disk images using
+TCP, Unix Domain Sockets and RDMA transport protocols.
+
+Syntax for specifying a VM disk image on GlusterFS volume is
+@example
+gluster[+transport]://[server[:port]]/volname/image[?socket=...]
+@end example
+
+
+Example
+@example
+qemu-system-x86_84 --drive file=gluster://192.0.2.1/testvol/a.img
+@end example
+
+See also @url{http://www.gluster.org}.
 @end table
 ETEXI
 
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 02/26] qcow2: Fix refcount table size calculation
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 01/26] qemu: Document GlusterFS block driver usage Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 03/26] qemu-iotests: qcow2: Test growing large refcount table Kevin Wolf
                   ` (24 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

A missing factor for the refcount table entry size in the calculation
could mean that too little memory was allocated for the in-memory
representation of the table, resulting in a buffer overflow.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Tested-by: Michael Tokarev <mjt@tls.msk.ru>
---
 block/qcow2-refcount.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 5e3f915..96224d1 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -301,7 +301,8 @@ static int alloc_refcount_block(BlockDriverState *bs,
     uint64_t last_table_size;
     uint64_t blocks_clusters;
     do {
-        uint64_t table_clusters = size_to_clusters(s, table_size);
+        uint64_t table_clusters =
+            size_to_clusters(s, table_size * sizeof(uint64_t));
         blocks_clusters = 1 +
             ((table_clusters + refcount_block_clusters - 1)
             / refcount_block_clusters);
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 03/26] qemu-iotests: qcow2: Test growing large refcount table
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 01/26] qemu: Document GlusterFS block driver usage Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 02/26] qcow2: Fix refcount table size calculation Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 04/26] MAINTAINERS: add Stefan Hajnoczi as block and virtio-blk co-maintainer Kevin Wolf
                   ` (23 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

Actually writing all the content with 512 byte sector size would take
forever, therefore build the image file with a Python script and use
qemu-io for the last write that actually triggers the refcount table
growth.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/044        |  117 +++++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/044.out    |    6 ++
 tests/qemu-iotests/group      |    1 +
 tests/qemu-iotests/iotests.py |    6 ++-
 tests/qemu-iotests/qcow2.py   |    9 ++--
 5 files changed, 134 insertions(+), 5 deletions(-)
 create mode 100755 tests/qemu-iotests/044
 create mode 100644 tests/qemu-iotests/044.out

diff --git a/tests/qemu-iotests/044 b/tests/qemu-iotests/044
new file mode 100755
index 0000000..11ea0f4
--- /dev/null
+++ b/tests/qemu-iotests/044
@@ -0,0 +1,117 @@
+#!/usr/bin/env python
+#
+# Tests growing a large refcount table.
+#
+# Copyright (C) 2012 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+import time
+import os
+import qcow2
+from qcow2 import QcowHeader
+import iotests
+from iotests import qemu_img, qemu_img_verbose, qemu_io
+import struct
+import subprocess
+
+test_img = os.path.join(iotests.test_dir, 'test.img')
+
+class TestRefcountTableGrowth(iotests.QMPTestCase):
+    '''Abstract base class for image mirroring test cases'''
+
+    def preallocate(self, name):
+        fd = open(name, "r+b")
+        try:
+            off_reftable = 512
+            off_refblock = off_reftable + (512 * 512)
+            off_l1       = off_refblock + (512 * 512 * 64)
+            off_l2       = off_l1 + (512 * 512 * 4 * 8)
+            off_data     = off_l2 + (512 * 512 * 4 * 512)
+
+            # Write a new header
+            h = QcowHeader(fd)
+            h.refcount_table_offset = off_reftable
+            h.refcount_table_clusters = 512
+            h.l1_table_offset = off_l1
+            h.l1_size = 512 * 512 * 4
+            h.update(fd)
+
+            # Write a refcount table
+            fd.seek(off_reftable)
+
+            for i in xrange(0, h.refcount_table_clusters):
+                sector = ''.join(struct.pack('>Q',
+                    off_refblock + i * 64 * 512 + j * 512)
+                    for j in xrange(0, 64))
+                fd.write(sector)
+
+            # Write the refcount blocks
+            assert(fd.tell() == off_refblock)
+            sector = ''.join(struct.pack('>H', 1) for j in xrange(0, 64 * 256))
+            for block in xrange(0, h.refcount_table_clusters):
+                fd.write(sector)
+
+            # Write the L1 table
+            assert(fd.tell() == off_l1)
+            assert(off_l2 + 512 * h.l1_size == off_data)
+            table = ''.join(struct.pack('>Q', (1 << 63) | off_l2 + 512 * j)
+                for j in xrange(0, h.l1_size))
+            fd.write(table)
+
+            # Write the L2 tables
+            assert(fd.tell() == off_l2)
+            img_file_size = h.refcount_table_clusters * 64 * 256 * 512
+            remaining = img_file_size - off_data
+
+            off = off_data
+            while remaining > 1024 * 512:
+                pytable = list((1 << 63) | off + 512 * j
+                    for j in xrange(0, 1024))
+                table = struct.pack('>1024Q', *pytable)
+                fd.write(table)
+                remaining = remaining - 1024 * 512
+                off = off + 1024 * 512
+
+            table = ''.join(struct.pack('>Q', (1 << 63) | off + 512 * j)
+                for j in xrange(0, remaining / 512))
+            fd.write(table)
+
+
+            # Data
+            fd.truncate(img_file_size)
+
+
+        finally:
+            fd.close()
+
+
+    def setUp(self):
+        qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=512', test_img, '16G')
+        self.preallocate(test_img)
+        pass
+
+
+    def tearDown(self):
+        os.remove(test_img)
+        pass
+
+    def test_grow_refcount_table(self):
+        qemu_io('-c', 'write 3800M 1M', test_img)
+        qemu_img_verbose('check' , test_img)
+        pass
+
+if __name__ == '__main__':
+    iotests.main(supported_fmts=['qcow2'])
diff --git a/tests/qemu-iotests/044.out b/tests/qemu-iotests/044.out
new file mode 100644
index 0000000..7a40071
--- /dev/null
+++ b/tests/qemu-iotests/044.out
@@ -0,0 +1,6 @@
+No errors were found on the image.
+.
+----------------------------------------------------------------------
+Ran 1 tests
+
+OK
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index ac86f54..a4a9044 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -50,3 +50,4 @@
 041 rw auto backing
 042 rw auto quick
 043 rw auto backing
+044 rw auto
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 735c674..b2eaf20 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -42,6 +42,10 @@ def qemu_img(*args):
     devnull = open('/dev/null', 'r+')
     return subprocess.call(qemu_img_args + list(args), stdin=devnull, stdout=devnull)
 
+def qemu_img_verbose(*args):
+    '''Run qemu-img without supressing its output and return the exit code'''
+    return subprocess.call(qemu_img_args + list(args))
+
 def qemu_io(*args):
     '''Run qemu-io and return the stdout data'''
     args = qemu_io_args + list(args)
@@ -182,4 +186,4 @@ def main(supported_fmts=[]):
     try:
         unittest.main(testRunner=MyTestRunner)
     finally:
-        sys.stderr.write(re.sub(r'Ran (\d+) test[s] in [\d.]+s', r'Ran \1 tests', output.getvalue()))
+        sys.stderr.write(re.sub(r'Ran (\d+) tests? in [\d.]+s', r'Ran \1 tests', output.getvalue()))
diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py
index 97f3770..fecf5b9 100755
--- a/tests/qemu-iotests/qcow2.py
+++ b/tests/qemu-iotests/qcow2.py
@@ -233,8 +233,9 @@ def usage():
     for name, handler, num_args, desc in cmds:
         print "    %-20s - %s" % (name, desc)
 
-if len(sys.argv) < 3:
-    usage()
-    sys.exit(1)
+if __name__ == '__main__':
+    if len(sys.argv) < 3:
+        usage()
+        sys.exit(1)
 
-main(sys.argv[1], sys.argv[2], sys.argv[3:])
+    main(sys.argv[1], sys.argv[2], sys.argv[3:])
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 04/26] MAINTAINERS: add Stefan Hajnoczi as block and virtio-blk co-maintainer
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (2 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 03/26] qemu-iotests: qcow2: Test growing large refcount table Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 05/26] block: Workaround for older versions of MinGW gcc Kevin Wolf
                   ` (22 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Stefan Hajnoczi <stefanha@redhat.com>

Kevin has requested co-maintainership to give him more time to write
code.  We will alternate patch review duties on a weekly basis.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 MAINTAINERS |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 8f5681f..2ede20d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -553,6 +553,7 @@ T: git git://github.com/kvaneesh/QEMU.git
 
 virtio-blk
 M: Kevin Wolf <kwolf@redhat.com>
+M: Stefan Hajnoczi <stefanha@redhat.com>
 S: Supported
 F: hw/virtio-blk*
 
@@ -583,6 +584,7 @@ F: audio/
 
 Block
 M: Kevin Wolf <kwolf@redhat.com>
+M: Stefan Hajnoczi <stefanha@redhat.com>
 S: Supported
 F: block*
 F: block/
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 05/26] block: Workaround for older versions of MinGW gcc
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (3 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 04/26] MAINTAINERS: add Stefan Hajnoczi as block and virtio-blk co-maintainer Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 06/26] tests: allow qemu-iotests to be run against nbd backend Kevin Wolf
                   ` (21 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Stefan Weil <sw@weilnetz.de>

Versions before gcc-4.6 don't support unnamed fields in initializers
(see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676).

Offset and OffsetHigh belong to an unnamed struct which is part of an
unnamed union. Therefore the original code does not work with older
versions of gcc.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/win32-aio.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/block/win32-aio.c b/block/win32-aio.c
index c34dc73..92f25a9 100644
--- a/block/win32-aio.c
+++ b/block/win32-aio.c
@@ -167,11 +167,11 @@ BlockDriverAIOCB *win32_aio_submit(BlockDriverState *bs,
         waiocb->is_linear = true;
     }
 
-    waiocb->ov = (OVERLAPPED) {
-        .Offset = (DWORD) offset,
-        .OffsetHigh = (DWORD) (offset >> 32),
-        .hEvent = event_notifier_get_handle(&aio->e)
-    };
+    memset(&waiocb->ov, 0, sizeof(waiocb->ov));
+    waiocb->ov.Offset = (DWORD)offset;
+    waiocb->ov.OffsetHigh = (DWORD)(offset >> 32);
+    waiocb->ov.hEvent = event_notifier_get_handle(&aio->e);
+
     aio->count++;
 
     if (type & QEMU_AIO_READ) {
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 06/26] tests: allow qemu-iotests to be run against nbd backend
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (4 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 05/26] block: Workaround for older versions of MinGW gcc Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 07/26] aio: switch aiocb_size type int -> size_t Kevin Wolf
                   ` (20 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Nick Thomas <nick@bytemark.co.uk>

To do this, we start a qemu-nbd process at _make_test_img and kill
it in _cleanup_test_img. $TEST_IMG is changed to point at the TCP
server. We also remove the checks for existence of binaries from
common.config - they're duplicated in common, and we can make the
qemu-nbd check conditional on $IMGPROTO being "nbd" if we do it there.

Signed-off-by: Nick Thomas <nick@bytemark.co.uk>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/common        |   13 ++++++++++---
 tests/qemu-iotests/common.config |   10 ++++++----
 tests/qemu-iotests/common.rc     |   23 ++++++++++++++++++++++-
 3 files changed, 38 insertions(+), 8 deletions(-)

diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index 1f6fdf5..b3aad89 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -136,6 +136,7 @@ check options
     -vmdk               test vmdk
     -rbd                test rbd
     -sheepdog           test sheepdog
+    -nbd                test nbd
     -xdiff		graphical mode diff
     -nocache		use O_DIRECT on backing file
     -misalign		misalign memory allocations
@@ -197,12 +198,14 @@ testlist options
 	    IMGPROTO=rbd
 	    xpand=false
 	    ;;
-
 	-sheepdog)
 	    IMGPROTO=sheepdog
 	    xpand=false
 	    ;;
-
+	-nbd)
+	    IMGPROTO=nbd
+	    xpand=false
+	    ;;
 	-nocache)
 	    QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --nocache"
 	    xpand=false
@@ -350,7 +353,11 @@ fi
 
 [ "$QEMU" = "" ] && _fatal "qemu not found"
 [ "$QEMU_IMG" = "" ] && _fatal "qemu-img not found"
-[ "$QEMU_IO" = "" ] && _fatal "qemu-img not found"
+[ "$QEMU_IO" = "" ] && _fatal "qemu-io not found"
+
+if [ "$IMGPROTO" = "nbd" ] ; then
+    [ "$QEMU_NBD" = "" ] && _fatal "qemu-nbd not found"
+fi
 
 if $valgrind; then
     export REAL_QEMU_IO="$QEMU_IO_PROG"
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
index df082e7..08a3f10 100644
--- a/tests/qemu-iotests/common.config
+++ b/tests/qemu-iotests/common.config
@@ -90,21 +90,23 @@ export PS_ALL_FLAGS="-ef"
 if [ -z "$QEMU_PROG" ]; then
     export QEMU_PROG="`set_prog_path qemu`"
 fi
-[ "$QEMU_PROG" = "" ] && _fatal "qemu not found"
 
 if [ -z "$QEMU_IMG_PROG" ]; then
     export QEMU_IMG_PROG="`set_prog_path qemu-img`"
 fi
-[ "$QEMU_IMG_PROG" = "" ] && _fatal "qemu-img not found"
 
 if [ -z "$QEMU_IO_PROG" ]; then
     export QEMU_IO_PROG="`set_prog_path qemu-io`"
 fi
-[ "$QEMU_IO_PROG" = "" ] && _fatal "qemu-io not found"
+
+if [ -z "$QEMU_NBD_PROG" ]; then
+    export QEMU_NBD_PROG="`set_prog_path qemu-nbd`"
+fi
 
 export QEMU=$QEMU_PROG
-export QEMU_IMG=$QEMU_IMG_PROG 
+export QEMU_IMG=$QEMU_IMG_PROG
 export QEMU_IO="$QEMU_IO_PROG $QEMU_IO_OPTIONS"
+export QEMU_NBD=$QEMU_NBD_PROG
 
 [ -f /etc/qemu-iotest.config ]       && . /etc/qemu-iotest.config
 
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 334534f..aef5f52 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -49,6 +49,9 @@ umask 022
 
 if [ "$IMGPROTO" = "file" ]; then
     TEST_IMG=$TEST_DIR/t.$IMGFMT
+elif [ "$IMGPROTO" = "nbd" ]; then
+    TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
+    TEST_IMG="nbd:127.0.0.1:10810"
 else
     TEST_IMG=$IMGPROTO:$TEST_DIR/t.$IMGFMT
 fi
@@ -86,6 +89,13 @@ _make_test_img()
     local extra_img_options=""
     local image_size=$*
     local optstr=""
+    local img_name=""
+
+    if [ -n "$TEST_IMG_FILE" ]; then
+        img_name=$TEST_IMG_FILE
+    else
+        img_name=$TEST_IMG
+    fi
 
     if [ -n "$IMGOPTS" ]; then
         optstr=$(_optstr_add "$optstr" "$IMGOPTS")
@@ -104,7 +114,7 @@ _make_test_img()
     fi
 
     # XXX(hch): have global image options?
-    $QEMU_IMG create -f $IMGFMT $extra_img_options $TEST_IMG $image_size | \
+    $QEMU_IMG create -f $IMGFMT $extra_img_options $img_name $image_size | \
         sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
             -e "s#$TEST_DIR#TEST_DIR#g" \
             -e "s#$IMGFMT#IMGFMT#g" \
@@ -115,12 +125,23 @@ _make_test_img()
             -e "s# compat6=\\(on\\|off\\)##g" \
             -e "s# static=\\(on\\|off\\)##g" \
             -e "s# lazy_refcounts=\\(on\\|off\\)##g"
+
+    # Start an NBD server on the image file, which is what we'll be talking to
+    if [ $IMGPROTO = "nbd" ]; then
+        eval "$QEMU_NBD -v -t -b 127.0.0.1 -p 10810  $TEST_IMG_FILE &"
+        QEMU_NBD_PID=$!
+        sleep 1 # FIXME: qemu-nbd needs to be listening before we continue
+    fi
 }
 
 _cleanup_test_img()
 {
     case "$IMGPROTO" in
 
+        nbd)
+            kill $QEMU_NBD_PID
+            rm -f $TEST_IMG_FILE
+            ;;
         file)
             rm -f $TEST_DIR/t.$IMGFMT
             rm -f $TEST_DIR/t.$IMGFMT.orig
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 07/26] aio: switch aiocb_size type int -> size_t
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (5 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 06/26] tests: allow qemu-iotests to be run against nbd backend Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 08/26] aio: use g_slice_alloc() for AIOCB pooling Kevin Wolf
                   ` (19 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Stefan Hajnoczi <stefanha@redhat.com>

Using appropriate types for variables is a good thing :).  All users
simply do sizeof(MyType) and the value is passed to a memory allocator,
it should be size_t.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 qemu-aio.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/qemu-aio.h b/qemu-aio.h
index 1b7eb6e..111b0b3 100644
--- a/qemu-aio.h
+++ b/qemu-aio.h
@@ -23,7 +23,7 @@ typedef void BlockDriverCompletionFunc(void *opaque, int ret);
 
 typedef struct AIOPool {
     void (*cancel)(BlockDriverAIOCB *acb);
-    int aiocb_size;
+    size_t aiocb_size;
     BlockDriverAIOCB *free_aiocb;
 } AIOPool;
 
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 08/26] aio: use g_slice_alloc() for AIOCB pooling
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (6 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 07/26] aio: switch aiocb_size type int -> size_t Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 09/26] aio: rename AIOPool to AIOCBInfo Kevin Wolf
                   ` (18 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Stefan Hajnoczi <stefanha@redhat.com>

AIO control blocks are frequently acquired and released because each aio
request involves at least one AIOCB.  Therefore, we pool them to avoid
heap allocation overhead.

The problem with the freelist approach in AIOPool is thread-safety.  If
we want BlockDriverStates to associate with AioContexts that execute in
multiple threads, then a global freelist becomes a problem.

This patch drops the freelist and instead uses g_slice_alloc() which is
tuned for per-thread fixed-size object pools.  qemu_aio_get() and
qemu_aio_release() are now thread-safe.

Note that the change from g_malloc0() to g_slice_alloc() should be safe
since the freelist reuse case doesn't zero the AIOCB either.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block.c    |   15 ++++-----------
 qemu-aio.h |    2 --
 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/block.c b/block.c
index da1fdca..ea0f7d8 100644
--- a/block.c
+++ b/block.c
@@ -3909,13 +3909,8 @@ void *qemu_aio_get(AIOPool *pool, BlockDriverState *bs,
 {
     BlockDriverAIOCB *acb;
 
-    if (pool->free_aiocb) {
-        acb = pool->free_aiocb;
-        pool->free_aiocb = acb->next;
-    } else {
-        acb = g_malloc0(pool->aiocb_size);
-        acb->pool = pool;
-    }
+    acb = g_slice_alloc(pool->aiocb_size);
+    acb->pool = pool;
     acb->bs = bs;
     acb->cb = cb;
     acb->opaque = opaque;
@@ -3924,10 +3919,8 @@ void *qemu_aio_get(AIOPool *pool, BlockDriverState *bs,
 
 void qemu_aio_release(void *p)
 {
-    BlockDriverAIOCB *acb = (BlockDriverAIOCB *)p;
-    AIOPool *pool = acb->pool;
-    acb->next = pool->free_aiocb;
-    pool->free_aiocb = acb;
+    BlockDriverAIOCB *acb = p;
+    g_slice_free1(acb->pool->aiocb_size, acb);
 }
 
 /**************************************************************/
diff --git a/qemu-aio.h b/qemu-aio.h
index 111b0b3..b29c509 100644
--- a/qemu-aio.h
+++ b/qemu-aio.h
@@ -24,7 +24,6 @@ typedef void BlockDriverCompletionFunc(void *opaque, int ret);
 typedef struct AIOPool {
     void (*cancel)(BlockDriverAIOCB *acb);
     size_t aiocb_size;
-    BlockDriverAIOCB *free_aiocb;
 } AIOPool;
 
 struct BlockDriverAIOCB {
@@ -32,7 +31,6 @@ struct BlockDriverAIOCB {
     BlockDriverState *bs;
     BlockDriverCompletionFunc *cb;
     void *opaque;
-    BlockDriverAIOCB *next;
 };
 
 void *qemu_aio_get(AIOPool *pool, BlockDriverState *bs,
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 09/26] aio: rename AIOPool to AIOCBInfo
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (7 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 08/26] aio: use g_slice_alloc() for AIOCB pooling Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 10/26] fdc: Remove status0 parameter from fdctrl_set_fifo() Kevin Wolf
                   ` (17 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Stefan Hajnoczi <stefanha@redhat.com>

Now that AIOPool no longer keeps a freelist, it isn't really a "pool"
anymore.  Rename it to AIOCBInfo and make it const since it no longer
needs to be modified.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block.c           |   22 +++++++++++-----------
 block/blkdebug.c  |    4 ++--
 block/blkverify.c |    4 ++--
 block/curl.c      |    4 ++--
 block/gluster.c   |    6 +++---
 block/iscsi.c     |   12 ++++++------
 block/linux-aio.c |    4 ++--
 block/qed.c       |    4 ++--
 block/rbd.c       |    4 ++--
 block/sheepdog.c  |    4 ++--
 block/win32-aio.c |    4 ++--
 dma-helpers.c     |    4 ++--
 hw/ide/core.c     |    4 ++--
 qemu-aio.h        |    8 ++++----
 thread-pool.c     |    4 ++--
 15 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/block.c b/block.c
index ea0f7d8..854ebd6 100644
--- a/block.c
+++ b/block.c
@@ -3521,7 +3521,7 @@ int bdrv_aio_multiwrite(BlockDriverState *bs, BlockRequest *reqs, int num_reqs)
 
 void bdrv_aio_cancel(BlockDriverAIOCB *acb)
 {
-    acb->pool->cancel(acb);
+    acb->aiocb_info->cancel(acb);
 }
 
 /* block I/O throttling */
@@ -3711,7 +3711,7 @@ static void bdrv_aio_cancel_em(BlockDriverAIOCB *blockacb)
     qemu_aio_release(acb);
 }
 
-static AIOPool bdrv_em_aio_pool = {
+static const AIOCBInfo bdrv_em_aiocb_info = {
     .aiocb_size         = sizeof(BlockDriverAIOCBSync),
     .cancel             = bdrv_aio_cancel_em,
 };
@@ -3740,7 +3740,7 @@ static BlockDriverAIOCB *bdrv_aio_rw_vector(BlockDriverState *bs,
 {
     BlockDriverAIOCBSync *acb;
 
-    acb = qemu_aio_get(&bdrv_em_aio_pool, bs, cb, opaque);
+    acb = qemu_aio_get(&bdrv_em_aiocb_info, bs, cb, opaque);
     acb->is_write = is_write;
     acb->qiov = qiov;
     acb->bounce = qemu_blockalign(bs, qiov->size);
@@ -3785,7 +3785,7 @@ static void bdrv_aio_co_cancel_em(BlockDriverAIOCB *blockacb)
     qemu_aio_flush();
 }
 
-static AIOPool bdrv_em_co_aio_pool = {
+static const AIOCBInfo bdrv_em_co_aiocb_info = {
     .aiocb_size         = sizeof(BlockDriverAIOCBCoroutine),
     .cancel             = bdrv_aio_co_cancel_em,
 };
@@ -3828,7 +3828,7 @@ static BlockDriverAIOCB *bdrv_co_aio_rw_vector(BlockDriverState *bs,
     Coroutine *co;
     BlockDriverAIOCBCoroutine *acb;
 
-    acb = qemu_aio_get(&bdrv_em_co_aio_pool, bs, cb, opaque);
+    acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque);
     acb->req.sector = sector_num;
     acb->req.nb_sectors = nb_sectors;
     acb->req.qiov = qiov;
@@ -3858,7 +3858,7 @@ BlockDriverAIOCB *bdrv_aio_flush(BlockDriverState *bs,
     Coroutine *co;
     BlockDriverAIOCBCoroutine *acb;
 
-    acb = qemu_aio_get(&bdrv_em_co_aio_pool, bs, cb, opaque);
+    acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque);
     co = qemu_coroutine_create(bdrv_aio_flush_co_entry);
     qemu_coroutine_enter(co, acb);
 
@@ -3884,7 +3884,7 @@ BlockDriverAIOCB *bdrv_aio_discard(BlockDriverState *bs,
 
     trace_bdrv_aio_discard(bs, sector_num, nb_sectors, opaque);
 
-    acb = qemu_aio_get(&bdrv_em_co_aio_pool, bs, cb, opaque);
+    acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque);
     acb->req.sector = sector_num;
     acb->req.nb_sectors = nb_sectors;
     co = qemu_coroutine_create(bdrv_aio_discard_co_entry);
@@ -3904,13 +3904,13 @@ void bdrv_init_with_whitelist(void)
     bdrv_init();
 }
 
-void *qemu_aio_get(AIOPool *pool, BlockDriverState *bs,
+void *qemu_aio_get(const AIOCBInfo *aiocb_info, BlockDriverState *bs,
                    BlockDriverCompletionFunc *cb, void *opaque)
 {
     BlockDriverAIOCB *acb;
 
-    acb = g_slice_alloc(pool->aiocb_size);
-    acb->pool = pool;
+    acb = g_slice_alloc(aiocb_info->aiocb_size);
+    acb->aiocb_info = aiocb_info;
     acb->bs = bs;
     acb->cb = cb;
     acb->opaque = opaque;
@@ -3920,7 +3920,7 @@ void *qemu_aio_get(AIOPool *pool, BlockDriverState *bs,
 void qemu_aio_release(void *p)
 {
     BlockDriverAIOCB *acb = p;
-    g_slice_free1(acb->pool->aiocb_size, acb);
+    g_slice_free1(acb->aiocb_info->aiocb_size, acb);
 }
 
 /**************************************************************/
diff --git a/block/blkdebug.c b/block/blkdebug.c
index 1206d52..d61ece8 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -41,7 +41,7 @@ typedef struct BlkdebugAIOCB {
 
 static void blkdebug_aio_cancel(BlockDriverAIOCB *blockacb);
 
-static AIOPool blkdebug_aio_pool = {
+static const AIOCBInfo blkdebug_aiocb_info = {
     .aiocb_size = sizeof(BlkdebugAIOCB),
     .cancel     = blkdebug_aio_cancel,
 };
@@ -335,7 +335,7 @@ static BlockDriverAIOCB *inject_error(BlockDriverState *bs,
         return NULL;
     }
 
-    acb = qemu_aio_get(&blkdebug_aio_pool, bs, cb, opaque);
+    acb = qemu_aio_get(&blkdebug_aiocb_info, bs, cb, opaque);
     acb->ret = -error;
 
     bh = qemu_bh_new(error_callback_bh, acb);
diff --git a/block/blkverify.c b/block/blkverify.c
index 9d5f1ec..4beede7 100644
--- a/block/blkverify.c
+++ b/block/blkverify.c
@@ -48,7 +48,7 @@ static void blkverify_aio_cancel(BlockDriverAIOCB *blockacb)
     }
 }
 
-static AIOPool blkverify_aio_pool = {
+static const AIOCBInfo blkverify_aiocb_info = {
     .aiocb_size         = sizeof(BlkverifyAIOCB),
     .cancel             = blkverify_aio_cancel,
 };
@@ -233,7 +233,7 @@ static BlkverifyAIOCB *blkverify_aio_get(BlockDriverState *bs, bool is_write,
                                          BlockDriverCompletionFunc *cb,
                                          void *opaque)
 {
-    BlkverifyAIOCB *acb = qemu_aio_get(&blkverify_aio_pool, bs, cb, opaque);
+    BlkverifyAIOCB *acb = qemu_aio_get(&blkverify_aiocb_info, bs, cb, opaque);
 
     acb->bh = NULL;
     acb->is_write = is_write;
diff --git a/block/curl.c b/block/curl.c
index c1074cd..1179484 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -438,7 +438,7 @@ static void curl_aio_cancel(BlockDriverAIOCB *blockacb)
     // Do we have to implement canceling? Seems to work without...
 }
 
-static AIOPool curl_aio_pool = {
+static const AIOCBInfo curl_aiocb_info = {
     .aiocb_size         = sizeof(CURLAIOCB),
     .cancel             = curl_aio_cancel,
 };
@@ -505,7 +505,7 @@ static BlockDriverAIOCB *curl_aio_readv(BlockDriverState *bs,
 {
     CURLAIOCB *acb;
 
-    acb = qemu_aio_get(&curl_aio_pool, bs, cb, opaque);
+    acb = qemu_aio_get(&curl_aiocb_info, bs, cb, opaque);
 
     acb->qiov = qiov;
     acb->sector_num = sector_num;
diff --git a/block/gluster.c b/block/gluster.c
index 3588d73..1c90174 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -388,7 +388,7 @@ static void qemu_gluster_aio_cancel(BlockDriverAIOCB *blockacb)
     }
 }
 
-static AIOPool gluster_aio_pool = {
+static const AIOCBInfo gluster_aiocb_info = {
     .aiocb_size = sizeof(GlusterAIOCB),
     .cancel = qemu_gluster_aio_cancel,
 };
@@ -439,7 +439,7 @@ static BlockDriverAIOCB *qemu_gluster_aio_rw(BlockDriverState *bs,
     size = nb_sectors * BDRV_SECTOR_SIZE;
     s->qemu_aio_count++;
 
-    acb = qemu_aio_get(&gluster_aio_pool, bs, cb, opaque);
+    acb = qemu_aio_get(&gluster_aiocb_info, bs, cb, opaque);
     acb->size = size;
     acb->ret = 0;
     acb->finished = NULL;
@@ -484,7 +484,7 @@ static BlockDriverAIOCB *qemu_gluster_aio_flush(BlockDriverState *bs,
     GlusterAIOCB *acb;
     BDRVGlusterState *s = bs->opaque;
 
-    acb = qemu_aio_get(&gluster_aio_pool, bs, cb, opaque);
+    acb = qemu_aio_get(&gluster_aiocb_info, bs, cb, opaque);
     acb->size = 0;
     acb->ret = 0;
     acb->finished = NULL;
diff --git a/block/iscsi.c b/block/iscsi.c
index d0b1a10..a6a819d 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -133,7 +133,7 @@ iscsi_aio_cancel(BlockDriverAIOCB *blockacb)
     }
 }
 
-static AIOPool iscsi_aio_pool = {
+static const AIOCBInfo iscsi_aiocb_info = {
     .aiocb_size         = sizeof(IscsiAIOCB),
     .cancel             = iscsi_aio_cancel,
 };
@@ -234,7 +234,7 @@ iscsi_aio_writev(BlockDriverState *bs, int64_t sector_num,
     uint64_t lba;
     struct iscsi_data data;
 
-    acb = qemu_aio_get(&iscsi_aio_pool, bs, cb, opaque);
+    acb = qemu_aio_get(&iscsi_aiocb_info, bs, cb, opaque);
     trace_iscsi_aio_writev(iscsi, sector_num, nb_sectors, opaque, acb);
 
     acb->iscsilun = iscsilun;
@@ -325,7 +325,7 @@ iscsi_aio_readv(BlockDriverState *bs, int64_t sector_num,
 
     qemu_read_size = BDRV_SECTOR_SIZE * (size_t)nb_sectors;
 
-    acb = qemu_aio_get(&iscsi_aio_pool, bs, cb, opaque);
+    acb = qemu_aio_get(&iscsi_aiocb_info, bs, cb, opaque);
     trace_iscsi_aio_readv(iscsi, sector_num, nb_sectors, opaque, acb);
 
     acb->iscsilun = iscsilun;
@@ -430,7 +430,7 @@ iscsi_aio_flush(BlockDriverState *bs,
     struct iscsi_context *iscsi = iscsilun->iscsi;
     IscsiAIOCB *acb;
 
-    acb = qemu_aio_get(&iscsi_aio_pool, bs, cb, opaque);
+    acb = qemu_aio_get(&iscsi_aiocb_info, bs, cb, opaque);
 
     acb->iscsilun = iscsilun;
     acb->canceled   = 0;
@@ -483,7 +483,7 @@ iscsi_aio_discard(BlockDriverState *bs,
     IscsiAIOCB *acb;
     struct unmap_list list[1];
 
-    acb = qemu_aio_get(&iscsi_aio_pool, bs, cb, opaque);
+    acb = qemu_aio_get(&iscsi_aiocb_info, bs, cb, opaque);
 
     acb->iscsilun = iscsilun;
     acb->canceled   = 0;
@@ -558,7 +558,7 @@ static BlockDriverAIOCB *iscsi_aio_ioctl(BlockDriverState *bs,
 
     assert(req == SG_IO);
 
-    acb = qemu_aio_get(&iscsi_aio_pool, bs, cb, opaque);
+    acb = qemu_aio_get(&iscsi_aiocb_info, bs, cb, opaque);
 
     acb->iscsilun = iscsilun;
     acb->canceled    = 0;
diff --git a/block/linux-aio.c b/block/linux-aio.c
index 6ca984d..91ef863 100644
--- a/block/linux-aio.c
+++ b/block/linux-aio.c
@@ -140,7 +140,7 @@ static void laio_cancel(BlockDriverAIOCB *blockacb)
     }
 }
 
-static AIOPool laio_pool = {
+static const AIOCBInfo laio_aiocb_info = {
     .aiocb_size         = sizeof(struct qemu_laiocb),
     .cancel             = laio_cancel,
 };
@@ -154,7 +154,7 @@ BlockDriverAIOCB *laio_submit(BlockDriverState *bs, void *aio_ctx, int fd,
     struct iocb *iocbs;
     off_t offset = sector_num * 512;
 
-    laiocb = qemu_aio_get(&laio_pool, bs, cb, opaque);
+    laiocb = qemu_aio_get(&laio_aiocb_info, bs, cb, opaque);
     laiocb->nbytes = nb_sectors * 512;
     laiocb->ctx = s;
     laiocb->ret = -EINPROGRESS;
diff --git a/block/qed.c b/block/qed.c
index 6c182ca..0b5374a 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -30,7 +30,7 @@ static void qed_aio_cancel(BlockDriverAIOCB *blockacb)
     }
 }
 
-static AIOPool qed_aio_pool = {
+static const AIOCBInfo qed_aiocb_info = {
     .aiocb_size         = sizeof(QEDAIOCB),
     .cancel             = qed_aio_cancel,
 };
@@ -1311,7 +1311,7 @@ static BlockDriverAIOCB *qed_aio_setup(BlockDriverState *bs,
                                        BlockDriverCompletionFunc *cb,
                                        void *opaque, int flags)
 {
-    QEDAIOCB *acb = qemu_aio_get(&qed_aio_pool, bs, cb, opaque);
+    QEDAIOCB *acb = qemu_aio_get(&qed_aiocb_info, bs, cb, opaque);
 
     trace_qed_aio_setup(bs->opaque, acb, sector_num, nb_sectors,
                         opaque, flags);
diff --git a/block/rbd.c b/block/rbd.c
index 015a9db..0aaacaf 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -570,7 +570,7 @@ static void qemu_rbd_aio_cancel(BlockDriverAIOCB *blockacb)
     acb->cancelled = 1;
 }
 
-static AIOPool rbd_aio_pool = {
+static const AIOCBInfo rbd_aiocb_info = {
     .aiocb_size = sizeof(RBDAIOCB),
     .cancel = qemu_rbd_aio_cancel,
 };
@@ -672,7 +672,7 @@ static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs,
 
     BDRVRBDState *s = bs->opaque;
 
-    acb = qemu_aio_get(&rbd_aio_pool, bs, cb, opaque);
+    acb = qemu_aio_get(&rbd_aiocb_info, bs, cb, opaque);
     acb->cmd = cmd;
     acb->qiov = qiov;
     if (cmd == RBD_AIO_DISCARD) {
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 9306174..a48f58c 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -420,7 +420,7 @@ static void sd_aio_cancel(BlockDriverAIOCB *blockacb)
     acb->canceled = true;
 }
 
-static AIOPool sd_aio_pool = {
+static const AIOCBInfo sd_aiocb_info = {
     .aiocb_size = sizeof(SheepdogAIOCB),
     .cancel = sd_aio_cancel,
 };
@@ -431,7 +431,7 @@ static SheepdogAIOCB *sd_aio_setup(BlockDriverState *bs, QEMUIOVector *qiov,
 {
     SheepdogAIOCB *acb;
 
-    acb = qemu_aio_get(&sd_aio_pool, bs, cb, opaque);
+    acb = qemu_aio_get(&sd_aiocb_info, bs, cb, opaque);
 
     acb->qiov = qiov;
 
diff --git a/block/win32-aio.c b/block/win32-aio.c
index 92f25a9..4704ee0 100644
--- a/block/win32-aio.c
+++ b/block/win32-aio.c
@@ -131,7 +131,7 @@ static void win32_aio_cancel(BlockDriverAIOCB *blockacb)
     }
 }
 
-static AIOPool win32_aio_pool = {
+static const AIOCBInfo win32_aiocb_info = {
     .aiocb_size         = sizeof(QEMUWin32AIOCB),
     .cancel             = win32_aio_cancel,
 };
@@ -145,7 +145,7 @@ BlockDriverAIOCB *win32_aio_submit(BlockDriverState *bs,
     uint64_t offset = sector_num * 512;
     DWORD rc;
 
-    waiocb = qemu_aio_get(&win32_aio_pool, bs, cb, opaque);
+    waiocb = qemu_aio_get(&win32_aiocb_info, bs, cb, opaque);
     waiocb->nbytes = nb_sectors * 512;
     waiocb->qiov = qiov;
     waiocb->is_read = (type == QEMU_AIO_READ);
diff --git a/dma-helpers.c b/dma-helpers.c
index 0c18e9e..4f5fb64 100644
--- a/dma-helpers.c
+++ b/dma-helpers.c
@@ -195,7 +195,7 @@ static void dma_aio_cancel(BlockDriverAIOCB *acb)
     dma_complete(dbs, 0);
 }
 
-static AIOPool dma_aio_pool = {
+static const AIOCBInfo dma_aiocb_info = {
     .aiocb_size         = sizeof(DMAAIOCB),
     .cancel             = dma_aio_cancel,
 };
@@ -205,7 +205,7 @@ BlockDriverAIOCB *dma_bdrv_io(
     DMAIOFunc *io_func, BlockDriverCompletionFunc *cb,
     void *opaque, DMADirection dir)
 {
-    DMAAIOCB *dbs = qemu_aio_get(&dma_aio_pool, bs, cb, opaque);
+    DMAAIOCB *dbs = qemu_aio_get(&dma_aiocb_info, bs, cb, opaque);
 
     trace_dma_bdrv_io(dbs, bs, sector_num, (dir == DMA_DIRECTION_TO_DEVICE));
 
diff --git a/hw/ide/core.c b/hw/ide/core.c
index d683a8c..7d6b0fa 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -336,7 +336,7 @@ static void trim_aio_cancel(BlockDriverAIOCB *acb)
     qemu_aio_release(iocb);
 }
 
-static AIOPool trim_aio_pool = {
+static const AIOCBInfo trim_aiocb_info = {
     .aiocb_size         = sizeof(TrimAIOCB),
     .cancel             = trim_aio_cancel,
 };
@@ -360,7 +360,7 @@ BlockDriverAIOCB *ide_issue_trim(BlockDriverState *bs,
     TrimAIOCB *iocb;
     int i, j, ret;
 
-    iocb = qemu_aio_get(&trim_aio_pool, bs, cb, opaque);
+    iocb = qemu_aio_get(&trim_aiocb_info, bs, cb, opaque);
     iocb->bh = qemu_bh_new(ide_trim_bh_cb, iocb);
     iocb->ret = 0;
 
diff --git a/qemu-aio.h b/qemu-aio.h
index b29c509..3889fe9 100644
--- a/qemu-aio.h
+++ b/qemu-aio.h
@@ -21,19 +21,19 @@
 typedef struct BlockDriverAIOCB BlockDriverAIOCB;
 typedef void BlockDriverCompletionFunc(void *opaque, int ret);
 
-typedef struct AIOPool {
+typedef struct AIOCBInfo {
     void (*cancel)(BlockDriverAIOCB *acb);
     size_t aiocb_size;
-} AIOPool;
+} AIOCBInfo;
 
 struct BlockDriverAIOCB {
-    AIOPool *pool;
+    const AIOCBInfo *aiocb_info;
     BlockDriverState *bs;
     BlockDriverCompletionFunc *cb;
     void *opaque;
 };
 
-void *qemu_aio_get(AIOPool *pool, BlockDriverState *bs,
+void *qemu_aio_get(const AIOCBInfo *aiocb_info, BlockDriverState *bs,
                    BlockDriverCompletionFunc *cb, void *opaque);
 void qemu_aio_release(void *p);
 
diff --git a/thread-pool.c b/thread-pool.c
index 651b324..204f70b 100644
--- a/thread-pool.c
+++ b/thread-pool.c
@@ -216,7 +216,7 @@ static void thread_pool_cancel(BlockDriverAIOCB *acb)
     qemu_mutex_unlock(&lock);
 }
 
-static AIOPool thread_pool_cb_pool = {
+static const AIOCBInfo thread_pool_aiocb_info = {
     .aiocb_size         = sizeof(ThreadPoolElement),
     .cancel             = thread_pool_cancel,
 };
@@ -226,7 +226,7 @@ BlockDriverAIOCB *thread_pool_submit_aio(ThreadPoolFunc *func, void *arg,
 {
     ThreadPoolElement *req;
 
-    req = qemu_aio_get(&thread_pool_cb_pool, NULL, cb, opaque);
+    req = qemu_aio_get(&thread_pool_aiocb_info, NULL, cb, opaque);
     req->func = func;
     req->arg = arg;
     req->state = THREAD_QUEUED;
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 10/26] fdc: Remove status0 parameter from fdctrl_set_fifo()
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (8 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 09/26] aio: rename AIOPool to AIOCBInfo Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 11/26] fdc-test: split test_media_change() test, so insert part can be reused Kevin Wolf
                   ` (16 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

It decided whether an interrupt is triggered. Only one caller made use
of this functionality, so move the code there.

In this one caller, the interrupt must actually be triggered
unconditionally, like it was before commit 2fee0088. For example, a
successful read without an implied seek can result in st0 = 0, but still
triggers the interrupt.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Tested-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/fdc.c |   33 ++++++++++++++++-----------------
 1 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/hw/fdc.c b/hw/fdc.c
index bf8c1d9..3585220 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -1079,15 +1079,12 @@ static void fdctrl_reset_fifo(FDCtrl *fdctrl)
 }
 
 /* Set FIFO status for the host to read */
-static void fdctrl_set_fifo(FDCtrl *fdctrl, int fifo_len, uint8_t status0)
+static void fdctrl_set_fifo(FDCtrl *fdctrl, int fifo_len)
 {
     fdctrl->data_dir = FD_DIR_READ;
     fdctrl->data_len = fifo_len;
     fdctrl->data_pos = 0;
     fdctrl->msr |= FD_MSR_CMDBUSY | FD_MSR_RQM | FD_MSR_DIO;
-    if (status0) {
-        fdctrl_raise_irq(fdctrl, status0);
-    }
 }
 
 /* Set an error: unimplemented/unknown command */
@@ -1096,7 +1093,7 @@ static void fdctrl_unimplemented(FDCtrl *fdctrl, int direction)
     qemu_log_mask(LOG_UNIMP, "fdc: unimplemented command 0x%02x\n",
                   fdctrl->fifo[0]);
     fdctrl->fifo[0] = FD_SR0_INVCMD;
-    fdctrl_set_fifo(fdctrl, 1, 0);
+    fdctrl_set_fifo(fdctrl, 1);
 }
 
 /* Seek to next sector
@@ -1170,7 +1167,9 @@ static void fdctrl_stop_transfer(FDCtrl *fdctrl, uint8_t status0,
     }
     fdctrl->msr |= FD_MSR_RQM | FD_MSR_DIO;
     fdctrl->msr &= ~FD_MSR_NONDMA;
-    fdctrl_set_fifo(fdctrl, 7, fdctrl->status0);
+
+    fdctrl_set_fifo(fdctrl, 7);
+    fdctrl_raise_irq(fdctrl, fdctrl->status0);
 }
 
 /* Prepare a data transfer (either DMA or FIFO) */
@@ -1536,7 +1535,7 @@ static void fdctrl_handle_lock(FDCtrl *fdctrl, int direction)
 {
     fdctrl->lock = (fdctrl->fifo[0] & 0x80) ? 1 : 0;
     fdctrl->fifo[0] = fdctrl->lock << 4;
-    fdctrl_set_fifo(fdctrl, 1, 0);
+    fdctrl_set_fifo(fdctrl, 1);
 }
 
 static void fdctrl_handle_dumpreg(FDCtrl *fdctrl, int direction)
@@ -1561,20 +1560,20 @@ static void fdctrl_handle_dumpreg(FDCtrl *fdctrl, int direction)
         (cur_drv->perpendicular << 2);
     fdctrl->fifo[8] = fdctrl->config;
     fdctrl->fifo[9] = fdctrl->precomp_trk;
-    fdctrl_set_fifo(fdctrl, 10, 0);
+    fdctrl_set_fifo(fdctrl, 10);
 }
 
 static void fdctrl_handle_version(FDCtrl *fdctrl, int direction)
 {
     /* Controller's version */
     fdctrl->fifo[0] = fdctrl->version;
-    fdctrl_set_fifo(fdctrl, 1, 0);
+    fdctrl_set_fifo(fdctrl, 1);
 }
 
 static void fdctrl_handle_partid(FDCtrl *fdctrl, int direction)
 {
     fdctrl->fifo[0] = 0x41; /* Stepping 1 */
-    fdctrl_set_fifo(fdctrl, 1, 0);
+    fdctrl_set_fifo(fdctrl, 1);
 }
 
 static void fdctrl_handle_restore(FDCtrl *fdctrl, int direction)
@@ -1627,7 +1626,7 @@ static void fdctrl_handle_save(FDCtrl *fdctrl, int direction)
     fdctrl->fifo[12] = fdctrl->pwrd;
     fdctrl->fifo[13] = 0;
     fdctrl->fifo[14] = 0;
-    fdctrl_set_fifo(fdctrl, 15, 0);
+    fdctrl_set_fifo(fdctrl, 15);
 }
 
 static void fdctrl_handle_readid(FDCtrl *fdctrl, int direction)
@@ -1693,7 +1692,7 @@ static void fdctrl_handle_sense_drive_status(FDCtrl *fdctrl, int direction)
         (cur_drv->head << 2) |
         GET_CUR_DRV(fdctrl) |
         0x28;
-    fdctrl_set_fifo(fdctrl, 1, 0);
+    fdctrl_set_fifo(fdctrl, 1);
 }
 
 static void fdctrl_handle_recalibrate(FDCtrl *fdctrl, int direction)
@@ -1718,7 +1717,7 @@ static void fdctrl_handle_sense_interrupt_status(FDCtrl *fdctrl, int direction)
         fdctrl->reset_sensei--;
     } else if (!(fdctrl->sra & FD_SRA_INTPEND)) {
         fdctrl->fifo[0] = FD_SR0_INVCMD;
-        fdctrl_set_fifo(fdctrl, 1, 0);
+        fdctrl_set_fifo(fdctrl, 1);
         return;
     } else {
         fdctrl->fifo[0] =
@@ -1727,7 +1726,7 @@ static void fdctrl_handle_sense_interrupt_status(FDCtrl *fdctrl, int direction)
     }
 
     fdctrl->fifo[1] = cur_drv->track;
-    fdctrl_set_fifo(fdctrl, 2, 0);
+    fdctrl_set_fifo(fdctrl, 2);
     fdctrl_reset_irq(fdctrl);
     fdctrl->status0 = FD_SR0_RDYCHG;
 }
@@ -1769,7 +1768,7 @@ static void fdctrl_handle_powerdown_mode(FDCtrl *fdctrl, int direction)
 {
     fdctrl->pwrd = fdctrl->fifo[1];
     fdctrl->fifo[0] = fdctrl->fifo[1];
-    fdctrl_set_fifo(fdctrl, 1, 0);
+    fdctrl_set_fifo(fdctrl, 1);
 }
 
 static void fdctrl_handle_option(FDCtrl *fdctrl, int direction)
@@ -1788,7 +1787,7 @@ static void fdctrl_handle_drive_specification_command(FDCtrl *fdctrl, int direct
             fdctrl->fifo[0] = fdctrl->fifo[1];
             fdctrl->fifo[2] = 0;
             fdctrl->fifo[3] = 0;
-            fdctrl_set_fifo(fdctrl, 4, 0);
+            fdctrl_set_fifo(fdctrl, 4);
         } else {
             fdctrl_reset_fifo(fdctrl);
         }
@@ -1796,7 +1795,7 @@ static void fdctrl_handle_drive_specification_command(FDCtrl *fdctrl, int direct
         /* ERROR */
         fdctrl->fifo[0] = 0x80 |
             (cur_drv->head << 2) | GET_CUR_DRV(fdctrl);
-        fdctrl_set_fifo(fdctrl, 1, 0);
+        fdctrl_set_fifo(fdctrl, 1);
     }
 }
 
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 11/26] fdc-test: split test_media_change() test, so insert part can be reused
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (9 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 10/26] fdc: Remove status0 parameter from fdctrl_set_fifo() Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 12/26] fdc-test: insert media before fuzzing registers Kevin Wolf
                   ` (15 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Hervé Poussineau <hpoussin@reactos.org>

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/fdc-test.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/tests/fdc-test.c b/tests/fdc-test.c
index fa74411..a4303d1 100644
--- a/tests/fdc-test.c
+++ b/tests/fdc-test.c
@@ -217,7 +217,7 @@ static void test_read_without_media(void)
     g_assert(ret == 0);
 }
 
-static void test_media_change(void)
+static void test_media_insert(void)
 {
     uint8_t dir;
 
@@ -245,6 +245,13 @@ static void test_media_change(void)
     assert_bit_clear(dir, DSKCHG);
     dir = inb(FLOPPY_BASE + reg_dir);
     assert_bit_clear(dir, DSKCHG);
+}
+
+static void test_media_change(void)
+{
+    uint8_t dir;
+
+    test_media_insert();
 
     /* Eject the floppy and check that DSKCHG is set. Reading it out doesn't
      * reset the bit. */
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 12/26] fdc-test: insert media before fuzzing registers
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (10 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 11/26] fdc-test: split test_media_change() test, so insert part can be reused Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 13/26] fdc-test: add tests for non-DMA READ command Kevin Wolf
                   ` (14 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Hervé Poussineau <hpoussin@reactos.org>

A media will be required for future fdc tests.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/fdc-test.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tests/fdc-test.c b/tests/fdc-test.c
index a4303d1..67bfb22 100644
--- a/tests/fdc-test.c
+++ b/tests/fdc-test.c
@@ -376,6 +376,7 @@ int main(int argc, char **argv)
     qtest_add_func("/fdc/media_change", test_media_change);
     qtest_add_func("/fdc/sense_interrupt", test_sense_interrupt);
     qtest_add_func("/fdc/relative_seek", test_relative_seek);
+    qtest_add_func("/fdc/media_insert", test_media_insert);
     qtest_add_func("/fdc/fuzz-registers", fuzz_registers);
 
     ret = g_test_run();
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 13/26] fdc-test: add tests for non-DMA READ command
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (11 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 12/26] fdc-test: insert media before fuzzing registers Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 14/26] fdc: use status0 field instead of a local variable Kevin Wolf
                   ` (13 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Hervé Poussineau <hpoussin@reactos.org>

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/fdc-test.c |   98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 98 insertions(+), 0 deletions(-)

diff --git a/tests/fdc-test.c b/tests/fdc-test.c
index 67bfb22..4649e3f 100644
--- a/tests/fdc-test.c
+++ b/tests/fdc-test.c
@@ -55,6 +55,8 @@ enum {
 };
 
 enum {
+    BUSY    = 0x10,
+    NONDMA  = 0x20,
     RQM     = 0x80,
     DIO     = 0x40,
 
@@ -166,6 +168,69 @@ static uint8_t send_read_command(void)
     return ret;
 }
 
+static uint8_t send_read_no_dma_command(int nb_sect, uint8_t expected_st0)
+{
+    uint8_t drive = 0;
+    uint8_t head = 0;
+    uint8_t cyl = 0;
+    uint8_t sect_addr = 1;
+    uint8_t sect_size = 2;
+    uint8_t eot = nb_sect;
+    uint8_t gap = 0x1b;
+    uint8_t gpl = 0xff;
+
+    uint8_t msr = 0;
+    uint8_t st0;
+
+    uint8_t ret = 0;
+
+    floppy_send(CMD_READ);
+    floppy_send(head << 2 | drive);
+    g_assert(!get_irq(FLOPPY_IRQ));
+    floppy_send(cyl);
+    floppy_send(head);
+    floppy_send(sect_addr);
+    floppy_send(sect_size);
+    floppy_send(eot);
+    floppy_send(gap);
+    floppy_send(gpl);
+
+    uint16_t i = 0;
+    uint8_t n = 2;
+    for (; i < n; i++) {
+        msr = inb(FLOPPY_BASE + reg_msr);
+        if (msr == (BUSY | NONDMA | DIO | RQM)) {
+            break;
+        }
+        sleep(1);
+    }
+
+    if (i >= n) {
+        return 1;
+    }
+
+    /* Non-DMA mode */
+    for (i = 0; i < 512 * 2 * nb_sect; i++) {
+        msr = inb(FLOPPY_BASE + reg_msr);
+        assert_bit_set(msr, BUSY | RQM | DIO);
+        inb(FLOPPY_BASE + reg_fifo);
+    }
+
+    st0 = floppy_recv();
+    if (st0 != expected_st0) {
+        ret = 1;
+    }
+
+    floppy_recv();
+    floppy_recv();
+    floppy_recv();
+    floppy_recv();
+    floppy_recv();
+    floppy_recv();
+
+    return ret;
+}
+
 static void send_seek(int cyl)
 {
     int drive = 0;
@@ -327,6 +392,36 @@ static void test_relative_seek(void)
     g_assert(pcn == 0);
 }
 
+static void test_read_no_dma_1(void)
+{
+    uint8_t ret;
+
+    outb(FLOPPY_BASE + reg_dor, inb(FLOPPY_BASE + reg_dor) & ~0x08);
+    send_seek(0);
+    ret = send_read_no_dma_command(1, 0x24); /* FIXME: should be 0x04 */
+    g_assert(ret == 0);
+}
+
+static void test_read_no_dma_18(void)
+{
+    uint8_t ret;
+
+    outb(FLOPPY_BASE + reg_dor, inb(FLOPPY_BASE + reg_dor) & ~0x08);
+    send_seek(0);
+    ret = send_read_no_dma_command(18, 0x24); /* FIXME: should be 0x04 */
+    g_assert(ret == 0);
+}
+
+static void test_read_no_dma_19(void)
+{
+    uint8_t ret;
+
+    outb(FLOPPY_BASE + reg_dor, inb(FLOPPY_BASE + reg_dor) & ~0x08);
+    send_seek(0);
+    ret = send_read_no_dma_command(19, 0x20);
+    g_assert(ret == 0);
+}
+
 /* success if no crash or abort */
 static void fuzz_registers(void)
 {
@@ -377,6 +472,9 @@ int main(int argc, char **argv)
     qtest_add_func("/fdc/sense_interrupt", test_sense_interrupt);
     qtest_add_func("/fdc/relative_seek", test_relative_seek);
     qtest_add_func("/fdc/media_insert", test_media_insert);
+    qtest_add_func("/fdc/read_no_dma_1", test_read_no_dma_1);
+    qtest_add_func("/fdc/read_no_dma_18", test_read_no_dma_18);
+    qtest_add_func("/fdc/read_no_dma_19", test_read_no_dma_19);
     qtest_add_func("/fdc/fuzz-registers", fuzz_registers);
 
     ret = g_test_run();
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 14/26] fdc: use status0 field instead of a local variable
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (12 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 13/26] fdc-test: add tests for non-DMA READ command Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 15/26] fdc: fix FD_SR0_SEEK for non-DMA transfers and multi sectors transfers Kevin Wolf
                   ` (12 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Hervé Poussineau <hpoussin@reactos.org>

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/fdc.c |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/hw/fdc.c b/hw/fdc.c
index 3585220..7e4b0ce 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -327,7 +327,7 @@ static void fdctrl_reset(FDCtrl *fdctrl, int do_irq);
 static void fdctrl_reset_fifo(FDCtrl *fdctrl);
 static int fdctrl_transfer_handler (void *opaque, int nchan,
                                     int dma_pos, int dma_len);
-static void fdctrl_raise_irq(FDCtrl *fdctrl, uint8_t status0);
+static void fdctrl_raise_irq(FDCtrl *fdctrl);
 static FDrive *get_cur_drv(FDCtrl *fdctrl);
 
 static uint32_t fdctrl_read_statusA(FDCtrl *fdctrl);
@@ -799,6 +799,7 @@ static void fdctrl_handle_tc(void *opaque, int irq, int level)
 /* Change IRQ state */
 static void fdctrl_reset_irq(FDCtrl *fdctrl)
 {
+    fdctrl->status0 = 0;
     if (!(fdctrl->sra & FD_SRA_INTPEND))
         return;
     FLOPPY_DPRINTF("Reset interrupt\n");
@@ -806,14 +807,13 @@ static void fdctrl_reset_irq(FDCtrl *fdctrl)
     fdctrl->sra &= ~FD_SRA_INTPEND;
 }
 
-static void fdctrl_raise_irq(FDCtrl *fdctrl, uint8_t status0)
+static void fdctrl_raise_irq(FDCtrl *fdctrl)
 {
     /* Sparc mutation */
     if (fdctrl->sun4m && (fdctrl->msr & FD_MSR_CMDBUSY)) {
         /* XXX: not sure */
         fdctrl->msr &= ~FD_MSR_CMDBUSY;
         fdctrl->msr |= FD_MSR_RQM | FD_MSR_DIO;
-        fdctrl->status0 = status0;
         return;
     }
     if (!(fdctrl->sra & FD_SRA_INTPEND)) {
@@ -822,7 +822,6 @@ static void fdctrl_raise_irq(FDCtrl *fdctrl, uint8_t status0)
     }
 
     fdctrl->reset_sensei = 0;
-    fdctrl->status0 = status0;
     FLOPPY_DPRINTF("Set interrupt status to 0x%02x\n", fdctrl->status0);
 }
 
@@ -851,7 +850,8 @@ static void fdctrl_reset(FDCtrl *fdctrl, int do_irq)
         fd_recalibrate(&fdctrl->drives[i]);
     fdctrl_reset_fifo(fdctrl);
     if (do_irq) {
-        fdctrl_raise_irq(fdctrl, FD_SR0_RDYCHG);
+        fdctrl->status0 |= FD_SR0_RDYCHG;
+        fdctrl_raise_irq(fdctrl);
         fdctrl->reset_sensei = FD_RESET_SENSEI_COUNT;
     }
 }
@@ -1169,7 +1169,7 @@ static void fdctrl_stop_transfer(FDCtrl *fdctrl, uint8_t status0,
     fdctrl->msr &= ~FD_MSR_NONDMA;
 
     fdctrl_set_fifo(fdctrl, 7);
-    fdctrl_raise_irq(fdctrl, fdctrl->status0);
+    fdctrl_raise_irq(fdctrl);
 }
 
 /* Prepare a data transfer (either DMA or FIFO) */
@@ -1284,7 +1284,8 @@ static void fdctrl_start_transfer(FDCtrl *fdctrl, int direction)
     if (direction != FD_DIR_WRITE)
         fdctrl->msr |= FD_MSR_DIO;
     /* IO based transfer: calculate len */
-    fdctrl_raise_irq(fdctrl, FD_SR0_SEEK);
+    fdctrl->status0 |= FD_SR0_SEEK;
+    fdctrl_raise_irq(fdctrl);
 }
 
 /* Prepare a transfer of deleted data */
@@ -1704,7 +1705,8 @@ static void fdctrl_handle_recalibrate(FDCtrl *fdctrl, int direction)
     fd_recalibrate(cur_drv);
     fdctrl_reset_fifo(fdctrl);
     /* Raise Interrupt */
-    fdctrl_raise_irq(fdctrl, FD_SR0_SEEK);
+    fdctrl->status0 |= FD_SR0_SEEK;
+    fdctrl_raise_irq(fdctrl);
 }
 
 static void fdctrl_handle_sense_interrupt_status(FDCtrl *fdctrl, int direction)
@@ -1743,7 +1745,8 @@ static void fdctrl_handle_seek(FDCtrl *fdctrl, int direction)
      */
     fd_seek(cur_drv, cur_drv->head, fdctrl->fifo[2], cur_drv->sect, 1);
     /* Raise Interrupt */
-    fdctrl_raise_irq(fdctrl, FD_SR0_SEEK);
+    fdctrl->status0 |= FD_SR0_SEEK;
+    fdctrl_raise_irq(fdctrl);
 }
 
 static void fdctrl_handle_perpendicular_mode(FDCtrl *fdctrl, int direction)
@@ -1814,7 +1817,8 @@ static void fdctrl_handle_relative_seek_in(FDCtrl *fdctrl, int direction)
     }
     fdctrl_reset_fifo(fdctrl);
     /* Raise Interrupt */
-    fdctrl_raise_irq(fdctrl, FD_SR0_SEEK);
+    fdctrl->status0 |= FD_SR0_SEEK;
+    fdctrl_raise_irq(fdctrl);
 }
 
 static void fdctrl_handle_relative_seek_out(FDCtrl *fdctrl, int direction)
@@ -1831,7 +1835,8 @@ static void fdctrl_handle_relative_seek_out(FDCtrl *fdctrl, int direction)
     }
     fdctrl_reset_fifo(fdctrl);
     /* Raise Interrupt */
-    fdctrl_raise_irq(fdctrl, FD_SR0_SEEK);
+    fdctrl->status0 |= FD_SR0_SEEK;
+    fdctrl_raise_irq(fdctrl);
 }
 
 static const struct {
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 15/26] fdc: fix FD_SR0_SEEK for non-DMA transfers and multi sectors transfers
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (13 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 14/26] fdc: use status0 field instead of a local variable Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 16/26] fdc: fix FD_SR0_SEEK for initial seek on DMA transfers Kevin Wolf
                   ` (11 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Hervé Poussineau <hpoussin@reactos.org>

On non-DMA transfers, fdctrl_stop_transfer() used to set FD_SR0_SEEK
no matter if there actually was a seek or not. This is obviously wrong.

fdctrl_seek_to_next_sect() has this information because it performs
the seek itself.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/fdc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/fdc.c b/hw/fdc.c
index 7e4b0ce..e47050f 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -1123,11 +1123,13 @@ static int fdctrl_seek_to_next_sect(FDCtrl *fdctrl, FDrive *cur_drv)
             } else {
                 new_head = 0;
                 new_track++;
+                fdctrl->status0 |= FD_SR0_SEEK;
                 if ((cur_drv->flags & FDISK_DBL_SIDES) == 0) {
                     ret = 0;
                 }
             }
         } else {
+            fdctrl->status0 |= FD_SR0_SEEK;
             new_track++;
             ret = 0;
         }
@@ -1458,7 +1460,7 @@ static uint32_t fdctrl_read_data(FDCtrl *fdctrl)
          * then from status mode to command mode
          */
         if (fdctrl->msr & FD_MSR_NONDMA) {
-            fdctrl_stop_transfer(fdctrl, FD_SR0_SEEK, 0x00, 0x00);
+            fdctrl_stop_transfer(fdctrl, 0x00, 0x00, 0x00);
         } else {
             fdctrl_reset_fifo(fdctrl);
             fdctrl_reset_irq(fdctrl);
@@ -1922,7 +1924,7 @@ static void fdctrl_write_data(FDCtrl *fdctrl, uint32_t value)
          * then from status mode to command mode
          */
         if (fdctrl->data_pos == fdctrl->data_len)
-            fdctrl_stop_transfer(fdctrl, FD_SR0_SEEK, 0x00, 0x00);
+            fdctrl_stop_transfer(fdctrl, 0x00, 0x00, 0x00);
         return;
     }
     if (fdctrl->data_pos == 0) {
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 16/26] fdc: fix FD_SR0_SEEK for initial seek on DMA transfers
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (14 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 15/26] fdc: fix FD_SR0_SEEK for non-DMA transfers and multi sectors transfers Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 17/26] fdc: fix false FD_SR0_SEEK Kevin Wolf
                   ` (10 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Hervé Poussineau <hpoussin@reactos.org>

fdctrl_start_transfer() used to set FD_SR0_SEEK no matter if
there actually was a seek or not. This is obviously wrong.

fdctrl_start_transfer() has this information because it performs
the initial seek itself.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/fdc.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/hw/fdc.c b/hw/fdc.c
index e47050f..a9a2a2a 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -1179,7 +1179,6 @@ static void fdctrl_start_transfer(FDCtrl *fdctrl, int direction)
 {
     FDrive *cur_drv;
     uint8_t kh, kt, ks;
-    int did_seek = 0;
 
     SET_CUR_DRV(fdctrl, fdctrl->fifo[1] & FD_DOR_SELMASK);
     cur_drv = get_cur_drv(fdctrl);
@@ -1213,7 +1212,7 @@ static void fdctrl_start_transfer(FDCtrl *fdctrl, int direction)
         fdctrl->fifo[5] = ks;
         return;
     case 1:
-        did_seek = 1;
+        fdctrl->status0 |= FD_SR0_SEEK;
         break;
     default:
         break;
@@ -1240,10 +1239,6 @@ static void fdctrl_start_transfer(FDCtrl *fdctrl, int direction)
         fdctrl->data_state |= FD_STATE_MULTI;
     else
         fdctrl->data_state &= ~FD_STATE_MULTI;
-    if (did_seek)
-        fdctrl->data_state |= FD_STATE_SEEK;
-    else
-        fdctrl->data_state &= ~FD_STATE_SEEK;
     if (fdctrl->fifo[5] == 00) {
         fdctrl->data_len = fdctrl->fifo[8];
     } else {
@@ -1286,7 +1281,6 @@ static void fdctrl_start_transfer(FDCtrl *fdctrl, int direction)
     if (direction != FD_DIR_WRITE)
         fdctrl->msr |= FD_MSR_DIO;
     /* IO based transfer: calculate len */
-    fdctrl->status0 |= FD_SR0_SEEK;
     fdctrl_raise_irq(fdctrl);
 }
 
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 17/26] fdc: fix false FD_SR0_SEEK
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (15 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 16/26] fdc: fix FD_SR0_SEEK for initial seek on DMA transfers Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 18/26] fdc-test: Check READ ID Kevin Wolf
                   ` (9 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Hervé Poussineau <hpoussin@reactos.org>

Do not always set FD_SR0_SEEK, as callers already set it if needed.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/fdc.c         |   10 +++++++---
 tests/fdc-test.c |    6 +++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/hw/fdc.c b/hw/fdc.c
index a9a2a2a..525ba20 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -1149,10 +1149,14 @@ static void fdctrl_stop_transfer(FDCtrl *fdctrl, uint8_t status0,
                                  uint8_t status1, uint8_t status2)
 {
     FDrive *cur_drv;
-
     cur_drv = get_cur_drv(fdctrl);
-    fdctrl->status0 = status0 | FD_SR0_SEEK | (cur_drv->head << 2) |
-                      GET_CUR_DRV(fdctrl);
+
+    fdctrl->status0 &= ~(FD_SR0_DS0 | FD_SR0_DS1 | FD_SR0_HEAD);
+    fdctrl->status0 |= GET_CUR_DRV(fdctrl);
+    if (cur_drv->head) {
+        fdctrl->status0 |= FD_SR0_HEAD;
+    }
+    fdctrl->status0 |= status0;
 
     FLOPPY_DPRINTF("transfer status: %02x %02x %02x (%02x)\n",
                    status0, status1, status2, fdctrl->status0);
diff --git a/tests/fdc-test.c b/tests/fdc-test.c
index 4649e3f..1156112 100644
--- a/tests/fdc-test.c
+++ b/tests/fdc-test.c
@@ -154,7 +154,7 @@ static uint8_t send_read_command(void)
     }
 
     st0 = floppy_recv();
-    if (st0 != 0x60) {
+    if (st0 != 0x40) {
         ret = 1;
     }
 
@@ -398,7 +398,7 @@ static void test_read_no_dma_1(void)
 
     outb(FLOPPY_BASE + reg_dor, inb(FLOPPY_BASE + reg_dor) & ~0x08);
     send_seek(0);
-    ret = send_read_no_dma_command(1, 0x24); /* FIXME: should be 0x04 */
+    ret = send_read_no_dma_command(1, 0x04);
     g_assert(ret == 0);
 }
 
@@ -408,7 +408,7 @@ static void test_read_no_dma_18(void)
 
     outb(FLOPPY_BASE + reg_dor, inb(FLOPPY_BASE + reg_dor) & ~0x08);
     send_seek(0);
-    ret = send_read_no_dma_command(18, 0x24); /* FIXME: should be 0x04 */
+    ret = send_read_no_dma_command(18, 0x04);
     g_assert(ret == 0);
 }
 
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 18/26] fdc-test: Check READ ID
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (16 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 17/26] fdc: fix false FD_SR0_SEEK Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 19/26] fdc: implement VERIFY command Kevin Wolf
                   ` (8 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

ST0 shouldn't include 0x20 (FD_SR0_SEEK) after READ ID.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Tested-by: Hervé Poussineau <hpoussin@reactos.org>
---
 tests/fdc-test.c |   66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/tests/fdc-test.c b/tests/fdc-test.c
index 1156112..e8ce686 100644
--- a/tests/fdc-test.c
+++ b/tests/fdc-test.c
@@ -48,6 +48,7 @@ enum {
 
 enum {
     CMD_SENSE_INT           = 0x08,
+    CMD_READ_ID             = 0x0a,
     CMD_SEEK                = 0x0f,
     CMD_READ                = 0xe6,
     CMD_RELATIVE_SEEK_OUT   = 0x8f,
@@ -392,6 +393,70 @@ static void test_relative_seek(void)
     g_assert(pcn == 0);
 }
 
+static void test_read_id(void)
+{
+    uint8_t drive = 0;
+    uint8_t head = 0;
+    uint8_t cyl;
+    uint8_t st0;
+
+    /* Seek to track 0 and check with READ ID */
+    send_seek(0);
+
+    floppy_send(CMD_READ_ID);
+    g_assert(!get_irq(FLOPPY_IRQ));
+    floppy_send(head << 2 | drive);
+
+    while (!get_irq(FLOPPY_IRQ)) {
+        /* qemu involves a timer with READ ID... */
+        clock_step(1000000000LL / 50);
+    }
+
+    st0 = floppy_recv();
+    floppy_recv();
+    floppy_recv();
+    cyl = floppy_recv();
+    head = floppy_recv();
+    floppy_recv();
+    floppy_recv();
+
+    g_assert_cmpint(cyl, ==, 0);
+    g_assert_cmpint(head, ==, 0);
+    g_assert_cmpint(st0, ==, head << 2);
+
+    /* Seek to track 8 on head 1 and check with READ ID */
+    head = 1;
+    cyl = 8;
+
+    floppy_send(CMD_SEEK);
+    floppy_send(head << 2 | drive);
+    g_assert(!get_irq(FLOPPY_IRQ));
+    floppy_send(cyl);
+    g_assert(get_irq(FLOPPY_IRQ));
+    ack_irq(NULL);
+
+    floppy_send(CMD_READ_ID);
+    g_assert(!get_irq(FLOPPY_IRQ));
+    floppy_send(head << 2 | drive);
+
+    while (!get_irq(FLOPPY_IRQ)) {
+        /* qemu involves a timer with READ ID... */
+        clock_step(1000000000LL / 50);
+    }
+
+    st0 = floppy_recv();
+    floppy_recv();
+    floppy_recv();
+    cyl = floppy_recv();
+    head = floppy_recv();
+    floppy_recv();
+    floppy_recv();
+
+    g_assert_cmpint(cyl, ==, 8);
+    g_assert_cmpint(head, ==, 1);
+    g_assert_cmpint(st0, ==, head << 2);
+}
+
 static void test_read_no_dma_1(void)
 {
     uint8_t ret;
@@ -471,6 +536,7 @@ int main(int argc, char **argv)
     qtest_add_func("/fdc/media_change", test_media_change);
     qtest_add_func("/fdc/sense_interrupt", test_sense_interrupt);
     qtest_add_func("/fdc/relative_seek", test_relative_seek);
+    qtest_add_func("/fdc/read_id", test_read_id);
     qtest_add_func("/fdc/media_insert", test_media_insert);
     qtest_add_func("/fdc/read_no_dma_1", test_read_no_dma_1);
     qtest_add_func("/fdc/read_no_dma_18", test_read_no_dma_18);
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 19/26] fdc: implement VERIFY command
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (17 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 18/26] fdc-test: Check READ ID Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 20/26] fdc-tests: add tests for " Kevin Wolf
                   ` (7 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Hervé Poussineau <hpoussin@reactos.org>

VERIFY command is like a READ command, except that read data is not
transfered by DMA.
As DMA engine is not used, so we have to start data transfer ourselves.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/fdc.c |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/hw/fdc.c b/hw/fdc.c
index 525ba20..3a82ed1 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -349,6 +349,7 @@ enum {
     FD_DIR_SCANE   = 2,
     FD_DIR_SCANL   = 3,
     FD_DIR_SCANH   = 4,
+    FD_DIR_VERIFY  = 5,
 };
 
 enum {
@@ -1266,14 +1267,21 @@ static void fdctrl_start_transfer(FDCtrl *fdctrl, int direction)
         if (((direction == FD_DIR_SCANE || direction == FD_DIR_SCANL ||
               direction == FD_DIR_SCANH) && dma_mode == 0) ||
             (direction == FD_DIR_WRITE && dma_mode == 2) ||
-            (direction == FD_DIR_READ && dma_mode == 1)) {
+            (direction == FD_DIR_READ && dma_mode == 1) ||
+            (direction == FD_DIR_VERIFY)) {
             /* No access is allowed until DMA transfer has completed */
             fdctrl->msr &= ~FD_MSR_RQM;
-            /* Now, we just have to wait for the DMA controller to
-             * recall us...
-             */
-            DMA_hold_DREQ(fdctrl->dma_chann);
-            DMA_schedule(fdctrl->dma_chann);
+            if (direction != FD_DIR_VERIFY) {
+                /* Now, we just have to wait for the DMA controller to
+                 * recall us...
+                 */
+                DMA_hold_DREQ(fdctrl->dma_chann);
+                DMA_schedule(fdctrl->dma_chann);
+            } else {
+                /* Start transfer */
+                fdctrl_transfer_handler(fdctrl, fdctrl->dma_chann, 0,
+                                        fdctrl->data_len);
+            }
             return;
         } else {
             FLOPPY_DPRINTF("bad dma_mode=%d direction=%d\n", dma_mode,
@@ -1376,6 +1384,9 @@ static int fdctrl_transfer_handler (void *opaque, int nchan,
                 goto transfer_error;
             }
             break;
+        case FD_DIR_VERIFY:
+            /* VERIFY commands */
+            break;
         default:
             /* SCAN commands */
             {
@@ -1858,7 +1869,7 @@ static const struct {
     { FD_CMD_SAVE, 0xff, "SAVE", 0, fdctrl_handle_save }, /* part of READ DELETED DATA */
     { FD_CMD_READ_DELETED, 0x1f, "READ DELETED DATA", 8, fdctrl_start_transfer_del, FD_DIR_READ },
     { FD_CMD_SCAN_EQUAL, 0x1f, "SCAN EQUAL", 8, fdctrl_start_transfer, FD_DIR_SCANE },
-    { FD_CMD_VERIFY, 0x1f, "VERIFY", 8, fdctrl_unimplemented },
+    { FD_CMD_VERIFY, 0x1f, "VERIFY", 8, fdctrl_start_transfer, FD_DIR_VERIFY },
     { FD_CMD_SCAN_LOW_OR_EQUAL, 0x1f, "SCAN LOW OR EQUAL", 8, fdctrl_start_transfer, FD_DIR_SCANL },
     { FD_CMD_SCAN_HIGH_OR_EQUAL, 0x1f, "SCAN HIGH OR EQUAL", 8, fdctrl_start_transfer, FD_DIR_SCANH },
     { FD_CMD_WRITE_DELETED, 0x3f, "WRITE DELETED DATA", 8, fdctrl_start_transfer_del, FD_DIR_WRITE },
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 20/26] fdc-tests: add tests for VERIFY command
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (18 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 19/26] fdc: implement VERIFY command Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 21/26] fdc: remove double affectation of FD_MSR_CMDBUSY flag Kevin Wolf
                   ` (6 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Hervé Poussineau <hpoussin@reactos.org>

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/fdc-test.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/tests/fdc-test.c b/tests/fdc-test.c
index e8ce686..4b0301d 100644
--- a/tests/fdc-test.c
+++ b/tests/fdc-test.c
@@ -50,6 +50,7 @@ enum {
     CMD_SENSE_INT           = 0x08,
     CMD_READ_ID             = 0x0a,
     CMD_SEEK                = 0x0f,
+    CMD_VERIFY              = 0x16,
     CMD_READ                = 0xe6,
     CMD_RELATIVE_SEEK_OUT   = 0x8f,
     CMD_RELATIVE_SEEK_IN    = 0xcf,
@@ -113,7 +114,7 @@ static void ack_irq(uint8_t *pcn)
     g_assert(!get_irq(FLOPPY_IRQ));
 }
 
-static uint8_t send_read_command(void)
+static uint8_t send_read_command(uint8_t cmd)
 {
     uint8_t drive = 0;
     uint8_t head = 0;
@@ -129,7 +130,7 @@ static uint8_t send_read_command(void)
 
     uint8_t ret = 0;
 
-    floppy_send(CMD_READ);
+    floppy_send(cmd);
     floppy_send(head << 2 | drive);
     g_assert(!get_irq(FLOPPY_IRQ));
     floppy_send(cyl);
@@ -279,7 +280,7 @@ static void test_read_without_media(void)
 {
     uint8_t ret;
 
-    ret = send_read_command();
+    ret = send_read_command(CMD_READ);
     g_assert(ret == 0);
 }
 
@@ -487,6 +488,14 @@ static void test_read_no_dma_19(void)
     g_assert(ret == 0);
 }
 
+static void test_verify(void)
+{
+    uint8_t ret;
+
+    ret = send_read_command(CMD_VERIFY);
+    g_assert(ret == 0);
+}
+
 /* success if no crash or abort */
 static void fuzz_registers(void)
 {
@@ -537,6 +546,7 @@ int main(int argc, char **argv)
     qtest_add_func("/fdc/sense_interrupt", test_sense_interrupt);
     qtest_add_func("/fdc/relative_seek", test_relative_seek);
     qtest_add_func("/fdc/read_id", test_read_id);
+    qtest_add_func("/fdc/verify", test_verify);
     qtest_add_func("/fdc/media_insert", test_media_insert);
     qtest_add_func("/fdc/read_no_dma_1", test_read_no_dma_1);
     qtest_add_func("/fdc/read_no_dma_18", test_read_no_dma_18);
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 21/26] fdc: remove double affectation of FD_MSR_CMDBUSY flag
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (19 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 20/26] fdc-tests: add tests for " Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 22/26] fdc: fix typo in zero constant Kevin Wolf
                   ` (5 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Hervé Poussineau <hpoussin@reactos.org>

FD_MSR_CMDBUSY flag is already set in fdctrl_write_data(), just
before calling the command handler (fdctrl_start_transfer() here).

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/fdc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/fdc.c b/hw/fdc.c
index 3a82ed1..a197c48 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -1239,7 +1239,7 @@ static void fdctrl_start_transfer(FDCtrl *fdctrl, int direction)
     /* Set the FIFO state */
     fdctrl->data_dir = direction;
     fdctrl->data_pos = 0;
-    fdctrl->msr |= FD_MSR_CMDBUSY;
+    assert(fdctrl->msr & FD_MSR_CMDBUSY);
     if (fdctrl->fifo[0] & 0x80)
         fdctrl->data_state |= FD_STATE_MULTI;
     else
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 22/26] fdc: fix typo in zero constant
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (20 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 21/26] fdc: remove double affectation of FD_MSR_CMDBUSY flag Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 23/26] fdc: remove last usage of FD_STATE_SEEK Kevin Wolf
                   ` (4 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Hervé Poussineau <hpoussin@reactos.org>

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/fdc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/fdc.c b/hw/fdc.c
index a197c48..de8778b 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -1244,7 +1244,7 @@ static void fdctrl_start_transfer(FDCtrl *fdctrl, int direction)
         fdctrl->data_state |= FD_STATE_MULTI;
     else
         fdctrl->data_state &= ~FD_STATE_MULTI;
-    if (fdctrl->fifo[5] == 00) {
+    if (fdctrl->fifo[5] == 0) {
         fdctrl->data_len = fdctrl->fifo[8];
     } else {
         int tmp;
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 23/26] fdc: remove last usage of FD_STATE_SEEK
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (21 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 22/26] fdc: fix typo in zero constant Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 24/26] vmdk: Fix data corruption bug in WRITE and READ handling Kevin Wolf
                   ` (3 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Hervé Poussineau <hpoussin@reactos.org>

Replace it by directly setting FD_SR0_SEEK if required

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/fdc.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/hw/fdc.c b/hw/fdc.c
index de8778b..29b5449 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -355,7 +355,6 @@ enum {
 enum {
     FD_STATE_MULTI  = 0x01,	/* multi track flag */
     FD_STATE_FORMAT = 0x02,	/* format flag */
-    FD_STATE_SEEK   = 0x04,	/* seek flag */
 };
 
 enum {
@@ -497,7 +496,6 @@ enum {
 };
 
 #define FD_MULTI_TRACK(state) ((state) & FD_STATE_MULTI)
-#define FD_DID_SEEK(state) ((state) & FD_STATE_SEEK)
 #define FD_FORMAT_CMD(state) ((state) & FD_STATE_FORMAT)
 
 struct FDCtrl {
@@ -1422,8 +1420,6 @@ static int fdctrl_transfer_handler (void *opaque, int nchan,
         fdctrl->data_dir == FD_DIR_SCANL ||
         fdctrl->data_dir == FD_DIR_SCANH)
         status2 = FD_SR2_SEH;
-    if (FD_DID_SEEK(fdctrl->data_state))
-        status0 |= FD_SR0_SEEK;
     fdctrl->data_len -= len;
     fdctrl_stop_transfer(fdctrl, status0, status1, status2);
  transfer_error:
@@ -1517,7 +1513,7 @@ static void fdctrl_format_sector(FDCtrl *fdctrl)
         fdctrl->fifo[5] = ks;
         return;
     case 1:
-        fdctrl->data_state |= FD_STATE_SEEK;
+        fdctrl->status0 |= FD_SR0_SEEK;
         break;
     default:
         break;
@@ -1531,10 +1527,7 @@ static void fdctrl_format_sector(FDCtrl *fdctrl)
         if (cur_drv->sect == cur_drv->last_sect) {
             fdctrl->data_state &= ~FD_STATE_FORMAT;
             /* Last sector done */
-            if (FD_DID_SEEK(fdctrl->data_state))
-                fdctrl_stop_transfer(fdctrl, FD_SR0_SEEK, 0x00, 0x00);
-            else
-                fdctrl_stop_transfer(fdctrl, 0x00, 0x00, 0x00);
+            fdctrl_stop_transfer(fdctrl, 0x00, 0x00, 0x00);
         } else {
             /* More to do */
             fdctrl->data_pos = 0;
@@ -1661,7 +1654,6 @@ static void fdctrl_handle_format_track(FDCtrl *fdctrl, int direction)
         fdctrl->data_state |= FD_STATE_MULTI;
     else
         fdctrl->data_state &= ~FD_STATE_MULTI;
-    fdctrl->data_state &= ~FD_STATE_SEEK;
     cur_drv->bps =
         fdctrl->fifo[2] > 7 ? 16384 : 128 << fdctrl->fifo[2];
 #if 0
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 24/26] vmdk: Fix data corruption bug in WRITE and READ handling
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (22 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 23/26] fdc: remove last usage of FD_STATE_SEEK Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 25/26] megasas: Use bdrv_drain_all instead of qemu_aio_flush Kevin Wolf
                   ` (2 subsequent siblings)
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Gerhard Wiesinger <lists@wiesinger.com>

Fixed a MAJOR BUG in VMDK files on file boundaries on reads
and ALSO ON WRITES WHICH MIGHT CORRUPT THE IMAGE AND DATA!!!!!!

Triggered for example with the following VMDK file (partly listed):
RW 4193792 FLAT "XP-W1-f001.vmdk" 0
RW 2097664 FLAT "XP-W1-f002.vmdk" 0
RW 4193792 FLAT "XP-W1-f003.vmdk" 0
RW 512 FLAT "XP-W1-f004.vmdk" 0
RW 4193792 FLAT "XP-W1-f005.vmdk" 0
RW 2097664 FLAT "XP-W1-f006.vmdk" 0
RW 4193792 FLAT "XP-W1-f007.vmdk" 0
RW 512 FLAT "XP-W1-f008.vmdk" 0

Patch includes:
1.) Patch fixes wrong calculation on extent boundaries. Especially it
fixes the relativeness of the sector number to the current extent.

Verfied correctness with:
1.) Converted either with Virtualbox to VDI and then with qemu-img and
    then with qemu-img only:

    VBoxManage clonehd --format vdi /VM/XP-W/new/XP-W1.vmdk ~/.VirtualBox/Harddisks/XP-W1-new-test.vdi
    ./qemu-img convert -O raw ~/.VirtualBox/Harddisks/XP-W1-new-test.vdi /root/QEMU/VM-XP-W1/XP-W1-via-VBOX.img
    md5sum /root/QEMU/VM-XP-W/XP-W1-direct.img
    md5sum /root/QEMU/VM-XP-W/XP-W1-via-VBOX.img
    => same MD5 hash

2.) Verified debug log files
3.) Run Windows XP successfully
4.) chkdsk run successfully without any errors

Signed-off-by: Gerhard Wiesinger <lists@wiesinger.com>
Acked-by: Fam Zheng <famcool@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/vmdk.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/block/vmdk.c b/block/vmdk.c
index 1a80e5a..51398c0 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1092,6 +1092,7 @@ static int vmdk_read(BlockDriverState *bs, int64_t sector_num,
     BDRVVmdkState *s = bs->opaque;
     int ret;
     uint64_t n, index_in_cluster;
+    uint64_t extent_begin_sector, extent_relative_sector_num;
     VmdkExtent *extent = NULL;
     uint64_t cluster_offset;
 
@@ -1103,7 +1104,9 @@ static int vmdk_read(BlockDriverState *bs, int64_t sector_num,
         ret = get_cluster_offset(
                             bs, extent, NULL,
                             sector_num << 9, 0, &cluster_offset);
-        index_in_cluster = sector_num % extent->cluster_sectors;
+        extent_begin_sector = extent->end_sector - extent->sectors;
+        extent_relative_sector_num = sector_num - extent_begin_sector;
+        index_in_cluster = extent_relative_sector_num % extent->cluster_sectors;
         n = extent->cluster_sectors - index_in_cluster;
         if (n > nb_sectors) {
             n = nb_sectors;
@@ -1154,6 +1157,7 @@ static int vmdk_write(BlockDriverState *bs, int64_t sector_num,
     VmdkExtent *extent = NULL;
     int n, ret;
     int64_t index_in_cluster;
+    uint64_t extent_begin_sector, extent_relative_sector_num;
     uint64_t cluster_offset;
     VmdkMetaData m_data;
 
@@ -1196,7 +1200,9 @@ static int vmdk_write(BlockDriverState *bs, int64_t sector_num,
         if (ret) {
             return -EINVAL;
         }
-        index_in_cluster = sector_num % extent->cluster_sectors;
+        extent_begin_sector = extent->end_sector - extent->sectors;
+        extent_relative_sector_num = sector_num - extent_begin_sector;
+        index_in_cluster = extent_relative_sector_num % extent->cluster_sectors;
         n = extent->cluster_sectors - index_in_cluster;
         if (n > nb_sectors) {
             n = nb_sectors;
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 25/26] megasas: Use bdrv_drain_all instead of qemu_aio_flush
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (23 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 24/26] vmdk: Fix data corruption bug in WRITE and READ handling Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 26/26] qemu-io: " Kevin Wolf
  2012-11-19  9:12 ` [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

Calling qemu_aio_flush() directly can hang when combined with I/O
throttling.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/megasas.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/megasas.c b/hw/megasas.c
index 291ff40..61b6527 100644
--- a/hw/megasas.c
+++ b/hw/megasas.c
@@ -1296,7 +1296,7 @@ static int megasas_dcmd_get_properties(MegasasState *s, MegasasCmd *cmd)
 
 static int megasas_cache_flush(MegasasState *s, MegasasCmd *cmd)
 {
-    qemu_aio_flush();
+    bdrv_drain_all();
     return MFI_STAT_OK;
 }
 
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PATCH 26/26] qemu-io: Use bdrv_drain_all instead of qemu_aio_flush
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (24 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 25/26] megasas: Use bdrv_drain_all instead of qemu_aio_flush Kevin Wolf
@ 2012-11-14 18:47 ` Kevin Wolf
  2012-11-19  9:12 ` [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-14 18:47 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

This is harmless as of today because I/O throttling is not used in
qemu-io, however as soon as .bdrv_drain handlers will be introduced,
qemu-io must be sure to call bdrv_drain_all().

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 qemu-io.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/qemu-io.c b/qemu-io.c
index 1ad7d3a..92cdb2a 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -1362,7 +1362,7 @@ static int aio_write_f(int argc, char **argv)
 
 static int aio_flush_f(int argc, char **argv)
 {
-    qemu_aio_flush();
+    bdrv_drain_all();
     return 0;
 }
 
-- 
1.7.6.5

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* Re: [Qemu-devel] [PULL 00/26] Block patches
  2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
                   ` (25 preceding siblings ...)
  2012-11-14 18:47 ` [Qemu-devel] [PATCH 26/26] qemu-io: " Kevin Wolf
@ 2012-11-19  9:12 ` Kevin Wolf
  26 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2012-11-19  9:12 UTC (permalink / raw)
  To: anthony; +Cc: Kevin Wolf, qemu-devel

Am 14.11.2012 19:47, schrieb Kevin Wolf:
> The following changes since commit ce34cf72fe508b27a78f83c184142e8d1e6a048a:
> 
>   Merge remote-tracking branch 'awilliam/tags/vfio-pci-for-qemu-1.3.0-rc0' into staging (2012-11-14 08:53:40 -0600)
> 
> are available in the git repository at:
> 
>   git://repo.or.cz/qemu/kevin.git for-anthony
> 
> Bharata B Rao (1):
>       qemu: Document GlusterFS block driver usage
> 
> Gerhard Wiesinger (1):
>       vmdk: Fix data corruption bug in WRITE and READ handling
> 
> Hervé Poussineau (12):
>       fdc-test: split test_media_change() test, so insert part can be reused
>       fdc-test: insert media before fuzzing registers
>       fdc-test: add tests for non-DMA READ command
>       fdc: use status0 field instead of a local variable
>       fdc: fix FD_SR0_SEEK for non-DMA transfers and multi sectors transfers
>       fdc: fix FD_SR0_SEEK for initial seek on DMA transfers
>       fdc: fix false FD_SR0_SEEK
>       fdc: implement VERIFY command
>       fdc-tests: add tests for VERIFY command
>       fdc: remove double affectation of FD_MSR_CMDBUSY flag
>       fdc: fix typo in zero constant
>       fdc: remove last usage of FD_STATE_SEEK
> 
> Kevin Wolf (6):
>       qcow2: Fix refcount table size calculation
>       qemu-iotests: qcow2: Test growing large refcount table
>       fdc: Remove status0 parameter from fdctrl_set_fifo()
>       fdc-test: Check READ ID
>       megasas: Use bdrv_drain_all instead of qemu_aio_flush
>       qemu-io: Use bdrv_drain_all instead of qemu_aio_flush
> 
> Nick Thomas (1):
>       tests: allow qemu-iotests to be run against nbd backend
> 
> Stefan Hajnoczi (4):
>       MAINTAINERS: add Stefan Hajnoczi as block and virtio-blk co-maintainer
>       aio: switch aiocb_size type int -> size_t
>       aio: use g_slice_alloc() for AIOCB pooling
>       aio: rename AIOPool to AIOCBInfo
> 
> Stefan Weil (1):
>       block: Workaround for older versions of MinGW gcc
> 
>  MAINTAINERS                      |    2 +
>  block.c                          |   31 +++----
>  block/blkdebug.c                 |    4 +-
>  block/blkverify.c                |    4 +-
>  block/curl.c                     |    4 +-
>  block/gluster.c                  |    6 +-
>  block/iscsi.c                    |   12 +-
>  block/linux-aio.c                |    4 +-
>  block/qcow2-refcount.c           |    3 +-
>  block/qed.c                      |    4 +-
>  block/rbd.c                      |    4 +-
>  block/sheepdog.c                 |    4 +-
>  block/vmdk.c                     |   10 ++-
>  block/win32-aio.c                |   14 ++--
>  dma-helpers.c                    |    4 +-
>  hw/fdc.c                         |  121 +++++++++++++-----------
>  hw/ide/core.c                    |    4 +-
>  hw/megasas.c                     |    2 +-
>  qemu-aio.h                       |   12 +--
>  qemu-doc.texi                    |   49 ++++++++++
>  qemu-io.c                        |    2 +-
>  qemu-options.hx                  |   17 ++++
>  tests/fdc-test.c                 |  192 +++++++++++++++++++++++++++++++++++++-
>  tests/qemu-iotests/044           |  117 +++++++++++++++++++++++
>  tests/qemu-iotests/044.out       |    6 +
>  tests/qemu-iotests/common        |   13 ++-
>  tests/qemu-iotests/common.config |   10 +-
>  tests/qemu-iotests/common.rc     |   23 +++++-
>  tests/qemu-iotests/group         |    1 +
>  tests/qemu-iotests/iotests.py    |    6 +-
>  tests/qemu-iotests/qcow2.py      |    9 +-
>  thread-pool.c                    |    4 +-
>  32 files changed, 556 insertions(+), 142 deletions(-)
>  create mode 100755 tests/qemu-iotests/044
>  create mode 100644 tests/qemu-iotests/044.out

Ping?

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PULL 00/26] Block patches
@ 2013-06-07 11:58 Stefan Hajnoczi
  2013-06-17 21:17 ` Anthony Liguori
  0 siblings, 1 reply; 42+ messages in thread
From: Stefan Hajnoczi @ 2013-06-07 11:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Stefan Hajnoczi

The following changes since commit 8819c10b5d55d537d59a0ffd5d623f348fc36c47:

  Merge remote-tracking branch 'sstabellini/xen_fixes_20130603' into staging (2013-06-04 14:58:58 -0500)

are available in the git repository at:


  git://github.com/stefanha/qemu.git block

for you to fetch changes up to e73fe2b46c38776288415ce7bc8ba3fcd23721c4:

  hmp: add parameters device and -v for info block (2013-06-07 13:45:01 +0200)

----------------------------------------------------------------
Andreas Färber (1):
      ide: Set BSY bit during FLUSH

Kevin Wolf (19):
      qemu-io: Remove unused args_command
      cutils: Support 'P' and 'E' suffixes in strtosz()
      qemu-io: Make cvtnum() a wrapper around strtosz_suffix()
      qemu-io: Handle cvtnum() errors in 'alloc'
      qemu-io: Don't use global bs in command implementations
      qemu-io: Split off commands to qemu-io-cmds.c
      qemu-io: Factor out qemuio_command
      qemu-io: Move 'help' function
      qemu-io: Move 'quit' function
      qemu-io: Move qemu_strsep() to cutils.c
      qemu-io: Move functions for registering and running commands
      qemu-io: Move command_loop() and friends
      qemu-io: Move remaining helpers from cmd.c
      qemu-io: Interface cleanup
      qemu-io: Use the qemu version for -V
      Make qemu-io commands available in HMP
      blkdebug: Add BLKDBG_FLUSH_TO_OS/DISK events
      ide-test: Add enum value for DEV
      ide-test: Add FLUSH CACHE test case

Stefan Hajnoczi (1):
      blockdev: reset werror/rerror on drive_del

Wenchao Xia (5):
      block: add snapshot info query function bdrv_query_snapshot_info_list()
      block: add image info query function bdrv_query_image_info()
      qmp: add ImageInfo in BlockDeviceInfo used by query-block
      hmp: show ImageInfo in 'info block'
      hmp: add parameters device and -v for info block

 Makefile                   |    2 +-
 Makefile.objs              |    1 +
 block.c                    |    8 +-
 block/blkdebug.c           |    3 +
 block/qapi.c               |  148 +++-
 blockdev.c                 |    4 +
 cmd.c                      |  612 -------------
 cmd.h                      |   79 --
 hmp-commands.hx            |   18 +
 hmp.c                      |   39 +
 hmp.h                      |    1 +
 hw/ide/core.c              |    1 +
 include/block/block.h      |    3 +
 include/block/qapi.h       |   14 +-
 include/qemu-common.h      |    3 +
 include/qemu-io.h          |   46 +
 monitor.c                  |   15 +-
 qapi-schema.json           |   10 +-
 qemu-img.c                 |   20 +-
 qemu-io-cmds.c             | 2118 ++++++++++++++++++++++++++++++++++++++++++++
 qemu-io.c                  | 1990 ++++-------------------------------------
 qmp-commands.hx            |   69 +-
 tests/ide-test.c           |   43 +-
 tests/qemu-iotests/049.out |    8 +-
 util/cutils.c              |   25 +
 25 files changed, 2717 insertions(+), 2563 deletions(-)
 delete mode 100644 cmd.c
 delete mode 100644 cmd.h
 create mode 100644 include/qemu-io.h
 create mode 100644 qemu-io-cmds.c

-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [Qemu-devel] [PULL 00/26] Block patches
  2013-06-07 11:58 Stefan Hajnoczi
@ 2013-06-17 21:17 ` Anthony Liguori
  0 siblings, 0 replies; 42+ messages in thread
From: Anthony Liguori @ 2013-06-17 21:17 UTC (permalink / raw)
  To: Stefan Hajnoczi, qemu-devel; +Cc: Anthony Liguori

Pulled.  Thanks.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PULL 00/26] Block patches
@ 2013-08-30 14:30 Kevin Wolf
  2013-08-30 17:14 ` Anthony Liguori
  0 siblings, 1 reply; 42+ messages in thread
From: Kevin Wolf @ 2013-08-30 14:30 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

The following changes since commit b5d54bd42158b90b239bb6ce9c13072eb3a53fd2:

  Merge remote-tracking branch 'qemu-kvm/uq/master' into stable-1.5 (2013-08-29 17:21:51 -0500)

are available in the git repository at:


  git://repo.or.cz/qemu/kevin.git for-anthony

for you to fetch changes up to edcbf2869829001b60b15ad32609138ae784a588:

  qemu-iotests: Overlapping cluster allocations (2013-08-30 15:48:59 +0200)

----------------------------------------------------------------
Bharata B Rao (1):
      gluster: Abort on AIO completion failure

Kevin Wolf (6):
      qcow2: Change default for new images to compat=1.1
      block: Remove redundant assertion
      qapi-types.py: Split off generate_struct_fields()
      Revert "block: Disable driver-specific options for 1.6"
      qemu-iotests: Update reference output for 051
      block: Remove old raw driver

Laszlo Ersek (7):
      add skeleton for BSD licensed "raw" BlockDriver
      raw_bsd: emit debug events in bdrv_co_readv() and bdrv_co_writev()
      raw_bsd: add raw_create()
      raw_bsd: introduce "special members"
      raw_bsd: add raw_create_options
      raw_bsd: register bdrv_raw
      switch raw block driver from "raw.o" to "raw_bsd.o"

Max Reitz (11):
      option: Add assigned flag to QEMUOptionParameter
      qcow2-refcount: Snapshot update for zero clusters
      qemu-iotests: Snapshotting zero clusters
      qcow2: Add corrupt bit
      qcow2: Metadata overlap checks
      qcow2: Employ metadata overlap checks
      qcow2-refcount: Move OFLAG_COPIED checks
      qcow2-refcount: Repair OFLAG_COPIED errors
      qcow2-refcount: Repair shared refcount blocks
      qcow2_check: Mark image consistent
      qemu-iotests: Overlapping cluster allocations

Peter Maydell (1):
      block/qcow2.h: Avoid "1LL << 63" (shifts into sign bit)

 block.c                    |   1 -
 block/Makefile.objs        |   2 +-
 block/gluster.c            |  15 +-
 block/qcow2-cache.c        |  17 ++
 block/qcow2-cluster.c      |  25 ++-
 block/qcow2-refcount.c     | 533 ++++++++++++++++++++++++++++++++++++++++-----
 block/qcow2-snapshot.c     |  22 ++
 block/qcow2.c              |  83 ++++++-
 block/qcow2.h              |  53 ++++-
 block/{raw.c => raw_bsd.c} | 170 +++++++--------
 blockdev.c                 | 143 ------------
 docs/specs/qcow2.txt       |   7 +-
 include/block/block.h      |   1 +
 include/monitor/monitor.h  |   1 +
 include/qemu/option.h      |   1 +
 monitor.c                  |   1 +
 scripts/qapi-types.py      |  19 +-
 tests/qemu-iotests/031.out |  12 +-
 tests/qemu-iotests/036.out |   2 +-
 tests/qemu-iotests/051.out |   1 -
 tests/qemu-iotests/060     | 111 ++++++++++
 tests/qemu-iotests/060.out |  44 ++++
 tests/qemu-iotests/062     |  64 ++++++
 tests/qemu-iotests/062.out |   9 +
 tests/qemu-iotests/group   |   4 +-
 util/qemu-option.c         |   9 +
 26 files changed, 1028 insertions(+), 322 deletions(-)
 rename block/{raw.c => raw_bsd.c} (57%)
 create mode 100755 tests/qemu-iotests/060
 create mode 100644 tests/qemu-iotests/060.out
 create mode 100755 tests/qemu-iotests/062
 create mode 100644 tests/qemu-iotests/062.out

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [Qemu-devel] [PULL 00/26] Block patches
  2013-08-30 14:30 Kevin Wolf
@ 2013-08-30 17:14 ` Anthony Liguori
  2013-09-02  8:24   ` Kevin Wolf
  0 siblings, 1 reply; 42+ messages in thread
From: Anthony Liguori @ 2013-08-30 17:14 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel

This pull request breaks make check, qemu-system-i386 segvs when
running qtest.  bisect blames the following commit.  I confirmed this
commit introduces the breakage too.

commit 19abade25242079f4b5582de17b2302fe185be2b
Author: Max Reitz <mreitz@redhat.com>
Date:   Fri Aug 30 14:34:29 2013 +0200

    qcow2-refcount: Repair shared refcount blocks

    If the refcount of a refcount block is greater than one, we can at least
    try to repair that problem by duplicating the affected block.

    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>

Backtrace is:

Core was generated by `i386-softmmu/qemu-system-i386 -qtest
unix:/tmp/qtest-30888.sock,nowait -qtest-l'.
Program terminated with signal 11, Segmentation fault.
#0  __strcmp_sse42 () at ../sysdeps/x86_64/multiarch/strcmp.S:259
259    ../sysdeps/x86_64/multiarch/strcmp.S: No such file or directory.
    in ../sysdeps/x86_64/multiarch/strcmp.S
(gdb) bt
#0  __strcmp_sse42 () at ../sysdeps/x86_64/multiarch/strcmp.S:259
#1  0x00002abc7727c395 in get_event_by_name (event=<synthetic pointer>,
    name=0x2abc77e69a96 "flush_to_os")
    at /home/anthony/git/qemu/block/blkdebug.c:195
#2  blkdebug_debug_breakpoint (bs=<optimized out>,
    event=0x2abc77e69a96 "flush_to_os", tag=0x2abc77e69aa2 "A")
    at /home/anthony/git/qemu/block/blkdebug.c:572
#3  0x00002abc773bab84 in break_f (bs=<optimized out>, argc=<optimized out>,
    argv=<optimized out>) at /home/anthony/git/qemu/qemu-io-cmds.c:1938
#4  0x00002abc773be088 in command (argv=0x2abc77e69dc0, argc=3,
    ct=<optimized out>, bs=0x2abc77de35c0)
    at /home/anthony/git/qemu/qemu-io-cmds.c:79
#5  qemuio_command (bs=0x2abc77de35c0, cmd=<optimized out>)
    at /home/anthony/git/qemu/qemu-io-cmds.c:2085
#6  0x00002abc772b8f4d in hmp_qemu_io (mon=0x7fffa0de1110,
    qdict=<optimized out>) at /home/anthony/git/qemu/hmp.c:1510
#7  0x00002abc77469749 in handle_user_command (mon=0x7fffa0de1110,
    cmdline=<optimized out>) at /home/anthony/git/qemu/monitor.c:4005
#8  0x00002abc77469908 in qmp_human_monitor_command (
    command_line=0x2abc77e69a10 "qemu-io ide0-hd0 \"break flush_to_os A\"",
    has_cpu_index=false, cpu_index=<optimized out>, errp=0x7fffa0de11d0)
    at /home/anthony/git/qemu/monitor.c:710
#9  0x00002abc773c29a7 in qmp_marshal_input_human_monitor_command (
---Type <return> to continue, or q <return> to quit---
    mon=<optimized out>, qdict=<optimized out>, ret=0x7fffa0de1240)
    at qmp-marshal.c:1658
#10 0x00002abc774642a0 in qmp_call_cmd (params=0x2abc77e8a370,
    mon=0x2abc77dea430, cmd=<optimized out>)
    at /home/anthony/git/qemu/monitor.c:4506
#11 handle_qmp_command (parser=<optimized out>, tokens=<optimized out>)
    at /home/anthony/git/qemu/monitor.c:4572
#12 0x00002abc774fc2f1 in json_message_process_token (lexer=0x2abc77dea4e0,
    token=0x2abc77e69800, type=JSON_OPERATOR, x=143, y=0)
    at /home/anthony/git/qemu/qobject/json-streamer.c:87
#13 0x00002abc7750ea12 in json_lexer_feed_char (lexer=0x2abc77dea4e0,
    ch=125 '}', flush=false) at /home/anthony/git/qemu/qobject/json-lexer.c:303
#14 0x00002abc7750eba9 in json_lexer_feed (lexer=0x2abc77dea4e0,
    buffer=0x7fffa0de1440 "}nb 0x511\n 0x3\nn ioapic\nNt\"|\274*", size=1)
    at /home/anthony/git/qemu/qobject/json-lexer.c:356
#15 0x00002abc774626fb in monitor_control_read (opaque=<optimized out>,
    buf=<optimized out>, size=<optimized out>)
    at /home/anthony/git/qemu/monitor.c:4593
#16 0x00002abc773b6f87 in qemu_chr_be_write (len=<optimized out>,
    buf=0x7fffa0de1440 "}nb 0x511\n 0x3\nn ioapic\nNt\"|\274*",
    s=0x2abc77ddfbf0) at /home/anthony/git/qemu/qemu-char.c:165
#17 tcp_chr_read (chan=<optimized out>, cond=<optimized out>,
    opaque=0x2abc77ddfbf0) at /home/anthony/git/qemu/qemu-char.c:2509
#18 0x00002abc7840fa5d in g_main_context_dispatch ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#19 0x00002abc7738a671 in glib_pollfds_poll ()
    at /home/anthony/git/qemu/main-loop.c:189
#20 os_host_main_loop_wait (timeout=<optimized out>)
    at /home/anthony/git/qemu/main-loop.c:234
#21 main_loop_wait (nonblocking=<optimized out>)
    at /home/anthony/git/qemu/main-loop.c:484
#22 0x00002abc77260b9a in main_loop () at /home/anthony/git/qemu/vl.c:2090
#23 main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>)
    at /home/anthony/git/qemu/vl.c:4435
(gdb)

Regards,

Anthony Liguori


On Fri, Aug 30, 2013 at 9:30 AM, Kevin Wolf <kwolf@redhat.com> wrote:
> The following changes since commit b5d54bd42158b90b239bb6ce9c13072eb3a53fd2:
>
>   Merge remote-tracking branch 'qemu-kvm/uq/master' into stable-1.5 (2013-08-29 17:21:51 -0500)
>
> are available in the git repository at:
>
>
>   git://repo.or.cz/qemu/kevin.git for-anthony
>
> for you to fetch changes up to edcbf2869829001b60b15ad32609138ae784a588:
>
>   qemu-iotests: Overlapping cluster allocations (2013-08-30 15:48:59 +0200)
>
> ----------------------------------------------------------------
> Bharata B Rao (1):
>       gluster: Abort on AIO completion failure
>
> Kevin Wolf (6):
>       qcow2: Change default for new images to compat=1.1
>       block: Remove redundant assertion
>       qapi-types.py: Split off generate_struct_fields()
>       Revert "block: Disable driver-specific options for 1.6"
>       qemu-iotests: Update reference output for 051
>       block: Remove old raw driver
>
> Laszlo Ersek (7):
>       add skeleton for BSD licensed "raw" BlockDriver
>       raw_bsd: emit debug events in bdrv_co_readv() and bdrv_co_writev()
>       raw_bsd: add raw_create()
>       raw_bsd: introduce "special members"
>       raw_bsd: add raw_create_options
>       raw_bsd: register bdrv_raw
>       switch raw block driver from "raw.o" to "raw_bsd.o"
>
> Max Reitz (11):
>       option: Add assigned flag to QEMUOptionParameter
>       qcow2-refcount: Snapshot update for zero clusters
>       qemu-iotests: Snapshotting zero clusters
>       qcow2: Add corrupt bit
>       qcow2: Metadata overlap checks
>       qcow2: Employ metadata overlap checks
>       qcow2-refcount: Move OFLAG_COPIED checks
>       qcow2-refcount: Repair OFLAG_COPIED errors
>       qcow2-refcount: Repair shared refcount blocks
>       qcow2_check: Mark image consistent
>       qemu-iotests: Overlapping cluster allocations
>
> Peter Maydell (1):
>       block/qcow2.h: Avoid "1LL << 63" (shifts into sign bit)
>
>  block.c                    |   1 -
>  block/Makefile.objs        |   2 +-
>  block/gluster.c            |  15 +-
>  block/qcow2-cache.c        |  17 ++
>  block/qcow2-cluster.c      |  25 ++-
>  block/qcow2-refcount.c     | 533 ++++++++++++++++++++++++++++++++++++++++-----
>  block/qcow2-snapshot.c     |  22 ++
>  block/qcow2.c              |  83 ++++++-
>  block/qcow2.h              |  53 ++++-
>  block/{raw.c => raw_bsd.c} | 170 +++++++--------
>  blockdev.c                 | 143 ------------
>  docs/specs/qcow2.txt       |   7 +-
>  include/block/block.h      |   1 +
>  include/monitor/monitor.h  |   1 +
>  include/qemu/option.h      |   1 +
>  monitor.c                  |   1 +
>  scripts/qapi-types.py      |  19 +-
>  tests/qemu-iotests/031.out |  12 +-
>  tests/qemu-iotests/036.out |   2 +-
>  tests/qemu-iotests/051.out |   1 -
>  tests/qemu-iotests/060     | 111 ++++++++++
>  tests/qemu-iotests/060.out |  44 ++++
>  tests/qemu-iotests/062     |  64 ++++++
>  tests/qemu-iotests/062.out |   9 +
>  tests/qemu-iotests/group   |   4 +-
>  util/qemu-option.c         |   9 +
>  26 files changed, 1028 insertions(+), 322 deletions(-)
>  rename block/{raw.c => raw_bsd.c} (57%)
>  create mode 100755 tests/qemu-iotests/060
>  create mode 100644 tests/qemu-iotests/060.out
>  create mode 100755 tests/qemu-iotests/062
>  create mode 100644 tests/qemu-iotests/062.out

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [Qemu-devel] [PULL 00/26] Block patches
  2013-08-30 17:14 ` Anthony Liguori
@ 2013-09-02  8:24   ` Kevin Wolf
  0 siblings, 0 replies; 42+ messages in thread
From: Kevin Wolf @ 2013-09-02  8:24 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel

Am 30.08.2013 um 19:14 hat Anthony Liguori geschrieben:
> This pull request breaks make check, qemu-system-i386 segvs when
> running qtest.  bisect blames the following commit.  I confirmed this
> commit introduces the breakage too.
> 
> commit 19abade25242079f4b5582de17b2302fe185be2b
> Author: Max Reitz <mreitz@redhat.com>
> Date:   Fri Aug 30 14:34:29 2013 +0200
> 
>     qcow2-refcount: Repair shared refcount blocks
> 
>     If the refcount of a refcount block is greater than one, we can at least
>     try to repair that problem by duplicating the affected block.
> 
>     Signed-off-by: Max Reitz <mreitz@redhat.com>
>     Signed-off-by: Kevin Wolf <kwolf@redhat.com>

Sorry, seems I messed up here. The shell history shows that I did
run 'make check', but somehow the failure must have escaped my
attention (it's not an assertion failure and we do have some noise
in successful runs, maybe that's why)

The other test case that could have caught it (qemu-iotests 026) has
been broken for ages, and we need to finally fix it.

Thanks for catching this, Anthony. I'll send a v2.

Kevin

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PULL 00/26] Block patches
@ 2014-09-05 16:13 Stefan Hajnoczi
  2014-09-05 16:32 ` Peter Maydell
  0 siblings, 1 reply; 42+ messages in thread
From: Stefan Hajnoczi @ 2014-09-05 16:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Stefan Hajnoczi

The following changes since commit 30eaca3acdf17d7bcbd1213eb149c02037edfb0b:

  Merge remote-tracking branch 'remotes/spice/tags/pull-spice-20140902-1' into staging (2014-09-02 10:26:10 +0100)

are available in the git repository at:


  git://github.com/stefanha/qemu.git tags/block-pull-request

for you to fetch changes up to 804b985da5f781a2ff0a723c1aae520b9ea95f27:

  ide: Add resize callback to ide/core (2014-09-05 10:38:56 +0100)

----------------------------------------------------------------
Block pull request

----------------------------------------------------------------
Chrysostomos Nanakos (1):
      block/archipelago: Use QEMU atomic builtins

Fam Zheng (2):
      virtio: Import virtio_vring.h
      block: Always compile virtio-blk dataplane

John Snow (5):
      libqos: add a simple first-fit memory allocator
      qtest/ide: Uninitialize PC allocator
      ide: Add wwn support to IDE-ATAPI drive
      IDE: Fill the IDENTIFY request consistently
      ide: Add resize callback to ide/core

Laszlo Ersek (2):
      pflash_cfi01: fixup stale DPRINTF() calls
      pflash_cfi01: write flash contents to bdrv on incoming migration

Liu Yuan (1):
      block: kill tail whitespace in block.c

MORITA Kazutaka (1):
      MAINTAINERS: update sheepdog maintainer

Marc Marí (7):
      tests: Functions bus_foreach and device_find from libqos virtio API
      tests: Add virtio device initialization
      libqos: Added basic virtqueue support to virtio implementation
      libqos: Added indirect descriptor support to virtio implementation
      libqos: Added test case for configuration changes in virtio-blk test
      libqos: Added MSI-X support
      libqos: Added EVENT_IDX support

Peter Lieven (3):
      rename parse_enum_option to qapi_enum_parse and make it public
      qemu-nbd: add option to set detect-zeroes mode
      qemu-nbd: fix indentation and coding style

Stefan Hajnoczi (4):
      qemu-img: clarify src_cache option documentation
      qemu-img: fix rebase src_cache option documentation
      vmdk: fix vmdk_parse_extents() extent_file leaks
      vmdk: fix buf leak in vmdk_parse_extents()

 MAINTAINERS                         |   2 +-
 block.c                             |   2 +-
 block/archipelago.c                 |  76 ++---
 block/vmdk.c                        |   4 +-
 blockdev.c                          |  30 +-
 configure                           |  21 +-
 hw/block/Makefile.objs              |   2 +-
 hw/block/pflash_cfi01.c             |  18 +-
 hw/block/virtio-blk.c               |  20 +-
 hw/ide/core.c                       | 111 +++++--
 hw/net/vhost_net.c                  |   2 +-
 hw/virtio/Makefile.objs             |   2 +-
 include/hw/virtio/dataplane/vring.h |   2 +-
 include/hw/virtio/virtio-blk.h      |   2 -
 include/hw/virtio/virtio_ring.h     | 167 ++++++++++
 include/qapi/util.h                 |  17 +
 linux-headers/linux/vhost.h         |   2 +-
 qapi/Makefile.objs                  |   2 +-
 qapi/qapi-util.c                    |  34 ++
 qemu-img.c                          |   3 +-
 qemu-img.texi                       |   7 +-
 qemu-nbd.c                          | 100 ++++--
 tests/Makefile                      |   3 +-
 tests/ide-test.c                    |   2 +
 tests/libqos/malloc-pc.c            | 280 +++++++++++++++-
 tests/libqos/malloc-pc.h            |   9 +
 tests/libqos/pci.c                  | 111 ++++++-
 tests/libqos/pci.h                  |  10 +
 tests/libqos/virtio-pci.c           | 343 +++++++++++++++++++
 tests/libqos/virtio-pci.h           |  61 ++++
 tests/libqos/virtio.c               | 257 +++++++++++++++
 tests/libqos/virtio.h               | 182 ++++++++++
 tests/libqtest.c                    |  48 +++
 tests/libqtest.h                    |   7 +
 tests/virtio-blk-test.c             | 640 +++++++++++++++++++++++++++++++++++-
 35 files changed, 2368 insertions(+), 211 deletions(-)
 create mode 100644 include/hw/virtio/virtio_ring.h
 create mode 100644 include/qapi/util.h
 create mode 100644 qapi/qapi-util.c
 create mode 100644 tests/libqos/virtio-pci.c
 create mode 100644 tests/libqos/virtio-pci.h
 create mode 100644 tests/libqos/virtio.c
 create mode 100644 tests/libqos/virtio.h

-- 
1.9.3

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [Qemu-devel] [PULL 00/26] Block patches
  2014-09-05 16:13 Stefan Hajnoczi
@ 2014-09-05 16:32 ` Peter Maydell
  0 siblings, 0 replies; 42+ messages in thread
From: Peter Maydell @ 2014-09-05 16:32 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: QEMU Developers

On 5 September 2014 17:13, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> The following changes since commit 30eaca3acdf17d7bcbd1213eb149c02037edfb0b:
>
>   Merge remote-tracking branch 'remotes/spice/tags/pull-spice-20140902-1' into staging (2014-09-02 10:26:10 +0100)
>
> are available in the git repository at:
>
>
>   git://github.com/stefanha/qemu.git tags/block-pull-request
>
> for you to fetch changes up to 804b985da5f781a2ff0a723c1aae520b9ea95f27:
>
>   ide: Add resize callback to ide/core (2014-09-05 10:38:56 +0100)
>
> ----------------------------------------------------------------
> Block pull request

Hi. I'm afraid this doesn't build on win32:

/home/petmay01/linaro/qemu-for-merges/hw/virtio/dataplane/vring.c: In
function ‘get_desc’:
/home/petmay01/linaro/qemu-for-merges/hw/virtio/dataplane/vring.c:184:
error: ‘ENOBUFS’ undeclared (first use in this function)
/home/petmay01/linaro/qemu-for-merges/hw/virtio/dataplane/vring.c:184:
error: (Each undeclared identifier is reported only once
/home/petmay01/linaro/qemu-for-merges/hw/virtio/dataplane/vring.c:184:
error: for each function it appears in.)

thanks
-- PMM

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [Qemu-devel] [PULL 00/26] Block patches
@ 2015-01-09 10:16 Stefan Hajnoczi
  2015-01-10 19:05 ` Peter Maydell
  0 siblings, 1 reply; 42+ messages in thread
From: Stefan Hajnoczi @ 2015-01-09 10:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Stefan Hajnoczi

This pull request depends on the previous block pull request which has not been
merged yet.  It was sent on Monday, 5th of January (Message-id:
<1420458696-1885-1-git-send-email-stefanha@redhat.com>).

The following changes since commit 3bd54e576f40f1d5bf45b4828c7316efd76a4db6:

  migration/block: fix pending() return value (2015-01-05 11:34:52 +0000)

are available in the git repository at:

  git://github.com/stefanha/qemu.git tags/block-pull-request

for you to fetch changes up to 4cba4284918145de66e27959725559f8aaf764ef:

  NVMe: Set correct VS Value for 1.1 Compliant Controllers (2015-01-09 10:12:23 +0000)

----------------------------------------------------------------

----------------------------------------------------------------

Alex Friedman (1):
  nvme: Fix get/set number of queues feature

Anubhav Rakshit (1):
  NVMe: Set correct VS Value for 1.1 Compliant Controllers

Chrysostomos Nanakos (1):
  MAINTAINERS: Update email addresses for Chrysostomos Nanakos

Fam Zheng (7):
  .gitignore: Ignore generated "common.env"
  qemu-iotests: Replace "/bin/true" with "true"
  qemu-iotests: Add "_supported_os Linux" to 058
  tests/Makefile: Add check-block to make check on Linux
  qemu-iotests: Add supported os parameter for python tests
  block: Split BLOCK_OP_TYPE_COMMIT to BLOCK_OP_TYPE_COMMIT_{SOURCE,
    TARGET}
  MAINTAINERS: Add migration/block* to block subsystem

John Snow (1):
  ide: Implement VPD response for ATAPI

Marc Marí (6):
  libqos: Convert malloc-pc allocator to a generic allocator
  libqos: Change use of pointers to uint64_t in virtio
  tests: Prepare virtio-blk-test for multi-arch implementation
  libqos: Remove PCI assumptions in constants of virtio driver
  libqos: Add malloc generic
  libqos: Add virtio MMIO support

Paolo Bonzini (6):
  coroutine-ucontext: use __thread
  qemu-thread: add per-thread atexit functions
  test-coroutine: avoid overflow on 32-bit systems
  QSLIST: add lock-free operations
  coroutine: rewrite pool to avoid mutex
  coroutine: drop qemu_coroutine_adjust_pool_size

Peter Lieven (2):
  coroutine: try harder not to delete coroutines
  block: limited request size in write zeroes unsupported path

Programmingkid (1):
  block/raw-posix.c: Fixes raw_getlength() on Mac OS X so that it
    reports the correct length of a real CD

 .gitignore                       |   1 +
 MAINTAINERS                      |   2 +-
 block.c                          |  11 +-
 block/block-backend.c            |   4 -
 block/raw-posix.c                |  18 ++-
 blockdev.c                       |   6 +-
 configure                        |   2 +-
 coroutine-ucontext.c             |  69 +++-------
 hw/block/dataplane/virtio-blk.c  |   3 +-
 hw/block/nvme.c                  |   8 +-
 hw/ide/atapi.c                   | 111 ++++++++++++++--
 hw/ide/internal.h                |   1 +
 include/block/block.h            |   3 +-
 include/block/coroutine.h        |  10 --
 include/qemu/queue.h             |  15 ++-
 include/qemu/thread.h            |   4 +
 qemu-coroutine.c                 | 103 +++++++-------
 tests/Makefile                   |   9 +-
 tests/libqos/malloc-generic.c    |  50 +++++++
 tests/libqos/malloc-generic.h    |  21 +++
 tests/libqos/malloc-pc.c         | 280 +--------------------------------------
 tests/libqos/malloc-pc.h         |  11 +-
 tests/libqos/malloc.c            | 270 +++++++++++++++++++++++++++++++++++++
 tests/libqos/malloc.h            |  45 ++++---
 tests/libqos/virtio-mmio.c       | 190 ++++++++++++++++++++++++++
 tests/libqos/virtio-mmio.h       |  46 +++++++
 tests/libqos/virtio-pci.c        |  50 +++----
 tests/libqos/virtio-pci.h        |  24 ++--
 tests/libqos/virtio.c            |   8 +-
 tests/libqos/virtio.h            |  16 +--
 tests/qemu-iotests/058           |   1 +
 tests/qemu-iotests/common.config |   2 +-
 tests/qemu-iotests/common.filter |   2 +-
 tests/qemu-iotests/common.rc     |   2 +-
 tests/qemu-iotests/iotests.py    |   5 +-
 tests/test-coroutine.c           |   2 +-
 tests/virtio-blk-test.c          | 249 +++++++++++++++++++++++-----------
 util/qemu-thread-posix.c         |  37 ++++++
 util/qemu-thread-win32.c         |  48 +++++--
 39 files changed, 1154 insertions(+), 585 deletions(-)
 create mode 100644 tests/libqos/malloc-generic.c
 create mode 100644 tests/libqos/malloc-generic.h
 create mode 100644 tests/libqos/malloc.c
 create mode 100644 tests/libqos/virtio-mmio.c
 create mode 100644 tests/libqos/virtio-mmio.h

-- 
2.1.0

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [Qemu-devel] [PULL 00/26] Block patches
  2015-01-09 10:16 Stefan Hajnoczi
@ 2015-01-10 19:05 ` Peter Maydell
  2015-01-10 19:10   ` Peter Maydell
  2015-01-12 14:25   ` Stefan Hajnoczi
  0 siblings, 2 replies; 42+ messages in thread
From: Peter Maydell @ 2015-01-10 19:05 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: QEMU Developers

On 9 January 2015 at 10:16, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> This pull request depends on the previous block pull request which has not been
> merged yet.  It was sent on Monday, 5th of January (Message-id:
> <1420458696-1885-1-git-send-email-stefanha@redhat.com>).
>
> The following changes since commit 3bd54e576f40f1d5bf45b4828c7316efd76a4db6:
>
>   migration/block: fix pending() return value (2015-01-05 11:34:52 +0000)
>
> are available in the git repository at:
>
>   git://github.com/stefanha/qemu.git tags/block-pull-request
>
> for you to fetch changes up to 4cba4284918145de66e27959725559f8aaf764ef:
>
>   NVMe: Set correct VS Value for 1.1 Compliant Controllers (2015-01-09 10:12:23 +0000)

I'm confused. You say this pull depends on the other one, but
the emails give the same tag name for both, so I can't pull
the other one first. (In fact, if not for this one failing I
would have applied it under the assumption that it *was* the
previous pullreq...)

In any case, this one fails 'make check':

GTESTER check-qtest-arm
WARNING: Image format was not specified for '/tmp/qtest.ZDWVz0' and
probing guessed raw.
         Automatically detecting the format is dangerous for raw
images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
**
ERROR:/home/petmay01/linaro/qemu-for-merges/tests/libqos/virtio.c:91:qvirtio_wait_queue_isr:
assertion failed: (g_get_monotonic_time() - start_time <= timeout_us)
GTester: last random seed: R02Scf242b6e43396cc299f6f06431644f8f
make: *** [check-qtest-arm] Error 1
make: Leaving directory `/home/petmay01/linaro/qemu-for-merges/build/all'

thanks
-- PMM

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [Qemu-devel] [PULL 00/26] Block patches
  2015-01-10 19:05 ` Peter Maydell
@ 2015-01-10 19:10   ` Peter Maydell
  2015-01-12  9:52     ` Fam Zheng
  2015-01-12 14:25   ` Stefan Hajnoczi
  1 sibling, 1 reply; 42+ messages in thread
From: Peter Maydell @ 2015-01-10 19:10 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: QEMU Developers

On 10 January 2015 at 19:05, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 9 January 2015 at 10:16, Stefan Hajnoczi <stefanha@redhat.com> wrote:
>> This pull request depends on the previous block pull request which has not been
>> merged yet.  It was sent on Monday, 5th of January (Message-id:
>> <1420458696-1885-1-git-send-email-stefanha@redhat.com>).
>>
>> The following changes since commit 3bd54e576f40f1d5bf45b4828c7316efd76a4db6:
>>
>>   migration/block: fix pending() return value (2015-01-05 11:34:52 +0000)
>>
>> are available in the git repository at:
>>
>>   git://github.com/stefanha/qemu.git tags/block-pull-request
>>
>> for you to fetch changes up to 4cba4284918145de66e27959725559f8aaf764ef:
>>
>>   NVMe: Set correct VS Value for 1.1 Compliant Controllers (2015-01-09 10:12:23 +0000)
>
> I'm confused. You say this pull depends on the other one, but
> the emails give the same tag name for both, so I can't pull
> the other one first. (In fact, if not for this one failing I
> would have applied it under the assumption that it *was* the
> previous pullreq...)
>
> In any case, this one fails 'make check':

Failed also and differently on my 32 bit ARM board, though that
may just be because I run this set with V=1; last part
of the log below. Looks like something is trying to run
qemu-system-arm without specifying a machine to use...

 === Testing plain filename for blkdebug ===

-blkdebug:TEST_DIR/blkdebug.conf:TEST_DIR/t.IMGFMT

 === Testing plain filename for blkdebug without configuration file ===

-blkdebug::TEST_DIR/t.IMGFMT
 *** done
100                [20:40:41] [20:40:45]
101                [20:40:45] [20:40:45] [not run]
        101 -- not suitable for this image format: qcow2
102                [20:40:45] [20:40:46] [failed, exit status 141] -
output mismatch (see 102.out.bad)
--- /root/qemu/tests/qemu-iotests/102.out       2014-11-03
18:34:23.000000000 +0000
+++ 102.out.bad 2015-01-09 20:40:46.000000000 +0000
@@ -15,7 +15,6 @@
 wrote 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 Image resized.
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drv0 map
-[                       0]      128/     128 sectors     allocated at
offset 0 bytes (1)
-*** done
+No machine specified, and there is no default.
+Use -machine help to list supported machines!
+Timeout waiting for allocated on handle 0
103                [20:40:46] [20:40:47]
105                [20:40:47] [20:40:48]
107                [20:40:48] [20:40:49]
108                [20:40:49] [20:40:52]
110                [20:40:52] [20:40:53]
111                [20:40:53] [20:40:53]
113                [20:40:53] [20:40:53] [not run]
        113 -- not suitable for this image format: qcow2
114                [20:40:53] [20:40:54]
Not run: 016 045 059 064 065 070 075 077 078 081 084 088 092 101 113
Failures: 028 067 068 071 087 095 099 102
Failed 8 of 65 tests
make: *** [check-tests/qemu-iotests-quick.sh] Error 1


-- PMM

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [Qemu-devel] [PULL 00/26] Block patches
  2015-01-10 19:10   ` Peter Maydell
@ 2015-01-12  9:52     ` Fam Zheng
  2015-01-12 10:32       ` Paolo Bonzini
  0 siblings, 1 reply; 42+ messages in thread
From: Fam Zheng @ 2015-01-12  9:52 UTC (permalink / raw)
  To: Stefan Hajnoczi, Peter Maydell; +Cc: QEMU Developers

On Sat, 01/10 19:10, Peter Maydell wrote:
> On 10 January 2015 at 19:05, Peter Maydell <peter.maydell@linaro.org> wrote:
> > On 9 January 2015 at 10:16, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> >> This pull request depends on the previous block pull request which has not been
> >> merged yet.  It was sent on Monday, 5th of January (Message-id:
> >> <1420458696-1885-1-git-send-email-stefanha@redhat.com>).
> >>
> >> The following changes since commit 3bd54e576f40f1d5bf45b4828c7316efd76a4db6:
> >>
> >>   migration/block: fix pending() return value (2015-01-05 11:34:52 +0000)
> >>
> >> are available in the git repository at:
> >>
> >>   git://github.com/stefanha/qemu.git tags/block-pull-request
> >>
> >> for you to fetch changes up to 4cba4284918145de66e27959725559f8aaf764ef:
> >>
> >>   NVMe: Set correct VS Value for 1.1 Compliant Controllers (2015-01-09 10:12:23 +0000)
> >
> > I'm confused. You say this pull depends on the other one, but
> > the emails give the same tag name for both, so I can't pull
> > the other one first. (In fact, if not for this one failing I
> > would have applied it under the assumption that it *was* the
> > previous pullreq...)
> >
> > In any case, this one fails 'make check':
> 
> Failed also and differently on my 32 bit ARM board, though that
> may just be because I run this set with V=1; last part
> of the log below. Looks like something is trying to run
> qemu-system-arm without specifying a machine to use...
> 

Ouch! This is something that proves really hard to do.

Stefan, please drop the make check-block series in next revision.

Fam

>  === Testing plain filename for blkdebug ===
> 
> -blkdebug:TEST_DIR/blkdebug.conf:TEST_DIR/t.IMGFMT
> 
>  === Testing plain filename for blkdebug without configuration file ===
> 
> -blkdebug::TEST_DIR/t.IMGFMT
>  *** done
> 100                [20:40:41] [20:40:45]
> 101                [20:40:45] [20:40:45] [not run]
>         101 -- not suitable for this image format: qcow2
> 102                [20:40:45] [20:40:46] [failed, exit status 141] -
> output mismatch (see 102.out.bad)
> --- /root/qemu/tests/qemu-iotests/102.out       2014-11-03
> 18:34:23.000000000 +0000
> +++ 102.out.bad 2015-01-09 20:40:46.000000000 +0000
> @@ -15,7 +15,6 @@
>  wrote 65536/65536 bytes at offset 0
>  64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  Image resized.
> -QEMU X.Y.Z monitor - type 'help' for more information
> -(qemu) qemu-io drv0 map
> -[                       0]      128/     128 sectors     allocated at
> offset 0 bytes (1)
> -*** done
> +No machine specified, and there is no default.
> +Use -machine help to list supported machines!
> +Timeout waiting for allocated on handle 0
> 103                [20:40:46] [20:40:47]
> 105                [20:40:47] [20:40:48]
> 107                [20:40:48] [20:40:49]
> 108                [20:40:49] [20:40:52]
> 110                [20:40:52] [20:40:53]
> 111                [20:40:53] [20:40:53]
> 113                [20:40:53] [20:40:53] [not run]
>         113 -- not suitable for this image format: qcow2
> 114                [20:40:53] [20:40:54]
> Not run: 016 045 059 064 065 070 075 077 078 081 084 088 092 101 113
> Failures: 028 067 068 071 087 095 099 102
> Failed 8 of 65 tests
> make: *** [check-tests/qemu-iotests-quick.sh] Error 1
> 
> 
> -- PMM
> 

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [Qemu-devel] [PULL 00/26] Block patches
  2015-01-12  9:52     ` Fam Zheng
@ 2015-01-12 10:32       ` Paolo Bonzini
  0 siblings, 0 replies; 42+ messages in thread
From: Paolo Bonzini @ 2015-01-12 10:32 UTC (permalink / raw)
  To: Fam Zheng, Stefan Hajnoczi, Peter Maydell; +Cc: QEMU Developers



On 12/01/2015 10:52, Fam Zheng wrote:
> On Sat, 01/10 19:10, Peter Maydell wrote:
>> On 10 January 2015 at 19:05, Peter Maydell <peter.maydell@linaro.org> wrote:
>>> On 9 January 2015 at 10:16, Stefan Hajnoczi <stefanha@redhat.com> wrote:
>>>> This pull request depends on the previous block pull request which has not been
>>>> merged yet.  It was sent on Monday, 5th of January (Message-id:
>>>> <1420458696-1885-1-git-send-email-stefanha@redhat.com>).
>>>>
>>>> The following changes since commit 3bd54e576f40f1d5bf45b4828c7316efd76a4db6:
>>>>
>>>>   migration/block: fix pending() return value (2015-01-05 11:34:52 +0000)
>>>>
>>>> are available in the git repository at:
>>>>
>>>>   git://github.com/stefanha/qemu.git tags/block-pull-request
>>>>
>>>> for you to fetch changes up to 4cba4284918145de66e27959725559f8aaf764ef:
>>>>
>>>>   NVMe: Set correct VS Value for 1.1 Compliant Controllers (2015-01-09 10:12:23 +0000)
>>>
>>> I'm confused. You say this pull depends on the other one, but
>>> the emails give the same tag name for both, so I can't pull
>>> the other one first. (In fact, if not for this one failing I
>>> would have applied it under the assumption that it *was* the
>>> previous pullreq...)
>>>
>>> In any case, this one fails 'make check':
>>
>> Failed also and differently on my 32 bit ARM board, though that
>> may just be because I run this set with V=1; last part
>> of the log below. Looks like something is trying to run
>> qemu-system-arm without specifying a machine to use...
>>
> 
> Ouch! This is something that proves really hard to do.
> 
> Stefan, please drop the make check-block series in next revision.

No need to drop the bug fixes.  One can just drop patch 11
("tests/Makefile: Add check-block to make check on Linux").

Paolo

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [Qemu-devel] [PULL 00/26] Block patches
  2015-01-10 19:05 ` Peter Maydell
  2015-01-10 19:10   ` Peter Maydell
@ 2015-01-12 14:25   ` Stefan Hajnoczi
  1 sibling, 0 replies; 42+ messages in thread
From: Stefan Hajnoczi @ 2015-01-12 14:25 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 1448 bytes --]

On Sat, Jan 10, 2015 at 07:05:47PM +0000, Peter Maydell wrote:
> On 9 January 2015 at 10:16, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> > This pull request depends on the previous block pull request which has not been
> > merged yet.  It was sent on Monday, 5th of January (Message-id:
> > <1420458696-1885-1-git-send-email-stefanha@redhat.com>).
> >
> > The following changes since commit 3bd54e576f40f1d5bf45b4828c7316efd76a4db6:
> >
> >   migration/block: fix pending() return value (2015-01-05 11:34:52 +0000)
> >
> > are available in the git repository at:
> >
> >   git://github.com/stefanha/qemu.git tags/block-pull-request
> >
> > for you to fetch changes up to 4cba4284918145de66e27959725559f8aaf764ef:
> >
> >   NVMe: Set correct VS Value for 1.1 Compliant Controllers (2015-01-09 10:12:23 +0000)
> 
> I'm confused. You say this pull depends on the other one, but
> the emails give the same tag name for both, so I can't pull
> the other one first. (In fact, if not for this one failing I
> would have applied it under the assumption that it *was* the
> previous pullreq...)

I used a script that overwrites the pull request tag.

Sorry for the confusion.  You can look at the "for you to fetch changes
up to 4cba4284918145de66e27959725559f8aaf764ef" lines to identify which
commits are part of each pull request.

I'm resending a new (combined) revision without the make check-block
commit.

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2015-01-12 14:25 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 01/26] qemu: Document GlusterFS block driver usage Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 02/26] qcow2: Fix refcount table size calculation Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 03/26] qemu-iotests: qcow2: Test growing large refcount table Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 04/26] MAINTAINERS: add Stefan Hajnoczi as block and virtio-blk co-maintainer Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 05/26] block: Workaround for older versions of MinGW gcc Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 06/26] tests: allow qemu-iotests to be run against nbd backend Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 07/26] aio: switch aiocb_size type int -> size_t Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 08/26] aio: use g_slice_alloc() for AIOCB pooling Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 09/26] aio: rename AIOPool to AIOCBInfo Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 10/26] fdc: Remove status0 parameter from fdctrl_set_fifo() Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 11/26] fdc-test: split test_media_change() test, so insert part can be reused Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 12/26] fdc-test: insert media before fuzzing registers Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 13/26] fdc-test: add tests for non-DMA READ command Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 14/26] fdc: use status0 field instead of a local variable Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 15/26] fdc: fix FD_SR0_SEEK for non-DMA transfers and multi sectors transfers Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 16/26] fdc: fix FD_SR0_SEEK for initial seek on DMA transfers Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 17/26] fdc: fix false FD_SR0_SEEK Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 18/26] fdc-test: Check READ ID Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 19/26] fdc: implement VERIFY command Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 20/26] fdc-tests: add tests for " Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 21/26] fdc: remove double affectation of FD_MSR_CMDBUSY flag Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 22/26] fdc: fix typo in zero constant Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 23/26] fdc: remove last usage of FD_STATE_SEEK Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 24/26] vmdk: Fix data corruption bug in WRITE and READ handling Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 25/26] megasas: Use bdrv_drain_all instead of qemu_aio_flush Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 26/26] qemu-io: " Kevin Wolf
2012-11-19  9:12 ` [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
  -- strict thread matches above, loose matches on Subject: below --
2015-01-09 10:16 Stefan Hajnoczi
2015-01-10 19:05 ` Peter Maydell
2015-01-10 19:10   ` Peter Maydell
2015-01-12  9:52     ` Fam Zheng
2015-01-12 10:32       ` Paolo Bonzini
2015-01-12 14:25   ` Stefan Hajnoczi
2014-09-05 16:13 Stefan Hajnoczi
2014-09-05 16:32 ` Peter Maydell
2013-08-30 14:30 Kevin Wolf
2013-08-30 17:14 ` Anthony Liguori
2013-09-02  8:24   ` Kevin Wolf
2013-06-07 11:58 Stefan Hajnoczi
2013-06-17 21:17 ` Anthony Liguori
2010-04-23 15:30 Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).