From patchwork Wed Aug 26 12:28:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Holler X-Patchwork-Id: 7076871 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D002BC05AC for ; Wed, 26 Aug 2015 12:44:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C9F1A20900 for ; Wed, 26 Aug 2015 12:44:20 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5A7122062E for ; Wed, 26 Aug 2015 12:44:19 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZUa1B-0004lu-Ja; Wed, 26 Aug 2015 12:41:29 +0000 Received: from h1446028.stratoserver.net ([85.214.92.142] helo=mail.ahsoftware.de) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZUa11-0004ci-3i for linux-arm-kernel@lists.infradead.org; Wed, 26 Aug 2015 12:41:19 +0000 Received: by mail.ahsoftware.de (Postfix, from userid 65534) id 75CE42C9C22E; Wed, 26 Aug 2015 14:30:47 +0200 (CEST) Received: from wandq.ahsoftware (p4FC3641D.dip0.t-ipconnect.de [79.195.100.29]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.ahsoftware.de (Postfix) with ESMTPSA id 0960A2C9C217 for ; Wed, 26 Aug 2015 14:30:44 +0200 (CEST) Received: by wandq.ahsoftware (Postfix, from userid 65534) id 5C2869A5453; Wed, 26 Aug 2015 14:30:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from krabat.ahsoftware (unknown [192.168.207.2]) by wandq.ahsoftware (Postfix) with ESMTP id 719709A53D2; Wed, 26 Aug 2015 12:28:57 +0000 (UTC) From: Alexander Holler To: linux-kernel@vger.kernel.org Subject: [PATCH 07/16] deps: add debug configuration options Date: Wed, 26 Aug 2015 14:28:19 +0200 Message-Id: <1440592108-3740-8-git-send-email-holler@ahsoftware.de> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1440592108-3740-1-git-send-email-holler@ahsoftware.de> References: <1440592108-3740-1-git-send-email-holler@ahsoftware.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150826_054119_517510_2DB04804 X-CRM114-Status: GOOD ( 17.64 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Russel King , Tomeu Vizoso , Greg KH , Grant Likely , Alexander Holler , Andrew Morton , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add some debug options to print annotated initcalls, the ordered list of annotated initcalls and to print a message right before an annotated initcall is called. Signed-off-by: Alexander Holler --- drivers/of/Kconfig | 18 ++++++++++++++ drivers/of/of_dependencies.c | 57 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 73 insertions(+), 2 deletions(-) diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig index 9bf6c73..26c4b1a 100644 --- a/drivers/of/Kconfig +++ b/drivers/of/Kconfig @@ -114,4 +114,22 @@ config OF_DEPENDENCIES If unsure, say N here. +config OF_DEPENDENCIES_PRINT_INIT_ORDER + bool "Print dependency based initialization order" + depends on OF_DEPENDENCIES + help + Used for debugging purposes. + +config OF_DEPENDENCIES_PRINT_ANNOTATED_INITCALLS + bool "Print names of annotated drivers" + depends on OF_DEPENDENCIES + help + Used for debugging purposes. + +config OF_DEPENDENCIES_DEBUG_CALLS_OF_ANNOTATED_INITCALLS + bool "Show when annotated initcalls are actually called" + depends on OF_DEPENDENCIES + help + Used for debugging purposes. + endif # OF diff --git a/drivers/of/of_dependencies.c b/drivers/of/of_dependencies.c index 64ed049..06435d5 100644 --- a/drivers/of/of_dependencies.c +++ b/drivers/of/of_dependencies.c @@ -336,6 +336,41 @@ static void __init of_init_remove_duplicates(void) } } +#ifdef CONFIG_OF_DEPENDENCIES_PRINT_INIT_ORDER +static void __init of_init_print_order(void) +{ + unsigned i; + struct property *prop; + const char *cp; + + pr_info("Initialization order:\n"); + for (i = 0; i < order.count; ++i) { + pr_info("init %u 0x%x", i, order.order[i]->phandle); + if (order.order[i]->name) + pr_cont(" %s", order.order[i]->name); + if (order.order[i]->full_name) + pr_cont(" (%s)", order.order[i]->full_name); + prop = __of_find_property(order.order[i], "compatible", NULL); + for (cp = of_prop_next_string(prop, NULL); cp; + cp = of_prop_next_string(prop, cp)) + pr_cont(" %s", cp); + } +} +#endif + +#ifdef CONFIG_OF_DEPENDENCIES_PRINT_ANNOTATED_INITCALLS +static void __init of_init_print_annotated(void) +{ + struct _annotated_initcall *ac; + + pr_info("Annotated drivers:\n"); + ac = __annotated_initcall_start; + for (; ac < __annotated_initcall_end; ++ac) + pr_info("Driver '%s' (%s)\n", ac->driver->name, + ac->driver->of_match_table->compatible); +} +#endif + static int __init of_init_build_order(void) { int rc = 0; @@ -363,7 +398,12 @@ static int __init of_init_build_order(void) return -EINVAL; /* cycle found */ of_init_remove_duplicates(); - +#ifdef CONFIG_OF_DEPENDENCIES_PRINT_INIT_ORDER + of_init_print_order(); +#endif +#ifdef CONFIG_OF_DEPENDENCIES_PRINT_ANNOTATED_INITCALLS + of_init_print_annotated(); +#endif return rc; } @@ -386,6 +426,12 @@ static void __init init_if_matched(struct device_node *node) if (ac->initcall && ac->driver->of_match_table) if (of_match_node(ac->driver->of_match_table, node)) { +#ifdef CONFIG_OF_DEPENDENCIES_DEBUG_CALLS_OF_ANNOTATED_INITCALLS + pr_info("Calling (ordered) initcall for driver %s (%s)\n", + ac->driver->name, + ac->driver->of_match_table ? + ac->driver->of_match_table->compatible : ""); +#endif do_one_initcall(*ac->initcall); ac->initcall = 0; } @@ -404,7 +450,14 @@ void __init of_init_drivers(void) } ac = __annotated_initcall_start; for (; ac < __annotated_initcall_end; ++ac) { - if (ac->initcall) + if (ac->initcall) { +#ifdef CONFIG_OF_DEPENDENCIES_DEBUG_CALLS_OF_ANNOTATED_INITCALLS + pr_info("Calling (unordered) initcall for driver %s (%s)\n", + ac->driver->name, + ac->driver->of_match_table ? + ac->driver->of_match_table->compatible : ""); +#endif do_one_initcall(*ac->initcall); + } } }