Skip to content

Commit 65d7ed5

Browse files
committed
x86/vector: Add vector domain debugfs support
Add the debug callback for the vector domain, which gives a detailed information about vector usage if invoked for the domain by using rhe matrix allocator debug function and vector/target information when invoked for a particular interrupt. Extra information foir the Vector domain: Online bitmaps: 32 Global available: 6352 Global reserved: 5 Total allocated: 20 System: 41: 0-19,32,50,128,238-255 | CPU | avl | man | act | vectors 0 183 4 19 33-48,51-53 1 199 4 1 33 2 199 4 0 Extra information for interrupts: Vector: 42 Target: 4 This allows a detailed analysis of the vector usage and the association to interrupts and devices. Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Juergen Gross <[email protected]> Tested-by: Yu Chen <[email protected]> Acked-by: Juergen Gross <[email protected]> Cc: Boris Ostrovsky <[email protected]> Cc: Tony Luck <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Alok Kataria <[email protected]> Cc: Joerg Roedel <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: Rui Zhang <[email protected]> Cc: "K. Y. Srinivasan" <[email protected]> Cc: Arjan van de Ven <[email protected]> Cc: Dan Williams <[email protected]> Cc: Len Brown <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 0fa115d commit 65d7ed5

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

arch/x86/kernel/apic/vector.c

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* published by the Free Software Foundation.
1212
*/
1313
#include <linux/interrupt.h>
14+
#include <linux/seq_file.h>
1415
#include <linux/init.h>
1516
#include <linux/compiler.h>
1617
#include <linux/slab.h>
@@ -373,9 +374,54 @@ static int x86_vector_alloc_irqs(struct irq_domain *domain, unsigned int virq,
373374
return err;
374375
}
375376

377+
#ifdef CONFIG_GENERIC_IRQ_DEBUGFS
378+
void x86_vector_debug_show(struct seq_file *m, struct irq_domain *d,
379+
struct irq_data *irqd, int ind)
380+
{
381+
unsigned int cpu, vec, prev_cpu, prev_vec;
382+
struct apic_chip_data *apicd;
383+
unsigned long flags;
384+
int irq;
385+
386+
if (!irqd) {
387+
irq_matrix_debug_show(m, vector_matrix, ind);
388+
return;
389+
}
390+
391+
irq = irqd->irq;
392+
if (irq < nr_legacy_irqs() && !test_bit(irq, &io_apic_irqs)) {
393+
seq_printf(m, "%*sVector: %5d\n", ind, "", ISA_IRQ_VECTOR(irq));
394+
seq_printf(m, "%*sTarget: Legacy PIC all CPUs\n", ind, "");
395+
return;
396+
}
397+
398+
apicd = irqd->chip_data;
399+
if (!apicd) {
400+
seq_printf(m, "%*sVector: Not assigned\n", ind, "");
401+
return;
402+
}
403+
404+
raw_spin_lock_irqsave(&vector_lock, flags);
405+
cpu = apicd->cpu;
406+
vec = apicd->cfg.vector;
407+
prev_cpu = apicd->prev_cpu;
408+
prev_vec = apicd->cfg.old_vector;
409+
raw_spin_unlock_irqrestore(&vector_lock, flags);
410+
seq_printf(m, "%*sVector: %5u\n", ind, "", vec);
411+
seq_printf(m, "%*sTarget: %5u\n", ind, "", cpu);
412+
if (prev_vec) {
413+
seq_printf(m, "%*sPrevious vector: %5u\n", ind, "", prev_vec);
414+
seq_printf(m, "%*sPrevious target: %5u\n", ind, "", prev_cpu);
415+
}
416+
}
417+
#endif
418+
376419
static const struct irq_domain_ops x86_vector_domain_ops = {
377-
.alloc = x86_vector_alloc_irqs,
378-
.free = x86_vector_free_irqs,
420+
.alloc = x86_vector_alloc_irqs,
421+
.free = x86_vector_free_irqs,
422+
#ifdef CONFIG_GENERIC_IRQ_DEBUGFS
423+
.debug_show = x86_vector_debug_show,
424+
#endif
379425
};
380426

381427
int __init arch_probe_nr_irqs(void)

0 commit comments

Comments
 (0)