Hyperthreading not enabled on linux guest

Discussions related to using VirtualBox on Windows hosts.
Post Reply
brians-vbox
Posts: 7
Joined: 8. May 2020, 21:17

Hyperthreading not enabled on linux guest

Post by brians-vbox »

Not sure if this question is better asked in the Linux Guests forum, but I'll start here.

I have an i7-10875H processor that has 8 cores and supports 16 threads. On my Windows 10 host, the BIOS enables hyperthreading and the OS reports NumberOfCores=8 and NumberOfLogicalProcessors=16 via Wmic. (I also see 16 logical processors in Device Manager.)

The guest is Ubuntu 20.04.2 and the boot loader is not disabling smt, yet the OS doesn't recognize more than 1 thread per proc.

Code: Select all

$ lscpu | grep -e Socket -e Core -e Thread -e Flags
Thread(s) per core:              1
Core(s) per socket:              8
Socket(s):                       1
Model name:                      Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz
Flags:                           ...ht...

$ cat /sys/devices/system/cpu/smt/control
notsupported
I'm running VirtualBox 6.1.18 and when I bring up the guest's system settings, the Processors(s) slider shows 1-8 green and 9-16 red. However, the CPUID dump in the log seems to show that it is not getting translated to the guest properly. Leaf 4 doesn't seem right, but I'm not sure what the kernel cares about here.

Code: Select all

