Re: [RFC v4 4/9] file-posix: introduce get_sysfs_str_val for device zoned model.

2022-07-11 Thread Hannes Reinecke
On 7/12/22 04:13, Sam Li wrote: Signed-off-by: Sam Li --- block/file-posix.c | 60 include/block/block-common.h | 4 +-- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index 3161d39ea4..4

Re: [RFC v4 1/9] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls.

2022-07-11 Thread Sam Li
Hannes Reinecke 于2022年7月12日周二 14:10写道: > > On 7/12/22 04:13, Sam Li wrote: > > By adding zone management operations in BlockDriver, storage > > controller emulation can use the new block layer APIs including > > zone_report and zone_mgmt(open, close, finish, reset). > > > > Signed-off-by: Sam Li

Re: [RFC v4 2/9] qemu-io: add zoned block device operations.

2022-07-11 Thread Hannes Reinecke
On 7/12/22 04:13, Sam Li wrote: Add zoned storage commands of the device: zone_open(zo), zone_close(zc), zone_reset(zs), zone_report(zp), zone_finish(zf). For example, it can be called by: ./build/qemu-io --image-opts driver=zoned_host_device, filename=/dev/nullb0 -c "zone_report 0 0 1" Signed-

Re: [RFC v4 3/9] file-posix: introduce get_sysfs_long_val for a block queue of sysfs attribute

2022-07-11 Thread Hannes Reinecke
On 7/12/22 04:13, Sam Li wrote: Use sysfs attribute files to get the zoned device information in case that ioctl() commands of zone management interface won't work. Signed-off-by: Sam Li --- block/file-posix.c | 38 +++--- 1 file changed, 27 insertions(+), 11

Re: [RFC v4 1/9] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls.

2022-07-11 Thread Hannes Reinecke
On 7/12/22 04:13, Sam Li wrote: By adding zone management operations in BlockDriver, storage controller emulation can use the new block layer APIs including zone_report and zone_mgmt(open, close, finish, reset). Signed-off-by: Sam Li --- block/block-backend.c| 41 ++ block/c

Re: [RFC v4 0/9] Add support for zoned device

2022-07-11 Thread Sam Li
Markus Armbruster 于2022年7月12日周二 13:47写道: > > Sam Li writes: > > > This patch series adds support for zoned device to virtio-blk emulation. > > Zoned > > Storage can support sequential writes, which reduces write amplification in > > SSD, > > leading to higher write throughput and increased capa

Re: [RFC v4 0/9] Add support for zoned device

2022-07-11 Thread Markus Armbruster
Sam Li writes: > This patch series adds support for zoned device to virtio-blk emulation. Zoned > Storage can support sequential writes, which reduces write amplification in > SSD, > leading to higher write throughput and increased capacity. Forgive me if this has already been discussed, or is

Re: [PATCH v4 09/12] tests/vm: Remove docker cross-compile test from CentOS VM

2022-07-11 Thread Richard Henderson
On 7/8/22 21:05, John Snow wrote: The fedora container has since been split apart, so there's no suitable nearby target that would support "test-mingw" as it requires both x32 and x64 support -- so either fedora-cross-win32 nor fedora-cross-win64 would be truly suitable. Just remove this test as

Re: [PATCH v4 08/12] tests/vm: add 1GB extra memory per core

2022-07-11 Thread Richard Henderson
On 7/8/22 21:04, John Snow wrote: If you try to run a 16 or 32 threaded test, you're going to run out of memory very quickly with qom-test and a few others. Bump the memory limit to try to scale with larger-core machines. Granted, this means that a 16 core processor is going to ask for 16GB, but

Re: [PATCH v4 07/12] tests/vm: remove duplicate 'centos' VM test

2022-07-11 Thread Richard Henderson
On 7/8/22 21:04, John Snow wrote: This is listed twice by accident; we require genisoimage to run the test, so remove the unconditional entry. Signed-off-by: John Snow Reviewed-by: Thomas Huth Reviewed-by: Daniel P. Berrangé --- tests/vm/Makefile.include | 2 +- 1 file changed, 1 insertion(+)

Re: [PATCH v4 03/12] tests/vm: switch CentOS 8 to CentOS 8 Stream

2022-07-11 Thread Richard Henderson
On 7/8/22 21:04, John Snow wrote: The old CentOS image didn't work anymore because it was already EOL at the beginning of 2022. Signed-off-by: John Snow Reviewed-by: Thomas Huth Reviewed-by: Daniel P. Berrangé --- tests/vm/centos | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) R

Re: [PATCH v4 06/12] tests/vm: remove ubuntu.i386 VM test

