Re: [PATCH] Enabling OF selftest to run without machine's devicetree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Mon, 28 Jul 2014 08:16:25 -0700, Gaurav Minocha <gaurav.minocha.os@xxxxxxxxx> wrote:
> On Mon, Jul 28, 2014 at 8:00 AM, Rob Herring <robherring2@xxxxxxxxx> wrote:
> > On Sun, Jul 27, 2014 at 10:28 PM, Gaurav Minocha
> > <gaurav.minocha.os@xxxxxxxxx> wrote:
> >> On Sat, Jul 26, 2014 at 3:17 PM, Gaurav Minocha
> >> <gaurav.minocha.os@xxxxxxxxx> wrote:
> >>> On Sat, Jul 26, 2014 at 2:11 PM, Rob Herring <robherring2@xxxxxxxxx> wrote:
> >>>> On Sat, Jul 26, 2014 at 2:48 PM, Gaurav Minocha
> >>>> <gaurav.minocha.os@xxxxxxxxx> wrote:
> >>>>> If there is no devicetree present, this patch adds the selftest
> >>>>> data as a live devicetree. It also removes the same after the
> >>>>> testcase execution is complete.
> >
> > [...]
> >
> >>>>> @@ -614,10 +616,31 @@ static int __init selftest_data_add(void)
> >>>>>                         "not running tests\n", __func__);
> >>>>>                 return -ENOMEM;
> >>>>>         }
> >>>>> -       of_fdt_unflatten_tree(selftest_data, &selftest_data_node);
> >>>>
> >>>> Can't you keep this factored out and just do "of_allnodes =
> >>>> selftest_data_node;"?
> >>>>
> >>> I tried to do that in first place, but of_alias_scan() called from
> >>> of_fdt_unflatten_tree(..)
> >>> needs of_allnodes. So, had to call it separately.
> >
> > No, it is not or I'm missing some change. Or it is a bug? It is called
> > from unflatten_device_tree which is the early boot version.
> >
> So, there are two functions unflatten_device_tree and of_fdt_unflatten_tree.
> In of_fdt_unflatten_tree, I added a call to of_alias_scan().
> Yes, unflatten_device_tree is the early boot version it already
> calls of_alias_scan().
> 
> I myself was in doubt to call of_alias_scan from of_fdt_unflatten_tree.
> Though it works fine, may be I'm not aware of a testcase in
> which it might fail. So, calling explicitly in another option as
> mentioned earlier.

Calling it from of_fdt_unflatten_tree() causes problems. That function
is intended to allow a flat tree to be processed without yet making any
part of it visible to the rest of the kernel. Calling of_alias_scan()
from there could end up adding entries to the global alias cache. To
begin with it means alias entries would point at unattached nodes, and
if the unflattened tree gets freed again later then it will cause the
kernel to oops if a driver tries to dereference it.

This is also a problem for the selftest code because the tree data is
removed after all the tests have been executed. Anything added to the
aliases cache needs to be undone before exiting the selftest module.

I've made a number of fixups to the patch to get it working with my
current tree (there were some conflicts with the overlay changes) and to
fix some problems. I'll send you my fixups in separate emails.

g.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux