From: Fabiano Rosas <farosas@suse.de>
To: Christian Schoenebeck <qemu_oss@crudebyte.com>,
qemu-devel@nongnu.org, qemu-stable@nongnu.org
Cc: Greg Kurz <groug@kaod.org>, Jia Jia <physicalmtea@gmail.com>,
Laurent Vivier <lvivier@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH 5/6] tests/qtest/libqos: add qvirtqueue_reset_pool() for descriptor pool reset
Date: Tue, 19 May 2026 04:51:49 -0300 [thread overview]
Message-ID: <87o6ib3kh6.fsf@suse.de> (raw)
In-Reply-To: <96cf23eea1204b34443218fe76bd4a5eaf9163e8.1779126034.git.qemu_oss@crudebyte.com>
Christian Schoenebeck <qemu_oss@crudebyte.com> writes:
> Add a function to reset the virtqueue descriptor pool state without
> reinitializing the device. This is useful for tests that issue a high
> number of requests and are limited by the simplified virtio test
> driver's descriptor tracking, which decrements num_free but never
> increments it back.
>
> The function is safe for synchronous test code where requests are
> sent and completed before the next request is issued.
>
> Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Acked-by: Fabiano Rosas <farosas@suse.de>
> ---
> tests/qtest/libqos/virtio.c | 23 +++++++++++++++++++++++
> tests/qtest/libqos/virtio.h | 2 ++
> 2 files changed, 25 insertions(+)
>
> diff --git a/tests/qtest/libqos/virtio.c b/tests/qtest/libqos/virtio.c
> index 010ff40834..ccbb325222 100644
> --- a/tests/qtest/libqos/virtio.c
> +++ b/tests/qtest/libqos/virtio.c
> @@ -464,6 +464,29 @@ bool qvirtqueue_get_buf(QTestState *qts, QVirtQueue *vq, uint32_t *desc_idx,
> return true;
> }
>
> +/*
> + * qvirtqueue_reset_pool:
> + * @vq: The virtqueue to reset
> + *
> + * Reset the descriptor pool state without reinitializing the device.
> + * This is useful for tests that issue a high number of requests and
> + * are limited by the simplified virtio test driver's descriptor tracking,
> + * which decrements num_free but never increments it back.
> + *
> + * This is only safe for synchronous test code where requests are
> + * sent and completed before the next request is issued. Do not use
> + * with asynchronous code where multiple requests may be in-flight.
> + *
> + * Note: This only resets the available descriptor pool (free_head,
> + * num_free). The used ring position (last_used_idx) is NOT reset
> + * and should continue to track consumed responses across iterations.
> + */
> +void qvirtqueue_reset_pool(QVirtQueue *vq)
> +{
> + vq->free_head = 0;
> + vq->num_free = vq->size;
> +}
> +
> void qvirtqueue_set_used_event(QTestState *qts, QVirtQueue *vq, uint16_t idx)
> {
> g_assert(vq->event);
> diff --git a/tests/qtest/libqos/virtio.h b/tests/qtest/libqos/virtio.h
> index e238f1726f..f17be0b9b6 100644
> --- a/tests/qtest/libqos/virtio.h
> +++ b/tests/qtest/libqos/virtio.h
> @@ -150,6 +150,8 @@ void qvirtqueue_kick(QTestState *qts, QVirtioDevice *d, QVirtQueue *vq,
> bool qvirtqueue_get_buf(QTestState *qts, QVirtQueue *vq, uint32_t *desc_idx,
> uint32_t *len);
>
> +void qvirtqueue_reset_pool(QVirtQueue *vq);
> +
> void qvirtqueue_set_used_event(QTestState *qts, QVirtQueue *vq, uint16_t idx);
>
> void qvirtio_start_device(QVirtioDevice *vdev);
next prev parent reply other threads:[~2026-05-19 7:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 17:40 [PATCH 0/6] 9pfs: fix V9fsPath heap buffer overflow Christian Schoenebeck
2026-05-18 17:35 ` [PATCH 1/6] hw/9pfs: add NULL check in v9fs_path_is_ancestor() Christian Schoenebeck
2026-05-18 17:35 ` [PATCH 2/6] hw/9pfs: change V9fsPath.size to size_t and v9fs_path_sprintf() return type Christian Schoenebeck
2026-05-18 17:35 ` [PATCH 3/6] hw/9pfs: add error handling to v9fs_fix_path() Christian Schoenebeck
2026-05-18 17:35 ` [PATCH 4/6] hw/9pfs: let callers of v9fs_path_sprintf() and v9fs_fix_path() handle errors Christian Schoenebeck
2026-05-18 17:36 ` [PATCH 5/6] tests/qtest/libqos: add qvirtqueue_reset_pool() for descriptor pool reset Christian Schoenebeck
2026-05-19 7:51 ` Fabiano Rosas [this message]
2026-05-18 17:36 ` [PATCH 6/6] tests/9pfs: add deep absolute path test Christian Schoenebeck
2026-05-27 14:35 ` [PATCH 0/6] 9pfs: fix V9fsPath heap buffer overflow Christian Schoenebeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o6ib3kh6.fsf@suse.de \
--to=farosas@suse.de \
--cc=groug@kaod.org \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=physicalmtea@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=qemu_oss@crudebyte.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.