All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v5 0/7] monitor: enable OOB by default
@ 2018-06-20  7:32 Peter Xu
  2018-06-20  7:32 ` [Qemu-devel] [PATCH v5 1/7] chardev: comment details for CLOSED event Peter Xu
                   ` (8 more replies)
  0 siblings, 9 replies; 50+ messages in thread
From: Peter Xu @ 2018-06-20  7:32 UTC (permalink / raw)
  To: qemu-devel
  Cc: Marc-André Lureau, Daniel P . Berrange, Thomas Huth,
	Christian Borntraeger, Fam Zheng, Kevin Wolf, Max Reitz, peterx,
	Eric Auger, Eric Blake, John Snow, Peter Maydell,
	Markus Armbruster, Stefan Hajnoczi, Dr . David Alan Gilbert

v5:
- more r-bs are collected
- make sure no patch contains extra s-o-bs by doing proper indents for
  diff quotes [Markus]
- misc commit message or comment changes [Markus]

v4:
- collect some r-bs
- remove one extra s-o-b of mine in one patch [Thomas, Markus]
- split the qmp response flush patch into two; apply changes to commit
  message [Markus]
- fix up the doc update patch [Markus]

v3:
- drop patch "tests: iotests: don't compare SHUTDOWN event", replace
  it with "monitor: flush qmp responses when CLOSED" to fix up the
  race. [Eric, Markus]
- tweak the oob revert patch to not break qmp-test [Eric]
- quite a few comment and commit message fix-ups [Eric]
- add more comment in commit message, mention about why MUX can't be
  used for Out-Of-Band [Markus]
- one new patch to comment on chardev CLOSED event [Stefan]
- one new patch to fix iotest breakage on 060 specifically

Tests: make check, iotests

Please review.  Thanks,

Peter Xu (7):
  chardev: comment details for CLOSED event
  monitor: rename *_pop_one to *_pop_any
  monitor: flush qmp responses when CLOSED
  tests: iotests: drop some stderr line
  docs: mention shared state protect for OOB
  monitor: remove "x-oob", turn oob on by default
  Revert "tests: Add parameter to qtest_init_without_qmp_handshake"

 docs/devel/qapi-code-gen.txt | 17 +++++---
 include/chardev/char.h       | 11 +++++-
 include/monitor/monitor.h    |  1 -
 tests/libqtest.h             |  4 +-
 monitor.c                    | 75 +++++++++++++++++++++---------------
 tests/libqtest.c             | 10 ++---
 tests/qmp-test.c             |  6 +--
 vl.c                         |  5 ---
 tests/qemu-iotests/060       | 10 ++++-
 tests/qemu-iotests/060.out   |  1 -
 10 files changed, 83 insertions(+), 57 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 50+ messages in thread
