lkml.org 
[lkml]   [2021]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH RFC 1/2] x86/apic: Do not make an exception for PIC_CASCADE_IR when marking legacy irqs in irq_matrix
Date
Trying to offline/online CPU0 seems to work only once:

# echo 0 > /sys/devices/system/cpu/cpu0/online
# echo 1 > /sys/devices/system/cpu/cpu0/online
# echo 0 > /sys/devices/system/cpu/cpu0/online
-bash: echo: write error: No space left on device

with the following in dmesg:

[ ... ] CPU 0 has 4294967295 vectors, 589 available. Cannot disable CPU

Clearly, we went negative with cm->allocated in irq_matrix and think that
there are too many vectors require re-assigning.

The problem turns to be: lapic_assign_system_vectors() called from
native_init_IRQ() makes an exception for PIC_CASCADE_IR and doesn't
mark it in irq_matrix. Later, when x86_vector_alloc_irqs() called
from setup_IO_APIC() does clear_irq_vector() for all legacy entries,
it doesn't make an exception so we go negative.

CPU0 offlining still works for the first time because some other vectors
get assigned and the overall balance remains positive (it's off-by-one, but
the check passes). When we online CPU0 back, no vectors get assigned and
the overall balance remains '-1'.

The simplest solution seems to be to not make an exception for
PIC_CASCADE_IR. Nothing seems to blow up immediately.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
arch/x86/kernel/apic/vector.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c
index 3c9c7492252f..f3aa02ced929 100644
--- a/arch/x86/kernel/apic/vector.c
+++ b/arch/x86/kernel/apic/vector.c
@@ -745,8 +745,7 @@ void __init lapic_assign_system_vectors(void)

/* Mark the preallocated legacy interrupts */
for (i = 0; i < nr_legacy_irqs(); i++) {
- if (i != PIC_CASCADE_IR)
- irq_matrix_assign(vector_matrix, ISA_IRQ_VECTOR(i));
+ irq_matrix_assign(vector_matrix, ISA_IRQ_VECTOR(i));
}
}

--
2.29.2
\
 
 \ /
  Last update: 2021-02-19 12:33    [W:0.733 / U:0.496 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site