Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4258299ybv; Mon, 10 Feb 2020 15:44:55 -0800 (PST) X-Google-Smtp-Source: APXvYqy6aNytfJH8wSAnJ5+0IZ8lGECCyo4kstu01ZTzOADfy9mEFIgOJ4gzrJ0+Ao9V5amlxV3Z X-Received: by 2002:a54:408f:: with SMTP id i15mr1100623oii.64.1581378295021; Mon, 10 Feb 2020 15:44:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581378295; cv=none; d=google.com; s=arc-20160816; b=visPWogcGA4EMPyTYjIhVn2RBF9i0OsmHDlf/C2AaHPLOkYPb7xsWAEIKZZhZ6mo3r LHI2RuOlI9cWqNzwwuZQlpypJT+v76Zy2wxZDRQnetg9XvNk0ioJeXDlacNK6wqZIRkN 22K6x/jGjmoYuoUeP6SbGE9BWN4LRAJyuffNKRF2PHNM2pizjSqWZccLhlmocc4/u15P f0qA6E9ObGQXaoiFSH6VFqYmeaxj4C13PsVxcD81TOlGXYpkCbpTSdn8ajWoxnBKFnYi yLi5Xhdjxn24CqnQAPDvBia+D6hlEnnUhW2oGclxE7PwE53K7mcUGTngsgh8PPt3REMM +aeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ZKIFs3juX6o2wyTcHULX2nKPGc0DSosTAVitqi46WI0=; b=vTCrjBMhyb/slnZDlj6guudY4FF2CBLkp+mr2LpXoAML0u01VJiaWRmzpFuId21pZ6 Hj6Snctr2MmQWKmncufJJDCzq9S57fo6VEd/UhdwCz2ZIkLGjqHyIR5MH7f9Mn3Z/0Zm HM1MkFzBKwwg3NOCJAJF/HKxe5h2MaqjmZq7ejkND7z0QYbL1cHrOCMdwGOu7Bj6//MU 3G1piJ8hfMuPixjnycN1mKqzhEuHRpmPCQdWy0KuIvsFRsbrGN6p5hbd/3egVdlb1D5H DKvvO93uKwWlVNAyaw2fuetFSDrQ2PLDL29ONW/I64N3NPz+9tzx4RluybtsOybhedRX MeQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gibson.dropbear.id.au header.s=201602 header.b=AIlf9AZJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3si969470otq.203.2020.02.10.15.44.40; Mon, 10 Feb 2020 15:44:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gibson.dropbear.id.au header.s=201602 header.b=AIlf9AZJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727518AbgBJXoO (ORCPT + 99 others); Mon, 10 Feb 2020 18:44:14 -0500 Received: from bilbo.ozlabs.org ([203.11.71.1]:49981 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727192AbgBJXoO (ORCPT ); Mon, 10 Feb 2020 18:44:14 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 48GjDC2Qn6z9sRX; Tue, 11 Feb 2020 10:44:11 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1581378251; bh=7K+kTdpfGU1z4smBOeCkzyWWjYgzO+WnbCkyrDmR7p4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AIlf9AZJ1vQff9JYuBdtBRk/crVFqUYXTGsG9OMcAs5seJrjwoszLY4HRDFIRKm2o JW3n0i1P3tSQfMORTkyW1exSiRw0c29BRguD/texL49oDBj4c51t18NkyH2pDVT1wG cMOr3hxl0pP6+I6A/FHfxln2cu/ByV7cC41AuQmI= Date: Tue, 11 Feb 2020 10:44:06 +1100 From: David Gibson To: Marek Szyprowski Cc: devicetree-compiler@vger.kernel.org, linux-kernel@vger.kernel.org, Bartlomiej Zolnierkiewicz Subject: Re: [PATCH] libfdt: place new nodes & properties after the parent's ones Message-ID: <20200210234406.GH22584@umbus.fritz.box> References: <20200204125844.19955-1-m.szyprowski@samsung.com> <20200205054508.GG60221@umbus.fritz.box> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jaoouwwPWoQSJZYp" Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --jaoouwwPWoQSJZYp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 10, 2020 at 12:40:19PM +0100, Marek Szyprowski wrote: > Hi David, >=20 > On 05.02.2020 06:45, David Gibson wrote: > > On Tue, Feb 04, 2020 at 01:58:44PM +0100, Marek Szyprowski wrote: > >> While applying dt-overlays using libfdt code, the order of the applied > >> properties and sub-nodes is reversed. This should not be a problem in > >> ideal world (mainline), but this matters for some vendor specific/cust= om > >> dtb files. This can be easily fixed by the little change to libfdt cod= e: > >> any new properties and sub-nodes should be added after the parent's no= de > >> properties and subnodes. > >> > >> Signed-off-by: Marek Szyprowski > > I'm not convinced this is a good idea. > > > > First, anything that relies on the order of properties or subnodes in > > a dtb is deeply, fundamentally broken. That can't even really be a > > problem with a dtb file itself, only with the code processing it. >=20 > I agree about the properties, but generally the order of nodes usually=20 > implies the order of creation of some devices or objects. Huh? From the device tree client's point of view the devices just exist - the order of creation should not be visible to it. > This sometimes=20 > has some side-effects. If those side effects matter, your code is broken. If you need to apply an order to nodes, you should be looking at 'reg' or other properties. > For comparison, the other lib used for fdt manipulation (libufdt)=20 > applies overlays in a such way, that the order of properties and nodes=20 > is not reversed. >=20 > > I'm also concerned this could have a negative performance impact, > > since it has to skip over a bunch of existing things before adding the > > new one. On the other hand, that may be offset by the fact that it > > will reduce the amount of stuff that needs to be memmove()ed later on. >=20 > This code is already slow (especially in the way the uboot's use it for= =20 > 'fdt apply' command), but in practice I've didn't observe negative=20 > impact on the performance of applying large overlays at all. I'm going to need numbers, not just "I didn't see anything". --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --jaoouwwPWoQSJZYp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAl5B6sYACgkQbDjKyiDZ s5IYVg//RmdG0csx2DA45UVzasqMWpkUTEDrr7pTxkDgmdvZOeC41OK5k1IifXT5 75hhxVU72PhzmC+m6ymvtrukzItSIgGKoWYdItS+Nykb7Mfs+fWYoN8uwiBLsVgM vvdEMzcXyWqDy9+BV0H1kimyj/NJrnMAYmae00aTSR50fDtyNWOU7vgupgOlmVO1 sSIxdL/wzjORwIEE9C/g6cEOYqZcccbzaVP/jRdBpOJjyArKwVYoirQCmypCT6gI a+btXPSNfnEuNnVnFJOHxvlybqvRhx8jjSFs3Duggb+ffMeTTKee5Yao8jzANVRw jqiDi3sIBp3pTZzmMGierGpUdQDx6cRDJz6oYNDmJkyLCTpEva3MGiDFwnXZ9AyR G2P/BDRjw782sDNzOPPMn8IvxMyL7zix/5+SNs9gsxZnQv/WTWj/O/LxhVXEhfSz UXEhLnPmqD8J9tLLy+3PuQ+CpPxxx5bGNhuJbftXCiYrjSjANpjmDMdSBgm1HVkc CbuHnPgWzOQ2eIImTN/PhtCTwOAd3Sw94gfYlC2q+9YUO1SGF/WjgAWvvf+uhVzz Wc4jQ9Vu9XTCAdWHEJgaj5cL93Lj5KJF6zYQbuoYMNClYJbmwoyrcCfYU/LEIlja m4cd0xAiqJet3wGoAtx19x1Yw44++MUvh/hvJpRmxropuRjXDvk= =g4vs -----END PGP SIGNATURE----- --jaoouwwPWoQSJZYp--