irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
/*
|
|
|
|
* irqtop.c - utility to display kernel interrupt information.
|
|
|
|
*
|
|
|
|
* zhenwei pi <pizhenwei@bytedance.com>
|
|
|
|
*
|
|
|
|
* Copyright (C) 2019 zhenwei pi
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2020-01-03 21:06:43 +00:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <getopt.h>
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
#include <limits.h>
|
|
|
|
#include <locale.h>
|
2020-01-03 21:06:43 +00:00
|
|
|
#include <signal.h>
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
#include <stdio.h>
|
2020-01-03 21:06:43 +00:00
|
|
|
#include <stdlib.h>
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
#include <string.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/select.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/types.h>
|
2020-01-03 21:06:43 +00:00
|
|
|
#include <termios.h>
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
#include <unistd.h>
|
|
|
|
|
2020-01-03 21:06:43 +00:00
|
|
|
#ifdef HAVE_SLCURSES_H
|
|
|
|
# include <slcurses.h>
|
|
|
|
#elif defined(HAVE_SLANG_SLCURSES_H)
|
|
|
|
# include <slang/slcurses.h>
|
|
|
|
#elif defined(HAVE_NCURSESW_NCURSES_H) && defined(HAVE_WIDECHAR)
|
|
|
|
# include <ncursesw/ncurses.h>
|
|
|
|
#elif defined(HAVE_NCURSES_H)
|
|
|
|
# include <ncurses.h>
|
|
|
|
#elif defined(HAVE_NCURSES_NCURSES_H)
|
|
|
|
# include <ncurses/ncurses.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_WIDECHAR
|
|
|
|
# include <wctype.h>
|
|
|
|
# include <wchar.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "c.h"
|
|
|
|
#include "closestream.h"
|
2020-01-04 07:45:43 +00:00
|
|
|
#include "monotonic.h"
|
2020-01-03 21:06:43 +00:00
|
|
|
#include "nls.h"
|
|
|
|
#include "pathnames.h"
|
2020-01-04 08:32:42 +00:00
|
|
|
#include "strutils.h"
|
2020-01-04 07:33:01 +00:00
|
|
|
#include "ttyutils.h"
|
2020-01-04 07:40:49 +00:00
|
|
|
#include "xalloc.h"
|
2020-01-03 21:06:43 +00:00
|
|
|
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
#define DEF_SORT_FUNC sort_count
|
|
|
|
#define IRQ_NAME_LEN 4
|
|
|
|
#define IRQ_DESC_LEN 64
|
|
|
|
#define IRQ_INFO_LEN 64
|
|
|
|
#define RESERVE_ROWS (1 + 1 + 1) /* summary + header + last row */
|
|
|
|
|
|
|
|
struct irq_info {
|
2020-01-03 21:06:43 +00:00
|
|
|
char irq[IRQ_NAME_LEN + 1]; /* name of this irq */
|
|
|
|
char desc[IRQ_DESC_LEN + 1]; /* description of this irq */
|
|
|
|
unsigned long count; /* count of this irq for all cpu(s) */
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct irq_stat {
|
2020-01-03 21:06:43 +00:00
|
|
|
unsigned int nr_irq; /* number of irq vector */
|
2019-12-25 17:56:07 +08:00
|
|
|
unsigned int nr_irq_info; /* number of irq info */
|
|
|
|
struct irq_info *irq_info; /* array of irq_info */
|
2020-01-03 21:06:43 +00:00
|
|
|
long nr_online_cpu; /* number of online cpu */
|
|
|
|
long nr_active_cpu; /* number of active cpu */
|
|
|
|
unsigned long total_irq; /* total irqs */
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
};
|
|
|
|
|
2020-01-04 08:08:17 +00:00
|
|
|
struct irqtop_ctl {
|
|
|
|
WINDOW *win;
|
|
|
|
int cols;
|
|
|
|
int rows;
|
2020-01-04 08:32:42 +00:00
|
|
|
struct timeval delay;
|
2020-01-04 08:08:17 +00:00
|
|
|
int (*sort_func)(const struct irq_info *, const struct irq_info *);
|
|
|
|
long smp_num_cpus;
|
|
|
|
unsigned int
|
2020-01-04 08:32:42 +00:00
|
|
|
request_exit:1,
|
2020-01-04 08:08:17 +00:00
|
|
|
run_once:1;
|
|
|
|
};
|
|
|
|
static struct irqtop_ctl *gctl;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* irqinfo - parse the system's interrupts
|
|
|
|
*/
|
2020-01-04 08:08:17 +00:00
|
|
|
static struct irq_stat *get_irqinfo(struct irqtop_ctl *ctl)
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
{
|
|
|
|
FILE *irqfile;
|
|
|
|
char *buffer, *tmp;
|
|
|
|
long bufferlen;
|
|
|
|
struct irq_stat *stat;
|
|
|
|
struct irq_info *curr;
|
|
|
|
|
|
|
|
/* NAME + ':' + 11 bytes/cpu + IRQ_DESC_LEN */
|
2020-01-04 08:08:17 +00:00
|
|
|
bufferlen = IRQ_NAME_LEN + 1 + ctl->smp_num_cpus * 11 + IRQ_DESC_LEN;
|
2020-01-04 07:40:49 +00:00
|
|
|
buffer = xmalloc(bufferlen);
|
|
|
|
stat = xcalloc(1, sizeof(*stat));
|
2020-01-03 21:06:43 +00:00
|
|
|
|
2020-01-04 07:40:49 +00:00
|
|
|
stat->irq_info = xmalloc(sizeof(*stat->irq_info) * IRQ_INFO_LEN);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
stat->nr_irq_info = IRQ_INFO_LEN;
|
|
|
|
|
2020-01-03 21:06:43 +00:00
|
|
|
irqfile = fopen(_PATH_PROC_INTERRUPTS, "r");
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
if (!irqfile) {
|
2020-01-03 21:06:43 +00:00
|
|
|
warn(_("cannot open %s"), _PATH_PROC_INTERRUPTS);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
goto free_stat;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read header firstly */
|
|
|
|
if (!fgets(buffer, bufferlen, irqfile)) {
|
2020-01-03 21:06:43 +00:00
|
|
|
warn(_("cannot read %s"), _PATH_PROC_INTERRUPTS);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
goto close_file;
|
|
|
|
}
|
|
|
|
|
2020-01-04 08:08:17 +00:00
|
|
|
stat->nr_online_cpu = ctl->smp_num_cpus;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
tmp = buffer;
|
|
|
|
while ((tmp = strstr(tmp, "CPU")) != NULL) {
|
|
|
|
tmp += 3; /* skip this "CPU", find next */
|
|
|
|
stat->nr_active_cpu++;
|
|
|
|
}
|
|
|
|
|
2020-01-03 21:06:43 +00:00
|
|
|
/* parse each line of _PATH_PROC_INTERRUPTS */
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
while (fgets(buffer, bufferlen, irqfile)) {
|
|
|
|
unsigned long count;
|
|
|
|
int index, length;
|
|
|
|
|
|
|
|
tmp = strchr(buffer, ':');
|
|
|
|
if (!tmp)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
length = strlen(buffer);
|
|
|
|
if (length < IRQ_NAME_LEN + 1 || tmp - buffer > IRQ_NAME_LEN)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
curr = stat->irq_info + stat->nr_irq++;
|
2020-01-04 07:40:49 +00:00
|
|
|
memset(curr, 0, sizeof(*curr));
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
memcpy(curr->irq, buffer, tmp - buffer);
|
|
|
|
|
|
|
|
tmp += 1;
|
2020-01-03 21:06:43 +00:00
|
|
|
for (index = 0; (index < stat->nr_active_cpu) && (tmp - buffer < length); index++) {
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
sscanf(tmp, " %10lu", &count);
|
|
|
|
curr->count += count;
|
|
|
|
stat->total_irq += count;
|
|
|
|
tmp += 11;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tmp - buffer < length) {
|
|
|
|
/* strip all space before desc */
|
2020-01-03 21:06:43 +00:00
|
|
|
while (*tmp == ' ')
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
tmp++;
|
|
|
|
strcpy(curr->desc, tmp);
|
|
|
|
} else {
|
|
|
|
/* no desc string at all, we have to set '\n' here */
|
|
|
|
curr->desc[0] = '\n';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (stat->nr_irq == stat->nr_irq_info) {
|
|
|
|
stat->nr_irq_info *= 2;
|
2020-01-04 07:40:49 +00:00
|
|
|
stat->irq_info = xrealloc(stat->irq_info,
|
|
|
|
sizeof(*stat->irq_info) * stat->nr_irq_info);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
}
|
|
|
|
}
|
2020-01-04 09:35:19 +00:00
|
|
|
fclose(irqfile);
|
|
|
|
free(buffer);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
return stat;
|
|
|
|
|
2020-01-03 21:06:43 +00:00
|
|
|
close_file:
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
fclose(irqfile);
|
2020-01-03 21:06:43 +00:00
|
|
|
free_stat:
|
2020-01-04 07:40:49 +00:00
|
|
|
free(stat->irq_info);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
free(stat);
|
|
|
|
free(buffer);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void put_irqinfo(struct irq_stat *stat)
|
|
|
|
{
|
|
|
|
if (stat)
|
|
|
|
free(stat->irq_info);
|
|
|
|
free(stat);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int sort_name(const struct irq_info *a, const struct irq_info *b)
|
|
|
|
{
|
|
|
|
return (strcmp(a->irq, b->irq) > 0) ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int sort_count(const struct irq_info *a, const struct irq_info *b)
|
|
|
|
{
|
|
|
|
return a->count < b->count;
|
|
|
|
}
|
|
|
|
|
2020-01-03 21:06:43 +00:00
|
|
|
static int sort_interrupts(const struct irq_info *a __attribute__((__unused__)),
|
|
|
|
const struct irq_info *b __attribute__((__unused__)))
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-01-04 08:08:17 +00:00
|
|
|
static void sort_result(struct irqtop_ctl *ctl, struct irq_info *result, size_t nmemb)
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
{
|
2020-01-04 08:08:17 +00:00
|
|
|
qsort(result, nmemb, sizeof(*result), (int (*)(const void *, const void *))ctl->sort_func);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
}
|
|
|
|
|
2020-01-03 21:06:43 +00:00
|
|
|
static void term_size(int unusused __attribute__((__unused__)))
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
{
|
2020-01-04 08:08:17 +00:00
|
|
|
get_terminal_dimension(&gctl->cols, &gctl->rows);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
}
|
|
|
|
|
2020-01-03 21:06:43 +00:00
|
|
|
static void sigint_handler(int unused __attribute__((__unused__)))
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
{
|
2020-01-04 08:32:42 +00:00
|
|
|
gctl->request_exit = 1;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
}
|
|
|
|
|
2020-01-03 21:06:43 +00:00
|
|
|
static void __attribute__((__noreturn__)) usage(void)
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
{
|
2020-01-03 21:06:43 +00:00
|
|
|
fputs(USAGE_HEADER, stdout);
|
|
|
|
printf(_(" %s [options]\n"), program_invocation_short_name);
|
|
|
|
|
|
|
|
fputs(USAGE_SEPARATOR, stdout);
|
|
|
|
puts(_("Utility to display kernel interrupt information."));
|
|
|
|
|
|
|
|
fputs(USAGE_OPTIONS, stdout);
|
|
|
|
fputs(_(" -d, --delay <secs> delay updates\n"), stdout);
|
|
|
|
fputs(_(" -o, --once only display average irq once, then exit\n"), stdout);
|
|
|
|
fputs(_(" -s, --sort <char> specify sort criteria by character (see below)\n"), stdout);
|
|
|
|
fputs(USAGE_SEPARATOR, stdout);
|
|
|
|
printf(USAGE_HELP_OPTIONS(21));
|
|
|
|
fputs(_("\nThe following are valid sort criteria:\n"), stdout);
|
|
|
|
fputs(_(" c: sort by increase count of each interrupt\n"), stdout);
|
|
|
|
fputs(_(" i: sort by default interrupts from proc interrupt\n"), stdout);
|
|
|
|
fputs(_(" n: sort by name\n"), stdout);
|
|
|
|
printf(USAGE_MAN_TAIL("irqtop(1)"));
|
|
|
|
exit(EXIT_SUCCESS);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
}
|
|
|
|
|
2020-01-03 21:06:43 +00:00
|
|
|
static void *set_sort_func(char key)
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
{
|
|
|
|
switch (key) {
|
|
|
|
case 'c':
|
2020-01-03 21:06:43 +00:00
|
|
|
return (void *)sort_count;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
case 'i':
|
2020-01-03 21:06:43 +00:00
|
|
|
return (void *)sort_interrupts;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
case 'n':
|
2020-01-03 21:06:43 +00:00
|
|
|
return (void *)sort_name;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
default:
|
2020-01-03 21:06:43 +00:00
|
|
|
return (void *)DEF_SORT_FUNC;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-04 08:08:17 +00:00
|
|
|
static void parse_input(struct irqtop_ctl *ctl, char c)
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
{
|
2020-01-03 21:06:43 +00:00
|
|
|
switch (c) {
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
case 'c':
|
2020-01-04 08:08:17 +00:00
|
|
|
ctl->sort_func = sort_count;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
break;
|
|
|
|
case 'i':
|
2020-01-04 08:08:17 +00:00
|
|
|
ctl->sort_func = sort_interrupts;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
break;
|
|
|
|
case 'n':
|
2020-01-04 08:08:17 +00:00
|
|
|
ctl->sort_func = sort_name;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
break;
|
|
|
|
case 'q':
|
|
|
|
case 'Q':
|
2020-01-04 08:32:42 +00:00
|
|
|
ctl->request_exit = 1;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-04 07:33:01 +00:00
|
|
|
static inline size_t choose_smaller(size_t a, size_t b)
|
|
|
|
{
|
|
|
|
if (a < b)
|
|
|
|
return a;
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
|
2020-01-04 08:08:17 +00:00
|
|
|
static inline void print_line(struct irqtop_ctl *ctl, const char *fmt, ...)
|
2020-01-04 07:33:01 +00:00
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
va_start(args, fmt);
|
2020-01-04 08:08:17 +00:00
|
|
|
if (ctl->run_once)
|
2020-01-04 07:33:01 +00:00
|
|
|
vprintf(fmt, args);
|
|
|
|
else {
|
2020-01-04 08:08:17 +00:00
|
|
|
vw_printw(ctl->win, fmt, args);
|
2020-01-04 07:33:01 +00:00
|
|
|
}
|
|
|
|
va_end(args);
|
|
|
|
}
|
|
|
|
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
int is_tty, o;
|
|
|
|
unsigned short old_rows;
|
|
|
|
struct irq_stat *stat, *last_stat = NULL;
|
2020-01-04 07:45:43 +00:00
|
|
|
struct timeval uptime_tv;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
int retval = EXIT_SUCCESS;
|
2020-01-04 08:08:17 +00:00
|
|
|
struct termios saved_tty;
|
2020-01-04 08:32:42 +00:00
|
|
|
struct irqtop_ctl ctl = { .delay.tv_sec = 3 };
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
|
|
|
|
static const struct option longopts[] = {
|
2020-01-03 21:06:43 +00:00
|
|
|
{"delay", required_argument, NULL, 'd'},
|
|
|
|
{"sort", required_argument, NULL, 's'},
|
|
|
|
{"once", no_argument, NULL, 'o'},
|
|
|
|
{"help", no_argument, NULL, 'h'},
|
|
|
|
{"version", no_argument, NULL, 'V'},
|
|
|
|
{NULL, 0, NULL, 0}
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
};
|
|
|
|
|
2020-01-04 08:08:17 +00:00
|
|
|
/* FIXME; use signalfd */
|
|
|
|
gctl = &ctl;
|
|
|
|
|
2020-01-03 21:06:43 +00:00
|
|
|
setlocale(LC_ALL, "");
|
2020-01-04 08:08:17 +00:00
|
|
|
ctl.sort_func = DEF_SORT_FUNC;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
|
|
|
|
while ((o = getopt_long(argc, argv, "d:os:hV", longopts, NULL)) != -1) {
|
|
|
|
switch (o) {
|
|
|
|
case 'd':
|
2020-01-04 08:32:42 +00:00
|
|
|
strtotimeval_or_err(optarg, &ctl.delay,
|
|
|
|
_("failed to parse delay argument"));
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
break;
|
|
|
|
case 's':
|
2020-01-04 08:08:17 +00:00
|
|
|
ctl.sort_func = (int (*)(const struct irq_info *, const struct irq_info *))
|
|
|
|
set_sort_func(optarg[0]);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
break;
|
|
|
|
case 'o':
|
2020-01-04 08:08:17 +00:00
|
|
|
ctl.run_once = 1;
|
2020-01-04 08:32:42 +00:00
|
|
|
ctl.request_exit = 1;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
break;
|
|
|
|
case 'V':
|
2020-01-03 21:06:43 +00:00
|
|
|
print_version(EXIT_SUCCESS);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
case 'h':
|
2020-01-03 21:06:43 +00:00
|
|
|
usage();
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
default:
|
2020-01-03 21:06:43 +00:00
|
|
|
usage();
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
is_tty = isatty(STDIN_FILENO);
|
|
|
|
if (is_tty && tcgetattr(STDIN_FILENO, &saved_tty) == -1)
|
2020-01-03 21:06:43 +00:00
|
|
|
fputs(_("terminal setting retrieval"), stdout);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
|
2020-01-04 08:08:17 +00:00
|
|
|
old_rows = ctl.rows;
|
|
|
|
get_terminal_dimension(&ctl.cols, &ctl.rows);
|
|
|
|
if (!ctl.run_once) {
|
|
|
|
ctl.win = initscr();
|
|
|
|
get_terminal_dimension(&ctl.cols, &ctl.rows);
|
|
|
|
resizeterm(ctl.rows, ctl.cols);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
signal(SIGWINCH, term_size);
|
|
|
|
}
|
|
|
|
signal(SIGINT, sigint_handler);
|
|
|
|
|
2020-01-04 08:08:17 +00:00
|
|
|
ctl.smp_num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
|
2020-01-04 07:45:43 +00:00
|
|
|
gettime_monotonic(&uptime_tv);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
|
|
|
|
do {
|
|
|
|
struct irq_info *result, *curr;
|
|
|
|
size_t size;
|
|
|
|
fd_set readfds;
|
|
|
|
char c;
|
2020-01-03 21:06:43 +00:00
|
|
|
size_t index;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
|
2020-01-04 08:08:17 +00:00
|
|
|
stat = get_irqinfo(&ctl);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
if (!stat) {
|
|
|
|
retval = EXIT_FAILURE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-01-04 08:08:17 +00:00
|
|
|
if (!ctl.run_once && old_rows != ctl.rows) {
|
|
|
|
resizeterm(ctl.rows, ctl.cols);
|
|
|
|
old_rows = ctl.rows;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
move(0, 0);
|
|
|
|
|
|
|
|
/* summary stat */
|
2020-01-04 08:08:17 +00:00
|
|
|
print_line(&ctl, "irqtop - IRQ : %d, TOTAL : %ld, CPU : %ld, "
|
2020-01-03 21:06:43 +00:00
|
|
|
"ACTIVE CPU : %ld\n", stat->nr_irq, stat->total_irq,
|
|
|
|
stat->nr_online_cpu, stat->nr_active_cpu);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
|
|
|
|
/* header */
|
|
|
|
attron(A_REVERSE);
|
2020-01-04 08:08:17 +00:00
|
|
|
print_line(&ctl, "%-80s\n", " IRQ COUNT DESC ");
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
attroff(A_REVERSE);
|
|
|
|
|
|
|
|
size = sizeof(*stat->irq_info) * stat->nr_irq;
|
2020-01-04 07:40:49 +00:00
|
|
|
result = xmalloc(size);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
memcpy(result, stat->irq_info, size);
|
|
|
|
if (!last_stat) {
|
2020-01-03 21:06:43 +00:00
|
|
|
|
|
|
|
for (index = 0; index < stat->nr_irq; index++) {
|
|
|
|
curr = result + index;
|
2020-01-04 07:45:43 +00:00
|
|
|
curr->count /= uptime_tv.tv_sec;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
}
|
|
|
|
last_stat = stat;
|
|
|
|
} else {
|
2020-01-03 21:06:43 +00:00
|
|
|
size_t i, j;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
|
|
|
|
for (i = 0; i < stat->nr_irq; i++) {
|
|
|
|
struct irq_info *found = NULL;
|
|
|
|
unsigned long diff = 0;
|
|
|
|
|
|
|
|
curr = result + i;
|
|
|
|
for (j = 0; j < last_stat->nr_irq; j++) {
|
|
|
|
struct irq_info *prev = last_stat->irq_info + j;
|
|
|
|
|
|
|
|
if (!strcmp(curr->irq, prev->irq))
|
|
|
|
found = prev;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (found && curr->count >= found->count)
|
|
|
|
diff = curr->count - found->count;
|
|
|
|
else
|
|
|
|
diff = curr->count;
|
|
|
|
|
|
|
|
curr->count = diff;
|
|
|
|
}
|
|
|
|
put_irqinfo(last_stat);
|
|
|
|
|
|
|
|
last_stat = stat;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* okay, sort and show the result */
|
2020-01-04 08:08:17 +00:00
|
|
|
sort_result(&ctl, result, stat->nr_irq);
|
|
|
|
for (index = 0; index < choose_smaller(ctl.rows - RESERVE_ROWS, stat->nr_irq); index++) {
|
2020-01-03 21:06:43 +00:00
|
|
|
curr = result + index;
|
2020-01-04 08:08:17 +00:00
|
|
|
print_line(&ctl, "%4s %10ld %s", curr->irq, curr->count, curr->desc);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
}
|
|
|
|
free(result);
|
|
|
|
|
2020-01-04 08:08:17 +00:00
|
|
|
if (ctl.run_once) {
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
break;
|
|
|
|
} else {
|
2020-01-04 08:32:42 +00:00
|
|
|
/* copy timeval, select will overwrite the value */
|
|
|
|
struct timeval tv = ctl.delay;
|
|
|
|
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
refresh();
|
|
|
|
FD_ZERO(&readfds);
|
|
|
|
FD_SET(STDIN_FILENO, &readfds);
|
|
|
|
if (select(STDOUT_FILENO, &readfds, NULL, NULL, &tv) > 0) {
|
|
|
|
if (read(STDIN_FILENO, &c, 1) != 1)
|
|
|
|
break;
|
2020-01-04 08:08:17 +00:00
|
|
|
parse_input(&ctl, c);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
}
|
|
|
|
}
|
2020-01-04 08:32:42 +00:00
|
|
|
} while (!ctl.request_exit);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
|
|
|
|
put_irqinfo(last_stat);
|
|
|
|
|
|
|
|
if (is_tty)
|
|
|
|
tcsetattr(STDIN_FILENO, TCSAFLUSH, &saved_tty);
|
|
|
|
|
2020-01-04 09:35:19 +00:00
|
|
|
if (ctl.win) {
|
|
|
|
delwin(ctl.win);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
endwin();
|
2020-01-04 09:35:19 +00:00
|
|
|
}
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 20:48:59 +08:00
|
|
|
return retval;
|
|
|
|
}
|