qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Cody <jcody@redhat.com>
To: Programmingkid <programmingkidx@gmail.com>
Cc: "Kevin Wolf" <kwolf@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"qemu-devel qemu-devel" <qemu-devel@nongnu.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	jsnow@redhat.com, "Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] Should we auto-generate IDs?
Date: Thu, 27 Aug 2015 08:32:34 -0400	[thread overview]
Message-ID: <20150827123234.GB2669@localhost.localdomain> (raw)
In-Reply-To: <2CB0CE30-A638-4933-A1D6-F65CA4910E61@gmail.com>

(Added Eric back in to the CC list.  Looks like he got dropped
somewhere along the way)

On Wed, Aug 26, 2015 at 11:22:08PM -0400, Programmingkid wrote:
> 
> On Aug 26, 2015, at 6:01 PM, Jeff Cody wrote:
> 
> > On Wed, Aug 26, 2015 at 02:17:17PM -0400, Programmingkid wrote:
> >> 
> >> On Aug 26, 2015, at 2:08 PM, Jeff Cody wrote:
> >> 
> >>> On Wed, Aug 26, 2015 at 01:29:04PM -0400, Programmingkid wrote:
> >>>> 
> >>>> On Aug 26, 2015, at 1:25 PM, Jeff Cody wrote:
> >>>> 
> >>>>> On Wed, Aug 26, 2015 at 06:31:57PM +0200, Markus Armbruster wrote:
> >>>>>> Did you drop cc's intentionally?  I put them right back.
> >>>>>> 
> >>>>>> Programmingkid <programmingkidx@gmail.com> writes:
> >>>>>> 
> >>>>>>> On Aug 25, 2015, at 8:38 AM, Markus Armbruster wrote:
> >>>>>>> 
> >>>>>>>> You're proposing to revise a qdev design decision, namely the purpose of
> >>>>>>>> IDs.  This has been discussed before, and IDs remained unchanged.
> >>>>>>>> Perhaps it's time to revisit this issue.  Cc'ing a few more people.
> >>>>>>>> 
> >>>>>>>> Relevant prior threads:
> >>>>>>>> * [PATCH] qdev: Reject duplicate and anti-social device IDs
> >>>>>>>> http://thread.gmane.org/gmane.comp.emulators.qemu/71230/focus=72272
> >>>>>>>> * [PATCH 6/6] qdev: Generate IDs for anonymous devices
> >>>>>>>> http://thread.gmane.org/gmane.comp.emulators.qemu/114853/focus=114858
> >>>>>>>> * [PATCH] qdev: Assign a default device ID when none is provided.
> >>>>>>>> http://thread.gmane.org/gmane.comp.emulators.qemu/249702
> >>>>>>>> * IDs in QOM (was: [PATCH] util: Emancipate id_wellformed() from QemuOpt
> >>>>>>>> http://thread.gmane.org/gmane.comp.emulators.qemu/299945/focus=300381
> >>>>>>>> 
> >>>>>>> 
> >>>>>>> After reading all the threads, I realize why all the attempts to
> >>>>>>> accept a device ID patch failed.
> >>>>>>> It is because it was assumed everyone would agree on one patch to
> >>>>>>> accept. This is
> >>>>>>> very unlikely. It would take someone in a leadership position to
> >>>>>>> decide which patch
> >>>>>>> should be accepted. From one of the threads above, I saw Anthony
> >>>>>>> Liguori participate.
> >>>>>>> He was in the perfect position to make the choice. The person who is
> >>>>>>> in his position now
> >>>>>>> is Peter Maydell. Maybe we should just ask him to look at all the
> >>>>>>> candidate patches and
> >>>>>>> have him pick one to use. 
> >>>>>> 
> >>>>>> Yes, when no consensus emerges, problems tend to go unsolved.
> >>>>>> 
> >>>>>> Before we appeal to authority to break the deadlock, we should make
> >>>>>> another attempt at finding consensus.
> >>>>>> 
> >>>>>> I know that we've entertained the idea of automatically generated IDs
> >>>>>> for block layer objects (that's why I cc'ed some block guys).
> >>>>> 
> >>>>> Yeah, I was one of the ones that proposed some auto-generated IDs for
> >>>>> the block layer, specifically for BlockDriverState, making use of the
> >>>>> node-name field that Benoit introduced a while ago.  Here is my patch
> >>>>> (not sure if this is the latest version, but it is sufficient for this
> >>>>> discussion):
> >>>>> 
> >>>>> http://patchwork.ozlabs.org/patch/355990/
> >>>>> 
> >>>>> I'm not sure about the requirements needed by device ID names, and
> >>>>> they may of course differ from what I was thinking for BDS entries.
> >>>>> 
> >>>>> Here is what I was after with my patch for node-name auto-generation:
> >>>>> 
> >>>>> * Identifiable as QEMU generated / reserved namespace
> >>>>> 
> >>>>> * Guaranteed uniqueness
> >>>>> 
> >>>>> * Non-predictable (don't want users trying to guess / assume
> >>>>> generated node-names)
> >>>>> 
> >>>>> My approach was overkill in some ways (24 characters!).  But for
> >>>>> better or worse, what I had was:
> >>>>> 
> >>>>>              __qemu##00000000IAIYNXXR
> >>>>>              ^^^^^^^^
> >>>>> QEMU namespace ----|    ^^^^^^^^
> >>>>>                        |     ^^^^^^^^^
> >>>>> Increment counter, unique |         |
> >>>>>                                  |
> >>>>> Random string, to spoil prediction  |
> >>>> 
> >>>> Yikes! 24 characters long. That is a bit much to type. Thank you very much
> >>>> for your effort.
> >>> 
> >>> IMO, the number of characters to type is pretty low on the list of
> >>> requirements, although it can still be addressed secondary to other
> >>> concerns.
> >>> 
> >>> I should have made this in reply to Markus' other email, because the
> >>> important part of this is try and address his point #2:
> >>> 
> >>> (from Markus' other email):
> >>>> 2. The ID must be well-formed.
> >>> 
> >>> To have a well-formed ID, we need to have know requirements of the ID
> >>> structure (i.e. the why and what of it all)
> >>> 
> >>> I don't know if the three requirements I had above apply to all areas
> >>> in QEMU, but I expect they do, in varying degrees of importance.  The
> >>> length itself can be tweaked.
> >>> 
> >>> Talking with John Snow over IRC (added to the CC), one thing he
> >>> suggested was adding in sub-domain spaces; e.g.:
> >>> 
> >>> __qemu#bn#00000000#IAIYNXXR
> >>> 
> >>> Where the 'bn' in this case would be for Block Nodes, etc..
> >>> 
> >>> This may make the scheme extensible through QEMU, where auto-generated
> >>> IDs are desired.
> >>> 
> >>> (sorry to say, this lengthens things, rather than shortening them!)
> >>> 
> >>> We can, of course, make the string shorter - if the random characters
> >>> are just there for spoiling predictability, then 2-3 should be
> >>> sufficient. We could then end up with something like this:
> >>> 
> >>> __qemu#bn#00000000#XR
> >>> 
> >>> The "__qemu" part of the namespace could be shortened as well, but it
> >>> would be nice if it was easy recognizable as being from QEMU.
> >> 
> >> If this ID format was supported, I'm thinking being able to copy and paste from
> >> the monitor is a necessary feature. 
> >> 
> >> Any way it could be shorted? I was hoping no more than three characters long. 
> >> 
> > 
> > Likely could be shorter, but something in the realm of three
> > characters doesn't seem very realistic.
> 
> Sure it is. Just set device id's like this: 0, 1, 2, 3, 4, 5, 6....

I'm not married to the ID generation scheme I proposed.  

What I am trying to do, however, is have a technical discussion on
generating an ID in a well-formed manner.  And hopefully, in a way
that is useful to all interested subsystems, if possible.

Do you disagree with the requirements I listed above?  If so, it would
be useful to begin the discussion around that.  For ease of
discussion, I'll list them again:

* Reserved namespaces
* Uniqueness
* Non-predictable (to avoid inadvertently creating a de facto ABI)


. . .

On the generation scheme proposed above:

I understand that something you desire is an ID that is easier to
type.

If we wanted to make it shorter, perhaps we could have the number
counter be variable length:

            qemu#ss#D#XY
              |   | | |
qemu reserved -   | | |
                  | | |
subsystem name ---| | |
                    | |
    counter --------| |
                      |
    2-digit random ---|


The counter would just grow to however many digits are needed.  There
is another benefit to growing that number as well - we can use
whatever integer size we think is adequate in the code, without
affecting the generation scheme.

-Jeff

  reply	other threads:[~2015-08-27 12:32 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-24 18:53 [Qemu-devel] [PATCH] qdev-monitor.c: Add device id generation Programmingkid
2015-08-24 22:21 ` Eric Blake
2015-08-25 12:42   ` Markus Armbruster
2015-08-25 15:25     ` Programmingkid
2015-08-25 15:33       ` Peter Maydell
2015-08-25 15:50         ` Programmingkid
2015-08-25 18:30           ` Markus Armbruster
2015-08-25 19:05             ` Programmingkid
2015-08-25 14:33   ` Programmingkid
2015-08-25 12:38 ` [Qemu-devel] Should we auto-generate IDs? (was: [PATCH] qdev-monitor.c: Add device id generation) Markus Armbruster
2015-08-25 15:15   ` Programmingkid
2015-08-26 14:52   ` Programmingkid
2015-08-26 16:31     ` [Qemu-devel] Should we auto-generate IDs? Markus Armbruster
2015-08-26 17:16       ` Programmingkid
2015-08-26 18:45         ` Peter Maydell
2015-08-26 21:48           ` Programmingkid
2015-08-26 22:08             ` John Snow
2015-08-27  3:40               ` Programmingkid
2015-08-27  5:39                 ` Markus Armbruster
2015-08-27 15:39                   ` Programmingkid
2015-08-26 17:25       ` Jeff Cody
2015-08-26 17:29         ` Programmingkid
2015-08-26 18:08           ` Jeff Cody
2015-08-26 18:17             ` Programmingkid
2015-08-26 22:01               ` Jeff Cody
2015-08-26 22:04                 ` John Snow
2015-08-27  3:26                   ` Programmingkid
2015-08-27  3:22                 ` Programmingkid
2015-08-27 12:32                   ` Jeff Cody [this message]
2015-08-27 13:00                     ` Eric Blake
2015-08-27 13:39                       ` Programmingkid
2015-08-27 13:51                         ` Daniel P. Berrange
2015-08-27 14:01                           ` Eric Blake
2015-08-27 14:18                             ` Jeff Cody
2015-08-27 14:19                             ` Programmingkid
2015-08-27 14:01                           ` Programmingkid
2015-08-27 18:59                       ` John Snow
2015-08-27 19:20                         ` Eric Blake
2015-08-27 13:33                     ` Programmingkid
2015-08-27 13:49                       ` Daniel P. Berrange
2015-08-27 13:56                         ` Programmingkid
2015-08-27 14:02                           ` Eric Blake
2015-08-27 14:34                             ` Programmingkid
2015-08-27 14:42                               ` Daniel P. Berrange
2015-08-27 15:20                                 ` Programmingkid
2015-08-27 15:40                                   ` Jeff Cody
2015-08-27 15:58                                     ` Programmingkid
2015-08-27 16:02                                       ` Daniel P. Berrange
2015-08-27 16:08                                         ` Programmingkid
2015-08-27 16:22                                           ` Daniel P. Berrange
2015-08-27 16:49                                             ` Programmingkid
2015-08-27 20:15                                             ` Programmingkid
2015-08-27 19:08                                         ` Jeff Cody
2015-08-27 19:27                                           ` Eric Blake
2015-08-27 20:37                                             ` Jeff Cody
2015-08-27 14:06                           ` Daniel P. Berrange
2015-08-27 14:54                             ` Programmingkid
2015-08-27 14:07                       ` Jeff Cody
2015-08-27 15:13                         ` Programmingkid
2015-08-27 15:19                           ` Daniel P. Berrange
2015-08-27 15:22                             ` Programmingkid
2015-08-27 15:55                               ` Daniel P. Berrange
2015-08-27 16:03                                 ` Programmingkid
2015-08-27 16:06                                   ` Daniel P. Berrange
2015-08-27 16:08                                     ` Eric Blake
2015-09-01 12:34                     ` Kevin Wolf
2015-09-01 14:18                       ` Programmingkid
2015-09-01 14:43                         ` Kevin Wolf
2015-09-01 15:55                           ` Programmingkid
2015-09-03 14:34       ` Programmingkid
2015-09-03 14:43         ` Jeff Cody
2015-09-03 15:55           ` Programmingkid
2015-09-03 16:12           ` [Qemu-devel] [PATCH v3] qdev-monitor.c: Add device id generation Programmingkid
2015-08-26 17:28   ` [Qemu-devel] Should we auto-generate IDs? (was: [PATCH] qdev-monitor.c: Add device id generation) Daniel P. Berrange
2015-08-26 17:46     ` Programmingkid
2015-08-26 17:53       ` Daniel P. Berrange
2015-08-26 18:01         ` Programmingkid
2015-08-27 13:54           ` Daniel P. Berrange
2015-08-27 14:03             ` Programmingkid

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=20150827123234.GB2669@localhost.localdomain \
    --to=jcody@redhat.com \
    --cc=afaerber@suse.de \
    --cc=armbru@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=programmingkidx@gmail.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).