qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eugenio Perez Martin <eperezma@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Parav Pandit <parav@mellanox.com>,
	Juan Quintela <quintela@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-level <qemu-devel@nongnu.org>,
	virtualization@lists.linux-foundation.org,
	Harpreet Singh Anand <hanand@xilinx.com>,
	Xiao W Wang <xiao.w.wang@intel.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Eli Cohen <eli@mellanox.com>,
	Stefano Garzarella <sgarzare@redhat.com>
Subject: Re: [RFC v3 04/29] vhost: Add x-vhost-enable-shadow-vq qmp
Date: Wed, 9 Jun 2021 16:06:12 +0200	[thread overview]
Message-ID: <CAJaqyWcwAAAXGZD5huHjYUvrDQyEQgmnv4iTCzY4=qT9zWMgFg@mail.gmail.com> (raw)
In-Reply-To: <87wnr3p8fn.fsf@dusky.pond.sub.org>

On Wed, Jun 9, 2021 at 1:46 PM Markus Armbruster <armbru@redhat.com> wrote:
>
> Eugenio Perez Martin <eperezma@redhat.com> writes:
>
> > On Tue, Jun 8, 2021 at 4:23 PM Markus Armbruster <armbru@redhat.com> wrote:
> >>
> >> Eugenio Perez Martin <eperezma@redhat.com> writes:
> >>
> >> > On Fri, May 21, 2021 at 9:05 AM Markus Armbruster <armbru@redhat.com> wrote:
> >> >>
> >> >> Eugenio Pérez <eperezma@redhat.com> writes:
> >> >>
> >> >> > Command to enable shadow virtqueue looks like:
> >> >> >
> >> >> > { "execute": "x-vhost-enable-shadow-vq",
> >> >> >   "arguments": { "name": "dev0", "enable": true } }
> >> >> >
> >> >> > Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> >> >> > ---
> >> >> >  qapi/net.json     | 22 ++++++++++++++++++++++
> >> >> >  hw/virtio/vhost.c |  6 ++++++
> >> >> >  2 files changed, 28 insertions(+)
> >> >> >
> >> >> > diff --git a/qapi/net.json b/qapi/net.json
> >> >> > index c31748c87f..660feafdd2 100644
> >> >> > --- a/qapi/net.json
> >> >> > +++ b/qapi/net.json
> >> >> > @@ -77,6 +77,28 @@
> >> >> >  ##
> >> >> >  { 'command': 'netdev_del', 'data': {'id': 'str'} }
> >> >> >
> >> >> > +##
> >> >> > +# @x-vhost-enable-shadow-vq:
> >> >> > +#
> >> >> > +# Use vhost shadow virtqueue.
> >> >> > +#
> >> >> > +# @name: the device name of the VirtIO device
> >> >> > +#
> >> >> > +# @enable: true to use he alternate shadow VQ notification path
> >>
> >> [...]
> >>
> >> >> > +#
> >> >> > +# Returns: Error if failure, or 'no error' for success. Not found if vhost is not enabled.
> >> >>
> >> >> This is confusing.  What do you mean by "Not found"?
> >> >>
> >> >> If you mean DeviceNotFound:
> >> >>
> >> >> 1. Not actually true: qmp_x_vhost_enable_shadow_vq() always fails with
> >> >> GenericError.  Perhaps later patches will change that.
> >>
> >> [...]
> >>
> >> >> 2. Do you really need to distinguish "vhost is not enabled" from other
> >> >> errors?
> >> >>
> >> >
> >> > SVQ cannot work if the device backend is not vhost, like qemu VirtIO
> >> > dev. What I meant is that "qemu will only look for its name in the set
> >> > of vhost devices, so you will have a device not found if the device is
> >> > not a vhost one", which may not be 100% clear at first glance. Maybe
> >> > this wording is better?
> >>
> >> We might be talking past each other.  Let me try again :)
> >>
> >> The following question is *not* about the doc comment, it's about the
> >> *code*: what practical problem is solved by using DeviceNotFound instead
> >> of GenericError for some errors?
> >>
> >
> > Sorry, I'm not sure if I follow you :). At risk of being circular in
> > this topic, the only use case I can think is to actually tell the
> > difference between "the device does not exists, or is not a vhost
> > device" and "the device does not support SVQ because X", where X can
> > be "it uses a packed ring", "it uses event idx", ...
> >
> > I can only think of one practical use case, "if you see this error,
> > you probably forgot to set vhost=on in the command line, or something
> > is forbidding this device to be a vhost one". Having said that, I'm
> > totally fine with using GenericError always, but I see the more
> > fine-grained the error the better. What would be the advantage of also
> > using GenericError here?
>
> In the initial design of the Error API, every error had its own distinct
> class.  This provided for fine-grained errors.
>
> Adding a new error was bothersome: you had to define a new class, in
> qerror.h.  Recompile the world.  Conflict magnet.  Constant temptation
> to reuse an existing error even when its error message is suboptimal,
> and the reuse of the class for another error conflates errors.
>
> After a bit under three years, we had 70 classes, used in almost 400
> places.  Management applications actually cared for just six classes.
>
> Bad error messages and development friction had turned out to be a real
> problem.  Conflating errors pretty much not.
>
> We concluded that providing for fine-grained errors when next to nothing
> uses them was not worth the pain.  So we ditched them:
>
>     https://lists.nongnu.org/archive/html/qemu-devel/2012-08/msg01958.html
>     Commit ac839ccd8c3..adb2072ed0f
>
> Since them, we recommend to use GenericError unless there is a
> compelling reason not to.  "Something might care someday" doesn't
> qualify.
>
> Learning by doing the wrong thing is painful and expensive, but at least
> the lessons tends to stick ;)
>
> Today, we have more than 4000 callers of error_setg(), and less than 40
> of error_set().
>