* [Qemu-devel] (no subject)
@ 2016-11-16 19:41 Christopher Oliver
  2016-11-17 10:35 ` [Qemu-devel] your mail Kevin Wolf
  0 siblings, 1 reply; 50+ messages in thread
From: Christopher Oliver @ 2016-11-16 19:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, mreitz, kwolf

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

This patch (hack?) works around the slowness in SEEK_HOLE for large dense files
on Linux tmpfs.  It may improve life elsewhere as well, and the penalty of the checks
should be vanishingly small where it is not needed.

If I'm subtly (or not so subtly) wrong, please fire back.

Sincerely,

-- 
Christopher Oliver <current.input.port@gmail.com>

[-- Attachment #2: qemu-patch --]
[-- Type: application/octet-stream, Size: 2307 bytes --]

The following patch is a work-around for slow SEEK_HOLE on some filesystems.
Specifically, SEEK_HOLE on a dense file on Linux tmpfs is linear time in
the length.  This slows qemu-img to a crawl as it runs SEEK_DATA/SEEK_HOLE
pairs over the length of the image it's reading stepping by small deltas.

The key observation is that if the descriptor is read-only, and there are
no writers anywhere else (that's undefined behavior anyhow, right?), then a
hole seek in the interval from the previous start to the previously found
hole will find the same hole.

Signed-off-by: Christopher Oliver

diff --git a/block/raw-posix.c b/block/raw-posix.c
index 28b47d9..b45defe 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -136,6 +136,8 @@ typedef struct BDRVRawState {
     int type;
     int open_flags;
     size_t buf_align;
+    off_t last_hole;
+    off_t hole_follows;
 
 #ifdef CONFIG_XFS
     bool is_xfs:1;
@@ -470,6 +472,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
 
     s->has_discard = true;
     s->has_write_zeroes = true;
+    s->last_hole = -1;
     bs->supported_zero_flags = BDRV_REQ_MAY_UNMAP;
     if ((bs->open_flags & BDRV_O_NOCACHE) != 0) {
         s->needs_alignment = true;
@@ -1710,7 +1713,24 @@ static int find_allocation(BlockDriverState *bs, off_t start,
      * H4. offs < 0, errno != ENXIO: we learned nothing
      *     Pretend we know nothing at all, i.e. "forget" about D1.
      */
-    offs = lseek(s->fd, start, SEEK_HOLE);
+    /* Addendum: Since HOLE seeks are expensive on some filesystems
+     * (e.g. tmpfs) and holes don't change when an image is read only,
+     * cache the range from a start to a hold and return that value
+     * for requests in that interval.  Outside of that interval, seek
+     * and cache the new range.
+     */
+    if  ((s->open_flags & (O_RDWR|O_RDONLY)) == O_RDONLY) {
+        if (start <= s->last_hole && start >= s->hole_follows) {
+            offs = lseek(s->fd, s->last_hole, SEEK_SET);
+        } else {
+            offs = lseek(s->fd, start, SEEK_HOLE);
+            s->last_hole = offs;
+            s->hole_follows = start;
+        }
+    } else {
+        offs = lseek(s->fd, start, SEEK_HOLE);
+    }
+
     if (offs < 0) {
         return -errno;          /* D1 and (H3 or H4) */
     }

^ permalink raw reply related	[flat|nested] 50+ messages in thread
* [Qemu-devel] (no subject)
@ 2014-12-06 10:54 Jun Li
  2014-12-06 11:17 ` [Qemu-devel] your mail Jun Li
  0 siblings, 1 reply; 50+ messages in thread
From: Jun Li @ 2014-12-06 10:54 UTC (permalink / raw)
  To: Max Reitz; +Cc: josh.durgin, juli, qemu-devel

stefanha@redhat.com
Bcc: 
Subject: Re: [Qemu-devel] qcow2: Can create qcow2 image format on rbd server
Reply-To: 
In-Reply-To: <5481E4E7.9010402@redhat.com>

On Fri, 12/05 18:01, Max Reitz wrote:
> On 2014-12-05 at 16:32, Jun Li wrote:
> >Currently, qemu-img can not create qcow2 image format on rbd server. Analysis
> >the code as followings:
> >when create qcow2 format image:
> >qcow2_create2
> >   bdrv_create_file(filename, opts, &local_err);  --> Here will create a 0 size
> >   file(e.g: file1) on rbd server.
> >   ...
> >   ret = bdrv_pwrite(bs, 0, header, cluster_size); --> So here can not write
> >   qcow2 header into file1 due to the file1's length is 0. Seems
> >   qemu_rbd_aio_writev can not write beyond EOF.
> >   ...
> >
> >As above analysis, there are two methods to solve the above bz as followings:
> >1, When create file1, just create a fixed-size file1 on rbd server(not 0 size).
> 
> Should be possible by using -o preallocation=falloc or -o
> preallocation=full.

Sure. If bdrv_create_file(filename, opts, &local_err) create a fixed-size(not
0 size) just as using "preallocation=falloc or preallocation=full", it will
create a fixed-size file on rbd server. So it won't exist above issue.

> 
> I can't say a lot about making rbd growable because I know near to nothing
> about rbd; but there are protocols which really simply don't support writes
> beyond the end of file, and where that's intended (for instance, while nbd
> somehow does support it when using the qemu nbd server, normally (strictly
> according to the protocol) it does not); so for these protocols, you have to
> use a preallocated image file or an image format which does not grow on
> writes (such as raw).
> 

Here just want to use rbd_resize to realize rbd growable.

