mbox series

[SRU,J/starfive-5.17,v2,0/1] Fix pinctrl-starfive race

Message ID 20220728124106.739685-1-emil.renner.berthing@canonical.com
Headers show
Series Fix pinctrl-starfive race | expand

Message

Emil Renner Berthing July 28, 2022, 12:41 p.m. UTC
[Impact]

 * The pinctrl-starfive driver has a race when initializing groups and
   functions that may result in other drivers not being able to initialize.

 * If this happens to the mmc driver the board will fail to boot.

 * This is an example of this happening:

Loading device tree blob...
[ 13.933777] pinctrl-starfive 11910000.pinctrl: does not have pin group sdio0-0.sdio-pins
[ 13.941940] pinctrl-starfive 11910000.pinctrl: invalid group sdio0-0.sdio-pins in map table
[ 13.957656] pinctrl-starfive 11910000.pinctrl: does not have pin group sdio0-0.sdio-pins
[ 13.965801] pinctrl-starfive 11910000.pinctrl: could not map group config for "sdio0-0.sdio-pins"
[ 13.974746] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
[ 13.983581] Oops [#1]
[ 13.985853] Modules linked in: phylink dw_mmc_pltfm clk_starfive_jh7100_audio reset_starfive_jh7100_audio(+) dw_mc
[ 13.986227] starfive-drm soc:display-subsystem: bound 12000000.crtc (ops starfive_crtc_component_ops)
[ 13.996286] CPU: 1 PID: 8 Comm: kworker/u4:0 Not tainted 5.17.0-1004-starfive #5-Ubuntu
[ 13.996297] Hardware name: StarFive VisionFive V1 (DT)
[ 13.996305] Workqueue: events_unbound async_run_entry_fn
[ 14.023868] epc : strcmp+0x12/0x36
[ 14.027274] ra : pinmux_func_name_to_selector+0x5a/0x76
[ 14.032583] epc : ffffffff80521224 ra : ffffffff805307d8 sp : ffffffd88006bb00
[ 14.039781] gp : ffffffff81e32e30 tp : ffffffd87ffd0000 t0 : 0000000000000040
[ 14.046988] t1 : 0000000000000000 t2 : ffffffff81004ed4 s0 : ffffffd88006bb10
[ 14.054190] s1 : 0000000000000006 a0 : ffffffd9ff1d3cb8 a1 : 0000000000000000
[ 14.061392] a2 : 0000000000000000 a3 : 0000000000000000 a4 : ffffffd88c45ce00
[ 14.068594] a5 : 0000000000000073 a6 : ffffffd88c45cdb0 a7 : ffffffd88c45ce08
[ 14.075795] s2 : ffffffd897c53000 s3 : 0000000000000007 s4 : ffffffd9ff1d3cb8
[ 14.082996] s5 : ffffffff810776f0 s6 : 0000000000000000 s7 : ffffffd8801aa5c0
[ 14.090199] s8 : ffffffd890fdf780 s9 : fffffffffffffdfb s10: ffffffff81d80008
[ 14.097400] s11: 0000000000000000 t3 : 0000000000000002 t4 : 0000000000000402
[ 14.104600] t5 : ffffffd897c53040 t6 : ffffffd897c53048
[ 14.109896] status: 0000000200000120 badaddr: 0000000000000000 cause: 000000000000000d
[ 14.117986] ---[ end trace 0000000000000000 ]---

[Test Plan]

 * Unfortunately this is a race that happens rarely so rebooting the board
   several times is the only known way to reproduce.

[Where problems could occur]

 * The fix could get the locking wrong and lock up the machine at boot.

Jianlong Huang (1):
  pinctrl: starfive: Serialize adding groups and functions

 drivers/pinctrl/pinctrl-starfive.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Tim Gardner July 28, 2022, 1:58 p.m. UTC | #1
On 7/28/22 06:41, Emil Renner Berthing wrote:
> [Impact]
> 
>   * The pinctrl-starfive driver has a race when initializing groups and
>     functions that may result in other drivers not being able to initialize.
> 
>   * If this happens to the mmc driver the board will fail to boot.
> 
>   * This is an example of this happening:
> 
> Loading device tree blob...
> [ 13.933777] pinctrl-starfive 11910000.pinctrl: does not have pin group sdio0-0.sdio-pins
> [ 13.941940] pinctrl-starfive 11910000.pinctrl: invalid group sdio0-0.sdio-pins in map table
> [ 13.957656] pinctrl-starfive 11910000.pinctrl: does not have pin group sdio0-0.sdio-pins
> [ 13.965801] pinctrl-starfive 11910000.pinctrl: could not map group config for "sdio0-0.sdio-pins"
> [ 13.974746] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
> [ 13.983581] Oops [#1]
> [ 13.985853] Modules linked in: phylink dw_mmc_pltfm clk_starfive_jh7100_audio reset_starfive_jh7100_audio(+) dw_mc
> [ 13.986227] starfive-drm soc:display-subsystem: bound 12000000.crtc (ops starfive_crtc_component_ops)
> [ 13.996286] CPU: 1 PID: 8 Comm: kworker/u4:0 Not tainted 5.17.0-1004-starfive #5-Ubuntu
> [ 13.996297] Hardware name: StarFive VisionFive V1 (DT)
> [ 13.996305] Workqueue: events_unbound async_run_entry_fn
> [ 14.023868] epc : strcmp+0x12/0x36
> [ 14.027274] ra : pinmux_func_name_to_selector+0x5a/0x76
> [ 14.032583] epc : ffffffff80521224 ra : ffffffff805307d8 sp : ffffffd88006bb00
> [ 14.039781] gp : ffffffff81e32e30 tp : ffffffd87ffd0000 t0 : 0000000000000040
> [ 14.046988] t1 : 0000000000000000 t2 : ffffffff81004ed4 s0 : ffffffd88006bb10
> [ 14.054190] s1 : 0000000000000006 a0 : ffffffd9ff1d3cb8 a1 : 0000000000000000
> [ 14.061392] a2 : 0000000000000000 a3 : 0000000000000000 a4 : ffffffd88c45ce00
> [ 14.068594] a5 : 0000000000000073 a6 : ffffffd88c45cdb0 a7 : ffffffd88c45ce08
> [ 14.075795] s2 : ffffffd897c53000 s3 : 0000000000000007 s4 : ffffffd9ff1d3cb8
> [ 14.082996] s5 : ffffffff810776f0 s6 : 0000000000000000 s7 : ffffffd8801aa5c0
> [ 14.090199] s8 : ffffffd890fdf780 s9 : fffffffffffffdfb s10: ffffffff81d80008
> [ 14.097400] s11: 0000000000000000 t3 : 0000000000000002 t4 : 0000000000000402
> [ 14.104600] t5 : ffffffd897c53040 t6 : ffffffd897c53048
> [ 14.109896] status: 0000000200000120 badaddr: 0000000000000000 cause: 000000000000000d
> [ 14.117986] ---[ end trace 0000000000000000 ]---
> 
> [Test Plan]
> 
>   * Unfortunately this is a race that happens rarely so rebooting the board
>     several times is the only known way to reproduce.
> 
> [Where problems could occur]
> 
>   * The fix could get the locking wrong and lock up the machine at boot.
> 
> Jianlong Huang (1):
>    pinctrl: starfive: Serialize adding groups and functions
> 
>   drivers/pinctrl/pinctrl-starfive.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Kleber Souza July 29, 2022, 8:38 a.m. UTC | #2
On 28.07.22 14:41, Emil Renner Berthing wrote:
> [Impact]
> 
>   * The pinctrl-starfive driver has a race when initializing groups and
>     functions that may result in other drivers not being able to initialize.
> 
>   * If this happens to the mmc driver the board will fail to boot.
> 
>   * This is an example of this happening:
> 
> Loading device tree blob...
> [ 13.933777] pinctrl-starfive 11910000.pinctrl: does not have pin group sdio0-0.sdio-pins
> [ 13.941940] pinctrl-starfive 11910000.pinctrl: invalid group sdio0-0.sdio-pins in map table
> [ 13.957656] pinctrl-starfive 11910000.pinctrl: does not have pin group sdio0-0.sdio-pins
> [ 13.965801] pinctrl-starfive 11910000.pinctrl: could not map group config for "sdio0-0.sdio-pins"
> [ 13.974746] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
> [ 13.983581] Oops [#1]
> [ 13.985853] Modules linked in: phylink dw_mmc_pltfm clk_starfive_jh7100_audio reset_starfive_jh7100_audio(+) dw_mc
> [ 13.986227] starfive-drm soc:display-subsystem: bound 12000000.crtc (ops starfive_crtc_component_ops)
> [ 13.996286] CPU: 1 PID: 8 Comm: kworker/u4:0 Not tainted 5.17.0-1004-starfive #5-Ubuntu
> [ 13.996297] Hardware name: StarFive VisionFive V1 (DT)
> [ 13.996305] Workqueue: events_unbound async_run_entry_fn
> [ 14.023868] epc : strcmp+0x12/0x36
> [ 14.027274] ra : pinmux_func_name_to_selector+0x5a/0x76
> [ 14.032583] epc : ffffffff80521224 ra : ffffffff805307d8 sp : ffffffd88006bb00
> [ 14.039781] gp : ffffffff81e32e30 tp : ffffffd87ffd0000 t0 : 0000000000000040
> [ 14.046988] t1 : 0000000000000000 t2 : ffffffff81004ed4 s0 : ffffffd88006bb10
> [ 14.054190] s1 : 0000000000000006 a0 : ffffffd9ff1d3cb8 a1 : 0000000000000000
> [ 14.061392] a2 : 0000000000000000 a3 : 0000000000000000 a4 : ffffffd88c45ce00
> [ 14.068594] a5 : 0000000000000073 a6 : ffffffd88c45cdb0 a7 : ffffffd88c45ce08
> [ 14.075795] s2 : ffffffd897c53000 s3 : 0000000000000007 s4 : ffffffd9ff1d3cb8
> [ 14.082996] s5 : ffffffff810776f0 s6 : 0000000000000000 s7 : ffffffd8801aa5c0
> [ 14.090199] s8 : ffffffd890fdf780 s9 : fffffffffffffdfb s10: ffffffff81d80008
> [ 14.097400] s11: 0000000000000000 t3 : 0000000000000002 t4 : 0000000000000402
> [ 14.104600] t5 : ffffffd897c53040 t6 : ffffffd897c53048
> [ 14.109896] status: 0000000200000120 badaddr: 0000000000000000 cause: 000000000000000d
> [ 14.117986] ---[ end trace 0000000000000000 ]---
> 
> [Test Plan]
> 
>   * Unfortunately this is a race that happens rarely so rebooting the board
>     several times is the only known way to reproduce.
> 
> [Where problems could occur]
> 
>   * The fix could get the locking wrong and lock up the machine at boot.
> 
> Jianlong Huang (1):
>    pinctrl: starfive: Serialize adding groups and functions
> 
>   drivers/pinctrl/pinctrl-starfive.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 


Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>

Thanks
Kleber Souza July 29, 2022, 1:46 p.m. UTC | #3
On 28.07.22 14:41, Emil Renner Berthing wrote:
> [Impact]
> 
>   * The pinctrl-starfive driver has a race when initializing groups and
>     functions that may result in other drivers not being able to initialize.
> 
>   * If this happens to the mmc driver the board will fail to boot.
> 
>   * This is an example of this happening:
> 
> Loading device tree blob...
> [ 13.933777] pinctrl-starfive 11910000.pinctrl: does not have pin group sdio0-0.sdio-pins
> [ 13.941940] pinctrl-starfive 11910000.pinctrl: invalid group sdio0-0.sdio-pins in map table
> [ 13.957656] pinctrl-starfive 11910000.pinctrl: does not have pin group sdio0-0.sdio-pins
> [ 13.965801] pinctrl-starfive 11910000.pinctrl: could not map group config for "sdio0-0.sdio-pins"
> [ 13.974746] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
> [ 13.983581] Oops [#1]
> [ 13.985853] Modules linked in: phylink dw_mmc_pltfm clk_starfive_jh7100_audio reset_starfive_jh7100_audio(+) dw_mc
> [ 13.986227] starfive-drm soc:display-subsystem: bound 12000000.crtc (ops starfive_crtc_component_ops)
> [ 13.996286] CPU: 1 PID: 8 Comm: kworker/u4:0 Not tainted 5.17.0-1004-starfive #5-Ubuntu
> [ 13.996297] Hardware name: StarFive VisionFive V1 (DT)
> [ 13.996305] Workqueue: events_unbound async_run_entry_fn
> [ 14.023868] epc : strcmp+0x12/0x36
> [ 14.027274] ra : pinmux_func_name_to_selector+0x5a/0x76
> [ 14.032583] epc : ffffffff80521224 ra : ffffffff805307d8 sp : ffffffd88006bb00
> [ 14.039781] gp : ffffffff81e32e30 tp : ffffffd87ffd0000 t0 : 0000000000000040
> [ 14.046988] t1 : 0000000000000000 t2 : ffffffff81004ed4 s0 : ffffffd88006bb10
> [ 14.054190] s1 : 0000000000000006 a0 : ffffffd9ff1d3cb8 a1 : 0000000000000000
> [ 14.061392] a2 : 0000000000000000 a3 : 0000000000000000 a4 : ffffffd88c45ce00
> [ 14.068594] a5 : 0000000000000073 a6 : ffffffd88c45cdb0 a7 : ffffffd88c45ce08
> [ 14.075795] s2 : ffffffd897c53000 s3 : 0000000000000007 s4 : ffffffd9ff1d3cb8
> [ 14.082996] s5 : ffffffff810776f0 s6 : 0000000000000000 s7 : ffffffd8801aa5c0
> [ 14.090199] s8 : ffffffd890fdf780 s9 : fffffffffffffdfb s10: ffffffff81d80008
> [ 14.097400] s11: 0000000000000000 t3 : 0000000000000002 t4 : 0000000000000402
> [ 14.104600] t5 : ffffffd897c53040 t6 : ffffffd897c53048
> [ 14.109896] status: 0000000200000120 badaddr: 0000000000000000 cause: 000000000000000d
> [ 14.117986] ---[ end trace 0000000000000000 ]---
> 
> [Test Plan]
> 
>   * Unfortunately this is a race that happens rarely so rebooting the board
>     several times is the only known way to reproduce.
> 
> [Where problems could occur]
> 
>   * The fix could get the locking wrong and lock up the machine at boot.
> 
> Jianlong Huang (1):
>    pinctrl: starfive: Serialize adding groups and functions
> 
>   drivers/pinctrl/pinctrl-starfive.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 


Applied to jammy:linux-starfive-5.17.

Thanks,
Kleber