Re: [RFC PATCH] x86/apic: Fix BUG due to multiple allocation of legacy vectors.

From: Thomas Gleixner
Date: Thu May 20 2021 - 04:17:42 EST


Imran,

On Wed, May 19 2021 at 23:39, Imran Khan wrote:
> During activation of secondary CPUs, lapic_online is
> invoked to initialize vectors. While lapic_online
> installs legacy vectors on all CPUs, it does not set
> the corresponding bits in per CPU bitmap maintained
> under irq_matrix.
> This may result in these legacy vectors getting allocated
> by irq_matrix_alloc and if that happens subsequent invocation
> of apic_update_vector will cause BUG like the one shown below:
>
> [ 154.738226] kernel BUG at arch/x86/kernel/apic/vector.c:172!

please trim the backtrace. It's not really relevant for understanding
the problem.

> This patch marks these legacy vectors as assigned in irq_matrix

git grep 'This patch' Documentation/process/

> so that corresponding bits in percpu bitmaps get set and these
> legacy vectors don't get reallocted.

This is just wrong.

True legacy interrupts (PIC delivery) are marked as system vectors. See
lapic_assign_legacy_vector(). That prevents them from being allocated.

> [ 154.858092] CPU: 22 PID: 3569 Comm: ifup-eth Not tainted 5.8.0-20200716.x86_64 #1

I have no idea what this 5.8.0-magic-date kernel is.

Have you verified that this problem exists with upstream?

Thanks,

tglx