All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] clk: respect the clock dependencies in of_clk_init
@ 2014-02-24 18:10 ` Gregory CLEMENT
  0 siblings, 0 replies; 13+ messages in thread
From: Gregory CLEMENT @ 2014-02-24 18:10 UTC (permalink / raw)
  To: Mike Turquette
  Cc: Tomasz Figa, linux-kernel, Jason Cooper, Andrew Lunn,
	Sebastian Hesselbarth, Gregory CLEMENT, Thomas Petazzoni,
	Ezequiel Garcia, linux-arm-kernel, Boris BREZILLON

Until now the clock providers were initialized in the order found in
the device tree. This led to have the dependencies between the clocks
not respected: children clocks could be initialized before their
parent clocks.

Instead of forcing each platform to manage its own initialization order,
this patch adds this work inside the framework itself.

Using the data of the device tree the of_clk_init function now delayed
the initialization of a clock provider if its parent provider was not
ready yet.

The strict dependency check (all parents of a given clk must be
initialized) was added by Boris BREZILLON

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
---
Mike,

This patch depend on the patch "clk: return probe defer when DT clock
not yet ready": http://article.gmane.org/gmane.linux.kernel/1643466

If for any reason you don't want to take it, then I will write a new
version closer to the v2 for the parent_ready() function.

I have taken into account all the remarks from Tomasz.

Thanks,

Changelog:
v2->v3:

- added the SoB flag of Boris
- used of_clk_get(np, i) in the parent_ready() function.
- simplified the loops to manage the order dependencies in of_clk_init()

v1 -> v2:
Merged the  strict dependency check from Boris.


 drivers/clk/clk.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 79 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 32d84e921b23..3a07f8ac2e11 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2526,24 +2526,99 @@ const char *of_clk_get_parent_name(struct device_node *np, int index)
 }
 EXPORT_SYMBOL_GPL(of_clk_get_parent_name);
 
+struct clock_provider {
+	of_clk_init_cb_t clk_init_cb;
+	struct device_node *np;
+	struct list_head node;
+};
+
+static LIST_HEAD(clk_provider_list);
+
+/*
+ * This function looks for a parent clock. If there is one, then it
+ * checks that the provider for this parent clock was initialized, in
+ * this case the parent clock will be ready.
+ */
+static int parent_ready(struct device_node *np)
+{
+	int i = 0;
+
+	while (true) {
+		struct clk *clk = of_clk_get(np, i);
+
+		/* this parent is ready we can check the next one */
+		if (!IS_ERR(clk)) {
+			clk_put(clk);
+			i++;
+			continue;
+		}
+
+		/* at least one parent is not ready, we exit now */
+		if (PTR_ERR(clk) == -EPROBE_DEFER)
+			return 0;
+
+		/*
+		 * Here we make assumption that the device tree is
+		 * written correctly. So an error means that there is
+		 * no more parent. As we didn't exit yet, then the
+		 * previous parent are ready. If there is no clock
+		 * parent, no need to wait for them, then we can
+		 * consider their absence as being ready
+		 */
+		return 1;
+	}
+}
+
 /**
  * of_clk_init() - Scan and init clock providers from the DT
  * @matches: array of compatible values and init functions for providers.
  *
- * This function scans the device tree for matching clock providers and
- * calls their initialization functions
+ * This function scans the device tree for matching clock providers
+ * and calls their initialization functions. It also do it by trying
+ * to follow the dependencies.
  */
 void __init of_clk_init(const struct of_device_id *matches)
 {
 	const struct of_device_id *match;
 	struct device_node *np;
+	struct clock_provider *clk_provider, *next;
+	bool is_init_done;
+	bool force = false;
 
 	if (!matches)
 		matches = &__clk_of_table;
 
+	/* First prepare the list of the clocks providers */
 	for_each_matching_node_and_match(np, matches, &match) {
-		of_clk_init_cb_t clk_init_cb = match->data;
-		clk_init_cb(np);
+		struct clock_provider *parent =
+			kzalloc(sizeof(struct clock_provider),	GFP_KERNEL);
+
+		parent->clk_init_cb = match->data;
+		parent->np = np;
+		list_add(&parent->node, &clk_provider_list);
+	}
+
+	while (!list_empty(&clk_provider_list)) {
+		is_init_done = false;
+		list_for_each_entry_safe(clk_provider, next,
+					&clk_provider_list, node) {
+			if (force || parent_ready(clk_provider->np)) {
+				clk_provider->clk_init_cb(clk_provider->np);
+				list_del(&clk_provider->node);
+				kfree(clk_provider);
+				is_init_done = true;
+			}
+		}
+
+		/*
+		 * We didn't managed to initialize any of the
+		 * remaining providers during the last loop, so now we
+		 * initialize all the remaining ones unconditionally
+		 * in case the clock parent was not mandatory
+		 */
+		if (!is_init_done)
+			force = true;
+
 	}
 }
 #endif
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3] clk: respect the clock dependencies in of_clk_init
@ 2014-02-24 18:10 ` Gregory CLEMENT
  0 siblings, 0 replies; 13+ messages in thread
From: Gregory CLEMENT @ 2014-02-24 18:10 UTC (permalink / raw)
  To: linux-arm-kernel

Until now the clock providers were initialized in the order found in
the device tree. This led to have the dependencies between the clocks
not respected: children clocks could be initialized before their
parent clocks.

Instead of forcing each platform to manage its own initialization order,
this patch adds this work inside the framework itself.

Using the data of the device tree the of_clk_init function now delayed
the initialization of a clock provider if its parent provider was not
ready yet.

The strict dependency check (all parents of a given clk must be
initialized) was added by Boris BREZILLON

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
---
Mike,

This patch depend on the patch "clk: return probe defer when DT clock
not yet ready": http://article.gmane.org/gmane.linux.kernel/1643466

If for any reason you don't want to take it, then I will write a new
version closer to the v2 for the parent_ready() function.

I have taken into account all the remarks from Tomasz.

Thanks,

Changelog:
v2->v3:

- added the SoB flag of Boris
- used of_clk_get(np, i) in the parent_ready() function.
- simplified the loops to manage the order dependencies in of_clk_init()

v1 -> v2:
Merged the  strict dependency check from Boris.


 drivers/clk/clk.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 79 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 32d84e921b23..3a07f8ac2e11 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2526,24 +2526,99 @@ const char *of_clk_get_parent_name(struct device_node *np, int index)
 }
 EXPORT_SYMBOL_GPL(of_clk_get_parent_name);
 
+struct clock_provider {
+	of_clk_init_cb_t clk_init_cb;
+	struct device_node *np;
+	struct list_head node;
+};
+
+static LIST_HEAD(clk_provider_list);
+
+/*
+ * This function looks for a parent clock. If there is one, then it
+ * checks that the provider for this parent clock was initialized, in
+ * this case the parent clock will be ready.
+ */
+static int parent_ready(struct device_node *np)
+{
+	int i = 0;
+
+	while (true) {
+		struct clk *clk = of_clk_get(np, i);
+
+		/* this parent is ready we can check the next one */
+		if (!IS_ERR(clk)) {
+			clk_put(clk);
+			i++;
+			continue;
+		}
+
+		/* at least one parent is not ready, we exit now */
+		if (PTR_ERR(clk) == -EPROBE_DEFER)
+			return 0;
+
+		/*
+		 * Here we make assumption that the device tree is
+		 * written correctly. So an error means that there is
+		 * no more parent. As we didn't exit yet, then the
+		 * previous parent are ready. If there is no clock
+		 * parent, no need to wait for them, then we can
+		 * consider their absence as being ready
+		 */
+		return 1;
+	}
+}
+
 /**
  * of_clk_init() - Scan and init clock providers from the DT
  * @matches: array of compatible values and init functions for providers.
  *
- * This function scans the device tree for matching clock providers and
- * calls their initialization functions
+ * This function scans the device tree for matching clock providers
+ * and calls their initialization functions. It also do it by trying
+ * to follow the dependencies.
  */
 void __init of_clk_init(const struct of_device_id *matches)
 {
 	const struct of_device_id *match;
 	struct device_node *np;
+	struct clock_provider *clk_provider, *next;
+	bool is_init_done;
+	bool force = false;
 
 	if (!matches)
 		matches = &__clk_of_table;
 
+	/* First prepare the list of the clocks providers */
 	for_each_matching_node_and_match(np, matches, &match) {
-		of_clk_init_cb_t clk_init_cb = match->data;
-		clk_init_cb(np);
+		struct clock_provider *parent =
+			kzalloc(sizeof(struct clock_provider),	GFP_KERNEL);
+
+		parent->clk_init_cb = match->data;
+		parent->np = np;
+		list_add(&parent->node, &clk_provider_list);
+	}
+
+	while (!list_empty(&clk_provider_list)) {
+		is_init_done = false;
+		list_for_each_entry_safe(clk_provider, next,
+					&clk_provider_list, node) {
+			if (force || parent_ready(clk_provider->np)) {
+				clk_provider->clk_init_cb(clk_provider->np);
+				list_del(&clk_provider->node);
+				kfree(clk_provider);
+				is_init_done = true;
+			}
+		}
+
+		/*
+		 * We didn't managed to initialize any of the
+		 * remaining providers during the last loop, so now we
+		 * initialize all the remaining ones unconditionally
+		 * in case the clock parent was not mandatory
+		 */
+		if (!is_init_done)
+			force = true;
+
 	}
 }
 #endif
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v3] clk: respect the clock dependencies in of_clk_init
  2014-02-24 18:10 ` Gregory CLEMENT
@ 2014-02-28 10:46   ` Gregory CLEMENT
  -1 siblings, 0 replies; 13+ messages in thread
From: Gregory CLEMENT @ 2014-02-28 10:46 UTC (permalink / raw)
  To: Mike Turquette
  Cc: Tomasz Figa, linux-kernel, Jason Cooper, Andrew Lunn,
	Sebastian Hesselbarth, Gregory CLEMENT, Thomas Petazzoni,
	Ezequiel Garcia, linux-arm-kernel, Boris BREZILLON

Hi Mike,

On 24/02/2014 19:10, Gregory CLEMENT wrote:
> Until now the clock providers were initialized in the order found in
> the device tree. This led to have the dependencies between the clocks
> not respected: children clocks could be initialized before their
> parent clocks.
> 
> Instead of forcing each platform to manage its own initialization order,
> this patch adds this work inside the framework itself.
> 
> Using the data of the device tree the of_clk_init function now delayed
> the initialization of a clock provider if its parent provider was not
> ready yet.
> 
> The strict dependency check (all parents of a given clk must be
> initialized) was added by Boris BREZILLON

Are you ok with this version?
Will you take it for 3.15?
Or maybe you expected that it will be part of a pull request?

However as it is modifying the core of the framework I thought that you
would take it and apply yourself.

Thanks,

Gregory

