All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: Jason Wang <jasowang@redhat.com>, qemu-devel@nongnu.org
Cc: Juan Quintela <quintela@redhat.com>,
	Jens Freimann <jfreimann@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH 1/2] virtio: add a way to disable a queue
Date: Mon, 9 Aug 2021 18:12:54 +0200	[thread overview]
Message-ID: <763ebfaa-72bb-bb0f-03b3-83c93f9a43f1@redhat.com> (raw)
In-Reply-To: <a298d8a8-b221-29e4-8f8f-a7db158b5e85@redhat.com>

On 09/08/2021 05:01, Jason Wang wrote:
> 
> 在 2021/8/6 下午3:27, Laurent Vivier 写道:
>> On 06/08/2021 08:25, Jason Wang wrote:
>>> 在 2021/8/2 下午4:42, Laurent Vivier 写道:
>>>> On 02/08/2021 06:50, Jason Wang wrote:
>>>>> 在 2021/7/30 上午3:19, Laurent Vivier 写道:
>>>>>> Add virtio_queue_disable()/virtio_queue_enable() to disable/enable a queue
>>>>>> by setting vring.num to 0 (or num_default).
>>>>>> This is needed to be able to disable a guest driver from the host side
>>>>> I suspect this won't work correclty for vhost.
>>>> With my test it seems to work with vhost too.
>>>
>>> So setting 0 will lead -EINVAL to be returned during VHOST_SET_VRING_NUM. I think qemu
>>> will warn the failure in this case.
>> I didn't see any error when I tried. I will check the code.
>>
>>> What's more important, it's not guaranteed to work for the case of vhost-user or
>>> vhost-vDPA.
>> Perhaps we can target only the vhost host case, as this is used for failover and usually
>> the virtio-net device is backed by a bridge on same network as the VFIO device?
> 
> 
> Probably not, it should be a general feature that can work for all types of virtio/vhost
> backends.
> 
> 
>>
>>>
>>>>> And I believe we should only do this after the per queue enabling/disabling is supported
>>>>> by the spec.
>>>>>
>>>>> (only MMIO support that AFAIK)
>>>> I don't want to modify the spec.
>>>>
>>>> I need something that works without modifying existing (old) drivers.
>>>>
>>>> The idea is to be able to disable the virtio-net kernel driver from QEMU if the driver is
>>>> too old (i.e. it doesn't support STANDBY feature).
>>>>
>>>> Setting vring.num to 0 forces the kernel driver to exit on error in the probe function.
>>>> It's what I want: the device is present but disabled (the driver is not loaded).
>>>>
>>>> Any other suggestion?
>>>
>>> I think we should probably disable the device instead of doing it per virtqueue.
>>>
>> I tried to use virtio_set_disabled() but it doesn't work.
>> Perhaps it's too late when I call the function (I need to do that in
>> virtio_net_set_features()). What I want is to prevent the load of the driver in the guest
>> kernel to hide the virtio-net device. Setting vring.num to 0 triggers an error in the
>> driver probe function and prevents the load of the driver.
> 
> 
> How about fail the validate_features() in this case?

It's a good suggestion and it seems to work.

I'm going to send an updated patch.

Thanks,
Laurent



  reply	other threads:[~2021-08-09 16:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29 19:19 [PATCH 0/2] virtio: failover: allow to keep the VFIO device rather than the virtio-net one Laurent Vivier
2021-07-29 19:19 ` [PATCH 1/2] virtio: add a way to disable a queue Laurent Vivier
2021-08-02  4:50   ` Jason Wang
2021-08-02  8:42     ` Laurent Vivier
2021-08-06  6:25       ` Jason Wang
2021-08-06  7:27         ` Laurent Vivier
2021-08-09  3:01           ` Jason Wang
2021-08-09 16:12             ` Laurent Vivier [this message]
2021-07-29 19:19 ` [PATCH 2/2] virtio: failover: define the default device to use in case of error Laurent Vivier

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=763ebfaa-72bb-bb0f-03b3-83c93f9a43f1@redhat.com \
    --to=lvivier@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=jfreimann@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@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.