Skip to content

Intel CPU服务器2TB内存下,hyperenclave启动失败 #31

Description

@bronzeMe

Your Question

物理内存2TB时,启动hyperencalve失败,失败原因和这个issue中的前期的报错类似“panicked at 'index out of bounds: the len is 32 but the index is 32', /home/test/.cargo/registry/src/github.com-1ecc6299db9ec823/buddy_system_allocator-0.5.0/src/lib.rs:90:13”
,这个issue中提到的workaround patch 看起来不适用于Intel CPU架构,

Q1: 是否需要如这个issue12中的这里修改一下bitmap_allocator呢
Q2:针对Intel CPU,2TB的内存场景下,应该是不需要如下的patch对吧?

#workaround patch
$git diff src/cell.rs
diff --git a/src/cell.rs b/src/cell.rs
index 928e1e1..f618087 100644
--- a/src/cell.rs
+++ b/src/cell.rs
@@ -140,29 +140,12 @@ impl Cell {
         for region in sys_config.mem_regions() {
             if region.flags.contains(MemFlags::DMA) {
                 let hv_virt_start = phys_to_virt(region.virt_start as GuestPhysAddr);
-                if hv_virt_start < region.virt_start as GuestPhysAddr {
-                    return hv_result_err!(
-                        EINVAL,
-                        format!(
-                            "Guest physical address {:#x} is too large",
-                            region.virt_start
-                        )
-                    );
-                }
                 hvm.insert(MemoryRegion::new_with_offset_mapper(
                     hv_virt_start,
                     region.phys_start as HostPhysAddr,
                     region.size as usize,
                     MemFlags::READ | MemFlags::WRITE,
                 ))?;
-                // Support hardware encrypt when swap out EPC page to guest RAM
-                #[cfg(feature = "sme")]
-                hvm.insert(MemoryRegion::new_with_offset_mapper(
-                    region.virt_start as HostVirtAddr,
-                    region.phys_start as HostPhysAddr,
-                    region.size as usize,
-                    MemFlags::READ | MemFlags::WRITE | MemFlags::ENCRYPTED,
-                ))?;
                 normal_world_mem_region.insert(
                     (region.phys_start as usize)..(region.phys_start + region.size) as usize,
                 )?;
系统/CPU/内核信息
 ##lscpu
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   46 bits physical, 57 bits virtual
CPU(s):                          224
On-line CPU(s) list:             0-223
Thread(s) per core:              2
Core(s) per socket:              56
Socket(s):                       2
NUMA node(s):                    2
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           207
Model name:                      INTEL(R) XEON(R) PLATINUM 8538C
Stepping:                        2
Frequency boost:                 enabled
CPU MHz:                         800.000
CPU max MHz:                     4000.0000
CPU min MHz:                     800.0000
BogoMIPS:                        5200.00
Virtualization:                  VT-x
L1d cache:                       5.3 MiB
L1i cache:                       3.5 MiB
L2 cache:                        224 MiB
L3 cache:                        560 MiB
NUMA node0 CPU(s):               0-55,112-167
NUMA node1 CPU(s):               56-111,168-223
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Enhanced IBRS, IBPB conditional, RSB filling
Vulnerability Tsx async abort:   Not affected

###内存
test@test:~$ lsmem
RANGE                                  SIZE  STATE REMOVABLE     BLOCK
0x0000000000000000-0x000000007fffffff    2G online        no         0
0x0000004100000000-0x0000005dffffffff  116G online       yes   130-187
0x0000005e00000000-0x0000005e7fffffff    2G online        no       188
0x0000005e80000000-0x000000fa7fffffff  624G online       yes   189-500
0x000000fa80000000-0x000000fb7fffffff    4G online        no   501-502
0x000000fb80000000-0x000000fbffffffff    2G online       yes       503
0x000000fc00000000-0x000001007fffffff   18G online        no   504-512
0x0000010080000000-0x000001fbffffffff 1006G online       yes  513-1015
0x000001fc00000000-0x000002007fffffff   18G online        no 1016-1024

Memory block size:         2G
Total online memory:     1.8T
Total offline memory:      0B
test@test:~$ cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-5.4.0-custom root=UUID=d9c98664-2f04-4901-a426-1cf58139d6b3 ro memmap=256G$0x100000000 intel_iommu=off intermap=off no5lvl ima_policy=tcb ima_hash=sha256 ima_appraise=fix evm=fi
### OS-kernel
test@test:~$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
test@test:~$ uname -a
Linux test 5.4.0-custom #1 SMP Thu Aug 22 05:22:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Relevant Documentation or Forum Link

SOL 日志

Secondary CPU 183 entered.
Secondary CPU 84 entered.
Secondary CPU 121 entered.
Secondary CPU 71 entered.
Secondary CPU 60 entered.
Secondary CPU 142 entered.
Secondary CPU 39 entered.
Secondary CPU 21 entered.
Secondary CPU 64 entered.
Primary CPU 3 entered.
Secondary CPU 147 entered.
Secondary CPU 151 entered.
Secondary CPU 133 entered.
Secondary CPU 35 entered.
Secondary CPU 126 entered.
Secondary CPU 135 entered.
Secondary CPU 16 entered.
Secondary CPU 27 entered.

Initializing hypervisor...
build_mode = release
log_level = warn
arch = x86_64
vendor = intel
stats = off
sme = off
epc = epc48

Secondary CPU 128 entered.
Secondary CPU 119 entered.
Secondary CPU 14 entered.
Secondary CPU 131 entered.
Secondary CPU 52 entered.
Secondary CPU 157 entered.
Secondary CPU 30 entered.
Secondary CPU 26 entered.
Secondary CPU 139 entered.
Secondary CPU 9 entered.
Secondary CPU 123 entered.
reclaim crypto algorithm: EncSWHmacSW
Secondary CPU 188 entered.
Secondary CPU 13 entered.
Secondary CPU 150 entered.
Secondary CPU 217 entered.
Secondary CPU 116 entered.
Secondary CPU 23 entered.
Secondary CPU 114 entered.
Secondary CPU 164 entered.
[ERROR][6]
panicked at 'index out of bounds: the len is 32 but the index is 32', /home/test/.cargo/registry/src/github.com-1ecc6299db9ec823/buddy_system_allocator-0.5.0/src/lib.rs:90:13
Current Cpu: PerCpu {
   cpu_id:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions