LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH RFC 0/2] of/unittest: Add reference count tests
@ 2015-01-23 16:10 Geert Uytterhoeven
2015-01-23 16:10 ` [PATCH 1/2] of: Allow selection of OF_DYNAMIC and OF_OVERLAY if OF_UNITTEST Geert Uytterhoeven
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2015-01-23 16:10 UTC (permalink / raw)
To: Grant Likely, Rob Herring; +Cc: devicetree, linux-kernel, Geert Uytterhoeven
Hi Grant, Rob,
This patch series adds tests to detect reference count imbalances.
The tests use a fixed list of paths to devices nodes (required device
nodes in a minimal DTS, and device nodes present in unittest-data).
I considered scanning for all present device node instead, but these
are more likely to change while running the test.
These tests are executed only if CONFIG_OF_DYNAMIC=y.
Patches are against devicetree/next, with "[PATCH] of: Add missing
of_node_put() in of_find_node_by_path()" (or the alternative proposed
by Grant) applied.
Note that it shows 44 failures, which I haven't investigated yet:
### dt-test ### start of selftest - you will see error messages
### dt-test ### FAIL of_selftest_refcnt():1512 /testcase-data/duplicate-name#1: not found
### dt-test ### FAIL of_selftest_refcnt():1512 /testcase-data/duplicate-name#1: not found
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data: expected:23 got:25
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/interrupts/intc0: expected:2 got:19
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/interrupts/intc1: expected:2 got:9
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/interrupts/intc2: expected:2 got:8
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/interrupts/intmap0: expected:4 got:7
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/interrupts/intmap1: expected:4 got:5
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/platform-tests: expected:4 got:5
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/phandle-tests/consumer-a: expected:4 got:6
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/phandle-tests/provider0: expected:2 got:3
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/phandle-tests/provider1: expected:2 got:4
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/phandle-tests/provider2: expected:2 got:4
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/phandle-tests/provider3: expected:2 got:3
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/a/name2: expected:2 got:3
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/b/name2: expected:2 got:3
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/c/name2: expected:2 got:3
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/name0: expected:2 got:3
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/name1: expected:2 got:3
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/name3: expected:2 got:3
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/name4: expected:2 got:3
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/name5: expected:2 got:3
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/name6: expected:2 got:3
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/name7: expected:2 got:3
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/name8: expected:2 got:3
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/name9: expected:2 got:3
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay-node/test-bus: expected:12 got:16
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay-node/test-bus/test-selftest100: expected:2 got:4
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay-node/test-bus/test-selftest0: expected:2 got:6
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay-node/test-bus/test-selftest1: expected:2 got:4
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay-node/test-bus/test-selftest2: expected:2 got:6
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay-node/test-bus/test-selftest3: expected:2 got:4
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay0/fragment@0/__overlay__: expected:2 got:3
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay1/fragment@0/__overlay__: expected:2 got:3
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay2/fragment@0/__overlay__: expected:2 got:3
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay3/fragment@0/__overlay__: expected:2 got:3
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay4/fragment@0/__overlay__: expected:3 got:4
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay6: expected:3 got:4
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay7: expected:3 got:4
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay8: expected:3 got:4
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay9: expected:3 got:4
### dt-test ### FAIL of_selftest_refcnt():1512 /testcase-data/duplicate-name#1: not found
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/testcase-device1: expected:4 got:6
### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/testcase-device2: expected:4 got:6
### dt-test ### end of selftest - 619 passed, 44 failed
Geert Uytterhoeven (2):
of: Allow selection of OF_DYNAMIC and OF_OVERLAY if OF_UNITTEST
of/unittest: Add reference count tests
drivers/of/Kconfig | 13 ++++-
drivers/of/unittest.c | 155 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 166 insertions(+), 2 deletions(-)
--
1.9.1
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] of: Allow selection of OF_DYNAMIC and OF_OVERLAY if OF_UNITTEST
2015-01-23 16:10 [PATCH RFC 0/2] of/unittest: Add reference count tests Geert Uytterhoeven
@ 2015-01-23 16:10 ` Geert Uytterhoeven
2015-03-20 12:25 ` Grant Likely
2015-01-23 16:10 ` [PATCH RFC 2/2] of/unittest: Add reference count tests Geert Uytterhoeven
2015-02-04 16:14 ` [PATCH RFC 0/2] " Rob Herring
2 siblings, 1 reply; 9+ messages in thread
From: Geert Uytterhoeven @ 2015-01-23 16:10 UTC (permalink / raw)
To: Grant Likely, Rob Herring; +Cc: devicetree, linux-kernel, Geert Uytterhoeven
Currently OF_DYNAMIC and OF_OVERLAY are not visible to the user, and are
selected automatically only when needed.
Allow them to be enabled manually to improve device tree unit test
coverage.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/of/Kconfig | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index 38d1c51f58b108db..e9301686493933cc 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -34,7 +34,11 @@ config OF_PROMTREE
# Hardly any platforms need this. It is safe to select, but only do so if you
# need it.
config OF_DYNAMIC
- bool
+ bool "Support for dynamic device trees" if OF_UNITTEST
+ help
+ On some platforms, the device tree can be manipulated at runtime.
+ While this option is selected automatically on such platforms, you
+ can enable it manually to improve device tree unit test coverage.
config OF_ADDRESS
def_bool y
@@ -84,9 +88,14 @@ config OF_RESOLVE
bool
config OF_OVERLAY
- bool
+ bool "Support for device tree overlays" if OF_UNITTEST
depends on OF
select OF_DYNAMIC
select OF_RESOLVE
+ help
+ Overlays are a method to dynamically modify part of the kernel's
+ device tree with dynamically loaded data.
+ While this option is selected automatically when needed, you can
+ enable it manually to improve device tree unit test coverage.
endmenu # OF
--
1.9.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH RFC 2/2] of/unittest: Add reference count tests
2015-01-23 16:10 [PATCH RFC 0/2] of/unittest: Add reference count tests Geert Uytterhoeven
2015-01-23 16:10 ` [PATCH 1/2] of: Allow selection of OF_DYNAMIC and OF_OVERLAY if OF_UNITTEST Geert Uytterhoeven
@ 2015-01-23 16:10 ` Geert Uytterhoeven
2015-02-04 16:14 ` [PATCH RFC 0/2] " Rob Herring
2 siblings, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2015-01-23 16:10 UTC (permalink / raw)
To: Grant Likely, Rob Herring; +Cc: devicetree, linux-kernel, Geert Uytterhoeven
Add tests to detect reference count imbalances. The tests use a fixed
list of paths to devices nodes (required device nodes in a minimal DTS,
and device nodes present in unittest-data).
These tests are executed only if CONFIG_OF_DYNAMIC=y.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/of/unittest.c | 155 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 155 insertions(+)
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 7aa1d6dae5ba72af..464703c6e7021760 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -1383,6 +1383,154 @@ out:
static inline void __init of_selftest_overlay(void) { }
#endif
+#ifdef CONFIG_OF_DYNAMIC
+static struct {
+ const char *path;
+ int refcnt;
+} refcnt_tests[] __initdata = {
+ /* required nodes */
+ { "/" },
+ { "/aliases" },
+ { "/chosen" },
+ { "/cpus" },
+ { "/cpus/cpu@0" },
+ { "/testcase-data" },
+ /* unittest-data */
+ { "/testcase-data/interrupts" },
+ { "/testcase-data/interrupts/intc0" },
+ { "/testcase-data/interrupts/intc1" },
+ { "/testcase-data/interrupts/intc2" },
+ { "/testcase-data/interrupts/interrupts0" },
+ { "/testcase-data/interrupts/interrupts1" },
+ { "/testcase-data/interrupts/interrupts-extended0" },
+ { "/testcase-data/interrupts/intmap0" },
+ { "/testcase-data/interrupts/intmap1" },
+ { "/testcase-data/platform-tests" },
+ { "/testcase-data/platform-tests/test-device@0" },
+ { "/testcase-data/platform-tests/test-device@0/dev@100" },
+ { "/testcase-data/platform-tests/test-device@1" },
+ { "/testcase-data/platform-tests/test-device@1/dev@100" },
+ { "/testcase-data/phandle-tests" },
+ { "/testcase-data/phandle-tests/consumer-a" },
+ { "/testcase-data/phandle-tests/provider0" },
+ { "/testcase-data/phandle-tests/provider1" },
+ { "/testcase-data/phandle-tests/provider2" },
+ { "/testcase-data/phandle-tests/provider3" },
+ { "/testcase-data/match-node" },
+ { "/testcase-data/match-node/a" },
+ { "/testcase-data/match-node/a/name2" },
+ { "/testcase-data/match-node/b" },
+ { "/testcase-data/match-node/b/name2" },
+ { "/testcase-data/match-node/c" },
+ { "/testcase-data/match-node/c/name2" },
+ { "/testcase-data/match-node/name0" },
+ { "/testcase-data/match-node/name1" },
+ { "/testcase-data/match-node/name3" },
+ { "/testcase-data/match-node/name4" },
+ { "/testcase-data/match-node/name5" },
+ { "/testcase-data/match-node/name6" },
+ { "/testcase-data/match-node/name7" },
+ { "/testcase-data/match-node/name8" },
+ { "/testcase-data/match-node/name9" },
+ { "/testcase-data/changeset" },
+ { "/testcase-data/changeset/node-remove" },
+ { "/testcase-data/overlay-node" },
+ { "/testcase-data/overlay-node/test-bus" },
+ { "/testcase-data/overlay-node/test-bus/test-selftest100" },
+ { "/testcase-data/overlay-node/test-bus/test-selftest101" },
+ { "/testcase-data/overlay-node/test-bus/test-selftest0" },
+ { "/testcase-data/overlay-node/test-bus/test-selftest1" },
+ { "/testcase-data/overlay-node/test-bus/test-selftest2" },
+ { "/testcase-data/overlay-node/test-bus/test-selftest3" },
+ { "/testcase-data/overlay-node/test-bus/test-selftest5" },
+ { "/testcase-data/overlay-node/test-bus/test-selftest6" },
+ { "/testcase-data/overlay-node/test-bus/test-selftest7" },
+ { "/testcase-data/overlay-node/test-bus/test-selftest8" },
+ { "/testcase-data/overlay0" },
+ { "/testcase-data/overlay0/fragment@0" },
+ { "/testcase-data/overlay0/fragment@0/__overlay__" },
+ { "/testcase-data/overlay1" },
+ { "/testcase-data/overlay1/fragment@0" },
+ { "/testcase-data/overlay1/fragment@0/__overlay__" },
+ { "/testcase-data/overlay2" },
+ { "/testcase-data/overlay2/fragment@0" },
+ { "/testcase-data/overlay2/fragment@0/__overlay__" },
+ { "/testcase-data/overlay3" },
+ { "/testcase-data/overlay3/fragment@0" },
+ { "/testcase-data/overlay3/fragment@0/__overlay__" },
+ { "/testcase-data/overlay4" },
+ { "/testcase-data/overlay4/fragment@0" },
+ { "/testcase-data/overlay4/fragment@0/__overlay__" },
+ { "/testcase-data/overlay4/fragment@0/__overlay__/test-selftest4" },
+ { "/testcase-data/overlay5" },
+ { "/testcase-data/overlay5/fragment@0" },
+ { "/testcase-data/overlay5/fragment@0/__overlay__" },
+ { "/testcase-data/overlay6" },
+ { "/testcase-data/overlay6/fragment@0" },
+ { "/testcase-data/overlay6/fragment@0/__overlay__" },
+ { "/testcase-data/overlay7" },
+ { "/testcase-data/overlay7/fragment@0" },
+ { "/testcase-data/overlay7/fragment@0/__overlay__" },
+ { "/testcase-data/overlay8" },
+ { "/testcase-data/overlay8/fragment@0" },
+ { "/testcase-data/overlay8/fragment@0/__overlay__" },
+ { "/testcase-data/overlay9" },
+ { "/testcase-data/overlay9/fragment@0" },
+ { "/testcase-data/overlay9/fragment@0/__overlay__" },
+ { "/testcase-data/duplicate-name#1" },
+ { "/testcase-data/testcase-device1" },
+ { "/testcase-data/testcase-device2" },
+ { "/__local_fixups__/testcase-data" },
+ { "/__local_fixups__/testcase-data/interrupts" },
+ { "/__local_fixups__/testcase-data/interrupts/interrupts0" },
+ { "/__local_fixups__/testcase-data/interrupts/interrupts1" },
+ { "/__local_fixups__/testcase-data/interrupts/interrupts-extended0" },
+ { "/__local_fixups__/testcase-data/interrupts/intmap0" },
+ { "/__local_fixups__/testcase-data/interrupts/intmap1" },
+ { "/__local_fixups__/testcase-data/phandle-tests" },
+ { "/__local_fixups__/testcase-data/phandle-tests/consumer-a" },
+ { "/__local_fixups__/testcase-data/overlay2" },
+ { "/__local_fixups__/testcase-data/overlay2/fragment@0" },
+ { "/__local_fixups__/testcase-data/overlay3" },
+ { "/__local_fixups__/testcase-data/overlay3/fragment@0" },
+ { "/__local_fixups__/testcase-data/overlay4" },
+ { "/__local_fixups__/testcase-data/overlay4/fragment@0" },
+ { "/__local_fixups__/testcase-data/testcase-device1" },
+ { "/__local_fixups__/testcase-data/testcase-device2" },
+};
+
+static void __init of_selftest_refcnt(void)
+{
+ static bool called;
+ unsigned int i;
+
+ for (i = 0; i < ARRAY_SIZE(refcnt_tests); i++) {
+ const char *path = refcnt_tests[i].path;
+ struct device_node *np = of_find_node_by_path(path);
+ int refcnt;
+
+ selftest(np, "%s: not found", path);
+ if (!np)
+ continue;
+
+ refcnt = atomic_read(&np->kobj.kref.refcount);
+ if (!called)
+ refcnt_tests[i].refcnt = refcnt;
+ else
+ selftest(refcnt == refcnt_tests[i].refcnt,
+ "%s: expected:%i got:%i\n", path,
+ refcnt_tests[i].refcnt, refcnt);
+
+ of_node_put(np);
+ }
+
+ called = true;
+}
+
+#else
+static inline void __init of_selftest_refcnt(void) { }
+#endif
+
static int __init of_selftest(void)
{
struct device_node *np;
@@ -1403,6 +1551,11 @@ static int __init of_selftest(void)
of_node_put(np);
pr_info("start of selftest - you will see error messages\n");
+
+ /* gather reference counts */
+ of_selftest_refcnt();
+ /* verify reference counts */
+ of_selftest_refcnt();
of_selftest_check_tree_linkage();
of_selftest_check_phandles();
of_selftest_find_node_by_name();
@@ -1420,6 +1573,8 @@ static int __init of_selftest(void)
/* Double check linkage after removing testcase data */
of_selftest_check_tree_linkage();
+ of_selftest_refcnt();
+
pr_info("end of selftest - %i passed, %i failed\n",
selftest_results.passed, selftest_results.failed);
--
1.9.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH RFC 0/2] of/unittest: Add reference count tests
2015-01-23 16:10 [PATCH RFC 0/2] of/unittest: Add reference count tests Geert Uytterhoeven
2015-01-23 16:10 ` [PATCH 1/2] of: Allow selection of OF_DYNAMIC and OF_OVERLAY if OF_UNITTEST Geert Uytterhoeven
2015-01-23 16:10 ` [PATCH RFC 2/2] of/unittest: Add reference count tests Geert Uytterhoeven
@ 2015-02-04 16:14 ` Rob Herring
2015-02-04 17:08 ` Geert Uytterhoeven
2 siblings, 1 reply; 9+ messages in thread
From: Rob Herring @ 2015-02-04 16:14 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Grant Likely, Rob Herring, devicetree, linux-kernel
On Fri, Jan 23, 2015 at 10:10 AM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> Hi Grant, Rob,
>
> This patch series adds tests to detect reference count imbalances.
> The tests use a fixed list of paths to devices nodes (required device
> nodes in a minimal DTS, and device nodes present in unittest-data).
> I considered scanning for all present device node instead, but these
> are more likely to change while running the test.
>
> These tests are executed only if CONFIG_OF_DYNAMIC=y.
>
> Patches are against devicetree/next, with "[PATCH] of: Add missing
> of_node_put() in of_find_node_by_path()" (or the alternative proposed
> by Grant) applied.
>
> Note that it shows 44 failures, which I haven't investigated yet:
Do you plan to?
While this could find problems in the unittests or the core OF code,
the vast majority of the problems are likely in the users and this
doesn't help with those. This whole issue of ref counts has been
discussed some and probably needs to be redesigned or instrumented in
a way that users can validate. But then it is pretty low priority
given that ref counts only matter on pseries.
Rob
>
> ### dt-test ### start of selftest - you will see error messages
> ### dt-test ### FAIL of_selftest_refcnt():1512 /testcase-data/duplicate-name#1: not found
> ### dt-test ### FAIL of_selftest_refcnt():1512 /testcase-data/duplicate-name#1: not found
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data: expected:23 got:25
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/interrupts/intc0: expected:2 got:19
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/interrupts/intc1: expected:2 got:9
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/interrupts/intc2: expected:2 got:8
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/interrupts/intmap0: expected:4 got:7
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/interrupts/intmap1: expected:4 got:5
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/platform-tests: expected:4 got:5
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/phandle-tests/consumer-a: expected:4 got:6
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/phandle-tests/provider0: expected:2 got:3
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/phandle-tests/provider1: expected:2 got:4
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/phandle-tests/provider2: expected:2 got:4
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/phandle-tests/provider3: expected:2 got:3
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/a/name2: expected:2 got:3
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/b/name2: expected:2 got:3
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/c/name2: expected:2 got:3
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/name0: expected:2 got:3
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/name1: expected:2 got:3
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/name3: expected:2 got:3
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/name4: expected:2 got:3
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/name5: expected:2 got:3
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/name6: expected:2 got:3
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/name7: expected:2 got:3
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/name8: expected:2 got:3
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/match-node/name9: expected:2 got:3
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay-node/test-bus: expected:12 got:16
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay-node/test-bus/test-selftest100: expected:2 got:4
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay-node/test-bus/test-selftest0: expected:2 got:6
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay-node/test-bus/test-selftest1: expected:2 got:4
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay-node/test-bus/test-selftest2: expected:2 got:6
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay-node/test-bus/test-selftest3: expected:2 got:4
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay0/fragment@0/__overlay__: expected:2 got:3
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay1/fragment@0/__overlay__: expected:2 got:3
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay2/fragment@0/__overlay__: expected:2 got:3
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay3/fragment@0/__overlay__: expected:2 got:3
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay4/fragment@0/__overlay__: expected:3 got:4
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay6: expected:3 got:4
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay7: expected:3 got:4
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay8: expected:3 got:4
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/overlay9: expected:3 got:4
> ### dt-test ### FAIL of_selftest_refcnt():1512 /testcase-data/duplicate-name#1: not found
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/testcase-device1: expected:4 got:6
> ### dt-test ### FAIL of_selftest_refcnt():1522 /testcase-data/testcase-device2: expected:4 got:6
> ### dt-test ### end of selftest - 619 passed, 44 failed
>
> Geert Uytterhoeven (2):
> of: Allow selection of OF_DYNAMIC and OF_OVERLAY if OF_UNITTEST
> of/unittest: Add reference count tests
>
> drivers/of/Kconfig | 13 ++++-
> drivers/of/unittest.c | 155 ++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 166 insertions(+), 2 deletions(-)
>
> --
> 1.9.1
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH RFC 0/2] of/unittest: Add reference count tests
2015-02-04 16:14 ` [PATCH RFC 0/2] " Rob Herring
@ 2015-02-04 17:08 ` Geert Uytterhoeven
0 siblings, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2015-02-04 17:08 UTC (permalink / raw)
To: Rob Herring
Cc: Geert Uytterhoeven, Grant Likely, Rob Herring, devicetree, linux-kernel
Hi Rob,
On Wed, Feb 4, 2015 at 5:14 PM, Rob Herring <robherring2@gmail.com> wrote:
> On Fri, Jan 23, 2015 at 10:10 AM, Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
>> This patch series adds tests to detect reference count imbalances.
>> The tests use a fixed list of paths to devices nodes (required device
>> nodes in a minimal DTS, and device nodes present in unittest-data).
>> I considered scanning for all present device node instead, but these
>> are more likely to change while running the test.
>>
>> These tests are executed only if CONFIG_OF_DYNAMIC=y.
>>
>> Patches are against devicetree/next, with "[PATCH] of: Add missing
>> of_node_put() in of_find_node_by_path()" (or the alternative proposed
>> by Grant) applied.
>>
>> Note that it shows 44 failures, which I haven't investigated yet:
>
> Do you plan to?
Maybe. It doesn't have such a high priority in my task list...
> While this could find problems in the unittests or the core OF code,
> the vast majority of the problems are likely in the users and this
> doesn't help with those. This whole issue of ref counts has been
> discussed some and probably needs to be redesigned or instrumented in
> a way that users can validate. But then it is pretty low priority
> given that ref counts only matter on pseries.
I agree most issues are in the users.
However, I did find one issue in the core code.
Note that the reference counts may become more important in the future,
as OF_OVERLAY selects OF_DYNAMIC.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] of: Allow selection of OF_DYNAMIC and OF_OVERLAY if OF_UNITTEST
2015-01-23 16:10 ` [PATCH 1/2] of: Allow selection of OF_DYNAMIC and OF_OVERLAY if OF_UNITTEST Geert Uytterhoeven
@ 2015-03-20 12:25 ` Grant Likely
2015-03-20 13:32 ` Rob Herring
0 siblings, 1 reply; 9+ messages in thread
From: Grant Likely @ 2015-03-20 12:25 UTC (permalink / raw)
To: Geert Uytterhoeven, Rob Herring
Cc: devicetree, linux-kernel, Geert Uytterhoeven
On Fri, 23 Jan 2015 17:10:04 +0100
, Geert Uytterhoeven <geert+renesas@glider.be>
wrote:
> Currently OF_DYNAMIC and OF_OVERLAY are not visible to the user, and are
> selected automatically only when needed.
>
> Allow them to be enabled manually to improve device tree unit test
> coverage.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
I like the change. Merged, thanks.
g.
> ---
> drivers/of/Kconfig | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
> index 38d1c51f58b108db..e9301686493933cc 100644
> --- a/drivers/of/Kconfig
> +++ b/drivers/of/Kconfig
> @@ -34,7 +34,11 @@ config OF_PROMTREE
> # Hardly any platforms need this. It is safe to select, but only do so if you
> # need it.
> config OF_DYNAMIC
> - bool
> + bool "Support for dynamic device trees" if OF_UNITTEST
> + help
> + On some platforms, the device tree can be manipulated at runtime.
> + While this option is selected automatically on such platforms, you
> + can enable it manually to improve device tree unit test coverage.
>
> config OF_ADDRESS
> def_bool y
> @@ -84,9 +88,14 @@ config OF_RESOLVE
> bool
>
> config OF_OVERLAY
> - bool
> + bool "Support for device tree overlays" if OF_UNITTEST
> depends on OF
> select OF_DYNAMIC
> select OF_RESOLVE
> + help
> + Overlays are a method to dynamically modify part of the kernel's
> + device tree with dynamically loaded data.
> + While this option is selected automatically when needed, you can
> + enable it manually to improve device tree unit test coverage.
>
> endmenu # OF
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] of: Allow selection of OF_DYNAMIC and OF_OVERLAY if OF_UNITTEST
2015-03-20 12:25 ` Grant Likely
@ 2015-03-20 13:32 ` Rob Herring
2015-03-24 22:54 ` Grant Likely
0 siblings, 1 reply; 9+ messages in thread
From: Rob Herring @ 2015-03-20 13:32 UTC (permalink / raw)
To: Grant Likely; +Cc: Geert Uytterhoeven, Rob Herring, devicetree, linux-kernel
On Fri, Mar 20, 2015 at 7:25 AM, Grant Likely <grant.likely@linaro.org> wrote:
> On Fri, 23 Jan 2015 17:10:04 +0100
> , Geert Uytterhoeven <geert+renesas@glider.be>
> wrote:
>> Currently OF_DYNAMIC and OF_OVERLAY are not visible to the user, and are
>> selected automatically only when needed.
>>
>> Allow them to be enabled manually to improve device tree unit test
>> coverage.
>>
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> I like the change. Merged, thanks.
Making OF_OVERLAY visible is already in 4.0-rc4.
Rob
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] of: Allow selection of OF_DYNAMIC and OF_OVERLAY if OF_UNITTEST
2015-03-20 13:32 ` Rob Herring
@ 2015-03-24 22:54 ` Grant Likely
2015-03-25 14:14 ` Geert Uytterhoeven
0 siblings, 1 reply; 9+ messages in thread
From: Grant Likely @ 2015-03-24 22:54 UTC (permalink / raw)
To: Rob Herring; +Cc: Geert Uytterhoeven, Rob Herring, devicetree, linux-kernel
On Fri, 20 Mar 2015 08:32:12 -0500
, Rob Herring <robherring2@gmail.com>
wrote:
> On Fri, Mar 20, 2015 at 7:25 AM, Grant Likely <grant.likely@linaro.org> wrote:
> > On Fri, 23 Jan 2015 17:10:04 +0100
> > , Geert Uytterhoeven <geert+renesas@glider.be>
> > wrote:
> >> Currently OF_DYNAMIC and OF_OVERLAY are not visible to the user, and are
> >> selected automatically only when needed.
> >>
> >> Allow them to be enabled manually to improve device tree unit test
> >> coverage.
> >>
> >> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >
> > I like the change. Merged, thanks.
>
> Making OF_OVERLAY visible is already in 4.0-rc4.
Yes, I modified the patch to fit.
g.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] of: Allow selection of OF_DYNAMIC and OF_OVERLAY if OF_UNITTEST
2015-03-24 22:54 ` Grant Likely
@ 2015-03-25 14:14 ` Geert Uytterhoeven
0 siblings, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2015-03-25 14:14 UTC (permalink / raw)
To: Grant Likely
Cc: Rob Herring, Geert Uytterhoeven, Rob Herring, devicetree, linux-kernel
Hi Grant,
On Tue, Mar 24, 2015 at 11:54 PM, Grant Likely <grant.likely@linaro.org> wrote:
> On Fri, 20 Mar 2015 08:32:12 -0500
> , Rob Herring <robherring2@gmail.com>
> wrote:
>> On Fri, Mar 20, 2015 at 7:25 AM, Grant Likely <grant.likely@linaro.org> wrote:
>> > On Fri, 23 Jan 2015 17:10:04 +0100
>> > , Geert Uytterhoeven <geert+renesas@glider.be>
>> > wrote:
>> >> Currently OF_DYNAMIC and OF_OVERLAY are not visible to the user, and are
>> >> selected automatically only when needed.
>> >>
>> >> Allow them to be enabled manually to improve device tree unit test
>> >> coverage.
>> >>
>> >> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> >
>> > I like the change. Merged, thanks.
>>
>> Making OF_OVERLAY visible is already in 4.0-rc4.
>
> Yes, I modified the patch to fit.
I had seen Rob's comment, but due to travelling I hadn't sent an updated
version yet. Thanks for taking care!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2015-03-25 14:14 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-23 16:10 [PATCH RFC 0/2] of/unittest: Add reference count tests Geert Uytterhoeven
2015-01-23 16:10 ` [PATCH 1/2] of: Allow selection of OF_DYNAMIC and OF_OVERLAY if OF_UNITTEST Geert Uytterhoeven
2015-03-20 12:25 ` Grant Likely
2015-03-20 13:32 ` Rob Herring
2015-03-24 22:54 ` Grant Likely
2015-03-25 14:14 ` Geert Uytterhoeven
2015-01-23 16:10 ` [PATCH RFC 2/2] of/unittest: Add reference count tests Geert Uytterhoeven
2015-02-04 16:14 ` [PATCH RFC 0/2] " Rob Herring
2015-02-04 17:08 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).