Re: [PATCH] scsi-disk: Don't silently truncate serial number

2024-06-06 Thread Paolo Bonzini
Queued, thanks. Paolo

[PATCH] virtio-blk: remove SCSI passthrough functionality

2024-05-08 Thread Paolo Bonzini
-by: Paolo Bonzini --- docs/about/deprecated.rst | 10 -- docs/about/removed-features.rst | 8 ++ hw/block/virtio-blk.c | 166 +++- hw/core/machine.c | 2 - 4 files changed, 19 insertions(+), 167 deletions(-) diff --git a/docs/about

Re: [PATCH for-9.1 4/9] Bump minimum glib version to v2.66

2024-04-12 Thread Paolo Bonzini
On 4/12/24 12:58, Thomas Huth wrote: On 12/04/2024 12.16, Paolo Bonzini wrote: On Thu, Mar 28, 2024 at 3:06 PM Thomas Huth wrote: Now that we dropped support for CentOS 8 and Ubuntu 20.04, we can look into bumping the glib version to a new minimum for further clean-ups. According

Re: [PATCH for-9.1 4/9] Bump minimum glib version to v2.66

2024-04-12 Thread Paolo Bonzini
On Thu, Mar 28, 2024 at 3:06 PM Thomas Huth wrote: > > Now that we dropped support for CentOS 8 and Ubuntu 20.04, we can > look into bumping the glib version to a new minimum for further > clean-ups. According to repology.org, available versions are: > > CentOS Stream 9: 2.66.7 > Debian

Re: [RFC 0/3] aio-posix: call ->poll_end() when removing AioHandler

2024-01-03 Thread Paolo Bonzini
On 1/3/24 12:40, Fiona Ebner wrote: I'm happy to report that I cannot reproduce the CPU-usage-spike issue with the patch, but I did run into an assertion failure when trying to verify that it fixes my original stuck-guest-IO issue. See below for the backtrace [0]. Hanna wrote in

Re: [RFC 0/3] aio-posix: call ->poll_end() when removing AioHandler

2024-01-02 Thread Paolo Bonzini
On Tue, Jan 2, 2024 at 4:24 PM Hanna Czenczek wrote: > I’ve attached the preliminary patch that I didn’t get to send (or test > much) last year. Not sure if it has the same CPU-usage-spike issue > Fiona was seeing, the only functional difference is that I notify the vq > after attaching the

Re: [PATCH 3/6] fixup scsi: only access SCSIDevice->requests from one thread

2023-12-20 Thread Paolo Bonzini
hot(ctx, scsi_device_for_each_req_async_bh, +g_steal_pointer()); return; } Reviewed-by: Paolo Bonzini

Re: [PATCH 4/6] nbd/server: avoid per-NBDRequest nbd_client_get/put()

2023-12-20 Thread Paolo Bonzini
stData *req) } nbd_client_receive_next_request(client); - -nbd_client_put(client); } static void blk_aio_attached(AioContext *ctx, void *opaque) Reviewed-by: Paolo Bonzini

Re: [PATCH 6/6] nbd/server: introduce NBDClient->lock to protect fields

2023-12-20 Thread Paolo Bonzini
On 12/21/23 02:49, Stefan Hajnoczi wrote: nbd_client_receive_next_request(client); + +qemu_mutex_unlock(>lock); + if (ret == -EIO) { goto disconnect; } I think I slightly prefer if disconnect is reached with lock taken, for consistency with the "done" label.

Re: [PATCH 5/6] nbd/server: only traverse NBDExport->clients from main loop thread

2023-12-20 Thread Paolo Bonzini
On 12/21/23 02:49, Stefan Hajnoczi wrote: The NBD clients list is currently accessed from both the export AioContext and the main loop thread. When the AioContext lock is removed there will be nothing protecting the clients list. Adding a lock around the clients list is tricky because NBDClient

Re: [RFC 0/3] aio-posix: call ->poll_end() when removing AioHandler

2023-12-18 Thread Paolo Bonzini
On Mon, Dec 18, 2023 at 1:41 PM Fiona Ebner wrote: > I think it's because of nested drains, because when additionally > checking that the drain count is zero and only executing the loop then, > that issue doesn't seem to manifest But isn't virtio_scsi_drained_end only run if bus->drain_count ==

Re: [RFC 3/3] aio-posix: call ->poll_end() when removing AioHandler

2023-12-14 Thread Paolo Bonzini
Il gio 14 dic 2023, 21:12 Stefan Hajnoczi ha scritto: > Since the fd may be bypassed until ->io_poll_end() returns, we must poll > one last time to check if an event snuck in right at the end without > making the fd readable. If polling detected an event, then we must do > something. We cannot

Re: [RFC 0/3] aio-posix: call ->poll_end() when removing AioHandler

2023-12-13 Thread Paolo Bonzini
On Wed, Dec 13, 2023 at 10:15 PM Stefan Hajnoczi wrote: > Alternatives welcome! (A cleaner version of this approach might be to forbid > cross-thread aio_set_fd_handler() calls and to refactor all > aio_set_fd_handler() callers so they come from the AioContext's home thread. > I'm starting to

Re: [RFC 3/3] aio-posix: call ->poll_end() when removing AioHandler

2023-12-13 Thread Paolo Bonzini
On Wed, Dec 13, 2023 at 10:15 PM Stefan Hajnoczi wrote: > -/* If a read is in progress, just mark the node as deleted */ > -if (ctx->walking_handlers > 0) { > -QLIST_INSERT_HEAD_RCU(>deleted_aio_handlers, node, > node_deleted); > -return false; > +/* If polling was

Re: [PATCH] tests/qemu-iotests/149: Use more inclusive language in this test

2023-11-09 Thread Paolo Bonzini
On 11/9/23 19:09, Thomas Huth wrote: Let's use 'allowlist' and 'ignorelist' here instead of problematic words. Signed-off-by: Thomas Huth --- tests/qemu-iotests/149 | 14 +++--- tests/qemu-iotests/149.out | 8 2 files changed, 11 insertions(+), 11 deletions(-) diff

Re: -drive if=none: can't we make this the default?

2023-10-16 Thread Paolo Bonzini
On 10/14/23 21:16, Michael Tokarev wrote: Can't we make -drive if=none the default? Yes, I know current default is ide, and whole world have to use if=none explicitly to undo this.  I think at this point we can deprecate if=ide default and switch to if=none in the next release.  I think it

Re: [PATCH v3 0/4] block: clean up coroutine versions of bdrv_{is_allocated, block_status}*

2023-09-26 Thread Paolo Bonzini
On Mon, Sep 4, 2023 at 12:03 PM Paolo Bonzini wrote: > > Provide coroutine versions of bdrv_is_allocated* and bdrv_block_status*, > since the underlying BlockDriver API is coroutine-based, and use > automatically-generated wrappers for the "mixed" versions. > > v2->

Re: [PULL 4/5] hw/ufs: Support for UFS logical unit

2023-09-15 Thread Paolo Bonzini
On 9/15/23 00:19, Jeuk Kim wrote: First, ufs-lu has a feature called "unit descriptor". This feature shows the status of the ufs-lu and only works with UFS-specific "query request" commands, not SCSI commands. This looks like something that can be implemented in the UFS subsystem. UFS also

Re: [PULL 4/5] hw/ufs: Support for UFS logical unit

2023-09-14 Thread Paolo Bonzini
On 9/7/23 20:16, Stefan Hajnoczi wrote: From: Jeuk Kim This commit adds support for ufs logical unit. The LU handles processing for the SCSI command, unit descriptor query request. This commit enables the UFS device to process IO requests. Signed-off-by: Jeuk Kim Reviewed-by: Stefan Hajnoczi

[PATCH] block: mark aio_poll as non-coroutine

2023-09-08 Thread Paolo Bonzini
It is forbidden to block on the event loop during a coroutine, as that can cause deadlocks due to recursive locking. Signed-off-by: Paolo Bonzini --- include/block/aio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/block/aio.h b/include/block/aio.h index

Re: deadlock when using iothread during backup_clean()

2023-09-05 Thread Paolo Bonzini
On 9/5/23 12:01, Fiona Ebner wrote: Can we assume block_job_remove_all_bdrv() to always hold the job's AioContext? I think so, see job_unref_locked(), job_prepare_locked() and job_finalize_single_locked(). These call the callbacks that ultimately get to block_job_remove_all_bdrv().

[PATCH v3 3/4] block: switch to co_wrapper for bdrv_is_allocated_*

2023-09-04 Thread Paolo Bonzini
Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- block/io.c | 53 ++-- include/block/block-io.h | 12 + 2 files changed, 14 insertions(+), 51 deletions(-) diff --git a/block/io.c b/block/io.c index ea358b6b994..81c9630dac1

[PATCH v3 4/4] block: convert more bdrv_is_allocated* and bdrv_block_status* calls to coroutine versions

2023-09-04 Thread Paolo Bonzini
Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- block/copy-before-write.c | 2 +- block/copy-on-read.c | 8 block/io.c| 6 +++--- block/mirror.c| 10 +- block/qcow2.c | 5 +++-- block/replication.c | 8

[PATCH v3 2/4] block: complete public block status API

2023-09-04 Thread Paolo Bonzini
Include both coroutine and non-coroutine versions, the latter being co_wrapper_mixed_bdrv_rdlock of the former. Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- block/io.c | 18 +- include/block/block-io.h | 17 +++-- 2 files changed, 16

[PATCH v3 0/4] block: clean up coroutine versions of bdrv_{is_allocated, block_status}*

2023-09-04 Thread Paolo Bonzini
Provide coroutine versions of bdrv_is_allocated* and bdrv_block_status*, since the underlying BlockDriver API is coroutine-based, and use automatically-generated wrappers for the "mixed" versions. v2->v3: cleaned up formatting Paolo Bonzini (4): block: rename the bdrv_co_block_

[PATCH v3 1/4] block: rename the bdrv_co_block_status static function

2023-09-04 Thread Paolo Bonzini
bdrv_block_status exists as a wrapper for bdrv_block_status_above, but the name of the (hypothetical) coroutine version, bdrv_co_block_status, is squatted by a random static function. Rename it to bdrv_co_do_block_status. Signed-off-by: Paolo Bonzini --- block/io.c | 21

Re: [PATCH v3] hw/ide/piix: properly initialize the BMIBA register

2023-07-12 Thread Paolo Bonzini
> According to the 82371FB documentation (82371FB.pdf, 2.3.9. BMIBA-BUS > MASTER INTERFACE BASE ADDRESS REGISTER, April 1997), the register is > 32bit wide. To properly reset it to default values, all 32bit need to be > cleared. Bit #0 "Resource Type Indicator (RTE)" needs to be enabled. Queued,

Re: [PATCH] qemu_cleanup: begin drained section after vm_shutdown()

2023-07-06 Thread Paolo Bonzini
Queued, thanks. Paolo

Re: [PATCH v2] hw/ide/piix: properly initialize the BMIBA register

2023-07-04 Thread Paolo Bonzini
On 7/3/23 22:33, Bernhard Beschow wrote: Paolo, Peter: Should we switch to pci_device_reset() in pci_xen_ide_unplug()? Or is device_cold_reset() supposed to do everything? device_cold_reset() does not reset state that is part of the bus, so I think it's consistent that it doesn't call

Re: [PATCH RFC 0/6] Switch iotests to pyvenv

2023-06-22 Thread Paolo Bonzini
Il gio 22 giu 2023, 23:18 John Snow ha scritto: > Possibly I could teach mkvenv a new trick, like "mkvenv init iotests" > and have the mkvenv script DTRT at that point, whatever that is -- > ideally exiting very quickly without doing anything. > Or maybe check itself should do the bootstrap if

Re: [PATCH RFC 0/6] Switch iotests to pyvenv

2023-06-22 Thread Paolo Bonzini
On Thu, Jun 22, 2023 at 11:08 PM John Snow wrote: > > On Thu, Jun 22, 2023 at 5:05 PM Paolo Bonzini wrote: > > > > On Thu, Jun 22, 2023 at 11:03 PM John Snow wrote: > > > If we always install it in editable mode, and the path where it is > >

Re: [PATCH RFC 0/6] Switch iotests to pyvenv

2023-06-22 Thread Paolo Bonzini
On Thu, Jun 22, 2023 at 11:03 PM John Snow wrote: > If we always install it in editable mode, and the path where it is > "installed" is what we expect it to be, it shouldn't have any problems > with being out of date I think. We could conceivably use the > "faux" package version the internal

Re: [RFC 4/6] migration: Deprecate -incoming

2023-06-22 Thread Paolo Bonzini
On Thu, Jun 22, 2023 at 5:26 PM Peter Xu wrote: > PS: we may want to postpone this to be later than migration_object_init(), > when/if there's a real patch. Yes, that's true. > > > The only incompatibility is for people who are using "," in an URI, > > > which is rare and only an issue for the

Re: [RFC 4/6] migration: Deprecate -incoming

2023-06-22 Thread Paolo Bonzini
On 6/22/23 10:52, Juan Quintela wrote: User friendliness. The problem is that if you use more than two channels with multifd, on the incoming side, you need to do: You're sacrificing user-friendliness for the 99.99% that don't use multifd, for an error (i.e. it's not even fixing the issue)

Re: [PATCH RFC 0/6] Switch iotests to pyvenv

2023-06-22 Thread Paolo Bonzini
On Wed, Jun 21, 2023 at 9:08 AM Paolo Bonzini wrote: > Maybe patch 4 can use distlib.scripts as well to create the check script in > the build directory? (Yes that's another mkvenv functionality...) On a phone > and don't have the docs at hand, so I am not sure. If not, your solution i

Re: [RFC 4/6] migration: Deprecate -incoming

2023-06-22 Thread Paolo Bonzini
On 6/21/23 09:08, Thomas Huth wrote:   if (strcmp(incoming, "defer") != 0) { +    warn_report("-incoming %s is deprecated, use -incoming defer and " +    " set the uri with migrate-incoming.", incoming);   qmp_migrate_incoming(incoming, _err);  

Re: [RFC 4/6] migration: Deprecate -incoming

2023-06-22 Thread Paolo Bonzini
On 6/12/23 22:51, Juan Quintela wrote: Shall we just leave it there? Or is deprecating it helps us in any form? See the patches two weeks ago when people complained that lisen(.., num) was too low. And there are other parameters that work the same way (that I convenientely had forgotten). So

Re: [PATCH RFC 0/6] Switch iotests to pyvenv

2023-06-21 Thread Paolo Bonzini
Il mer 21 giu 2023, 02:21 John Snow ha scritto: > Hi, this is ... a fairly incomplete series about trying to get iotests > to run out of the configure-time venv. I'm looking for some feedback, so > out to the list it goes. > > Primarily, I'm having doubts about these points: > > 1) I think I

Re: [PATCH 2/2] scsi/qemu-pr-helper: Use defaults [get/set]_multipath_config() impl

2023-06-05 Thread Paolo Bonzini
On 6/5/23 19:41, Philippe Mathieu-Daudé wrote: Commit b3f1c8c413 ("qemu-pr-helper: use new libmultipath API") declared the two [get/set]_multipath_config() functions to satisfy the 'new' API. The library already provides an internal implementation for these helpers, exposed as weak symbols.

Re: [PATCH v2 11/11] Revert "graph-lock: Disable locking for now"

2023-06-05 Thread Paolo Bonzini
On 6/5/23 10:57, Kevin Wolf wrote: void bdrv_graph_rdlock_main_loop(void) @@ -296,18 +276,13 @@ void assert_bdrv_graph_readable(void) { /* reader_count() is slow due to aio_context_list_lock lock contention */ /* TODO Reenable when wrlock is reenabled */ There's still a TODO

Re: [PATCH 01/12] file-posix: remove incorrect coroutine_fn calls

2023-06-01 Thread Paolo Bonzini
Il gio 1 giu 2023, 15:50 Eric Blake ha scritto: > > @@ -2696,7 +2696,7 @@ static int coroutine_fn > raw_co_truncate(BlockDriverState *bs, int64_t offset, > > } > > > > if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode)) { > > -int64_t cur_length = raw_co_getlength(bs); > > +

[PATCH 09/12] vhdx: mark more functions as coroutine_fns and GRAPH_RDLOCK

2023-06-01 Thread Paolo Bonzini
Mark functions as coroutine_fn when they are only called by other coroutine_fns and they can suspend. Change calls to co_wrappers to use the non-wrapped functions, which in turn requires adding GRAPH_RDLOCK annotations. Signed-off-by: Paolo Bonzini --- block/vhdx-log.c | 36

[PATCH 12/12] block: use bdrv_co_debug_event in coroutine context

2023-06-01 Thread Paolo Bonzini
, and switch whenever possible. Signed-off-by: Paolo Bonzini --- block/io.c | 4 ++-- block/qcow.c | 24 block/qcow2-cluster.c| 12 ++-- block/qcow2-refcount.c | 4 ++-- block/qcow2.c| 18 +- block/qed-table.c

[PATCH 04/12] bochs: mark more functions as coroutine_fns and GRAPH_RDLOCK

2023-06-01 Thread Paolo Bonzini
Mark functions as coroutine_fn when they are only called by other coroutine_fns and they can suspend. Change calls to co_wrappers to use the non-wrapped functions, which in turn requires adding GRAPH_RDLOCK annotations. Signed-off-by: Paolo Bonzini --- block/bochs.c | 7 --- 1 file changed

[PATCH 08/12] vmdk: mark more functions as coroutine_fns and GRAPH_RDLOCK

2023-06-01 Thread Paolo Bonzini
Mark functions as coroutine_fn when they are only called by other coroutine_fns and they can suspend. Change calls to co_wrappers to use the non-wrapped functions, which in turn requires adding GRAPH_RDLOCK annotations. Signed-off-by: Paolo Bonzini --- block/vmdk.c | 27

[PATCH 10/12] qcow2: mark more functions as coroutine_fns and GRAPH_RDLOCK

2023-06-01 Thread Paolo Bonzini
Mark functions as coroutine_fn when they are only called by other coroutine_fns and they can suspend. Change calls to co_wrappers to use the non-wrapped functions, which in turn requires adding GRAPH_RDLOCK annotations. Signed-off-by: Paolo Bonzini --- block/qcow2-bitmap.c | 26

[PATCH 05/12] block: mark another function as coroutine_fns and GRAPH_UNLOCKED

2023-06-01 Thread Paolo Bonzini
Mark functions as coroutine_fn when they are only called by other coroutine_fns and they can suspend. Because this function operates on a BlockBackend, mark it GRAPH_UNLOCKED. Signed-off-by: Paolo Bonzini --- block.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git

[PATCH 07/12] dmg: mark more functions as coroutine_fns and GRAPH_RDLOCK

2023-06-01 Thread Paolo Bonzini
Mark functions as coroutine_fn when they are only called by other coroutine_fns and they can suspend. Change calls to co_wrappers to use the non-wrapped functions, which in turn requires adding GRAPH_RDLOCK annotations. Signed-off-by: Paolo Bonzini --- block/dmg.c | 21 +++-- 1

[PATCH 03/12] vpc: mark more functions as coroutine_fns and GRAPH_RDLOCK

2023-06-01 Thread Paolo Bonzini
Mark functions as coroutine_fn when they are only called by other coroutine_fns and they can suspend. Change calls to co_wrappers to use the non-wrapped functions, which in turn requires adding GRAPH_RDLOCK annotations. Signed-off-by: Paolo Bonzini --- block/vpc.c | 52

[PATCH v2 2/4] block: complete public block status API

2023-06-01 Thread Paolo Bonzini
Include both coroutine and non-coroutine versions, the latter being co_wrapper_mixed_bdrv_rdlock of the former. Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- block/io.c | 18 +- include/block/block-io.h | 18 -- 2 files changed, 17

[PATCH v2 3/4] block: switch to co_wrapper for bdrv_is_allocated_*

2023-06-01 Thread Paolo Bonzini
Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- block/io.c | 53 ++-- include/block/block-io.h | 12 + 2 files changed, 14 insertions(+), 51 deletions(-) diff --git a/block/io.c b/block/io.c index 806715a5bbe3..2fae64ad1eb6

[PATCH v2 4/4] block: convert more bdrv_is_allocated* and bdrv_block_status* calls to coroutine versions

2023-06-01 Thread Paolo Bonzini
Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- block/copy-before-write.c | 2 +- block/copy-on-read.c | 8 block/io.c| 6 +++--- block/mirror.c| 10 +- block/qcow2.c | 5 +++-- block/replication.c | 8

[PATCH 11/12] block: use bdrv_co_getlength in coroutine context

2023-06-01 Thread Paolo Bonzini
bdrv_co_getlength was recently introduced, with bdrv_getlength becoming a wrapper for use in unknown context. Switch to bdrv_co_getlength when possible. Signed-off-by: Paolo Bonzini --- block/io.c| 10 +- block/parallels.c | 4 ++-- block/qcow.c | 6 +++--- block/vmdk.c

[PATCH 00/12] block: more fixes to coroutine_fn marking

2023-06-01 Thread Paolo Bonzini
*** BLURB HERE *** Paolo Bonzini (12): file-posix: remove incorrect coroutine_fn calls qed: mark more functions as coroutine_fns and GRAPH_RDLOCK vpc: mark more functions as coroutine_fns and GRAPH_RDLOCK bochs: mark more functions as coroutine_fns and GRAPH_RDLOCK block: mark another

[PATCH v2 0/3] block: remove separate bdrv_file_open callback

2023-06-01 Thread Paolo Bonzini
instead of .bdrv_file_open, and unify the two callbacks. Paolo v1->v2: fix bisectability Paolo Bonzini (3): block: make assertion more generic block: do not check bdrv_file_open block: remove separate bdrv_file_open callback block.c | 17 +++-- bl

[PATCH 06/12] cloop: mark more functions as coroutine_fns and GRAPH_RDLOCK

2023-06-01 Thread Paolo Bonzini
Mark functions as coroutine_fn when they are only called by other coroutine_fns and they can suspend. Change calls to co_wrappers to use the non-wrapped functions, which in turn requires adding GRAPH_RDLOCK annotations. Signed-off-by: Paolo Bonzini --- block/cloop.c | 9 + 1 file

[PATCH v2 3/3] block: remove separate bdrv_file_open callback

2023-06-01 Thread Paolo Bonzini
bdrv_file_open and bdrv_open are completely equivalent, they are never checked except to see which one to invoke. So merge them into a single one. Signed-off-by: Paolo Bonzini --- block.c | 4 +--- block/blkdebug.c | 2 +- block/blkio.c

[PATCH v2 1/3] block: make assertion more generic

2023-06-01 Thread Paolo Bonzini
.bdrv_needs_filename is only set for drivers that also set bdrv_file_open, i.e. protocol drivers. So we can make the assertion always, it will always pass for those drivers that use bdrv_open. Signed-off-by: Paolo Bonzini --- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH 02/12] qed: mark more functions as coroutine_fns and GRAPH_RDLOCK

