soc: imx: gpcv2: fix regulator deferred probe
PATCH 1/1 soc: imx: gpcv2: fix regulator deferred probe
If a regulator requests a deferred probe, the power domain gets initialized twice. This leads to a list double add (without list debugging the kernel hangs due to the double add later):
WARNING: CPU: 0 PID: 19 at lib/list_debug.c:31 __list_add_valid+0xbc/0xc4 list_add double add: new=c1229754, prev=c12383b4, next=c1229754.
Initialize the power domain after we get the regulator. Also do not print an error in case the regulator defers probing.
---
Hi Shawn,
Since this leads to a Kernel hang in v4.13-rc3, can you get this into v4.13 still?
--
Stefan
drivers/soc/imx/gpcv2.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/soc/imx/gpcv2.c +8 -7
@@ -200,16 +200,11 @@ static int imx7_pgc_domain_probe(struct platform_device *pdev) domain->dev = &pdev->dev; - ret =pm_genpd_init (&domain->genpd,NULL , true); -if (ret) { -dev_err (domain->dev,"Failed to init power domain\n" ); -return ret; - } - domain->regulator =devm_regulator_get_optional (domain->dev,"power" );if (IS_ERR (domain->regulator)) {if (PTR_ERR (domain->regulator) != -ENODEV ) { -dev_err (domain->dev,"Failed to get domain's regulator\n" ); +if (PTR_ERR (domain->regulator) != -EPROBE_DEFER ) +dev_err (domain->dev,"Failed to get domain's regulator\n" );return PTR_ERR (domain->regulator); } }else {
@@ -217,6 +212,12 @@ static int imx7_pgc_domain_probe(struct platform_device *pdev) domain->voltage, domain->voltage); } + ret =pm_genpd_init (&domain->genpd,NULL , true); +if (ret) { +dev_err (domain->dev,"Failed to init power domain\n" ); +return ret; + } + ret =of_genpd_add_provider_simple (domain->dev->of_node, &domain->genpd);if (ret) {
Signature · 1 line
2.13.3
Quoted 16 lines · Stefan Agner
If a regulator requests a deferred probe, the power domain gets initialized twice. This leads to a list double add (without list debugging the kernel hangs due to the double add later):
WARNING: CPU: 0 PID: 19 at lib/list_debug.c:31 __list_add_valid+0xbc/0xc4 list_add double add: new=c1229754, prev=c12383b4, next=c1229754.Initialize the power domain after we get the regulator. Also do not print an error in case the regulator defers probing.
Cc Fabio Estevam <[email protected]>Cc Andrey Smirnov <[email protected]>Cc linux-arm-kernel at lists.infradead.orgCc linux-kernel at vger.kernel.orgFixes 03aa12629fc4 ("soc: imx: Add GPCv2 power gating driver")Signed-off-by Stefan Agner <[email protected]>
Quoted 5 lines
---
Hi Shawn,Since this leads to a Kernel hang in v4.13-rc3, can you get this into v4.13 still?
Sure. But before doing that, I would like to get an ACK from Andrey on this fix.
Shawn
Quoted 10 lines · Stefan Agner
If a regulator requests a deferred probe, the power domain gets initialized twice. This leads to a list double add (without list debugging the kernel hangs due to the double add later):
WARNING: CPU: 0 PID: 19 at lib/list_debug.c:31 __list_add_valid+0xbc/0xc4 list_add double add: new=c1229754, prev=c12383b4, next=c1229754.Initialize the power domain after we get the regulator. Also do not print an error in case the regulator defers probing.
Quoted 6 lines
Cc Fabio Estevam <[email protected]>Cc Andrey Smirnov <[email protected]>Cc linux-arm-kernel at lists.infradead.orgCc linux-kernel at vger.kernel.orgFixes 03aa12629fc4 ("soc: imx: Add GPCv2 power gating driver")Signed-off-by Stefan Agner <[email protected]>
As the author of original bug:
I also went ahead and tested PCIe on my SabreSD with Intel Gigabit adapter, so
Thanks for debugging and fixing this!
Andrey Smirnov
Shawn Guo
AppliedQuoted 10 lines · Stefan Agner
If a regulator requests a deferred probe, the power domain gets initialized twice. This leads to a list double add (without list debugging the kernel hangs due to the double add later):
WARNING: CPU: 0 PID: 19 at lib/list_debug.c:31 __list_add_valid+0xbc/0xc4 list_add double add: new=c1229754, prev=c12383b4, next=c1229754.Initialize the power domain after we get the regulator. Also do not print an error in case the regulator defers probing.
Quoted 6 lines
Cc Fabio Estevam <[email protected]>Cc Andrey Smirnov <[email protected]>Cc linux-arm-kernel at lists.infradead.orgCc linux-kernel at vger.kernel.orgFixes 03aa12629fc4 ("soc: imx: Add GPCv2 power gating driver")Signed-off-by Stefan Agner <[email protected]>
Applied, thanks.
Hi Shawn,
Quoted 11 lines · Shawn Guo
Quoted 10 lines · Stefan Agner
If a regulator requests a deferred probe, the power domain gets initialized twice. This leads to a list double add (without list debugging the kernel hangs due to the double add later):
WARNING: CPU: 0 PID: 19 at lib/list_debug.c:31 __list_add_valid+0xbc/0xc4 list_add double add: new=c1229754, prev=c12383b4, next=c1229754.Initialize the power domain after we get the regulator. Also do not print an error in case the regulator defers probing.
Quoted 8 lines
Quoted 6 lines
Cc Fabio Estevam <[email protected]>Cc Andrey Smirnov <[email protected]>Cc linux-arm-kernel at lists.infradead.orgCc linux-kernel at vger.kernel.orgFixes 03aa12629fc4 ("soc: imx: Add GPCv2 power gating driver")Signed-off-by Stefan Agner <[email protected]>Applied, thanks.
As of 4.13-rc5 this did not make it upstream yet, I guess still on its way?
--
Stefan
Quoted 21 lines · Stefan Agner
Hi Shawn,
Quoted 18 lines · Shawn Guo
Quoted 16 lines · Stefan Agner
If a regulator requests a deferred probe, the power domain gets initialized twice. This leads to a list double add (without list debugging the kernel hangs due to the double add later):
WARNING: CPU: 0 PID: 19 at lib/list_debug.c:31 __list_add_valid+0xbc/0xc4 list_add double add: new=c1229754, prev=c12383b4, next=c1229754.Initialize the power domain after we get the regulator. Also do not print an error in case the regulator defers probing.
Cc Fabio Estevam <[email protected]>Cc Andrey Smirnov <[email protected]>Cc linux-arm-kernel at lists.infradead.orgCc linux-kernel at vger.kernel.orgFixes 03aa12629fc4 ("soc: imx: Add GPCv2 power gating driver")Signed-off-by Stefan Agner <[email protected]>
Quoted 4 lines
Quoted 1 line
Applied, thanks.
As of 4.13-rc5 this did not make it upstream yet, I guess still on its way?
Yes, Stefan. It's on the way to arm-soc [1], but not yet responded.
Shawn
Arnd Bergmann
AppliedQuoted 24 lines · Shawn Guo
Quoted 23 lines · Stefan Agner
Hi Shawn,
Quoted 19 lines · Shawn Guo
Quoted 10 lines · Stefan Agner
If a regulator requests a deferred probe, the power domain gets initialized twice. This leads to a list double add (without list debugging the kernel hangs due to the double add later):
WARNING: CPU: 0 PID: 19 at lib/list_debug.c:31 __list_add_valid+0xbc/0xc4 list_add double add: new=c1229754, prev=c12383b4, next=c1229754.Initialize the power domain after we get the regulator. Also do not print an error in case the regulator defers probing.
Quoted 6 lines
Cc Fabio Estevam <[email protected]>Cc Andrey Smirnov <[email protected]>Cc linux-arm-kernel at lists.infradead.orgCc linux-kernel at vger.kernel.orgFixes 03aa12629fc4 ("soc: imx: Add GPCv2 power gating driver")Signed-off-by Stefan Agner <[email protected]>Applied, thanks.
Quoted 8 lines
Quoted 2 lines
As of 4.13-rc5 this did not make it upstream yet, I guess still on its way?
Yes, Stefan. It's on the way to arm-soc [1], but not yet responded.
Shawn
Merged into arm-soc now with Shawn's pull request.
Arnd