Received: from eggs.gnu.org ([2001:4830:134:3::10]:44074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUxJP-0008A1-2Z for qemu-devel@nongnu.org; Thu, 27 Aug 2015 09:33:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUxJI-0004Lj-Lj for qemu-devel@nongnu.org; Thu, 27 Aug 2015 09:33:51 -0400 Received: from mail-qk0-x22b.google.com ([2607:f8b0:400d:c09::22b]:34182) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUxJI-0004Lc-HV for qemu-devel@nongnu.org; Thu, 27 Aug 2015 09:33:44 -0400 Received: by qkfh127 with SMTP id h127so10291202qkf.1 for ; Thu, 27 Aug 2015 06:33:44 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Programmingkid In-Reply-To: <20150827123234.GB2669@localhost.localdomain> Date: Thu, 27 Aug 2015 09:33:42 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: <56530C98-D6B3-417E-BB58-E29412283BF1@gmail.com> References: <29C62C49-06A5-4F99-8062-7269A28C29A3@gmail.com> <8737z7o85i.fsf@blackfin.pond.sub.org> <441C227A-2CF0-43AE-AC7F-B066708CEABD@gmail.com> <87fv36j9j6.fsf@blackfin.pond.sub.org> <20150826172550.GJ11016@localhost.localdomain> <20150826180815.GK11016@localhost.localdomain> <20150826220151.GA2669@localhost.localdomain> <2CB0CE30-A638-4933-A1D6-F65CA4910E61@gmail.com> <20150827123234.GB2669@localhost.localdomain> Subject: Re: [Qemu-devel] Should we auto-generate IDs? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jeff Cody Cc: Kevin Wolf , Markus Armbruster , qemu-devel qemu-devel , Paolo Bonzini , jsnow@redhat.com, =?iso-8859-1?Q?Andreas_F=E4rber?= On Aug 27, 2015, at 8:32 AM, Jeff Cody wrote: > (Added Eric back in to the CC list. Looks like he got dropped > somewhere along the way) >=20 > On Wed, Aug 26, 2015 at 11:22:08PM -0400, Programmingkid wrote: >>=20 >> On Aug 26, 2015, at 6:01 PM, Jeff Cody wrote: >>=20 >>> On Wed, Aug 26, 2015 at 02:17:17PM -0400, Programmingkid wrote: >>>>=20 >>>> On Aug 26, 2015, at 2:08 PM, Jeff Cody wrote: >>>>=20 >>>>> On Wed, Aug 26, 2015 at 01:29:04PM -0400, Programmingkid wrote: >>>>>>=20 >>>>>> On Aug 26, 2015, at 1:25 PM, Jeff Cody wrote: >>>>>>=20 >>>>>>> On Wed, Aug 26, 2015 at 06:31:57PM +0200, Markus Armbruster = wrote: >>>>>>>> Did you drop cc's intentionally? I put them right back. >>>>>>>>=20 >>>>>>>> Programmingkid writes: >>>>>>>>=20 >>>>>>>>> On Aug 25, 2015, at 8:38 AM, Markus Armbruster wrote: >>>>>>>>>=20 >>>>>>>>>> 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. >>>>>>>>>>=20 >>>>>>>>>> Relevant prior threads: >>>>>>>>>> * [PATCH] qdev: Reject duplicate and anti-social device IDs >>>>>>>>>> = http://thread.gmane.org/gmane.comp.emulators.qemu/71230/focus=3D72272 >>>>>>>>>> * [PATCH 6/6] qdev: Generate IDs for anonymous devices >>>>>>>>>> = http://thread.gmane.org/gmane.comp.emulators.qemu/114853/focus=3D114858 >>>>>>>>>> * [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=3D300381 >>>>>>>>>>=20 >>>>>>>>>=20 >>>>>>>>> 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. =46rom 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.=20 >>>>>>>>=20 >>>>>>>> Yes, when no consensus emerges, problems tend to go unsolved. >>>>>>>>=20 >>>>>>>> Before we appeal to authority to break the deadlock, we should = make >>>>>>>> another attempt at finding consensus. >>>>>>>>=20 >>>>>>>> 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). >>>>>>>=20 >>>>>>> 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): >>>>>>>=20 >>>>>>> http://patchwork.ozlabs.org/patch/355990/ >>>>>>>=20 >>>>>>> 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. >>>>>>>=20 >>>>>>> Here is what I was after with my patch for node-name = auto-generation: >>>>>>>=20 >>>>>>> * Identifiable as QEMU generated / reserved namespace >>>>>>>=20 >>>>>>> * Guaranteed uniqueness >>>>>>>=20 >>>>>>> * Non-predictable (don't want users trying to guess / assume >>>>>>> generated node-names) >>>>>>>=20 >>>>>>> My approach was overkill in some ways (24 characters!). But for >>>>>>> better or worse, what I had was: >>>>>>>=20 >>>>>>> __qemu##00000000IAIYNXXR >>>>>>> ^^^^^^^^ >>>>>>> QEMU namespace ----| ^^^^^^^^ >>>>>>> | ^^^^^^^^^ >>>>>>> Increment counter, unique | | >>>>>>> | >>>>>>> Random string, to spoil prediction | >>>>>>=20 >>>>>> Yikes! 24 characters long. That is a bit much to type. Thank you = very much >>>>>> for your effort. >>>>>=20 >>>>> 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. >>>>>=20 >>>>> I should have made this in reply to Markus' other email, because = the >>>>> important part of this is try and address his point #2: >>>>>=20 >>>>> (from Markus' other email): >>>>>> 2. The ID must be well-formed. >>>>>=20 >>>>> 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) >>>>>=20 >>>>> 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. >>>>>=20 >>>>> Talking with John Snow over IRC (added to the CC), one thing he >>>>> suggested was adding in sub-domain spaces; e.g.: >>>>>=20 >>>>> __qemu#bn#00000000#IAIYNXXR >>>>>=20 >>>>> Where the 'bn' in this case would be for Block Nodes, etc.. >>>>>=20 >>>>> This may make the scheme extensible through QEMU, where = auto-generated >>>>> IDs are desired. >>>>>=20 >>>>> (sorry to say, this lengthens things, rather than shortening = them!) >>>>>=20 >>>>> 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: >>>>>=20 >>>>> __qemu#bn#00000000#XR >>>>>=20 >>>>> 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. >>>>=20 >>>> If this ID format was supported, I'm thinking being able to copy = and paste from >>>> the monitor is a necessary feature.=20 >>>>=20 >>>> Any way it could be shorted? I was hoping no more than three = characters long.=20 >>>>=20 >>>=20 >>> Likely could be shorter, but something in the realm of three >>> characters doesn't seem very realistic. >>=20 >> Sure it is. Just set device id's like this: 0, 1, 2, 3, 4, 5, 6.... >=20 > I'm not married to the ID generation scheme I proposed. =20 >=20 > 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. >=20 > 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: >=20 > * Reserved namespaces > * Uniqueness > * Non-predictable (to avoid inadvertently creating a de facto ABI) Uniqueness is a must. Reserve namespaces? Why do we need to do this? What is wrong with having a predictable ID? Maybe we need to discuss where this ID is going to be used. I know I=20 need it for the device_del monitor command. Any other places you or anyone else knows it is used? > . . >=20 > On the generation scheme proposed above: >=20 > I understand that something you desire is an ID that is easier to > type. >=20 > If we wanted to make it shorter, perhaps we could have the number > counter be variable length: >=20 > qemu#ss#D#XY > | | | | > qemu reserved - | | | > | | | > subsystem name ---| | | > | | > counter --------| | > | > 2-digit random ---| >=20 >=20 > 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. >=20 > -Jeff This system does seem easy to type. Do we need the "qemu" part? It seems unnecessary. Maybe we could do this: Examples: For the third block device it would look like this: bl3 For the seventh USB device it would look like this: ub7 Each subsystem would receive a two character code.=20