Re: [PATCH v5 02/12] blkio: add libblkio block driver

2022-09-27 Thread Markus Armbruster
Stefan Hajnoczi writes: > libblkio (https://gitlab.com/libblkio/libblkio/) is a library for > high-performance disk I/O. It currently supports io_uring, > virtio-blk-vhost-user, and virtio-blk-vhost-vdpa with additional drivers > under development. > > One of the reasons for developing libblkio i

Re: [PATCH v11 18/21] job.c: enable job lock/unlock and remove Aiocontext locks

2022-09-27 Thread Paolo Bonzini
Il lun 26 set 2022, 14:21 Vladimir Sementsov-Ogievskiy < vsement...@yandex-team.ru> ha scritto: > On 9/18/22 20:12, Emanuele Giuseppe Esposito wrote: > >>> --- a/qemu-img.c > >>> +++ b/qemu-img.c > >>> @@ -911,7 +911,6 @@ static void run_block_job(BlockJob *job, Error > >>> **errp) > >>>Ai

[PATCH v5 11/12] blkio: implement BDRV_REQ_REGISTERED_BUF optimization

2022-09-27 Thread Stefan Hajnoczi
Avoid bounce buffers when QEMUIOVector elements are within previously registered bdrv_register_buf() buffers. The idea is that emulated storage controllers will register guest RAM using bdrv_register_buf() and set the BDRV_REQ_REGISTERED_BUF on I/O requests. Therefore no blkio_map_mem_region() cal

[PATCH v5 12/12] virtio-blk: use BDRV_REQ_REGISTERED_BUF optimization hint

2022-09-27 Thread Stefan Hajnoczi
Register guest RAM using BlockRAMRegistrar and set the BDRV_REQ_REGISTERED_BUF flag so block drivers can optimize memory accesses in I/O requests. This is for vdpa-blk, vhost-user-blk, and other I/O interfaces that rely on DMA mapping/unmapping. Signed-off-by: Stefan Hajnoczi --- include/hw/vir

[PATCH v5 06/12] block: add BDRV_REQ_REGISTERED_BUF request flag

2022-09-27 Thread Stefan Hajnoczi
Block drivers may optimize I/O requests accessing buffers previously registered with bdrv_register_buf(). Checking whether all elements of a request's QEMUIOVector are within previously registered buffers is expensive, so we need a hint from the user to avoid costly checks. Add a BDRV_REQ_REGISTER

[PATCH v5 05/12] block: use BdrvRequestFlags type for supported flag fields

2022-09-27 Thread Stefan Hajnoczi
Use the enum type so GDB displays the enum members instead of printing a numeric constant. Signed-off-by: Stefan Hajnoczi --- include/block/block_int-common.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/block/block_int-common.h b/include/block/block_int-co

Re: [PATCH 1/1] 9pfs: avoid iterator invalidation in v9fs_mark_fids_unreclaim

2022-09-27 Thread Greg Kurz
On Tue, 27 Sep 2022 19:14:33 +0200 Christian Schoenebeck wrote: > On Dienstag, 27. September 2022 15:05:13 CEST Linus Heckemann wrote: > > Christian Schoenebeck writes: > > > Ah, you sent this fix as a separate patch on top. I actually just meant > > > that you would take my already queued patch

[PATCH v5 09/12] exec/cpu-common: add qemu_ram_get_fd()

2022-09-27 Thread Stefan Hajnoczi
Add a function to get the file descriptor for a RAMBlock. Device emulation code typically uses the MemoryRegion APIs but vhost-style code may use RAMBlock directly for sharing guest memory with another process. This new API will be used by the libblkio block driver so it can share guest memory via

[PATCH v5 10/12] stubs: add qemu_ram_block_from_host() and qemu_ram_get_fd()

2022-09-27 Thread Stefan Hajnoczi
The blkio block driver will need to look up the file descriptor for a given pointer. This is possible in softmmu builds where the RAMBlock API is available for querying guest RAM. Add stubs so tools like qemu-img that link the block layer still build successfully. In this case there is no guest RA

[PATCH v5 08/12] block: add BlockRAMRegistrar

2022-09-27 Thread Stefan Hajnoczi
Emulated devices and other BlockBackend users wishing to take advantage of blk_register_buf() all have the same repetitive job: register RAMBlocks with the BlockBackend using RAMBlockNotifier. Add a BlockRAMRegistrar API to do this. A later commit will use this from hw/block/virtio-blk.c. Signed-

[PATCH v5 07/12] block: return errors from bdrv_register_buf()

2022-09-27 Thread Stefan Hajnoczi
Registering an I/O buffer is only a performance optimization hint but it is still necessary to return errors when it fails. Later patches will need to detect errors when registering buffers but an immediate advantage is that error_report() calls are no longer needed in block driver .bdrv_register_

[PATCH v5 03/12] numa: call ->ram_block_removed() in ram_block_notifer_remove()

2022-09-27 Thread Stefan Hajnoczi
When a RAMBlockNotifier is added, ->ram_block_added() is called with all existing RAMBlocks. There is no equivalent ->ram_block_removed() call when a RAMBlockNotifier is removed. The util/vfio-helpers.c code (the sole user of RAMBlockNotifier) is fine with this asymmetry because it does not rely o

[PATCH v5 04/12] block: pass size to bdrv_unregister_buf()

2022-09-27 Thread Stefan Hajnoczi
The only implementor of bdrv_register_buf() is block/nvme.c, where the size is not needed when unregistering a buffer. This is because util/vfio-helpers.c can look up mappings by address. Future block drivers that implement bdrv_register_buf() may not be able to do their job given only the buffer

[PATCH v5 02/12] blkio: add libblkio block driver

2022-09-27 Thread Stefan Hajnoczi
libblkio (https://gitlab.com/libblkio/libblkio/) is a library for high-performance disk I/O. It currently supports io_uring, virtio-blk-vhost-user, and virtio-blk-vhost-vdpa with additional drivers under development. One of the reasons for developing libblkio is that other applications besides QEM

[PATCH v5 01/12] coroutine: add flag to re-queue at front of CoQueue

2022-09-27 Thread Stefan Hajnoczi
When a coroutine wakes up it may determine that it must re-queue. Normally coroutines are pushed onto the back of the CoQueue, but for fairness it may be necessary to push it onto the front of the CoQueue. Add a flag to specify that the coroutine should be pushed onto the front of the CoQueue. A l

[PATCH v5 00/12] blkio: add libblkio BlockDriver

2022-09-27 Thread Stefan Hajnoczi
v5: - Drop "RFC" since libblkio 1.0 has been released and the library API is stable - Disable BDRV_REQ_REGISTERED_BUF if we run out of blkio_mem_regions. The bounce buffer slow path is taken when there are not enough blkio_mem_regions to cover guest RAM. [Hanna & David Hildenbrand] - Call ram_b

Re: [PATCH v5] 9pfs: use GHashTable for fid table

2022-09-27 Thread Christian Schoenebeck
On Dienstag, 27. September 2022 17:14:57 CEST Linus Heckemann wrote: > Linus Heckemann writes: > > static void coroutine_fn virtfs_reset(V9fsPDU *pdu) > > { > > > > V9fsState *s = pdu->s; > > V9fsFidState *fidp; > > > > +GList *freeing; > > +/* Get a list of all the values (

Re: [PATCH v5] 9pfs: use GHashTable for fid table

2022-09-27 Thread Christian Schoenebeck
On Dienstag, 27. September 2022 16:25:03 CEST Linus Heckemann wrote: > The previous implementation would iterate over the fid table for > lookup operations, resulting in an operation with O(n) complexity on > the number of open files and poor cache locality -- for every open, > stat, read, write, e

Re: [PATCH 1/1] 9pfs: avoid iterator invalidation in v9fs_mark_fids_unreclaim

2022-09-27 Thread Christian Schoenebeck
On Dienstag, 27. September 2022 15:05:13 CEST Linus Heckemann wrote: > Christian Schoenebeck writes: > > Ah, you sent this fix as a separate patch on top. I actually just meant > > that you would take my already queued patch as the latest version (just > > because I had made some minor changes on

Re: [PULL 0/1] Block patches

2022-09-27 Thread Stefan Hajnoczi
Applied, thanks. Please update the changelog at https://wiki.qemu.org/ChangeLog/7.2 for any user-visible changes. signature.asc Description: PGP signature

[PATCH v5] 9pfs: use GHashTable for fid table

2022-09-27 Thread Linus Heckemann
The previous implementation would iterate over the fid table for lookup operations, resulting in an operation with O(n) complexity on the number of open files and poor cache locality -- for every open, stat, read, write, etc operation. This change uses a hashtable for this instead, significantly i

Re: [PATCH v5] 9pfs: use GHashTable for fid table

2022-09-27 Thread Linus Heckemann
Linus Heckemann writes: > static void coroutine_fn virtfs_reset(V9fsPDU *pdu) > { > V9fsState *s = pdu->s; > V9fsFidState *fidp; > +GList *freeing; > +/* Get a list of all the values (fid states) in the table, which we > then... */ > +g_autoptr(GList) fids = g_hash_table_g

Re: [PATCH 1/1] 9pfs: avoid iterator invalidation in v9fs_mark_fids_unreclaim

2022-09-27 Thread Linus Heckemann
Christian Schoenebeck writes: > Ah, you sent this fix as a separate patch on top. I actually just meant that > you would take my already queued patch as the latest version (just because I > had made some minor changes on my end) and adjust that patch further as v4. > > Anyway, there are still s

[PATCH v4] block: Refactor get_tmp_filename()

2022-09-27 Thread Bin Meng
From: Bin Meng At present there are two callers of get_tmp_filename() and they are inconsistent. One does: /* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */ char *tmp_filename = g_malloc0(PATH_MAX + 1); ... ret = get_tmp_filename(tmp_filename, PATH_MAX + 1);

[PATCH v4 40/54] tests/qtest: ide-test: Open file in binary mode

2022-09-27 Thread Bin Meng
From: Xuzhou Cheng By default Windows opens file in text mode, while a POSIX compliant implementation treats text files and binary files the same. The fopen() 'mode' string can include the letter 'b' to indicate binary mode shall be used. POSIX spec says the character 'b' shall have no effect, b

[PATCH v4 37/54] tests/qtest: {ahci, ide}-test: Use relative path for temporary files for win32

2022-09-27 Thread Bin Meng
From: Bin Meng These test cases uses "blkdebug:path/to/config:path/to/image" for testing. On Windows, absolute file paths contain the delimiter ':' which causes the blkdebug filename parser fail to parse filenames. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau Reviewed-by: Thomas Huth

[PATCH v4 13/54] tests/qtest: ide-test: Avoid using hardcoded /tmp

2022-09-27 Thread Bin Meng
From: Bin Meng This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- (no changes since v3) Changes in v3: - Split to a separate patch tests/qtest/i

[PATCH v4 19/54] tests/qtest: virtio-blk-test: Avoid using hardcoded /tmp

2022-09-27 Thread Bin Meng
From: Bin Meng This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- (no changes since v3) Changes in v3: - Split to a separate patch tests/qtest/v

[PATCH v4 25/54] block/vvfat: Unify the mkdir() call

2022-09-27 Thread Bin Meng
From: Bin Meng There is a difference in the mkdir() call for win32 and non-win32 platforms, and currently is handled in the codes with #ifdefs. glib provides a portable g_mkdir() API and we can use it to unify the codes without #ifdefs. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau -

[PATCH v4 00/54] tests/qtest: Enable running qtest on Windows

2022-09-27 Thread Bin Meng
In preparation to adding virtio-9p support on Windows, this series enables running qtest on Windows, so that we can run the virtio-9p tests on Windows to make sure it does not break accidently. Changes in v4: - Do not use g_autofree and g_steal_pointer - Update the error reporting by using the GEr

[PATCH v4 09/54] tests/qtest: fdc-test: Avoid using hardcoded /tmp

2022-09-27 Thread Bin Meng
From: Bin Meng This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng Reviewed-by: Marc-André Lureau --- (no changes since v3) Changes in v3: - Split to a separate patch tests/qtest/f

[PATCH v4 05/54] tests/qtest: ahci-test: Avoid using hardcoded /tmp

2022-09-27 Thread Bin Meng
From: Bin Meng This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng Reviewed-by: Thomas Huth --- (no changes since v3) Changes in v3: - Split to a separate patch - Ensure g_autofree v

Re: [PATCH v15 0/6] hmp,qmp: Add commands to introspect virtio devices

2022-09-27 Thread Jonah Palmer
Hey Michael, when you get the chance, could you review these patches for me? Specifically patch 3/6, as that has the majority of the changes made for this series. Thanks! Jonah From: Jonah Palmer Sent: Thursday, August 11, 2022 8:26 AM To: qemu-de...@nongnu.org

Re: [PATCH v2] block: Refactor get_tmp_filename()

2022-09-27 Thread Markus Armbruster
Bin Meng writes: > Hi Markus, > > On Tue, Sep 27, 2022 at 2:22 PM Markus Armbruster wrote: >> >> Bin Meng writes: >> >> > On Mon, Sep 26, 2022 at 6:13 PM Markus Armbruster >> > wrote: >> >> >> >> Bin Meng writes: >> >> >> >> > From: Bin Meng >> >> > >> >> > At present there are two callers