00:00:03.121545 CPUM: Logical host processors: 16 present, 16 max, 16 online, online mask: 000000000000ffff
00:00:03.121545 CPUM: Physical host cores: 8
00:00:03.121546 ************************* CPUID dump ************************
00:00:03.121549          Raw Standard CPUID Leaves
00:00:03.121549      Leaf/sub-leaf  eax      ebx      ecx      edx
00:00:03.121550 Gst: 00000000/0000  00000016 756e6547 6c65746e 49656e69
00:00:03.121551 Hst:                00000016 756e6547 6c65746e 49656e69
00:00:03.121551 Gst: 00000001/0000  000a0652 00080800 d6fa2203 178bfbff
00:00:03.121552 Hst:                000a0652 04100800 7ffafbff bfebfbff
00:00:03.121553 Gst: 00000002/0000  76036301 00f0b5ff 00000000 00c30000
00:00:03.121553 Hst:                76036301 00f0b5ff 00000000 00c30000
00:00:03.121554 Gst: 00000003/0000  00000000 00000000 00000000 00000000
00:00:03.121554 Hst:                00000000 00000000 00000000 00000000
00:00:03.121555 Gst: 00000004/0000  1c000121 01c0003f 0000003f 00000000
00:00:03.121556 Hst:                1c004121 01c0003f 0000003f 00000000
00:00:03.121556 Gst: 00000004/0001  1c000122 01c0003f 0000003f 00000000
00:00:03.121557 Hst:                1c004122 01c0003f 0000003f 00000000
00:00:03.121557 Gst: 00000004/0002  1c000143 00c0003f 000003ff 00000000
00:00:03.121558 Hst:                1c004143 00c0003f 000003ff 00000000
00:00:03.121558 Gst: 00000004/0003  1c000163 03c0003f 00003fff 00000006
00:00:03.121559 Hst:                1c03c163 03c0003f 00003fff 00000006
00:00:03.121559 Gst: 00000004/0004  1c000000 00000000 00000000 00000000
00:00:03.121560 Hst:                00000000 00000000 00000000 00000000
00:00:03.121560 Gst: 00000005/0000  00000000 00000000 00000000 00000000
00:00:03.121560 Hst:                00000040 00000040 00000003 11142120
00:00:03.121561 Gst: 00000006/0000  00000000 00000000 00000000 00000000
00:00:03.121562 Hst:                000027f7 00000002 00000009 00000000
00:00:03.121562 Gst: 00000007/0000  00000000 00842421 00000000 30000400
00:00:03.121563 Hst:                00000000 029c67af 40000008 bc000400
00:00:03.121563 Gst: 00000007/0001  00000000 00000000 00000000 00000000
00:00:03.121563 Hst:                00000000 00000000 00000000 00000000
00:00:03.121564 Gst: 00000008/0000  00000000 00000000 00000000 00000000
00:00:03.121564 Hst:                00000000 00000000 00000000 00000000
00:00:03.121565 Gst: 00000009/0000  00000000 00000000 00000000 00000000
00:00:03.121565 Hst:                00000000 00000000 00000000 00000000
00:00:03.121565 Gst: 0000000a/0000  00000000 00000000 00000000 00000000
00:00:03.121566 Hst:                07300404 00000000 00000000 00000603
00:00:03.121566 Gst: 0000000b/0000  00000000 00000001 00000100 00000000
00:00:03.121567 Hst:                00000001 00000002 00000100 00000004
00:00:03.121567 Gst: 0000000b/0001  00000003 00000008 00000201 00000000
00:00:03.121567 Hst:                00000004 00000010 00000201 00000004
00:00:03.121568 Gst: 0000000b/0002  00000000 00000000 00000002 00000000
00:00:03.121568 Hst:                00000000 00000000 00000002 00000004
00:00:03.121569 Gst: 0000000c/0000  00000000 00000000 00000000 00000000
00:00:03.121569 Hst:                00000000 00000000 00000000 00000000
00:00:03.121569 Gst: 0000000d/0000  00000007 00000340 00000340 00000000
00:00:03.121570 Hst:                0000021f 00000440 00000a88 00000000
00:00:03.121570 Gst: 0000000d/0001  00000000 00000440 00000000 00000000
00:00:03.121571 Hst:                0000000f 00000440 00000100 00000000
00:00:03.121571 Gst: 0000000d/0002  00000100 00000240 00000000 00000000
00:00:03.121571 Hst:                00000100 00000240 00000000 00000000
00:00:03.121572 Gst: 0000000d/0003  00000000 00000000 00000000 00000000
00:00:03.121572 Hst:                00000040 000003c0 00000000 00000000
00:00:03.121573 Gst: 0000000d/0004  00000000 00000000 00000000 00000000
00:00:03.121573 Hst:                00000040 00000400 00000000 00000000
00:00:03.121573 Gst: 0000000d/0005  00000000 00000000 00000000 00000000
00:00:03.121574 Hst:                00000000 00000000 00000000 00000000
00:00:03.121574 Gst: 0000000d/0006  00000000 00000000 00000000 00000000
00:00:03.121574 Hst:                00000000 00000000 00000000 00000000
00:00:03.121575 Gst: 0000000d/0007  00000000 00000000 00000000 00000000
00:00:03.121575 Hst:                00000000 00000000 00000000 00000000
00:00:03.121576 Gst: 0000000d/0008  00000000 00000000 00000000 00000000
00:00:03.121576 Hst:                00000080 00000000 00000001 00000000
00:00:03.121576 Gst: 0000000d/0009  00000000 00000000 00000000 00000000
00:00:03.121577 Hst:                00000008 00000a80 00000000 00000000
00:00:03.121577 Gst: 0000000d/000a  00000000 00000000 00000000 00000000
00:00:03.121577 Hst:                00000000 00000000 00000000 00000000
00:00:03.121589 Gst: 0000000e/0000  00000000 00000000 00000000 00000000
00:00:03.121590 Hst:                00000000 00000000 00000000 00000000
00:00:03.121590 Gst: 0000000f/0000  00000000 00000000 00000000 00000000
00:00:03.121591 Hst:                00000000 00000000 00000000 00000000
00:00:03.121591 Gst: 00000010/0000  00000000 00000000 00000000 00000000
00:00:03.121591 Hst:                00000000 00000000 00000000 00000000
00:00:03.121592 Gst: 00000011/0000  00000000 00000000 00000000 00000000
00:00:03.121592 Hst:                00000000 00000000 00000000 00000000
00:00:03.121592 Gst: 00000012/0000  00000000 00000000 00000000 00000000
00:00:03.121593 Hst:                00000000 00000000 00000000 00000000
00:00:03.121593 Gst: 00000013/0000  00000000 00000000 00000000 00000000
00:00:03.121594 Hst:                00000000 00000000 00000000 00000000
00:00:03.121594 Gst: 00000014/0000  00000000 00000000 00000000 00000000
00:00:03.121594 Hst:                00000001 0000000f 00000007 00000000
00:00:03.121595 Hst: 00000015/0000  00000002 000000c0 00000000 00000000
00:00:03.121595 Hst: 00000016/0000  000008fc 000013ec 00000064 00000000
00:00:03.121596                                Name: GenuineIntel
00:00:03.121597                            Supports: 0x00000000-0x00000016
00:00:03.121598                              Family:  6 	Extended: 0 	Effective: 6
00:00:03.121599                               Model:  5 	Extended: 10 	Effective: 165
00:00:03.121599                            Stepping: 2
00:00:03.121600                                Type: 0 (primary)
00:00:03.121600                             APIC ID: 0x00
00:00:03.121601                        Logical CPUs: 8
00:00:03.121601                        CLFLUSH Size: 8
00:00:03.121601                            Brand ID: 0x00
00:00:03.121602 Features
00:00:03.121602   Mnemonic - Description                                  = guest (host)
00:00:03.121604   FPU - x87 FPU on Chip                                   = 1 (1)
00:00:03.121605   VME - Virtual 8086 Mode Enhancements                    = 1 (1)
00:00:03.121605   DE - Debugging extensions                               = 1 (1)
00:00:03.121606   PSE - Page Size Extension                               = 1 (1)
00:00:03.121606   TSC - Time Stamp Counter                                = 1 (1)
00:00:03.121607   MSR - Model Specific Registers                          = 1 (1)
00:00:03.121607   PAE - Physical Address Extension                        = 1 (1)
00:00:03.121608   MCE - Machine Check Exception                           = 1 (1)
00:00:03.121608   CX8 - CMPXCHG8B instruction                             = 1 (1)
00:00:03.121609   APIC - APIC On-Chip                                     = 1 (1)
00:00:03.121609   SEP - SYSENTER and SYSEXIT Present                      = 1 (1)
00:00:03.121610   MTRR - Memory Type Range Registers                      = 1 (1)
00:00:03.121610   PGE - PTE Global Bit                                    = 1 (1)
00:00:03.121611   MCA - Machine Check Architecture                        = 1 (1)
00:00:03.121611   CMOV - Conditional Move instructions                    = 1 (1)
00:00:03.121612   PAT - Page Attribute Table                              = 1 (1)
00:00:03.121612   PSE-36 - 36-bit Page Size Extension                     = 1 (1)
00:00:03.121613   PSN - Processor Serial Number                           = 0 (0)
00:00:03.121613   CLFSH - CLFLUSH instruction                             = 1 (1)
00:00:03.121614   DS - Debug Store                                        = 0 (1)
00:00:03.121614   ACPI - Thermal Mon. & Soft. Clock Ctrl.                 = 0 (1)
00:00:03.121615   MMX - Intel MMX Technology                              = 1 (1)
00:00:03.121615   FXSR - FXSAVE and FXRSTOR instructions                  = 1 (1)
00:00:03.121616   SSE - SSE support                                       = 1 (1)
00:00:03.121616   SSE2 - SSE2 support                                     = 1 (1)
00:00:03.121617   SS - Self Snoop                                         = 0 (1)
00:00:03.121617   HTT - Hyper-Threading Technology                        = 1 (1)
00:00:03.121618   TM - Therm. Monitor                                     = 0 (1)
00:00:03.121618   PBE - Pending Break Enabled                             = 0 (1)
00:00:03.121619   SSE3 - SSE3 support                                     = 1 (1)
00:00:03.121619   PCLMUL - PCLMULQDQ support (for AES-GCM)                = 1 (1)
00:00:03.121620   DTES64 - DS Area 64-bit Layout                          = 0 (1)
00:00:03.121620   MONITOR - MONITOR/MWAIT instructions                    = 0 (1)
00:00:03.121621   CPL-DS - CPL Qualified Debug Store                      = 0 (1)
00:00:03.121621   VMX - Virtual Machine Extensions                        = 0 (1)
00:00:03.121622   SMX - Safer Mode Extensions                             = 0 (1)
00:00:03.121622   EST - Enhanced SpeedStep Technology                     = 0 (1)
00:00:03.121623   TM2 - Terminal Monitor 2                                = 0 (1)
00:00:03.121623   SSSE3 - Supplemental Streaming SIMD Extensions 3        = 1 (1)
00:00:03.121623   CNTX-ID - L1 Context ID                                 = 0 (0)
00:00:03.121624   SDBG - Silicon Debug interface                          = 0 (1)
00:00:03.121624   FMA - Fused Multiply Add extensions                     = 0 (1)
00:00:03.121625   CX16 - CMPXCHG16B instruction                           = 1 (1)
00:00:03.121625   TPRUPDATE - xTPR Update Control                         = 0 (1)
00:00:03.121626   PDCM - Perf/Debug Capability MSR                        = 0 (1)
00:00:03.121626   PCID - Process Context Identifiers                      = 1 (1)
00:00:03.121627   DCA - Direct Cache Access                               = 0 (0)
00:00:03.121627   SSE4_1 - SSE4_1 support                                 = 1 (1)
00:00:03.121628   SSE4_2 - SSE4_2 support                                 = 1 (1)
00:00:03.121628   X2APIC - x2APIC support                                 = 1 (1)
00:00:03.121629   MOVBE - MOVBE instruction                               = 1 (1)
00:00:03.121629   POPCNT - POPCNT instruction                             = 1 (1)
00:00:03.121630   TSCDEADL - Time Stamp Counter Deadline                  = 0 (1)
00:00:03.121630   AES - AES instructions                                  = 1 (1)
00:00:03.121631   XSAVE - XSAVE instruction                               = 1 (1)
00:00:03.121631   OSXSAVE - OSXSAVE instruction                           = 0 (1)
00:00:03.121632   AVX - AVX support                                       = 1 (1)
00:00:03.121632   F16C - 16-bit floating point conversion instructions    = 0 (1)
00:00:03.121633   RDRAND - RDRAND instruction                             = 1 (1)
00:00:03.121633   HVP - Hypervisor Present (we're a guest)                = 1 (0)
00:00:03.121634 Structured Extended Feature Flags Enumeration (leaf 7):
00:00:03.121634   Mnemonic - Description                                  = guest (host)
00:00:03.121634   FSGSBASE - RDFSBASE/RDGSBASE/WRFSBASE/WRGSBASE instr.   = 1 (1)
00:00:03.121635   TSCADJUST - Supports MSR_IA32_TSC_ADJUST                = 0 (1)
00:00:03.121635   SGX - Supports Software Guard Extensions                = 0 (1)
00:00:03.121636   BMI1 - Advanced Bit Manipulation extension 1            = 0 (1)
00:00:03.121636   HLE - Hardware Lock Elision                             = 0 (0)
00:00:03.121637   AVX2 - Advanced Vector Extensions 2                     = 1 (1)
00:00:03.121637   FDP_EXCPTN_ONLY - FPU DP only updated on exceptions     = 0 (0)
00:00:03.121638   SMEP - Supervisor Mode Execution Prevention             = 0 (1)
00:00:03.121638   BMI2 - Advanced Bit Manipulation extension 2            = 0 (1)
00:00:03.121638   ERMS - Enhanced REP MOVSB/STOSB instructions            = 0 (1)
00:00:03.121639   INVPCID - INVPCID instruction                           = 1 (1)
00:00:03.121639   RTM - Restricted Transactional Memory                   = 0 (0)
00:00:03.121640   PQM - Platform Quality of Service Monitoring            = 0 (0)
00:00:03.121640   DEPFPU_CS_DS - Deprecates FPU CS, FPU DS values if set  = 1 (1)
00:00:03.121641   MPE - Intel Memory Protection Extensions                = 0 (1)
00:00:03.121641   PQE - Platform Quality of Service Enforcement           = 0 (0)
00:00:03.121641   AVX512F - AVX512 Foundation instructions                = 0 (0)
00:00:03.121642   RDSEED - RDSEED instruction                             = 1 (1)
00:00:03.121642   ADX - ADCX/ADOX instructions                            = 0 (1)
00:00:03.121643   SMAP - Supervisor Mode Access Prevention                = 0 (1)
00:00:03.121643   CLFLUSHOPT - CLFLUSHOPT (Cache Line Flush) instruction  = 1 (1)
00:00:03.121644   INTEL_PT - Intel Processor Trace                        = 0 (1)
00:00:03.121644   AVX512PF - AVX512 Prefetch instructions                 = 0 (0)
00:00:03.121645   AVX512ER - AVX512 Exponential & Reciprocal instructions = 0 (0)
00:00:03.121645   AVX512CD - AVX512 Conflict Detection instructions       = 0 (0)
00:00:03.121646   SHA - Secure Hash Algorithm extensions                  = 0 (0)
00:00:03.121646   PREFETCHWT1 - PREFETCHWT1 instruction                   = 0 (0)
00:00:03.121647   UMIP - User mode insturction prevention                 = 0 (0)
00:00:03.121647   PKU - Protection Key for Usermode pages                 = 0 (1)
00:00:03.121647   OSPKE - CR4.PKU mirror                                  = 0 (0)
00:00:03.121648   MAWAU - Value used by BNDLDX & BNDSTX                   = 0x0 (0x0)
00:00:03.121649   RDPID - Read processor ID support                       = 0 (0)
00:00:03.121649   SGX_LC - Supports SGX Launch Configuration              = 0 (1)
00:00:03.121649   MD_CLEAR - Supports MDS related buffer clearing         = 1 (1)
00:00:03.121650   IBRS_IBPB - IA32_SPEC_CTRL.IBRS and IA32_PRED_CMD.IBPB  = 0 (1)
00:00:03.121650   STIBP - Supports IA32_SPEC_CTRL.STIBP                   = 0 (1)
00:00:03.121651   FLUSH_CMD - Supports IA32_FLUSH_CMD                     = 1 (1)
00:00:03.121651   ARCHCAP - Supports IA32_ARCH_CAP                        = 1 (1)
00:00:03.121652   CORECAP - Supports IA32_CORE_CAP                        = 0 (0)
00:00:03.121652   SSBD - Supports IA32_SPEC_CTRL.SSBD                     = 0 (1)
00:00:03.121653 Processor Extended State Enumeration (leaf 0xd):
00:00:03.121653    XSAVE area cur/max size by XCR0, guest: 0x340/0x340
00:00:03.121654     XSAVE area cur/max size by XCR0, host: 0x440/0xa88
00:00:03.121654                    Valid XCR0 bits, guest: 0x00000000`00000007 ( x87 SSE YMM_Hi128 )
00:00:03.121655                     Valid XCR0 bits, host: 0x00000000`0000021f ( x87 SSE YMM_Hi128 BNDREGS BNDCSR 9 )
00:00:03.121657                     XSAVE features, guest:
00:00:03.121657                      XSAVE features, host: XSAVEOPT XSAVEC XGETBC1 XSAVES
00:00:03.121658       XSAVE area cur size XCR0|XSS, guest: 0x440
00:00:03.121658        XSAVE area cur size XCR0|XSS, host: 0x440
00:00:03.121658                Valid IA32_XSS bits, guest: 0x00000000`00000000
00:00:03.121659                 Valid IA32_XSS bits, host: 0x00000100`00000000 ( 40 )
00:00:03.121660   State #2, guest: off=0x0240, cb=0x0100 IA32_XSS-bit -- YMM_Hi128
00:00:03.121661   State #2, host:  off=0x0240, cb=0x0100 IA32_XSS-bit -- YMM_Hi128
00:00:03.121661   State #3, host:  off=0x03c0, cb=0x0040 IA32_XSS-bit -- BNDREGS
00:00:03.121662   State #4, host:  off=0x0400, cb=0x0040 IA32_XSS-bit -- BNDCSR
00:00:03.121663   State #8, host:  off=0x0000, cb=0x0080 XCR0-bit -- 8
00:00:03.121664   State #9, host:  off=0x0a80, cb=0x0008 IA32_XSS-bit -- 9
00:00:03.121670          Unknown CPUID Leaves
00:00:03.121670      Leaf/sub-leaf  eax      ebx      ecx      edx
00:00:03.121670 Gst: 00000014/0001  00000000 00000000 00000000 00000000
00:00:03.121671 Hst:                02490002 003f3fff 00000000 00000000
00:00:03.121671 Gst: 00000014/0002  00000000 00000000 00000000 00000000
00:00:03.121672 Hst:                00000000 00000000 00000000 00000000
00:00:03.121672 Gst: 00000015/0000  00000000 00000000 00000000 00000000
00:00:03.121672 Hst:                00000002 000000c0 00000000 00000000
00:00:03.121673 Gst: 00000016/0000  00000000 00000000 00000000 00000000
00:00:03.121673 Hst:                000008fc 000013ec 00000064 00000000
00:00:03.121674          Raw Hypervisor CPUID Leaves
00:00:03.121675      Leaf/sub-leaf  eax      ebx      ecx      edx
00:00:03.121675 Gst: 40000000/0000  40000001 4b4d564b 564b4d56 0000004d
00:00:03.121676 Hst:                000008fc 000013ec 00000064 00000000
00:00:03.121676 Gst: 40000001/0000  01000089 00000000 00000000 00000000
00:00:03.121677 Hst:                000008fc 000013ec 00000064 00000000
00:00:03.121677          Raw Extended CPUID Leaves
00:00:03.121678      Leaf/sub-leaf  eax      ebx      ecx      edx
00:00:03.121678 Gst: 80000000/0000  80000008 00000000 00000000 00000000
00:00:03.121678 Hst:                80000008 00000000 00000000 00000000
00:00:03.121679 Gst: 80000001/0000  00000000 00000000 00000121 28100800
00:00:03.121679 Hst:                00000000 00000000 00000121 2c100800
00:00:03.121680 Gst: 80000002/0000  65746e49 2952286c 726f4320 4d542865
00:00:03.121681 Hst:                65746e49 2952286c 726f4320 4d542865
00:00:03.121682 Gst: 80000003/0000  37692029 3830312d 20483537 20555043
00:00:03.121682 Hst:                37692029 3830312d 20483537 20555043
00:00:03.121683 Gst: 80000004/0000  2e322040 48473033 0000007a 00000000
00:00:03.121684 Hst:                2e322040 48473033 0000007a 00000000
00:00:03.121684 Gst: 80000005/0000  00000000 00000000 00000000 00000000
00:00:03.121684 Hst:                00000000 00000000 00000000 00000000
00:00:03.121685 Gst: 80000006/0000  00000000 00000000 01006040 00000000
00:00:03.121685 Hst:                00000000 00000000 01006040 00000000
00:00:03.121686 Gst: 80000007/0000  00000000 00000000 00000000 00000100
00:00:03.121686 Hst:                00000000 00000000 00000000 00000100
00:00:03.121686 Gst: 80000008/0000  00003027 00000000 00000000 00000000
00:00:03.121687 Hst:                00003027 00000000 00000000 00000000
00:00:03.121687 Ext Name:                        
00:00:03.121688 Ext Supports:                    0x80000000-0x80000008
00:00:03.121688 Family:                          0  	Extended: 0 	Effective: 0
00:00:03.121688 Model:                           0  	Extended: 0 	Effective: 0
00:00:03.121689 Stepping:                        0
00:00:03.121689 Brand ID:                        0x000
00:00:03.121689 Ext Features
00:00:03.121690   Mnemonic - Description                                  = guest (host)
00:00:03.121690   FPU - x87 FPU on Chip                                   = 0 (0)
00:00:03.121691   VME - Virtual 8086 Mode Enhancements                    = 0 (0)
00:00:03.121692   DE - Debugging extensions                               = 0 (0)
00:00:03.121692   PSE - Page Size Extension                               = 0 (0)
00:00:03.121693   TSC - Time Stamp Counter                                = 0 (0)
00:00:03.121693   MSR - K86 Model Specific Registers                      = 0 (0)
00:00:03.121694   PAE - Physical Address Extension                        = 0 (0)
00:00:03.121694   MCE - Machine Check Exception                           = 0 (0)
00:00:03.121694   CX8 - CMPXCHG8B instruction                             = 0 (0)
00:00:03.121695   APIC - APIC On-Chip                                     = 0 (0)
00:00:03.121696   SEP - SYSCALL/SYSRET                                    = 1 (1)
00:00:03.121696   MTRR - Memory Type Range Registers                      = 0 (0)
00:00:03.121696   PGE - PTE Global Bit                                    = 0 (0)
00:00:03.121697   MCA - Machine Check Architecture                        = 0 (0)
00:00:03.121697   CMOV - Conditional Move instructions                    = 0 (0)
00:00:03.121698   PAT - Page Attribute Table                              = 0 (0)
00:00:03.121698   PSE-36 - 36-bit Page Size Extension                     = 0 (0)
00:00:03.121699   NX - No-Execute/Execute-Disable                         = 1 (1)
00:00:03.121699   AXMMX - AMD Extensions to MMX instructions              = 0 (0)
00:00:03.121700   MMX - Intel MMX Technology                              = 0 (0)
00:00:03.121700   FXSR - FXSAVE and FXRSTOR Instructions                  = 0 (0)
00:00:03.121701   FFXSR - AMD fast FXSAVE and FXRSTOR instructions        = 0 (0)
00:00:03.121701   Page1GB - 1 GB large page                               = 0 (1)
00:00:03.121702   RDTSCP - RDTSCP instruction                             = 1 (1)
00:00:03.121702   LM - AMD64 Long Mode                                    = 1 (1)
00:00:03.121703   3DNOWEXT - AMD Extensions to 3DNow                      = 0 (0)
00:00:03.121703   3DNOW - AMD 3DNow                                       = 0 (0)
00:00:03.121704   LahfSahf - LAHF/SAHF support in 64-bit mode             = 1 (1)
00:00:03.121704   CmpLegacy - Core multi-processing legacy mode           = 0 (0)
00:00:03.121705   SVM - AMD Secure Virtual Machine extensions             = 0 (0)
00:00:03.121705   EXTAPIC - AMD Extended APIC registers                   = 0 (0)
00:00:03.121705   CR8L - AMD LOCK MOV CR0 means MOV CR8                   = 0 (0)
00:00:03.121706   ABM - AMD Advanced Bit Manipulation                     = 1 (1)
00:00:03.121706   SSE4A - SSE4A instructions                              = 0 (0)
00:00:03.121707   MISALIGNSSE - AMD Misaligned SSE mode                   = 0 (0)
00:00:03.121707   3DNOWPRF - AMD PREFETCH and PREFETCHW instructions      = 1 (1)
00:00:03.121708   OSVW - AMD OS Visible Workaround                        = 0 (0)
00:00:03.121708   IBS - Instruct Based Sampling                           = 0 (0)
00:00:03.121709   XOP - Extended Operation support                        = 0 (0)
00:00:03.121709   SKINIT - SKINIT, STGI, and DEV support                  = 0 (0)
00:00:03.121710   WDT - AMD Watchdog Timer support                        = 0 (0)
00:00:03.121710   LWP - Lightweight Profiling support                     = 0 (0)
00:00:03.121710   FMA4 - Four operand FMA instruction support             = 0 (0)
00:00:03.121711   NodeId - NodeId in MSR C001_100C                        = 0 (0)
00:00:03.121711   TBM - Trailing Bit Manipulation instructions            = 0 (0)
00:00:03.121712   TOPOEXT - Topology Extensions                           = 0 (0)
00:00:03.121712   PRFEXTCORE - Performance Counter Extensions support     = 0 (0)
00:00:03.121713   PRFEXTNB - NB Performance Counter Extensions support    = 0 (0)
00:00:03.121713   DATABPEXT - Data-access Breakpoint Extension            = 0 (0)
00:00:03.121714   PERFTSC - Performance Time Stamp Counter                = 0 (0)
00:00:03.121714   PCX_L2I - L2I/L3 Performance Counter Extensions         = 0 (0)
00:00:03.121714   MWAITX - MWAITX and MONITORX instructions               = 0 (0)
00:00:03.121715 Full Name:                       "Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz"
00:00:03.121716 TLB 2/4M Instr/Uni:              res0     0 entries
00:00:03.121716 TLB 2/4M Data:                   res0     0 entries
00:00:03.121716 TLB 4K Instr/Uni:                res0     0 entries
00:00:03.121717 TLB 4K Data:                     res0     0 entries
00:00:03.121717 L1 Instr Cache Line Size:        0 bytes
00:00:03.121717 L1 Instr Cache Lines Per Tag:    0
00:00:03.121717 L1 Instr Cache Associativity:    res0  
00:00:03.121718 L1 Instr Cache Size:             0 KB
00:00:03.121718 L1 Data Cache Line Size:         0 bytes
00:00:03.121718 L1 Data Cache Lines Per Tag:     0
00:00:03.121718 L1 Data Cache Associativity:     res0  
00:00:03.121719 L1 Data Cache Size:              0 KB
00:00:03.121719 L2 TLB 2/4M Instr/Uni:           off       0 entries
00:00:03.121719 L2 TLB 2/4M Data:                off       0 entries
00:00:03.121720 L2 TLB 4K Instr/Uni:             off       0 entries
00:00:03.121720 L2 TLB 4K Data:                  off       0 entries
00:00:03.121720 L2 Cache Line Size:              0 bytes
00:00:03.121720 L2 Cache Lines Per Tag:          0
00:00:03.121720 L2 Cache Associativity:          off   
00:00:03.121721 L2 Cache Size:                   0 KB
00:00:03.121721   TS - Temperature Sensor                                 = 0 (0)
00:00:03.121722   FID - Frequency ID control                              = 0 (0)
00:00:03.121722   VID - Voltage ID control                                = 0 (0)
00:00:03.121723   TscInvariant - Invariant Time Stamp Counter             = 1 (1)
00:00:03.121723   CBP - Core Performance Boost                            = 0 (0)
00:00:03.121724   EffFreqRO - Read-only Effective Frequency Interface     = 0 (0)
00:00:03.121724   ProcFdbkIf - Processor Feedback Interface               = 0 (0)
00:00:03.121725   ProcPwrRep - Core power reporting interface support     = 0 (0)
00:00:03.121725 Physical Address Width:          39 bits
00:00:03.121725 Virtual Address Width:           48 bits
00:00:03.121726 Guest Physical Address Width:    0 bits
00:00:03.121726 Physical Core Count:             1
00:00:03.121727 
Can anyone point me in the right direction here? I see there is a way to set cpuid with modifyvm, but the 0xb leaf is a bit complex and the modifyvm command can't account for the variation in the x2APIC field as far as I can tell. Maybe the kernel does't care????

What do I have to do to get my guest to recognize the cpu supports 2 threads per processor?

Thanks for any help.
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Hyperthreading not enabled on linux guest

Post by fth0 »

brians-vbox wrote:What do I have to do to get my guest to recognize the cpu supports 2 threads per processor?
You cannot do that.

In the VM configuration, you define a number <n> of virtual CPUs (vCPUs), for example 2 (preferred), 8, 16, 32 (the latter only via command line). To the guest, VirtualBox then provides <n> single-threaded CPU cores. On the host, VirtualBox creates <n> OS threads inside the VirtualBoxVM process named EMT-0 to EMT-<n-1>. The host OS scheduler then decides at any time which OS thread to execute on which CPU hyperthread.

You can verify this with your favorite task manager on the host, if you like. Let a VM with 2 vCPUs do some work, and see which host CPU cores/hyperthreads are busy. The results depend on the host OS, BTW.
brians-vbox
Posts: 7
Joined: 8. May 2020, 21:17

Re: Hyperthreading not enabled on linux guest

Post by brians-vbox »

Hi and thanks for the explanation. That certainly makes sense.

I did as you suggested and monitored the usage of the 16 "logical" CPUs in Windows under a heavy guest workload using parallel GNU make -j <n> on a large project.

When VirtualBox is configured with 8 virtual processors to match the 8 physical cores of my CPU, I see 8 of the 16 logical CPUs in Windows active. It appears that Windows assigns each of these threads to a different physical core as the resource monitor shows every other CPU active. Increasing the number of virtual processors under the same workload resulted in utilization of the other logical CPUs (i.e., hyperthreading in use.)

I then timed the compile on various settings of <n> virtual processors assigned to the guest.

Code: Select all

n    real    delta 
----------------------
8    343    0
10   329   -4%
14   316   -8%
16   305   -11%

n = number of virtual processors configured in vbox and passed to make with -j <n>
real = real time in seconds average of 2 runs 
delta = percentage speed up
These results are about what I expected: a modest increase in performance as the additional threads are run as hyperthreads (and thus sharing physical cores with other threads.)

It would be interesting to compare this to non-virtualized performance (I may setup a dual boot to do that at some point in the future.) The main question to me is how much better (if at all) would linux do scheduling the threads if it was aware of the physical layout of the CPU? Then if there was an advantage, could this be realized if VirtualBox exposed this to the guest virtual processor? I suppose much would have to do on how much Windows gets in the way. It is also quite possible that it makes no difference in my application.

Do you know if Oracle has done any work, or plans to do any work on exposing hyperthreading to the guest? A quick glance seems to indicate this is supported on VMware. The problem with over-subscribing the number of virtual processors in VirtualBox is that it precludes reserving a core for the host. Although, I've never done so in the past and have yet to see any negative consequences other than lack of responsiveness on the host. Most of the time I'm exclusively using the guest anyway. Do you know what the worst case consequences are to over-subscribing? Can the host get starved by the guest such that Windows will crash or somehow otherwise go off to never-never land?

Regards,
Brian
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Hyperthreading not enabled on linux guest

Post by fth0 »

brians-vbox wrote:When VirtualBox is configured with 8 virtual processors to match the 8 physical cores of my CPU, I see 8 of the 16 logical CPUs in Windows active. It appears that Windows assigns each of these threads to a different physical core as the resource monitor shows every other CPU active.
Well, sort of. Starting with 8 vCPUs prevented you from seeing the truth. ;)

