Re: [hybi] method of allocation of reserved bits to extensions

Jim Gettys <jg@freedesktop.org> Thu, 26 May 2011 12:47 UTC

Return-Path: <gettysjim@gmail.com>
X-Original-To: hybi@ietfa.amsl.com
Delivered-To: hybi@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 29FA6130044 for <hybi@ietfa.amsl.com>; Thu, 26 May 2011 05:47:51 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.599
X-Spam-Level:
X-Spam-Status: No, score=-3.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AApnEIS2gBYl for <hybi@ietfa.amsl.com>; Thu, 26 May 2011 05:47:50 -0700 (PDT)
Received: from mail-vx0-f172.google.com (mail-vx0-f172.google.com [209.85.220.172]) by ietfa.amsl.com (Postfix) with ESMTP id 4093B130018 for <hybi@ietf.org>; Thu, 26 May 2011 05:47:50 -0700 (PDT)
Received: by vxg33 with SMTP id 33so610292vxg.31 for <hybi@ietf.org>; Thu, 26 May 2011 05:47:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:message-id:date:from:organization :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=p20XGITUBJT7/zWJsfxnn9KIliVFDDUcYaBK8q6rUcM=; b=BSZ/kG0LoEMyB0+vIxNLJ95NT5avPtwq28PCLM9M6exyaTNKskPpXsP8KXdEQiP1Sz eC6goLoSTadr7Wg4gdXyEYzsaTItNFcyTapoHUQD9wuMN3LcNIjwsJl3tQllELapqQ2R dJWRSbcIhW5V9di9BaQZYp1bLW2gdhi+tBY5c=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:organization:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; b=jZyGPhBHjFjyiWq/bHPPRgeoXoJcCAZ01/hV2sso7XVbyUSNVog2S/xl4XSoQwVzY6 49yOaVkZr6YMBrfxikpIQrve73NU5AM1Ll4PBnK5zRo+Y8yOY/NPGLF9zDpMWNsFrYx/ uL/+gJXdnqVG3RwyM2wMwBQ6ebB7ao5ruZsI8=
Received: by 10.52.114.196 with SMTP id ji4mr978864vdb.29.1306413529683; Thu, 26 May 2011 05:38:49 -0700 (PDT)
Received: from [192.168.1.119] (c-98-229-99-32.hsd1.ma.comcast.net [98.229.99.32]) by mx.google.com with ESMTPS id cx6sm300306vbb.6.2011.05.26.05.38.47 (version=SSLv3 cipher=OTHER); Thu, 26 May 2011 05:38:48 -0700 (PDT)
Sender: Jim Gettys <gettysjim@gmail.com>
Message-ID: <4DDE49D6.3010708@freedesktop.org>
Date: Thu, 26 May 2011 08:38:46 -0400
From: Jim Gettys <jg@freedesktop.org>
Organization: Bell Labs
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Lightning/1.0b2 Thunderbird/3.1.10
MIME-Version: 1.0
To: Greg Wilkins <gregw@intalio.com>
References: <BANLkTi=vOQDtL5GobitKe8yiUoQFb2go_Q@mail.gmail.com> <BANLkTikiUkivJitZGU-+q6wBfJ3VW45F8g@mail.gmail.com> <BANLkTindmLQ0KE6K5qUX2ue+=hoLUaznLA@mail.gmail.com> <BANLkTim9w83iSY-TH1yuVAUXxypJk_tmrw@mail.gmail.com> <BANLkTimnMBwNgP_e29exT6dUkp60s2xU3g@mail.gmail.com> <BANLkTi==RTfqaYFT3CQs1pM5Tb501rk2Vg@mail.gmail.com> <BANLkTinqQiMQ4N1vWjyCe682BmdisW-=KA@mail.gmail.com> <BANLkTik1a6CEA8LiiLgsnBt9qHCaybmWfg@mail.gmail.com> <4DBA3809.4010004@oracle.com> <CA566BAEAD6B3F4E8B5C5C4F61710C11402DB23F@TK5EX14MBXW603.wingroup.windeploy.ntdev.microsoft.com> <BANLkTim8dkW3R2R1ukAqwkXOM0=uqfiPmA@mail.gmail.com> <4DD61D35.10404@warmcat.com> <BANLkTi=57EYWnuOv3n=crHsgC5t3x=PPkA@mail.gmail.com> <BANLkTi=hP1CPNE+3PSHUTWcBHW_WPxCBQw@mail.gmail.com> <BANLkTikwysTjCw62aZSi_3faHrQjYW=fuw@mail.gmail.com> <BANLkTiku1qznAK-yv4jUdfpuRVfuaBD7Hg@mail.gmail.com> <BANLkTim2y1_5GYgJo6xQY+0E7Bz96qF9vg@mail.gmail.com> <BANLkTintB9i-qRV=b3UGSQM+12u6cVJ1jA@mail.gmail.com>
In-Reply-To: <BANLkTintB9i-qRV=b3UGSQM+12u6cVJ1jA@mail.gmail.com>
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
X-Mailman-Approved-At: Thu, 26 May 2011 08:37:14 -0700
Cc: Hybi <hybi@ietf.org>, Alan Coopersmith <alan.coopersmith@oracle.com>, Gabriel Montenegro <Gabriel.Montenegro@microsoft.com>, Brodie Thiesfield <brodie@jellycan.com>
Subject: Re: [hybi] method of allocation of reserved bits to extensions
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/hybi>, <mailto:hybi-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/hybi>
List-Post: <mailto:hybi@ietf.org>
List-Help: <mailto:hybi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 26 May 2011 13:19:59 -0000