2023-06-01 Thread Paolo Bonzini
Mark functions as coroutine_fn when they are only called by other coroutine_fns and they can suspend. Change calls to co_wrappers to use the non-wrapped functions, which in turn requires adding GRAPH_RDLOCK annotations. Signed-off-by: Paolo Bonzini --- block/qed-check.c | 5 +++-- block/qed.c

[PATCH 01/12] file-posix: remove incorrect coroutine_fn calls

2023-06-01 Thread Paolo Bonzini
, check_cache_dropped was only a coroutine_fn because it called raw_co_getlength, so it can be made non-coroutine as well. Signed-off-by: Paolo Bonzini --- block/file-posix.c | 29 + 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/block/file-posix.c b/block

[PATCH v2 2/3] block: do not check bdrv_file_open

2023-06-01 Thread Paolo Bonzini
The set of BlockDrivers that have .bdrv_file_open coincides with those that have .protocol_name and guess what---checking drv->bdrv_file_open is done to see if the driver is a protocol. So check drv->protocol_name instead. Signed-off-by: Paolo Bonzini --- block.c | 11 +--

[PATCH v2 0/4] block: clean up coroutine versions of bdrv_{is_allocated, block_status}*

2023-06-01 Thread Paolo Bonzini
Provide coroutine versions of bdrv_is_allocated* and bdrv_block_status*, since the underlying BlockDriver API is coroutine-based, and use automatically-generated wrappers for the "mixed" versions. Paolo v1->v2: rename the old bdrv_co_block_status to bdrv_co_do_block_status Pao

