Discussion of the VIRTIO specification
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Eugenio Perez Martin <eperezma@redhat.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
	"virtio-comment@lists.oasis-open.org"
	<virtio-comment@lists.oasis-open.org>,
	Laurent Vivier <lvivier@redhat.com>, Cindy Lu <lulu@redhat.com>,
	"cohuck@redhat.com" <cohuck@redhat.com>,
	"alvaro.karsz@solid-run.com" <alvaro.karsz@solid-run.com>,
	Liuxiangdong <liuxiangdong5@huawei.com>,
	Gautam Dawar <gdawar@xilinx.com>,
	"longpeng2@huawei.com" <longpeng2@huawei.com>,
	Dragos Tatulea <dtatulea@nvidia.com>,
	"stefanha@redhat.com" <stefanha@redhat.com>,
	Harpreet Singh Anand <hanand@xilinx.com>,
	Stefano Garzarella <sgarzare@redhat.com>,
	Heng Qi <hengqi@linux.alibaba.com>,
	"jasowang@redhat.com" <jasowang@redhat.com>,
	Zhu Lingshan <lingshan.zhu@intel.com>,
	Shannon Nelson <snelson@pensando.io>,
	Max Gurtovoy <mgurtovoy@nvidia.com>,
	"si-wei.liu@oracle.com" <si-wei.liu@oracle.com>,
	Parav Pandit <parav@nvidia.com>
Subject: Re: [virtio-comment] Re: [PATCH 1/2] virtio: introduce selective queue enabling
Date: Thu, 8 Jun 2023 10:39:50 -0400	[thread overview]
Message-ID: <20230608103816-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CAJaqyWdusP1DXGV4==ddVRjh9FaTcu2u-4d03_4kOaf2Zom+GQ@mail.gmail.com>

On Thu, Jun 08, 2023 at 04:18:23PM +0200, Eugenio Perez Martin wrote:
> On Thu, Jun 8, 2023 at 2:24 PM Xuan Zhuo <xuanzhuo@linux.alibaba.com> wrote:
> >
> > On Tue, 6 Jun 2023 15:19:53 -0400, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > > On Tue, Jun 06, 2023 at 06:04:32PM +0000, Parav Pandit wrote:
> > > > Hi Eugenio,
> > > >
> > > > > From: Eugenio P閞ez <eperezma@redhat.com>
> > > > > Sent: Tuesday, June 6, 2023 1:55 PM
> > > > >
> > > > > This patch allows the driver to start the device (as set DRIVER_OK) with only
> > > > > some queues enabled, and then enable another queues later.
> > > > >
> > > > > This is the current way to migrate net device state through control virtqueue, in
> > > > > a software assisted framework with vDPA:
> > > > > * First, only net CVQ is enabled at DRIVER_OK
> > > > > * All the control commands (mac address, mq, etc) needed for the device to
> > > > > behave the same as the source of migration are sent
> > > > > * Finally all the dataplane queues are enabled.
> > > > >
> > > > > Signed-off-by: Eugenio P閞ez <eperezma@redhat.com>
> > > > > ---
> > > > >  content.tex | 15 +++++++++++++--
> > > > >  1 file changed, 13 insertions(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/content.tex b/content.tex
> > > > > index d2ab9eb..ea4a6d8 100644
> > > > > --- a/content.tex
> > > > > +++ b/content.tex
> > > > > @@ -99,10 +99,10 @@ \section{Feature Bits}\label{sec:Basic Facilities of a
> > > > > Virtio Device / Feature B  \begin{description}
> > > > >  \item[0 to 23, and 50 to 127] Feature bits for the specific device type
> > > > >
> > > > > -\item[24 to 41] Feature bits reserved for extensions to the queue and
> > > > > +\item[24 to 42] Feature bits reserved for extensions to the queue and
> > > > >    feature negotiation mechanisms
> > > > >
> > > > > -\item[42 to 49, and 128 and above] Feature bits reserved for future extensions.
> > > > > +\item[43 to 49, and 128 and above] Feature bits reserved for future
> > > > > extensions.
> > > > >  \end{description}
> > > > >
> > > > >  \begin{note}
> > > > > @@ -398,6 +398,13 @@ \section{Virtqueues}\label{sec:Basic Facilities of a
> > > > > Virtio Device / Virtqueues}  Every driver and device supports either the Packed
> > > > > or the Split  Virtqueue format, or both.
> > > > >
> > > > > +\subsection{Virtqueue selective enabling}\label{sec:Basic Facilities of
> > > > > +a Virtio Device / Virtqueues / Selective Virtqueue Enable}
> > > > > +
> > > > > +If the driver negotiates VIRTIO\_F\_RING\_ENABLE\_ANYTIME, it can
> > > > > +enable individual virtqueues both before and after the DRIVER\_OK. The
> > > > > +way to enable a virtqueue is transport specific, but it mimics the
> > > > > +re-enabling after an hypothetical reset.
> > > > > +
> > > > >  \subsection{Virtqueue Reset}\label{sec:Basic Facilities of a Virtio Device /
> > > > > Virtqueues / Virtqueue Reset}
> > > > >
> > > > >  When VIRTIO_F_RING_RESET is negotiated, the driver can reset a virtqueue
> > > > > @@ -870,6 +877,10 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved
> > > > > Feature Bits}
> > > > >   \ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits} for
> > > > >   handling features reserved for future use.
> > > > >
> > > > > +  \item[VIRTIO_F_RING_ENABLE_ANYTIME(42)] This feature indicates  that
> > > > > + the driver can enable a queue both before and after DRIVER\_OK.
> > > > > +  See \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Selective
> > > > > Virtqueue Enable}.
> > > > > +
> > > >
> > > > Can you please highlight, current spec normative which indicates that
> > > > all queues must be enabled before DRIVER_OK and more queues cannot be
> > > > enabled after DRIVER_OK?
> > >
> > >
> > > This one:
> > > \drivernormative{\subsection}{Device Initialization}{General Initialization And Device Operation / Device Initialization}
> > >
> > > it does not say "all queues" if you want to split hairs but I think
> > > assuming it's safe to enable queues later is dangerous.
> >
> > Although there is no "all queues" here, if the queue is not ready, the device
> > may use all the queues after "Device OK". So I also think it might be dangerous.
> >
> > But I also ran into this problem. We want the device to support 100 queues, but
> > we also want to use only 16 queues by default. The user can then manually scale
> > up to 100, if the user has a large memory.
> >
> > So I think, the point is that "num_queues" is the max and default value. Can we
> > change "num_queues" to default, then we introduced a new value as max.
> >
> > Does this way solve your problem? @Eugenio
> >
> 
> It would need a tweak, but it gives me an idea.
> 
> I think you're talking about what the device offers, isn't it? I would
> need to modify it from the driver.
> 
> But it has an interesting question, how to allocate "less vrings" than
> virtio_pci_common_cfg.num_queues?

