Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5332685ybv; Tue, 11 Feb 2020 13:42:00 -0800 (PST) X-Google-Smtp-Source: APXvYqyktnktt0NKVPw9rxMXGxpqCsnaWRLMa7ThuOxIG72oeN21qpoWEm7C88L+Y+tZxMJj6ifb X-Received: by 2002:aca:f20b:: with SMTP id q11mr4052841oih.78.1581457320528; Tue, 11 Feb 2020 13:42:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581457320; cv=none; d=google.com; s=arc-20160816; b=xOeHtoxwSneY7uF95cePvz4FzzZZ48IhvPboj6snmotGRrx0swRlXzw0GAIbdi0yaA +ealoYhl2YL/6h7MFUJvT7Tsuf6CziPH+GzVF7aFm6+Fj+E4w9x+DJK9gAaNGxnA/A8E ZEm2pkpQOmlVhEDDbiNDhFcvGfDnLDid0Et+w6CPXoirVU1p51ZbuFWCVWXqbLarHdGl TkTa7OOMiveBwulT3FbDtdcBWxmG+AyR9cMNy4zb44RZd+P0btqIAJVlSVV7qmxOBj/5 PN87Z9JEuW2atTTTzAYXOieMsH6UNMTaKnz9dtgF2j0FsU/0ugyPIv6GX8B9sWTJd2JH 0CgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=3jq1F1h8gv0wknOUQLa4Ra//htCCwCRIkA+gMc+KQ94=; b=Xju8cF0UhCKRyOlV1Y5yjqcIEPxia4LhK6Lv9r6tTzrya28CbhQn827PnvWfV7AKFY 3spt0+G16b6BvciOd2iG9DSeNeZCRE4nx7wATrgm5nYjiualttby9XohYPHDJ8f8XSgB phHrlgS+rI54FeRe69BlnBlSjTFuNv2yL1h9CCTwwlqbWizTJwYCqEcnsA9cAilxDglZ rsQ5Yn5ftopkyPVwAbzcQ6RTqjxS3B9urCz1eRqDFYCr81W7QUxQvqqYCDPysgEZSZV9 WzMNRdIO2Vx7V36Y8GoRmYqzLDBq7gko3M69UAhhxbxL36z2QjWouqSnyezFQtGiTgbl lXEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LefOiRP3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l6si2615656otk.134.2020.02.11.13.41.48; Tue, 11 Feb 2020 13:42:00 -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=@kernel.org header.s=default header.b=LefOiRP3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728732AbgBKU3g (ORCPT + 99 others); Tue, 11 Feb 2020 15:29:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:60066 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728019AbgBKU3f (ORCPT ); Tue, 11 Feb 2020 15:29:35 -0500 Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0566F20842; Tue, 11 Feb 2020 20:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581452975; bh=050Spu/rOU3M2mOId8IXyEhwRlEOjhxlUycw+DTlrAU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=LefOiRP31zOt17a/0mZeErAs3SLjX6rxUajiE6zk+ZHw5rNpW0kPYozl2m3vp2OvQ HTUuTEX4/6m9nO8mHTctSbXZ+j7kHj5fdynX4FmZfVJsBmiKpM6eIPUkSXdnnXoY6H o3er5cfpYWlylCbvpwchBWOog+/g/IfGeFIzw2Ro= Received: by mail-qv1-f43.google.com with SMTP id y8so5666231qvk.6; Tue, 11 Feb 2020 12:29:34 -0800 (PST) X-Gm-Message-State: APjAAAUVTN7tt6WYFKAoFCsLCDPUfg0JDMmLUk1WUpsIDpGEAXXOuCqo GCdbPISWrAAOBcDbTabTbUUsDOWjaRiUXDHVkQ== X-Received: by 2002:ad4:4511:: with SMTP id k17mr4321626qvu.135.1581452974077; Tue, 11 Feb 2020 12:29:34 -0800 (PST) MIME-Version: 1.0 References: <20200204125844.19955-1-m.szyprowski@samsung.com> <20200205054508.GG60221@umbus.fritz.box> <20200210234406.GH22584@umbus.fritz.box> In-Reply-To: <20200210234406.GH22584@umbus.fritz.box> From: Rob Herring Date: Tue, 11 Feb 2020 14:29:22 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] libfdt: place new nodes & properties after the parent's ones To: David Gibson Cc: Marek Szyprowski , Devicetree Compiler , "linux-kernel@vger.kernel.org" , Bartlomiej Zolnierkiewicz Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 10, 2020 at 5:44 PM David Gibson wrote: > > On Mon, Feb 10, 2020 at 12:40:19PM +0100, Marek Szyprowski wrote: > > Hi David, > > > > 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/custom > > >> dtb files. This can be easily fixed by the little change to libfdt code: > > >> any new properties and sub-nodes should be added after the parent's node > > >> 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. > > > > I agree about the properties, but generally the order of nodes usually > > 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. I'm not sure if downstream is different, but upstream this stems from Linux initcalls being processed in link order within a given level. It's much better than it used to be, but short of randomizing the ordering, I'm not sure we'll ever find and fix all these hidden dependencies. > > This sometimes > > 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. The general preference is to sort by 'reg'. And we try to catch and reject any node re-ordering patches. Rob