[PATCH v2 1/4] block: rename the bdrv_co_block_status static function

2023-06-01 Thread Paolo Bonzini
bdrv_block_status exists as a wrapper for bdrv_block_status_above, but the name of the (hypothetical) coroutine version, bdrv_co_block_status, is squatted by a random static function. Rename it to bdrv_do_block_status. Signed-off-by: Paolo Bonzini --- block/io.c | 19 +-- 1

Re: [PATCH 03/20] block: bdrv/blk_co_unref() for calls in coroutine context

2023-04-27 Thread Paolo Bonzini
Il gio 27 apr 2023, 19:00 Kevin Wolf ha scritto: > By the way, and slightly unrelated, can vrc somehow help with finding > places that call coroutine wrappers without holding the AioContext lock? > (This results in an abort() when AIO_WAIT_WHILE() tries to unlock the > AioContext.) This is one

Re: [PATCH 03/20] block: bdrv/blk_co_unref() for calls in coroutine context

2023-04-27 Thread Paolo Bonzini
Il mar 25 apr 2023, 19:32 Kevin Wolf ha scritto: > These functions must not be called in coroutine context, because they > need write access to the graph. > With these patches applied vrc is still complaining about calls to bdrv_unref_child from qcow2_do_open and qcow2_do_close. Otherwise, the

Re: [PATCH 2/3] block: do not check bdrv_file_open

2023-04-21 Thread Paolo Bonzini
On Thu, Jan 19, 2023 at 2:17 PM Kevin Wolf wrote: > > assert(!drv->bdrv_needs_filename || bs->filename[0]); > > -if (drv->bdrv_file_open) { > > +if (drv->bdrv_open) { > > ret = drv->bdrv_file_open(bs, options, open_flags, _err); > > } else if (drv->bdrv_open) { > >

Re: [PATCH 0/4] block: clean up coroutine versions of bdrv_{is_allocated, block_status}*

2023-04-21 Thread Paolo Bonzini
Ping. Paolo On Wed, Apr 5, 2023 at 12:32 PM Paolo Bonzini wrote: > > Provide coroutine versions of bdrv_is_allocated* and bdrv_block_status*, > since the underlying BlockDriver API is coroutine-based, and use > automatically-generated wrappers for the "mixed" version

Re: QMP (without OOB) function running in thread different from the main thread as part of aio_poll

2023-04-20 Thread Paolo Bonzini
Il gio 20 apr 2023, 08:11 Markus Armbruster ha scritto: > So, splicing in a bottom half unmoored monitor commands from the main > loop. We weren't aware of that, as our commit messages show. > > I guess the commands themselves don't care; all they need is the BQL. > > However, did we

Re: QMP (without OOB) function running in thread different from the main thread as part of aio_poll

2023-04-19 Thread Paolo Bonzini
Il mer 19 apr 2023, 16:11 Fiona Ebner ha scritto: Hi, while debugging a completely different issue, I was surprised to see do_qmp_dispatch_bh being run in a vCPU thread. I was under the impression that QMP functions are supposed to be executed in the main thread. Is that wrong While monitor

[PATCH 8.0 regression] block/nfs: do not poll within a coroutine

2023-04-12 Thread Paolo Bonzini
nvert bdrv_get_allocated_file_size() to co_wrapper", 2023-02-01) Signed-off-by: Paolo Bonzini --- block/nfs.c | 24 +--- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/block/nfs.c b/block/nfs.c index 351dc6ec8d14..417defc0cfef 100644 --- a/block/nfs.c +++ b/block/nfs.c

Re: [PATCH 8/8] block, block-backend: write some hot coroutine wrappers by hand

2023-04-07 Thread Paolo Bonzini
Il ven 7 apr 2023, 22:04 Eric Blake ha scritto: > On Fri, Apr 07, 2023 at 05:33:03PM +0200, Paolo Bonzini wrote: > > The introduction of the graph lock is causing blk_get_geometry, a hot > function > > used in the I/O path, to create a coroutine. However, the only part >

[PATCH 8.0 regression 0/8] block: remove bdrv_co_get_geometry coroutines from I/O hot path

2023-04-07 Thread Paolo Bonzini
I'm not sure how we can avoid the regression, if not by disabling completely the graph lock (!) or applying this large series. I'm throwing this out before disappearing for a couple days for Easter; I have only tested it with qemu-iotests and "make check-unit". Thanks, Paolo Paolo Bon

[PATCH 3/8] block: refresh bs->total_sectors on reopen

2023-04-07 Thread Paolo Bonzini
instead, together with the existing bdrv_refresh_limits. Signed-off-by: Paolo Bonzini --- block.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block.c b/block.c index b1b7c7efe036..9de50ac7c811 100644 --- a/block.c +++ b/block.c @@ -4918,6 +4918,7 @@ static void bdrv_reopen_commit

[PATCH 2/8] block: remove has_variable_length from filters

2023-04-07 Thread Paolo Bonzini
Filters automatically get has_variable_length from their underlying BlockDriverState. There is no need to mark them as variable-length in the BlockDriver. Signed-off-by: Paolo Bonzini --- block/copy-on-read.c| 1 - block/filter-compress.c | 1 - block/preallocate.c | 1 - block

[PATCH 7/8] block-backend: ignore inserted state in blk_co_nb_sectors

2023-04-07 Thread Paolo Bonzini
(). It will also make it possible to skip the creation of a coroutine in the (common) case where bs->bl.has_variable_length is false. Signed-off-by: Paolo Bonzini --- block/block-backend.c | 23 --- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/block/block-backend.

[PATCH 5/8] migration/block: replace uses of blk_nb_sectors that do not check result

2023-04-07 Thread Paolo Bonzini
Uses of blk_nb_sectors must check whether the result is negative. Otherwise, underflow can happen. Fortunately, alloc_aio_bitmap() and bmds_aio_inflight() both have an alternative way to retrieve the number of sectors in the file. Signed-off-by: Paolo Bonzini --- migration/block.c | 5 ++--- 1

[PATCH 1/8] block: move has_variable_length to BlockLimits

2023-04-07 Thread Paolo Bonzini
and initialize the field from the BlockDriver. Signed-off-by: Paolo Bonzini --- block.c | 2 +- block/io.c | 6 ++ include/block/block_int-common.h | 8 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index

[PATCH 6/8] block-backend: inline bdrv_co_get_geometry

2023-04-07 Thread Paolo Bonzini
bdrv_co_get_geometry is only used in blk_co_get_geometry. Inline it in there, to reduce the number of wrappers for bs->total_sectors. Signed-off-by: Paolo Bonzini --- block.c | 10 -- block/block-backend.c| 8 ++-- include/block/block-io.h | 3 --- 3 fi

[PATCH 4/8] block: remove has_variable_length from BlockDriver

2023-04-07 Thread Paolo Bonzini
Fill in the field in BlockLimits directly for host devices, and copy it from there for the raw format. Signed-off-by: Paolo Bonzini --- block/file-posix.c | 12 block/file-win32.c | 2 +- block/io.c | 2 -- block/raw-format.c

[PATCH 8/8] block, block-backend: write some hot coroutine wrappers by hand

2023-04-07 Thread Paolo Bonzini
devices. So, write by hand the three wrappers on the path from blk_co_get_geometry to bdrv_co_refresh_total_sectors, so that the coroutine wrapper is only created if bdrv_nb_sectors actually calls bdrv_refresh_total_sectors. Reported-by: Stefan Hajnoczi Signed-off-by: Paolo Bonzini --- block.c

[PATCH] block: add missing coroutine_fn annotations

2023-04-06 Thread Paolo Bonzini
After the recent introduction of many new coroutine callbacks, a couple calls from non-coroutine_fn to coroutine_fn have sneaked in; fix them. Signed-off-by: Paolo Bonzini --- block/mirror.c | 4 ++-- include/block/graph-lock.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions

[PATCH 2/3] block-backend: make global properties write-once

2023-04-05 Thread Paolo Bonzini
-by: Paolo Bonzini --- block/block-backend.c | 27 +++ block/commit.c| 4 ++-- block/export/export.c | 2 +- block/mirror.c| 4 ++-- block/parallels.c | 2 +- block/qcow.c

[PATCH 1/3] aio-posix: disable polling after aio_disable_external()

2023-04-05 Thread Paolo Bonzini
run. Signed-off-by: Paolo Bonzini --- util/aio-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/aio-posix.c b/util/aio-posix.c index a8be940f760d..0d22e3d6d37c 100644 --- a/util/aio-posix.c +++ b/util/aio-posix.c @@ -29,7 +29,7 @@ bool aio_poll_disabled

[PATCH 0/3] block-backend: avoid deadlocks due to early queuing of request

2023-04-05 Thread Paolo Bonzini
the wrong time. However, this is left for later. Paolo Based-on: <20230405101634.10537-1-pbonz...@redhat.com> Paolo Bonzini (3): aio-posix: disable polling after aio_disable_external() block-backend: make global properties write-once block-backend: delay application of request

Re: [PATCH 0/3] block: remove separate bdrv_file_open callback

2023-04-05 Thread Paolo Bonzini
On Thu, Mar 9, 2023 at 9:50 AM Paolo Bonzini wrote: > The value of the bdrv_file_open is sometimes checked to distinguish > protocol and format drivers, but apart from that there is no difference > between bdrv_file_open and bdrv_open. > > However, they can all be distinguished

[PATCH 4/4] block: convert more bdrv_is_allocated* and bdrv_block_status* calls to coroutine versions

2023-04-05 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- block/copy-before-write.c | 2 +- block/copy-on-read.c | 8 block/io.c| 6 +++--- block/mirror.c| 10 +- block/qcow2.c | 5 +++-- block/replication.c | 8 block/stream.c

[PATCH 2/4] block: complete public block status API

2023-04-05 Thread Paolo Bonzini
Include both coroutine and non-coroutine versions, the latter being co_wrapper_mixed_bdrv_rdlock of the former. Signed-off-by: Paolo Bonzini --- block/io.c | 18 +- include/block/block-io.h | 18 -- 2 files changed, 17 insertions(+), 19 deletions

[PATCH 0/4] block: clean up coroutine versions of bdrv_{is_allocated, block_status}*

2023-04-05 Thread Paolo Bonzini
Provide coroutine versions of bdrv_is_allocated* and bdrv_block_status*, since the underlying BlockDriver API is coroutine-based, and use automatically-generated wrappers for the "mixed" versions. Paolo Paolo Bonzini (4): block: rename the bdrv_co_block_status static function block

[PATCH 3/4] block: switch to co_wrapper for bdrv_is_allocated_*

2023-04-05 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- block/io.c | 53 ++-- include/block/block-io.h | 12 + 2 files changed, 14 insertions(+), 51 deletions(-) diff --git a/block/io.c b/block/io.c index 0aad0f57d8c7..cacde79a3e98 100644 --- a/block/io.c

[PATCH 1/4] block: rename the bdrv_co_block_status static function

2023-04-05 Thread Paolo Bonzini
bdrv_block_status exists as a wrapper for bdrv_block_status_above, but the name of the (hypothetical) coroutine version, bdrv_co_block_status, is squatted by a random static function. Rename it to bdrv_do_block_status. Signed-off-by: Paolo Bonzini --- block/io.c | 10 +- 1 file changed

[PATCH] nbd: a BlockExport always has a BlockBackend

2023-04-05 Thread Paolo Bonzini
exp->common.blk cannot be NULL, nbd_export_delete() is only called from blk_exp_unref() and in turn that can only happen after blk_exp_add() has asserted exp->blk != NULL. Signed-off-by: Paolo Bonzini --- nbd/server.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-)

Re: [PATCH] aio-wait: avoid AioContext lock in aio_wait_bh_oneshot()

2023-04-04 Thread Paolo Bonzini
not be held across aio_wait_bh_oneshot(). Holding a lock across aio_poll() can cause deadlock so we don't want callers to do that. This is a step towards getting rid of the AioContext lock. Reviewed-by: Paolo Bonzini Paolo

Re: [PATCH v2 for 8.0?] nbd/server: Request TCP_NODELAY

2023-04-04 Thread Paolo Bonzini
CHANNEL(sioc), false); object_ref(OBJECT(client->sioc)); client->ioc = QIO_CHANNEL(sioc); object_ref(OBJECT(client->ioc)); base-commit: efcd0ec14b0fe9ee0ee70277763b2d538d19238d Acked-by: Paolo Bonzini

