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

Evan Green evan at rivosinc.com
Fri Nov 3 10:19:49 PDT 2023


On Fri, Nov 3, 2023 at 1:24 AM Sebastian Andrzej Siewior
<bigeasy at linutronix.de> wrote:
>
> On 2023-11-03 08:14:01 [+0000], Conor Dooley wrote:
> > I'm don't think that problems are restricted to a tree containing Evan's
> > patch for parallel checks. For example:
>
> I saw check_unaligned_access() being invoked from arch_initcall()/
> check_unaligned_access_boot_cpu() which is fine. The other invocation
> from smp_callin() (secondary bring up). This is not. Evan's patch makes
> them all happen from SMP-function call which happens always with
> disabled interrupts.

Hi Sebastien,
Could you elaborate a little on the rule violation here? The
documentation for GFP_NOWAIT says:

> If the allocation is performed from an atomic context, e.g interrupt
> handler, use ``GFP_NOWAIT``.

which seems like it basically fits my situation. If I do a search for
GFP_NOWAIT to hunt for instances of allocating with interrupts
disabled, I see at least the following examples (more available upon
request):

[kzalloc] arch/sparc/kernel/adi_64.c: alloc_tag_store()
[kzalloc] block/blk-cgroup.c: blkg_create()
[idr_alloc] drivers/accel/drm_accel.c: accel_minor_alloc()
[kzalloc] drivers/block/loop.c: loop_queue_work()
[idr_alloc] drivers/block/ublk_drv.c: ublk_alloc_dev_number()

Finding the documentation that states this is illegal might help me
understand what I should be doing instead. For example, I'm fuzzy on
something that's disallowed when interrupts are disabled but ok in
smp_callin().

One option is to do all the allocations in
check_unaligned_access_all_cpus(), and pass them in, but until I can
find the rules it's hard to verify that's a correct fix. It's also a
little clunky, and wouldn't apply to the hotplug path, so I want to
make sure it's necessary and sufficient before embarking on that
journey.

-Evan

>
> Sebastian



More information about the linux-riscv mailing list