Re: [PATCH v5 00/18] tests/qtest: Enable running qtest on Windows

2022-10-06 Thread Bin Meng
On Fri, Oct 7, 2022 at 4:35 AM Alex Bennée wrote: > > > Bin Meng writes: > > > 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. > > I'm happy to

Re: [PATCH v10 3/7] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls

2022-10-06 Thread Damien Le Moal
On 10/7/22 00:17, Stefan Hajnoczi wrote: > On Tue, Oct 04, 2022 at 08:23:15AM +0900, Damien Le Moal wrote: >> On 2022/10/04 2:47, Stefan Hajnoczi wrote: >>> On Thu, Sep 29, 2022 at 04:36:27PM +0800, Sam Li wrote: Add a new zoned_host_device BlockDriver. The zoned_host_device option accept

Re: [PATCH v3 0/8] m25p80: Add SFDP support

2022-10-06 Thread Patrick Williams
On Fri, Jul 22, 2022 at 08:35:54AM +0200, Cédric Le Goater wrote: > > Cédric Le Goater (8): > m25p80: Add basic support for the SFDP command > m25p80: Add the n25q256a SFDP table > m25p80: Add the mx25l25635e SFPD table > m25p80: Add the mx25l25635f SFPD table > m25p80: Add the mx66l1g45

[PATCH] m25p80: Add the w25q01jvq SFPD table

