google / gvisor

Application Kernel for Containers
https://gvisor.dev
Apache License 2.0
15.31k stars 1.27k forks source link

Ask for support for CPUs without cpuid.X86FeatureGBPAGES #6327

Open laijs opened 2 years ago

laijs commented 2 years ago

Description

If other conditions are allowed, ring0/pagetables/walker_amd64.go always do pudEntry.SetSuper() for GBPAGES without checking if the cpu has cpuid.X86FeatureGBPAGES. Could we add the check for cpuid.X86FeatureGBPAGES before SetSuper()?

Is this feature related to a specific bug?

If gvisor is tested on CPUs without cpuid.X86FeatureGBPAGES,

PC=0xe6fc30 m=18 sigcode=1

goroutine 82 [syscall, locked to thread]:
gvisor.dev/gvisor/pkg/sentry/platform/kvm.(*vCPU).SwitchToUser(0xc000127400, 0xc00034ea20, 0xc0004d7300, 0xc00008c0c0, 0x100000101, 0x10009, 0xc0004f8fd8, 0xc000114800, 0xe66f0e, 0xc00008c080)
        pkg/sentry/platform/kvm/machine_amd64.go:323 +0xbe fp=0xc0002e0d00 sp=0xc0002e0ca0 pc=0xe6c5de
gvisor.dev/gvisor/pkg/sentry/platform/kvm.(*context).Switch(0xc0004f8fd0, 0x16ccac0, 0xc0000af500, 0x16c61c0, 0xc0001aa000, 0x16e9ee0, 0xc00034ea20, 0x1, 0x0, 0x40, ...)
        pkg/sentry/platform/kvm/context.go:76 +0x24c fp=0xc0002e0dd8 sp=0xc0002e0d00 pc=0xe6879c
gvisor.dev/gvisor/pkg/sentry/kernel.(*runApp).execute(0x0, 0xc0000af500, 0x168a520, 0x0)
        pkg/sentry/kernel/task_run.go:271 +0x305 fp=0xc0002e0f40 sp=0xc0002e0dd8 pc=0x99db35
gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).run(0xc0000af500, 0x1)
        pkg/sentry/kernel/task_run.go:97 +0x1d8 fp=0xc0002e0fd0 sp=0xc0002e0f40 pc=0x99d0c8
runtime.goexit()
        GOROOT/src/runtime/asm_amd64.s:1361 +0x1 fp=0xc0002e0fd8 sp=0xc0002e0fd0 pc=0x465781
created by gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).Start
        pkg/sentry/kernel/task_start.go:392 +0xfe

pkg/sentry/platform/kvm/machine_amd64.go:323 is the ip after bluepill()

Do you have a specific solution in mind?

No response

amscanne commented 2 years ago

Yeah, we should do this. Out of curiosity, what CPU is lacking this feature?

github-actions[bot] commented 9 months ago

A friendly reminder that this issue had no activity for 120 days.