Just allocate less, don't configure what you do not use.

> I guess it is ok to set all vq
> addresses to a vring that never increments avail_idx? The driver still
> needs to allocate memory for that one and lose start time configuring
> them.
> 
> Maybe for net is valid to leave them unconfigured? it should only use
> one vq pair and CVQ by default.

It's ok for all devices, and this is how it always worked.

> My proposal could be done at the virtio-net level, allowing
> max_virtqueue_pairs to be 0 from the beginning. For example, allowing
> the driver to write it before DRIVER_OK. In that case, no data vq is
> enabled and only CVQ process requests after DRIVER_OK. After all the
> config is written, the driver changes the number of active queues with
> VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET.
> 
> I think it is better solved in a generic way, but I'm ok with this
> -net specific too.
> 
> Thanks!
> 
> > Thanks.
> >
> >
> >
> > >
> > > E.g. vhost user backends tend to assume no new queues appear
> > > after DRIVER_OK.
> > >
> > > --
> > > MST
> > >
> >
> > This publicly archived list offers a means to provide input to the
> > OASIS Virtual I/O Device (VIRTIO) TC.
> >
> > In order to verify user consent to the Feedback License terms and
> > to minimize spam in the list archive, subscription is required
> > before posting.
> >
> > Subscribe: virtio-comment-subscribe@lists.oasis-open.org
> > Unsubscribe: virtio-comment-unsubscribe@lists.oasis-open.org
> > List help: virtio-comment-help@lists.oasis-open.org
> > List archive: https://lists.oasis-open.org/archives/virtio-comment/
> > Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
> > List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
> > Committee: https://www.oasis-open.org/committees/virtio/
> > Join OASIS: https://www.oasis-open.org/join/
> >


This publicly archived list offers a means to provide input to the
OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and
to minimize spam in the list archive, subscription is required
before posting.

