Skip to contentSkip to conversation

Fix crash on OMAP with CONFIG_DEBUG_SLAB

PATCH New Rajendra Nayak 3 participants 10 messages Mar 14, 2013 – Mar 19, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Fix crash on OMAP with CONFIG_DEBUG_SLAB

These patches mainly fix the crash that was reported with CONFIG_DEBUG_SLAB enabled on OMAPs, due to the early clock initializations.

Tested on Panda ES (omap4460), beagle Xm (omap3630) and BeagleBoneBlack (AM335x)

Rajendra Nayak (2):
ARM: OMAP2+: clocks: Have consistent naming for parent name arrays
ARM: OMAP2+: clocks: Pass static parent pointers to common clock core

 arch/arm/mach-omap2/cclock2420_data.c |  314 ++++++++++-------
 arch/arm/mach-omap2/cclock2430_data.c |  332 ++++++++++--------
 arch/arm/mach-omap2/cclock33xx_data.c |   74 +++-
 arch/arm/mach-omap2/cclock3xxx_data.c |  599 ++++++++++++++++++---------------
 arch/arm/mach-omap2/cclock44xx_data.c |  240 ++++++++++---
 arch/arm/mach-omap2/clock.h           |   15 +-
 6 files changed, 965 insertions(+), 609 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/2 ARM: OMAP2+: clocks: Pass static parent pointers to common clock core

OMAP clock inits happen quite early, even before the slab is available. As part of the clock init, the common clock core tries to cache parent pointers (if not passed by the caller registering the clock) which fails in case of OMAP since the slab isn't initied.
Without CONFIG_DEBUG_SLAB enabled, this just results in the common clock core retrying the caching attempt at some point later.
However with CONFIG_DEBUG_SLAB enabled this results in a BUG() as reported in the link below by Tony..
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg85932.html

Fix this by passing static parent pointers to the common clock core while registering clocks.

---
 arch/arm/mach-omap2/cclock2420_data.c |   56 +++++++-
 arch/arm/mach-omap2/cclock2430_data.c |   56 +++++++-
 arch/arm/mach-omap2/cclock33xx_data.c |   74 ++++++++---
 arch/arm/mach-omap2/cclock3xxx_data.c |   79 +++++++++--
 arch/arm/mach-omap2/cclock44xx_data.c |  236 ++++++++++++++++++++++++++-------
 arch/arm/mach-omap2/clock.h           |   15 ++-
 6 files changed, 436 insertions(+), 80 deletions(-)
arch/arm/mach-omap2/cclock2420_data.c +54 -2
index 4b89559..727a6dd 100644
@@ -296,6 +296,10 @@ static const char *dsp_fck_parents[] = {
 	"core_ck",
 };
 