On 05/25/2011 01:08 AM, Greg Wilkins wrote:
>
> I don't want them available for extensions if it is just a
> free-for-all, because then non-technical market forces will come into
> play for their allocation and interoperability will be poor unless you
> only use defacto standard extensions.
>
> IANA registry is also a way to avoid the free for all, but it feels a
> bit heavy bureaucracy for just 3 bits, which will soon be consumed and
> then we are back to having no available bits and extensions have to
> use the payload anyway.
>
> But IANA is better than the status quo of no allocation.
>
>
>>>> It sounds to me like you are saying "if I can't have it my way, nobody
>>>> can
>>>> have them".  If they can't ever be used for extensions, it isn't
>>>> entirely
>>>> clear what they could be used for, so we would be better off just
>>>> allocating
>>>> them to the opcode than leaving them unused.
>>> If they are registered it doesn't mean they can't be used. Just that
>>> the extension that uses them must be blessed with the registration.
>>> All other extensions just add a byte to their payload and use it for
>>> their flags.
>> Again, that isn't what Greg was suggesting.
>> Also, if reserved opcodes can't be used (which Greg was also suggesting),
>> then there is no room for any experimentation, which seems a recipe for poor
>> progress getting useful extensions.
> Extensions can always have their own opcodes by putting them as a byte
> in the payload (which is what you have previously advocated for
> extension opcodes anyway).         Sure we can go to IANA and create a
> registry for the 8 or so available opcodes, but I'm sure they will
> soon be allocated to some worthy extensions and then future
> experimentation will have to use payload opcodes anyway.
>
> I just think that we have too few bits and opcodes available to make a
> fixed allocation work (either by defacto standards or by IANA
> registry), as all will soon be consumed and we then have to think of
> other solutions anyway.      I think a simple dynamic allocation
> mechanism would work for a large pool of possible extensions, but we
> would be limited by how many active extensions could be applied on the
> same connection.
>
> So eitherway, I see that eventually we will have to handle extensions
> with flags and codes in the payload, so why not just go there directly
> and not have to deal with either designing a system now or working
> with IANA to allocated very limited resources.
>
There is a technique we used in X11 design we should have pushed on much 
more broadly: enabling the client to do assignment/allocation of 
protocol elements as much as possible: we did this with resource ID's, 
and should have done this elsewhere in the protocol.  Our really big 
mistake was the Atom system, but I'll leave that for a different 
discussion if appropriate.  But the extension system has a similar 
mistake we made.

In the X protocol, extensions are a two phase process.

You perform a "QueryExtension", in which you provide the name of the 
extension (which is a string).  If it exists, the server tells you what 
opcode it will be available at (and a base number in the error numbering 
field for reporting errors, and a base number in the event fields that 
events may return from the extension).

In the X protocol, opcodes are two fields, a major opcode (1 byte) and a 
minor opcode (1 byte).

So long as there is no collision in the names of extensions, there is no 
reason for a registry.

There is also a protocol request to list the extensions available at the 
server.

By convention extensions have version numbering in them.

The downside of what we did (in the X protocol in general), is that 
while maximally extensible, it's more "chatty" than it might be 
requiring round trips to synchronise client and server state, which 
we've had to kludge around by pipelining requests.  We hadn't yet 
internalised that going over the net was so expensive to always optimise 
for that case.

It would have been better to just list the extension names available up 
front at connection open, and (when an extension is first used), have 
the client have to send a request to assign it a free opcode, avoiding 
the RTT delays.  You could also imagine (given your limited opcode 
space) you might be able to support more extensions simultaneously, 
switching assignments dynamically.  You could even have your servers 
list the most frequently used extensions first, and pre-assign them, so 
that the client doesn't have to send this message in many cases.

We haven't needed to in X, because we have 256 available opcodes, and 
haven't exhausted the op-code space.

Dunno if you can go this route: but it's what I'd do if I could and it 
were my headache.
                 - Jim