2022-07-11 Thread Richard Henderson
On 7/8/22 21:04, John Snow wrote: Ubuntu 18.04 is out of our support window, and Ubuntu 20.04 does not support i386 anymore. The debian project does, but they do not provide any cloud images for it, a new expect-style script would have to be written. Since we have i386 cross-compiler tests hoste

Re: [PATCH v4 05/12] tests/vm: upgrade Ubuntu 18.04 VM to 20.04

2022-07-11 Thread Richard Henderson
On 7/8/22 21:04, John Snow wrote: 18.04 has fallen out of our support window, so move ubuntu.aarch64 forward to ubuntu 20.04, which is now our oldest supported Ubuntu release. Notes: This checksum changes periodically; use a fixed point image with a known checksum so that the image isn't re-dow

Re: [PATCH v4 04/12] tests/vm: switch centos.aarch64 to CentOS 8 Stream

2022-07-11 Thread Richard Henderson
On 7/8/22 21:04, John Snow wrote: Switch this test over to using a cloud image like the base CentOS8 VM test, which helps make this script a bit simpler too. Note: At time of writing, this test seems pretty flaky when run without KVM support for aarch64. Certain unit tests like migration-test, v

Re: [PATCH v4 02/12] tests/vm: use 'cp' instead of 'ln' for temporary vm images

2022-07-11 Thread Richard Henderson
On 7/8/22 21:04, John Snow wrote: If the initial setup fails, you've permanently altered the state of the downloaded image in an unknowable way. Use 'cp' like our other test setup scripts do. Signed-off-by: John Snow Reviewed-by: Thomas Huth Reviewed-by: Daniel P. Berrangé --- tests/vm/centos

[RFC v4 9/9] qapi: add support for zoned host device

2022-07-11 Thread Sam Li
--- block/file-posix.c | 8 +++- qapi/block-core.json | 7 +-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index e9ad1d8e1e..4e0aa02acf 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -3737,6 +3737,12 @@ static void

[RFC v4 7/9] config: add check to block layer

2022-07-11 Thread Sam Li
Putting zoned/non-zoned BlockDrivers on top of each other is not allowed. Signed-off-by: Sam Li --- block.c | 7 +++ block/file-posix.c | 2 ++ include/block/block_int-common.h | 5 + 3 files changed, 14 insertions(+) diff --git a/block.c b/block.c

[RFC v4 5/9] qemu-iotests: test new zone operations.

2022-07-11 Thread Sam Li
We have added new block layer APIs of zoned block devices. Test it with: (1) Create a null_blk device, run each zone operation on it and see whether reporting right zone information. Signed-off-by: Sam Li --- tests/qemu-iotests/tests/zoned.sh | 69 +++ 1 file changed,

[RFC v4 4/9] file-posix: introduce get_sysfs_str_val for device zoned model.

2022-07-11 Thread Sam Li
Signed-off-by: Sam Li --- block/file-posix.c | 60 include/block/block-common.h | 4 +-- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index 3161d39ea4..42708012ff 100644 --- a/block/file-pos

[RFC v4 3/9] file-posix: introduce get_sysfs_long_val for a block queue of sysfs attribute

2022-07-11 Thread Sam Li
Use sysfs attribute files to get the zoned device information in case that ioctl() commands of zone management interface won't work. Signed-off-by: Sam Li --- block/file-posix.c | 38 +++--- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/block/fil

[RFC v4 8/9] include: add support for zoned block devices

2022-07-11 Thread Sam Li
This is the virtio_blk.h header file from Dmitry's "virtio-blk: add support for zoned block devices" patch. It introduces virtio_blk_zoned_characteristics struct from Dmitry's virtio-blk zoned storage spec. Signed-off-by: Dmitry Fomichev Signed-off-by: Sam Li --- include/standard-headers/linux/

[RFC v4 0/9] Add support for zoned device

2022-07-11 Thread Sam Li
This patch series adds support for zoned device to virtio-blk emulation. Zoned Storage can support sequential writes, which reduces write amplification in SSD, leading to higher write throughput and increased capacity. v4: - add block layer APIs (revision) - add configurations for zoned block devi

[RFC v4 6/9] raw-format: add zone operations

2022-07-11 Thread Sam Li
Signed-off-by: Sam Li --- block/raw-format.c | 13 + 1 file changed, 13 insertions(+) diff --git a/block/raw-format.c b/block/raw-format.c index 69fd650eaf..96bdb6c1e2 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -314,6 +314,17 @@ static int coroutine_fn raw_co_pdiscar

[RFC v4 2/9] qemu-io: add zoned block device operations.

