From: "Michael S. Tsirkin" <mst@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
Laurent Vivier <lvivier@redhat.com>,
Thomas Huth <thuth@redhat.com>,
qemu-block@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
qemu-stable@nongnu.org, qemu-devel@nongnu.org,
Coiby Xu <Coiby.Xu@gmail.com>, Max Reitz <mreitz@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Raphael Norwitz <raphael.norwitz@nutanix.com>,
Jason Wang <jasowang@redhat.com>
Subject: Re: [PATCH v3 01/12] vhost-user-blk: fix blkcfg->num_queues endianness
Date: Tue, 23 Feb 2021 11:13:47 -0500 [thread overview]
Message-ID: <20210223111018-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20210223144653.811468-2-stefanha@redhat.com>
On Tue, Feb 23, 2021 at 02:46:42PM +0000, Stefan Hajnoczi wrote:
> Treat the num_queues field as virtio-endian. On big-endian hosts the
> vhost-user-blk num_queues field was in the wrong endianness.
>
> Move the blkcfg.num_queues store operation from realize to
> vhost_user_blk_update_config() so feature negotiation has finished and
> we know the endianness of the device. VIRTIO 1.0 devices are
> little-endian, but in case someone wants to use legacy VIRTIO we support
> all endianness cases.
>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
okay but as we recently discovered config space can in theory
be read before FEATURES_OK. Nasty, I know. Things kind of work
right now but we really need some other path to notify backends
when legacy guest is active. E.g. VDPA also has this problem.
> ---
> hw/block/vhost-user-blk.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
> index da4fbf9084..b870a50e6b 100644
> --- a/hw/block/vhost-user-blk.c
> +++ b/hw/block/vhost-user-blk.c
> @@ -54,6 +54,9 @@ static void vhost_user_blk_update_config(VirtIODevice *vdev, uint8_t *config)
> {
> VHostUserBlk *s = VHOST_USER_BLK(vdev);
>
> + /* Our num_queues overrides the device backend */
> + virtio_stw_p(vdev, &s->blkcfg.num_queues, s->num_queues);
> +
> memcpy(config, &s->blkcfg, sizeof(struct virtio_blk_config));
> }
>
> @@ -491,10 +494,6 @@ reconnect:
> goto reconnect;
> }
>
> - if (s->blkcfg.num_queues != s->num_queues) {
> - s->blkcfg.num_queues = s->num_queues;
> - }
> -
> return;
>
> virtio_err:
> --
> 2.29.2
>
next prev parent reply other threads:[~2021-02-23 16:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-23 14:46 [PATCH v3 00/12] block/export: vhost-user-blk server tests and input validation Stefan Hajnoczi
2021-02-23 14:46 ` [PATCH v3 01/12] vhost-user-blk: fix blkcfg->num_queues endianness Stefan Hajnoczi
2021-02-23 16:13 ` Michael S. Tsirkin [this message]
2021-02-24 15:12 ` Stefan Hajnoczi
2021-02-23 14:46 ` [PATCH v3 02/12] libqtest: add qtest_socket_server() Stefan Hajnoczi
2021-02-23 14:46 ` [PATCH v3 03/12] libqtest: add qtest_kill_qemu() Stefan Hajnoczi
2021-03-08 6:38 ` Thomas Huth
2021-02-23 14:46 ` [PATCH v3 04/12] libqtest: add qtest_remove_abrt_handler() Stefan Hajnoczi
2021-03-08 6:44 ` Thomas Huth
2021-02-23 14:46 ` [PATCH v3 05/12] test: new qTest case to test the vhost-user-blk-server Stefan Hajnoczi
2021-02-23 14:46 ` [PATCH v3 06/12] tests/qtest: add multi-queue test case to vhost-user-blk-test Stefan Hajnoczi
2021-02-23 14:46 ` [PATCH v3 07/12] block/export: fix blk_size double byteswap Stefan Hajnoczi
2021-02-23 14:46 ` [PATCH v3 08/12] block/export: use VIRTIO_BLK_SECTOR_BITS Stefan Hajnoczi
2021-02-23 14:46 ` [PATCH v3 09/12] block/export: fix vhost-user-blk export sector number calculation Stefan Hajnoczi
2021-02-23 14:46 ` [PATCH v3 10/12] block/export: port virtio-blk discard/write zeroes input validation Stefan Hajnoczi
2021-02-23 14:46 ` [PATCH v3 11/12] vhost-user-blk-test: test discard/write zeroes invalid inputs Stefan Hajnoczi
2021-02-23 14:46 ` [PATCH v3 12/12] block/export: port virtio-blk read/write range check Stefan Hajnoczi
2021-03-03 12:40 ` [PATCH v3 00/12] block/export: vhost-user-blk server tests and input validation Kevin Wolf
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=20210223111018-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=Coiby.Xu@gmail.com \
--cc=jasowang@redhat.com \
--cc=kwolf@redhat.com \
--cc=lvivier@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=raphael.norwitz@nutanix.com \
--cc=stefanha@redhat.com \
--cc=thuth@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 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.