From: Jason Wang <jasowang@redhat.com>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: mst@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH net V5] virtio-net: validate features during probe
Date: Thu, 20 Nov 2014 17:52:50 +0800 [thread overview]
Message-ID: <546DB9F2.2020806@redhat.com> (raw)
In-Reply-To: <20141120104824.0a9e2060.cornelia.huck@de.ibm.com>
On 11/20/2014 05:48 PM, Cornelia Huck wrote:
> On Thu, 20 Nov 2014 17:03:05 +0800
> Jason Wang <jasowang@redhat.com> wrote:
>
>> We currently trigger BUG when VIRTIO_NET_F_CTRL_VQ
>> is not set but one of features depending on it is.
>> That's not a friendly way to report errors to
>> hypervisors.
>> Let's check, and fail probe instead.
>>
>> Cc: Rusty Russell <rusty@rustcorp.com.au>
>> Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
>> Cc: Wanlong Gao <gaowanlong@cn.fujitsu.com>
>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> +static bool virtnet_validate_features(struct virtio_device *vdev)
>> +{
>> + if (!virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ) &&
>> + (VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_RX,
>> + "VIRTIO_NET_F_CTRL_VQ") ||
>> + VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_VLAN,
>> + "VIRTIO_NET_F_CTRL_VQ") ||
>> + VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_GUEST_ANNOUNCE,
>> + "VIRTIO_NET_F_CTRL_VQ") ||
>> + VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_MQ, "VIRTIO_NET_F_CTRL_VQ") ||
>> + VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR,
>> + "VIRTIO_NET_F_CTRL_VQ"))) {
>> + return false;
>> + }
>> +
>> + return true;
>> +}
> I still think it may make sense to print all incorrectly set bits, but
> let's just fix the BUG() trigger for now.
>
> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>
Right, will do it in the future.
Thanks
WARNING: multiple messages have this Message-ID (diff)
From: Jason Wang <jasowang@redhat.com>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: rusty@rustcorp.com.au, mst@redhat.com,
virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Wanlong Gao <gaowanlong@cn.fujitsu.com>
Subject: Re: [PATCH net V5] virtio-net: validate features during probe
Date: Thu, 20 Nov 2014 17:52:50 +0800 [thread overview]
Message-ID: <546DB9F2.2020806@redhat.com> (raw)
In-Reply-To: <20141120104824.0a9e2060.cornelia.huck@de.ibm.com>
On 11/20/2014 05:48 PM, Cornelia Huck wrote:
> On Thu, 20 Nov 2014 17:03:05 +0800
> Jason Wang <jasowang@redhat.com> wrote:
>
>> We currently trigger BUG when VIRTIO_NET_F_CTRL_VQ
>> is not set but one of features depending on it is.
>> That's not a friendly way to report errors to
>> hypervisors.
>> Let's check, and fail probe instead.
>>
>> Cc: Rusty Russell <rusty@rustcorp.com.au>
>> Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
>> Cc: Wanlong Gao <gaowanlong@cn.fujitsu.com>
>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> +static bool virtnet_validate_features(struct virtio_device *vdev)
>> +{
>> + if (!virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ) &&
>> + (VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_RX,
>> + "VIRTIO_NET_F_CTRL_VQ") ||
>> + VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_VLAN,
>> + "VIRTIO_NET_F_CTRL_VQ") ||
>> + VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_GUEST_ANNOUNCE,
>> + "VIRTIO_NET_F_CTRL_VQ") ||
>> + VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_MQ, "VIRTIO_NET_F_CTRL_VQ") ||
>> + VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR,
>> + "VIRTIO_NET_F_CTRL_VQ"))) {
>> + return false;
>> + }
>> +
>> + return true;
>> +}
> I still think it may make sense to print all incorrectly set bits, but
> let's just fix the BUG() trigger for now.
>
> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>
Right, will do it in the future.
Thanks
next prev parent reply other threads:[~2014-11-20 9:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-20 9:03 [PATCH net V5] virtio-net: validate features during probe Jason Wang
2014-11-20 9:03 ` Jason Wang
2014-11-20 9:48 ` Cornelia Huck
2014-11-20 9:48 ` Cornelia Huck
2014-11-20 9:52 ` Jason Wang [this message]
2014-11-20 9:52 ` Jason Wang
2014-11-20 12:44 ` Michael S. Tsirkin
2014-11-20 12:44 ` Michael S. Tsirkin
2014-11-21 5:27 ` David Miller
2014-11-21 5:27 ` David Miller
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=546DB9F2.2020806@redhat.com \
--to=jasowang@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.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.