So let's do it with GenericError then :). Thanks for pointing it out,
it will be fixed in the next revision!

> > Just to be sure that we are on the same page, I think this is better
> > seen from PATCH 07/39: vhost: Route guest->host notification through
> > shadow virtqueue.
> >
> >> [...]
> >>
>



  reply	other threads:[~2021-06-09 14:07 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19 16:28 [RFC v3 00/29] vDPA software assisted live migration Eugenio Pérez
2021-05-19 16:28 ` [RFC v3 01/29] virtio: Add virtio_queue_is_host_notifier_enabled Eugenio Pérez
2021-05-19 16:28 ` [RFC v3 02/29] vhost: Save masked_notifier state Eugenio Pérez
2021-05-19 16:28 ` [RFC v3 03/29] vhost: Add VhostShadowVirtqueue Eugenio Pérez
2021-05-19 16:28 ` [RFC v3 04/29] vhost: Add x-vhost-enable-shadow-vq qmp Eugenio Pérez
2021-05-21  7:05   ` Markus Armbruster
2021-05-24  7:13     ` Eugenio Perez Martin
2021-06-08 14:23       ` Markus Armbruster
2021-06-08 15:26         ` Eugenio Perez Martin
2021-06-09 11:46           ` Markus Armbruster
2021-06-09 14:06             ` Eugenio Perez Martin [this message]
2021-05-19 16:28 ` [RFC v3 05/29] virtio: Add VIRTIO_F_QUEUE_STATE Eugenio Pérez
2021-05-19 16:28 ` [RFC v3 06/29] virtio-net: Honor VIRTIO_CONFIG_S_DEVICE_STOPPED Eugenio Pérez
2021-05-26  1:06   ` Jason Wang
2021-05-26  1:10     ` Jason Wang
2021-06-01  7:13       ` Eugenio Perez Martin
2021-06-03  3:12         ` Jason Wang
2021-05-19 16:28 ` [RFC v3 07/29] vhost: Route guest->host notification through shadow virtqueue Eugenio Pérez
2021-05-19 16:28 ` [RFC v3 08/29] vhost: Route host->guest " Eugenio Pérez
2021-05-19 16:28 ` [RFC v3 09/29] vhost: Avoid re-set masked notifier in shadow vq Eugenio Pérez
2021-05-19 16:28 ` [RFC v3 10/29] virtio: Add vhost_shadow_vq_get_vring_addr Eugenio Pérez
2021-05-19 16:28 ` [RFC v3 11/29] vhost: Add vhost_vring_pause operation Eugenio Pérez
2021-05-19 16:28 ` [RFC v3 12/29] vhost: add vhost_kernel_vring_pause Eugenio Pérez
2021-05-19 16:28 ` [RFC v3 13/29] vhost: Add vhost_get_iova_range operation Eugenio Pérez
2021-05-26  1:14   ` Jason Wang
2021-05-26 17:49     ` Eugenio Perez Martin
2021-05-27  4:51       ` Jason Wang
2021-06-01  7:17         ` Eugenio Perez Martin
2021-06-03  3:13           ` Jason Wang
2021-05-19 16:28 ` [RFC v3 14/29] vhost: add vhost_has_limited_iova_range Eugenio Pérez
2021-05-19 16:28 ` [RFC v3 15/29] vhost: Add enable_custom_iommu to VhostOps Eugenio Pérez
2021-05-31  9:01   ` Jason Wang
2021-06-01  7:49     ` Eugenio Perez Martin
2021-05-19 16:28 ` [RFC v3 16/29] vhost-vdpa: Add vhost_vdpa_enable_custom_iommu Eugenio Pérez
2021-05-19 16:28 ` [RFC v3 17/29] vhost: Shadow virtqueue buffers forwarding Eugenio Pérez
2021-06-02  9:50   ` Jason Wang
2021-06-02 17:18     ` Eugenio Perez Martin
2021-06-03  3:34       ` Jason Wang
2021-06-04  8:37         ` Eugenio Perez Martin
2021-05-19 16:28 ` [RFC v3 18/29] vhost: Use vhost_enable_custom_iommu to unmap everything if available Eugenio Pérez
2021-05-19 16:28 ` [RFC v3 19/29] vhost: Check for device VRING_USED_F_NO_NOTIFY at shadow virtqueue kick Eugenio Pérez
2021-05-19 16:28 ` [RFC v3 20/29] vhost: Use VRING_AVAIL_F_NO_INTERRUPT at device call on shadow virtqueue Eugenio Pérez
2021-05-19 16:28 ` [RFC v3 21/29] vhost: Add VhostIOVATree Eugenio Pérez
2021-05-31  9:40   ` Jason Wang
2021-06-01  8:15     ` Eugenio Perez Martin
2021-07-14  3:04       ` Jason Wang
2021-07-14  6:54         ` Eugenio Perez Martin
2021-07-14  9:14           ` Eugenio Perez Martin
2021-07-14  9:33             ` Jason Wang
2021-05-19 16:28 ` [RFC v3 22/29] vhost: Add iova_rev_maps_find_iova to IOVAReverseMaps Eugenio Pérez
2021-05-19 16:28 ` [RFC v3 23/29] vhost: Use a tree to store memory mappings Eugenio Pérez
2021-05-19 16:28 ` [RFC v3 24/29] vhost: Add iova_rev_maps_alloc Eugenio Pérez
2021-05-19 16:28 ` [RFC v3 25/29] vhost: Add custom IOTLB translations to SVQ Eugenio Pérez
2021-06-02  9:51   ` Jason Wang
2021-06-02 17:51     ` Eugenio Perez Martin
2021-06-03  3:39       ` Jason Wang
2021-06-04  9:07         ` Eugenio Perez Martin
2021-05-19 16:29 ` [RFC v3 26/29] vhost: Map in vdpa-dev Eugenio Pérez
2021-05-19 16:29 ` [RFC v3 27/29] vhost-vdpa: Implement vhost_vdpa_vring_pause operation Eugenio Pérez
2021-05-19 16:29 ` [RFC v3 28/29] vhost-vdpa: never map with vDPA listener Eugenio Pérez
2021-05-19 16:29 ` [RFC v3 29/29] vhost: Start vhost-vdpa SVQ directly Eugenio Pérez
2021-05-24  9:38 ` [RFC v3 00/29] vDPA software assisted live migration Michael S. Tsirkin
2021-05-24 10:37   ` Eugenio Perez Martin
2021-05-24 11:29     ` Michael S. Tsirkin
2021-07-19 14:13       ` Stefan Hajnoczi
2021-05-25  0:09     ` Jason Wang
2021-06-02  9:59 ` 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='CAJaqyWcwAAAXGZD5huHjYUvrDQyEQgmnv4iTCzY4=qT9zWMgFg@mail.gmail.com' \
    --to=eperezma@redhat.com \
    --cc=armbru@redhat.com \
    --cc=eli@mellanox.com \
    --cc=hanand@xilinx.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=parav@mellanox.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=sgarzare@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xiao.w.wang@intel.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;
as well as URLs for NNTP newsgroup(s).