2022-07-11 Thread Sam Li
Add zoned storage commands of the device: zone_open(zo), zone_close(zc), zone_reset(zs), zone_report(zp), zone_finish(zf). For example, it can be called by: ./build/qemu-io --image-opts driver=zoned_host_device, filename=/dev/nullb0 -c "zone_report 0 0 1" Signed-off-by: Sam Li --- block/io.c

[RFC v4 1/9] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls.

2022-07-11 Thread Sam Li
By adding zone management operations in BlockDriver, storage controller emulation can use the new block layer APIs including zone_report and zone_mgmt(open, close, finish, reset). Signed-off-by: Sam Li --- block/block-backend.c| 41 ++ block/coroutines.h | 5 + b

[RFC PATCH v3 5/7] tests: add 'check-venv' as a dependency of 'make check'

2022-07-11 Thread John Snow
This patch adds the 'check-venv' target as a requisite of all meson driven check-* targets. As of this commit, it will only install the "qemu" namespace package from the source tree, and nothing else. In the future, the "qemu" namespace package in qemu.git will begin to require an external qemu.qm

[RFC PATCH v3 7/7] iotests: self-bootstrap testing venv

2022-07-11 Thread John Snow
When iotests are invoked manually from e.g. $build/tests/qemu-iotests/check, it is not necessarily guaranteed that we'll have run 'check-venv' yet. With this patch, teach testenv.py how to create its own environment. Note: this self-bootstrapping is fairly rudimentary and will miss certain trigge

[RFC PATCH v3 6/7] iotests: use tests/venv for running tests

2022-07-11 Thread John Snow
Essentially, the changes to testenv.py here mimic the changes that occur when you "source venv/bin/activate.fish" or similar. (1) update iotest's internal notion of which python binary to use, (2) export the VIRTUAL_ENV variable, (3) front-load the venv/bin directory to PATH. If the venv director

[RFC PATCH v3 4/7] tests/vm: add venv pre-requisites to VM building recipes

2022-07-11 Thread John Snow
NetBSD needs "py37-pip" in order to create virtual environments. Signed-off-by: John Snow --- tests/vm/netbsd | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/vm/netbsd b/tests/vm/netbsd index 45aa9a7fda7..53fe508e487 100755 --- a/tests/vm/netbsd +++ b/tests/vm/netbsd @@ -31,6 +31,7 @@

[RFC PATCH v3 0/7] tests: run python tests under a venv

2022-07-11 Thread John Snow
Hi, here's another RFC for bringing external Python dependencies to the QEMU test suite. This is mostly a refresh of a version I sent out before, but mixes in my VM improvement test as an optional pre-requisite to improve VM test stability to ensure that the BSDs all pass with the new infrastructu

[RFC PATCH v3 3/7] tests: Remove spurious pip warnings on Ubuntu20.04

2022-07-11 Thread John Snow
The version of pip ("20.0.2") that ships with Ubuntu 20.04 has a bug where it will try to attempt building a wheel even if the "wheel" python package that enables it to do so is not installed. Even though pip continues gracefully from source, The result is a lot of irrelevant failure output. Upstr

[RFC PATCH v3 1/7] tests: create optional tests/venv dependency groups

2022-07-11 Thread John Snow
This patch uses a dummy package and setup.cfg/setup.py files to manage optional dependency groups for the test venv specification. Now, there's a core set of dependencies which for now includes just "qemu" (but soon, qemu.qmp) and a separate, optional 'avocado' group that includes avocado-framework

[RFC PATCH v3 2/7] tests: pythonize test venv creation

2022-07-11 Thread John Snow
This splits the venv creation logic out of the Makefile and into a Python script. One reason for doing this is to be able to call the venv bootstrapper from places outside of the Makefile, e.g. configure and iotests. Another reason is to be able to add "offline" logic to modify the behavior of the

Re: [PATCH] iotests: fix source directory location

2022-07-11 Thread John Snow
On Fri, May 27, 2022, 12:29 PM Kevin Wolf wrote: > Am 26.05.2022 um 16:21 hat John Snow geschrieben: > > On Thu, May 26, 2022, 3:54 AM Daniel P. Berrangé > > wrote: > > > > > On Wed, May 25, 2022 at 08:25:12PM -0400, John Snow wrote: > > > > If you invoke the check script from outside of the tes

Re: [PATCH] python: QEMUMachine: enable qmp accept timeout by default

2022-07-11 Thread John Snow
On Mon, Jul 11, 2022 at 5:16 PM John Snow wrote: > > On Fri, Jun 24, 2022 at 3:53 PM Vladimir Sementsov-Ogievskiy > wrote: > > > > I've spent much time trying to debug hanging pipeline in gitlab. I > > started from and idea that I have problem in code in my series (which > > has some timeouts). F

