lkml.org 
[lkml]   [2014]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v3 0/7] Introducing (yet again) Device Tree Overlays
From
On Wed, Apr 16, 2014 at 4:33 PM, Rob Herring <robherring2@gmail.com> wrote:
> On Wed, Apr 16, 2014 at 4:23 PM, delicious quinoa
> <delicious.quinoa@gmail.com> wrote:
>> On Thu, Apr 3, 2014 at 3:40 PM, delicious quinoa
>> <delicious.quinoa@gmail.com> wrote:
>>> On Fri, Mar 28, 2014 at 1:27 PM, delicious quinoa
>>> <delicious.quinoa@gmail.com> wrote:
>>>> On Tue, Mar 18, 2014 at 4:55 PM, Pantelis Antoniou
>>>> <pantelis.antoniou@konsulko.com> wrote:
>>>>> The following patchset introduces Device Tree overlays, a method
>>>>> of dynamically altering the kernel's live Device Tree, along with
>>>>> a generic interface to use it in a board agnostic manner.
>
> [snip]
>
>>>> I can get a NULL pointer when I apply and remove an overlay and the
>>>> conditions are right. The overlay applies correctly. The crash is
>>>> when I do the rmdir. My overlay is:
>>>>
>>>> /dts-v1/;
>>>> /plugin/;
>>>> / {
>>>> fragment@0 {
>>>> target-path="/soc";
>>>> __overlay__ {
>>>> #address-cells = <1>;
>>>> #size-cells = <1>;
>>>> agpio0: agpio0 {
>>>> compatible = "altr,pio-1.0";
>>>> reg = <0xff210040 0x10>;
>>>
>>> Added some printks and got a bit further with debug. If I leave this
>>> as-is, the platform device has 2 resources. We get the NULL pointer in
>>> __release_resource() when releasing the first one (reg). If I remove
>>> this one line ('reg =') the crash goes away. So in this case, we are
>>> ok when releasing an irq resource but get a NULL pointer when removing
>>> a reg resource. Don't know why at this point.
>>
>> The crash is confirmed on v4 patches as well. The immediate cause of the crash:
>>
>> static int __release_resource(struct resource *old)
>> {
>> struct resource *tmp, **p;
>>
>> p = &old->parent->child;
>> for (;;) {
>> tmp = *p; <===kablooey
>> ...
>>
>> when __release_resource() is called for the reg resource, it does 'p =
>> &olde->parent->child' and then crashes when it does 'tmp = *p'.
>>
>> Root cause: It appears that there isn't any code in drivers/of/ that
>> eventually calls __request_resource() or __insert_resource() so the
>> resource's parents/sibling pointers are never initialized. Maybe I'm
>> missing some patches or something.
>
> It's probably related to this issue:
>
> https://groups.google.com/forum/#!topic/fa.linux.kernel/CTx1ReiOjnQ
> http://www.mail-archive.com/linuxppc-dev@lists.ozlabs.org/msg63678.html
>
> Rob

Yes, that's the same root problem (devices are released by 'of' code
that were never added using resource.c code). Adding a
"of_device_unpopulate()" function to a bunch of drivers won't work
because the crash happens without loading any driver.

Alan


\
 
 \ /
  Last update: 2014-04-17 18:21    [W:0.418 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site