From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
qemu-devel@nongnu.org, slp@redhat.com,
marcandre.lureau@redhat.com, stefanha@redhat.com,
mathieu.poirier@linaro.org, viresh.kumar@linaro.org,
sgarzare@redhat.com
Subject: Re: [PATCH v3 4/7] hw/virtio: ensure a valid host_feature set for virtio-user-gpio
Date: Tue, 29 Nov 2022 10:48:47 -0500 [thread overview]
Message-ID: <20221129104802-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <8735a2yigb.fsf@linaro.org>
On Mon, Nov 28, 2022 at 07:39:29PM +0000, Alex Bennée wrote:
>
> Stefan Hajnoczi <stefanha@gmail.com> writes:
>
> > On Mon, 28 Nov 2022 at 11:42, Alex Bennée <alex.bennee@linaro.org> wrote:
> >>
> >> There was a disconnect here because vdev->host_features was set to
> >> random rubbish. This caused a weird negotiation between the driver and
> >> device that took no account of the features provided by the backend.
> >> To fix this we must set vdev->host_features once we have initialised
> >> the vhost backend.
> >>
> >> [AJB: however this is confusing because AFAICT none of the other
> >> vhost-user devices do this.]
> >>
> >> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> >> ---
> >> hw/virtio/vhost-user-gpio.c | 6 ++++++
> >> 1 file changed, 6 insertions(+)
> >>
> >> diff --git a/hw/virtio/vhost-user-gpio.c b/hw/virtio/vhost-user-gpio.c
> >> index 5851cb3bc9..b2496c824c 100644
> >> --- a/hw/virtio/vhost-user-gpio.c
> >> +++ b/hw/virtio/vhost-user-gpio.c
> >> @@ -228,6 +228,12 @@ static int vu_gpio_connect(DeviceState *dev, Error **errp)
> >> return ret;
> >> }
> >>
> >> + /*
> >> + * Once we have initialised the vhost backend we can finally set
> >> + * the what host features are available for this device.
> >> + */
> >> + vdev->host_features = vhost_dev->features;
> >
> > vdev->host_feature is already set by virtio_bus_device_plugged ->
> > vu_gpio_get_features.
> >
> > Something is still wrong.
> >
> > My understanding is: ->realize() performs a blocking connect so when
> > it returns and virtio_bus_device_plugged() runs, we'll be able to
> > fetch the backend features from ->get_features(). The assumption is
> > that the backend features don't change across reconnection (I think).
> >
> > vhost-user-gpio seems to follow the same flow as the other vhost-user
> > devices (vhost-user-net is special, so let's ignore it), so I don't
> > understand why it's necessary to manually assign ->host_features here?
>
> I think you are right. I suspect I got confused while chasing down the
> missing high bits (due to the legacy VirtIO negotiation). Also slightly
> thrown off by the appearance of virtio-net (I assume because of a
> machine default?):
>
> ➜ env QTEST_QEMU_STORAGE_DAEMON_BINARY=./storage-daemon/qemu-storage-daemon QTEST_QEMU_IMG=./qemu-img QTEST_QEMU_BINARY=./qemu-system-aarch64 G_TEST_DBUS_DAEMON=/home/alex/
> lsrc/qemu.git/tests/dbus-vmstate-daemon.sh MALLOC_PERTURB_=177 ./tests/qtest/qos-test --tap -p /aarch64/virt/generic-pcihost/pci-bus-generic/pci-bus/vhost-user-gpio-pci/vhost-user-gpio/vhost-user-gpio-tests/read-guest-mem/memfile
> # random seed: R02S235ee9d31e87e0159f810979be62563e
> # starting QEMU: exec ./qemu-system-aarch64 -qtest unix:/tmp/qtest-1276289.sock -qtest-log /dev/null -chardev socket,path=/tmp/qtest-1276289.qmp,id=char0 -mon chardev=char0,mode=control -display none -machine none -accel qtest
> # Start of aarch64 tests
> # Start of virt tests
> # Start of generic-pcihost tests
> # Start of pci-bus-generic tests
> # Start of pci-bus tests
> # Start of vhost-user-gpio-pci tests
> # Start of vhost-user-gpio tests
> # Start of vhost-user-gpio-tests tests
> # Start of read-guest-mem tests
> virtio_bus_device_plugged: virtio-net host_features = 0x10179bf8064
> vu_gpio_connect: pre host_features = 10039000000
> vu_gpio_connect: post host_features = 140000001
> virtio_bus_device_plugged: virtio-gpio host_features = 0x140000001
> qemu-system-aarch64: Failed to set msg fds.
> qemu-system-aarch64: vhost VQ 0 ring restore failed: -22: Invalid argument (22)
> qemu-system-aarch64: Failed to set msg fds.
> qemu-system-aarch64: vhost VQ 1 ring restore failed: -22: Invalid argument (22)
> qemu-system-aarch64: Failed to set msg fds.
> qemu-system-aarch64: vhost_set_vring_call failed: Invalid argument (22)
> qemu-system-aarch64: Failed to set msg fds.
> qemu-system-aarch64: vhost_set_vring_call failed: Invalid argument (22)
> # qos_test running single test in subprocess
> # set_protocol_features: 0x200
> # set_owner: start of session
> # vhost-user: un-handled message: 14
> # vhost-user: un-handled message: 14
> # set_vring_num: 0/256
> # set_vring_addr: 0x7f55b0000000/0x7f55affff000/0x7f55b0001000
> ok 1 /aarch64/virt/generic-pcihost/pci-bus-generic/pci-bus/vhost-user-gpio-pci/vhost-user-gpio/vhost-user-gpio-tests/read-guest-mem/memfile
> # Start of memfile tests
> # End of memfile tests
> # End of read-guest-mem tests
> # End of vhost-user-gpio-tests tests
> # End of vhost-user-gpio tests
> # End of vhost-user-gpio-pci tests
> # End of pci-bus tests
> # End of pci-bus-generic tests
> # End of generic-pcihost tests
> # End of virt tests
> # End of aarch64 tests
> 1..1
>
> and for mmio:
>
> env MALLOC_PERTURB_=235 QTEST_QEMU_IMG=./qemu-img QTEST_QEMU_BINARY="./qemu-system-arm" QTEST_QEMU_STORAGE_DAEMON_BINARY=./storage-daemon/qemu-storage-daemon G_TEST_DBUS_DAEMON=/home/alex/lsrc/qemu.git/tests/dbus-vmstate-daemon.sh ./tests/qtest/qos-test --tap -p /arm/virt/virtio-mmio/virtio-bus/vhost-user-gpio-device/vhost-user-gpio/vhost-user-gpio-tests/read-guest-mem/memfile
> # random seed: R02Sac48bb073367f77c1c1a1db6b5245c9e
> # starting QEMU: exec ./qemu-system-arm -qtest unix:/tmp/qtest-1276963.sock -qtest-log /dev/null -chardev socket,path=/tmp/qtest-1276963.qmp,id=char0 -mon chardev=char0,mode=control -display none -machine none -accel qtest
> # Start of arm tests
> # Start of virt tests
> # Start of virtio-mmio tests
> # Start of virtio-bus tests
> # Start of vhost-user-gpio-device tests
> # Start of vhost-user-gpio tests
> # Start of vhost-user-gpio-tests tests
> # Start of read-guest-mem tests
> virtio_bus_device_plugged: virtio-net host_features = 0x10179bf8064
> vu_gpio_connect: pre host_features = 10039000000
> vu_gpio_connect: post host_features = 140000001
> virtio_bus_device_plugged: virtio-gpio host_features = 0x140000001
> qemu-system-arm: Failed to set msg fds.
> qemu-system-arm: vhost_set_vring_call failed: Invalid argument (22)
> qemu-system-arm: Failed to set msg fds.
> qemu-system-arm: vhost_set_vring_call failed: Invalid argument (22)
> # qos_test running single test in subprocess
> # set_protocol_features: 0x200
> # set_owner: start of session
> # vhost-user: un-handled message: 14
> # vhost-user: un-handled message: 14
> ok 1 /arm/virt/virtio-mmio/virtio-bus/vhost-user-gpio-device/vhost-user-gpio/vhost-user-gpio-tests/read-guest-mem/memfile
> # Start of memfile tests
> # End of memfile tests
> # End of read-guest-mem tests
> # End of vhost-user-gpio-tests tests
> # End of vhost-user-gpio tests
> # End of vhost-user-gpio-device tests
> # End of virtio-bus tests
> # End of virtio-mmio tests
> # End of virt tests
> # End of arm tests
> 1..1
>
> I'll drop this patch for now and re-test.
So I should expect v4? And I guess we can split out documentation things then?
> >
> > Stefan
>
>
> --
> Alex Bennée
next prev parent reply other threads:[~2022-11-29 15:49 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-28 16:40 [PATCH for 7.2-rc3 v3 0/7] fix vhost-user issues with CI Alex Bennée
2022-11-28 16:40 ` [PATCH v3 1/7] include/hw: attempt to document VirtIO feature variables Alex Bennée
2022-11-29 8:54 ` Stefano Garzarella
2022-11-28 16:41 ` [PATCH v3 2/7] include/hw: VM state takes precedence in virtio_device_should_start Alex Bennée
2022-11-28 17:09 ` Michael S. Tsirkin
2022-11-28 16:41 ` [PATCH v3 3/7] tests/qtests: override "force-legacy" for gpio virtio-mmio tests Alex Bennée
2022-11-28 16:41 ` [PATCH v3 4/7] hw/virtio: ensure a valid host_feature set for virtio-user-gpio Alex Bennée
2022-11-28 18:39 ` Stefan Hajnoczi
2022-11-28 19:39 ` Alex Bennée
2022-11-29 15:48 ` Michael S. Tsirkin [this message]
2022-11-29 21:01 ` Stefan Hajnoczi
2022-11-29 21:13 ` Michael S. Tsirkin
2022-11-29 22:53 ` Alex Bennée
2022-11-28 16:41 ` [Virtio-fs] [PATCH v3 5/7] vhost: enable vrings in vhost_dev_start() for vhost-user devices Alex Bennée
2022-11-28 16:41 ` Alex Bennée
2022-11-28 16:41 ` [PATCH v3 6/7] hw/virtio: add started_vu status field to vhost-user-gpio Alex Bennée
2022-11-28 16:41 ` [PATCH v3 7/7] hw/virtio: generalise CHR_EVENT_CLOSED handling Alex Bennée
2022-11-29 5:18 ` Raphael Norwitz
2022-11-29 5:30 ` Michael S. Tsirkin
2022-11-29 14:24 ` Raphael Norwitz
2022-11-30 10:25 ` Alex Bennée
2022-11-30 10:28 ` Michael S. Tsirkin
2022-11-30 11:28 ` Alex Bennée
2022-11-30 6:57 ` [PATCH for 7.2-rc3 v3 0/7] fix vhost-user issues with CI Michael S. Tsirkin
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=20221129104802-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=marcandre.lureau@redhat.com \
--cc=mathieu.poirier@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
--cc=slp@redhat.com \
--cc=stefanha@gmail.com \
--cc=stefanha@redhat.com \
--cc=viresh.kumar@linaro.org \
/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.