From: "Michael S. Tsirkin" <mst@redhat.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: xuanzhuo@linux.alibaba.com, lulu@redhat.com, eperezma@redhat.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
xieyongji@bytedance.com, david.marchand@redhat.com
Subject: Re: [PATCH v2 3/3] vduse: Temporarily disable control queue features
Date: Tue, 4 Jul 2023 12:43:20 -0400 [thread overview]
Message-ID: <20230704124245-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20230704164045.39119-4-maxime.coquelin@redhat.com>
On Tue, Jul 04, 2023 at 06:40:45PM +0200, Maxime Coquelin wrote:
> Virtio-net driver control queue implementation is not safe
> when used with VDUSE. If the VDUSE application does not
> reply to control queue messages, it currently ends up
> hanging the kernel thread sending this command.
>
> Some work is on-going to make the control queue
> implementation robust with VDUSE. Until it is completed,
> let's disable control virtqueue and features that depend on
> it.
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> drivers/vdpa/vdpa_user/vduse_dev.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
> index 1271c9796517..04367a53802b 100644
> --- a/drivers/vdpa/vdpa_user/vduse_dev.c
> +++ b/drivers/vdpa/vdpa_user/vduse_dev.c
> @@ -1778,6 +1778,25 @@ static struct attribute *vduse_dev_attrs[] = {
>
> ATTRIBUTE_GROUPS(vduse_dev);
>
> +static void vduse_dev_features_fixup(struct vduse_dev_config *config)
> +{
> + if (config->device_id == VIRTIO_ID_NET) {
> + /*
> + * Temporarily disable control virtqueue and features that
> + * depend on it while CVQ is being made more robust for VDUSE.
> + */
> + config->features &= ~((1ULL << VIRTIO_NET_F_CTRL_VQ) |
> + (1ULL << VIRTIO_NET_F_CTRL_RX) |
> + (1ULL << VIRTIO_NET_F_CTRL_VLAN) |
> + (1ULL << VIRTIO_NET_F_GUEST_ANNOUNCE) |
> + (1ULL << VIRTIO_NET_F_MQ) |
> + (1ULL << VIRTIO_NET_F_CTRL_MAC_ADDR) |
> + (1ULL << VIRTIO_NET_F_RSS) |
> + (1ULL << VIRTIO_NET_F_HASH_REPORT) |
> + (1ULL << VIRTIO_NET_F_NOTF_COAL));
> + }
> +}
> +
This will never be exhaustive, we are adding new features.
Please add an allowlist with just legal ones instead.
> static int vduse_create_dev(struct vduse_dev_config *config,
> void *config_buf, u64 api_version)
> {
> @@ -1793,6 +1812,8 @@ static int vduse_create_dev(struct vduse_dev_config *config,
> if (!dev)
> goto err;
>
> + vduse_dev_features_fixup(config);
> +
> dev->api_version = api_version;
> dev->device_features = config->features;
> dev->device_id = config->device_id;
> --
> 2.41.0
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: xieyongji@bytedance.com, jasowang@redhat.com,
david.marchand@redhat.com, lulu@redhat.com,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org, xuanzhuo@linux.alibaba.com,
eperezma@redhat.com
Subject: Re: [PATCH v2 3/3] vduse: Temporarily disable control queue features
Date: Tue, 4 Jul 2023 12:43:20 -0400 [thread overview]
Message-ID: <20230704124245-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20230704164045.39119-4-maxime.coquelin@redhat.com>
On Tue, Jul 04, 2023 at 06:40:45PM +0200, Maxime Coquelin wrote:
> Virtio-net driver control queue implementation is not safe
> when used with VDUSE. If the VDUSE application does not
> reply to control queue messages, it currently ends up
> hanging the kernel thread sending this command.
>
> Some work is on-going to make the control queue
> implementation robust with VDUSE. Until it is completed,
> let's disable control virtqueue and features that depend on
> it.
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> drivers/vdpa/vdpa_user/vduse_dev.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
> index 1271c9796517..04367a53802b 100644
> --- a/drivers/vdpa/vdpa_user/vduse_dev.c
> +++ b/drivers/vdpa/vdpa_user/vduse_dev.c
> @@ -1778,6 +1778,25 @@ static struct attribute *vduse_dev_attrs[] = {
>
> ATTRIBUTE_GROUPS(vduse_dev);
>
> +static void vduse_dev_features_fixup(struct vduse_dev_config *config)
> +{
> + if (config->device_id == VIRTIO_ID_NET) {
> + /*
> + * Temporarily disable control virtqueue and features that
> + * depend on it while CVQ is being made more robust for VDUSE.
> + */
> + config->features &= ~((1ULL << VIRTIO_NET_F_CTRL_VQ) |
> + (1ULL << VIRTIO_NET_F_CTRL_RX) |
> + (1ULL << VIRTIO_NET_F_CTRL_VLAN) |
> + (1ULL << VIRTIO_NET_F_GUEST_ANNOUNCE) |
> + (1ULL << VIRTIO_NET_F_MQ) |
> + (1ULL << VIRTIO_NET_F_CTRL_MAC_ADDR) |
> + (1ULL << VIRTIO_NET_F_RSS) |
> + (1ULL << VIRTIO_NET_F_HASH_REPORT) |
> + (1ULL << VIRTIO_NET_F_NOTF_COAL));
> + }
> +}
> +
This will never be exhaustive, we are adding new features.
Please add an allowlist with just legal ones instead.
> static int vduse_create_dev(struct vduse_dev_config *config,
> void *config_buf, u64 api_version)
> {
> @@ -1793,6 +1812,8 @@ static int vduse_create_dev(struct vduse_dev_config *config,
> if (!dev)
> goto err;
>
> + vduse_dev_features_fixup(config);
> +
> dev->api_version = api_version;
> dev->device_features = config->features;
> dev->device_id = config->device_id;
> --
> 2.41.0
next prev parent reply other threads:[~2023-07-04 16:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-04 16:40 [PATCH v2 0/3] vduse: add support for networking devices Maxime Coquelin
2023-07-04 16:40 ` Maxime Coquelin
2023-07-04 16:40 ` [PATCH v2 1/3] vduse: validate block features only with block devices Maxime Coquelin
2023-07-04 16:40 ` Maxime Coquelin
2023-07-04 16:40 ` [PATCH v2 2/3] vduse: enable Virtio-net device type Maxime Coquelin
2023-07-04 16:40 ` Maxime Coquelin
2023-07-04 16:40 ` [PATCH v2 3/3] vduse: Temporarily disable control queue features Maxime Coquelin
2023-07-04 16:40 ` Maxime Coquelin
2023-07-04 16:43 ` Michael S. Tsirkin [this message]
2023-07-04 16:43 ` Michael S. Tsirkin
2023-07-04 19:22 ` Maxime Coquelin
2023-07-04 19:22 ` Maxime Coquelin
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=20230704124245-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=david.marchand@redhat.com \
--cc=eperezma@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lulu@redhat.com \
--cc=maxime.coquelin@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=xieyongji@bytedance.com \
--cc=xuanzhuo@linux.alibaba.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.