From: "Michael S. Tsirkin" <mst@redhat.com>
To: Cindy Lu <lulu@redhat.com>
Cc: jasowang@redhat.com, kraxel@redhat.com, dgilbert@redhat.com,
stefanha@redhat.com, arei.gonglei@huawei.com,
marcandre.lureau@redhat.com, qemu-devel@nongnu.org
Subject: Re: [PATCH v17 01/10] virtio: introduce macro VIRTIO_CONFIG_IRQ_IDX
Date: Fri, 28 Oct 2022 20:34:41 -0400 [thread overview]
Message-ID: <20221028203426-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20221028075458.1182340-2-lulu@redhat.com>
On Fri, Oct 28, 2022 at 03:54:49PM +0800, Cindy Lu wrote:
> To support configure interrupt for vhost-vdpa
> Introduce VIRTIO_CONFIG_IRQ_IDX -1 as configure interrupt's queue index,
> Then we can reuse the functions guest_notifier_mask and guest_notifier_pending.
> Add the check of queue index in these drivers, if the driver does not support
> configure interrupt, the function will just return
>
> Signed-off-by: Cindy Lu <lulu@redhat.com>
Fails make check:
qemu-system-x86_64: ../hw/virtio/vhost-user.c:2230: vhost_user_get_vq_index: Assertion `idx >= dev->vq_index && idx < dev->vq_index + dev->nvqs' failed.
Broken pipe
../tests/qtest/libqtest.c:165: kill_qemu() detected QEMU death from signal 6 (Aborted) (core dumped)
# child process (/x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/vhost-user-gpio-pci/vhost-user-gpio/vhost-user-gpio-tests/read-guest-mem/memfile/subprocess [819522]) killed by signal 6 (Aborted), core dumped
# child process (/x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/vhost-user-gpio-pci/vhost-user-gpio/vhost-user-gpio-tests/read-guest-mem/memfile/subprocess [819522]) stdout: ""
# child process (/x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/vhost-user-gpio-pci/vhost-user-gpio/vhost-user-gpio-tests/read-guest-mem/memfile/subprocess [819522]) stderr: "qemu-system-x86_64: ../hw/virtio/vhost-user.c:2230: vhost_user_get_vq_index: Assertion `idx >= dev->vq_index && idx < dev->vq_index + dev->nvqs' failed.\nBroken pipe\n../tests/qtest/libqtest.c:165: kill_qemu() detected QEMU death from signal 6 (Aborted) (core dumped)\n"
**
ERROR:../tests/qtest/qos-test.c:191:subprocess_run_one_test: child process (/x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/vhost-user-gpio-pci/vhost-user-gpio/vhost-user-gpio-tests/read-guest-mem/memfile/subprocess [819522]) failed unexpectedly
Bail out! ERROR:../tests/qtest/qos-test.c:191:subprocess_run_one_test: child process (/x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/vhost-user-gpio-pci/vhost-user-gpio/vhost-user-gpio-tests/read-guest-mem/memfile/subprocess [819522]) failed unexpectedly
runone.sh: line 10: 819019 Aborted (core dumped) QTEST_QEMU_STORAGE_DAEMON_BINARY=./build/storage-daemon/qemu-storage-daemon QTEST_QEMU_BINARY=build/x86_64-softmmu/qemu-system-x86_64 "$@"
> ---
> hw/display/vhost-user-gpu.c | 15 +++++++++++++++
> hw/net/virtio-net.c | 20 ++++++++++++++++++--
> hw/virtio/vhost-user-fs.c | 16 ++++++++++++++++
> hw/virtio/vhost-vsock-common.c | 16 ++++++++++++++++
> hw/virtio/virtio-crypto.c | 16 ++++++++++++++++
> include/hw/virtio/virtio.h | 3 +++
> 6 files changed, 84 insertions(+), 2 deletions(-)
>
> diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c
> index 19c0e20103..2868819281 100644
> --- a/hw/display/vhost-user-gpu.c
> +++ b/hw/display/vhost-user-gpu.c
> @@ -486,6 +486,13 @@ vhost_user_gpu_guest_notifier_pending(VirtIODevice *vdev, int idx)
> {
> VhostUserGPU *g = VHOST_USER_GPU(vdev);
>
> + /* Add the check for configure interrupt, we use VIRTIO_CONFIG_IRQ_IDX -1
> + * as the Marco of configure interrupt, If this driver does not
> + * support, the function will just return false
> + */
> + if (idx == VIRTIO_CONFIG_IRQ_IDX) {
> + return false;
> + }
> return vhost_virtqueue_pending(&g->vhost->dev, idx);
> }
>
> @@ -494,6 +501,14 @@ vhost_user_gpu_guest_notifier_mask(VirtIODevice *vdev, int idx, bool mask)
> {
> VhostUserGPU *g = VHOST_USER_GPU(vdev);
>
> + /* Add the check for configure interrupt,Here use VIRTIO_CONFIG_IRQ_IDX -1
> + * as the Marco of configure interrupt, If this driver does not
> + * support, the function will return
> + */
> +
> + if (idx == VIRTIO_CONFIG_IRQ_IDX) {
> + return;
> + }
> vhost_virtqueue_mask(&g->vhost->dev, vdev, idx, mask);
> }
>
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index e9f696b4cf..1617a37a21 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -3216,6 +3216,14 @@ static bool virtio_net_guest_notifier_pending(VirtIODevice *vdev, int idx)
> } else {
> nc = qemu_get_subqueue(n->nic, vq2q(idx));
> }
> + /* Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
> + * as the Marco of configure interrupt's IDX, If this driver does not
> + * support, the function will return false
> + */
> +
> + if (idx == VIRTIO_CONFIG_IRQ_IDX) {
> + return false;
> + }
> return vhost_net_virtqueue_pending(get_vhost_net(nc->peer), idx);
> }
>
> @@ -3239,8 +3247,16 @@ static void virtio_net_guest_notifier_mask(VirtIODevice *vdev, int idx,
> } else {
> nc = qemu_get_subqueue(n->nic, vq2q(idx));
> }
> - vhost_net_virtqueue_mask(get_vhost_net(nc->peer),
> - vdev, idx, mask);
> + /* Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
> + * as the Marco of configure interrupt's IDX, If this driver does not
> + * support, the function will return
> + */
> +
> + if (idx == VIRTIO_CONFIG_IRQ_IDX) {
> + return;
> + }
> +
> + vhost_net_virtqueue_mask(get_vhost_net(nc->peer), vdev, idx, mask);
> }
>
> static void virtio_net_set_config_size(VirtIONet *n, uint64_t host_features)
> diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c
> index ad0f91c607..f87a074553 100644
> --- a/hw/virtio/vhost-user-fs.c
> +++ b/hw/virtio/vhost-user-fs.c
> @@ -158,6 +158,14 @@ static void vuf_guest_notifier_mask(VirtIODevice *vdev, int idx,
> {
> VHostUserFS *fs = VHOST_USER_FS(vdev);
>
> + /* Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
> + * as the Marco of configure interrupt's IDX, If this driver does not
> + * support, the function will return
> + */
> +
> + if (idx == VIRTIO_CONFIG_IRQ_IDX) {
> + return;
> + }
> vhost_virtqueue_mask(&fs->vhost_dev, vdev, idx, mask);
> }
>
> @@ -165,6 +173,14 @@ static bool vuf_guest_notifier_pending(VirtIODevice *vdev, int idx)
> {
> VHostUserFS *fs = VHOST_USER_FS(vdev);
>
> + /* Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
> + * as the Marco of configure interrupt's IDX, If this driver does not
> + * support, the function will return
> + */
> +
> + if (idx == VIRTIO_CONFIG_IRQ_IDX) {
> + return false;
> + }
> return vhost_virtqueue_pending(&fs->vhost_dev, idx);
> }
>
> diff --git a/hw/virtio/vhost-vsock-common.c b/hw/virtio/vhost-vsock-common.c
> index 29b9ab4f72..12e35b1a98 100644
> --- a/hw/virtio/vhost-vsock-common.c
> +++ b/hw/virtio/vhost-vsock-common.c
> @@ -126,6 +126,14 @@ static void vhost_vsock_common_guest_notifier_mask(VirtIODevice *vdev, int idx,
> {
> VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
>
> + /* Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
> + * as the Marco of configure interrupt's IDX, If this driver does not
> + * support, the function will return
> + */
> +
> + if (idx == VIRTIO_CONFIG_IRQ_IDX) {
> + return;
> + }
> vhost_virtqueue_mask(&vvc->vhost_dev, vdev, idx, mask);
> }
>
> @@ -134,6 +142,14 @@ static bool vhost_vsock_common_guest_notifier_pending(VirtIODevice *vdev,
> {
> VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
>
> + /* Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
> + * as the Marco of configure interrupt's IDX, If this driver does not
> + * support, the function will return
> + */
> +
> + if (idx == VIRTIO_CONFIG_IRQ_IDX) {
> + return false;
> + }
> return vhost_virtqueue_pending(&vvc->vhost_dev, idx);
> }
>
> diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
> index df4bde210b..d61278a707 100644
> --- a/hw/virtio/virtio-crypto.c
> +++ b/hw/virtio/virtio-crypto.c
> @@ -1139,6 +1139,14 @@ static void virtio_crypto_guest_notifier_mask(VirtIODevice *vdev, int idx,
>
> assert(vcrypto->vhost_started);
>
> + /* Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
> + * as the Marco of configure interrupt's IDX, If this driver does not
> + * support, the function will return
> + */
> +
> + if (idx == VIRTIO_CONFIG_IRQ_IDX) {
> + return;
> + }
> cryptodev_vhost_virtqueue_mask(vdev, queue, idx, mask);
> }
>
> @@ -1149,6 +1157,14 @@ static bool virtio_crypto_guest_notifier_pending(VirtIODevice *vdev, int idx)
>
> assert(vcrypto->vhost_started);
>
> + /* Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
> + * as the Marco of configure interrupt's IDX, If this driver does not
> + * support, the function will return
> + */
> +
> + if (idx == VIRTIO_CONFIG_IRQ_IDX) {
> + return false;
> + }
> return cryptodev_vhost_virtqueue_pending(vdev, queue, idx);
> }
>
> diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
> index f41b4a7e64..a9953cf8b0 100644
> --- a/include/hw/virtio/virtio.h
> +++ b/include/hw/virtio/virtio.h
> @@ -79,6 +79,9 @@ typedef struct VirtQueueElement
>
> #define VIRTIO_NO_VECTOR 0xffff
>
> +/* special index value used internally for config irqs */
> +#define VIRTIO_CONFIG_IRQ_IDX -1
> +
> #define TYPE_VIRTIO_DEVICE "virtio-device"
> OBJECT_DECLARE_TYPE(VirtIODevice, VirtioDeviceClass, VIRTIO_DEVICE)
>
> --
> 2.34.3
next prev parent reply other threads:[~2022-10-29 0:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-28 7:54 [PATCH v17 00/10]vhost-vdpa: add support for configure interrupt Cindy Lu
2022-10-28 7:54 ` [PATCH v17 01/10] virtio: introduce macro VIRTIO_CONFIG_IRQ_IDX Cindy Lu
2022-10-29 0:34 ` Michael S. Tsirkin [this message]
2022-10-28 7:54 ` [PATCH v17 02/10] virtio-pci: decouple notifier from interrupt process Cindy Lu
2022-10-28 7:54 ` [PATCH v17 03/10] virtio-pci: decouple the single vector from the " Cindy Lu
2022-10-28 7:54 ` [PATCH v17 04/10] vhost: introduce new VhostOps vhost_set_config_call Cindy Lu
2022-10-28 7:54 ` [PATCH v17 05/10] vhost-vdpa: add support for config interrupt Cindy Lu
2022-10-28 7:54 ` [PATCH v17 06/10] virtio: add support for configure interrupt Cindy Lu
2022-10-28 7:54 ` [PATCH v17 07/10] vhost: " Cindy Lu
2022-10-28 7:54 ` [PATCH v17 08/10] virtio-net: " Cindy Lu
2022-10-28 7:54 ` [PATCH v17 09/10] virtio-mmio: " Cindy Lu
2022-10-28 7:54 ` [PATCH v17 10/10] virtio-pci: " Cindy Lu
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=20221028203426-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=dgilbert@redhat.com \
--cc=jasowang@redhat.com \
--cc=kraxel@redhat.com \
--cc=lulu@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).