Pinctrl driver has a race condition bug

Bug #1983019 reported by Emil Renner Berthing
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux-starfive-5.17 (Ubuntu)
Fix Released
Undecided
Emil Renner Berthing
Jammy
Fix Released
Undecided
Emil Renner Berthing

Bug Description

[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.

Changed in linux-starfive-5.17 (Ubuntu):
assignee: nobody → Emil Renner Berthing (esmil)
status: New → In Progress
Changed in linux-starfive-5.17 (Ubuntu Jammy):
status: New → In Progress
assignee: nobody → Emil Renner Berthing (esmil)
Changed in linux-starfive-5.17 (Ubuntu Jammy):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux-starfive-5.17 - 5.17.0-1005.6

---------------
linux-starfive-5.17 (5.17.0-1005.6) jammy; urgency=medium

  * jammy/linux-starfive-5.17: 5.17.0-1005.6 -proposed tracker (LP: #1983089)

  * Pinctrl driver has a race condition bug (LP: #1983019)
    - pinctrl: starfive: Serialize adding groups and functions

  * /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf cannot be booted with KVM
    (LP: #1980594)
    - RISC-V: KVM: Fix SRCU deadlock caused by kvm_riscv_check_vcpu_requests()

 -- Emil Renner Berthing <email address hidden> Fri, 29 Jul 2022 15:02:57 +0200

Changed in linux-starfive-5.17 (Ubuntu Jammy):
status: Fix Committed → Fix Released
Changed in linux-starfive-5.17 (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.