interrupts are all about devices that produce data that is written to buffers (ram-like-chips) that need to be processed in a timely manner.
be it keyboard or mouse input buffers. (you don’t want to wait 5minutes before your key-press is causing an effect)
instead of polling the buffers on regular basis – if you press a key a hardware interrupt is triggered – the currently cpu-occupying proess is interrupted (hence the name) – so the cpu is via pointer pointed at a program that processes the interrupt request (IRQ) e.g. read the keyboard-buffer.
note: these are all VMs on Hyper-V on Windows 8 Host ( i am forced to use this here ).
show view get infos about interrupts
uname -a; # tested with Linux debian 3.16.0-4-686-pae #1 SMP Debian 3.16.43-2 (2017-04-30) i686 GNU/Linux cat /proc/interrupts IRQ Number CPU0 0: 21232 IO-APIC-edge timer 1: 9 IO-APIC-edge i8042 <- keyboard controller 6: 5 IO-APIC-edge floppy 4: serial interface (COM-Port) 8: 0 IO-APIC-edge rtc0 <- real time clock 9: 0 IO-APIC-fasteoi acpi 12: 161 IO-APIC-edge i8042 14: 0 IO-APIC-edge ata_piix <- harddisk controller 15: 1261 IO-APIC-edge ata_piix <- harddisk controller NMI: 0 Non-maskable interrupts LOC: 49036 Local timer interrupts SPU: 0 Spurious interrupts PMI: 0 Performance monitoring interrupts IWI: 0 IRQ work interrupts RTR: 0 APIC ICR read retries RES: 0 Rescheduling interrupts CAL: 0 Function call interrupts TLB: 0 TLB shootdowns TRM: 0 Thermal event interrupts THR: 0 Threshold APIC interrupts MCE: 0 Machine check exceptions MCP: 4 Machine check polls HYP: 39750 Hypervisor callback interrupts ERR: 0 MIS: 0 # memory (buffer) areas directly on PCI-card like network-card where data is to be fetched by DMA on interrupt request (CPU needs to command DMA to do so) cat /proc/ioports 0000-0cf7 : PCI Bus 0000:00 0000-001f : dma1 0020-0021 : pic1 0022-0022 : ACPI PM2_CNT_BLK 0040-0043 : timer0 0050-0053 : timer1 0060-0060 : keyboard 0061-0061 : PNP0800:00 0064-0064 : keyboard 0070-0071 : rtc0 0080-008f : dma page reg 00a0-00a1 : pic2 00c0-00df : dma2 00f0-00ff : PNP0C04:00 00f0-00ff : fpu 0160-016f : pnp 00:06 0170-0177 : 0000:00:07.1 0170-0177 : ata_piix 01e0-01ef : pnp 00:06 01f0-01f7 : 0000:00:07.1 01f0-01f7 : ata_piix 0278-027f : pnp 00:06 02f8-02ff : serial 0370-0371 : pnp 00:07 0376-0376 : 0000:00:07.1 0376-0376 : ata_piix 0378-037f : pnp 00:06 03c0-03df : vga+ 03f2-03f2 : floppy 03f4-03f5 : floppy 03f6-03f6 : 0000:00:07.1 03f6-03f6 : ata_piix 03f7-03f7 : floppy 03f8-03ff : serial 0400-043f : 0000:00:07.3 0400-043f : pnp 00:07 0400-0403 : ACPI PM1a_EVT_BLK 0404-0405 : ACPI PM1a_CNT_BLK 0408-040b : ACPI PM_TMR 040c-040f : ACPI GPE0_BLK 0440-044f : pnp 00:07 04d0-04d1 : pnp 00:06 0678-067f : pnp 00:06 0778-077f : pnp 00:06 0cf8-0cff : PCI conf1 0d00-ffff : PCI Bus 0000:00 ffa0-ffaf : 0000:00:07.1 ffa0-ffaf : ata_piix # BusmasterDMA is faster than old DMA (1MByte/sec) # "key pressed" -> written to buffer and CPU is interrupted -> CPU tells DMA to fetch the buffer's content and probably load it to RAM where CPU can process it cat /proc/dma 2: floppy 4: cascade apt-get install procinfo; # nice overview over interrupts watch -n1 "cat /proc/interrupts"; # lets you watch what interrupts are called (refreshes every second) while true; do procinfo; sleep 1; clear; done; # lets you watch what interrupts are called (refreshes every second) # sample output procinfo # example output of Hyper-V Debian8.8 VM procinfo Memory: Total Used Free Buffers RAM: 1030084 478464 551620 25168 Swap: 2094076 0 2094076 Bootup: Thu May 18 15:35:25 2017 Load average: 0.30 0.17 0.18 1/252 2634 user : 00:00:05.48 0.3% page in : 295388 nice : 00:00:00.00 0.0% page out: 36976 system: 00:00:04.24 0.2% page act: 26514 IOwait: 00:00:48.56 2.3% page dea: 0 hw irq: 00:00:00.00 0.0% page flt: 349259 sw irq: 00:00:00.46 0.0% swap in : 0 idle : 00:33:34.61 97.2% swap out: 0 uptime: 00:34:42.42 context : 301154 irq 0: 37932 timer irq 9: 0 acpi irq 1: 9 i8042 irq 12: 161 i8042 irq 6: 5 floppy irq 14: 0 ata_piix irq 8: 0 rtc0 irq 15: 2155 ata_piix fd0 1r 0w sdb 680r 78w sda 9892r 1191w eth0 TX 184.79KiB RX 687.02KiB lo TX 720.00B RX 720.00B procinfo # example output of Hyper-V SUSE12 VM Linux 4.4.21-69-default (geeko@buildhost) (gcc 4.8.5) #1 SMP Tue Oct 25 10:58:20 UTC 2016 (9464f67) 2CPU [suse.(none)] Memory: Total Used Free Shared Buffers Cached Mem: 1007380 941472 65908 0 2076 613724 Swap: 2103292 0 2103292 Bootup: Thu May 18 02:09:02 2017 Load average: 0.01 0.01 0.00 1/255 6522 user : 0:00:43.18 0.0% page in : 485432 disk 1: 12525r 77945w nice : 0:00:00.74 0.0% page out: 3292308 system: 0:00:41.72 0.0% page act: 179857 IOwait: 0:04:07.61 0.2% page dea: 0 hw irq: 0:00:00.00 0.0% page flt: 1151465 sw irq: 0:00:02.69 0.0% swap in : 0 idle : 1d 3:56:16.87 99.5% swap out: 0 uptime: 14:02:00.83 context : 3064037 irq 0: 919819 2-edge timer irq 9: 1 9-fasteoi acpi irq 1: 11 1-edge i8042 irq 12: 163 12-edge i8042 irq 6: 6 6-edge floppy irq 14: 0 14-edge ata_piix irq 8: 0 8-edge rtc0 irq 15: 49499 15-edge ata_piix
show view get info about cpu
cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 42
model name : Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
stepping : 7
microcode : 0xffffffff
cpu MHz : 3392.199
cache size : 8192 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fdiv_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx lm constant_tsc eagerfpu pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx hypervisor lahf_lm xsaveopt
bogomips : 6784.39
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
show view get pci devices
uname -a; # tested with Linux suse 4.4.21-69-default #1 SMP Tue Oct 25 10:58:20 UTC 2016 (9464f67) x86_64 x86_64 x86_64 GNU/Linux suse:/home/user # lspci -vvv 00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (AGP disabled) (rev 03) Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- SERR- Latency: 0 Interrupt: pin A routed to IRQ 11 Region 0: Memory at f8000000 (32-bit, non-prefetchable) [size=64M] Expansion ROM at [disabled] Kernel driver in use: hyperv_fb Kernel modules: hyperv_fb
info about harddisk controller attached devices
this file only exists under SUSE12/CentOS7/RedHat not Debian/Ubuntu.
On recent kernels the /proc/scsi is being “migrated” to sysfs
suse:# cat /proc/scsi/scsi Attached devices: Host: scsi0 Channel: 00 Id: 00 Lun: 00 Vendor: Msft Model: Virtual Disk Rev: 1.0 Type: Direct-Access ANSI SCSI revision: 05 Host: scsi2 Channel: 00 Id: 00 Lun: 00 Vendor: Msft Model: Virtual CD/ROM Rev: 1.0 Type: CD-ROM ANSI SCSI revision: 05 [root@centos user]# cat /proc/scsi/scsi Attached devices: Host: scsi2 Channel: 00 Id: 00 Lun: 00 Vendor: Msft Model: Virtual Disk Rev: 1.0 Type: Direct-Access ANSI SCSI revision: 05 Host: scsi1 Channel: 00 Id: 00 Lun: 00 Vendor: Msft Model: Virtual CD/ROM Rev: 1.0 Type: CD-ROM ANSI SCSI revision: 05
under Debian:
apt-get install lsscsi; lsscsi [1:0:0:0] cd/dvd Msft Virtual CD/ROM 1.0 /dev/sr0 [2:0:0:0] disk Msft Virtual Disk 1.0 /dev/sda [3:0:1:0] disk Msft Virtual Disk 1.0 /dev/sdb ll /sys/class/scsi_host total 0 lrwxrwxrwx 1 root root 0 May 18 16:54 host0 -> ../../devices/pci0000:00/0000:00:07.1/ata1/host0/scsi_host/host0 lrwxrwxrwx 1 root root 0 May 18 16:54 host1 -> ../../devices/pci0000:00/0000:00:07.1/ata2/host1/scsi_host/host1 lrwxrwxrwx 1 root root 0 May 18 16:54 host2 -> ../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/device:07/VMBUS:01/vmbus_0_1/host2/scsi_host/host2 lrwxrwxrwx 1 root root 0 May 18 16:54 host3 -> ../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/device:07/VMBUS:01/vmbus_0_2/host3/scsi_host/host3 lrwxrwxrwx 1 root root 0 May 18 16:54 host4 -> ../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/device:07/VMBUS:01/vmbus_0_6/host4/scsi_host/host4
debian folder /sys/
ll /sys
total 0
drwxr-xr-x 2 root root 0 May 18 16:52 block
drwxr-xr-x 23 root root 0 May 18 16:52 bus
drwxr-xr-x 36 root root 0 May 18 16:52 class
drwxr-xr-x 4 root root 0 May 18 16:52 dev
drwxr-xr-x 15 root root 0 May 18 16:52 devices
drwxr-xr-x 5 root root 0 May 18 16:52 firmware
drwxr-xr-x 7 root root 0 May 18 16:52 fs
drwxr-xr-x 2 root root 0 May 18 16:52 hypervisor
drwxr-xr-x 7 root root 0 May 18 16:52 kernel
drwxr-xr-x 94 root root 0 May 18 16:52 module
drwxr-xr-x 2 root root 0 May 18 16:52 power
Links:
https://en.wikipedia.org/wiki/Direct_memory_access
http://wiki.osdev.org/%228042%22_PS/2_Controller
https://www.cyberciti.biz/faq/howto-display-iros-under-linux/
liked this article?
- only together we can create a truly free world
- plz support dwaves to keep it up & running!
- (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
- really really hate advertisement
- contribute: whenever a solution was found, blog about it for others to find!
- talk about, recommend & link to this blog and articles
- thanks to all who contribute!