mirror of https://github.com/docker/docs.git
Merge pull request #2503 from larskanis/fix-amd-svm-detection-on-linux
Fix detection of virtualization support on AMD CPU.
This commit is contained in:
commit
1de66c75e4
|
@ -9,7 +9,7 @@ import (
|
||||||
|
|
||||||
// IsVTXDisabled checks if VT-X is disabled in the BIOS. If it is, the vm will fail to start.
|
// IsVTXDisabled checks if VT-X is disabled in the BIOS. If it is, the vm will fail to start.
|
||||||
// If we can't be sure it is disabled, we carry on and will check the vm logs after it's started.
|
// If we can't be sure it is disabled, we carry on and will check the vm logs after it's started.
|
||||||
// We want to check that either vmx or smd flags are present in /proc/cpuinfo.
|
// We want to check that either vmx or svm flags are present in /proc/cpuinfo.
|
||||||
func (d *Driver) IsVTXDisabled() bool {
|
func (d *Driver) IsVTXDisabled() bool {
|
||||||
cpuinfo, err := ioutil.ReadFile("/proc/cpuinfo")
|
cpuinfo, err := ioutil.ReadFile("/proc/cpuinfo")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -22,7 +22,7 @@ func (d *Driver) IsVTXDisabled() bool {
|
||||||
func isVTXDisabled(cpuinfo []byte) bool {
|
func isVTXDisabled(cpuinfo []byte) bool {
|
||||||
features := [2][]byte{
|
features := [2][]byte{
|
||||||
{'v', 'm', 'x'},
|
{'v', 'm', 'x'},
|
||||||
{'s', 'm', 'd'},
|
{'s', 'v', 'm'},
|
||||||
}
|
}
|
||||||
for _, v := range features {
|
for _, v := range features {
|
||||||
if bytes.Contains(cpuinfo, v) {
|
if bytes.Contains(cpuinfo, v) {
|
||||||
|
|
|
@ -9,31 +9,32 @@ import (
|
||||||
const (
|
const (
|
||||||
amdCPUInfo = `
|
amdCPUInfo = `
|
||||||
processor : 0
|
processor : 0
|
||||||
vendor_id : GenuineIntel
|
vendor_id : AuthenticAMD
|
||||||
cpu family : 6
|
cpu family : 20
|
||||||
model : 70
|
model : 1
|
||||||
model name : Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
|
model name : AMD C-50 Processor
|
||||||
stepping : 1
|
stepping : 0
|
||||||
microcode : 0x19
|
microcode : 0x5000026
|
||||||
cpu MHz : 2294.688
|
cpu MHz : 800.000
|
||||||
cache size : 6144 KB
|
cache size : 512 KB
|
||||||
physical id : 0
|
physical id : 0
|
||||||
siblings : 1
|
siblings : 2
|
||||||
core id : 0
|
core id : 0
|
||||||
cpu cores : 1
|
cpu cores : 2
|
||||||
apicid : 0
|
apicid : 0
|
||||||
initial apicid : 0
|
initial apicid : 0
|
||||||
fpu : yes
|
fpu : yes
|
||||||
fpu_exception : yes
|
fpu_exception : yes
|
||||||
cpuid level : 13
|
cpuid level : 6
|
||||||
wp : yes
|
wp : yes
|
||||||
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 smd clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm
|
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc extd_apicid aperfmperf pni monitor ssse3 cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch ibs skinit wdt arat hw_pstate npt lbrv svm_lock nrip_save pausefilter vmmcall
|
||||||
bugs :
|
bugs : fxsave_leak sysret_ss_attrs
|
||||||
bogomips : 4589.37
|
bogomips : 1995.09
|
||||||
|
TLB size : 1024 4K pages
|
||||||
clflush size : 64
|
clflush size : 64
|
||||||
cache_alignment : 64
|
cache_alignment : 64
|
||||||
address sizes : 39 bits physical, 48 bits virtual
|
address sizes : 36 bits physical, 48 bits virtual
|
||||||
power management:
|
power management: ts ttp tm stc 100mhzsteps hwpstate
|
||||||
`
|
`
|
||||||
intelCPUInfo = `
|
intelCPUInfo = `
|
||||||
processor : 0
|
processor : 0
|
||||||
|
|
Loading…
Reference in New Issue