Re: [PATCH] block/nvme: use AIO_WAIT_WHILE_UNLOCKED()

2023-04-04 Thread Paolo Bonzini
q, req, cmd, nvme_admin_cmd_sync_cb, ); -AIO_WAIT_WHILE(aio_context, ret == -EINPROGRESS); +AIO_WAIT_WHILE_UNLOCKED(NULL, ret == -EINPROGRESS); return ret; } Reviewed-by: Paolo Bonzini

Re: [PATCH 01/13] virtio-scsi: avoid race between unplug and transport event

2023-04-04 Thread Paolo Bonzini
On 4/4/23 15:06, Stefan Hajnoczi wrote: Would this be more useful as a qdev_is_realized() helper? Yes. There are no other users, but I think a helper makes sense. Agreed; anyway, Reviewed-by: Paolo Bonzini Paolo

Re: [PATCH 11/13] block/fuse: take AioContext lock around blk_exp_ref/unref()

2023-04-04 Thread Paolo Bonzini
On 4/3/23 20:30, Stefan Hajnoczi wrote: These functions must be called with the AioContext acquired: /* Callers must hold exp->ctx lock */ void blk_exp_ref(BlockExport *exp) ... /* Callers must hold exp->ctx lock */ void blk_exp_unref(BlockExport *exp) Signed-off-by: Stefan