> 
> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
> Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
> ---
> Mike,
> 
> This patch depend on the patch "clk: return probe defer when DT clock
> not yet ready": http://article.gmane.org/gmane.linux.kernel/1643466
> 
> If for any reason you don't want to take it, then I will write a new
> version closer to the v2 for the parent_ready() function.
> 
> I have taken into account all the remarks from Tomasz.
> 
> Thanks,
> 
> Changelog:
> v2->v3:
> 
> - added the SoB flag of Boris
> - used of_clk_get(np, i) in the parent_ready() function.
> - simplified the loops to manage the order dependencies in of_clk_init()
> 
> v1 -> v2:
> Merged the  strict dependency check from Boris.
> 
> 
>  drivers/clk/clk.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 79 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 32d84e921b23..3a07f8ac2e11 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -2526,24 +2526,99 @@ const char *of_clk_get_parent_name(struct device_node *np, int index)
>  }
>  EXPORT_SYMBOL_GPL(of_clk_get_parent_name);
>  
> +struct clock_provider {
> +	of_clk_init_cb_t clk_init_cb;
> +	struct device_node *np;
> +	struct list_head node;
> +};
> +
> +static LIST_HEAD(clk_provider_list);
> +
> +/*
> + * This function looks for a parent clock. If there is one, then it
> + * checks that the provider for this parent clock was initialized, in
> + * this case the parent clock will be ready.
> + */
> +static int parent_ready(struct device_node *np)
> +{
> +	int i = 0;
> +
> +	while (true) {
> +		struct clk *clk = of_clk_get(np, i);
> +
> +		/* this parent is ready we can check the next one */
> +		if (!IS_ERR(clk)) {
> +			clk_put(clk);
> +			i++;
> +			continue;
> +		}
> +
> +		/* at least one parent is not ready, we exit now */
> +		if (PTR_ERR(clk) == -EPROBE_DEFER)
> +			return 0;
> +
> +		/*
> +		 * Here we make assumption that the device tree is
> +		 * written correctly. So an error means that there is
> +		 * no more parent. As we didn't exit yet, then the
> +		 * previous parent are ready. If there is no clock
> +		 * parent, no need to wait for them, then we can
> +		 * consider their absence as being ready
> +		 */
> +		return 1;
> +	}
> +}
> +
>  /**
>   * of_clk_init() - Scan and init clock providers from the DT
>   * @matches: array of compatible values and init functions for providers.
>   *
> - * This function scans the device tree for matching clock providers and
> - * calls their initialization functions
> + * This function scans the device tree for matching clock providers
> + * and calls their initialization functions. It also do it by trying
> + * to follow the dependencies.
>   */
>  void __init of_clk_init(const struct of_device_id *matches)
>  {
>  	const struct of_device_id *match;
>  	struct device_node *np;
> +	struct clock_provider *clk_provider, *next;
> +	bool is_init_done;
> +	bool force = false;
>  
>  	if (!matches)
>  		matches = &__clk_of_table;
>  
> +	/* First prepare the list of the clocks providers */
>  	for_each_matching_node_and_match(np, matches, &match) {
> -		of_clk_init_cb_t clk_init_cb = match->data;
> -		clk_init_cb(np);
> +		struct clock_provider *parent =
> +			kzalloc(sizeof(struct clock_provider),	GFP_KERNEL);
> +
> +		parent->clk_init_cb = match->data;
> +		parent->np = np;
> +		list_add(&parent->node, &clk_provider_list);
> +	}
> +
> +	while (!list_empty(&clk_provider_list)) {
> +		is_init_done = false;
> +		list_for_each_entry_safe(clk_provider, next,
> +					&clk_provider_list, node) {
> +			if (force || parent_ready(clk_provider->np)) {
> +				clk_provider->clk_init_cb(clk_provider->np);
> +				list_del(&clk_provider->node);
> +				kfree(clk_provider);
> +				is_init_done = true;
> +			}
> +		}
> +
> +		/*
> +		 * We didn't managed to initialize any of the
> +		 * remaining providers during the last loop, so now we
> +		 * initialize all the remaining ones unconditionally
> +		 * in case the clock parent was not mandatory
> +		 */
> +		if (!is_init_done)
> +			force = true;
> +
>  	}
>  }
>  #endif
> 


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v3] clk: respect the clock dependencies in of_clk_init
@ 2014-02-28 10:46   ` Gregory CLEMENT
  0 siblings, 0 replies; 13+ messages in thread
From: Gregory CLEMENT @ 2014-02-28 10:46 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Mike,

On 24/02/2014 19:10, Gregory CLEMENT wrote:
> Until now the clock providers were initialized in the order found in
> the device tree. This led to have the dependencies between the clocks
> not respected: children clocks could be initialized before their
> parent clocks.
> 
> Instead of forcing each platform to manage its own initialization order,
> this patch adds this work inside the framework itself.
> 
> Using the data of the device tree the of_clk_init function now delayed
> the initialization of a clock provider if its parent provider was not
> ready yet.
> 
> The strict dependency check (all parents of a given clk must be
> initialized) was added by Boris BREZILLON

Are you ok with this version?
Will you take it for 3.15?
Or maybe you expected that it will be part of a pull request?

However as it is modifying the core of the framework I thought that you
would take it and apply yourself.

Thanks,

Gregory

> 
> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
> Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
> ---
> Mike,
> 
> This patch depend on the patch "clk: return probe defer when DT clock
> not yet ready": http://article.gmane.org/gmane.linux.kernel/1643466
> 
> If for any reason you don't want to take it, then I will write a new
> version closer to the v2 for the parent_ready() function.
> 
> I have taken into account all the remarks from Tomasz.
> 
> Thanks,
> 
> Changelog:
> v2->v3:
> 
> - added the SoB flag of Boris
> - used of_clk_get(np, i) in the parent_ready() function.
> - simplified the loops to manage the order dependencies in of_clk_init()
> 
> v1 -> v2:
> Merged the  strict dependency check from Boris.
> 
> 
>  drivers/clk/clk.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 79 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 32d84e921b23..3a07f8ac2e11 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -2526,24 +2526,99 @@ const char *of_clk_get_parent_name(struct device_node *np, int index)
>  }
>  EXPORT_SYMBOL_GPL(of_clk_get_parent_name);
>  
> +struct clock_provider {
> +	of_clk_init_cb_t clk_init_cb;
> +	struct device_node *np;
> +	struct list_head node;
> +};
> +
> +static LIST_HEAD(clk_provider_list);
> +
> +/*
> + * This function looks for a parent clock. If there is one, then it
> + * checks that the provider for this parent clock was initialized, in
> + * this case the parent clock will be ready.
> + */
> +static int parent_ready(struct device_node *np)
> +{
> +	int i = 0;
> +
> +	while (true) {
> +		struct clk *clk = of_clk_get(np, i);
> +
> +		/* this parent is ready we can check the next one */
> +		if (!IS_ERR(clk)) {
> +			clk_put(clk);
> +			i++;
> +			continue;
> +		}
> +
> +		/* at least one parent is not ready, we exit now */
> +		if (PTR_ERR(clk) == -EPROBE_DEFER)
> +			return 0;
> +
> +		/*
> +		 * Here we make assumption that the device tree is
> +		 * written correctly. So an error means that there is
> +		 * no more parent. As we didn't exit yet, then the
> +		 * previous parent are ready. If there is no clock
> +		 * parent, no need to wait for them, then we can
> +		 * consider their absence as being ready
> +		 */
> +		return 1;
> +	}
> +}
> +
>  /**
>   * of_clk_init() - Scan and init clock providers from the DT
>   * @matches: array of compatible values and init functions for providers.
>   *
> - * This function scans the device tree for matching clock providers and
> - * calls their initialization functions
> + * This function scans the device tree for matching clock providers
> + * and calls their initialization functions. It also do it by trying
> + * to follow the dependencies.
>   */
>  void __init of_clk_init(const struct of_device_id *matches)
>  {
>  	const struct of_device_id *match;
>  	struct device_node *np;
> +	struct clock_provider *clk_provider, *next;
> +	bool is_init_done;
> +	bool force = false;
>  
>  	if (!matches)
>  		matches = &__clk_of_table;
>  
> +	/* First prepare the list of the clocks providers */
>  	for_each_matching_node_and_match(np, matches, &match) {
> -		of_clk_init_cb_t clk_init_cb = match->data;
> -		clk_init_cb(np);
> +		struct clock_provider *parent =
> +			kzalloc(sizeof(struct clock_provider),	GFP_KERNEL);
> +
> +		parent->clk_init_cb = match->data;
> +		parent->np = np;
> +		list_add(&parent->node, &clk_provider_list);
> +	}
> +
> +	while (!list_empty(&clk_provider_list)) {
> +		is_init_done = false;
> +		list_for_each_entry_safe(clk_provider, next,
> +					&clk_provider_list, node) {
> +			if (force || parent_ready(clk_provider->np)) {
> +				clk_provider->clk_init_cb(clk_provider->np);
> +				list_del(&clk_provider->node);
> +				kfree(clk_provider);
> +				is_init_done = true;
> +			}
> +		}
> +
> +		/*
> +		 * We didn't managed to initialize any of the
> +		 * remaining providers during the last loop, so now we
> +		 * initialize all the remaining ones unconditionally
> +		 * in case the clock parent was not mandatory
> +		 */
> +		if (!is_init_done)
> +			force = true;
> +
>  	}
>  }
>  #endif
> 


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v3] clk: respect the clock dependencies in of_clk_init
  2014-02-28 10:46   ` Gregory CLEMENT
  (?)
@ 2014-03-21  3:52   ` Mike Turquette
  2014-03-26 15:19       ` Kevin Hilman
  -1 siblings, 1 reply; 13+ messages in thread
From: Mike Turquette @ 2014-03-21  3:52 UTC (permalink / raw)
  To: linux-arm-kernel

Quoting Gregory CLEMENT (2014-02-28 02:46:12)
> Hi Mike,
> 
> On 24/02/2014 19:10, Gregory CLEMENT wrote:
> > Until now the clock providers were initialized in the order found in
> > the device tree. This led to have the dependencies between the clocks
> > not respected: children clocks could be initialized before their
> > parent clocks.
> > 
> > Instead of forcing each platform to manage its own initialization order,
> > this patch adds this work inside the framework itself.
> > 
> > Using the data of the device tree the of_clk_init function now delayed
> > the initialization of a clock provider if its parent provider was not
> > ready yet.
> > 
> > The strict dependency check (all parents of a given clk must be
> > initialized) was added by Boris BREZILLON
> 
> Are you ok with this version?
> Will you take it for 3.15?
> Or maybe you expected that it will be part of a pull request?
> 
> However as it is modifying the core of the framework I thought that you
> would take it and apply yourself.

Hi Gregory,

I have taken this into clk-next. If no regressions pop up over the next
few days then it should go into 3.15.

Thanks,
Mike

