qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>,
	"Daniel P. Berrange" <berrange@redhat.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	qemu-devel@nongnu.org,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v1 2/2] char: allow passing pre-opened socket file descriptor at startup
Date: Thu, 21 Dec 2017 13:05:54 -0600	[thread overview]
Message-ID: <11c497d0-6e59-c836-7e73-74b617673d8e@redhat.com> (raw)
In-Reply-To: <87mv2cuiut.fsf@dusky.pond.sub.org>

On 12/21/2017 10:49 AM, Markus Armbruster wrote:
> QAPI schema review only.
> 

>> @@ -123,10 +124,16 @@
>>   #
>>   # @unix:  Unix domain socket
>>   #
>> +# @vsock: VSOCK socket
>> +#
>> +# @fd: socket file descriptor passed over monitor
>> +#
> 
> Indepedent doc fix.  I'd put it in a separate patch.

Missed in v2, so we still need that.

> 
> One inaccuracy: @fd is *not* a file descriptor, it's the *name* of a
> file descriptor.  Please fix.
> 
>> +# @fdset: socket file descriptor passed via CLI (since 2.12)
>> +#
> 
> I gather we have to ways to pass file descriptors.  One way identifies
> them by name (member @fd), the other by numeric ID (member @fdset).

Yes, sort of.

> 
> 0. This is disgusting.  Is there any way to unify the two, and deprecate
> the loser (hopefully the numeric one)?

v2 went with the numeric one for the CLI, as it is less verbose.

> 
> 1. What makes the second one a *set*?

We have two existing mechanisms for fd passing:

a) HMP and QMP have the older 'getfd' command since 0.14, which 
associates a single fd (via SCM_RIGHTS) with a name (which cannot start 
with a digit).  This does not scale - every command that wants to use an 
fd like this has to be updated to take an explicit fd argument; and you 
can't alter permissions on the fd after the fact.

b) QMP added the newer 'add-fd' in 1.2, which allows the association of 
multiple fds (via SCM_RIGHTS) with a set number (the set is then 
accessed via the magic prefix /dev/fdset/NNN.  This was also exposed via 
the command line, via '--add-fd', at the same time.  It also scales 
better, in that any command that already takes a filename now operates 
on fdsets as needed; also, you can associate multiple fds to the set 
(one that is read-only, another that is read-write), and qemu will 
alternate between fds according to permissions needed at the time.

New code targetting QMP should use only 'add-fd'; particularly since 
-addfd is the only version that works via CLI, even if there is only one 
fd in the set.  But it is more verbose, so having CLI shorthand that 
takes just an fd number is sometimes acceptable.

> 
> 2. What ties the second one to the CLI?  Accidents of implementation or
> something deeper?
> 

At this point, more history than anything else.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

      parent reply	other threads:[~2017-12-21 19:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-21 13:27 [Qemu-devel] [PATCH v1 0/2] Enable passing pre-opened chardev socket FDs Daniel P. Berrange
2017-12-21 13:27 ` [Qemu-devel] [PATCH v1 1/2] io: move fd_is_socket() into common sockets code Daniel P. Berrange
2017-12-21 13:49   ` Marc-André Lureau
2017-12-21 13:27 ` [Qemu-devel] [PATCH v1 2/2] char: allow passing pre-opened socket file descriptor at startup Daniel P. Berrange
2017-12-21 13:48   ` Marc-André Lureau
2017-12-21 14:18     ` Eric Blake
2017-12-21 14:20   ` Daniel P. Berrange
2017-12-21 16:49   ` Markus Armbruster
2017-12-21 16:53     ` Daniel P. Berrange
2017-12-21 19:05     ` Eric Blake [this message]

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=11c497d0-6e59-c836-7e73-74b617673d8e@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=marcandre.lureau@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).