2022-10-06 Thread Patrick Williams
Generated from hardware using the following command and then padding with 0xff to fill out a power-of-2: hexdump -v -e '8/1 "0x%02x, " "\n"' sfdp` Signed-off-by: Patrick Williams --- hw/block/m25p80.c | 3 ++- hw/block/m25p80_sfdp.c | 36 hw/block/m

[PATCH v6 13/13] virtio-blk: use BDRV_REQ_REGISTERED_BUF optimization hint

2022-10-06 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 v6 10/13] exec/cpu-common: add qemu_ram_get_fd()

2022-10-06 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 v6 11/13] stubs: add qemu_ram_block_from_host() and qemu_ram_get_fd()

2022-10-06 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 v6 08/13] numa: use QLIST_FOREACH_SAFE() for RAM block notifiers

2022-10-06 Thread Stefan Hajnoczi
Make list traversal work when a callback removes a notifier mid-traversal. This is a cleanup to prevent bugs in the future. Signed-off-by: Stefan Hajnoczi --- hw/core/numa.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/core/numa.c b/hw/core/numa.c index 31e6fe1

[PATCH v6 07/13] block: return errors from bdrv_register_buf()

2022-10-06 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 v6 05/13] block: use BdrvRequestFlags type for supported flag fields

2022-10-06 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

[PATCH v6 04/13] block: pass size to bdrv_unregister_buf()

2022-10-06 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 v6 12/13] blkio: implement BDRV_REQ_REGISTERED_BUF optimization

2022-10-06 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 v6 09/13] block: add BlockRAMRegistrar

2022-10-06 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 v6 03/13] numa: call ->ram_block_removed() in ram_block_notifer_remove()

2022-10-06 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 v6 06/13] block: add BDRV_REQ_REGISTERED_BUF request flag

2022-10-06 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 v6 02/13] blkio: add libblkio block driver

2022-10-06 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 v6 01/13] coroutine: add flag to re-queue at front of CoQueue

2022-10-06 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 v6 00/13] blkio: add libblkio BlockDriver

2022-10-06 Thread Stefan Hajnoczi
v6: - Add untested nvme-io_uring driver. Please test in your nested NVMe environment, Alberto. [Alberto] - Map blkio mem regions only when necessary to reduce conflicts with RAM discard [Alberto] - Reduce duplication by having a single blkio_virtio_blk_common_open() function [Alberto] - Avoid du

Re: [PATCH v5 00/18] tests/qtest: Enable running qtest on Windows

2022-10-06 Thread Alex Bennée
Bin Meng writes: > 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. I'm happy to take this whole series through my testing/next however I don't h

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

2022-10-06 Thread Stefan Hajnoczi
On Thu, Oct 06, 2022 at 05:41:39PM +0100, Alberto Faria wrote: > On Tue, Sep 27, 2022 at 8:34 PM Stefan Hajnoczi wrote: > > +static int blkio_virtio_blk_vhost_user_open(BlockDriverState *bs, > > +QDict *options, int flags, Error **errp) > > +{ > > +const char *path = qdict_get_try_str(

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

2022-10-06 Thread Alberto Faria
On Thu, Oct 6, 2022 at 7:46 PM Stefan Hajnoczi wrote: > > Regardless, I'd say we want to map memory regions even if we don't > > strictly need to (in cases where we can do so at no additional cost), > > since that may improve performance for some drivers. > > The downside is that when s->mem_regio

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

2022-10-06 Thread Stefan Hajnoczi
On Thu, Oct 06, 2022 at 07:09:36PM +0100, Alberto Faria wrote: > On Thu, Oct 6, 2022 at 7:00 PM Stefan Hajnoczi wrote: > > s->needs_mem_regions determines if we'll use libblkio memory regions at > > all. When it's false we skip blkio_map_mem_region() and therefore it's > > safe to set s->mem_regio

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

2022-10-06 Thread Alberto Faria
On Thu, Oct 6, 2022 at 7:00 PM Stefan Hajnoczi wrote: > s->needs_mem_regions determines if we'll use libblkio memory regions at > all. When it's false we skip blkio_map_mem_region() and therefore it's > safe to set s->mem_regions_pinned to false. blkio_register_buf() calls blkio_map_mem_region().

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

2022-10-06 Thread Stefan Hajnoczi
On Wed, Sep 28, 2022 at 09:12:36PM +0100, Alberto Campinho Faria wrote: > On Wed, Sep 28, 2022 at 8:21 PM Stefan Hajnoczi wrote: > > On Tue, Sep 27, 2022 at 03:34:30PM -0400, Stefan Hajnoczi wrote: > > > +ret = blkio_get_bool(s->blkio, > > > + "mem-regions-pinned", > >

Re: [PATCH v12 00/21] job: replace AioContext lock with job_mutex

2022-10-06 Thread Kevin Wolf
Am 26.09.2022 um 11:31 hat Emanuele Giuseppe Esposito geschrieben: > In this series, we want to remove the AioContext lock and instead > use the already existent job_mutex to protect the job structures > and list. This is part of the work to get rid of AioContext lock > usage in favour of smaller g

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

2022-10-06 Thread Stefan Hajnoczi
On Thu, Oct 06, 2022 at 02:18:35PM +0200, Stefano Garzarella wrote: > Hi Stefan, > I tested this series with the vDPA block simulator in Linux v6.0. > It worked well, but I had a segfault when blkio_map_mem_region() fails. > > In my case, it failed because I forgot to increase the `memlock` limit

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

2022-10-06 Thread Alberto Faria
On Tue, Sep 27, 2022 at 8:34 PM Stefan Hajnoczi wrote: > +static int blkio_virtio_blk_vhost_user_open(BlockDriverState *bs, > +QDict *options, int flags, Error **errp) > +{ > +const char *path = qdict_get_try_str(options, "path"); > +BDRVBlkioState *s = bs->opaque; > +int ret;

Re: [PATCH v12 16/21] blockjob: protect iostatus field in BlockJob struct

2022-10-06 Thread Kevin Wolf
Am 26.09.2022 um 11:32 hat Emanuele Giuseppe Esposito geschrieben: > iostatus is the only field (together with .job) that needs > protection using the job mutex. > > It is set in the main loop (GLOBAL_STATE functions) but read > in I/O code (block_job_error_action). > > In order to protect it, ch

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

2022-10-06 Thread Christian Schoenebeck
On Mittwoch, 5. Oktober 2022 11:38:39 CEST Christian Schoenebeck wrote: > On Dienstag, 4. Oktober 2022 14:54:16 CEST Christian Schoenebeck wrote: > > On Dienstag, 4. Oktober 2022 12:41:21 CEST Linus Heckemann wrote: > > > The previous implementation would iterate over the fid table for > > > lookup

[PATCH v5 05/18] block/vvfat: Unify the mkdir() call

2022-10-06 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 v5 00/18] tests/qtest: Enable running qtest on Windows

2022-10-06 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 v5: - Rebase on qemu/master - Drop patches that are already merged - Use g_autoptr(GError) -

Re: [PATCH 00/18] tests/qtest: Enable running qtest on Windows

2022-10-06 Thread Bin Meng
On Thu, Oct 6, 2022 at 11:11 PM Bin Meng wrote: > > 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 v5: > - Rebase on qemu/master > -

Re: [PATCH v10 3/7] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls

2022-10-06 Thread Stefan Hajnoczi
On Tue, Oct 04, 2022 at 08:23:15AM +0900, Damien Le Moal wrote: > On 2022/10/04 2:47, Stefan Hajnoczi wrote: > > On Thu, Sep 29, 2022 at 04:36:27PM +0800, Sam Li wrote: > >> Add a new zoned_host_device BlockDriver. The zoned_host_device option > >> accepts only zoned host block devices. By adding z

Re: [PATCH] quorum: Remove unnecessary forward declaration

2022-10-06 Thread Philippe Mathieu-Daudé via
On 6/10/22 14:26, Kevin Wolf wrote: Signed-off-by: Kevin Wolf --- block/quorum.c | 2 -- 1 file changed, 2 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

[PATCH 05/18] block/vvfat: Unify the mkdir() call

2022-10-06 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 00/18] tests/qtest: Enable running qtest on Windows

2022-10-06 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 v5: - Rebase on qemu/master - Drop patches that are already merged - Use g_autoptr(GError) -

Re: [PATCH v2 2/2] virtio-blk: add zoned storage emulation for zoned devices

2022-10-06 Thread Stefan Hajnoczi
On Thu, Sep 29, 2022 at 05:48:21PM +0800, Sam Li wrote: > This patch extends virtio-blk emulation to handle zoned device commands > by calling the new block layer APIs to perform zoned device I/O on > behalf of the guest. It supports Report Zone, four zone oparations (open, > close, finish, reset),

Re: [PATCH v2 1/2] include: update virtio_blk headers from Linux 5.19-rc2+

2022-10-06 Thread Peter Maydell
On Thu, 29 Sept 2022 at 11:14, Sam Li wrote: > > Use scripts/update-linux-headers.sh to update virtio-blk headers > from Dmitry's "virtio-blk:add support for zoned block devices" > linux patch. There is a link for more information: > https://github.com/dmitry-fomichev/virtblk-zbd > > Signed-off-by

Re: [PATCH] quorum: Remove unnecessary forward declaration

2022-10-06 Thread Peter Maydell
On Thu, 6 Oct 2022 at 14:13, Kevin Wolf wrote: > > Signed-off-by: Kevin Wolf > --- > block/quorum.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/block/quorum.c b/block/quorum.c > index 970f63d9f9..f9e6539ceb 100644 > --- a/block/quorum.c > +++ b/block/quorum.c > @@ -232,8 +232,6 @@

Re: [PATCH v2 1/2] include: update virtio_blk headers from Linux 5.19-rc2+

2022-10-06 Thread Stefan Hajnoczi
On Thu, Sep 29, 2022 at 05:48:20PM +0800, Sam Li wrote: > Use scripts/update-linux-headers.sh to update virtio-blk headers > from Dmitry's "virtio-blk:add support for zoned block devices" > linux patch. There is a link for more information: > https://github.com/dmitry-fomichev/virtblk-zbd > > Sign

[PATCH] quorum: Remove unnecessary forward declaration

2022-10-06 Thread Kevin Wolf
Signed-off-by: Kevin Wolf --- block/quorum.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/block/quorum.c b/block/quorum.c index 970f63d9f9..f9e6539ceb 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -232,8 +232,6 @@ static bool quorum_has_too_much_io_failed(QuorumAIOCB *acb) retu

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

2022-10-06 Thread Stefano Garzarella
Hi Stefan, I tested this series with the vDPA block simulator in Linux v6.0. It worked well, but I had a segfault when blkio_map_mem_region() fails. In my case, it failed because I forgot to increase the `memlock` limit with `ulimit -l unlimited` since the simulator still requires locking all th

Re: [PATCH v3 00/26] block: fix coroutine_fn annotations

2022-10-06 Thread Kevin Wolf
Am 22.09.2022 um 10:48 hat Paolo Bonzini geschrieben: > As discussed at KVM Forum 2022, I am reposting this series to > add more coroutine_fn annotations. Fixing the annotations > enables static analysis of which functions are coroutine-only > and which are mixed (coroutine/non-coroutine). > > A

Re: [PATCH 06/26] blkdebug: add missing coroutine_fn annotations

2022-10-06 Thread Kevin Wolf
Am 05.10.2022 um 23:11 hat Paolo Bonzini geschrieben: > Il mer 5 ott 2022, 06:32 Kevin Wolf ha scritto: > > > Hm... blkdebug_debug_event() is called from bdrv_debug_event(), which is > > not coroutine_fn. And I think that it's not coroutine_fn is correct: > > For example, with 'qemu-img snapshot