xen/arm: irq: Initialize the per-CPU IRQs while preparing the CPU
Commit
5047cd1d5dea "xen/common: Use enhanced ASSERT_ALLOC_CONTEXT in
xmalloc()" extended the checks in _xmalloc() to catch any use of the
helpers from context with interrupts disabled.
Unfortunately, the rule is not followed when initializing the per-CPU
IRQs:
(XEN) Xen call trace:
(XEN) [<
002389f4>] _xmalloc+0xfc/0x314 (PC)
(XEN) [<
00000000>]
00000000 (LR)
(XEN) [<
0021a7c4>] init_one_irq_desc+0x48/0xd0
(XEN) [<
002807a8>] irq.c#init_local_irq_data+0x48/0xa4
(XEN) [<
00280834>] init_secondary_IRQ+0x10/0x2c
(XEN) [<
00288fa4>] start_secondary+0x194/0x274
(XEN) [<
40010170>]
40010170
(XEN)
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 2:
(XEN) Assertion '!in_irq() && (local_irq_is_enabled() || num_online_cpus() <= 1)' failed at common/xmalloc_tlsf.c:601
(XEN) ****************************************
This is happening because zalloc_cpumask_var() may allocate memory
if NR_CPUS is > 2 * sizeof(unsigned long).
Avoid the problem by initializing the per-CPU IRQs while preparing the
CPU.
This also has the benefit to remove a BUG_ON() in the secondary CPU
code.
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Michal Orzel <michal.orzel@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Tested-by: Bertrand Marquis <bertrand.marquis@arm.com>