fix a kernel panic on fsl corenet board when CONFIG_CLK_PPC_CORENET is enabled
Subsystems (3)
v2 cover fix a kernel panic on fsl corenet board when CONFIG_CLK_PPC_CORENET is enabled
Hi,
I have done a boot test on p2014rdb and t4240qds boards. I don't have an access to mpc512x board, so only build test for that.
v2:
- Revert the commit da788acb2838 first.
- Invoke of_clk_init() from a common place.
v1
This tries to fix a kernel panic introduced by commit da788acb2838 ("clk: ppc-corenet: Fix Section mismatch warning").
Kevin Hao (3):
Revert "clk: ppc-corenet: Fix Section mismatch warning"
powerpc: call of_clk_init() from time_init()
clk: ppc-corenet: fix section mismatch warning
arch/powerpc/kernel/time.c | 5 ++++ arch/powerpc/platforms/512x/clock-commonclk.c | 11 ++++--- drivers/clk/clk-ppc-corenet.c | 43 ++++----------------------- 3 files changed, 16 insertions(+), 43 deletions(-)
Signature · 1 line
1.9.3
PATCH v2 1/3 Revert "clk: ppc-corenet: Fix Section mismatch warning"
This reverts commit da788acb28386aa896224e784954bb73c99ff26c.
That commit tried to fix the section mismatch warning by moving the ppc_corenet_clk_driver struct to init section. This is definitely wrong because the kernel would free the memories occupied by this struct after boot while this driver is still registered in the driver core. The kernel would panic when accessing this driver struct.
---
A new patch in v2.
drivers/clk/clk-ppc-corenet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-ppc-corenet.c +1 -1
@@ -291,7 +291,7 @@ static const struct of_device_id ppc_clk_ids[] __initconst = { {} }; -static struct platform_driver ppc_corenet_clk_driver__initdata = { +static struct platform_driver ppc_corenet_clk_driver = { .driver = { .name ="ppc_corenet_clock" , .owner =THIS_MODULE ,
Signature · 1 line
1.9.3
PATCH v2 2/3 powerpc: call of_clk_init() from time_init()
In reply to Kevin HaoSo the boards which has COMMON_CLK enabled don't have to invoke this in its board specific file.
---
A new patch in v2.
arch/powerpc/kernel/time.c | 5 +++++ arch/powerpc/platforms/512x/clock-commonclk.c | 11 +++++------ 2 files changed, 10 insertions(+), 6 deletions(-)
arch/powerpc/kernel/time.c +5 -0
@@ -54,6 +54,7 @@#include <linux/irq.h> #include <linux/delay.h> #include <linux/irq_work.h> +#include <linux/clk-provider.h> #include <asm/trace.h> #include <asm/io.h>
@@ -943,6 +944,10 @@ void __init time_init(void)init_decrementer_clockevent ();tick_setup_hrtimer_broadcast (); + +#ifdef CONFIG_COMMON_CLK +of_clk_init (NULL ); +#endif }
arch/powerpc/platforms/512x/clock-commonclk.c +5 -6
@@ -1168,6 +1168,11 @@ static void mpc5121_clk_provide_backwards_compat(void) } } +/* +* The "fixed-clock" nodes (which includes the oscillator node if the board's +* DT provides one) has already been scanned by the of_clk_init() in +* time_init(). +*/ int __init mpc5121_clk_init (void ) {struct device_node *clk_np;
@@ -1187,12 +1192,6 @@ int __init mpc5121_clk_init(void)mpc512x_clk_preset_data ();/* -* have the device tree scanned for "fixed-clock" nodes (which -* includes the oscillator node if the board's DT provides one) -*/ -of_clk_init (NULL ); - -/* * add a dummy clock for those situations where a clock spec is * required yet no real clock is involved */
Signature · 1 line
1.9.3
PATCH v2 3/3 clk: ppc-corenet: fix section mismatch warning
In reply to Kevin HaoIn order to fix the following section mismatch warning:
WARNING: drivers/clk/built-in.o(.data+0xe4): Section mismatch in reference from the variable ppc_corenet_clk_driver to the function .init.text:ppc_corenet_clk_probe() The variable ppc_corenet_clk_driver references
the function __init ppc_corenet_clk_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
WARNING: drivers/clk/built-in.o(.data+0x10c): Section mismatch in reference from the variable ppc_corenet_clk_driver to the variable .init.rodata:ppc_clk_ids The variable ppc_corenet_clk_driver references
the variable __initconst ppc_clk_ids
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
We can't just add the __init annotation to ppc_corenet_clk_driver or remove the __init from ppc_corenet_clk_probe() and ppc_clk_ids. So choose to use CLK_OF_DECLARE to scan and init the clock devices.
---
v2: Avoid to invoke of_clk_init() in a board specific file.
drivers/clk/clk-ppc-corenet.c | 43 ++++++------------------------------------- 1 file changed, 6 insertions(+), 37 deletions(-)
drivers/clk/clk-ppc-corenet.c +6 -37
@@ -268,40 +268,9 @@ static void __init sysclk_init(struct device_node *node)of_clk_add_provider (np, of_clk_src_simple_get, clk); } -static const struct of_device_id clk_match[]__initconst = { - { .compatible ="fsl,qoriq-sysclk-1.0" , .data = sysclk_init, }, - { .compatible ="fsl,qoriq-sysclk-2.0" , .data = sysclk_init, }, - { .compatible ="fsl,qoriq-core-pll-1.0" , .data = core_pll_init, }, - { .compatible ="fsl,qoriq-core-pll-2.0" , .data = core_pll_init, }, - { .compatible ="fsl,qoriq-core-mux-1.0" , .data = core_mux_init, }, - { .compatible ="fsl,qoriq-core-mux-2.0" , .data = core_mux_init, }, - {} -}; - -static int __init ppc_corenet_clk_probe (struct platform_device *pdev) -{ -of_clk_init (clk_match); - -return 0 ; -} - -static const struct of_device_id ppc_clk_ids[]__initconst = { - { .compatible ="fsl,qoriq-clockgen-1.0" , }, - { .compatible ="fsl,qoriq-clockgen-2.0" , }, - {} -}; - -static struct platform_driver ppc_corenet_clk_driver = { - .driver = { - .name ="ppc_corenet_clock" , - .owner =THIS_MODULE , - .of_match_table = ppc_clk_ids, - }, - .probe = ppc_corenet_clk_probe, -}; - -static int __init ppc_corenet_clk_init (void ) -{ -return platform_driver_register (&ppc_corenet_clk_driver); -} -subsys_initcall (ppc_corenet_clk_init); +CLK_OF_DECLARE (qoriq_sysclk_1,"fsl,qoriq-sysclk-1.0" , sysclk_init); +CLK_OF_DECLARE (qoriq_sysclk_2,"fsl,qoriq-sysclk-2.0" , sysclk_init); +CLK_OF_DECLARE (qoriq_core_pll_1,"fsl,qoriq-core-pll-1.0" , core_pll_init); +CLK_OF_DECLARE (qoriq_core_pll_2,"fsl,qoriq-core-pll-2.0" , core_pll_init); +CLK_OF_DECLARE (qoriq_core_mux_1,"fsl,qoriq-core-mux-1.0" , core_mux_init); +CLK_OF_DECLARE (qoriq_core_mux_2,"fsl,qoriq-core-mux-2.0" , core_mux_init);
Signature · 1 line
1.9.3
Quoted 4 lines · Kevin Hao
Hi,
I have done a boot test on p2014rdb and t4240qds boards. I don't have an access to mpc512x board, so only build test for that.
I do find a mpc5121ads board in our lab, the kernel boot well with these changes.
Thanks,
Kevin
Quoted 18 lines · Kevin Hao
Hi,
I have done a boot test on p2014rdb and t4240qds boards. I don't have an access to mpc512x board, so only build test for that.
v2:
- Revert the commitda788acb2838first.
- Invokeof_clk_init()from a common place.v1
This tries to fix a kernel panic introduced by commitda788acb2838("clk: ppc-corenet: Fix Section mismatch warning").Kevin Hao (3):
Revert "clk: ppc-corenet: Fix Section mismatch warning"
powerpc: callof_clk_init()fromtime_init()
clk: ppc-corenet: fix section mismatch warning
Quoted 5 lines
arch/powerpc/kernel/time.c | 5 ++++ arch/powerpc/platforms/512x/clock-commonclk.c | 11 ++++--- drivers/clk/clk-ppc-corenet.c | 43 ++++----------------------- 3 files changed, 16 insertions(+), 43 deletions(-)
Whose tree should this go through?
-Scott
Mike Turquette
Acked-byQuoting Scott Wood (2014-11-06 20:07:43)
Quoted 5 lines · Kevin Hao
Quoted 4 lines
Hi,
=I have done a boot test on p2014rdb and t4240qds boards. I don't have a=
n access
Quoted 19 lines
Quoted 18 lines
to mpc512x board, so only build test for that.
=v2:
- Revert the commitda788acb2838first.
- Invokeof_clk_init()from a common place.
=v1
This tries to fix a kernel panic introduced by commitda788acb2838("clk: ppc-corenet: Fix Section mismatch warning").
=Kevin Hao (3):
Revert "clk: ppc-corenet: Fix Section mismatch warning"
powerpc: callof_clk_init()fromtime_init()
clk: ppc-corenet: fix section mismatch warning
=
Quoted 3 lines
Quoted 3 lines
arch/powerpc/kernel/time.c | 5 ++++ arch/powerpc/platforms/512x/clock-commonclk.c | 11 ++++---
drivers/clk/clk-ppc-corenet.c| 43 ++++---------------=
--------
Quoted 6 lines
Quoted 2 lines
3 files changed, 16 insertions(+), 43 deletions(-)=
=
Acked-by Scott Wood <[email protected]>
I'm fine with it going through the ppc tree.
Quoted 9 lines
=
Whose tree should this go through?
=-Scott
==20
SGVsbG8gTWlrZSwNCg0KQ291bGQgeW91IHBsZWFzZSBhcHBseSB0aGlzIHBhdGNoPw0KVGhpcyBw YXRjaCBoYXMgYmVlbiBhY2tlZCBmb3IgYSB3aGlsZS4NCg0KVGhhbmtzLA0KWXVhbnRpYW4NCg0K PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBMaW51eHBwYy1kZXYNCj4gW21h aWx0bzpsaW51eHBwYy1kZXYtYm91bmNlcytiMjk5ODM9ZnJlZXNjYWxlLmNvbUBsaXN0cy5vemxh YnMub3JnXSBPbg0KPiBCZWhhbGYgT2YgU2NvdHQgV29vZA0KPiBTZW50OiBGcmlkYXksIE5vdmVt YmVyIDA3LCAyMDE0IDEyOjA4IFBNDQo+IFRvOiBLZXZpbiBIYW8NCj4gQ2M6IE1pa2UgVHVycXVl dHRlOyBHZXJoYXJkIFNpdHRpZzsgTHUgSmluZ2NoYW5nLUIzNTA4MzsNCj4gbGludXhwcGMtZGV2 QGxpc3RzLm96bGFicy5vcmcNCj4gU3ViamVjdDogUmU6IFtQQVRDSCB2MiAwLzNdIGZpeCBhIGtl cm5lbCBwYW5pYyBvbiBmc2wgY29yZW5ldCBib2FyZCB3aGVuDQo+IENPTkZJR19DTEtfUFBDX0NP UkVORVQgaXMgZW5hYmxlZA0KPiANCj4gT24gU3VuLCAyMDE0LTEwLTE5IGF0IDE0OjExICswODAw LCBLZXZpbiBIYW8gd3JvdGU6DQo+ID4gSGksDQo+ID4NCj4gPiBJIGhhdmUgZG9uZSBhIGJvb3Qg dGVzdCBvbiBwMjAxNHJkYiBhbmQgdDQyNDBxZHMgYm9hcmRzLiBJIGRvbid0IGhhdmUNCj4gPiBh biBhY2Nlc3MgdG8gbXBjNTEyeCBib2FyZCwgc28gb25se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PiBXaG9zZSB0cmVlIHNo b3VsZCB0aGlzIGdvIHRocm91Z2g/DQo+IA0KPiAtU2NvdHQNCj4gDQo+IA0KPiBfX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXw0KPiBMaW51eHBwYy1kZXYgbWFp bGluZyBsaXN0DQo+IExpbnV4cHBjLWRldkBsaXN0cy5vemxhYnMub3JnDQo+IGh0dHBzOi8vbGlz dHMub3psYWJzLm9yZy9saXN0aW5mby9saW51eHBwYy1kZXYNCg==
If the current code panics as of commit da788acb2838, then the revert (but not the other patches) should go to stable as well.
-Scott
Quoted 55 lines · On Wed, 2014-11-26 at 21:30 -0600, Tang Yuantian-B29983 wrote:
Hello Mike,
Could you please apply this patch?
This patch has been acked for a while.Thanks,
YuantianQuoted 47 lines
-----Original Message-----
From: Linuxppc-dev [mailto:[email protected]] On Behalf Of Scott Wood
Sent: Friday, November 07, 2014 12:08 PM
To: Kevin Hao
Cc: Mike Turquette; Gerhard Sittig; Lu Jingchang-B35083; [email protected]
Subject: Re: [PATCH v2 0/3] fix a kernel panic on fsl corenet board whenCONFIG_CLK_PPC_CORENETis enabledQuoted 18 lines · Kevin Hao
Hi,
I have done a boot test on p2014rdb and t4240qds boards. I don't have an access to mpc512x board, so only build test for that.
v2:
- Revert the commitda788acb2838first.
- Invokeof_clk_init()from a common place.v1
This tries to fix a kernel panic introduced by commitda788acb2838("clk: ppc-corenet: Fix Section mismatch warning").Kevin Hao (3):
Revert "clk: ppc-corenet: Fix Section mismatch warning"
powerpc: callof_clk_init()fromtime_init()
clk: ppc-corenet: fix section mismatch warningQuoted 5 lines
arch/powerpc/kernel/time.c | 5 ++++ arch/powerpc/platforms/512x/clock-commonclk.c | 11 ++++--- drivers/clk/clk-ppc-corenet.c | 43 ++++----------------------- 3 files changed, 16 insertions(+), 43 deletions(-)Acked-by Scott Wood <[email protected]>Whose tree should this go through?
-Scott
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev
Quoted 2 lines · Scott Wood
If the current code panics as of commit
da788acb2838, then the revert (but not the other patches) should go to stable as well.
OK, I will make a respin to cc stable and add yours and Michael's ack.
Thanks,
Kevin