Skip to content
  • Olivier Moysan's avatar
    a14bf98c
    ASoC: stm32: sai: fix possible circular locking · a14bf98c
    Olivier Moysan authored
    
    
    In current driver, locks can be taken as follows:
    - Register access: take a lock on regmap config and then on clock.
    - Master clock provider: take a lock on clock and then on regmap config.
    This can lead to the circular locking summarized below.
    
    Remove peripheral clock management through regmap framework, and manage
    peripheral clock in driver instead. On register access, lock on clock
    is taken first, which allows to avoid possible locking issue.
    
    [ 6696.561513] ======================================================
    [ 6696.567670] WARNING: possible circular locking dependency detected
    [ 6696.573842] 4.19.49 #866 Not tainted
    [ 6696.577397] ------------------------------------------------------
    [ 6696.583566] pulseaudio/6439 is trying to acquire lock:
    [ 6696.588697] 87b0a25b (enable_lock){..-.}, at: clk_enable_lock+0x64/0x128
    [ 6696.595377]
    [ 6696.595377] but task is already holding lock:
    [ 6696.601197] d858f825 (stm32_sai_sub:1342:(sai->regmap_config)->lock){....}
    ...
    [ 6696.812513]  Possible unsafe locking scenario:
    [ 6696.812513]
    [ 6696.818418]        CPU0                    CPU1
    [ 6696.822935]        ----                    ----
    [ 6696.827451]   lock(stm32_sai_sub:1342:(sai->regmap_config)->lock);
    [ 6696.833618]                                lock(enable_lock);
    [ 6696.839350]                                lock(stm32_sai_sub:1342:
                                                  (sai->regmap_config)->lock);
    [ 6696.848035]   lock(enable_lock);
    
    Fixes: 03e78a24 ("ASoC: stm32: sai: add h7 support")
    
    Signed-off-by: default avatarOlivier Moysan <olivier.moysan@st.com>
    Link: https://lore.kernel.org/r/20200109083254.478-1-olivier.moysan@st.com
    
    
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
    a14bf98c
    ASoC: stm32: sai: fix possible circular locking
    Olivier Moysan authored
    
    
    In current driver, locks can be taken as follows:
    - Register access: take a lock on regmap config and then on clock.
    - Master clock provider: take a lock on clock and then on regmap config.
    This can lead to the circular locking summarized below.
    
    Remove peripheral clock management through regmap framework, and manage
    peripheral clock in driver instead. On register access, lock on clock
    is taken first, which allows to avoid possible locking issue.
    
    [ 6696.561513] ======================================================
    [ 6696.567670] WARNING: possible circular locking dependency detected
    [ 6696.573842] 4.19.49 #866 Not tainted
    [ 6696.577397] ------------------------------------------------------
    [ 6696.583566] pulseaudio/6439 is trying to acquire lock:
    [ 6696.588697] 87b0a25b (enable_lock){..-.}, at: clk_enable_lock+0x64/0x128
    [ 6696.595377]
    [ 6696.595377] but task is already holding lock:
    [ 6696.601197] d858f825 (stm32_sai_sub:1342:(sai->regmap_config)->lock){....}
    ...
    [ 6696.812513]  Possible unsafe locking scenario:
    [ 6696.812513]
    [ 6696.818418]        CPU0                    CPU1
    [ 6696.822935]        ----                    ----
    [ 6696.827451]   lock(stm32_sai_sub:1342:(sai->regmap_config)->lock);
    [ 6696.833618]                                lock(enable_lock);
    [ 6696.839350]                                lock(stm32_sai_sub:1342:
                                                  (sai->regmap_config)->lock);
    [ 6696.848035]   lock(enable_lock);
    
    Fixes: 03e78a24 ("ASoC: stm32: sai: add h7 support")
    
    Signed-off-by: default avatarOlivier Moysan <olivier.moysan@st.com>
    Link: https://lore.kernel.org/r/20200109083254.478-1-olivier.moysan@st.com
    
    
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Loading