Subject: Re: [PATCH] powerpc/powermac: Use early_* IO variants in via_calibrate_decr

From: Michael Ellerman <[email-masked]>
Date: Wed, 02 Aug 2023 23:10:10 +1000

Benjamin Gray <[email-masked]> writes:
> On Thu, 2023-07-06 at 11:08 +1000, Benjamin Gray wrote:
>> The issue is pre-existing, but is surfaced by commit 721255b9826b
>> ("genirq: Use a maple tree for interrupt descriptor management").
>> It's not clear to me why this causes it to surface.
>
> From the thread chain in [1], it looks like the maple tree
> implementation just has different allocation behaviour, which follows a
> pre-existing code path to kmem_cache_alloc_bulk(), which
> unconditionally enables interrupts.

That was a bug that was fixed before the series was merged.

See:
  f5451547b831 ("mm, slab/slub: Ensure kmem_cache_alloc_bulk() is available early")

It looks like the trigger here is that the maple tree code uses
call_rcu() in ma_free_rcu(), and call_rcu() can cause TIF_NEED_RESCHED
to be set, which causes cond_resched() to actually reschedule, enabling
interrupts.

cheers

> (thanks Jordan Niethe for finding this thread)
>
> [1]: https://lore.kernel.org/all/87o7qdzfay.ffs@tglx/