Re: [PATCH] python: QEMUMachine: enable qmp accept timeout by default

2022-07-11 Thread John Snow
On Fri, Jun 24, 2022 at 3:53 PM Vladimir Sementsov-Ogievskiy wrote: > > I've spent much time trying to debug hanging pipeline in gitlab. I > started from and idea that I have problem in code in my series (which > has some timeouts). Finally I found that the problem is that I've used > QEMUMachine

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

2022-07-11 Thread Vladimir Sementsov-Ogievskiy
That seems a lot closer! Now I'm going to vocation from tomorrow up to the end of week, so I'll return next Monday. On 7/6/22 23:15, Emanuele Giuseppe Esposito wrote: In this series, we want to remove the AioContext lock and instead use the already existent job_mutex to protect the job struct

Re: [PATCH v9 17/21] blockjob.h: categorize fields in struct BlockJob

2022-07-11 Thread Vladimir Sementsov-Ogievskiy
On 7/6/22 23:15, Emanuele Giuseppe Esposito wrote: The same job lock is being used also to protect some of blockjob fields. Categorize them just as done in job.h. Thanks! Signed-off-by: Emanuele Giuseppe Esposito --- include/block/blockjob.h | 17 ++--- 1 file changed, 14 ins

Re: [PATCH v9 13/21] job: detect change of aiocontext within job coroutine

2022-07-11 Thread Vladimir Sementsov-Ogievskiy
On 7/6/22 23:15, Emanuele Giuseppe Esposito wrote: From: Paolo Bonzini We want to make sure access of job->aio_context is always done under either BQL or job_mutex. The problem is that using aio_co_enter(job->aiocontext, job->co) in job_start and job_enter_cond makes the coroutine immediately r

Re: [PATCH] util/aio: Defer disabling poll mode as long as possible

2022-07-11 Thread Stefan Hajnoczi
On Sun, Jul 10, 2022 at 08:08:49PM +0800, Chao Gao wrote: > When we measure FIO read performance (cache=writethrough, bs=4k, > iodepth=64) in VMs, ~80K/s notifications (e.g., EPT_MISCONFIG) are observed > from guest to qemu. > > It turns out those frequent notificatons are caused by interference f

Re: [PATCH v9 19/21] blockjob: protect iostatus field in BlockJob struct

2022-07-11 Thread Vladimir Sementsov-Ogievskiy
On 7/6/22 23:15, Emanuele Giuseppe Esposito wrote: 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, change block_job_iostatus_set_

Re: [PATCH v9 18/21] blockjob: rename notifier callbacks as _locked

2022-07-11 Thread Vladimir Sementsov-Ogievskiy
On 7/6/22 23:15, Emanuele Giuseppe Esposito wrote: They all are called with job_lock held, in job_event_*_locked() Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi Reviewed-by: Vladimir Sementsov-Ogievskiy -- Best regards, Vladimir

Re: [PATCH v9 16/21] block_job_query: remove atomic read

2022-07-11 Thread Vladimir Sementsov-Ogievskiy
On 7/6/22 23:15, Emanuele Giuseppe Esposito wrote: Not sure what the atomic here was supposed to do, since job.busy is protected by the job lock. Since the whole function is called under job_mutex, just remove the atomic. Reviewed-by: Stefan Hajnoczi Signed-off-by: Emanuele Giuseppe Esposito R

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

2022-07-11 Thread Vladimir Sementsov-Ogievskiy
On 7/6/22 23:15, Emanuele Giuseppe Esposito wrote: Change the job_{lock/unlock} and macros to use job_mutex. Now that they are not nop anymore, remove the aiocontext to avoid deadlocks. Therefore: - when possible, remove completely the aiocontext lock/unlock pair - if it is used by some other f

Re: [PATCH v9 14/21] jobs: protect job.aio_context with BQL and job_mutex

2022-07-11 Thread Vladimir Sementsov-Ogievskiy
On 7/6/22 23:15, Emanuele Giuseppe Esposito wrote: In order to make it thread safe, implement a "fake rwlock", where we allow reads under BQL *or* job_mutex held, but writes only under BQL *and* job_mutex. The only write we have is in child_job_set_aio_ctx also in job_create of course, but it

Re: [PATCH v9 12/21] commit and mirror: create new nodes using bdrv_get_aio_context, and not the job aiocontext