Re: [PATCH 00/13] block: remove aio_disable_external() API

2023-04-04 Thread Paolo Bonzini
On 4/3/23 20:29, Stefan Hajnoczi wrote: The aio_disable_external() API temporarily suspends file descriptor monitoring in the event loop. The block layer uses this to prevent new I/O requests being submitted from the guest and elsewhere between bdrv_drained_begin() and bdrv_drained_end(). While

Re: [PATCH 04/13] util/vhost-user-server: rename refcount to in_flight counter

2023-04-04 Thread Paolo Bonzini
qemu_coroutine_yield(); server->wait_idle = false; } -assert(server->refcount == 0); +assert(server->in_flight == 0); vu_deinit(vu_dev); Reviewed-by: Paolo Bonzini

Re: [PATCH 02/13] virtio-scsi: stop using aio_disable_external() during unplug

2023-04-04 Thread Paolo Bonzini
aio_disable_external(ctx); qdev_simple_device_unplug_cb(hotplug_dev, dev, errp); -aio_enable_external(ctx); if (s->ctx) { virtio_scsi_acquire(s); Reviewed-by: Paolo Bonzini

Re: [PATCH for 8.0] tests/qemu-iotests: explicitly invoke 'check' via 'python'

2023-03-29 Thread Paolo Bonzini
env: qemu_iotests_env, Reviewed-by: Paolo Bonzini Paolo

  1   2   3   4   5   6   7   8   9   10   >