+static struct clk *dsp_fck_parents_ptr[] = {
+	&core_ck,
+};
+
 static const struct clk_ops dsp_fck_ops = {
 	.init		= &omap2_init_clk_clkdm,
 	.enable		= &omap2_dflt_clk_enable,
@@ -322,6 +326,10 @@ static const char *dsp_ick_parents[] = {
 	"dsp_fck",
 };
 
+static struct clk *dsp_ick_parents_ptr[] = {
+	&dsp_fck,
+};
+
 DEFINE_CLK_OMAP_MUX_GATE(dsp_ick, "dsp_clkdm", dsp_ick_clksel,
 			 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
 			 OMAP24XX_CLKSEL_DSP_IF_MASK,
@@ -358,6 +366,10 @@ static const char *dss1_fck_parents[] = {
 	"sys_ck", "core_ck",
 };
 
+static struct clk *dss1_fck_parents_ptr[] = {
+	&sys_ck, &core_ck,
+};
+
 static struct clk dss1_fck;
 
 static const struct clk_ops dss1_fck_ops = {
@@ -407,6 +419,10 @@ static const char *func_48m_ck_parents[] = {
 	"apll96_ck", "alt_ck",
 };
 
+static struct clk *func_48m_ck_parents_ptr[] = {
+	&apll96_ck, &alt_ck,
+};
+
 static struct clk func_48m_ck;
 
 static const struct clk_ops func_48m_ck_ops = {
@@ -428,7 +444,7 @@ static struct clk_hw_omap func_48m_ck_hw = {
 	.clkdm_name	= "wkup_clkdm",
 };
 
-DEFINE_STRUCT_CLK(func_48m_ck, func_48m_ck_parents, func_48m_ck_ops);
+DEFINE_STRUCT_CLK_MUX(func_48m_ck, func_48m_ck_parents, func_48m_ck_ops);
 
 static const struct clksel dss2_fck_clksel[] = {
 	{ .parent = &sys_ck, .rates = dss2_fck_sys_rates },
@@ -440,6 +456,10 @@ static const char *dss2_fck_parents[] = {
 	"sys_ck", "func_48m_ck",
 };
 
+static struct clk *dss2_fck_parents_ptr[] = {
+	&sys_ck, &func_48m_ck,
+};
+
 DEFINE_CLK_OMAP_MUX_GATE(dss2_fck, "dss_clkdm", dss2_fck_clksel,
 			 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
 			 OMAP24XX_CLKSEL_DSS2_MASK,
@@ -451,7 +471,11 @@ static const char *func_54m_ck_parents[] = {
 	"apll54_ck", "alt_ck",
 };
 
-DEFINE_CLK_MUX(func_54m_ck, func_54m_ck_parents, NULL, 0x0,
+static struct clk *func_54m_ck_parents_ptr[] = {
+	&apll54_ck, &alt_ck,
+};
+
+DEFINE_CLK_MUX(func_54m_ck, func_54m_ck_parents, func_54m_ck_parents_ptr, 0x0,
 	       OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
 	       OMAP24XX_54M_SOURCE_SHIFT, OMAP24XX_54M_SOURCE_WIDTH,
 	       0x0, NULL);
@@ -572,6 +596,10 @@ static const char *gfx_2d_fck_parents[] = {
 	"core_l3_ck",
 };
 
+static struct clk *gfx_2d_fck_parents_ptr[] = {
+	&core_l3_ck,
+};
+
 DEFINE_CLK_OMAP_MUX_GATE(gfx_2d_fck, "gfx_clkdm", gfx_fck_clksel,
 			 OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
 			 OMAP_CLKSEL_GFX_MASK,
@@ -671,6 +699,10 @@ static const char *gpt10_fck_parents[] = {
 	"func_32k_ck", "sys_ck", "alt_ck",
 };
 
+static struct clk  *gpt10_fck_parents_ptr[] = {
+	&func_32k_ck, &sys_ck, &alt_ck,
+};
+
 DEFINE_CLK_OMAP_MUX_GATE(gpt10_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
 			 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
 			 OMAP24XX_CLKSEL_GPT10_MASK,
@@ -1088,6 +1120,10 @@ static const char *mcbsp1_fck_parents[] = {
 	"func_96m_ck", "mcbsp_clks",
 };
 
+static struct clk *mcbsp1_fck_parents_ptr[] = {
+	&func_96m_ck, &mcbsp_clks,
+};
+
 DEFINE_CLK_OMAP_MUX_GATE(mcbsp1_fck, "core_l4_clkdm", mcbsp_fck_clksel,
 			 OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
 			 OMAP2_MCBSP1_CLKS_MASK,
@@ -1403,6 +1439,10 @@ static const char *ssi_ssr_sst_fck_parents[] = {
 	"core_ck",
 };
 
+static struct clk *ssi_ssr_sst_fck_parents_ptr[] = {
+	&core_ck,
+};
+
 DEFINE_CLK_OMAP_MUX_GATE(ssi_ssr_sst_fck, "core_l3_clkdm",
 			 ssi_ssr_sst_fck_clksel,
 			 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
@@ -1458,6 +1498,10 @@ static const char *sys_clkout_src_parents[] = {
 	"core_ck", "sys_ck", "func_96m_ck", "func_54m_ck",
 };
 
+static struct clk *sys_clkout_src_parents_ptr[] = {
+	&core_ck, &sys_ck, &func_96m_ck, &func_54m_ck,
+};
+
 DEFINE_CLK_OMAP_MUX_GATE(sys_clkout_src, "wkup_clkdm", common_clkout_src_clksel,
 			 OMAP2420_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_SOURCE_MASK,
 			 OMAP2420_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_EN_SHIFT,
@@ -1591,6 +1635,10 @@ static const char *usb_l4_ick_parents[] = {
 	"core_l3_ck",
 };
 
+static struct clk *usb_l4_ick_parents_ptr[] = {
+	&core_l3_ck,
+};
+
 DEFINE_CLK_OMAP_MUX_GATE(usb_l4_ick, "core_l4_clkdm", usb_l4_ick_clksel,
 			 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
 			 OMAP24XX_CLKSEL_USB_MASK,
@@ -1642,6 +1690,10 @@ static const char *vlynq_fck_parents[] = {
 	"func_96m_ck", "core_ck",
 };
 
+static struct clk *vlynq_fck_parents_ptr[] = {
+	&func_96m_ck, &core_ck,
+};
+
 DEFINE_CLK_OMAP_MUX_GATE(vlynq_fck, "core_l3_clkdm", vlynq_fck_clksel,
 			 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
 			 OMAP2420_CLKSEL_VLYNQ_MASK,
arch/arm/mach-omap2/cclock2430_data.c +54 -2

134 lines not on this page · raw message

arch/arm/mach-omap2/cclock33xx_data.c +58 -16

216 lines not on this page · raw message

arch/arm/mach-omap2/cclock3xxx_data.c +68 -11

182 lines not on this page · raw message

arch/arm/mach-omap2/cclock44xx_data.c +189 -47

483 lines not on this page · raw message

arch/arm/mach-omap2/clock.h +13 -2
index 60ddd86..9dbdcb5 100644
@@ -65,6 +65,16 @@ struct clockdomain;
 		.ops = &_clkops_name,				\
 	};
 
+#define DEFINE_STRUCT_CLK_MUX(_name, _parent_array_name, _clkops_name)	\
+	static struct clk _name = {				\
+		.name = #_name,					\
+		.hw = &_name##_hw.hw,				\
+		.parent_names = _parent_array_name,		\
+		.num_parents = ARRAY_SIZE(_parent_array_name),	\
+		.parents = _parent_array_name##_ptr,		\
+		.ops = &_clkops_name,				\
+	};
+
 #define DEFINE_STRUCT_CLK_FLAGS(_name, _parent_array_name,	\
 				_clkops_name, _flags)		\
 	static struct clk _name = {				\
@@ -72,6 +82,7 @@ struct clockdomain;
 		.hw = &_name##_hw.hw,				\
 		.parent_names = _parent_array_name,		\
 		.num_parents = ARRAY_SIZE(_parent_array_name),	\
+		.parents = _parent_array_name##_ptr,		\
 		.ops = &_clkops_name,				\
 		.flags = _flags,				\
 	};
@@ -97,7 +108,7 @@ struct clockdomain;
 		.clksel_mask	= _clksel_mask,			\
 		.clkdm_name	= _clkdm_name,			\
 	};							\
-	DEFINE_STRUCT_CLK(_name, _parent_names, _ops);
+	DEFINE_STRUCT_CLK_MUX(_name, _parent_names, _ops);
 
 #define DEFINE_CLK_OMAP_MUX_GATE(_name, _clkdm_name, _clksel,	\
 				 _clksel_reg, _clksel_mask,	\
@@ -116,7 +127,7 @@ struct clockdomain;
 		.clksel_mask	= _clksel_mask,			\
 		.clkdm_name	= _clkdm_name,			\
 	};							\
-	DEFINE_STRUCT_CLK(_name, _parent_names, _ops);
+	DEFINE_STRUCT_CLK_MUX(_name, _parent_names, _ops);
 
 #define DEFINE_CLK_OMAP_HSDIVIDER(_name, _parent_name,		\
 				_parent_ptr, _flags,		\
Signature · 1 line
1.7.9.5
maintainer
#2 lore raw

PATCH 2/2 ARM: OMAP2+: clocks: Pass static parent pointers to common clock core

Quoted 10 lines · Rajendra Nayak

OMAP clock inits happen quite early, even before the slab is available. As part of the clock init, the common clock core tries to cache parent pointers (if not passed by the caller registering the clock) which fails in case of OMAP since the slab isn't initied.
Without CONFIG_DEBUG_SLAB enabled, this just results in the common clock core retrying the caching attempt at some point later.
However with CONFIG_DEBUG_SLAB enabled this results in a BUG() as reported in the link below by Tony..
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg85932.html

Quoted 2 lines

Fix this by passing static parent pointers to the common clock core while registering clocks.

I wonder if we could easily fix this by initializing only some of the clocks that early?

If we had a two stage initialization we could dynamically allocate the rest of the parent clocks without having to add all the static data.

Regards,

Tony

#3 lore raw

PATCH 2/2 ARM: OMAP2+: clocks: Pass static parent pointers to common clock core

Quoted 11 lines · Tony Lindgren
Quoted 10 lines · Rajendra Nayak

OMAP clock inits happen quite early, even before the slab is available. As part of the clock init, the common clock core tries to cache parent pointers (if not passed by the caller registering the clock) which fails in case of OMAP since the slab isn't initied.
Without CONFIG_DEBUG_SLAB enabled, this just results in the common clock core retrying the caching attempt at some point later.
However with CONFIG_DEBUG_SLAB enabled this results in a BUG() as reported in the link below by Tony..
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg85932.html

Quoted 5 lines
Quoted 2 lines

Fix this by passing static parent pointers to the common clock core while registering clocks.

I wonder if we could easily fix this by initializing only some of the clocks that early?

We actually don't need any clocks that early (I mean even before slab init) We only need them before timer init.

This isn't something specific to OMAP so I started looking at what others in drivers/clk seem to do.

I found imx, spear, mvebu all do their clk inits within .init_time callbacks. tegra seems to even do it within .init_irq callback.

Either one would work for us too :)

Quoted 8 lines

If we had a two stage initialization we could dynamically allocate the rest of the parent clocks without having to add all the static data.

Regards,

Tony

maintainer
#4 lore raw

PATCH 2/2 ARM: OMAP2+: clocks: Pass static parent pointers to common clock core

Quoted 12 lines · Rajendra Nayak
Quoted 11 lines · Tony Lindgren
Quoted 10 lines · Rajendra Nayak

OMAP clock inits happen quite early, even before the slab is available. As part of the clock init, the common clock core tries to cache parent pointers (if not passed by the caller registering the clock) which fails in case of OMAP since the slab isn't initied.
Without CONFIG_DEBUG_SLAB enabled, this just results in the common clock core retrying the caching attempt at some point later.
However with CONFIG_DEBUG_SLAB enabled this results in a BUG() as reported in the link below by Tony..
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg85932.html

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Fix this by passing static parent pointers to the common clock core while registering clocks.

I wonder if we could easily fix this by initializing only some of the clocks that early?

We actually don't need any clocks that early (I mean even before slab init) We only need them before timer init.

Yes and only the timer clocks at that point. The others could be initialized later on so we get console error messages without having to turn on DEBUG_LL and earlyprintk.

Quoted 7 lines

This isn't something specific to OMAP so I started looking at what others in drivers/clk seem to do.

I found imx, spear, mvebu all do their clk inits within .init_time callbacks. tegra seems to even do it within .init_irq callback.

Either one would work for us too :)

Well I suggest init_irq as that's when we need the first clocks for timer.

Regards,

Tony

#5 lore raw

PATCH 2/2 ARM: OMAP2+: clocks: Pass static parent pointers to common clock core

Quoted 19 lines · Tony Lindgren
Quoted 18 lines · Rajendra Nayak
Quoted 16 lines · Tony Lindgren
Quoted 10 lines · Rajendra Nayak

OMAP clock inits happen quite early, even before the slab is available. As part of the clock init, the common clock core tries to cache parent pointers (if not passed by the caller registering the clock) which fails in case of OMAP since the slab isn't initied.
Without CONFIG_DEBUG_SLAB enabled, this just results in the common clock core retrying the caching attempt at some point later.
However with CONFIG_DEBUG_SLAB enabled this results in a BUG() as reported in the link below by Tony..
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg85932.html

Quoted 2 lines

Fix this by passing static parent pointers to the common clock core while registering clocks.

I wonder if we could easily fix this by initializing only some of the clocks that early?

Quoted 6 lines
Quoted 2 lines

We actually don't need any clocks that early (I mean even before slab init) We only need them before timer init.

Yes and only the timer clocks at that point. The others could be initialized later on so we get console error messages without having to turn on DEBUG_LL and earlyprintk.

but that wouldn't be possible with the hwmod dependency on clocks. We would need to move the hwmod inits further down too.

Quoted 10 lines
Quoted 8 lines

This isn't something specific to OMAP so I started looking at what others in drivers/clk seem to do.

I found imx, spear, mvebu all do their clk inits within .init_time callbacks. tegra seems to even do it within .init_irq callback.

Either one would work for us too :)

Well I suggest init_irq as that's when we need the first clocks for timer.

For which platforms? I instead see them being needed only by init_timer, so was thinking thats a better place instead.

For the -rc fix to fix the crash with DEBUG_SLAB, is it fine if I move *all* clock inits down to init_timer (or init_irq).

Splitting clocks alone would not work for now, without hwmod being moved down also.

Quoted 5 lines

Regards,

Tony

maintainer
#6 lore raw

PATCH 2/2 ARM: OMAP2+: clocks: Pass static parent pointers to common clock core

Quoted 39 lines · Rajendra Nayak
Quoted 19 lines · Tony Lindgren
Quoted 18 lines · Rajendra Nayak
Quoted 16 lines · Tony Lindgren
Quoted 10 lines · Rajendra Nayak

OMAP clock inits happen quite early, even before the slab is available. As part of the clock init, the common clock core tries to cache parent pointers (if not passed by the caller registering the clock) which fails in case of OMAP since the slab isn't initied.
Without CONFIG_DEBUG_SLAB enabled, this just results in the common clock core retrying the caching attempt at some point later.
However with CONFIG_DEBUG_SLAB enabled this results in a BUG() as reported in the link below by Tony..
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg85932.html

Quoted 2 lines

Fix this by passing static parent pointers to the common clock core while registering clocks.

I wonder if we could easily fix this by initializing only some of the clocks that early?

Quoted 6 lines
Quoted 2 lines

We actually don't need any clocks that early (I mean even before slab init) We only need them before timer init.

Yes and only the timer clocks at that point. The others could be initialized later on so we get console error messages without having to turn on DEBUG_LL and earlyprintk.

but that wouldn't be possible with the hwmod dependency on clocks. We would need to move the hwmod inits further down too.

Quoted 9 lines
Quoted 8 lines

This isn't something specific to OMAP so I started looking at what others in drivers/clk seem to do.

I found imx, spear, mvebu all do their clk inits within .init_time callbacks. tegra seems to even do it within .init_irq callback.

Either one would work for us too :)

Quoted 7 lines
Quoted 1 line

Well I suggest init_irq as that's when we need the first clocks for timer.

For which platforms? I instead see them being needed only by init_timer, so was thinking thats a better place instead.

For the -rc fix to fix the crash with DEBUG_SLAB, is it fine if I move *all* clock inits down to init_timer (or init_irq).

Sounds good to me for the -rc series. How about initialize omap_clk_init() function pointer in the SoC specific omap*_init_early() then just call omap_clk_init() in timer_init?

Quoted 1 line

Splitting clocks alone would not work for now, without hwmod being moved down also.

Good point. For the -rc series the sounds like your suggestion is the least intrusive fix and also gets us started removing few more early boot time dependencies.

Regards,

Tony

#7 lore raw

PATCH 2/2 ARM: OMAP2+: clocks: Pass static parent pointers to common clock core

Quoting Tony Lindgren (2013-03-18 09:37:58)

Quoted 52 lines · Rajendra Nayak
Quoted 39 lines · Tony Lindgren
Quoted 19 lines · Rajendra Nayak
Quoted 18 lines · Tony Lindgren
Quoted 16 lines · Rajendra Nayak
Quoted 10 lines

OMAP clock inits happen quite early, even before the slab is available. As part of the clock init, the common clock core tries to cache parent pointers (if not passed by the caller registering the clock) which fails in case of OMAP since the slab isn't initied.
Without CONFIG_DEBUG_SLAB enabled, this just results in the common clock core retrying the caching attempt at some point later.
However with CONFIG_DEBUG_SLAB enabled this results in a BUG() as reported in the link below by Tony..
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg85932.html

Quoted 2 lines

Fix this by passing static parent pointers to the common clock core while registering clocks.

I wonder if we could easily fix this by initializing only some of the clocks that early?

Quoted 6 lines
Quoted 2 lines

We actually don't need any clocks that early (I mean even before slab init) We only need them before timer init.

Yes and only the timer clocks at that point. The others could be initialized later on so we get console error messages without having to turn on DEBUG_LL and earlyprintk.

but that wouldn't be possible with the hwmod dependency on clocks. We would need to move the hwmod inits further down too.

Quoted 9 lines
Quoted 8 lines

This isn't something specific to OMAP so I started looking at what others in drivers/clk seem to do.

I found imx, spear, mvebu all do their clk inits within .init_time callbacks. tegra seems to even do it within .init_irq callback.

Either one would work for us too :)

Quoted 7 lines
Quoted 1 line

Well I suggest init_irq as that's when we need the first clocks for timer.

For which platforms? I instead see them being needed only by init_timer, so was thinking thats a better place instead.

For the -rc fix to fix the crash with DEBUG_SLAB, is it fine if I move *all* clock inits down to init_timer (or init_irq).

Sounds good to me for the -rc series. How about initialize omap_clk_init() function pointer in the SoC specific omap*_init_early() then just call omap_clk_init() in timer_init?

Quoted 6 lines
Quoted 1 line

Splitting clocks alone would not work for now, without hwmod being moved down also.

Good point. For the -rc series the sounds like your suggestion is the least intrusive fix and also gets us started removing few more early boot time dependencies.

+1 for removing the early init dependencies. hwmod initialization was the original impetus for all this static struct clk stuff. If the initialization for hwmod and the omap clocks can be moved to a later callback then it is the first step in removing the static data and getting rid of clk-private.h usage.

Regards,
Mike

Quoted 3 lines

Regards,

Tony

#8 lore raw

PATCH 2/2 ARM: OMAP2+: clocks: Pass static parent pointers to common clock core

Quoted 60 lines · Mike Turquette

Quoting Tony Lindgren (2013-03-18 09:37:58)

Quoted 52 lines · Rajendra Nayak
Quoted 39 lines · Tony Lindgren
Quoted 19 lines · Rajendra Nayak
Quoted 18 lines · Tony Lindgren
Quoted 16 lines · Rajendra Nayak
Quoted 10 lines

OMAP clock inits happen quite early, even before the slab is available. As part of the clock init, the common clock core tries to cache parent pointers (if not passed by the caller registering the clock) which fails in case of OMAP since the slab isn't initied.
Without CONFIG_DEBUG_SLAB enabled, this just results in the common clock core retrying the caching attempt at some point later.
However with CONFIG_DEBUG_SLAB enabled this results in a BUG() as reported in the link below by Tony..
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg85932.html

Quoted 2 lines

Fix this by passing static parent pointers to the common clock core while registering clocks.

I wonder if we could easily fix this by initializing only some of the clocks that early?

Quoted 6 lines
Quoted 2 lines

We actually don't need any clocks that early (I mean even before slab init) We only need them before timer init.

Yes and only the timer clocks at that point. The others could be initialized later on so we get console error messages without having to turn on DEBUG_LL and earlyprintk.

but that wouldn't be possible with the hwmod dependency on clocks. We would need to move the hwmod inits further down too.

Quoted 9 lines
Quoted 8 lines

This isn't something specific to OMAP so I started looking at what others in drivers/clk seem to do.

I found imx, spear, mvebu all do their clk inits within .init_time callbacks. tegra seems to even do it within .init_irq callback.

Either one would work for us too :)

Quoted 7 lines
Quoted 1 line

Well I suggest init_irq as that's when we need the first clocks for timer.

For which platforms? I instead see them being needed only by init_timer, so was thinking thats a better place instead.

For the -rc fix to fix the crash with DEBUG_SLAB, is it fine if I move *all* clock inits down to init_timer (or init_irq).

Sounds good to me for the -rc series. How about initialize omap_clk_init() function pointer in the SoC specific omap*_init_early() then just call omap_clk_init() in timer_init?

Quoted 6 lines
Quoted 1 line

Splitting clocks alone would not work for now, without hwmod being moved down also.

Good point. For the -rc series the sounds like your suggestion is the least intrusive fix and also gets us started removing few more early boot time dependencies.

Quoted 5 lines

+1 for removing the early init dependencies. hwmod initialization was the original impetus for all this static struct clk stuff. If the initialization for hwmod and the omap clocks can be moved to a later callback then it is the first step in removing the static data and getting rid of clk-private.h usage.

I am working on that stuff to get rid of the dependency on clk-private.h Will post some RFC soon once I have omap4 working and if the approach seems fine, will move over all of omap so you can delete the clk-private.h completely :)

Quoted 7 lines

Regards,
Mike

Quoted 3 lines

Regards,

Tony

#9 lore raw

cover Fix crash on OMAP with CONFIG_DEBUG_SLAB

In reply to Rajendra Nayak

Missed out Mike, copied now.

Quoted 19 lines · Rajendra Nayak

These patches mainly fix the crash that was reported with CONFIG_DEBUG_SLAB enabled on OMAPs, due to the early clock initializations.

Tested on Panda ES (omap4460), beagle Xm (omap3630) and BeagleBoneBlack (AM335x)

Rajendra Nayak (2):
ARM: OMAP2+: clocks: Have consistent naming for parent name arrays
ARM: OMAP2+: clocks: Pass static parent pointers to common clock core

 arch/arm/mach-omap2/cclock2420_data.c |  314 ++++++++++-------
 arch/arm/mach-omap2/cclock2430_data.c |  332 ++++++++++--------
 arch/arm/mach-omap2/cclock33xx_data.c |   74 +++-
 arch/arm/mach-omap2/cclock3xxx_data.c |  599 ++++++++++++++++++---------------
 arch/arm/mach-omap2/cclock44xx_data.c |  240 ++++++++++---
 arch/arm/mach-omap2/clock.h           |   15 +-
 6 files changed, 965 insertions(+), 609 deletions(-)