2022-07-11 Thread Vladimir Sementsov-Ogievskiy
On 7/6/22 23:15, Emanuele Giuseppe Esposito wrote: We are always using the given bs AioContext, so there is no need to take the job ones (which is identical anyways). This also reduces the point we need to check when protecting job.aio_context field. Reviewed-by: Stefan Hajnoczi Signed-off-by: E

Re: [PATCH v9 11/21] jobs: group together API calls under the same job lock

2022-07-11 Thread Vladimir Sementsov-Ogievskiy
On 7/6/22 23:15, Emanuele Giuseppe Esposito wrote: Now that the API offers also _locked() functions, take advantage of it and give also the caller control to take the lock and call _locked functions. This makes sense especially when we have for loops, because it makes no sense to have: for(job

Re: [PATCH v9 10/21] block/mirror.c: use of job helpers in drivers to avoid TOC/TOU

2022-07-11 Thread Vladimir Sementsov-Ogievskiy
On 7/6/22 23:15, Emanuele Giuseppe Esposito wrote: Once job lock is used and aiocontext is removed, mirror has to perform job operations under the same critical section, using the helpers prepared in previous commit. Note: at this stage, job_{lock/unlock} and job lock guard macros are*nop*. Sig

Re: [PATCH v9 09/21] jobs: use job locks also in the unit tests

2022-07-11 Thread Vladimir Sementsov-Ogievskiy
On 7/6/22 23:15, Emanuele Giuseppe Esposito wrote: Add missing job synchronization in the unit tests, with explicit locks. We are deliberately using _locked functions wrapped by a guard instead of a normal call because the normal call will be removed in future, as the only usage is limited to th

Re: [PATCH v9 07/21] blockjob: introduce block_job _locked() APIs

2022-07-11 Thread Emanuele Giuseppe Esposito
Am 11/07/2022 um 14:04 schrieb Vladimir Sementsov-Ogievskiy: > On 7/6/22 23:15, Emanuele Giuseppe Esposito wrote: >> Just as done with job.h, create _locked() functions in blockjob.h >> >> These functions will be later useful when caller has already taken >> the lock. All blockjob _locked functi

Re: [PATCH v9 08/21] jobs: add job lock in find_* functions

2022-07-11 Thread Vladimir Sementsov-Ogievskiy
On 7/6/22 23:15, Emanuele Giuseppe Esposito wrote: Both blockdev.c and job-qmp.c have TOC/TOU conditions, because they first search for the job and then perform an action on it. Therefore, we need to do the search + action under the same job mutex critical section. Note: at this stage, job_{lock

Re: [PATCH v9 07/21] blockjob: introduce block_job _locked() APIs

2022-07-11 Thread Vladimir Sementsov-Ogievskiy
On 7/6/22 23:15, Emanuele Giuseppe Esposito wrote: Just as done with job.h, create _locked() functions in blockjob.h These functions will be later useful when caller has already taken the lock. All blockjob _locked functions call job _locked functions. Note: at this stage, job_{lock/unlock} and

[PATCH 1/1] block: add missed block_acct_setup with new block device init procedure

2022-07-11 Thread Denis V. Lunev
Commit 5f76a7aac156ca75680dad5df4a385fd0b58f6b1 is looking harmless from the first glance, but it has changed things a lot. 'libvirt' uses it to detect that it should follow new initialization way and this changes things considerably. With this procedure followed, blockdev_init() is not called anym

Re: [PATCH v9 05/21] job.c: add job_lock/unlock while keeping job.h intact

2022-07-11 Thread Vladimir Sementsov-Ogievskiy
On 7/11/22 10:30, Emanuele Giuseppe Esposito wrote: Am 08/07/2022 um 21:25 schrieb Vladimir Sementsov-Ogievskiy:   static bool job_started(Job *job) So we can call it both with mutex locked and without. Hope it never race with job_start. Where exactly do you see it called with mutex not h

Re: [PATCH v9 06/21] job: move and update comments from blockjob.c

2022-07-11 Thread Vladimir Sementsov-Ogievskiy
On 7/6/22 23:15, Emanuele Giuseppe Esposito wrote: This comment applies more on job, it was left in blockjob as in the past the whole job logic was implemented there. Note: at this stage, job_{lock/unlock} and job lock guard macros are*nop*. No functional change intended. Signed-off-by: Emanue

Re: [PATCH v9 05/21] job.c: add job_lock/unlock while keeping job.h intact

2022-07-11 Thread Emanuele Giuseppe Esposito
Am 08/07/2022 um 21:25 schrieb Vladimir Sementsov-Ogievskiy: >>   static bool job_started(Job *job) > > So we can call it both with mutex locked and without. Hope it never race > with job_start. Where exactly do you see it called with mutex not held? I don't see it anywhere, and if you agree