Start with 4 vCPUs instead, and you'll (probably *) still see 8 logical CPUs in Windows being active. For the sake of simplicity, you can imagine each of the 4 OS threads being scheduled every millisecond for execution on an idle CPU. Therefore, it looks like all logical CPUs simultaneously take (nearly) the same load. Windows will try to prevent scheduling a second OS thread on one CPU core unless necessary, as you already discovered.

If you take a Linux host instead, you'll (probably *) see only 4 logical CPUs being active, and visibly jumping around between the 16 logical CPUs every other second or so, also not scheduling a second OS thread on one CPU core unless necessary.

(*) I analyzed this myself some months ago, using Windows 10 and Linux Mint 20, both being consumer grade OSs. So I'm not sure if this also holds true for the server OS variants, which are typically used for high load operations like compiling.
brians-vbox wrote:The main question to me is how much better (if at all) would linux do scheduling the threads if it was aware of the physical layout of the CPU?
The most important part is the OS on the host, which naturally is aware of the physical layout of the CPU, and is also the only one scheduling on the physical CPU. The guest Os comes second. Because of the different scheduling behaviors described above, I'd use Linux for both. If or how much better it is? A difficult question, because several more performance aspects also play a significant role, like memory size and throughput, disk I/O, ...
brians-vbox wrote:Do you know if Oracle has done any work, or plans to do any work on exposing hyperthreading to the guest?
I only know that they tried to do it in the past, without good results, and didn't continue with it, so I wouldn't hold my breath ...
brians-vbox wrote:Do you know what the worst case consequences are to over-subscribing? Can the host get starved by the guest such that Windows will crash or somehow otherwise go off to never-never land?
Yes, anything is possible. But it is not as easy at it seems. ;)
brians-vbox
Posts: 7
Joined: 8. May 2020, 21:17

Re: Hyperthreading not enabled on linux guest

Post by brians-vbox »

Great info. Thanks for helping me see the light. :D
Post Reply