Re: [core] progressing ietf-core-yang-cbor and ietf-core-sid

"Rob Wilton (rwilton)" <rwilton@cisco.com> Wed, 15 January 2020 18:01 UTC

Return-Path: <rwilton@cisco.com>
X-Original-To: core@ietfa.amsl.com
Delivered-To: core@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id EA0AB1208C6 for <core@ietfa.amsl.com>; Wed, 15 Jan 2020 10:01:02 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.49
X-Spam-Level:
X-Spam-Status: No, score=-14.49 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, SPF_PASS=-0.001, T_KAM_HTML_FONT_INVALID=0.01, USER_IN_DEF_DKIM_WL=-7.5] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cisco.com header.b=k8GI/K/j; dkim=pass (1024-bit key) header.d=cisco.onmicrosoft.com header.b=SNnUfdZL
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id D5plVqT_2Zub for <core@ietfa.amsl.com>; Wed, 15 Jan 2020 10:00:58 -0800 (PST)
Received: from rcdn-iport-1.cisco.com (rcdn-iport-1.cisco.com [173.37.86.72]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id EAAE21208BF for <core@ietf.org>; Wed, 15 Jan 2020 10:00:57 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=36074; q=dns/txt; s=iport; t=1579111257; x=1580320857; h=from:to:cc:subject:date:message-id:references: in-reply-to:mime-version; bh=KirATHSNVqmonFe4LW3tRAhCnK35Gk7q/lrXBbUuFNQ=; b=k8GI/K/jla8oZdDU9oq+eUr93QHeYXaFh/Bw8X1ANO2KC3If/zbjd4wz O1jgKBlIdE5GbFNtiQbthkXv6xO1ZglmnPtcj3dtSQCu4PqiQsR2z4NbJ 4SRSKaia3Wa+xUbxqiDOIel3wUfUgdxSQpe7QC+oDmQR9Tl7ROudB6nvK k=;
IronPort-PHdr: 9a23:y5YHWRW9EMIbvh2B2r3znst1jNjV8LGuZFwc94YnhrRSc6+q45XlOgnF6O5wiEPSA92J8OpK3uzRta2oGXcN55qMqjgjSNRNTFdE7KdehAk8GIiAAEz/IuTtankgA8VGSFhj13q6KkNSXs35Yg6arw==
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0DxCQDoUh9e/5NdJa1kHgELHIMgLyQsBWxYIAQLKgqEBYNGA4p3gl+YDoJSA1QJAQEBDAEBGAEKCgIBAYFMgnQCF4FoJDgTAgMNAQEEAQEBAgEFBG2FNwyFXgEBAQECAQEBEBEKEwEBLAsBBAcEAgEGAg4DAQMBASEHAwICAiULFAMGCAIEDgUIGoMFgX1NAw4gAQIMi2WQZAKBOIhhdYEygn8BAQWFJhiCDQMGgTaMGBqBQT+BEUeCTD6CZAEBAYFkK4JjMoIsjTcggnmFWYlwjy8KgjiHPYV6iRSabpc5kiMCBAIEBQIOAQEFgWkigVhwFTuCbB8xGA2IAQwXg1CCZIIwhT90gSmLJwGBDwEB
X-IronPort-AV: E=Sophos;i="5.70,323,1574121600"; d="scan'208,217";a="698006843"
Received: from rcdn-core-11.cisco.com ([173.37.93.147]) by rcdn-iport-1.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 15 Jan 2020 18:00:43 +0000
Received: from XCH-ALN-004.cisco.com (xch-aln-004.cisco.com [173.36.7.14]) by rcdn-core-11.cisco.com (8.15.2/8.15.2) with ESMTPS id 00FI0h8M023375 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=FAIL); Wed, 15 Jan 2020 18:00:43 GMT
Received: from xhs-rtp-002.cisco.com (64.101.210.229) by XCH-ALN-004.cisco.com (173.36.7.14) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 15 Jan 2020 12:00:42 -0600
Received: from xhs-rtp-003.cisco.com (64.101.210.230) by xhs-rtp-002.cisco.com (64.101.210.229) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 15 Jan 2020 13:00:40 -0500
Received: from NAM11-CO1-obe.outbound.protection.outlook.com (64.101.32.56) by xhs-rtp-003.cisco.com (64.101.210.230) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Wed, 15 Jan 2020 13:00:40 -0500
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EORJ0KZ++JKbtdgtxrxFFFxm/Dzfj+N1ujATlNm6Kxwo5ZCAqEIc7UQTiBsthn9AXxPw2WrrPEURv6owgCS3e9fzzFAFbB26zVanAqMPknRFGjgB118lpFUx1CgkuYPSRlpWD0ivyGbIqL1aiQREbKSzmnJDEw6a4mSOzmYtKdU9cNkcNZ+wFQNFDkjl6lyukTo5lJuEng3jD7m+KhlO0DZmuPlnu1NNbBsvrkYS3zAbU/0/uskS9GsvC96m3Wt68N43eeDcC6xAP3uTobcIXtkzPslDoBt9R2Sw5hTXriuSAKvz0npSKjmdYajnOzue1RJ/Uq8iLuc/P7afm3QCkg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KirATHSNVqmonFe4LW3tRAhCnK35Gk7q/lrXBbUuFNQ=; b=lDAE8Ju89sCeMyDqHrRPPKoRtgQeVmayXBgSZb1bdpweikZBfo2Yqe0nrv0SOydmxI6WFUKwoiGrU9OWJs4vLRp7fZp5xfsasdjwZHjZkRGCoeHRDAl2LlaJzc7/CiYPhV4g9zqGEkaxo8aPMMiTYhy9Sr7C8KnHP6mwcq92a8CHUZRj1yA1z01c3zOVnwu+XSMqJmpYvJEnlutEua2nDAGtBRRtbi2Zu7agtKkaofiBMN6zB3Ozk/Yuktf2Zl+7Yux6Or9v5Rws4hswnMJyplP86UjS1/Z/FjdL2WlsT3TiP4mmeKsASoJdxuR6lMOFGJKv9Vzypw+MXDsdjw3MQQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cisco.com; dmarc=pass action=none header.from=cisco.com; dkim=pass header.d=cisco.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.onmicrosoft.com; s=selector2-cisco-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KirATHSNVqmonFe4LW3tRAhCnK35Gk7q/lrXBbUuFNQ=; b=SNnUfdZLN56IyUTAHwU6ezRH8jFnzGtnOMrxnnyNTv+m8VOKSwk1WjFdwZqnMyv8aH7E2I5GSwhR1Jlv3TP1VZ6XtuJ+K+90hHjk/WuNsHRNqtJMfpPuPR5beAvJjrWvqhscAoaxy9OpUYh02+jSZNrhQNgx5ReojX9ZcVzJHiA=
Received: from MN2PR11MB4366.namprd11.prod.outlook.com (52.135.38.209) by MN2PR11MB3568.namprd11.prod.outlook.com (20.178.251.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.18; Wed, 15 Jan 2020 18:00:38 +0000
Received: from MN2PR11MB4366.namprd11.prod.outlook.com ([fe80::b9ce:1058:5fa6:44a1]) by MN2PR11MB4366.namprd11.prod.outlook.com ([fe80::b9ce:1058:5fa6:44a1%7]) with mapi id 15.20.2623.018; Wed, 15 Jan 2020 18:00:38 +0000
From: "Rob Wilton (rwilton)" <rwilton@cisco.com>
To: Carsten Bormann <cabo@tzi.org>
CC: Michael Richardson <mcr+ietf@sandelman.ca>, "core@ietf.org" <core@ietf.org>
Thread-Topic: [core] progressing ietf-core-yang-cbor and ietf-core-sid
Thread-Index: AQHVurUJXZhJjcMJe0u46wy442FB/KfheU0AgAHZe4CAAM9xgIACJ0WAgAI7cgCAAH+BgIAC1zwAgAASRXCAABKKAIAAANaQgAAVwgCAAAE30A==
Date: Wed, 15 Jan 2020 18:00:38 +0000
Message-ID: <MN2PR11MB43663AFE1492793F34DAA113B5370@MN2PR11MB4366.namprd11.prod.outlook.com>
References: <29380.1565102380@localhost> <BL0PR06MB50428065032ECC2AB3345F619AD70@BL0PR06MB5042.namprd06.prod.outlook.com> <7505.1565633977@localhost> <BL0PR06MB50424C618A704460E4A8F8D99AA90@BL0PR06MB5042.namprd06.prod.outlook.com> <18990.1577231446@localhost> <CAJFkdRyWOfCb4U09rEJ-ZMR3GUuk-rmQ+f3Fs164Mxs8qkeVuw@mail.gmail.com> <22612.1578626081@localhost> <CAJFkdRztFUxdGcdvtTgB=9c-e_BwDAgLTmVPJ+OB8-dgs1sGog@mail.gmail.com> <15754.1578789013@localhost> <CAJFkdRy_3pC37ZxzhTmzqRgWjwDvEFTuhu5Z8+_ktaJgoeOGfg@mail.gmail.com> <6025.1578939111@localhost> <ACA7E58F-A308-457B-846F-E298807DCEC1@tzi.org> <MN2PR11MB4366A026E4A16F311E5922BFB5370@MN2PR11MB4366.namprd11.prod.outlook.com> <46BA6719-5319-40FC-B218-5832F32C85BC@tzi.org> <MN2PR11MB43663281BBACA171BEBFAB2BB5370@MN2PR11MB4366.namprd11.prod.outlook.com> <B7600D51-B3A9-44F7-A7E4-E9D6CD496246@tzi.org>
In-Reply-To: <B7600D51-B3A9-44F7-A7E4-E9D6CD496246@tzi.org>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: spf=none (sender IP is ) smtp.mailfrom=rwilton@cisco.com;
x-originating-ip: [173.38.220.36]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: b309ba25-12e5-4195-29d1-08d799e4d3de
x-ms-traffictypediagnostic: MN2PR11MB3568:
x-microsoft-antispam-prvs: <MN2PR11MB3568511D71778490817D28D3B5370@MN2PR11MB3568.namprd11.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:8882;
x-forefront-prvs: 02830F0362
x-forefront-antispam-report: SFV:NSPM; SFS:(10001)(10009020)(4636009)(396003)(39860400002)(376002)(136003)(366004)(346002)(189003)(199004)(71200400001)(8676002)(54906003)(478600001)(26005)(64756008)(81166006)(2906002)(5660300002)(53546011)(966005)(81156014)(6506007)(66446008)(66556008)(76116006)(66476007)(66946007)(21615005)(33656002)(6916009)(316002)(9686003)(7696005)(52536014)(4326008)(186003)(55016002)(86362001)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR11MB3568; H:MN2PR11MB4366.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1;
received-spf: None (protection.outlook.com: cisco.com does not designate permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: 2CqvFKi0urcaqCkQBJR8asLUqsB0J4Ok+tfEgIdUfWdkvv9u2dHsZy1iyYZlv39fR++Pli+NMRBClJBVTivM7DM1qkOiV376uniROoeFlvIvdfa7cACqLFF3EyNqc0jY79UV2Er4ys8BspEG+BrwZWLcqdjh8TdIpKF1d3npvlW3bsPlNSl2KhfcGfWuRlI/tIXYkI5jxMlJqaic+B/Bs2lsKzcgerNOL6vncY8w3qowj+MzI0a5ISzmz702S2MnIOubkiiIN9VSY1pY3GTOVioN/BhwpA8AKEyFZ3NbF+Q54tQyuiIML/VY4Gxh5IR7JYDo+ag5Y95c/q6+zSOJL/dkHOK2ekPI7mcrly5x4sAY+wTPJw/i60e+7DPMD71inmmeAJFGTrxAG6d+llNLBjCRD5zCPFN+UqnkHSl6W5Yed89tY7VpsPYgelnTALYgU3NAUMxH7KLkmI7VlVUrPzbhVPSyXFSVjYZiFF5yFyTzbe0m6ful4p+SjDsZrylOt0hLa6P9ycf1ki457lfO3l8qSgXZlodDi9XA9PrREug=
x-ms-exchange-transport-forked: True
Content-Type: multipart/alternative; boundary="_000_MN2PR11MB43663AFE1492793F34DAA113B5370MN2PR11MB4366namp_"
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-Network-Message-Id: b309ba25-12e5-4195-29d1-08d799e4d3de
X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2020 18:00:38.1330 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 5ae1af62-9505-4097-a69a-c1553ef7840e
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: obhuVcCaxrW/NXnv8TeryrACuD7pxAKB+V/IJOrVLuPAqAeCQUUlpmgk62oa48aaMR33ELArFV+PdVlmEg67Cw==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3568
X-OriginatorOrg: cisco.com
X-Outbound-SMTP-Client: 173.36.7.14, xch-aln-004.cisco.com
X-Outbound-Node: rcdn-core-11.cisco.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/core/8FLHVDWk369f_c-RmAZJfZxCCBc>
Subject: Re: [core] progressing ietf-core-yang-cbor and ietf-core-sid
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Constrained RESTful Environments \(CoRE\) Working Group list" <core.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/core>, <mailto:core-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/core/>
List-Post: <mailto:core@ietf.org>
List-Help: <mailto:core-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/core>, <mailto:core-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 15 Jan 2020 18:01:03 -0000




> -----Original Message-----

> From: Carsten Bormann <cabo@tzi.org>

> Sent: 15 January 2020 17:07

> To: Rob Wilton (rwilton) <rwilton@cisco.com>

> Cc: Michael Richardson <mcr+ietf@sandelman.ca>; core@ietf.org

> Subject: Re: [core] progressing ietf-core-yang-cbor and ietf-core-sid

>

> OK, let’s get pedantic then.

[RW]

I am not being pedantic. 😉



CPU architectures really do not natively support negative 64 bit integers, and you can't pretend that they do, so let's just avoid them, because we don't need them and they will only cause bugs/mistakes.





>

> The operation that would be needed here without the 63-bit restriction is

> adding a 65-bit signed (delta) to a 64-bit unsigned (context SID), with

> the constraint that the result (actual SID) fits into a 64-bit unsigned.

> Unless you want to do error checking (which probably is a good idea), this

> can be done entirely with 64-bit unsigned numbers, simply ignoring the

> modulo wraparounds.  Error checking then just requires a few magnitude

> checks, which do require some scribbling on the back of an envelope to get

> right.

[RW]



I've not said that one can't encode this, just that it becomes more tricky and I predict that people will get it wrong, or likely assume that SIDs are only 63 bits.



E.g. when constructing the SID delta (in C) you can't just subtract the child SID from the parent SID and convert to a cbor signed/unsigned value, and expect the right thing to happen.  You have further annoyances if you want to store the SID deltas in heap data structures for any reason.  Perhaps nobody will even want/need to do this, but it seems plausible that they might.





> All CPU architectures of the last 40 years (OK, maybe since the

> iAPX 432, which was 1981) that I know of make it not hard to do these

> things.

[RW]

I respectively disagree.



Having seen the hard to debug bugs when smart experienced software engineers were not careful enough with C's handling of signed and unsigned integers definitely puts me into the camp that Java got this right, and that it is unsigned arithmetic that folks struggle to consistently get right.



> Platforms like the JVM do.

>

> CBOR’s "65-bit signed" (64-bit unsigned + sign bit in mt) integer coverage

> is indeed surprising initially (it is until you start to embrace bignums).

> From the C language, implementers should be used to the fact that as soon

> as you go to "signed 64-bit" (63-bit unsigned + sign bit expressed as

> two’s complement), there are all kinds of problems.  Of course, not all C

> courses teach this…  (The main problem being that 64-bit is big enough

> that many implementers never reach the boundaries of this space.)

[RW]

Okay, but I'm of the opinion that signed types are the sane ones, and it is unsigned types that do surprising things (normally with unanticipated underflow due to subtraction and modulo arithmetic).





>

> So the problem here really is in the platform or BKAC (between keyboard

> and chair), not in the architecture...

[RW]

As per above, I think that we disagree on this point.  But really not sure it is worth spending more time on ...



Kind regards,
Rob







>

> Grüße, Carsten

>

>

> > On 2020-01-15, at 17:40, Rob Wilton (rwilton) <rwilton@cisco.com<mailto:rwilton@cisco.com>> wrote:

> >

> >

> >

> > > -----Original Message-----

> > > From: Carsten Bormann <cabo@tzi.org<mailto:cabo@tzi.org>>

> > > Sent: 15 January 2020 15:46

> > > To: Rob Wilton (rwilton) <rwilton@cisco.com<mailto:rwilton@cisco.com>>

> > > Cc: Michael Richardson <mcr+ietf@sandelman.ca<mailto:mcr+ietf@sandelman.ca>>; core@ietf.org<mailto:core@ietf.org>

> > > Subject: Re: [core] progressing ietf-core-yang-cbor and

> > > ietf-core-sid

> > >

> > > Yeah, but here the problem is in the head of the implementor and not

> > > in the CPU architecture :-)

> >

> > I'm not sure that I agree, 😉

> >

> > I might be wrong, but most CPU architectures don't support 64 bit

> negative values (unless you move to 128 bit signed numbers with the

> corresponding performance overhead).  Of course, implementors can work

> around the architecture limitations by emulating 64 bit negative numbers

> using unsigned 64 bit numbers ...

> >

> >

> > In fact, I was wondering whether it is really a good thing that CBOR

> allows a 64 bit negative integer to be expressed.  It means that the CBOR

> encoding can easily carry values that most implementations cannot easily

> generate or represent.

> >

> > So, I looked at the first available C implementation example at

> https://cbor.io/impls.html, and it can't handle negative 64 bit numbers,

> overflowing them into a long variable.  I wonder what proportion of CBOR

> implementations do handle these correctly ...  Of course, I'm not

> suggesting changing the spec, just a retrospective observation.

> >

> > > I was not suggesting the text behind the substitutes to be included,

> > > this was just explanation why I’d like to have the change.

> > [RW]

> > Yes, but I think that "architectures" is probably the correct term

> > here, at least until we end up with CPUs with a 65 bit signed

> > datapath, although I have to confess that I doubt that the choice of

> > word really matters. 😊

> >

> > Thanks,

> > Rob

> >

> >

> >

> > >

> > > Grüße, Carsten

> > >

> > >

> > > > On 2020-01-15, at 16:01, Rob Wilton (rwilton) <rwilton@cisco.com<mailto:rwilton@cisco.com>>

> wrote:

> > > >

> > > >

> > > >

> > > >> -----Original Message-----

> > > >> From: core <core-bounces@ietf.org<mailto:core-bounces@ietf.org>> On Behalf Of Carsten Bormann

> > > >> Sent: 15 January 2020 13:35

> > > >> To: Michael Richardson <mcr+ietf@sandelman.ca<mailto:mcr+ietf@sandelman.ca>>

> > > >> Cc: core@ietf.org<mailto:core@ietf.org>

> > > >> Subject: Re: [core] progressing ietf-core-yang-cbor and

> > > >> ietf-core-sid

> > > >>

> > > >> (No chair hat.)

> > > >>

> > > >> On 2020-01-13, at 19:11, Michael Richardson

> > > >> <mcr+ietf@sandelman.ca<mailto:mcr+ietf@sandelman.ca>>

> > > wrote:

> > > >>>

> > > >>> The use of 63-bit unsigned integers allows SIDs to be

> > > >>> manipulated more easily  on architectures that might otherwise

> > > >>> lack native 64-bit

> > > >> unsigned arithmetic.

> > > >>> The loss a single bit of precision is not significant given the

> > > >>> size of the  space.

> > > >>

> > > >> s/use of/limitation to/     (we have been using them before)

> > > >> s/architectures/platforms/  (Java is our main problem here, no?)

> > > > [RW]

> > > > I think that it would be awkward for most languages/CPU

> > > > architectures,

> > > anywhere where you could end up with a negative number that is less

> > > than 2^63.

> > > >

> > > > Yes, it is possible to write code in C or Java to handle this, but

> > > > my hunch is that implementations could easily get this wrong (e.g.

> > > > by just using signed int64 as the type to hold the difference

> > > > between parent and child SIDs.)

> > > >

> > > > Thanks,

> > > > Rob

> > > >

> > > >

> > > >> s/precision/range/ s/space/remaining space/

> > > >>

> > > >> Grüße, Carsten

> > > >>

> > > >> _______________________________________________

> > > >> core mailing list

> > > >> core@ietf.org<mailto:core@ietf.org>

> > > >> https://www.ietf.org/mailman/listinfo/core