H a r d w a r e / S
- f
t w a r e C
- D
e s i g n f
- r
E f f i c i e n t M i c r
- k
e r n e l E x e c u t i
- n
Martjn Děcký martjn.decky@huawei.com
February 2019
H a r d w a r e / S o f t w a r e C o - D e s - - PowerPoint PPT Presentation
H a r d w a r e / S o f t w a r e C o - D e s i g n f o r E f f i c i e n t M i c r o k e r n e l E x e c u t i o n Martjn Dck martjn.decky@huawei.com February 2019 Who Am I Passionate
February 2019
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 2
3 Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon
3
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 4
5 Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon
5
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 6
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 7
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 8
CPUs do not support microkernels properly
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 9
CPUs do not support microkernels properly Microkernels sufger perfromance penaltjes
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 10
CPUs do not support microkernels properly Microkernels are not in the mainstream Microkernels sufger perfromance penaltjes
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 11
CPUs do not support microkernels properly Microkernels are not in the mainstream Microkernels sufger perfromance penaltjes No requirements on CPUs from microkernels
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 12
CPUs do not support microkernels properly Microkernels are not in the mainstream Microkernels sufger perfromance penaltjes No requirements on CPUs from microkernels
13 Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 14
Passing arguments in registers and on the stack Passing direct pointers to memory structures
Passing arguments in a subset of registers Privilege level switch, address space switch Scheduling (in case of asynchronous IPC) Data copying or memory sharing with page granularity
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 15
Communicatjng partjes identjfjed by a “call gate” (capability) containing the target address space and the PC of the IPC handler (implicit for return)
Call gates stored in a TLB-like hardware cache (CLB) CLB populated by the microkernel similarly to TLB-only memory management architecture
Async Jump/Call, Async Return and Async Receive instructjons Using the CPU cache like an extended register stack engine
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 16
Much fjner granularity than pages (typically 64 to 128 bytes) A separate virtual-to-cache mapping mechanism before the standard virtual-to-physical mapping
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 17
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 18
Again, similar mechanism to TLB-only memory management Dedicated instructjons for context store, context restore, context switch, context save, context load
Context data could be potentjally ABI-optjmized
Autonomous mechanism for event-triggered context switch (e.g. external interrupt) Effjcient hardware mechanism for latency hiding
The equivalent of fjne/coarse-grained simultaneous multjthreading
The sofuware scheduler is in charge of settjng the scheduler policy The CPU is in charge of scheduling the contexts based on ALU, cache and other resource availability
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 19
Effjcient delivery of interrupt events to user space device drivers
Without the routjne microkernel interventjon
An interrupt could be directly handled by a preconfjgured hardware context in user space
A clear path towards moving even the tjmer interrupt handler and the scheduler from kernel space to user space Going back to interrupt-driven handling of peripherals with extreme low latency requirements (instead of polling)
The usual pain point: Level-triggered interrupts
Some coordinatjon with the platgorm interrupt controller is probably needed to automatjcally mask the interrupt source
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 20
RV128 (128-bit variant of RISC-V) would provide 64 bits for the capability reference and 64 bits for object ofgset
128-bit fmat pointers are probably useless anyway
Simplifying the implementatjon of managed languages’ VMs Working with multjple virtual address spaces at once
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 21
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 22
Useful for data-centric applicatjons for sharing large amounts of memory between processes
The primary reason for removal was not performance, but portability
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 23
Switching the EPT and passing register arguments Current implementatjon limited to 512 entry points Practjcally usable even for very fjne-grained virtualizatjon with the granularity of individual functjons
Liu Y., Zhou T., Chen K., Chen H., Xia Y.: Thwartjng Memory Disclosure with Effjcient Hypervisor-enforced Intra-domain Isolatjon, 22nd ACM SIGSAC Conference on Computer and Communicatjons Security, 2015
– “The cost of a VMFUNC is similar with a syscall” – “… hypervisor-level protectjon at the cost of system calls”
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 24
Hardware-based capability model for byte-granularity memory protectjon Extension of the 64-bit MIPS ISA
Evaluated on an extended MIPS R4000 FPGA sofu-core 32 capability registers (256 bits)
Limitatjon: Infmexible design mostly due to the tjght backward compatjbility with a 64-bit ISA
Several design and implementatjon issues, deemed not productjon-ready
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 25
This prevented them from replacing monolithic operatjng systems and closed the vicious cycle
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 26
Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon 27
Basic research Applied research Prototype development Collaboratjon with academia and other technology companies
Previous microkernel experience is a big plus “A startup within a large company” Shaping the future product portgolio of Huawei
Including hardware/sofuware co-design via HiSilicon
28 Martjn Děcký, FOSDEM, February 3rd 2019 Hardware/Sofuware Co-Design for Effjcient Microkernel Executjon