qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
	qemu-devel@nongnu.org, Eugenio Perez Martin <eperezma@redhat.com>,
	German Maglione <gmaglione@redhat.com>,
	Liu Jiang <gerry@linux.alibaba.com>,
	Sergio Lopez Pascual <slp@redhat.com>,
	Stefano Garzarella <sgarzare@redhat.com>,
	Jason Wang <jasowang@redhat.com>
Subject: Re: [PATCH 7/7] vhost-user: call VHOST_USER_SET_VRING_ENABLE synchronously
Date: Tue, 3 Oct 2023 10:25:04 -0400	[thread overview]
Message-ID: <20231003102338-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <037ac5f2-8c19-e1ff-fc96-3cda8755924f@redhat.com>

On Tue, Oct 03, 2023 at 03:23:24PM +0200, Laszlo Ersek wrote:
> On 10/3/23 15:08, Stefan Hajnoczi wrote:
> > On Tue, 3 Oct 2023 at 08:27, Michael S. Tsirkin <mst@redhat.com> wrote:
> >>
> >> On Mon, Oct 02, 2023 at 05:13:26PM -0400, Stefan Hajnoczi wrote:
> >>> One more question:
> >>>
> >>> Why is the disabled state not needed by regular (non-vhost) virtio-net devices?
> >>
> >> Tap does the same - it purges queued packets:
> >>
> >> int tap_disable(NetClientState *nc)
> >> {
> >>     TAPState *s = DO_UPCAST(TAPState, nc, nc);
> >>     int ret;
> >>
> >>     if (s->enabled == 0) {
> >>         return 0;
> >>     } else {
> >>         ret = tap_fd_disable(s->fd);
> >>         if (ret == 0) {
> >>             qemu_purge_queued_packets(nc);
> >>             s->enabled = false;
> >>             tap_update_fd_handler(s);
> >>         }
> >>         return ret;
> >>     }
> >> }
> > 
> > tap_disable() is not equivalent to the vhost-user "started but
> > disabled" ring state. tap_disable() is a synchronous one-time action,
> > while "started but disabled" is a continuous state.
> > 
> > The "started but disabled" ring state isn't needed to achieve this.
> > The back-end can just drop tx buffers upon receiving
> > VHOST_USER_SET_VRING_ENABLE .num=0.
> > 
> > The history of the spec is curious. VHOST_USER_SET_VRING_ENABLE was
> > introduced before the the "started but disabled" state was defined,
> > and it explicitly mentions tap attach/detach:
> > 
> > commit 7263a0ad7899994b719ebed736a1119cc2e08110
> > Author: Changchun Ouyang <changchun.ouyang@intel.com>
> > Date:   Wed Sep 23 12:20:01 2015 +0800
> > 
> >     vhost-user: add a new message to disable/enable a specific virt queue.
> > 
> >     Add a new message, VHOST_USER_SET_VRING_ENABLE, to enable or disable
> >     a specific virt queue, which is similar to attach/detach queue for
> >     tap device.
> > 
> > and then later:
> > 
> > commit c61f09ed855b5009f816242ce281fd01586d4646
> > Author: Michael S. Tsirkin <mst@redhat.com>
> > Date:   Mon Nov 23 12:48:52 2015 +0200
> > 
> >     vhost-user: clarify start and enable
> > 
> >>
> >> what about non tap backends? I suspect they just aren't
> >> used widely with multiqueue so no one noticed.
> > 
> > I still don't understand why "started but disabled" is needed instead
> > of just two ring states: enabled and disabled.
> > 
> > It seems like the cleanest path going forward is to keep the "ignore
> > rx, discard tx" semantics for virtio-net devices but to clarify in the
> > spec that other device types do not process the ring:
> > 
> > "
> > * started but disabled: the back-end must not process the ring. For legacy
> >   reasons there is an exception for the networking device, where the
> >   back-end must process and discard any TX packets and not process
> >   other rings.
> > "
> > 
> > What do you think?
> 
> ... from a vhost-user backend perspective, won't this create a need for
> all "ring processor" (~ virtio event loop) implementations to support
> both methods? IIUC, the "virtio pop" is usually independent of the
> particular device to which the requests are ultimately delivered. So the
> event loop would have to grow a new parameter regarding "what to do in
> the started-but-disabled state", the network device would have to pass
> in one value (-> pop & drop), and all other devices would have to pass
> in the other value (stop popping).
> 
> ... I figure in rust-vmm/vhost it would affect the "handle_event"
> function in "crates/vhost-user-backend/src/event_loop.rs".
> 
> Do I understand right? (Not disagreeing, just pondering the impact on
> backends.)
> 
> Laszlo