> 
> Thanks,
> 
> Gregory
> 
> > 
> > Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
> > Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
> > ---
> > Mike,
> > 
> > This patch depend on the patch "clk: return probe defer when DT clock
> > not yet ready": http://article.gmane.org/gmane.linux.kernel/1643466
> > 
> > If for any reason you don't want to take it, then I will write a new
> > version closer to the v2 for the parent_ready() function.
> > 
> > I have taken into account all the remarks from Tomasz.
> > 
> > Thanks,
> > 
> > Changelog:
> > v2->v3:
> > 
> > - added the SoB flag of Boris
> > - used of_clk_get(np, i) in the parent_ready() function.
> > - simplified the loops to manage the order dependencies in of_clk_init()
> > 
> > v1 -> v2:
> > Merged the  strict dependency check from Boris.
> > 
> > 
> >  drivers/clk/clk.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
> >  1 file changed, 79 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > index 32d84e921b23..3a07f8ac2e11 100644
> > --- a/drivers/clk/clk.c
> > +++ b/drivers/clk/clk.c
> > @@ -2526,24 +2526,99 @@ const char *of_clk_get_parent_name(struct device_node *np, int index)
> >  }
> >  EXPORT_SYMBOL_GPL(of_clk_get_parent_name);
> >  
> > +struct clock_provider {
> > +     of_clk_init_cb_t clk_init_cb;
> > +     struct device_node *np;
> > +     struct list_head node;
> > +};
> > +
> > +static LIST_HEAD(clk_provider_list);
> > +
> > +/*
> > + * This function looks for a parent clock. If there is one, then it
> > + * checks that the provider for this parent clock was initialized, in
> > + * this case the parent clock will be ready.
> > + */
> > +static int parent_ready(struct device_node *np)
> > +{
> > +     int i = 0;
> > +
> > +     while (true) {
> > +             struct clk *clk = of_clk_get(np, i);
> > +
> > +             /* this parent is ready we can check the next one */
> > +             if (!IS_ERR(clk)) {
> > +                     clk_put(clk);
> > +                     i++;
> > +                     continue;
> > +             }
> > +
> > +             /* at least one parent is not ready, we exit now */
> > +             if (PTR_ERR(clk) == -EPROBE_DEFER)
> > +                     return 0;
> > +
> > +             /*
> > +              * Here we make assumption that the device tree is
> > +              * written correctly. So an error means that there is
> > +              * no more parent. As we didn't exit yet, then the
> > +              * previous parent are ready. If there is no clock
> > +              * parent, no need to wait for them, then we can
> > +              * consider their absence as being ready
> > +              */
> > +             return 1;
> > +     }
> > +}
> > +
> >  /**
> >   * of_clk_init() - Scan and init clock providers from the DT
> >   * @matches: array of compatible values and init functions for providers.
> >   *
> > - * This function scans the device tree for matching clock providers and
> > - * calls their initialization functions
> > + * This function scans the device tree for matching clock providers
> > + * and calls their initialization functions. It also do it by trying
> > + * to follow the dependencies.
> >   */
> >  void __init of_clk_init(const struct of_device_id *matches)
> >  {
> >       const struct of_device_id *match;
> >       struct device_node *np;
> > +     struct clock_provider *clk_provider, *next;
> > +     bool is_init_done;
> > +     bool force = false;
> >  
> >       if (!matches)
> >               matches = &__clk_of_table;
> >  
> > +     /* First prepare the list of the clocks providers */
> >       for_each_matching_node_and_match(np, matches, &match) {
> > -             of_clk_init_cb_t clk_init_cb = match->data;
> > -             clk_init_cb(np);
> > +             struct clock_provider *parent =
> > +                     kzalloc(sizeof(struct clock_provider),  GFP_KERNEL);
> > +
> > +             parent->clk_init_cb = match->data;
> > +             parent->np = np;
> > +             list_add(&parent->node, &clk_provider_list);
> > +     }
> > +
> > +     while (!list_empty(&clk_provider_list)) {
> > +             is_init_done = false;
> > +             list_for_each_entry_safe(clk_provider, next,
> > +                                     &clk_provider_list, node) {
> > +                     if (force || parent_ready(clk_provider->np)) {
> > +                             clk_provider->clk_init_cb(clk_provider->np);
> > +                             list_del(&clk_provider->node);
> > +                             kfree(clk_provider);
> > +                             is_init_done = true;
> > +                     }
> > +             }
> > +
> > +             /*
> > +              * We didn't managed to initialize any of the
> > +              * remaining providers during the last loop, so now we
> > +              * initialize all the remaining ones unconditionally
> > +              * in case the clock parent was not mandatory
> > +              */
> > +             if (!is_init_done)
> > +                     force = true;
> > +
> >       }
> >  }
> >  #endif
> > 
> 
> 
> -- 
> Gregory Clement, Free Electrons
> Kernel, drivers, real-time and embedded Linux
> development, consulting, training and support.
> http://free-electrons.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3] clk: respect the clock dependencies in of_clk_init
  2014-03-21  3:52   ` Mike Turquette
@ 2014-03-26 15:19       ` Kevin Hilman
  0 siblings, 0 replies; 13+ messages in thread
From: Kevin Hilman @ 2014-03-26 15:19 UTC (permalink / raw)
  To: Mike Turquette
  Cc: Gregory CLEMENT, Thomas Petazzoni, Andrew Lunn, Jason Cooper,
	Tomasz Figa, LKML, Ezequiel Garcia, Boris BREZILLON,
	linux-arm-kernel, Sebastian Hesselbarth, Sascha Hauer, Shawn Guo,
	Olof Johansson, Arnd Bergmann

[+ imx6 maintainers ]

On Thu, Mar 20, 2014 at 8:52 PM, Mike Turquette <mturquette@linaro.org> wrote:
> Quoting Gregory CLEMENT (2014-02-28 02:46:12)
>> Hi Mike,
>>
>> On 24/02/2014 19:10, Gregory CLEMENT wrote:
>> > Until now the clock providers were initialized in the order found in
>> > the device tree. This led to have the dependencies between the clocks
>> > not respected: children clocks could be initialized before their
>> > parent clocks.
>> >
>> > Instead of forcing each platform to manage its own initialization order,
>> > this patch adds this work inside the framework itself.
>> >
>> > Using the data of the device tree the of_clk_init function now delayed
>> > the initialization of a clock provider if its parent provider was not
>> > ready yet.
>> >
>> > The strict dependency check (all parents of a given clk must be
>> > initialized) was added by Boris BREZILLON
>>
>> Are you ok with this version?
>> Will you take it for 3.15?
>> Or maybe you expected that it will be part of a pull request?
>>
>> However as it is modifying the core of the framework I thought that you
>> would take it and apply yourself.
>
> Hi Gregory,
>
> I have taken this into clk-next. If no regressions pop up over the next
> few days then it should go into 3.15.

$SUBJECT patch (as commit 1771b10d605) is in -next has been fingered
by bisection to be the reason behind boot failures[1] on imx6 wand
boards in the last several -next kernels.

Reverting the patch on top of next/master gets these boards booting again.

The boot failures result in no console output, so I haven't done any
further debugging.

Kevin

[1] http://lists.linaro.org/pipermail/kernel-build-reports/2014-March/002927.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v3] clk: respect the clock dependencies in of_clk_init
@ 2014-03-26 15:19       ` Kevin Hilman
  0 siblings, 0 replies; 13+ messages in thread
From: Kevin Hilman @ 2014-03-26 15:19 UTC (permalink / raw)
  To: linux-arm-kernel

[+ imx6 maintainers ]

On Thu, Mar 20, 2014 at 8:52 PM, Mike Turquette <mturquette@linaro.org> wrote:
> Quoting Gregory CLEMENT (2014-02-28 02:46:12)
>> Hi Mike,
>>
>> On 24/02/2014 19:10, Gregory CLEMENT wrote:
>> > Until now the clock providers were initialized in the order found in
>> > the device tree. This led to have the dependencies between the clocks
>> > not respected: children clocks could be initialized before their
>> > parent clocks.
>> >
>> > Instead of forcing each platform to manage its own initialization order,
>> > this patch adds this work inside the framework itself.
>> >
>> > Using the data of the device tree the of_clk_init function now delayed
>> > the initialization of a clock provider if its parent provider was not
>> > ready yet.
>> >
>> > The strict dependency check (all parents of a given clk must be
>> > initialized) was added by Boris BREZILLON
>>
>> Are you ok with this version?
>> Will you take it for 3.15?
>> Or maybe you expected that it will be part of a pull request?
>>
>> However as it is modifying the core of the framework I thought that you
>> would take it and apply yourself.
>
> Hi Gregory,
>
> I have taken this into clk-next. If no regressions pop up over the next
> few days then it should go into 3.15.

$SUBJECT patch (as commit 1771b10d605) is in -next has been fingered
by bisection to be the reason behind boot failures[1] on imx6 wand
boards in the last several -next kernels.

Reverting the patch on top of next/master gets these boards booting again.

The boot failures result in no console output, so I haven't done any
further debugging.

Kevin

[1] http://lists.linaro.org/pipermail/kernel-build-reports/2014-March/002927.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3] clk: respect the clock dependencies in of_clk_init
  2014-03-26 15:19       ` Kevin Hilman
@ 2014-03-26 16:02         ` Gregory CLEMENT
  -1 siblings, 0 replies; 13+ messages in thread
From: Gregory CLEMENT @ 2014-03-26 16:02 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: Mike Turquette, Thomas Petazzoni, Andrew Lunn, Shawn Guo,
	Jason Cooper, Arnd Bergmann, Tomasz Figa, LKML, Olof Johansson,
	Ezequiel Garcia, Boris BREZILLON, Sascha Hauer, linux-arm-kernel,
	Sebastian Hesselbarth

On 26/03/2014 16:19, Kevin Hilman wrote:
> [+ imx6 maintainers ]
> 
> On Thu, Mar 20, 2014 at 8:52 PM, Mike Turquette <mturquette@linaro.org> wrote:
>> Quoting Gregory CLEMENT (2014-02-28 02:46:12)
>>> Hi Mike,
>>>
>>> On 24/02/2014 19:10, Gregory CLEMENT wrote:
>>>> Until now the clock providers were initialized in the order found in
>>>> the device tree. This led to have the dependencies between the clocks
>>>> not respected: children clocks could be initialized before their
>>>> parent clocks.
>>>>
>>>> Instead of forcing each platform to manage its own initialization order,
>>>> this patch adds this work inside the framework itself.
>>>>
>>>> Using the data of the device tree the of_clk_init function now delayed
>>>> the initialization of a clock provider if its parent provider was not
>>>> ready yet.
>>>>
>>>> The strict dependency check (all parents of a given clk must be
>>>> initialized) was added by Boris BREZILLON
>>>
>>> Are you ok with this version?
>>> Will you take it for 3.15?
>>> Or maybe you expected that it will be part of a pull request?
>>>
>>> However as it is modifying the core of the framework I thought that you
>>> would take it and apply yourself.
>>
>> Hi Gregory,
>>
>> I have taken this into clk-next. If no regressions pop up over the next
>> few days then it should go into 3.15.
> 
> $SUBJECT patch (as commit 1771b10d605) is in -next has been fingered
> by bisection to be the reason behind boot failures[1] on imx6 wand
> boards in the last several -next kernels.
> 
> Reverting the patch on top of next/master gets these boards booting again.
> 
> The boot failures result in no console output, so I haven't done any
> further debugging.

I don't have any imx6 board, but should it be possible for you or the imx6
maintainer to add earlyprintk to see exactly what happen here?


Thanks,

Gregory


> 
> Kevin
> 
> [1] http://lists.linaro.org/pipermail/kernel-build-reports/2014-March/002927.html
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v3] clk: respect the clock dependencies in of_clk_init
@ 2014-03-26 16:02         ` Gregory CLEMENT
  0 siblings, 0 replies; 13+ messages in thread
From: Gregory CLEMENT @ 2014-03-26 16:02 UTC (permalink / raw)
  To: linux-arm-kernel

On 26/03/2014 16:19, Kevin Hilman wrote:
> [+ imx6 maintainers ]
> 
> On Thu, Mar 20, 2014 at 8:52 PM, Mike Turquette <mturquette@linaro.org> wrote:
>> Quoting Gregory CLEMENT (2014-02-28 02:46:12)
>>> Hi Mike,
>>>
>>> On 24/02/2014 19:10, Gregory CLEMENT wrote:
>>>> Until now the clock providers were initialized in the order found in
>>>> the device tree. This led to have the dependencies between the clocks
>>>> not respected: children clocks could be initialized before their
>>>> parent clocks.
>>>>
>>>> Instead of forcing each platform to manage its own initialization order,
>>>> this patch adds this work inside the framework itself.
>>>>
>>>> Using the data of the device tree the of_clk_init function now delayed
>>>> the initialization of a clock provider if its parent provider was not
>>>> ready yet.
>>>>
>>>> The strict dependency check (all parents of a given clk must be
>>>> initialized) was added by Boris BREZILLON
>>>
>>> Are you ok with this version?
>>> Will you take it for 3.15?
>>> Or maybe you expected that it will be part of a pull request?
>>>
>>> However as it is modifying the core of the framework I thought that you
>>> would take it and apply yourself.
>>
>> Hi Gregory,
>>
>> I have taken this into clk-next. If no regressions pop up over the next
>> few days then it should go into 3.15.
> 
> $SUBJECT patch (as commit 1771b10d605) is in -next has been fingered
> by bisection to be the reason behind boot failures[1] on imx6 wand
> boards in the last several -next kernels.
> 
> Reverting the patch on top of next/master gets these boards booting again.
> 
> The boot failures result in no console output, so I haven't done any
> further debugging.

I don't have any imx6 board, but should it be possible for you or the imx6
maintainer to add earlyprintk to see exactly what happen here?


Thanks,

Gregory


> 
> Kevin
> 
> [1] http://lists.linaro.org/pipermail/kernel-build-reports/2014-March/002927.html
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3] clk: respect the clock dependencies in of_clk_init
  2014-03-26 16:02         ` Gregory CLEMENT
@ 2014-03-26 16:22           ` Fabio Estevam
  -1 siblings, 0 replies; 13+ messages in thread
From: Fabio Estevam @ 2014-03-26 16:22 UTC (permalink / raw)
  To: Gregory CLEMENT
  Cc: Kevin Hilman, Thomas Petazzoni, Andrew Lunn, Boris BREZILLON,
	Mike Turquette, Jason Cooper, Arnd Bergmann, Tomasz Figa, LKML,
	Ezequiel Garcia, Olof Johansson, Shawn Guo, Sascha Hauer,
	linux-arm-kernel, Sebastian Hesselbarth

Hi Gregory,

On Wed, Mar 26, 2014 at 1:02 PM, Gregory CLEMENT
<gregory.clement@free-electrons.com> wrote:
> I don't have any imx6 board, but should it be possible for you or the imx6
> maintainer to add earlyprintk to see exactly what happen here?

Below is the log with earlyprintk enabled.

Regards,

Fabio Estevam

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 3.14.0-rc8-next-20140326 (fabio@fabio-Latitude-E6410)
(gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1) ) #942 SMP Wed M
ar 26 13:20:56 BRT 2014
CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: Wandboard i.MX6 Quad Board
bootconsole [earlycon0] enabled
Memory policy: Data cache writealloc
PERCPU: Embedded 8 pages/cpu @ee7a4000 s8960 r8192 d15616 u32768
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 520720
Kernel command line: console=ttymxc0,115200 root=/dev/nfs ip=dhcp
nfsroot=192.168.0.2:/tftpboot/rfs,v3,tcp earlyprintk
PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 262144 (order: 8, 1048576 bytes)
Inode-cache hash table entries: 131072 (order: 7, 524288 bytes)
Memory: 2063904K/2097152K available (6455K kernel code, 402K rwdata,
2200K rodata, 320K init, 5513K bss, 33248K reserved, 270336K high
mem)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0xf0000000 - 0xff000000   ( 240 MB)
    lowmem  : 0x80000000 - 0xef800000   (1784 MB)
    pkmap   : 0x7fe00000 - 0x80000000   (   2 MB)
    modules : 0x7f000000 - 0x7fe00000   (  14 MB)
      .text : 0x80008000 - 0x8087bfdc   (8656 kB)
      .init : 0x8087c000 - 0x808cc300   ( 321 kB)
      .data : 0x808ce000 - 0x80932980   ( 403 kB)
       .bss : 0x80932988 - 0x80e950f8   (5514 kB)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