> Of course, while that may be a solution for nbd, it doesn't sound like a
> good solution for rbd, so writes beyond the EOF should probably be supported
> there (although once again, I don't know rbd well enough to judge that).
> 

Yes, you are right. Also talked with stefan. Here just want to ask Josh Durgin
whether it has other solutions or rbd can support asynchronous rbd_resize.

Regards,
Jun Li

> 
> >2, When write the qcow2 header into file1, just let qemu_rbd_aio_writev can
> >enlarge the file1. So should add qemu_rbd_truncate inside qemu_rbd_aio_writev.
> >qemu_rbd_truncate will call rbd_resize, but seems rbd_resize is
> >synchronous function. If so, when do bdrv_pwrite, guest will hang.This is not
> >our expected.
> >
> >For method 1, maybe it's not corresponding to the original principle of qcow2.
> >Yes, it's very easy to solve the above bz. Nevertheless, I just want to use
> >method 2 to solve above issue.
> >
> >For method 2, could anyone give some suggestions on howto realize a
> >asynchronous rbd_resize. Thanks.
> >
> >Above analysis also based on stefan's hints. Thanks.
> >
> >Best Regards,
> >Jun Li
> 

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

end of thread, other threads:[~2018-07-19 13:04 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-20  7:32 [Qemu-devel] [PATCH v5 0/7] monitor: enable OOB by default Peter Xu
2018-06-20  7:32 ` [Qemu-devel] [PATCH v5 1/7] chardev: comment details for CLOSED event Peter Xu
2018-06-20  7:32 ` [Qemu-devel] [PATCH v5 2/7] monitor: rename *_pop_one to *_pop_any Peter Xu
2018-06-20  7:32 ` [Qemu-devel] [PATCH v5 3/7] monitor: flush qmp responses when CLOSED Peter Xu
2018-06-20  8:33   ` Markus Armbruster
2018-06-20  8:38     ` Peter Xu
2018-06-20  9:50       ` Markus Armbruster
2018-06-20  7:32 ` [Qemu-devel] [PATCH v5 4/7] tests: iotests: drop some stderr line Peter Xu
2018-06-20  8:35   ` Markus Armbruster
2018-06-20  7:32 ` [Qemu-devel] [PATCH v5 5/7] docs: mention shared state protect for OOB Peter Xu
2018-06-20  7:32 ` [Qemu-devel] [PATCH v5 6/7] monitor: remove "x-oob", turn oob on by default Peter Xu
2018-06-20  7:32 ` [Qemu-devel] [PATCH v5 7/7] Revert "tests: Add parameter to qtest_init_without_qmp_handshake" Peter Xu
2018-06-26 17:21 ` [Qemu-devel] (no subject) Markus Armbruster
2018-06-27  7:38   ` [Qemu-devel] monitor: enable OOB by default Markus Armbruster
2018-06-27  8:41     ` Markus Armbruster
2018-06-27 10:20       ` Daniel P. Berrangé
2018-06-27 11:23         ` Markus Armbruster
2018-06-27 12:07           ` Peter Xu
2018-06-27 12:37             ` Eric Blake
2018-06-28  7:04               ` Markus Armbruster
2018-06-29  7:20                 ` Peter Xu
2018-06-28  6:55             ` Markus Armbruster
2018-06-28 11:43               ` Eric Blake
2018-06-29  8:18               ` Peter Xu
2018-06-27 13:13       ` Markus Armbruster
2018-06-27 13:28         ` Daniel P. Berrangé
2018-06-28 13:02           ` Markus Armbruster
2018-06-27 13:34         ` Peter Xu
2018-06-28 13:20           ` Markus Armbruster
2018-06-29  9:01             ` Peter Xu
2018-07-18 15:08               ` Markus Armbruster
2018-07-19 13:00                 ` Peter Xu
2018-06-27  7:40   ` Markus Armbruster
2018-06-27  8:35     ` Markus Armbruster
2018-06-27 12:32       ` Peter Xu
2018-06-28  9:29         ` Markus Armbruster
2018-06-29  9:42           ` Peter Xu
2018-06-27 13:36     ` Peter Xu
2018-06-27 11:59   ` [Qemu-devel] your mail Peter Xu
2018-06-28  8:31     ` Markus Armbruster
2018-06-28 11:51       ` Eric Blake
2018-06-28 12:00       ` Daniel P. Berrangé
2018-06-29  9:57         ` Peter Xu
2018-06-29 15:40           ` Eric Blake
2018-07-02  5:43   ` [Qemu-devel] monitor: enable OOB by default Markus Armbruster
2018-07-04  5:44     ` Peter Xu
2018-07-04  7:03       ` Markus Armbruster
2018-06-30 16:26 ` [Qemu-devel] [PATCH v5 0/7] " Markus Armbruster
  -- strict thread matches above, loose matches on Subject: below --
2016-11-16 19:41 [Qemu-devel] (no subject) Christopher Oliver
2016-11-17 10:35 ` [Qemu-devel] your mail Kevin Wolf
2014-12-06 10:54 [Qemu-devel] (no subject) Jun Li
2014-12-06 11:17 ` [Qemu-devel] your mail Jun Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.