在 x86 Intel Xeon 系统上的 Jailhouse 虚拟机管理程序下设置页面属性表 (PAT) 时出现问题

问题描述 投票:0回答:1

我正在尝试在 Intel Xeon x86_64 系统上设置 Jailhouse 虚拟机管理程序。但是,在初始设置期间写入

MSR_IA32_PAT
时,虚拟机管理程序会卡住。显然,写入
MSR_IA32_PAT
的值无效(Jailhouse 在不同系统中使用相同的值)。它适用于旧系统,但不适用于当前系统。

我已经追踪到问题,似乎是在监狱/虚拟机管理程序/arch/x86/setup.c中的这个函数调用中

write_msr(MSR_IA32_PAT, PAT_HOST_VALUE);

初始化第一个处理器时,代码永远不会从此函数返回,并且系统挂起。可能是什么问题?

写入

PAT_HOST_VALUE
MSR_IA32_PAT
0x070106UL
,对应于
PAT0= write-back
PAT1=write-combined
PAT2=Uncached-minus
。但是,我不确定这是否是我的系统的正确设置。我不是这方面的专家,但我已经检查过,相同的
PAT_HOST_VALUE
值适用于另一个系统。

cat /sys/kernel/debug/x86/pat_memtype_list
详情如下

PAT memtype list:
PAT: [mem 0x000000005a639000-0x000000005a6af000] write-back
PAT: [mem 0x000000006981a000-0x000000006981b000] write-back
PAT: [mem 0x000000006981b000-0x000000006981c000] write-back
PAT: [mem 0x000000006982f000-0x0000000069830000] write-back
PAT: [mem 0x000000006a25c000-0x000000006a2ab000] write-back
PAT: [mem 0x000000006a2ae000-0x000000006a2af000] write-back
PAT: [mem 0x000000006a2b3000-0x000000006a2b4000] write-back
PAT: [mem 0x000000006a2c8000-0x000000006a2c9000] write-back
PAT: [mem 0x000000006a2c8000-0x000000006a2cb000] write-back
PAT: [mem 0x000000006c338000-0x000000006c339000] write-back
PAT: [mem 0x000000006c339000-0x000000006c33a000] write-back
PAT: [mem 0x000000006cdd3000-0x000000006cdd4000] write-back
PAT: [mem 0x000000006cdd4000-0x000000006cdd5000] write-back
PAT: [mem 0x000000006f5d5000-0x000000006f5d6000] write-back
PAT: [mem 0x000000006f5dd000-0x000000006f5de000] write-back
PAT: [mem 0x000000006f5de000-0x000000006f5df000] write-back
PAT: [mem 0x000000006f5df000-0x000000006f5e0000] write-back
PAT: [mem 0x000000006f5e0000-0x000000006f5e1000] write-back
PAT: [mem 0x000000006f5e2000-0x000000006f5e3000] write-back
PAT: [mem 0x000000006f5e3000-0x000000006f5e4000] uncached-minus
PAT: [mem 0x000000006f5e3000-0x000000006f5e4000] uncached-minus
PAT: [mem 0x000000006f5e4000-0x000000006f5e5000] write-back
PAT: [mem 0x000000006f5e5000-0x000000006f5e6000] write-back
PAT: [mem 0x000000006f5e6000-0x000000006f5e7000] write-back
PAT: [mem 0x000000006f5e7000-0x000000006f5e8000] write-back
PAT: [mem 0x000000006f5e8000-0x000000006f5e9000] write-back
PAT: [mem 0x000000006f5e9000-0x000000006f5ea000] write-back
PAT: [mem 0x000000006f5ea000-0x000000006f5eb000] write-back
PAT: [mem 0x000000006f5eb000-0x000000006f5ec000] write-back
PAT: [mem 0x000000006f5ec000-0x000000006f5ed000] write-back
PAT: [mem 0x000000006f5f6000-0x000000006f5f7000] write-back
PAT: [mem 0x000000006f615000-0x000000006f616000] write-back
PAT: [mem 0x000000006f616000-0x000000006f617000] write-back
PAT: [mem 0x000000006f618000-0x000000006f619000] write-back
PAT: [mem 0x000000006f619000-0x000000006f61a000] write-back
PAT: [mem 0x000000006f61a000-0x000000006f61b000] write-back
PAT: [mem 0x000000006f61b000-0x000000006f61c000] write-back
PAT: [mem 0x000000006f61c000-0x000000006f61d000] write-back
PAT: [mem 0x000000006f68a000-0x000000006f68b000] write-back
PAT: [mem 0x000000006f68b000-0x000000006f68c000] write-back
PAT: [mem 0x000000006f68c000-0x000000006f68d000] write-back
PAT: [mem 0x000000006f68d000-0x000000006f68e000] write-back
PAT: [mem 0x000000006f68e000-0x000000006f68f000] write-back
PAT: [mem 0x000000006f68f000-0x000000006f690000] write-back
PAT: [mem 0x000000006f690000-0x000000006f691000] write-back
PAT: [mem 0x000000006f691000-0x000000006f692000] write-back
PAT: [mem 0x000000006f692000-0x000000006f694000] write-back
PAT: [mem 0x000000006f694000-0x000000006f6af000] write-back
PAT: [mem 0x000000006f6af000-0x000000006f6c1000] write-back
PAT: [mem 0x000000006f6c1000-0x000000006f706000] write-back
PAT: [mem 0x000000006f706000-0x000000006f768000] write-back
PAT: [mem 0x000000006f768000-0x000000006f769000] write-back
PAT: [mem 0x000000006f76a000-0x000000006f76c000] write-back
PAT: [mem 0x000000006f76c000-0x000000006f76d000] write-back
PAT: [mem 0x000000006f76d000-0x000000006f7e8000] write-back
PAT: [mem 0x000000006f7e8000-0x000000006f7e9000] write-back
PAT: [mem 0x000000006f7e9000-0x000000006f7ea000] write-back
PAT: [mem 0x000000006f7ea000-0x000000006f7eb000] write-back
PAT: [mem 0x000000006f7eb000-0x000000006f7ec000] write-back
PAT: [mem 0x000000006f7ec000-0x000000006f7ed000] write-back
PAT: [mem 0x000000006f7ed000-0x000000006f7ee000] write-back
PAT: [mem 0x000000006f7ee000-0x000000006f7ef000] write-back
PAT: [mem 0x000000006f7ef000-0x000000006f7f0000] write-back
PAT: [mem 0x000000006f7f0000-0x000000006f7f1000] write-back
PAT: [mem 0x000000006f7f1000-0x000000006f7f2000] write-back
PAT: [mem 0x000000006f7f2000-0x000000006f7f3000] write-back
PAT: [mem 0x000000006f7f3000-0x000000006f7f4000] write-back
PAT: [mem 0x000000006f7f4000-0x000000006f7f5000] write-back
PAT: [mem 0x000000006f7f5000-0x000000006f7f6000] write-back
PAT: [mem 0x000000006f7f6000-0x000000006f7f7000] write-back
PAT: [mem 0x000000006f7f7000-0x000000006f7f8000] write-back
PAT: [mem 0x000000006f7f8000-0x000000006f7f9000] write-back
PAT: [mem 0x000000006f7f9000-0x000000006f7fc000] write-back
PAT: [mem 0x000000006f7fc000-0x000000006f7fd000] write-back
PAT: [mem 0x000000006f7fd000-0x000000006f7fe000] write-back
PAT: [mem 0x0000000080000000-0x0000000090000000] uncached-minus
PAT: [mem 0x0000000080000000-0x0000000080001000] uncached-minus
PAT: [mem 0x00000000800a3000-0x00000000800a4000] uncached-minus
PAT: [mem 0x0000000092100000-0x0000000092120000] uncached-minus
PAT: [mem 0x0000000092120000-0x0000000092121000] uncached-minus
PAT: [mem 0x0000000092122000-0x0000000092123000] uncached-minus
PAT: [mem 0x00000000977fc000-0x00000000977fd000] uncached-minus
PAT: [mem 0x0000000099000000-0x0000000099004000] uncached-minus
PAT: [mem 0x00000000a97fc000-0x00000000a97fd000] uncached-minus
PAT: [mem 0x00000000bb7fc000-0x00000000bb7fd000] uncached-minus
PAT: [mem 0x00000000cd3fc000-0x00000000cd3fd000] uncached-minus
PAT: [mem 0x00000000cd400000-0x00000000cd402000] uncached-minus
PAT: [mem 0x00000000cd403000-0x00000000cd404000] uncached-minus
PAT: [mem 0x00000000deffc000-0x00000000deffd000] uncached-minus
PAT: [mem 0x00000000df101000-0x00000000df102000] uncached-minus
PAT: [mem 0x00000000df101000-0x00000000df102000] uncached-minus
PAT: [mem 0x00000000df101000-0x00000000df102000] uncached-minus
PAT: [mem 0x00000000df101000-0x00000000df102000] uncached-minus
PAT: [mem 0x00000000df101000-0x00000000df102000] uncached-minus
PAT: [mem 0x00000000df101000-0x00000000df102000] uncached-minus
PAT: [mem 0x00000000df101000-0x00000000df102000] uncached-minus
PAT: [mem 0x00000000df101000-0x00000000df102000] uncached-minus
PAT: [mem 0x00000000df101000-0x00000000df102000] uncached-minus
PAT: [mem 0x00000000df101000-0x00000000df102000] uncached-minus
PAT: [mem 0x00000000df101000-0x00000000df102000] uncached-minus
PAT: [mem 0x00000000df103000-0x00000000df106000] uncached-minus
PAT: [mem 0x00000000df106000-0x00000000df10a000] uncached-minus
PAT: [mem 0x00000000df10a000-0x00000000df10c000] uncached-minus
PAT: [mem 0x00000000df7fc000-0x00000000df7fd000] uncached-minus
PAT: [mem 0x00000000dfa00000-0x00000000dfa01000] uncached-minus
PAT: [mem 0x00000000dfa80000-0x00000000dfa84000] uncached-minus
PAT: [mem 0x00000000dfa80000-0x00000000dfb00000] uncached-minus
PAT: [mem 0x00000000dfaa2000-0x00000000dfaa7000] uncached-minus
PAT: [mem 0x00000000dfaaa000-0x00000000dfaaf000] uncached-minus
PAT: [mem 0x00000000dfb00000-0x00000000dfb04000] uncached-minus
PAT: [mem 0x00000000dfb00000-0x00000000dfb80000] uncached-minus
PAT: [mem 0x00000000dfb80000-0x00000000dfb84000] uncached-minus
PAT: [mem 0x00000000dfb80000-0x00000000dfc00000] uncached-minus
PAT: [mem 0x00000000dfba2000-0x00000000dfba7000] uncached-minus
PAT: [mem 0x00000000dfbaa000-0x00000000dfbaf000] uncached-minus
PAT: [mem 0x00000000dfc00000-0x00000000dfc80000] uncached-minus
PAT: [mem 0x00000000e0690000-0x00000000e06a0000] uncached-minus
PAT: [mem 0x00000000e06a0000-0x00000000e06b0000] uncached-minus
PAT: [mem 0x00000000e06b0000-0x00000000e06c0000] uncached-minus
PAT: [mem 0x00000000e06d0000-0x00000000e06e0000] uncached-minus
PAT: [mem 0x00000000e06e0000-0x00000000e06f0000] uncached-minus
PAT: [mem 0x00000000fed00000-0x00000000fed01000] uncached-minus
PAT: [mem 0x00000000fed40000-0x00000000fed41000] uncached-minus
PAT: [mem 0x00000000fed40000-0x00000000fed45000] uncached-minus
PAT: [mem 0x0000200ffff00000-0x0000200ffff10000] uncached-minus
PAT: [mem 0x0000200ffff10000-0x0000200ffff14000] uncached-minus
PAT: [mem 0x0000200ffff19000-0x0000200ffff1a000] uncached-minus
PAT: [mem 0x0000201fe0000000-0x0000201fe0870000] write-combining
PAT: [mem 0x0000201fe0000000-0x0000201fe0870000] write-combining
PAT: [mem 0x0000205ffff20000-0x0000205ffff30000] uncached-minus
PAT: [mem 0x0000205ffff22000-0x0000205ffff23000] uncached-minus

cat /proc/mtrr
的值为

reg00: base=0x000000000 (    0MB), size= 2048MB, count=1: write-back
reg01: base=0x07e000000 ( 2016MB), size=   32MB, count=1: uncachable
reg02: base=0x100000000 ( 4096MB), size= 4096MB, count=1: write-back
reg03: base=0x200000000 ( 8192MB), size= 8192MB, count=1: write-back
reg04: base=0x400000000 (16384MB), size=16384MB, count=1: write-back
reg05: base=0x800000000 (32768MB), size=32768MB, count=1: write-back
reg06: base=0x1000000000 (65536MB), size=65536MB, count=1: write-back

我一直在尝试了解 MTRR 和 PAT 是如何工作的,但仍然无法完全理解。问题是我应该如何设置

PAT_HOST_VALUE
使其对应于我系统上的
PAT
MTRR
设置。

kernel intel paging osdev bare-metal
1个回答
0
投票

在我们的例子中,我们的 Linux 内核 (6.12) 使用 5 级页表,但监狱假设为 4 级。

在内核中禁用 5 级分页为我们解决了这个问题:

CONFIG_PGTABLE_LEVELS=4
# CONFIG_X86_5LEVEL is not set
© www.soinside.com 2019 - 2024. All rights reserved.