Re: [PATCH RT v2 0/3] riscv: add PREEMPT_RT support

Sebastian Andrzej Siewior
2023-11-03T08:17:29Z

On 2023-11-02 14:37:05 [-0700], Palmer Dabbelt wrote:
> On Thu, 02 Nov 2023 08:54:23 PDT (-0700), bigeasy@linutronix.de wrote:
> > On 2023-11-02 12:31:15 [+0000], Conor Dooley wrote:
> > > [ 1.130384] BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
> > > [ 1.130418]
> > > [ 1.130414] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 0, name: swapper/1
> > > [ 1.130971] [<ffffffff80267d78>] __alloc_pages+0xac/0x1be
> > > [ 1.130978] alloc_workqueue+0x96/0x6de
> > > [ 1.131005] [<ffffffff8000412a>] check_unaligned_access+0x34/0x336
> > > [ 1.131010] kmem_cache_init_late+0x1c/0x36
> > > [ 1.131038] [<ffffffff80004660>] check_unaligned_access_nonboot_cpu+0x12/0x1a
> > > [ 1.131046] start_kernel+0x204/0x7e6
> > > [ 1.131082] irq event stamp: 822
> > > [ 1.131071] [<ffffffff800fcba0>] __flush_smp_call_function_queue+0x1de/0x790
> > > [ 1.131093] hardirqs last enabled at (821): [<ffffffff80bd75b0>] default_idle_call+0xfa/0x152
> > > [ 1.131111] [<ffffffff800fd3a0>] generic_smp_call_function_single_interrupt+0xe/0x1a
> > > [ 1.131124] hardirqs last disabled at (822): [<ffffffff80bd52a0>] do_irq+0x16/0xa6
> >
> > Without the patch check_unaligned_access_boot_cpu() ->
> > check_unaligned_access() is okay. The SMP/IPI variant (the patch imho)
> > is bad. There must be no memory allocation from IRQ-off region - the
>
> Ya, sorry I didn't catch it. I'm just going to drop Evan's patch, it'd
> missed the batch I was going to send tomorrow anyway.

The bring up of the secondary CPUs still has the memory in IRQ-off
path, only the primary CPU is fine.

Sebastian