Interrupt Affinityについて

Interrupt Affinityについて

C5c954985fb774ff7731dbb0cfc27f89?s=128

Takuya ASADA

June 28, 2014
Tweet

Transcript

  1. 4.

    $ cat /proc/interrupts CPU0 CPU1 0: 36843 61973 IO-APIC-edge timer

    1: 518 591 IO-APIC-edge i8042 8: 1 0 IO-APIC-edge rtc0 9: 387 321 IO-APIC-fasteoi acpi 12: 11236 79 IO-APIC-edge i8042 16: 0 0 IO-APIC-fasteoi uhci_hcd:usb6 17: 12 11 IO-APIC-fasteoi uhci_hcd:usb7 18: 0 0 IO-APIC-fasteoi uhci_hcd:usb8 19: 6531 235 IO-APIC-fasteoi ehci_hcd:usb2 20: 0 0 IO-APIC-fasteoi uhci_hcd:usb3 21: 85 69 IO-APIC-fasteoi uhci_hcd:usb4 22: 0 0 IO-APIC-fasteoi uhci_hcd:usb5 23: 20 15 IO-APIC-fasteoi ehci_hcd:usb1 40: 0 0 PCI-MSI-edge PCIe PME, pciehp 41: 0 0 PCI-MSI-edge PCIe PME, pciehp 42: 0 0 PCI-MSI-edge PCIe PME, pciehp 43: 33199 31756 PCI-MSI-edge ahci 44: 19 1583 PCI-MSI-edge eth0 45: 10 11 PCI-MSI-edge mei 46: 41104 59303 PCI-MSI-edge i915 47: 170268 708 PCI-MSI-edge iwlwifi 48: 78 77 PCI-MSI-edge snd_hda_intel NMI: 1406 1430 Non-maskable interrupts $16ຖͷׂΓࠐΈ౷ܭΛදࣔ /proc/interrupts
  2. 10.

    MultiQueue NICͷׂΓࠐΈ $16ຖʹૹड৴ΩϡʔɺΩϡʔຖʹ .4*9ׂΓࠐΈΛ࣋ͭ ਖ਼͍͠TNQ@B⒏OJUZ͸ݻఆతʹܾ·ͬ ͍ͯΔ ෳ਺$16΁ࢄΒͯ͠͸ͳΒͳ͍ 47: 7602 0

    0 0 0 3 23 0 PCI-MSI-edge p1p1-TxRx-0 48: 0 7602 0 0 0 0 13 12 PCI-MSI-edge p1p1-TxRx-1 49: 12 0 7605 0 0 0 10 0 PCI-MSI-edge p1p1-TxRx-2 50: 0 12 0 7602 3 0 10 0 PCI-MSI-edge p1p1-TxRx-3 51: 0 0 12 0 7602 3 10 0 PCI-MSI-edge p1p1-TxRx-4 52: 0 0 0 20 0 7602 13 0 PCI-MSI-edge p1p1-TxRx-5 53: 0 0 0 0 12 0 7612 3 PCI-MSI-edge p1p1-TxRx-6 54: 3 0 0 0 0 13 10 7602 PCI-MSI-edge p1p1-TxRx-7 55: 0 2 0 0 0 0 2 0 PCI-MSI-edge p1p1
  3. 13.

    PC্ͷׂΓࠐΈίϯϙʔωϯτ CPU Local APIC CPU Local APIC CPU Local APIC

    ICH 8259A PIC Timer I/O APIC Legacy PCI Devices MSI(-X) Capable Devices IPI Legacy PCI 8259A Intr MSI(-X) PCI-LPC bridge SuperIO Chip
  4. 14.

    Local APIC $16ຖͷׂΓࠐΈίϯτϩʔϥɹׂΓࠐΈΛڐՄɾϚεΫ͠ ͨΓɺ&0*ͨ͠Γ γεςϜશମͰҰҙͳ"1*$*%Λ࣋ͭ ଞͷ-"1*$΁ׂΓࠐΊΔʢ*1**OUFSQSPDFTTPS*OUFSSVQU CPU Local APIC CPU

    Local APIC CPU Local APIC ICH 8259A PIC Timer I/O APIC Legacy PCI Devices MSI(-X) Capable Devices IPI Legacy PCI 8259A Intr MSI(-X) PCI-LPC bridge SuperIO Chip
  5. 24.

    ϨΨγσόΠε ϨΨγσόΠε͔ΒͷׂΓࠐΈΛ1$*-1$CSJEHFͰ1$*΁ม׵ 1$*σόΠεಉ༷ʹ*0"1*$Λ௨ͯ͡-"1*$΁ׂΓࠐΈϝοηʔ δΛૹ৴ ޓ׵ੑͷͨΊ"ʹ΋઀ଓ͞Ε͍ͯΔͱࢥΘΕΔ CPU Local APIC CPU Local

    APIC CPU Local APIC ICH 8259A PIC Timer I/O APIC Legacy PCI Devices MSI(-X) Capable Devices IPI Legacy PCI 8259A Intr MSI(-X) PCI-LPC bridge SuperIO Chip
  6. 26.

    MSI(-X) capable PCI devices ֤σόΠε͕೚ҙͷ਺ͷ*32Λ࣋ͯΔ ֤*32ͷׂΓࠐΈઌ-"1*$͸1$*σόΠεͷ1$* $POpHVSBUJPO4QBDFʹ࣋ͭ 1$*σόΠε͸௚઀-"1*$΁ׂΓࠐΈϝοηʔδΛૹ৴ CPU Local

    APIC CPU Local APIC CPU Local APIC ICH 8259A PIC Timer I/O APIC Legacy PCI Devices MSI(-X) Capable Devices IPI Legacy PCI 8259A Intr MSI(-X) PCI-LPC bridge SuperIO Chip
  7. 27.

    MSI Capability on
 PCI configuration space Device ID Vendor ID

    … Reserved Cap. Pointer … Capability x CAP ID(x) Next Pointer … Capability y CAP ID(yy) Next Pointer … MSICTL CAP ID(D0h) Next Pointer MSIAR MSIDR
  8. 38.

    σʔλγʔτ *OUFMšBOE*""SDIJUFDUVSFT4PGUXBSF%FWFMPQFS .BOVBMT
 *OUFSSVQU$PNNBOE3FHJTUFS *$3 
 1IZTJDBM%FTUJOBUJPO.PEF
 -PHJDBM%FTUJOBUJPO.PEF
 -PXFTU1SJPSJUZ%FMJWFSZ.PEF *OUFMš"SDIJUFDUVSFY"1*$4QFDJpDBUJPO


    -PHJDBM%FTUJOBUJPO3FHJTUFS *OUFMš*0$POUSPMMFS)VC *$) 'BNJMZ%BUBTIFFU
 "VUPNBUJD3PUBUJPO.PEF &RVBM1SJPSJUZ%FWJDFT 
 4QFDJpD3PUBUJPO.PEF 4QFDJpD1SJPSJUZ 
  9. 40.

    # lspci -vvvv -s 00:19.0 00:19.0 Ethernet controller: Intel Corporation

    82567LM Gigabit Network Connection (rev 03) Subsystem: Lenovo Device 20ee Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx+ Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 0 Interrupt: pin A routed to IRQ 44 Region 0: Memory at f2600000 (32-bit, non-prefetchable) [size=128K] Region 1: Memory at f2625000 (32-bit, non-prefetchable) [size=4K] Region 2: I/O ports at 1840 [size=32] Capabilities: [c8] Power Management version 2 Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+) Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=1 PME- Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+ Address: 00000000fee0300c Data: 41b9 Capabilities: [e0] PCI Advanced Features AFCap: TP+ FLR+ AFCtrl: FLR- AFStatus: TP- Kernel driver in use: e1000e Kernel modules: e1000e ੺͘ృͬͨॴ͕.4*ͷϑΟʔϧυ͕ͩɺ͜Εͩ ͱಡΊͳ͍ͷͰMTQDJΛGPSLͯ͠.4*ϑΟʔϧ υΛදࣔ͢ΔπʔϧΛ࡞੒
 IUUQTHJTUHJUIVCDPN
  10. 41.

    # gcc -lpci msireg.c! # ./a.out 00:19.0! Message Signalled Interrupts:

    64bit+ Queue=0/0 Enable+! address_hi=0! address_lo=fee0300c dest_mode=logical redirection=lowpri dest_id=3! data=41b9 trigger=edge level=assert delivery_mode=lowpri vector=185 -PHJDBMNPEFͰ-PXQSJɺEFTUJEɺ WFDUPSʹͳ͍ͬͯΔ # echo 1 > /proc/irq/44/smp_affinity! # ./a.out 00:19.0! Message Signalled Interrupts: 64bit+ Queue=0/0 Enable+! address_hi=0! address_lo=fee0100c dest_mode=logical redirection=lowpri dest_id=1! data=41b9 trigger=edge level=assert delivery_mode=lowpri vector=185 EFTU@JE͕ʹॻ͖׵Θͬͨ
  11. 43.

    OSॳظԽ࣌ͷׂΓࠐΈϞʔυઃఆ ؀ڥʹΑͬͯҟͳΔυϥΠόΛ࢖༻
 BSDIYLFSOFMBQJDBQJD@qBU@D YBQJD@DMVTUFSD  YBQJD@QIZTDʜ BQJD@qBUʢඇYBQJDϞʔυʣ
 %FMJWFSZ.PEF-PX1SJ
 %FTUJOBUJPO.PEF-PHJDBM BQJD@QIZTqBUʢඇYBQJDϞʔυ

    $164ʣ
 %FMJWFSZ.PEF'JYFE
 %FTUJOBUJPO.PEF1IZTJDBM BQJD@YBQJD@QIZTʢYBQJDϞʔυ "$1*Ͱ1IZTJDBMϞʔυࢦఆʣ
 ಉ্ ϥ΢ϯυϩϏϯׂΓࠐΈͰ͖Δ؀ڥ͸Ұఆ৚݅Λຬͨͨ͠৔߹ͷΈ