Skip to content
Commit 26ef1d95 authored by Meng Li's avatar Meng Li Committed by Liwei Song
Browse files

mfd: altera-sysmgr: enable raw spinlock feature for preempt-rt kernel

When booting up preempt rt kernel on stratix10 platform, there is
below calltrace:
BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:969
in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 1, name: swapper/0
Preemption disabled at:
[<ffff8000100b25b0>] __setup_irq+0xe0/0x730
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.78-rt54-yocto-preempt-rt #1
Hardware name: SoCFPGA Stratix 10 SoCDK (DT)
Call trace:
 ......
 ___might_sleep+0x144/0x180
 rt_spin_lock+0x34/0x9c
 regmap_lock_spinlock+0x24/0x40
 regmap_write+0x48/0x84
 a10_eccmgr_irq_unmask+0x34/0x40
 ......
 altr_edac_a10_probe+0x16c/0x2b0
 platform_drv_probe+0x60/0xb4
 ......
 ret_from_fork+0x10/0x38

Because regmap_write is invoked under preemption disabled status, and
might trigger sleep.
Recently, the commit 67021f25("regmap: teach regmap to use raw
spinlocks if requested in the config ") add an option for regmap to use
raw spinlock. So, enable raw spinlock in preempt-rt kernel to avoid the
might sleep issue.
Note: The commit 67021f25

 is only in kernel v5.15, not included in
earlier versions. So, if intend to fix this issue in earlier preempt-rt
kernel, it is need to backport the 2 patches together, otherwise there
will be building issue.

Signed-off-by: default avatarMeng Li <Meng.Li@windriver.com>
Signed-off-by: default avatarBruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: default avatarLiwei Song <liwei.song@windriver.com>
parent 193cdd07
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment