Documentation/translations/zh_CN/virt/ne_overview.rst
Source file repositories/reference/linux-study-clean/Documentation/translations/zh_CN/virt/ne_overview.rst
File Facts
- System
- Linux kernel
- Corpus path
Documentation/translations/zh_CN/virt/ne_overview.rst- Extension
.rst- Size
- 4577 bytes
- Lines
- 89
- Domain
- Support Tooling And Documentation
- Bucket
- Documentation
- Inferred role
- Support Tooling And Documentation: documentation
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
.. SPDX-License-Identifier: GPL-2.0
.. include:: ../disclaimer-zh_CN.rst
:Original: Documentation/virt/ne_overview.rst
:翻译:
司延腾 Yanteng Si <siyanteng@loongson.cn>
:校译:
时奎亮 Alex Shi <alexs@kernel.org>
.. _cn_virt_ne_overview:
==============
Nitro Enclaves
==============
概述
====
Nitro Enclaves(NE)是亚马逊弹性计算云(EC2)的一项新功能,允许客户在EC2实
例中划分出孤立的计算环境[1]。
例如,一个处理敏感数据并在虚拟机中运行的应用程序,可以与在同一虚拟机中运行的
其他应用程序分开。然后,这个应用程序在一个独立于主虚拟机的虚拟机中运行,即
enclave。
一个enclave与催生它的虚拟机一起运行。这种设置符合低延迟应用的需要。为enclave
分配的资源,如内存和CPU,是从主虚拟机中分割出来的。每个enclave都被映射到一
个运行在主虚拟机中的进程,该进程通过一个ioctl接口与NE驱动进行通信。
在这个意义上,有两个组成部分。
1. 一个enclave抽象进程——一个运行在主虚拟机客体中的用户空间进程,它使用NE驱动
提供的ioctl接口来生成一个enclave虚拟机(这就是下面的2)。
有一个NE模拟的PCI设备暴露给主虚拟机。这个新的PCI设备的驱动被包含在NE驱动中。
ioctl逻辑被映射到PCI设备命令,例如,NE_START_ENCLAVE ioctl映射到一个enclave
启动PCI命令。然后,PCI设备命令被翻译成在管理程序方面采取的行动;也就是在运
行主虚拟机的主机上运行的Nitro管理程序。Nitro管理程序是基于KVM核心技术的。
2. enclave本身——一个运行在与催生它的主虚拟机相同的主机上的虚拟机。内存和CPU
从主虚拟机中分割出来,专门用于enclave虚拟机。enclave没有连接持久性存储。
从主虚拟机中分割出来并给enclave的内存区域需要对齐2 MiB/1 GiB物理连续的内存
区域(或这个大小的倍数,如8 MiB)。该内存可以通过使用hugetlbfs从用户空间分
配[2][3]。一个enclave的内存大小需要至少64 MiB。enclave内存和CPU需要来自同
一个NUMA节点。
一个enclave在专用的核心上运行。CPU 0及其同级别的CPU需要保持对主虚拟机的可用
性。CPU池必须由具有管理能力的用户为NE目的进行设置。关于CPU池的格式,请看内核
文档[4]中的cpu list部分。
enclave通过本地通信通道与主虚拟机进行通信,使用virtio-vsock[5]。主虚拟机有
virtio-pci vsock模拟设备,而飞地虚拟机有virtio-mmio vsock模拟设备。vsock
设备使用eventfd作为信令。enclave虚拟机看到通常的接口——本地APIC和IOAPIC——从
virtio-vsock设备获得中断。virtio-mmio设备被放置在典型的4 GiB以下的内存中。
在enclave中运行的应用程序需要和将在enclave虚拟机中运行的操作系统(如内核、
ramdisk、init)一起被打包到enclave镜像中。enclave虚拟机有自己的内核并遵循标
准的Linux启动协议[6]。
内核bzImage、内核命令行、ramdisk(s)是enclave镜像格式(EIF)的一部分;另外
还有一个EIF头,包括元数据,如magic number、eif版本、镜像大小和CRC。
哈希值是为整个enclave镜像(EIF)、内核和ramdisk(s)计算的。例如,这被用来检
查在enclave虚拟机中加载的enclave镜像是否是打算运行的那个。
Annotation
- Atlas domain: Support Tooling And Documentation / Documentation.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.