qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Laurent Vivier" <lvivier@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	qemu-devel@nongnu.org,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Eric Blake" <eblake@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Laine Stump" <laine@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH] net: vhost-user: add QAPI events to report connection state
Date: Fri, 14 Feb 2025 15:38:19 +0100	[thread overview]
Message-ID: <20250214153819.286365e4@elisabeth> (raw)
In-Reply-To: <Z69TxVIQS16yDiS2@redhat.com>

On Fri, 14 Feb 2025 14:31:33 +0000
Daniel P. Berrangé <berrange@redhat.com> wrote:

> On Fri, Feb 14, 2025 at 03:28:34PM +0100, Stefano Brivio wrote:
> > On Fri, 14 Feb 2025 14:19:13 +0000
> > Daniel P. Berrangé <berrange@redhat.com> wrote:
> >   
> > > On Fri, Feb 14, 2025 at 01:59:20PM +0000, Daniel P. Berrangé wrote:  
> > > > On Fri, Feb 14, 2025 at 11:18:55AM +0100, Laurent Vivier wrote:    
> > > > > On 14/02/2025 11:06, Markus Armbruster wrote:    
> > > > > > Laurent Vivier <lvivier@redhat.com> writes:
> > > > > >     
> > > > > > > The netdev reports NETDEV_VHOST_USER_CONNECTED event when
> > > > > > > the chardev is connected, and NETDEV_VHOST_USER_DISCONNECTED
> > > > > > > when it is disconnected.
> > > > > > > 
> > > > > > > The NETDEV_VHOST_USER_CONNECTED event includes the ChardevInfo
> > > > > > > (label, filename and frontend_open).
> > > > > > > 
> > > > > > > This allows a system manager like libvirt to detect when the server
> > > > > > > fails.
> > > > > > > 
> > > > > > > For instance with passt:
> > > > > > > 
> > > > > > > { 'execute': 'qmp_capabilities' }
> > > > > > > { "return": { } }
> > > > > > > 
> > > > > > > [killing passt here]
> > > > > > > 
> > > > > > > { "timestamp": { "seconds": 1739517243, "microseconds": 115081 },
> > > > > > >    "event": "NETDEV_VHOST_USER_DISCONNECTED",
> > > > > > >    "data": { "netdev-id": "netdev0" } }
> > > > > > > 
> > > > > > > [automatic reconnection with reconnect-ms]
> > > > > > > 
> > > > > > > { "timestamp": { "seconds": 1739517290, "microseconds": 343777 },
> > > > > > >    "event": "NETDEV_VHOST_USER_CONNECTED",
> > > > > > >    "data": { "netdev-id": "netdev0",
> > > > > > >              "info": { "frontend-open": true,
> > > > > > >                        "filename": "unix:",
> > > > > > >                        "label": "chr0" } } }
> > > > > > > 
> > > > > > > Signed-off-by: Laurent Vivier <lvivier@redhat.com>    
> > > > > > 
> > > > > > Standard question for events: if a management application misses an
> > > > > > event, say because it restarts and reconnects, is there a way to obtain
> > > > > > the missed information with a query command?
> > > > > >     
> > > > > 
> > > > > query-chardev could help but it doesn't provide the netdev id.    
> > > > 
> > > > It doesn't have to IMHO. The application that created the NIC should know
> > > > what ID it assigned to both the netdev and chardev, and thus should be
> > > > able to use query-chardev to identify the chardev it previously
> > > > associated with the netdev.    
> > > 
> > > That said I kind of wonder whether we should be adding events against
> > > the chardev directly, instead of against the netdev use of chardev.  
> > 
> > What is the advantage? This already works and is consistent with the
> > existing non-vhost-user mechanism.  
> 
> The advantage is that chardevs are used in many places across QEMU, so
> emitting the events against the chardev is more broadly useful to
> consumers of QEMU, than doing a special case that only benefit vhostuser
> NICS.

It's not so much of a special case because it would be perfectly in
line with the NETDEV_STREAM_DISCONNECTED event and its usage in
applications (the only current user being libvirt).

That's a proven approach and the matching implementation for passt is
trivial because of that.

-- 
Stefano



  reply	other threads:[~2025-02-14 14:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-14  7:26 [PATCH] net: vhost-user: add QAPI events to report connection state Laurent Vivier
2025-02-14  8:53 ` Stefano Brivio
2025-02-14 10:06 ` Markus Armbruster
2025-02-14 10:18   ` Laurent Vivier
2025-02-14 13:54     ` Markus Armbruster
2025-02-14 14:13       ` Stefano Brivio
2025-02-14 13:59     ` Daniel P. Berrangé
2025-02-14 14:18       ` Stefano Brivio
2025-02-14 14:19       ` Daniel P. Berrangé
2025-02-14 14:28         ` Stefano Brivio
2025-02-14 14:31           ` Daniel P. Berrangé
2025-02-14 14:38             ` Stefano Brivio [this message]
2025-02-17 10:22         ` 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=20250214153819.286365e4@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=laine@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.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 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).