The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
To: James Hogan <james.hogan@imgtec.com>
Cc: <linux-kernel@vger.kernel.org>,
	Grant Likely <grant.likely@secretlab.ca>,
	Arnd Bergmann <arnd@arndb.de>,
	Rob Herring <rob.herring@calxeda.com>
Subject: Re: [PATCH 1/2] metag: copy devicetree to non-init memory
Date: Thu, 21 Feb 2013 16:48:22 +0530	[thread overview]
Message-ID: <5126027E.7000006@synopsys.com> (raw)
In-Reply-To: <5125EA35.7060602@imgtec.com>

On Thursday 21 February 2013 03:04 PM, James Hogan wrote:
> Hi Vineet,
>
> On 21/02/13 09:08, Vineet Gupta wrote:
>> On Wednesday 20 February 2013 08:22 PM, James Hogan wrote:
>>> Make a copy of the device tree blob in non-init memory. It is required
>>> when using built-in device tree files that the platform code copies the
>>> blob to non-init memory prior to calling unflatten_device_tree(),
>>> otherwise the strings that the device tree refer to will get poisoned
>>> and potentially reused, breaking later reading of the device tree
>>> post-init (such as compatible matching in modules, debugfs, and the
>>> procfs interface).
>> While the patch conceptually looks correct, I'm not sure why any user of DT -
>> post-init would refer to DT bindings using of_fdt_* API which use the flat tree,
>> instead of the binary tree (more efficient in space/usage). Is this to support
>> some in-transition drivers and other code.
> The strings aren't copied when the devicetree is unflattened, so the
> unflattened version still points into initdata, so all the strings "in"
> the unflattened version are wiped when it's freed too.

You are absolutely right, so ARC port is infested with same ticking time bomb !
Thanks for the heads up - I'll queue up a fix - but that will go in after the
first pull request as I want any change, however minimal/local to cook in -next
for some time (for paranoid sake at this stage)

> Documentation/kbuild/makefiles.txt has this to say:
>>     dtc
>> 	Create flattend device tree blob object suitable for linking
>> 	into vmlinux. Device tree blobs linked into vmlinux are placed
>> 	in an init section in the image. Platform code *must* copy the
>> 	blob to non-init memory prior to calling unflatten_device_tree().
> Other architectures using the builtin dtb also do the copy. I presume
> it's in initdata in the first place to avoid keeping the built-in one
> around if one is provided by the bootloader instead.

Makes sense !

-Vineet

  reply	other threads:[~2013-02-21 11:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-20 14:52 [PATCH 0/2] metag: copy flattened devicetree to non-init memory James Hogan
2013-02-20 14:52 ` [PATCH 1/2] metag: copy " James Hogan
2013-02-21  9:08   ` Vineet Gupta
2013-02-21  9:34     ` James Hogan
2013-02-21 11:18       ` Vineet Gupta [this message]
2013-02-21 11:19   ` Vineet Gupta
2013-02-21 11:28     ` James Hogan
2013-02-20 14:52 ` [PATCH 2/2] metag: prom.h: remove declaration of metag_dt_memblock_reserve() James Hogan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5126027E.7000006@synopsys.com \
    --to=vineet.gupta1@synopsys.com \
    --cc=arnd@arndb.de \
    --cc=grant.likely@secretlab.ca \
    --cc=james.hogan@imgtec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rob.herring@calxeda.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox