x2APICã¨interrupt remapping
以åIOAPICãMSI/MSI-Xãå©ç¨ããããã¤ã¹ã§x2apicãå©ç¨ããã«ã¯interrupt remapingãå©ç¨ããã¨æ¸ãã¾ããï¼
ä»åå®éã®ãããã³ã°ã調ã¹ããã¨ããã£ãã®ã§ï¼ããã«è¦ç¹ãã¾ã¨ãã¾ãï¼ å³ã¯VT-dã®ããã¥ã¡ã³ãããã®å¼ç¨ã§ãï¼
åæ
Interrupt Remappingã®ãµãã¼ãã¯VT-dã¬ã¸ã¹ã¿ã®Extended Capability Registerã®3bitç®(IR: Interrupt Remapping support)ã§ç¤ºããã¾ãï¼
VT-dã¬ã¸ã¹ã¿ã®ã¢ãã¬ã¹ã¯ACPIã®DMARã®DRHDã«è¨è¼ããã¦ãã¾ãï¼
ã¾ãVT-dã¬ã¸ã¹ã¿ã®Global Command Register (18h)ã®IRE: Interrupt Remapping Enableãå©ç¨ãã¦Interupt remapingãæå¹åãã¾ãï¼
Interrupt Remappingã®è¨å®
Interrupt Remappingãå©ç¨ããã«ã¯ï¼ä»¥ä¸ã®è¨å®ãå¿ è¦ã§ãï¼
ããã¤ã¹å´
MSI/MSI-Xãå©ç¨ããããã¤ã¹ã¯ï¼å²ãè¾¼ã¿ãçæããã¨ãã«ï¼ä»¥ä¸ã«ç¤ºã"Remappable Format Interrut Request"ã§MSIãè¨å®ãã¾ãï¼
é常ã®MSIã¨ç°ãªãï¼å²ãè¾¼ã¿ã¢ãã¬ã¹ã«å²ãè¾¼ã¿ãã¯ã¿çªå·ãdestination IDã¯ã¨ã³ã³ã¼ãããã¦ãã¾ããï¼Interrupt indexã§æ¬¡ã«èª¬æããInterrupt remapping table entryã®ã¤ã³ããã¯ã¹ãæå®ãã¾ãï¼
ï¼ããããåããããã«ï¼Interrupt Remappingãå©ç¨ããå ´åã«ã¯ï¼ããã¤ã¹ã®æ¹ã®å²ãè¾¼ã¿è¨å®ãé©åã«è¨å®ããå¿ è¦ãããã¾ãï¼ããã¤ã¹è¨å®ã«ééã§interrupt remappingãå©ç¨ãããã¨ã¯ã§ãã¾ããï¼ï¼
IRTE (Interrupt Remapping Table Entry)
IRTEã§å®éã®å¤æã®å 容ãè¨å®ãã¾ãï¼IRTEã«ã¯interrupt remappingç¨ã¨ï¼posted interruptsç¨ã®äºç¨®é¡åå¨ãã¾ãï¼
interrupt remappingãå©ç¨ããå ´åã¯ï¼ä»¥ä¸ã®ãããªã¨ã³ããªã«ãªãã¾ãï¼
IRTEã®ãã¼ã¹ã¢ãã¬ã¹ã¯VT-dã¬ã¸ã¹ã¿ã®Interrupt Remapping Table Address Register (0B8h)ã«æ ¼ç´ããã¦ãã¾ãï¼
Invalidation
IRTEã¨ã³ããªã®ãã£ãã·ã¥ã®ç¡å¹åã¯Invalidation Queueãç¨ãã¦ãããªãã¾ãï¼
確èª
x2APICãæå¹ã«ããLinuxãã·ã³ã§MSIã®è¨å®ã¨RITEã¨ã³ããªã確èªãã¾ããï¼
以ä¸ã®MSI-Xãæå¹ã«ãªã£ã¦ããããã¤ã¹ã対象ã§ãï¼
% sudo lspci -vvv -s 05:00.0 05:00.0 Non-Volatile memory controller: OCZ Technology Group, Inc. RD400/400A SSD (rev 01) (prog-if 02 [NVM Express]) ... Capabilities: [b0] MSI-X: Enable+ Count=8 Masked- Vector table: BAR=0 offset=00002000 PBA: BAR=0 offset=00003000
MSI-X ãã¯ã¿ãã¼ãã«
åã¨åãããã«MSI-Xã®ãã¯ã¿ãã¼ãã«ã®ç¢ºèªãã¾ãï¼
% for j in `seq 0 1 64`; do; for i in `seq $((($j+1)*16-4+8192)) -4 $(($j*16+8192))`; sudo ./pcimem /sys/devices/pci0000:00/0000:00:1d.0/0000:05:00.0/resource0 $i w | tail -n1 | cut -d':' -f 2 | tr '\n' ' '; echo ; done 0x0 0x0 0x0 0xFEE00258 0x0 0x0 0x0 0xFEE00378 0x0 0x0 0x0 0xFEE00398 0x0 0x0 0x0 0xFEE003B8 ...
å·¦ãMessage data, ä¸çªå³ãMessage Addressã§ãï¼ ä¸ããããããå©ç¨ããIRTEã®ã¤ã³ããã¯ã¹ã¯18, 27, 28, 29ã§ãï¼
IRTE
é©å½ãªã«ã¼ãã«ã¢ã¸ã¥ã¼ã«æ¸ãã¦ç¢ºèªããã以ä¸ã®ããã«ãªãã¾ããï¼
[ 2459.161111] vtd: irta = 0x0000000460500000, eime = 1, s = 2^15 [ 2459.161112] vtd: 0 000000010083002d, 0000000000040500 [ 2459.161112] vtd: P: 1 [ 2459.161113] vtd: FPD: 0 [ 2459.161113] vtd: Destination mode: 1 [ 2459.161113] vtd: Redirection Hint: 1 [ 2459.161114] vtd: Trigger Mode: 0 [ 2459.161114] vtd: Delivery Mode: 1 [ 2459.161114] vtd: AVAIL: 0 [ 2459.161115] vtd: VECTOR: 131 [ 2459.161115] vtd: Destination ID: 1 [ 2459.161115] vtd: SID: 0x500
ããã§ï¼æåã®è¡ãInterrupt Remapping Table Address Registerã®å¤ã§ï¼eime=1ãªã®ã§x2APICã¢ã¼ãã§ãï¼ ãã®ä¸ãIRTEã®ä¸èº«ã§ãï¼