2017-01-01ãã1å¹´éã®è¨äºä¸è¦§
å®æçã«å¿ããæ°ãããã®ã§ã¡ã¢ï¼SDM Volume 3A 4.1.3, 4.6åç §. ç¨èª supervisor mode access CPL < 3 ã§ã®ã¢ã¯ã»ã¹ user mode access CPL == 3 ã§ã®ã¢ã¯ã»ã¹ supervisor mode address page entryã®U/S bitãä¸ã¤ã§ã0ã§ããé å*1 user mode addres superâ¦
tockã¨ããrust製ã®çµã¿è¾¼ã¿åãOSãããã¾ãï¼ ãã®tockã®ä½æè ãã2015å¹´ã«Ownership is Theft: Experiences Building an Embedded OS in Rust (PLOS 2015)ã¨ããè«æãçºè¡¨ãã¾ããï¼ããã§ã¯èè ãtockãéçºããä¸ã§åµã£ãownershipã«é¢ããåé¡ã¨ï¼ãâ¦
æè¿Linuxã§ããããã¨å¤§æ´»èºã®BPF (Berkeley Packet Filter)ã«ã¯ä¸»ã«2種é¡ãã£ã¦ï¼ä¸çªæåã«æå±ããlibpcapãªã©ã§å©ç¨ãããcBPF (classic BPF)ã¨ï¼ä¸»ã«Linuxå ã§ç¾å¨å©ç¨ããã¦ããï¼cBPFããã¼ã¹ã«æ¡å¼µããeBPF (extended BPF)ãããã¾ãï¼ cBPFã®ããâ¦
eBPFã«ããã«ã¼ãã«ãã¬ã¼ã¹ ä¸çªæåã«æ¸ããéãï¼eBPFã¯Linuxã®ãã¬ã¼ãµã¨ãã¦å©ç¨ã§ãã¾ãï¼ ã«ã¼ãã«ãeBPFããã°ã©ã ãå®è¡ããå ´åï¼BPFã¤ã³ã¿ããªã¿ã«ctxã渡ããã¾ãï¼jitåããã¦ããå ´åãåæ§ã§ãï¼ï¼ https://github.com/torvalds/linux/blob/vâ¦
Clangãå©ç¨ããeBPFããã°ã©ã ã®ä½æ eBPFã¸ã®ã³ã³ãã¤ã« llvm IRã®åºå eBPFã¢ã»ã³ããªã®åºå eBPFããã°ã©ã ã®åºå ã«ã¼ãã«ã§åä½ããeBPFããã°ã©ã ã®ä¾ skbuffããã®ãã¼ã eBPF mapã®å¦ç BPF Compiler Collection (BCC) ã¤ã³ã¹ãã¼ã« bccã«ããããâ¦
ã¯ããã«ï¼æ³¨æï¼ extended BPF (eBPF) eBPF map eBPFããã°ã©ã ã®ä¾ eBPFã®mapã®ä½æ eBPFããã°ã©ã ã®ä½æ eBPFãã£ã«ã¿ããã°ã©ã ã®å©ç¨ setsockoptã®æå JIT ã½ã¼ã¹ ã¾ã¨ã ã¯ããã«ï¼æ³¨æï¼ ã¡ããã©ä¸å¹´ãããåã«Linuxã®BPFã«ã¤ãã¦è¨äºãæ¸ãã¦ãã¾â¦
nom nomã¯rust製ã®ãã¼ãµã³ã³ããã¼ã¿ã¼ã©ã¤ãã©ãªã§ãï¼ å人çã«ã¯no_stdã§ã®åä½ããµãã¼ããã¦ãç¹ãå¬ããã§ãï¼ ä»ååå¼·ã®ããã«nomã§numpyã®ãã¡ã¤ã«ï¼ã®ãããï¼ããã¼ã¹ãã¦ã¿ã¾ãï¼ numpyã®ãã©ã¼ããã ä»åã¯ä»¥ä¸ã®ããã«ãã¦ä½æãããã¼ã¿ãâ¦
flexible array memberã¨ã¯ ZSTã使ãæ¹æ³ DSTã使ãæ¹æ³ flexible array memberã¨ã¯ flexible array memberã¨ã¯ãã°ãï¼Cè¨èªã§ä»¥ä¸ã®ãããªãµã¤ãºå®ç¾©ãæããªãæ§é ä½ã¡ã³ãã®ãã¨ã§ãï¼C99ããæ¨æºï¼ï¼ struct X{ size_t len; char value[]; } ãã®æ§é â¦
Boxã使ã Vecã使ã std::heap::Allocã使ã placement-in ã使ã mallocã使ã 1. Boxã使ã rustã§åçã«ã¡ã¢ãªã確ä¿ããæ¹æ³ã¨ãã£ã¦ã¾ãæãã¤ãã®ã¯Boxã使ãæ¹æ³ã ã¨æãã¾ãï¼ä¾ãã°ï¼ä»¥ä¸ã®ããã«ããã°é·ã1000ã®u8ã®ãããã¡ã確ä¿ã§ãã¾ãï¼ leâ¦
nostdã¨ã¯ rustã¯ä»ã®å¤ãã®è¨èªã¨åæ§ï¼æ¨æºã©ã¤ãã©ãª(std)ãåå ããã¦ããï¼é常ã¯ããã使ã£ã¦ããã°ã©ãã³ã°ããããªãã¾ãï¼ããããªããï¼stdã®å¤ãã®æ©è½ã¯OSã®æ©è½ãå©ç¨ãã¦ããããï¼OSãã®ãã®ãéçºãããã¨ãï¼ãããã¯OSãåå¨ããªãç°å¢ã§â¦
æç¨ã§rustã®GUIã©ã¤ãã©ãªã«ã¤ãã¦èª¿ã¹ãæ©ä¼ãããã¾ããï¼ç¹ã«ããã¨ãã£ãGUIã©ã¤ãã©ãªã¯ã¾ã ãªããããªæ°ããã¾ãï¼ æ®æ®µèªåããã¤ãã£ããªGUIã¢ããªã±ã¼ã·ã§ã³ãä½æããå ´åã¯Qtã使ãã¾ãï¼rustããQtãå¼ã³åºãã®ã¯ããã¤ã試ã¿ããã£ã¦ï¼disasseâ¦
DPDKã§ã¯ãã±ãããmbufã¨ãããã¼ã¿æ§é ã§ç®¡çãã¦ãã¾ãï¼ mbufã«ã¤ãã¦ã¯ http://dpdk.org/doc/guides/prog_guide/mbuf_lib.html ã«ã¾ã¨ã¾ã£ã¦ãã¾ããï¼ããã§ã¯å ·ä½çãªmbufã®æ§æã使ããæ¹ã«ã¤ãã¦ã¿ã¦ããããã¨æãã¾ãï¼ mempoolã®ãããã mbufã¯â¦
DPDKã«ããã¦ã©ã®ããã«ã¡ã¢ãªã使ç¨ãããããããã«ã¾ã¨ãããã¨æãã¾ãï¼ ãªãï¼ããã«æ¸ãã¦ãããã®ã¯ããã¾ã§ç§ãã³ã¼ããèªãã§è§£éããçµæã«ãªãã¾ãï¼ DPDKã®ãã¼ã¸ã§ã³ã¯17.05ï¼OSã¯Linuxã対象ã¨ãã¦ãã¾ãï¼ å ¨ä½å DPDKã§ã¯ç¬èªã®ã¡ã¢ãªã¢ãâ¦
DPDKã¯hugepageãããã©ã«ãã§å©ç¨ãã¦ãã¾ãï¼ããã§ã¯DPDKã«ãããhugepageã®åæåé¨åã«ã¤ãã¦ã¾ã¨ãããã¨æãã¾ãï¼ OSã¯Linux , DPDKã®ãã¼ã¸ã§ã³ã¯v17.05-rc2ã§ãï¼ åæåã®ããã¾ããªæµã librte_eal/linuxapp/eal/eal.c:rte_eal_init()ãDPDKã®åºâ¦
åå /proc/pid/pagemap ã«ã¤ãã¦ç°¡åã«è§¦ããã®ã§ï¼å®éã«pagemapãèªã¿åãã¨ãã©ããããã¨ãèµ·ãããå°ã追ã£ã¦ã¿ããã¨æãã¾ãï¼ /proc/pid/pagemapã«é¢ããæä½ã¯ã«ã¼ãã«ã®fs/proc/task_mmu.cå ã§proc_pagemap_operationsã«å®ç¾©ãã¦ããã¾ãï¼ httpsâ¦
ÃÃãªçç±ã§ä»®æ³ã¢ãã¬ã¹ã§ã¯ãªãå®éã®ç©çã¢ãã¬ã¹ãæ±ããããã¨ãããã¨æãã¾ãï¼ linuxã®å ´åï¼ã«ã¼ãã«ãããªãvirt2phys()ç使ãã¾ããï¼ã¦ã¼ã¶ã©ã³ãããã¯ãã®ãããªé¢æ°ã¯ããã¾ããï¼ ãã®ä»£ããï¼ /proc/self/pagemap ãåç §ãã¦è§£æ±ºãããã¨ãâ¦
ååLAPICã«ã¤ãã¦æ¸ãã¾ããï¼LAPICã¯ä»ã§ã¯CPUå ã«åãè¾¼ã¾ãã¦ããï¼Intelã®SDMã«ãã®ä½¿ç¨æ¹æ³ãæ¸ãã¦ããã¾ãï¼ä¸æ¹ã§I/O APICã¯ä»ã§ã¯ãããã»ããã«åãè¾¼ã¾ãã¦ããããï¼I/O APICã«é¢ãã¦ç¥ãããå ´åã¯ãããã»ããã®ãã¼ã¿ã·ã¼ããè¦ããã¨ã«ãªãâ¦
kallsymsãè¦ã¦ã¿ãã¨ï¼ã¡ã¢ãªå é ã®ã¦ã¼ã¶ç©ºéã®ã¢ãã¬ã¹ã«ããã·ã³ãã«ãè¤æ°åå¨ãã¦ãããã¨ã確èªã§ãã¾ãï¼ % sudo cat /proc/kallsyms | head 0000000000000000 A irq_stack_union 0000000000000000 A __per_cpu_start 0000000000004000 A exception_â¦
å®éã®ããã¤ã¹ã§MSI-Xã®è¨å®ã®ç¢ºèªããã¦ã¿ã¾ãï¼ ä»æå ã«X540ãããã®ã§ï¼ããã§å®éã«ç¢ºèªãã¦ã¿ã¾ãï¼ æç® X540ã®ä»æ§ã¯ä»¥ä¸ããå ¥æã§ãã¾ãï¼ Intel Ethernet Controller X540: Datasheet 7.3ç« ã«X540ã«ãããMSI-Xã«ã¤ãã¦æ¸ãã¦ããã¾ãï¼ã¾ãï¼9.â¦
MSI (Message Signaled Interrupts) ã¯PCI Technology Specificationãçå®ããï¼PCI/PCIeã§å©ç¨ãããå²ãè¾¼ã¿æ¹æ³ã®ä¸ã¤ã§ãï¼æåããåå¨ããpin-basedãªå²ãè¾¼ã¿ï¼INTxå²ãè¾¼ã¿ï¼ã¨æ¯ã¹ï¼MSIãå©ç¨ããå©ç¹ã¨ãã¦ä»¥ä¸ãæãããã¾ãï¼ pin-baseå²ãè¾¼ã¿â¦
APICã¯ä»ã®x86ã¢ã¼ããã¯ãã£ã§ä½¿ç¨ããã¦ããå²ãè¾¼ã¿ã³ã³ããã¼ã©ã®ãã¨ã§ãï¼ä»æ§ã¯ï¼ Intel SDM 10ç« ãªã©ã«æ¸ãã¦ããã¾ãï¼ä»¥ä¸ï¼å³ã¯SDMããå¼ç¨ãã¦ãã¾ãï¼ APICã¯åã³ã¢ãã¨ã«åå¨ããLocal APICã¨ï¼å¤é¨ããã®å²ãè¾¼ã¿ãæ å½ããI/O APICã«åããâ¦
Linux Device Driver Chapter 15ã§ã¯ Linuxã§å©ç¨ãããã¢ãã¬ã¹ã以ä¸ã®5種é¡ã«åé¡ãã¦ãã¾ãï¼ User virtual address Physical address Bus address Kernel logical address Kenerl virtual address User virtual addressã¯ãã®åã®éãã¦ã¼ã¶ããã»ã¹ãâ¦
rustããCã®é¢æ°ãå¼ã¶æ¹æ³ï¼ãããã¯ï¼ãã®éï¼ã¯å ¬å¼ã®ããã¥ã¡ã³ã (https://doc.rust-lang.org/book/ffi.html)ã«æ¸ãã¦ããã®ã§ãããèªãã°ããã㧠ããï¼èªåã§æ¸ããCã®é¢æ°ãå¼ã¶æ¹æ³ã«ã¤ãã¦ç´æ¥ã¯æ¸ãã¦ãªãã®ã§ããã«ç°¡åã« ã¾ã¨ãã¦ã¿ã¾ãï¼ ruâ¦