Already the case I guess - RX ring is not processed, TX is. Right?

-- 
MST



  reply	other threads:[~2023-10-03 14:25 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-27 18:29 [PATCH 0/7] vhost-user: call VHOST_USER_SET_VRING_ENABLE synchronously Laszlo Ersek
2023-08-27 18:29 ` [PATCH 1/7] vhost-user: strip superfluous whitespace Laszlo Ersek
2023-08-30  8:26   ` Stefano Garzarella
2023-08-30 15:04   ` Philippe Mathieu-Daudé
2023-08-27 18:29 ` [PATCH 2/7] vhost-user: tighten "reply_supported" scope in "set_vring_addr" Laszlo Ersek
2023-08-30  8:27   ` Stefano Garzarella
2023-08-30 15:04   ` Philippe Mathieu-Daudé
2023-08-27 18:29 ` [PATCH 3/7] vhost-user: factor out "vhost_user_write_msg" Laszlo Ersek
2023-08-28 22:46   ` Philippe Mathieu-Daudé
2023-08-30  8:31   ` Stefano Garzarella
2023-08-30  9:14     ` Laszlo Ersek
2023-08-30  9:54       ` Laszlo Ersek
2023-08-27 18:29 ` [PATCH 4/7] vhost-user: flatten "enforce_reply" into "vhost_user_write_msg" Laszlo Ersek
2023-08-28 22:47   ` Philippe Mathieu-Daudé
2023-08-30  8:31   ` Stefano Garzarella
2023-08-27 18:29 ` [PATCH 5/7] vhost-user: hoist "write_msg", "get_features", "get_u64" Laszlo Ersek
2023-08-30  8:32   ` Stefano Garzarella
2023-08-30 15:04   ` Philippe Mathieu-Daudé
2023-08-27 18:29 ` [PATCH 6/7] vhost-user: allow "vhost_set_vring" to wait for a reply Laszlo Ersek
2023-08-28 22:49   ` Philippe Mathieu-Daudé
2023-08-30  8:32   ` Stefano Garzarella
2023-08-27 18:29 ` [PATCH 7/7] vhost-user: call VHOST_USER_SET_VRING_ENABLE synchronously Laszlo Ersek
2023-08-30  8:39   ` Stefano Garzarella
2023-08-30  9:26     ` Laszlo Ersek
2023-08-30 14:24       ` Stefano Garzarella
2023-08-30  8:41   ` Laszlo Ersek
2023-08-30  8:59     ` Laszlo Ersek
2023-08-30  9:04       ` Laszlo Ersek
2023-08-30 12:10   ` Stefan Hajnoczi
2023-08-30 13:30     ` Laszlo Ersek
2023-08-30 15:37       ` Stefan Hajnoczi
2023-09-05  6:30         ` Laszlo Ersek
2023-09-25 15:31           ` Laszlo Ersek
2023-10-01 19:24             ` Michael S. Tsirkin
2023-10-01 19:25               ` Michael S. Tsirkin
2023-10-02  1:56                 ` Laszlo Ersek
2023-10-02  6:57                   ` Michael S. Tsirkin
2023-10-02 14:02                     ` Laszlo Ersek
2023-10-02  6:49         ` Michael S. Tsirkin
2023-10-02 21:12           ` Stefan Hajnoczi
2023-10-02 21:13             ` Stefan Hajnoczi
2023-10-03 12:26               ` Michael S. Tsirkin
2023-10-03 13:08                 ` Stefan Hajnoczi
2023-10-03 13:23                   ` Laszlo Ersek
2023-10-03 14:25                     ` Michael S. Tsirkin [this message]
2023-10-03 14:28                       ` Laszlo Ersek
2023-10-03 14:40                   ` Michael S. Tsirkin
2023-10-03 15:45                     ` Stefan Hajnoczi
2023-10-02 22:36             ` Michael S. Tsirkin
2023-10-03  0:17               ` Stefan Hajnoczi
2023-10-03 14:28                 ` Michael S. Tsirkin
2023-10-03 14:41   ` Michael S. Tsirkin
2023-10-03 15:55     ` Stefan Hajnoczi
2023-10-04 10:15       ` Laszlo Ersek
2023-10-04 16:30         ` Michael S. Tsirkin
2023-10-04 10:17       ` Laszlo Ersek
2023-08-30  8:48 ` [PATCH 0/7] " Stefano Garzarella
2023-08-30  9:32   ` Laszlo Ersek

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=20231003102338-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=eperezma@redhat.com \
    --cc=gerry@linux.alibaba.com \
    --cc=gmaglione@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=lersek@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    --cc=slp@redhat.com \
    --cc=stefanha@gmail.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).