Hierarchical RCU implementation.
NR_IRQS:16 nr_irqs:16 16
L310 cache controller enabled
l2x0: 16 ways, CACHE_ID 0x410000c7, AUX_CTRL 0x32070000, Cache size: 1024 kB
Switching to timer-based delay loop
Division by zero in kernel.
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc8-next-20140326 #942
Backtrace:
[<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
 r6:00000000 r5:00000000 r4:00000000 r3:00000000
[<80011e58>] (show_stack) from [<8064cc60>] (dump_stack+0x88/0xa4)
[<8064cbd8>] (dump_stack) from [<80011a94>] (__div0+0x18/0x20)
 r5:00000000 r4:00000000
[<80011a7c>] (__div0) from [<8029582c>] (Ldiv0_64+0x8/0x18)
[<8007e854>] (clocks_calc_mult_shift) from [<8089a8d0>]
(sched_clock_register+0x60/0x238)
 r10:f0018074 r9:00000000 r8:80020ba0 r7:00000020 r6:00000000 r5:80932eac
 r4:00000000
[<8089a870>] (sched_clock_register) from [<80884588>]
(mxc_timer_init+0xf8/0x190)
 r10:f0018074 r9:00000000 r8:00000057 r7:f0020024 r6:ee022b80 r5:80932eac
 r4:00000000
[<80884490>] (mxc_timer_init) from [<808910b0>]
(imx6q_clocks_init+0x2c00/0x2d24)
 r8:00000004 r7:809334d0 r6:808c7310 r5:ee7ccbe8 r4:f0020000
[<8088e4b0>] (imx6q_clocks_init) from [<808b024c>] (of_clk_init+0xd8/0x198)
 r10:80923594 r9:809234d4 r8:00000000 r7:ee002ac0 r6:ee002b00 r5:ee7ce5b0
 r4:00000001
[<808b0174>] (of_clk_init) from [<80880364>] (time_init+0x2c/0x38)
 r10:ef7fc9c0 r9:412fc09a r8:808d6880 r7:808bd790 r6:ffffffff r5:809329c0
 r4:00000001
[<80880338>] (time_init) from [<8087ca2c>] (start_kernel+0x1f8/0x388)
[<8087c834>] (start_kernel) from [<10008074>] (0x10008074)
 r10:00000000 r8:1000406a r7:808db644 r6:808bd78c r5:808d692c r4:10c5387d
sched_clock: 32 bits at 0 Hz, resolution 0ns, wraps every 0ns
Division by zero in kernel.
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc8-next-20140326 #942
Backtrace:
[<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
 r6:ee011a00 r5:00000000 r4:00000000 r3:00000000
[<80011e58>] (show_stack) from [<8064cc60>] (dump_stack+0x88/0xa4)
[<8064cbd8>] (dump_stack) from [<80011a94>] (__div0+0x18/0x20)
 r5:00000000 r4:00000000
[<80011a7c>] (__div0) from [<8029582c>] (Ldiv0_64+0x8/0x18)
[<8007ea84>] (__clocksource_updatefreq_scale) from [<8007ec3c>]
(__clocksource_register_scale+0x14/0x54)
 r10:000000c8 r9:00000000 r8:f0020024 r7:807b3e58 r6:ee0119c0 r5:00000000
 r4:ee011a00
[<8007ec28>] (__clocksource_register_scale) from [<808ae6f8>]
(clocksource_mmio_init+0x8c/0xa8)
 r4:ffffffff r3:00000001
[<808ae66c>] (clocksource_mmio_init) from [<808845ac>]
(mxc_timer_init+0x11c/0x190)
 r10:f0018074 r8:00000057 r7:f0020024 r6:ee022b80 r5:80932eac r4:808dc900
[<80884490>] (mxc_timer_init) from [<808910b0>]
(imx6q_clocks_init+0x2c00/0x2d24)
 r8:00000004 r7:809334d0 r6:808c7310 r5:ee7ccbe8 r4:f0020000
[<8088e4b0>] (imx6q_clocks_init) from [<808b024c>] (of_clk_init+0xd8/0x198)
 r10:80923594 r9:809234d4 r8:00000000 r7:ee002ac0 r6:ee002b00 r5:ee7ce5b0
 r4:00000001
[<808b0174>] (of_clk_init) from [<80880364>] (time_init+0x2c/0x38)
 r10:ef7fc9c0 r9:412fc09a r8:808d6880 r7:808bd790 r6:ffffffff r5:809329c0
 r4:00000001
[<80880338>] (time_init) from [<8087ca2c>] (start_kernel+0x1f8/0x388)
[<8087c834>] (start_kernel) from [<10008074>] (0x10008074)
 r10:00000000 r8:1000406a r7:808db644 r6:808bd78c r5:808d692c r4:10c5387d
Division by zero in kernel.
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc8-next-20140326 #942
Backtrace:
[<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
 r6:ee011a00 r5:00000000 r4:00000000 r3:00000000
[<80011e58>] (show_stack) from [<8064cc60>] (dump_stack+0x88/0xa4)
[<8064cbd8>] (dump_stack) from [<80011a94>] (__div0+0x18/0x20)
 r5:00000000 r4:00000000
[<80011a7c>] (__div0) from [<8029582c>] (Ldiv0_64+0x8/0x18)
[<8007e854>] (clocks_calc_mult_shift) from [<8007eb28>]
(__clocksource_updatefreq_scale+0xa4/0x1a4)
 r10:00000001 r9:a3d70a3d r8:70a3d70a r7:0000000b r6:ee011a00 r5:00000001
 r4:00000001
[<8007ea84>] (__clocksource_updatefreq_scale) from [<8007ec3c>]
(__clocksource_register_scale+0x14/0x54)
 r10:000000c8 r9:00000000 r8:f0020024 r7:807b3e58 r6:ee0119c0 r5:00000000
 r4:ee011a00
[<8007ec28>] (__clocksource_register_scale) from [<808ae6f8>]
(clocksource_mmio_init+0x8c/0xa8)
 r4:ffffffff r3:00000001
[<808ae66c>] (clocksource_mmio_init) from [<808845ac>]
(mxc_timer_init+0x11c/0x190)
 r10:f0018074 r8:00000057 r7:f0020024 r6:ee022b80 r5:80932eac r4:808dc900
[<80884490>] (mxc_timer_init) from [<808910b0>]
(imx6q_clocks_init+0x2c00/0x2d24)
 r8:00000004 r7:809334d0 r6:808c7310 r5:ee7ccbe8 r4:f0020000
[<8088e4b0>] (imx6q_clocks_init) from [<808b024c>] (of_clk_init+0xd8/0x198)
 r10:80923594 r9:809234d4 r8:00000000 r7:ee002ac0 r6:ee002b00 r5:ee7ce5b0
 r4:00000001
[<808b0174>] (of_clk_init) from [<80880364>] (time_init+0x2c/0x38)
 r10:ef7fc9c0 r9:412fc09a r8:808d6880 r7:808bd790 r6:ffffffff r5:809329c0
 r4:00000001
[<80880338>] (time_init) from [<8087ca2c>] (start_kernel+0x1f8/0x388)
[<8087c834>] (start_kernel) from [<10008074>] (0x10008074)
 r10:00000000 r8:1000406a r7:808db644 r6:808bd78c r5:808d692c r4:10c5387d
Division by zero in kernel.
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc8-next-20140326 #942
Backtrace:
[<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
 r6:ee022b80 r5:00000000 r4:00000000 r3:00000000
[<80011e58>] (show_stack) from [<8064cc60>] (dump_stack+0x88/0xa4)
[<8064cbd8>] (dump_stack) from [<80011a94>] (__div0+0x18/0x20)
 r5:808dc900 r4:00000000
[<80011a7c>] (__div0) from [<8029582c>] (Ldiv0_64+0x8/0x18)
[<80082314>] (clockevents_config) from [<800823b4>]
(clockevents_config_and_register+0x1c/0x28)
 r5:80932eac r4:808dc900
[<80082398>] (clockevents_config_and_register) from [<808845d8>]
(mxc_timer_init+0x148/0x190)
 r4:808dc900 r3:fffffffe
[<80884490>] (mxc_timer_init) from [<808910b0>]
(imx6q_clocks_init+0x2c00/0x2d24)
 r8:00000004 r7:809334d0 r6:808c7310 r5:ee7ccbe8 r4:f0020000
[<8088e4b0>] (imx6q_clocks_init) from [<808b024c>] (of_clk_init+0xd8/0x198)
 r10:80923594 r9:809234d4 r8:00000000 r7:ee002ac0 r6:ee002b00 r5:ee7ce5b0
 r4:00000001
[<808b0174>] (of_clk_init) from [<80880364>] (time_init+0x2c/0x38)
 r10:ef7fc9c0 r9:412fc09a r8:808d6880 r7:808bd790 r6:ffffffff r5:809329c0
 r4:00000001
[<80880338>] (time_init) from [<8087ca2c>] (start_kernel+0x1f8/0x388)
[<8087c834>] (start_kernel) from [<10008074>] (0x10008074)
 r10:00000000 r8:1000406a r7:808db644 r6:808bd78c r5:808d692c r4:10c5387d
------------[ cut here ]------------
WARNING: CPU: 0 PID: 0 at kernel/time/clockevents.c:44 cev_delta2ns+0xe8/0x104()
Modules linked in:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc8-next-20140326 #942
Backtrace:
[<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
 r6:80081cb8 r5:00000000 r4:00000000 r3:00000000
[<80011e58>] (show_stack) from [<8064cc60>] (dump_stack+0x88/0xa4)
[<8064cbd8>] (dump_stack) from [<80028f78>] (warn_slowpath_common+0x70/0x94)
 r5:00000009 r4:00000000
[<80028f08>] (warn_slowpath_common) from [<80028fc0>]
(warn_slowpath_null+0x24/0x2c)
 r8:000000ff r7:000000ff r6:00000000 r5:808dc900 r4:00000000
[<80028f9c>] (warn_slowpath_null) from [<80081cb8>] (cev_delta2ns+0xe8/0x104)
[<80081bd0>] (cev_delta2ns) from [<80082374>] (clockevents_config+0x60/0x84)
 r9:00000000 r8:00000057 r7:f0020024 r6:ee022b80 r5:808dc900 r4:00000000
[<80082314>] (clockevents_config) from [<800823b4>]
(clockevents_config_and_register+0x1c/0x28)
 r5:80932eac r4:808dc900
[<80082398>] (clockevents_config_and_register) from [<808845d8>]
(mxc_timer_init+0x148/0x190)
 r4:808dc900 r3:fffffffe
[<80884490>] (mxc_timer_init) from [<808910b0>]
(imx6q_clocks_init+0x2c00/0x2d24)
 r8:00000004 r7:809334d0 r6:808c7310 r5:ee7ccbe8 r4:f0020000
[<8088e4b0>] (imx6q_clocks_init) from [<808b024c>] (of_clk_init+0xd8/0x198)
 r10:80923594 r9:809234d4 r8:00000000 r7:ee002ac0 r6:ee002b00 r5:ee7ce5b0
 r4:00000001
[<808b0174>] (of_clk_init) from [<80880364>] (time_init+0x2c/0x38)
 r10:ef7fc9c0 r9:412fc09a r8:808d6880 r7:808bd790 r6:ffffffff r5:809329c0
 r4:00000001
[<80880338>] (time_init) from [<8087ca2c>] (start_kernel+0x1f8/0x388)
[<8087c834>] (start_kernel) from [<10008074>] (0x10008074)
 r10:00000000 r8:1000406a r7:808db644 r6:808bd78c r5:808d692c r4:10c5387d
---[ end trace 3406ff24bd97382e ]---

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v3] clk: respect the clock dependencies in of_clk_init
@ 2014-03-26 16:22           ` Fabio Estevam
  0 siblings, 0 replies; 13+ messages in thread
From: Fabio Estevam @ 2014-03-26 16:22 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Gregory,

On Wed, Mar 26, 2014 at 1:02 PM, Gregory CLEMENT
<gregory.clement@free-electrons.com> wrote:
> I don't have any imx6 board, but should it be possible for you or the imx6
> maintainer to add earlyprintk to see exactly what happen here?

Below is the log with earlyprintk enabled.

Regards,

Fabio Estevam

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 3.14.0-rc8-next-20140326 (fabio at fabio-Latitude-E6410)
(gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1) ) #942 SMP Wed M
ar 26 13:20:56 BRT 2014
CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: Wandboard i.MX6 Quad Board
bootconsole [earlycon0] enabled
Memory policy: Data cache writealloc
PERCPU: Embedded 8 pages/cpu @ee7a4000 s8960 r8192 d15616 u32768
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 520720
Kernel command line: console=ttymxc0,115200 root=/dev/nfs ip=dhcp
nfsroot=192.168.0.2:/tftpboot/rfs,v3,tcp earlyprintk
PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 262144 (order: 8, 1048576 bytes)
Inode-cache hash table entries: 131072 (order: 7, 524288 bytes)
Memory: 2063904K/2097152K available (6455K kernel code, 402K rwdata,
2200K rodata, 320K init, 5513K bss, 33248K reserved, 270336K high
mem)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0xf0000000 - 0xff000000   ( 240 MB)
    lowmem  : 0x80000000 - 0xef800000   (1784 MB)
    pkmap   : 0x7fe00000 - 0x80000000   (   2 MB)
    modules : 0x7f000000 - 0x7fe00000   (  14 MB)
      .text : 0x80008000 - 0x8087bfdc   (8656 kB)
      .init : 0x8087c000 - 0x808cc300   ( 321 kB)
      .data : 0x808ce000 - 0x80932980   ( 403 kB)
       .bss : 0x80932988 - 0x80e950f8   (5514 kB)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
Hierarchical RCU implementation.
NR_IRQS:16 nr_irqs:16 16
L310 cache controller enabled
l2x0: 16 ways, CACHE_ID 0x410000c7, AUX_CTRL 0x32070000, Cache size: 1024 kB
Switching to timer-based delay loop
Division by zero in kernel.
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc8-next-20140326 #942
Backtrace:
[<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
 r6:00000000 r5:00000000 r4:00000000 r3:00000000
[<80011e58>] (show_stack) from [<8064cc60>] (dump_stack+0x88/0xa4)
[<8064cbd8>] (dump_stack) from [<80011a94>] (__div0+0x18/0x20)
 r5:00000000 r4:00000000
[<80011a7c>] (__div0) from [<8029582c>] (Ldiv0_64+0x8/0x18)
[<8007e854>] (clocks_calc_mult_shift) from [<8089a8d0>]
(sched_clock_register+0x60/0x238)
 r10:f0018074 r9:00000000 r8:80020ba0 r7:00000020 r6:00000000 r5:80932eac
 r4:00000000
[<8089a870>] (sched_clock_register) from [<80884588>]
(mxc_timer_init+0xf8/0x190)
 r10:f0018074 r9:00000000 r8:00000057 r7:f0020024 r6:ee022b80 r5:80932eac
 r4:00000000
[<80884490>] (mxc_timer_init) from [<808910b0>]
(imx6q_clocks_init+0x2c00/0x2d24)
 r8:00000004 r7:809334d0 r6:808c7310 r5:ee7ccbe8 r4:f0020000
[<8088e4b0>] (imx6q_clocks_init) from [<808b024c>] (of_clk_init+0xd8/0x198)
 r10:80923594 r9:809234d4 r8:00000000 r7:ee002ac0 r6:ee002b00 r5:ee7ce5b0
 r4:00000001
[<808b0174>] (of_clk_init) from [<80880364>] (time_init+0x2c/0x38)
 r10:ef7fc9c0 r9:412fc09a r8:808d6880 r7:808bd790 r6:ffffffff r5:809329c0
 r4:00000001
[<80880338>] (time_init) from [<8087ca2c>] (start_kernel+0x1f8/0x388)
[<8087c834>] (start_kernel) from [<10008074>] (0x10008074)
 r10:00000000 r8:1000406a r7:808db644 r6:808bd78c r5:808d692c r4:10c5387d
sched_clock: 32 bits at 0 Hz, resolution 0ns, wraps every 0ns
Division by zero in kernel.
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc8-next-20140326 #942
Backtrace:
[<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
 r6:ee011a00 r5:00000000 r4:00000000 r3:00000000
[<80011e58>] (show_stack) from [<8064cc60>] (dump_stack+0x88/0xa4)
[<8064cbd8>] (dump_stack) from [<80011a94>] (__div0+0x18/0x20)
 r5:00000000 r4:00000000
[<80011a7c>] (__div0) from [<8029582c>] (Ldiv0_64+0x8/0x18)
[<8007ea84>] (__clocksource_updatefreq_scale) from [<8007ec3c>]
(__clocksource_register_scale+0x14/0x54)
 r10:000000c8 r9:00000000 r8:f0020024 r7:807b3e58 r6:ee0119c0 r5:00000000
 r4:ee011a00
[<8007ec28>] (__clocksource_register_scale) from [<808ae6f8>]
(clocksource_mmio_init+0x8c/0xa8)
 r4:ffffffff r3:00000001
[<808ae66c>] (clocksource_mmio_init) from [<808845ac>]
(mxc_timer_init+0x11c/0x190)
 r10:f0018074 r8:00000057 r7:f0020024 r6:ee022b80 r5:80932eac r4:808dc900
[<80884490>] (mxc_timer_init) from [<808910b0>]
(imx6q_clocks_init+0x2c00/0x2d24)
 r8:00000004 r7:809334d0 r6:808c7310 r5:ee7ccbe8 r4:f0020000
[<8088e4b0>] (imx6q_clocks_init) from [<808b024c>] (of_clk_init+0xd8/0x198)
 r10:80923594 r9:809234d4 r8:00000000 r7:ee002ac0 r6:ee002b00 r5:ee7ce5b0
 r4:00000001
[<808b0174>] (of_clk_init) from [<80880364>] (time_init+0x2c/0x38)
 r10:ef7fc9c0 r9:412fc09a r8:808d6880 r7:808bd790 r6:ffffffff r5:809329c0
 r4:00000001
[<80880338>] (time_init) from [<8087ca2c>] (start_kernel+0x1f8/0x388)
[<8087c834>] (start_kernel) from [<10008074>] (0x10008074)
 r10:00000000 r8:1000406a r7:808db644 r6:808bd78c r5:808d692c r4:10c5387d
Division by zero in kernel.
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc8-next-20140326 #942
Backtrace:
[<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
 r6:ee011a00 r5:00000000 r4:00000000 r3:00000000
[<80011e58>] (show_stack) from [<8064cc60>] (dump_stack+0x88/0xa4)
[<8064cbd8>] (dump_stack) from [<80011a94>] (__div0+0x18/0x20)
 r5:00000000 r4:00000000
[<80011a7c>] (__div0) from [<8029582c>] (Ldiv0_64+0x8/0x18)
[<8007e854>] (clocks_calc_mult_shift) from [<8007eb28>]
(__clocksource_updatefreq_scale+0xa4/0x1a4)
 r10:00000001 r9:a3d70a3d r8:70a3d70a r7:0000000b r6:ee011a00 r5:00000001
 r4:00000001
[<8007ea84>] (__clocksource_updatefreq_scale) from [<8007ec3c>]
(__clocksource_register_scale+0x14/0x54)
 r10:000000c8 r9:00000000 r8:f0020024 r7:807b3e58 r6:ee0119c0 r5:00000000
 r4:ee011a00
[<8007ec28>] (__clocksource_register_scale) from [<808ae6f8>]
(clocksource_mmio_init+0x8c/0xa8)
 r4:ffffffff r3:00000001
[<808ae66c>] (clocksource_mmio_init) from [<808845ac>]
(mxc_timer_init+0x11c/0x190)
 r10:f0018074 r8:00000057 r7:f0020024 r6:ee022b80 r5:80932eac r4:808dc900
[<80884490>] (mxc_timer_init) from [<808910b0>]
(imx6q_clocks_init+0x2c00/0x2d24)
 r8:00000004 r7:809334d0 r6:808c7310 r5:ee7ccbe8 r4:f0020000
[<8088e4b0>] (imx6q_clocks_init) from [<808b024c>] (of_clk_init+0xd8/0x198)
 r10:80923594 r9:809234d4 r8:00000000 r7:ee002ac0 r6:ee002b00 r5:ee7ce5b0
 r4:00000001
[<808b0174>] (of_clk_init) from [<80880364>] (time_init+0x2c/0x38)
 r10:ef7fc9c0 r9:412fc09a r8:808d6880 r7:808bd790 r6:ffffffff r5:809329c0
 r4:00000001
[<80880338>] (time_init) from [<8087ca2c>] (start_kernel+0x1f8/0x388)
[<8087c834>] (start_kernel) from [<10008074>] (0x10008074)
 r10:00000000 r8:1000406a r7:808db644 r6:808bd78c r5:808d692c r4:10c5387d
Division by zero in kernel.
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc8-next-20140326 #942
Backtrace:
[<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
 r6:ee022b80 r5:00000000 r4:00000000 r3:00000000
[<80011e58>] (show_stack) from [<8064cc60>] (dump_stack+0x88/0xa4)
[<8064cbd8>] (dump_stack) from [<80011a94>] (__div0+0x18/0x20)
 r5:808dc900 r4:00000000
[<80011a7c>] (__div0) from [<8029582c>] (Ldiv0_64+0x8/0x18)
[<80082314>] (clockevents_config) from [<800823b4>]
(clockevents_config_and_register+0x1c/0x28)
 r5:80932eac r4:808dc900
[<80082398>] (clockevents_config_and_register) from [<808845d8>]
(mxc_timer_init+0x148/0x190)
 r4:808dc900 r3:fffffffe
[<80884490>] (mxc_timer_init) from [<808910b0>]
(imx6q_clocks_init+0x2c00/0x2d24)
 r8:00000004 r7:809334d0 r6:808c7310 r5:ee7ccbe8 r4:f0020000
[<8088e4b0>] (imx6q_clocks_init) from [<808b024c>] (of_clk_init+0xd8/0x198)
 r10:80923594 r9:809234d4 r8:00000000 r7:ee002ac0 r6:ee002b00 r5:ee7ce5b0
 r4:00000001
[<808b0174>] (of_clk_init) from [<80880364>] (time_init+0x2c/0x38)
 r10:ef7fc9c0 r9:412fc09a r8:808d6880 r7:808bd790 r6:ffffffff r5:809329c0
 r4:00000001
[<80880338>] (time_init) from [<8087ca2c>] (start_kernel+0x1f8/0x388)
[<8087c834>] (start_kernel) from [<10008074>] (0x10008074)
 r10:00000000 r8:1000406a r7:808db644 r6:808bd78c r5:808d692c r4:10c5387d
------------[ cut here ]------------
WARNING: CPU: 0 PID: 0 at kernel/time/clockevents.c:44 cev_delta2ns+0xe8/0x104()
Modules linked in:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc8-next-20140326 #942
Backtrace:
[<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
 r6:80081cb8 r5:00000000 r4:00000000 r3:00000000
[<80011e58>] (show_stack) from [<8064cc60>] (dump_stack+0x88/0xa4)
[<8064cbd8>] (dump_stack) from [<80028f78>] (warn_slowpath_common+0x70/0x94)
 r5:00000009 r4:00000000
[<80028f08>] (warn_slowpath_common) from [<80028fc0>]
(warn_slowpath_null+0x24/0x2c)
 r8:000000ff r7:000000ff r6:00000000 r5:808dc900 r4:00000000
[<80028f9c>] (warn_slowpath_null) from [<80081cb8>] (cev_delta2ns+0xe8/0x104)
[<80081bd0>] (cev_delta2ns) from [<80082374>] (clockevents_config+0x60/0x84)
 r9:00000000 r8:00000057 r7:f0020024 r6:ee022b80 r5:808dc900 r4:00000000
[<80082314>] (clockevents_config) from [<800823b4>]
(clockevents_config_and_register+0x1c/0x28)
 r5:80932eac r4:808dc900
[<80082398>] (clockevents_config_and_register) from [<808845d8>]
(mxc_timer_init+0x148/0x190)
 r4:808dc900 r3:fffffffe
[<80884490>] (mxc_timer_init) from [<808910b0>]
(imx6q_clocks_init+0x2c00/0x2d24)
 r8:00000004 r7:809334d0 r6:808c7310 r5:ee7ccbe8 r4:f0020000
[<8088e4b0>] (imx6q_clocks_init) from [<808b024c>] (of_clk_init+0xd8/0x198)
 r10:80923594 r9:809234d4 r8:00000000 r7:ee002ac0 r6:ee002b00 r5:ee7ce5b0
 r4:00000001
[<808b0174>] (of_clk_init) from [<80880364>] (time_init+0x2c/0x38)
 r10:ef7fc9c0 r9:412fc09a r8:808d6880 r7:808bd790 r6:ffffffff r5:809329c0
 r4:00000001
[<80880338>] (time_init) from [<8087ca2c>] (start_kernel+0x1f8/0x388)
[<8087c834>] (start_kernel) from [<10008074>] (0x10008074)
 r10:00000000 r8:1000406a r7:808db644 r6:808bd78c r5:808d692c r4:10c5387d
---[ end trace 3406ff24bd97382e ]---

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3] clk: respect the clock dependencies in of_clk_init
  2014-03-26 16:22           ` Fabio Estevam
@ 2014-03-26 19:50             ` Gregory CLEMENT
  -1 siblings, 0 replies; 13+ messages in thread
From: Gregory CLEMENT @ 2014-03-26 19:50 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Thomas Petazzoni, Andrew Lunn, Kevin Hilman, Mike Turquette,
	Jason Cooper, Arnd Bergmann, LKML, Tomasz Figa, Boris BREZILLON,
	Ezequiel Garcia, Olof Johansson, Shawn Guo, Sascha Hauer,
	linux-arm-kernel, Sebastian Hesselbarth

Hi Fabio,

On 26/03/2014 17:22, Fabio Estevam wrote:
> Hi Gregory,
> 
> On Wed, Mar 26, 2014 at 1:02 PM, Gregory CLEMENT
> <gregory.clement@free-electrons.com> wrote:
>> I don't have any imx6 board, but should it be possible for you or the imx6
>> maintainer to add earlyprintk to see exactly what happen here?
> 
> Below is the log with earlyprintk enabled.
> 
> Regards,
> 
> Fabio Estevam
> 
> Starting kernel ...
> 
> Uncompressing Linux... done, booting the kernel.
> Booting Linux on physical CPU 0x0
> Linux version 3.14.0-rc8-next-20140326 (fabio@fabio-Latitude-E6410)
> (gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1) ) #942 SMP Wed M
> ar 26 13:20:56 BRT 2014
> CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c5387d
> CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
> Machine model: Wandboard i.MX6 Quad Board
> bootconsole [earlycon0] enabled
> Memory policy: Data cache writealloc
> PERCPU: Embedded 8 pages/cpu @ee7a4000 s8960 r8192 d15616 u32768
> Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 520720
> Kernel command line: console=ttymxc0,115200 root=/dev/nfs ip=dhcp
> nfsroot=192.168.0.2:/tftpboot/rfs,v3,tcp earlyprintk
> PID hash table entries: 4096 (order: 2, 16384 bytes)
> Dentry cache hash table entries: 262144 (order: 8, 1048576 bytes)
> Inode-cache hash table entries: 131072 (order: 7, 524288 bytes)
> Memory: 2063904K/2097152K available (6455K kernel code, 402K rwdata,
> 2200K rodata, 320K init, 5513K bss, 33248K reserved, 270336K high
> mem)
> Virtual kernel memory layout:
>     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
>     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
>     vmalloc : 0xf0000000 - 0xff000000   ( 240 MB)
>     lowmem  : 0x80000000 - 0xef800000   (1784 MB)
>     pkmap   : 0x7fe00000 - 0x80000000   (   2 MB)
>     modules : 0x7f000000 - 0x7fe00000   (  14 MB)
>       .text : 0x80008000 - 0x8087bfdc   (8656 kB)
>       .init : 0x8087c000 - 0x808cc300   ( 321 kB)
>       .data : 0x808ce000 - 0x80932980   ( 403 kB)
>        .bss : 0x80932988 - 0x80e950f8   (5514 kB)
> SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
> Hierarchical RCU implementation.
> NR_IRQS:16 nr_irqs:16 16
> L310 cache controller enabled
> l2x0: 16 ways, CACHE_ID 0x410000c7, AUX_CTRL 0x32070000, Cache size: 1024 kB
> Switching to timer-based delay loop
> Division by zero in kernel.
> CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc8-next-20140326 #942
> Backtrace:
> [<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
>  r6:00000000 r5:00000000 r4:00000000 r3:00000000
> [<80011e58>] (show_stack) from [<8064cc60>] (dump_stack+0x88/0xa4)
> [<8064cbd8>] (dump_stack) from [<80011a94>] (__div0+0x18/0x20)
>  r5:00000000 r4:00000000
> [<80011a7c>] (__div0) from [<8029582c>] (Ldiv0_64+0x8/0x18)
> [<8007e854>] (clocks_calc_mult_shift) from [<8089a8d0>]
> (sched_clock_register+0x60/0x238)
>  r10:f0018074 r9:00000000 r8:80020ba0 r7:00000020 r6:00000000 r5:80932eac
>  r4:00000000
> [<8089a870>] (sched_clock_register) from [<80884588>]
> (mxc_timer_init+0xf8/0x190)
>  r10:f0018074 r9:00000000 r8:00000057 r7:f0020024 r6:ee022b80 r5:80932eac
>  r4:00000000
> [<80884490>] (mxc_timer_init) from [<808910b0>]
> (imx6q_clocks_init+0x2c00/0x2d24)
>  r8:00000004 r7:809334d0 r6:808c7310 r5:ee7ccbe8 r4:f0020000
> [<8088e4b0>] (imx6q_clocks_init) from [<808b024c>] (of_clk_init+0xd8/0x198)
>  r10:80923594 r9:809234d4 r8:00000000 r7:ee002ac0 r6:ee002b00 r5:ee7ce5b0
>  r4:00000001
> [<808b0174>] (of_clk_init) from [<80880364>] (time_init+0x2c/0x38)
>  r10:ef7fc9c0 r9:412fc09a r8:808d6880 r7:808bd790 r6:ffffffff r5:809329c0
>  r4:00000001
> [<80880338>] (time_init) from [<8087ca2c>] (start_kernel+0x1f8/0x388)
> [<8087c834>] (start_kernel) from [<10008074>] (0x10008074)
>  r10:00000000 r8:1000406a r7:808db644 r6:808bd78c r5:808d692c r4:10c5387d
> sched_clock: 32 bits at 0 Hz, resolution 0ns, wraps every 0ns
> Division by zero in kernel.
> CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc8-next-20140326 #942
> Backtrace:
> [<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
>  r6:ee011a00 r5:00000000 r4:00000000 r3:00000000
> [<80011e58>] (show_stack) from [<8064cc60>] (dump_stack+0x88/0xa4)
> [<8064cbd8>] (dump_stack) from [<80011a94>] (__div0+0x18/0x20)
>  r5:00000000 r4:00000000
> [<80011a7c>] (__div0) from [<8029582c>] (Ldiv0_64+0x8/0x18)
> [<8007ea84>] (__clocksource_updatefreq_scale) from [<8007ec3c>]
> (__clocksource_register_scale+0x14/0x54)
>  r10:000000c8 r9:00000000 r8:f0020024 r7:807b3e58 r6:ee0119c0 r5:00000000
>  r4:ee011a00
> [<8007ec28>] (__clocksource_register_scale) from [<808ae6f8>]
> (clocksource_mmio_init+0x8c/0xa8)
>  r4:ffffffff r3:00000001
> [<808ae66c>] (clocksource_mmio_init) from [<808845ac>]
> (mxc_timer_init+0x11c/0x190)
>  r10:f0018074 r8:00000057 r7:f0020024 r6:ee022b80 r5:80932eac r4:808dc900
> [<80884490>] (mxc_timer_init) from [<808910b0>]
> (imx6q_clocks_init+0x2c00/0x2d24)
>  r8:00000004 r7:809334d0 r6:808c7310 r5:ee7ccbe8 r4:f0020000
> [<8088e4b0>] (imx6q_clocks_init) from [<808b024c>] (of_clk_init+0xd8/0x198)
>  r10:80923594 r9:809234d4 r8:00000000 r7:ee002ac0 r6:ee002b00 r5:ee7ce5b0
>  r4:00000001
> [<808b0174>] (of_clk_init) from [<80880364>] (time_init+0x2c/0x38)
>  r10:ef7fc9c0 r9:412fc09a r8:808d6880 r7:808bd790 r6:ffffffff r5:809329c0
>  r4:00000001
> [<80880338>] (time_init) from [<8087ca2c>] (start_kernel+0x1f8/0x388)
> [<8087c834>] (start_kernel) from [<10008074>] (0x10008074)
>  r10:00000000 r8:1000406a r7:808db644 r6:808bd78c r5:808d692c r4:10c5387d
> Division by zero in kernel.
> CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc8-next-20140326 #942
> Backtrace:
> [<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
>  r6:ee011a00 r5:00000000 r4:00000000 r3:00000000
> [<80011e58>] (show_stack) from [<8064cc60>] (dump_stack+0x88/0xa4)
> [<8064cbd8>] (dump_stack) from [<80011a94>] (__div0+0x18/0x20)
>  r5:00000000 r4:00000000
> [<80011a7c>] (__div0) from [<8029582c>] (Ldiv0_64+0x8/0x18)
> [<8007e854>] (clocks_calc_mult_shift) from [<8007eb28>]
> (__clocksource_updatefreq_scale+0xa4/0x1a4)
>  r10:00000001 r9:a3d70a3d r8:70a3d70a r7:0000000b r6:ee011a00 r5:00000001
>  r4:00000001
> [<8007ea84>] (__clocksource_updatefreq_scale) from [<8007ec3c>]
> (__clocksource_register_scale+0x14/0x54)
>  r10:000000c8 r9:00000000 r8:f0020024 r7:807b3e58 r6:ee0119c0 r5:00000000
>  r4:ee011a00
> [<8007ec28>] (__clocksource_register_scale) from [<808ae6f8>]
> (clocksource_mmio_init+0x8c/0xa8)
>  r4:ffffffff r3:00000001
> [<808ae66c>] (clocksource_mmio_init) from [<808845ac>]
> (mxc_timer_init+0x11c/0x190)
>  r10:f0018074 r8:00000057 r7:f0020024 r6:ee022b80 r5:80932eac r4:808dc900
> [<80884490>] (mxc_timer_init) from [<808910b0>]
> (imx6q_clocks_init+0x2c00/0x2d24)
>  r8:00000004 r7:809334d0 r6:808c7310 r5:ee7ccbe8 r4:f0020000
> [<8088e4b0>] (imx6q_clocks_init) from [<808b024c>] (of_clk_init+0xd8/0x198)
>  r10:80923594 r9:809234d4 r8:00000000 r7:ee002ac0 r6:ee002b00 r5:ee7ce5b0
>  r4:00000001
> [<808b0174>] (of_clk_init) from [<80880364>] (time_init+0x2c/0x38)
>  r10:ef7fc9c0 r9:412fc09a r8:808d6880 r7:808bd790 r6:ffffffff r5:809329c0
>  r4:00000001
> [<80880338>] (time_init) from [<8087ca2c>] (start_kernel+0x1f8/0x388)
> [<8087c834>] (start_kernel) from [<10008074>] (0x10008074)
>  r10:00000000 r8:1000406a r7:808db644 r6:808bd78c r5:808d692c r4:10c5387d
> Division by zero in kernel.
> CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc8-next-20140326 #942
> Backtrace:
> [<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
>  r6:ee022b80 r5:00000000 r4:00000000 r3:00000000
> [<80011e58>] (show_stack) from [<8064cc60>] (dump_stack+0x88/0xa4)
> [<8064cbd8>] (dump_stack) from [<80011a94>] (__div0+0x18/0x20)
>  r5:808dc900 r4:00000000
> [<80011a7c>] (__div0) from [<8029582c>] (Ldiv0_64+0x8/0x18)
> [<80082314>] (clockevents_config) from [<800823b4>]
> (clockevents_config_and_register+0x1c/0x28)
>  r5:80932eac r4:808dc900
> [<80082398>] (clockevents_config_and_register) from [<808845d8>]
> (mxc_timer_init+0x148/0x190)
>  r4:808dc900 r3:fffffffe
> [<80884490>] (mxc_timer_init) from [<808910b0>]
> (imx6q_clocks_init+0x2c00/0x2d24)
>  r8:00000004 r7:809334d0 r6:808c7310 r5:ee7ccbe8 r4:f0020000
> [<8088e4b0>] (imx6q_clocks_init) from [<808b024c>] (of_clk_init+0xd8/0x198)
>  r10:80923594 r9:809234d4 r8:00000000 r7:ee002ac0 r6:ee002b00 r5:ee7ce5b0
>  r4:00000001
> [<808b0174>] (of_clk_init) from [<80880364>] (time_init+0x2c/0x38)
>  r10:ef7fc9c0 r9:412fc09a r8:808d6880 r7:808bd790 r6:ffffffff r5:809329c0
>  r4:00000001
> [<80880338>] (time_init) from [<8087ca2c>] (start_kernel+0x1f8/0x388)
> [<8087c834>] (start_kernel) from [<10008074>] (0x10008074)
>  r10:00000000 r8:1000406a r7:808db644 r6:808bd78c r5:808d692c r4:10c5387d
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 0 at kernel/time/clockevents.c:44 cev_delta2ns+0xe8/0x104()
> Modules linked in:
> CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc8-next-20140326 #942
> Backtrace:
> [<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
>  r6:80081cb8 r5:00000000 r4:00000000 r3:00000000
> [<80011e58>] (show_stack) from [<8064cc60>] (dump_stack+0x88/0xa4)
> [<8064cbd8>] (dump_stack) from [<80028f78>] (warn_slowpath_common+0x70/0x94)
>  r5:00000009 r4:00000000
> [<80028f08>] (warn_slowpath_common) from [<80028fc0>]
> (warn_slowpath_null+0x24/0x2c)
>  r8:000000ff r7:000000ff r6:00000000 r5:808dc900 r4:00000000
> [<80028f9c>] (warn_slowpath_null) from [<80081cb8>] (cev_delta2ns+0xe8/0x104)
> [<80081bd0>] (cev_delta2ns) from [<80082374>] (clockevents_config+0x60/0x84)
>  r9:00000000 r8:00000057 r7:f0020024 r6:ee022b80 r5:808dc900 r4:00000000
> [<80082314>] (clockevents_config) from [<800823b4>]
> (clockevents_config_and_register+0x1c/0x28)
>  r5:80932eac r4:808dc900
> [<80082398>] (clockevents_config_and_register) from [<808845d8>]
> (mxc_timer_init+0x148/0x190)
>  r4:808dc900 r3:fffffffe
> [<80884490>] (mxc_timer_init) from [<808910b0>]
> (imx6q_clocks_init+0x2c00/0x2d24)
>  r8:00000004 r7:809334d0 r6:808c7310 r5:ee7ccbe8 r4:f0020000
> [<8088e4b0>] (imx6q_clocks_init) from [<808b024c>] (of_clk_init+0xd8/0x198)
>  r10:80923594 r9:809234d4 r8:00000000 r7:ee002ac0 r6:ee002b00 r5:ee7ce5b0
>  r4:00000001
> [<808b0174>] (of_clk_init) from [<80880364>] (time_init+0x2c/0x38)
>  r10:ef7fc9c0 r9:412fc09a r8:808d6880 r7:808bd790 r6:ffffffff r5:809329c0
>  r4:00000001
> [<80880338>] (time_init) from [<8087ca2c>] (start_kernel+0x1f8/0x388)
> [<8087c834>] (start_kernel) from [<10008074>] (0x10008074)
>  r10:00000000 r8:1000406a r7:808db644 r6:808bd78c r5:808d692c r4:10c5387d
> ---[ end trace 3406ff24bd97382e ]---

Thanks for the traces. As I guessed some clocks are not initialized in time.
I am a bit disappointed because I tried to write a patch which in worst
case didn't change this order.

Viewing the code clock support for imx6, I think the problem could be due to
the fact that some link between the clock are not exposed to the device tree.

I need to have a closer look to sort out it.

Gregory

> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v3] clk: respect the clock dependencies in of_clk_init
@ 2014-03-26 19:50             ` Gregory CLEMENT
  0 siblings, 0 replies; 13+ messages in thread
From: Gregory CLEMENT @ 2014-03-26 19:50 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Fabio,

On 26/03/2014 17:22, Fabio Estevam wrote:
> Hi Gregory,
> 
> On Wed, Mar 26, 2014 at 1:02 PM, Gregory CLEMENT
> <gregory.clement@free-electrons.com> wrote:
>> I don't have any imx6 board, but should it be possible for you or the imx6
>> maintainer to add earlyprintk to see exactly what happen here?
> 
> Below is the log with earlyprintk enabled.
> 
> Regards,
> 
> Fabio Estevam
> 
> Starting kernel ...
> 
> Uncompressing Linux... done, booting the kernel.
> Booting Linux on physical CPU 0x0
> Linux version 3.14.0-rc8-next-20140326 (fabio at fabio-Latitude-E6410)
> (gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1) ) #942 SMP Wed M
> ar 26 13:20:56 BRT 2014
> CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c5387d
> CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
> Machine model: Wandboard i.MX6 Quad Board
> bootconsole [earlycon0] enabled
> Memory policy: Data cache writealloc
> PERCPU: Embedded 8 pages/cpu @ee7a4000 s8960 r8192 d15616 u32768
> Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 520720
> Kernel command line: console=ttymxc0,115200 root=/dev/nfs ip=dhcp
> nfsroot=192.168.0.2:/tftpboot/rfs,v3,tcp earlyprintk
> PID hash table entries: 4096 (order: 2, 16384 bytes)
> Dentry cache hash table entries: 262144 (order: 8, 1048576 bytes)
> Inode-cache hash table entries: 131072 (order: 7, 524288 bytes)
> Memory: 2063904K/2097152K available (6455K kernel code, 402K rwdata,
> 2200K rodata, 320K init, 5513K bss, 33248K reserved, 270336K high
> mem)
> Virtual kernel memory layout:
>     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
>     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
>     vmalloc : 0xf0000000 - 0xff000000   ( 240 MB)
>     lowmem  : 0x80000000 - 0xef800000   (1784 MB)
>     pkmap   : 0x7fe00000 - 0x80000000   (   2 MB)
>     modules : 0x7f000000 - 0x7fe00000   (  14 MB)
>       .text : 0x80008000 - 0x8087bfdc   (8656 kB)
>       .init : 0x8087c000 - 0x808cc300   ( 321 kB)
>       .data : 0x808ce000 - 0x80932980   ( 403 kB)
>        .bss : 0x80932988 - 0x80e950f8   (5514 kB)
> SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
> Hierarchical RCU implementation.
> NR_IRQS:16 nr_irqs:16 16
> L310 cache controller enabled
> l2x0: 16 ways, CACHE_ID 0x410000c7, AUX_CTRL 0x32070000, Cache size: 1024 kB
> Switching to timer-based delay loop
> Division by zero in kernel.
> CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc8-next-20140326 #942
> Backtrace:
> [<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
>  r6:00000000 r5:00000000 r4:00000000 r3:00000000
> [<80011e58>] (show_stack) from [<8064cc60>] (dump_stack+0x88/0xa4)
> [<8064cbd8>] (dump_stack) from [<80011a94>] (__div0+0x18/0x20)
>  r5:00000000 r4:00000000
> [<80011a7c>] (__div0) from [<8029582c>] (Ldiv0_64+0x8/0x18)
> [<8007e854>] (clocks_calc_mult_shift) from [<8089a8d0>]
> (sched_clock_register+0x60/0x238)
>  r10:f0018074 r9:00000000 r8:80020ba0 r7:00000020 r6:00000000 r5:80932eac
>  r4:00000000
> [<8089a870>] (sched_clock_register) from [<80884588>]
> (mxc_timer_init+0xf8/0x190)
>  r10:f0018074 r9:00000000 r8:00000057 r7:f0020024 r6:ee022b80 r5:80932eac
>  r4:00000000
> [<80884490>] (mxc_timer_init) from [<808910b0>]
> (imx6q_clocks_init+0x2c00/0x2d24)
>  r8:00000004 r7:809334d0 r6:808c7310 r5:ee7ccbe8 r4:f0020000
> [<8088e4b0>] (imx6q_clocks_init) from [<808b024c>] (of_clk_init+0xd8/0x198)
>  r10:80923594 r9:809234d4 r8:00000000 r7:ee002ac0 r6:ee002b00 r5:ee7ce5b0
>  r4:00000001
> [<808b0174>] (of_clk_init) from [<80880364>] (time_init+0x2c/0x38)
>  r10:ef7fc9c0 r9:412fc09a r8:808d6880 r7:808bd790 r6:ffffffff r5:809329c0
>  r4:00000001
> [<80880338>] (time_init) from [<8087ca2c>] (start_kernel+0x1f8/0x388)
> [<8087c834>] (start_kernel) from [<10008074>] (0x10008074)
>  r10:00000000 r8:1000406a r7:808db644 r6:808bd78c r5:808d692c r4:10c5387d
> sched_clock: 32 bits at 0 Hz, resolution 0ns, wraps every 0ns
> Division by zero in kernel.
> CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc8-next-20140326 #942
> Backtrace:
> [<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
>  r6:ee011a00 r5:00000000 r4:00000000 r3:00000000
> [<80011e58>] (show_stack) from [<8064cc60>] (dump_stack+0x88/0xa4)
> [<8064cbd8>] (dump_stack) from [<80011a94>] (__div0+0x18/0x20)
>  r5:00000000 r4:00000000
> [<80011a7c>] (__div0) from [<8029582c>] (Ldiv0_64+0x8/0x18)
> [<8007ea84>] (__clocksource_updatefreq_scale) from [<8007ec3c>]
> (__clocksource_register_scale+0x14/0x54)
>  r10:000000c8 r9:00000000 r8:f0020024 r7:807b3e58 r6:ee0119c0 r5:00000000
>  r4:ee011a00
> [<8007ec28>] (__clocksource_register_scale) from [<808ae6f8>]
> (clocksource_mmio_init+0x8c/0xa8)
>  r4:ffffffff r3:00000001
> [<808ae66c>] (clocksource_mmio_init) from [<808845ac>]
> (mxc_timer_init+0x11c/0x190)
>  r10:f0018074 r8:00000057 r7:f0020024 r6:ee022b80 r5:80932eac r4:808dc900
> [<80884490>] (mxc_timer_init) from [<808910b0>]
> (imx6q_clocks_init+0x2c00/0x2d24)
>  r8:00000004 r7:809334d0 r6:808c7310 r5:ee7ccbe8 r4:f0020000
> [<8088e4b0>] (imx6q_clocks_init) from [<808b024c>] (of_clk_init+0xd8/0x198)
>  r10:80923594 r9:809234d4 r8:00000000 r7:ee002ac0 r6:ee002b00 r5:ee7ce5b0
>  r4:00000001
> [<808b0174>] (of_clk_init) from [<80880364>] (time_init+0x2c/0x38)
>  r10:ef7fc9c0 r9:412fc09a r8:808d6880 r7:808bd790 r6:ffffffff r5:809329c0
>  r4:00000001
> [<80880338>] (time_init) from [<8087ca2c>] (start_kernel+0x1f8/0x388)
> [<8087c834>] (start_kernel) from [<10008074>] (0x10008074)
>  r10:00000000 r8:1000406a r7:808db644 r6:808bd78c r5:808d692c r4:10c5387d
> Division by zero in kernel.
> CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc8-next-20140326 #942
> Backtrace:
> [<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
>  r6:ee011a00 r5:00000000 r4:00000000 r3:00000000
> [<80011e58>] (show_stack) from [<8064cc60>] (dump_stack+0x88/0xa4)
> [<8064cbd8>] (dump_stack) from [<80011a94>] (__div0+0x18/0x20)
>  r5:00000000 r4:00000000
> [<80011a7c>] (__div0) from [<8029582c>] (Ldiv0_64+0x8/0x18)
> [<8007e854>] (clocks_calc_mult_shift) from [<8007eb28>]
> (__clocksource_updatefreq_scale+0xa4/0x1a4)
>  r10:00000001 r9:a3d70a3d r8:70a3d70a r7:0000000b r6:ee011a00 r5:00000001
>  r4:00000001
> [<8007ea84>] (__clocksource_updatefreq_scale) from [<8007ec3c>]
> (__clocksource_register_scale+0x14/0x54)
>  r10:000000c8 r9:00000000 r8:f0020024 r7:807b3e58 r6:ee0119c0 r5:00000000
>  r4:ee011a00
> [<8007ec28>] (__clocksource_register_scale) from [<808ae6f8>]
> (clocksource_mmio_init+0x8c/0xa8)
>  r4:ffffffff r3:00000001
> [<808ae66c>] (clocksource_mmio_init) from [<808845ac>]
> (mxc_timer_init+0x11c/0x190)
>  r10:f0018074 r8:00000057 r7:f0020024 r6:ee022b80 r5:80932eac r4:808dc900
> [<80884490>] (mxc_timer_init) from [<808910b0>]
> (imx6q_clocks_init+0x2c00/0x2d24)
>  r8:00000004 r7:809334d0 r6:808c7310 r5:ee7ccbe8 r4:f0020000
> [<8088e4b0>] (imx6q_clocks_init) from [<808b024c>] (of_clk_init+0xd8/0x198)
>  r10:80923594 r9:809234d4 r8:00000000 r7:ee002ac0 r6:ee002b00 r5:ee7ce5b0
>  r4:00000001
> [<808b0174>] (of_clk_init) from [<80880364>] (time_init+0x2c/0x38)
>  r10:ef7fc9c0 r9:412fc09a r8:808d6880 r7:808bd790 r6:ffffffff r5:809329c0
>  r4:00000001
> [<80880338>] (time_init) from [<8087ca2c>] (start_kernel+0x1f8/0x388)
> [<8087c834>] (start_kernel) from [<10008074>] (0x10008074)
>  r10:00000000 r8:1000406a r7:808db644 r6:808bd78c r5:808d692c r4:10c5387d
> Division by zero in kernel.
> CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc8-next-20140326 #942
> Backtrace:
> [<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
>  r6:ee022b80 r5:00000000 r4:00000000 r3:00000000
> [<80011e58>] (show_stack) from [<8064cc60>] (dump_stack+0x88/0xa4)
> [<8064cbd8>] (dump_stack) from [<80011a94>] (__div0+0x18/0x20)
>  r5:808dc900 r4:00000000
> [<80011a7c>] (__div0) from [<8029582c>] (Ldiv0_64+0x8/0x18)
> [<80082314>] (clockevents_config) from [<800823b4>]
> (clockevents_config_and_register+0x1c/0x28)
>  r5:80932eac r4:808dc900
> [<80082398>] (clockevents_config_and_register) from [<808845d8>]
> (mxc_timer_init+0x148/0x190)
>  r4:808dc900 r3:fffffffe
> [<80884490>] (mxc_timer_init) from [<808910b0>]
> (imx6q_clocks_init+0x2c00/0x2d24)
>  r8:00000004 r7:809334d0 r6:808c7310 r5:ee7ccbe8 r4:f0020000
> [<8088e4b0>] (imx6q_clocks_init) from [<808b024c>] (of_clk_init+0xd8/0x198)
>  r10:80923594 r9:809234d4 r8:00000000 r7:ee002ac0 r6:ee002b00 r5:ee7ce5b0
>  r4:00000001
> [<808b0174>] (of_clk_init) from [<80880364>] (time_init+0x2c/0x38)
>  r10:ef7fc9c0 r9:412fc09a r8:808d6880 r7:808bd790 r6:ffffffff r5:809329c0
>  r4:00000001
> [<80880338>] (time_init) from [<8087ca2c>] (start_kernel+0x1f8/0x388)
> [<8087c834>] (start_kernel) from [<10008074>] (0x10008074)
>  r10:00000000 r8:1000406a r7:808db644 r6:808bd78c r5:808d692c r4:10c5387d
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 0 at kernel/time/clockevents.c:44 cev_delta2ns+0xe8/0x104()
> Modules linked in:
> CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.0-rc8-next-20140326 #942
> Backtrace:
> [<80011cd4>] (dump_backtrace) from [<80011e70>] (show_stack+0x18/0x1c)
>  r6:80081cb8 r5:00000000 r4:00000000 r3:00000000
> [<80011e58>] (show_stack) from [<8064cc60>] (dump_stack+0x88/0xa4)
> [<8064cbd8>] (dump_stack) from [<80028f78>] (warn_slowpath_common+0x70/0x94)
>  r5:00000009 r4:00000000
> [<80028f08>] (warn_slowpath_common) from [<80028fc0>]
> (warn_slowpath_null+0x24/0x2c)
>  r8:000000ff r7:000000ff r6:00000000 r5:808dc900 r4:00000000
> [<80028f9c>] (warn_slowpath_null) from [<80081cb8>] (cev_delta2ns+0xe8/0x104)
> [<80081bd0>] (cev_delta2ns) from [<80082374>] (clockevents_config+0x60/0x84)
>  r9:00000000 r8:00000057 r7:f0020024 r6:ee022b80 r5:808dc900 r4:00000000
> [<80082314>] (clockevents_config) from [<800823b4>]
> (clockevents_config_and_register+0x1c/0x28)
>  r5:80932eac r4:808dc900
> [<80082398>] (clockevents_config_and_register) from [<808845d8>]
> (mxc_timer_init+0x148/0x190)
>  r4:808dc900 r3:fffffffe
> [<80884490>] (mxc_timer_init) from [<808910b0>]
> (imx6q_clocks_init+0x2c00/0x2d24)
>  r8:00000004 r7:809334d0 r6:808c7310 r5:ee7ccbe8 r4:f0020000
> [<8088e4b0>] (imx6q_clocks_init) from [<808b024c>] (of_clk_init+0xd8/0x198)
>  r10:80923594 r9:809234d4 r8:00000000 r7:ee002ac0 r6:ee002b00 r5:ee7ce5b0
>  r4:00000001
> [<808b0174>] (of_clk_init) from [<80880364>] (time_init+0x2c/0x38)
>  r10:ef7fc9c0 r9:412fc09a r8:808d6880 r7:808bd790 r6:ffffffff r5:809329c0
>  r4:00000001
> [<80880338>] (time_init) from [<8087ca2c>] (start_kernel+0x1f8/0x388)
> [<8087c834>] (start_kernel) from [<10008074>] (0x10008074)
>  r10:00000000 r8:1000406a r7:808db644 r6:808bd78c r5:808d692c r4:10c5387d
> ---[ end trace 3406ff24bd97382e ]---

Thanks for the traces. As I guessed some clocks are not initialized in time.
I am a bit disappointed because I tried to write a patch which in worst
case didn't change this order.

Viewing the code clock support for imx6, I think the problem could be due to
the fact that some link between the clock are not exposed to the device tree.

I need to have a closer look to sort out it.

Gregory

> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-03-26 19:50 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-24 18:10 [PATCH v3] clk: respect the clock dependencies in of_clk_init Gregory CLEMENT
2014-02-24 18:10 ` Gregory CLEMENT
2014-02-28 10:46 ` Gregory CLEMENT
2014-02-28 10:46   ` Gregory CLEMENT
2014-03-21  3:52   ` Mike Turquette
2014-03-26 15:19     ` Kevin Hilman
2014-03-26 15:19       ` Kevin Hilman
2014-03-26 16:02       ` Gregory CLEMENT
2014-03-26 16:02         ` Gregory CLEMENT
2014-03-26 16:22         ` Fabio Estevam
2014-03-26 16:22           ` Fabio Estevam
2014-03-26 19:50           ` Gregory CLEMENT
2014-03-26 19:50             ` Gregory CLEMENT

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.