Subscribe: virtio-comment-subscribe@lists.oasis-open.org
Unsubscribe: virtio-comment-unsubscribe@lists.oasis-open.org
List help: virtio-comment-help@lists.oasis-open.org
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/


  reply	other threads:[~2023-06-08 14:40 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-06 17:55 [virtio-comment] [PATCH 0/2] Selective queue enabling Eugenio Pérez
2023-06-06 17:55 ` [virtio-comment] [PATCH 1/2] virtio: introduce selective " Eugenio Pérez
2023-06-06 18:04   ` [virtio-comment] " Parav Pandit
2023-06-06 19:19     ` [virtio-comment] " Michael S. Tsirkin
2023-06-06 19:25       ` [virtio-comment] " Parav Pandit
2023-06-08 11:53         ` Eugenio Perez Martin
2023-06-08 13:15           ` Parav Pandit
2023-06-08 15:05             ` Michael S. Tsirkin
2023-06-08 15:07               ` Parav Pandit
2023-06-08 15:11           ` Michael S. Tsirkin
2023-06-08 12:11       ` [virtio-comment] " Xuan Zhuo
2023-06-08 13:21         ` [virtio-comment] " Parav Pandit
2023-06-08 14:18         ` [virtio-comment] " Eugenio Perez Martin
2023-06-08 14:39           ` Michael S. Tsirkin [this message]
2023-06-09  3:53           ` Xuan Zhuo
2023-06-06 19:11   ` Michael S. Tsirkin
2023-06-13  7:50   ` Michael S. Tsirkin
2023-06-13  8:28     ` Eugenio Perez Martin
2023-06-06 17:55 ` [virtio-comment] [PATCH 2/2] virtio: pci support virtqueue selective enabling Eugenio Pérez
2023-06-06 19:09   ` [virtio-comment] " Michael S. Tsirkin
2023-06-07  7:37     ` Eugenio Perez Martin
2023-06-07  9:03       ` Michael S. Tsirkin
2023-06-07  9:46         ` Eugenio Perez Martin
2023-06-06 19:09 ` [virtio-comment] Re: [PATCH 0/2] Selective queue enabling Michael S. Tsirkin
2023-06-07  5:35   ` Eugenio Perez Martin
2023-06-07  8:22     ` Xuan Zhuo
2023-06-07  8:47       ` Eugenio Perez Martin
2023-06-07  8:59         ` Michael S. Tsirkin
2023-06-07  9:41           ` Eugenio Perez Martin
2023-06-07 20:26             ` Michael S. Tsirkin
2023-06-08  0:44               ` Jason Wang
2023-06-08  6:04                 ` Michael S. Tsirkin
2023-06-08  6:43                   ` Eugenio Perez Martin
2023-06-08  7:18                     ` Michael S. Tsirkin
2023-06-08  7:47                       ` Jason Wang
2023-06-08 13:44                         ` Michael S. Tsirkin
2023-06-08  8:36                       ` Eugenio Perez Martin
2023-06-08 14:13                         ` Parav Pandit
2023-06-08 22:08                         ` Michael S. Tsirkin
2023-06-09 10:27                           ` Eugenio Perez Martin
2023-06-09 15:54                             ` Michael S. Tsirkin
2023-06-12  7:56                               ` Eugenio Perez Martin
2023-06-13  7:46                                 ` Michael S. Tsirkin
2023-06-13  7:53                                   ` Michael S. Tsirkin
2023-06-13 10:12                                     ` Eugenio Perez Martin
2023-06-13 12:28                                       ` Michael S. Tsirkin
2023-06-15  8:35                                         ` Eugenio Perez Martin
2023-06-16 14:40                                           ` Michael S. Tsirkin
2023-06-17 12:53                                             ` Eugenio Perez Martin
2023-06-17 23:08                                               ` Michael S. Tsirkin
2023-06-24 18:40                                                 ` Eugenio Perez Martin
2023-06-25  5:31                                                   ` Jason Wang
2023-06-25 21:32                                                     ` Michael S. Tsirkin
2023-06-26  2:53                                                       ` Jason Wang
2023-06-26  8:19                                                         ` Eugenio Perez Martin
2023-06-26  9:40                                                           ` Michael S. Tsirkin
2023-06-27  8:07                                                             ` Jason Wang
2023-06-13 19:00                                       ` Parav Pandit
2023-06-13 19:54                                         ` Michael S. Tsirkin
2023-06-13 21:09                                           ` Parav Pandit
2023-06-13 21:19                                             ` Parav Pandit
2023-06-13 21:48                                             ` Michael S. Tsirkin
2023-06-13 21:54                                               ` Parav Pandit
2023-06-14  4:26                                                 ` Zhu, Lingshan
2023-06-14  4:32                                                   ` Parav Pandit
2023-06-14  6:11                                                     ` Zhu, Lingshan
2023-06-14 11:56                                                       ` Parav Pandit
2023-06-15  5:56                                                         ` Zhu, Lingshan
2023-06-16  9:19                                                           ` Eugenio Perez Martin
2023-06-08  7:46                   ` Jason Wang
2023-07-06 18:18 ` [virtio-comment] " Eugenio Perez Martin
2023-07-10  3:55   ` Jason Wang
2023-07-10  5:49     ` Michael S. Tsirkin
2023-07-10 12:13       ` Parav Pandit
2023-07-11  3:09         ` Jason Wang
2023-07-11  3:08       ` Jason Wang

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=20230608103816-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=alvaro.karsz@solid-run.com \
    --cc=cohuck@redhat.com \
    --cc=dtatulea@nvidia.com \
    --cc=eperezma@redhat.com \
    --cc=gdawar@xilinx.com \
    --cc=hanand@xilinx.com \
    --cc=hengqi@linux.alibaba.com \
    --cc=jasowang@redhat.com \
    --cc=lingshan.zhu@intel.com \
    --cc=liuxiangdong5@huawei.com \
    --cc=longpeng2@huawei.com \
    --cc=lulu@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mgurtovoy@nvidia.com \
    --cc=parav@nvidia.com \
    --cc=sgarzare@redhat.com \
    --cc=si-wei.liu@oracle.com \
    --cc=snelson@pensando.io \
    --cc=stefanha@redhat.com \
    --cc=virtio-comment@lists.oasis-open.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox