linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mfd: altera-sysmgr: enable raw spinlock feature for stratix10 platform
@ 2021-11-15  3:44 Meng Li
  2021-11-16  8:26 ` Li, Meng
  0 siblings, 1 reply; 2+ messages in thread
From: Meng Li @ 2021-11-15  3:44 UTC (permalink / raw)
  To: thor.thayer, lee.jones, arnd; +Cc: linux-kernel, meng.li

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. So, enable raw spinlock feature forcibly.

Fixes: f36e789a1f8d ("mfd: altera-sysmgr: Add SOCFPGA System Manager ")
Cc: stable@vger.kernel.org
Signed-off-by: Meng Li <Meng.Li@windriver.com>
---
 drivers/mfd/altera-sysmgr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mfd/altera-sysmgr.c b/drivers/mfd/altera-sysmgr.c
index 591b300d9095..8aad5bbb13b3 100644
--- a/drivers/mfd/altera-sysmgr.c
+++ b/drivers/mfd/altera-sysmgr.c
@@ -83,6 +83,9 @@ static struct regmap_config altr_sysmgr_regmap_cfg = {
 	.fast_io = true,
 	.use_single_read = true,
 	.use_single_write = true,
+#ifdef CONFIG_PREEMPT_RT
+	.use_raw_spinlock = true,
+#endif
 };
 
 /**
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH] mfd: altera-sysmgr: enable raw spinlock feature for stratix10 platform
  2021-11-15  3:44 [PATCH] mfd: altera-sysmgr: enable raw spinlock feature for stratix10 platform Meng Li
@ 2021-11-16  8:26 ` Li, Meng
  0 siblings, 0 replies; 2+ messages in thread
From: Li, Meng @ 2021-11-16  8:26 UTC (permalink / raw)
  To: thor.thayer, lee.jones, arnd; +Cc: linux-kernel

I did some improvement for this patch and will send v2 RR.

Thanks,
Limeng

> -----Original Message-----
> From: Li, Meng <Meng.Li@windriver.com>
> Sent: Monday, November 15, 2021 11:45 AM
> To: thor.thayer@linux.intel.com; lee.jones@linaro.org; arnd@arndb.de
> Cc: linux-kernel@vger.kernel.org; Li, Meng <Meng.Li@windriver.com>
> Subject: [PATCH] mfd: altera-sysmgr: enable raw spinlock feature for
> stratix10 platform
> 
> 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. So, enable raw spinlock feature forcibly.
> 
> Fixes: f36e789a1f8d ("mfd: altera-sysmgr: Add SOCFPGA System Manager ")
> Cc: stable@vger.kernel.org
> Signed-off-by: Meng Li <Meng.Li@windriver.com>
> ---
>  drivers/mfd/altera-sysmgr.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/mfd/altera-sysmgr.c b/drivers/mfd/altera-sysmgr.c index
> 591b300d9095..8aad5bbb13b3 100644
> --- a/drivers/mfd/altera-sysmgr.c
> +++ b/drivers/mfd/altera-sysmgr.c
> @@ -83,6 +83,9 @@ static struct regmap_config altr_sysmgr_regmap_cfg = {
>  	.fast_io = true,
>  	.use_single_read = true,
>  	.use_single_write = true,
> +#ifdef CONFIG_PREEMPT_RT
> +	.use_raw_spinlock = true,
> +#endif
>  };
> 
>  /**
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-16  8:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15  3:44 [PATCH] mfd: altera-sysmgr: enable raw spinlock feature for stratix10 platform Meng Li
2021-11-16  8:26 ` Li, Meng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).